@simonren/quorum 0.9.1 → 0.11.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.
Files changed (68) hide show
  1. package/README.md +91 -48
  2. package/commands/multi-consult.md +47 -72
  3. package/commands/multi-review.md +68 -99
  4. package/dist/adapters/base.d.ts +53 -70
  5. package/dist/adapters/base.js +21 -79
  6. package/dist/adapters/claude.d.ts +38 -17
  7. package/dist/adapters/claude.js +93 -185
  8. package/dist/adapters/cli-adapter.d.ts +78 -0
  9. package/dist/adapters/cli-adapter.js +217 -0
  10. package/dist/adapters/codex.d.ts +18 -13
  11. package/dist/adapters/codex.js +64 -200
  12. package/dist/adapters/gemini.d.ts +30 -21
  13. package/dist/adapters/gemini.js +55 -149
  14. package/dist/adapters/index.d.ts +8 -5
  15. package/dist/adapters/index.js +7 -8
  16. package/dist/config.d.ts +98 -28
  17. package/dist/config.js +44 -25
  18. package/dist/consult-prompt.d.ts +6 -5
  19. package/dist/consult-prompt.js +48 -23
  20. package/dist/decoders/claude.d.ts +6 -0
  21. package/dist/decoders/claude.js +10 -1
  22. package/dist/doctor.d.ts +20 -0
  23. package/dist/doctor.js +91 -0
  24. package/dist/executor.d.ts +58 -46
  25. package/dist/executor.js +218 -129
  26. package/dist/guards.d.ts +29 -0
  27. package/dist/guards.js +72 -0
  28. package/dist/handoff.d.ts +79 -229
  29. package/dist/handoff.js +411 -402
  30. package/dist/index.d.ts +8 -12
  31. package/dist/index.js +81 -106
  32. package/dist/integrity.d.ts +16 -0
  33. package/dist/integrity.js +49 -0
  34. package/dist/sections.d.ts +22 -0
  35. package/dist/sections.js +31 -0
  36. package/dist/server.d.ts +9 -0
  37. package/dist/server.js +36 -0
  38. package/dist/tools/consult.d.ts +17 -76
  39. package/dist/tools/consult.js +72 -188
  40. package/dist/tools/format.d.ts +35 -0
  41. package/dist/tools/format.js +85 -0
  42. package/dist/tools/review.d.ts +55 -0
  43. package/dist/tools/review.js +120 -0
  44. package/dist/types.d.ts +20 -103
  45. package/dist/types.js +18 -29
  46. package/package.json +7 -4
  47. package/dist/cli/check.d.ts +0 -20
  48. package/dist/cli/check.js +0 -78
  49. package/dist/cli/codex.d.ts +0 -11
  50. package/dist/cli/codex.js +0 -255
  51. package/dist/cli/gemini.d.ts +0 -12
  52. package/dist/cli/gemini.js +0 -253
  53. package/dist/context.d.ts +0 -1538
  54. package/dist/context.js +0 -383
  55. package/dist/decoders/gemini.d.ts +0 -33
  56. package/dist/decoders/gemini.js +0 -58
  57. package/dist/errors.d.ts +0 -46
  58. package/dist/errors.js +0 -198
  59. package/dist/pipeline.d.ts +0 -135
  60. package/dist/pipeline.js +0 -462
  61. package/dist/prompt-v2.d.ts +0 -38
  62. package/dist/prompt-v2.js +0 -391
  63. package/dist/prompt.d.ts +0 -71
  64. package/dist/prompt.js +0 -309
  65. package/dist/schema.d.ts +0 -660
  66. package/dist/schema.js +0 -536
  67. package/dist/tools/feedback.d.ts +0 -91
  68. package/dist/tools/feedback.js +0 -117
package/dist/types.d.ts CHANGED
@@ -1,105 +1,22 @@
1
1
  /**
2
- * Types for AI Reviewer MCP Server
2
+ * Shared primitive types for the quorum MCP server.
3
+ *
4
+ * The `as const` tuples are the single source of truth for the enums: the Zod
5
+ * input schemas (and therefore the JSON schemas advertised to the MCP client)
6
+ * are derived from them, so a value added here shows up everywhere.
3
7
  */
4
- export type OutputType = 'plan' | 'findings' | 'analysis' | 'proposal';
5
- export type FocusArea = 'security' | 'performance' | 'architecture' | 'correctness' | 'maintainability' | 'scalability' | 'testing' | 'documentation';
6
- export type CliType = 'codex' | 'gemini' | 'claude';
7
- export type ReasoningEffort = 'high' | 'xhigh';
8
- export type ServiceTier = 'default' | 'fast' | 'flex';
9
- export interface FeedbackRequest {
10
- workingDir: string;
11
- ccOutput: string;
12
- outputType: OutputType;
13
- analyzedFiles?: string[];
14
- focusAreas?: FocusArea[];
15
- customPrompt?: string;
16
- reasoningEffort?: ReasoningEffort;
17
- serviceTier?: ServiceTier;
18
- }
19
- export interface FeedbackSuccess {
20
- success: true;
21
- feedback: string;
22
- model: CliType;
23
- }
24
- export interface FeedbackFailure {
25
- success: false;
26
- error: FeedbackError;
27
- suggestion?: string;
28
- model: CliType;
29
- }
30
- export type FeedbackResult = FeedbackSuccess | FeedbackFailure;
31
- export type FeedbackError = {
32
- type: 'cli_not_found';
33
- cli: CliType;
34
- installCmd: string;
35
- } | {
36
- type: 'timeout';
37
- cli: CliType;
38
- durationMs: number;
39
- } | {
40
- type: 'rate_limit';
41
- cli: CliType;
42
- retryAfterMs?: number;
43
- } | {
44
- type: 'auth_error';
45
- cli: CliType;
46
- message: string;
47
- } | {
48
- type: 'invalid_response';
49
- cli: CliType;
50
- rawOutput: string;
51
- } | {
52
- type: 'cli_error';
53
- cli: CliType;
54
- exitCode: number;
55
- stderr: string;
56
- };
57
- export interface MultiFeedbackResult {
58
- successful: Array<{
59
- model: CliType;
60
- feedback: string;
61
- }>;
62
- failed: Array<{
63
- model: CliType;
64
- error: FeedbackError;
65
- }>;
66
- partialSuccess: boolean;
67
- allFailed: boolean;
68
- }
69
- export interface CliStatus {
70
- codex: boolean;
71
- gemini: boolean;
72
- claude: boolean;
73
- }
74
- export interface StructuredFeedback {
75
- agreements: Array<{
76
- finding: string;
77
- reason: string;
78
- }>;
79
- disagreements: Array<{
80
- finding: string;
81
- reason: string;
82
- correction: string;
83
- }>;
84
- additions: Array<{
85
- finding: string;
86
- location: string;
87
- impact: string;
88
- }>;
89
- alternatives: Array<{
90
- topic: string;
91
- alternative: string;
92
- tradeoffs: string;
93
- }>;
94
- riskAssessment: {
95
- level: 'Low' | 'Medium' | 'High';
96
- reason: string;
97
- };
98
- }
99
- export interface ReviewerPersona {
100
- name: string;
101
- focus: string;
102
- style: string;
103
- }
104
- export declare const REVIEWER_PERSONAS: Record<CliType, ReviewerPersona>;
105
- export declare const FOCUS_AREA_DESCRIPTIONS: Record<FocusArea, string>;
8
+ /** What kind of CC-produced work a review is looking at. */
9
+ export declare const OUTPUT_TYPES: readonly ["implementation", "plan", "findings", "analysis", "proposal"];
10
+ export type OutputType = (typeof OUTPUT_TYPES)[number];
11
+ /** Review focus areas a caller may ask the panel to weight. */
12
+ export declare const FOCUS_AREAS: readonly ["security", "performance", "architecture", "correctness", "maintainability", "scalability", "testing", "documentation"];
13
+ export type FocusArea = (typeof FOCUS_AREAS)[number];
14
+ /** Codex reasoning effort. */
15
+ export declare const REASONING_EFFORTS: readonly ["high", "xhigh"];
16
+ export type ReasoningEffort = (typeof REASONING_EFFORTS)[number];
17
+ /** Codex service tier (speed/cost trade-off). */
18
+ export declare const SERVICE_TIERS: readonly ["default", "fast", "flex"];
19
+ export type ServiceTier = (typeof SERVICE_TIERS)[number];
20
+ /** Claude Code `--effort` levels. */
21
+ export declare const CLAUDE_EFFORTS: readonly ["low", "medium", "high", "xhigh", "max"];
22
+ export type ClaudeEffort = (typeof CLAUDE_EFFORTS)[number];
package/dist/types.js CHANGED
@@ -1,31 +1,20 @@
1
1
  /**
2
- * Types for AI Reviewer MCP Server
2
+ * Shared primitive types for the quorum MCP server.
3
+ *
4
+ * The `as const` tuples are the single source of truth for the enums: the Zod
5
+ * input schemas (and therefore the JSON schemas advertised to the MCP client)
6
+ * are derived from them, so a value added here shows up everywhere.
3
7
  */
4
- export const REVIEWER_PERSONAS = {
5
- codex: {
6
- name: 'Codex',
7
- focus: 'correctness, edge cases, performance',
8
- style: 'Apply pragmatic skepticism - verify before agreeing.'
9
- },
10
- gemini: {
11
- name: 'Gemini',
12
- focus: 'design patterns, scalability, tech debt',
13
- style: 'Think holistically - consider broader context.'
14
- },
15
- claude: {
16
- name: 'Claude',
17
- focus: 'deep analysis, correctness, security, architecture',
18
- style: 'Fresh perspective with clean context - challenge assumptions.'
19
- }
20
- };
21
- // Focus area descriptions
22
- export const FOCUS_AREA_DESCRIPTIONS = {
23
- security: 'Vulnerabilities, auth, input validation',
24
- performance: 'Speed, memory, efficiency',
25
- architecture: 'Design patterns, structure, coupling',
26
- correctness: 'Logic errors, edge cases, bugs',
27
- maintainability: 'Code clarity, documentation, complexity',
28
- scalability: 'Load handling, bottlenecks',
29
- testing: 'Test coverage, test quality',
30
- documentation: 'Comments, docs, API docs'
31
- };
8
+ /** What kind of CC-produced work a review is looking at. */
9
+ export const OUTPUT_TYPES = ['implementation', 'plan', 'findings', 'analysis', 'proposal'];
10
+ /** Review focus areas a caller may ask the panel to weight. */
11
+ export const FOCUS_AREAS = [
12
+ 'security', 'performance', 'architecture', 'correctness',
13
+ 'maintainability', 'scalability', 'testing', 'documentation',
14
+ ];
15
+ /** Codex reasoning effort. */
16
+ export const REASONING_EFFORTS = ['high', 'xhigh'];
17
+ /** Codex service tier (speed/cost trade-off). */
18
+ export const SERVICE_TIERS = ['default', 'fast', 'flex'];
19
+ /** Claude Code `--effort` levels. */
20
+ export const CLAUDE_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simonren/quorum",
3
- "version": "0.9.1",
4
- "description": "MCP server for Claude Code — a quorum of AI models (Codex, Gemini, Claude) for adversarial review and consultation, synthesized by Claude Code",
3
+ "version": "0.11.0",
4
+ "description": "MCP server for Claude Code — a quorum of AI models (Codex, Gemini, Claude Fable with fresh context) for standard + adversarial review and consultation, synthesized by Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -34,6 +34,9 @@
34
34
  ],
35
35
  "author": "SimonRen",
36
36
  "license": "MIT",
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
37
40
  "publishConfig": {
38
41
  "access": "public"
39
42
  },
@@ -43,8 +46,8 @@
43
46
  },
44
47
  "homepage": "https://github.com/SimonRen/quorum#readme",
45
48
  "dependencies": {
46
- "@modelcontextprotocol/sdk": "^1.0.0",
47
- "zod": "^3.22.0"
49
+ "@modelcontextprotocol/sdk": "^1.25.2",
50
+ "zod": "^3.25.0"
48
51
  },
49
52
  "devDependencies": {
50
53
  "@types/node": "^20.0.0",
@@ -1,20 +0,0 @@
1
- /**
2
- * CLI Availability Checker
3
- */
4
- import { CliStatus, CliType } from '../types.js';
5
- /**
6
- * Check availability of all supported CLIs
7
- */
8
- export declare function checkCliAvailability(): Promise<CliStatus>;
9
- /**
10
- * Check if a specific CLI is available
11
- */
12
- export declare function isCliAvailable(cli: CliType): Promise<boolean>;
13
- /**
14
- * Get CLI version (for debugging)
15
- */
16
- export declare function getCliVersion(cli: CliType): Promise<string | null>;
17
- /**
18
- * Log CLI availability status (for startup debugging)
19
- */
20
- export declare function logCliStatus(): Promise<void>;
package/dist/cli/check.js DELETED
@@ -1,78 +0,0 @@
1
- /**
2
- * CLI Availability Checker
3
- */
4
- import { spawn } from 'child_process';
5
- /**
6
- * Check if a command exists on the system
7
- */
8
- async function commandExists(command) {
9
- return new Promise((resolve) => {
10
- const proc = spawn('which', [command], {
11
- stdio: ['ignore', 'pipe', 'ignore']
12
- });
13
- proc.on('close', (code) => {
14
- resolve(code === 0);
15
- });
16
- proc.on('error', () => {
17
- resolve(false);
18
- });
19
- });
20
- }
21
- /**
22
- * Check availability of all supported CLIs
23
- */
24
- export async function checkCliAvailability() {
25
- const [codex, gemini, claude] = await Promise.all([
26
- commandExists('codex'),
27
- commandExists('gemini'),
28
- commandExists('claude')
29
- ]);
30
- return { codex, gemini, claude };
31
- }
32
- /**
33
- * Check if a specific CLI is available
34
- */
35
- export async function isCliAvailable(cli) {
36
- return commandExists(cli);
37
- }
38
- /**
39
- * Get CLI version (for debugging)
40
- */
41
- export async function getCliVersion(cli) {
42
- return new Promise((resolve) => {
43
- const proc = spawn(cli, ['--version'], {
44
- stdio: ['ignore', 'pipe', 'pipe']
45
- });
46
- let stdout = '';
47
- proc.stdout.on('data', (data) => {
48
- stdout += data.toString();
49
- });
50
- proc.on('close', (code) => {
51
- if (code === 0 && stdout) {
52
- resolve(stdout.trim().split('\n')[0]);
53
- }
54
- else {
55
- resolve(null);
56
- }
57
- });
58
- proc.on('error', () => {
59
- resolve(null);
60
- });
61
- });
62
- }
63
- /**
64
- * Log CLI availability status (for startup debugging)
65
- */
66
- export async function logCliStatus() {
67
- const status = await checkCliAvailability();
68
- console.error('AI Reviewer CLI Status:');
69
- console.error(` - Codex: ${status.codex ? '✓ Available' : '✗ Not found'}`);
70
- console.error(` - Gemini: ${status.gemini ? '✓ Available' : '✗ Not found'}`);
71
- console.error(` - Claude: ${status.claude ? '✓ Available' : '✗ Not found'}`);
72
- if (!status.codex && !status.gemini && !status.claude) {
73
- console.error('\nWarning: No AI CLIs found. Install at least one:');
74
- console.error(' npm install -g @openai/codex-cli');
75
- console.error(' npm install -g @google/gemini-cli');
76
- console.error(' Claude Code: https://docs.anthropic.com/en/docs/claude-code');
77
- }
78
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Codex CLI Wrapper
3
- *
4
- * Uses OpenAI's Codex CLI in non-interactive mode (codex exec)
5
- * Reference: https://developers.openai.com/codex/cli/reference/
6
- */
7
- import { FeedbackRequest, FeedbackResult } from '../types.js';
8
- /**
9
- * Run Codex CLI with the given request
10
- */
11
- export declare function runCodexReview(request: FeedbackRequest): Promise<FeedbackResult>;
package/dist/cli/codex.js DELETED
@@ -1,255 +0,0 @@
1
- /**
2
- * Codex CLI Wrapper
3
- *
4
- * Uses OpenAI's Codex CLI in non-interactive mode (codex exec)
5
- * Reference: https://developers.openai.com/codex/cli/reference/
6
- */
7
- import { spawn } from 'child_process';
8
- import { existsSync } from 'fs';
9
- import { build7SectionPrompt, buildDeveloperInstructions, buildRetryPrompt, isValidFeedbackOutput } from '../prompt.js';
10
- import { createTimeoutError, createCliNotFoundError, getSuggestion } from '../errors.js';
11
- // Activity-based timeout: reset on output, kill on silence
12
- const INACTIVITY_TIMEOUT_MS = 120000; // 2 min of no output = timeout
13
- const MAX_TIMEOUT_MS = 3600000; // 60 min absolute max (edge case safety)
14
- const MAX_RETRIES = 2;
15
- const MAX_BUFFER_SIZE = 1024 * 1024; // 1MB max buffer to prevent memory issues
16
- /**
17
- * Run Codex CLI with the given request
18
- */
19
- export async function runCodexReview(request) {
20
- // Validate workingDir exists before running
21
- if (!existsSync(request.workingDir)) {
22
- return {
23
- success: false,
24
- error: {
25
- type: 'cli_error',
26
- cli: 'codex',
27
- exitCode: -1,
28
- stderr: `Working directory does not exist: ${request.workingDir}`
29
- },
30
- suggestion: 'Check that the working directory path is correct',
31
- model: 'codex'
32
- };
33
- }
34
- return runWithRetry(request, 0);
35
- }
36
- /**
37
- * Run Codex with retry logic
38
- */
39
- async function runWithRetry(request, attempt, previousError, previousOutput) {
40
- try {
41
- // Build the prompt (use retry prompt if this is a retry)
42
- const basePrompt = attempt === 0
43
- ? build7SectionPrompt(request)
44
- : buildRetryPrompt(request, attempt + 1, previousError, previousOutput);
45
- const developerInstructions = buildDeveloperInstructions('codex');
46
- // Combine developer instructions with the prompt for Codex
47
- // Codex exec doesn't have a separate system instruction flag
48
- const fullPrompt = `${developerInstructions}\n\n---\n\n${basePrompt}`;
49
- // Run the CLI
50
- const result = await runCodexCli(fullPrompt, request.workingDir, request.reasoningEffort || 'high');
51
- // Check for CLI errors
52
- if (result.exitCode !== 0) {
53
- // Check for specific error patterns in stderr
54
- if (result.stderr.toLowerCase().includes('rate limit')) {
55
- return {
56
- success: false,
57
- error: {
58
- type: 'rate_limit',
59
- cli: 'codex',
60
- retryAfterMs: parseRetryAfter(result.stderr)
61
- },
62
- suggestion: 'Wait and retry, or use /gemini-review instead',
63
- model: 'codex'
64
- };
65
- }
66
- if (result.stderr.toLowerCase().includes('unauthorized') ||
67
- result.stderr.toLowerCase().includes('authentication') ||
68
- result.stderr.includes('401') ||
69
- result.stderr.includes('403')) {
70
- return {
71
- success: false,
72
- error: {
73
- type: 'auth_error',
74
- cli: 'codex',
75
- message: result.stderr
76
- },
77
- suggestion: 'Run `codex login` to authenticate',
78
- model: 'codex'
79
- };
80
- }
81
- return {
82
- success: false,
83
- error: {
84
- type: 'cli_error',
85
- cli: 'codex',
86
- exitCode: result.exitCode,
87
- stderr: result.stderr
88
- },
89
- model: 'codex'
90
- };
91
- }
92
- // Check for buffer truncation warning
93
- if (result.truncated) {
94
- return {
95
- success: false,
96
- error: {
97
- type: 'cli_error',
98
- cli: 'codex',
99
- exitCode: 0,
100
- stderr: 'Output exceeded maximum buffer size (1MB) and was truncated'
101
- },
102
- suggestion: 'Try reviewing a smaller scope with --focus',
103
- model: 'codex'
104
- };
105
- }
106
- // Validate the response structure
107
- if (!isValidFeedbackOutput(result.stdout)) {
108
- if (attempt < MAX_RETRIES) {
109
- // Retry with history
110
- return runWithRetry(request, attempt + 1, 'Output missing required sections (Agreements, Disagreements, Additions, Alternatives, Risk Assessment)', result.stdout);
111
- }
112
- // Max retries reached, return invalid response error
113
- return {
114
- success: false,
115
- error: {
116
- type: 'invalid_response',
117
- cli: 'codex',
118
- rawOutput: result.stdout
119
- },
120
- suggestion: getSuggestion({ type: 'invalid_response', cli: 'codex', rawOutput: result.stdout }),
121
- model: 'codex'
122
- };
123
- }
124
- return {
125
- success: true,
126
- feedback: result.stdout,
127
- model: 'codex'
128
- };
129
- }
130
- catch (error) {
131
- const err = error;
132
- // Handle CLI not found (ENOENT for the codex binary itself)
133
- if (err.code === 'ENOENT') {
134
- return {
135
- success: false,
136
- error: createCliNotFoundError('codex'),
137
- suggestion: getSuggestion(createCliNotFoundError('codex')),
138
- model: 'codex'
139
- };
140
- }
141
- if (err.message === 'TIMEOUT' || err.message === 'MAX_TIMEOUT') {
142
- const isMaxTimeout = err.message === 'MAX_TIMEOUT';
143
- const timeoutMs = isMaxTimeout ? MAX_TIMEOUT_MS : INACTIVITY_TIMEOUT_MS;
144
- return {
145
- success: false,
146
- error: createTimeoutError('codex', timeoutMs),
147
- suggestion: isMaxTimeout
148
- ? 'Task exceeded 60 minute maximum. Try a smaller scope.'
149
- : 'No output for 2 minutes. Process may be hung. Try a smaller scope or use --focus.',
150
- model: 'codex'
151
- };
152
- }
153
- // Generic error
154
- return {
155
- success: false,
156
- error: {
157
- type: 'cli_error',
158
- cli: 'codex',
159
- exitCode: -1,
160
- stderr: err.message
161
- },
162
- model: 'codex'
163
- };
164
- }
165
- }
166
- /**
167
- * Execute the Codex CLI in non-interactive mode
168
- *
169
- * Uses: codex exec -m gpt-5.2-codex -c model_reasoning_effort="high|xhigh" \
170
- * -c model_reasoning_summary_format=experimental \
171
- * --dangerously-bypass-approvals-and-sandbox "<prompt>"
172
- */
173
- function runCodexCli(prompt, workingDir, reasoningEffort = 'high') {
174
- return new Promise((resolve, reject) => {
175
- // Build CLI arguments for non-interactive execution
176
- const args = [
177
- 'exec',
178
- '-m', 'gpt-5.2-codex',
179
- '-c', `model_reasoning_effort=${reasoningEffort}`,
180
- '-c', 'model_reasoning_summary_format=experimental',
181
- '--dangerously-bypass-approvals-and-sandbox',
182
- '--skip-git-repo-check',
183
- '-C', workingDir,
184
- prompt
185
- ];
186
- const proc = spawn('codex', args, {
187
- cwd: workingDir,
188
- stdio: ['ignore', 'pipe', 'pipe'],
189
- env: { ...process.env }
190
- });
191
- let stdout = '';
192
- let stderr = '';
193
- let truncated = false;
194
- let inactivityTimer;
195
- // Max timeout - absolute cap (60 min)
196
- const maxTimer = setTimeout(() => {
197
- proc.kill('SIGTERM');
198
- reject(new Error('MAX_TIMEOUT'));
199
- }, MAX_TIMEOUT_MS);
200
- // Activity-based timeout - reset on any output
201
- const resetInactivityTimer = () => {
202
- clearTimeout(inactivityTimer);
203
- inactivityTimer = setTimeout(() => {
204
- proc.kill('SIGTERM');
205
- reject(new Error('TIMEOUT'));
206
- }, INACTIVITY_TIMEOUT_MS);
207
- };
208
- // Start inactivity timer
209
- resetInactivityTimer();
210
- proc.stdout.on('data', (data) => {
211
- resetInactivityTimer(); // Still streaming = reset timer
212
- if (stdout.length < MAX_BUFFER_SIZE) {
213
- stdout += data.toString();
214
- if (stdout.length > MAX_BUFFER_SIZE) {
215
- stdout = stdout.slice(0, MAX_BUFFER_SIZE);
216
- truncated = true;
217
- }
218
- }
219
- });
220
- proc.stderr.on('data', (data) => {
221
- resetInactivityTimer(); // Still streaming = reset timer
222
- if (stderr.length < MAX_BUFFER_SIZE) {
223
- stderr += data.toString();
224
- if (stderr.length > MAX_BUFFER_SIZE) {
225
- stderr = stderr.slice(0, MAX_BUFFER_SIZE);
226
- }
227
- }
228
- });
229
- proc.on('close', (code) => {
230
- clearTimeout(inactivityTimer);
231
- clearTimeout(maxTimer);
232
- resolve({
233
- stdout,
234
- stderr,
235
- exitCode: code ?? -1,
236
- truncated
237
- });
238
- });
239
- proc.on('error', (err) => {
240
- clearTimeout(inactivityTimer);
241
- clearTimeout(maxTimer);
242
- reject(err);
243
- });
244
- });
245
- }
246
- /**
247
- * Parse retry-after duration from error message
248
- */
249
- function parseRetryAfter(errorMessage) {
250
- const match = errorMessage.match(/retry[- ]?after[:\s]+(\d+)/i);
251
- if (match) {
252
- return parseInt(match[1]) * 1000; // Convert to ms
253
- }
254
- return undefined;
255
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Gemini CLI Wrapper
3
- *
4
- * Uses Google's Gemini CLI in non-interactive mode (gemini -p)
5
- * Reference: https://github.com/google-gemini/gemini-cli
6
- * Package: @google/gemini-cli
7
- */
8
- import { FeedbackRequest, FeedbackResult } from '../types.js';
9
- /**
10
- * Run Gemini CLI with the given request
11
- */
12
- export declare function runGeminiReview(request: FeedbackRequest): Promise<FeedbackResult>;