@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.
- package/README.md +91 -48
- package/commands/multi-consult.md +47 -72
- package/commands/multi-review.md +68 -99
- package/dist/adapters/base.d.ts +53 -70
- package/dist/adapters/base.js +21 -79
- package/dist/adapters/claude.d.ts +38 -17
- package/dist/adapters/claude.js +93 -185
- package/dist/adapters/cli-adapter.d.ts +78 -0
- package/dist/adapters/cli-adapter.js +217 -0
- package/dist/adapters/codex.d.ts +18 -13
- package/dist/adapters/codex.js +64 -200
- package/dist/adapters/gemini.d.ts +30 -21
- package/dist/adapters/gemini.js +55 -149
- package/dist/adapters/index.d.ts +8 -5
- package/dist/adapters/index.js +7 -8
- package/dist/config.d.ts +98 -28
- package/dist/config.js +44 -25
- package/dist/consult-prompt.d.ts +6 -5
- package/dist/consult-prompt.js +48 -23
- package/dist/decoders/claude.d.ts +6 -0
- package/dist/decoders/claude.js +10 -1
- package/dist/doctor.d.ts +20 -0
- package/dist/doctor.js +91 -0
- package/dist/executor.d.ts +58 -46
- package/dist/executor.js +218 -129
- package/dist/guards.d.ts +29 -0
- package/dist/guards.js +72 -0
- package/dist/handoff.d.ts +79 -229
- package/dist/handoff.js +411 -402
- package/dist/index.d.ts +8 -12
- package/dist/index.js +81 -106
- package/dist/integrity.d.ts +16 -0
- package/dist/integrity.js +49 -0
- package/dist/sections.d.ts +22 -0
- package/dist/sections.js +31 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +36 -0
- package/dist/tools/consult.d.ts +17 -76
- package/dist/tools/consult.js +72 -188
- package/dist/tools/format.d.ts +35 -0
- package/dist/tools/format.js +85 -0
- package/dist/tools/review.d.ts +55 -0
- package/dist/tools/review.js +120 -0
- package/dist/types.d.ts +20 -103
- package/dist/types.js +18 -29
- package/package.json +7 -4
- package/dist/cli/check.d.ts +0 -20
- package/dist/cli/check.js +0 -78
- package/dist/cli/codex.d.ts +0 -11
- package/dist/cli/codex.js +0 -255
- package/dist/cli/gemini.d.ts +0 -12
- package/dist/cli/gemini.js +0 -253
- package/dist/context.d.ts +0 -1538
- package/dist/context.js +0 -383
- package/dist/decoders/gemini.d.ts +0 -33
- package/dist/decoders/gemini.js +0 -58
- package/dist/errors.d.ts +0 -46
- package/dist/errors.js +0 -198
- package/dist/pipeline.d.ts +0 -135
- package/dist/pipeline.js +0 -462
- package/dist/prompt-v2.d.ts +0 -38
- package/dist/prompt-v2.js +0 -391
- package/dist/prompt.d.ts +0 -71
- package/dist/prompt.js +0 -309
- package/dist/schema.d.ts +0 -660
- package/dist/schema.js +0 -536
- package/dist/tools/feedback.d.ts +0 -91
- package/dist/tools/feedback.js +0 -117
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Quorum MCP
|
|
3
|
+
* Quorum MCP server — entry point.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Single model review (codex_review, gemini_review)
|
|
10
|
-
* - Multi-model parallel review (multi_review)
|
|
11
|
-
* - Structured JSON output with confidence scores
|
|
12
|
-
* - Expert role specialization per focus area
|
|
5
|
+
* A quorum of AI CLIs (Codex, Gemini via agy, Claude Code with fresh context)
|
|
6
|
+
* reviews Claude Code's work or answers its questions; Claude Code synthesizes.
|
|
13
7
|
*
|
|
14
8
|
* Usage:
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* npx -y @simonren/quorum run the MCP server on stdio
|
|
10
|
+
* npx -y @simonren/quorum update install/update the slash commands
|
|
11
|
+
* npx -y @simonren/quorum doctor show detected CLIs and config
|
|
12
|
+
* npx -y @simonren/quorum --version
|
|
17
13
|
*/
|
|
18
|
-
|
|
14
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,134 +1,109 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Quorum MCP
|
|
3
|
+
* Quorum MCP server — entry point.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Single model review (codex_review, gemini_review)
|
|
10
|
-
* - Multi-model parallel review (multi_review)
|
|
11
|
-
* - Structured JSON output with confidence scores
|
|
12
|
-
* - Expert role specialization per focus area
|
|
5
|
+
* A quorum of AI CLIs (Codex, Gemini via agy, Claude Code with fresh context)
|
|
6
|
+
* reviews Claude Code's work or answers its questions; Claude Code synthesizes.
|
|
13
7
|
*
|
|
14
8
|
* Usage:
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* npx -y @simonren/quorum run the MCP server on stdio
|
|
10
|
+
* npx -y @simonren/quorum update install/update the slash commands
|
|
11
|
+
* npx -y @simonren/quorum doctor show detected CLIs and config
|
|
12
|
+
* npx -y @simonren/quorum --version
|
|
17
13
|
*/
|
|
18
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
19
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
20
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
21
|
-
import { handleMultiReview, ReviewInputSchema, TOOL_DEFINITIONS, } from './tools/feedback.js';
|
|
22
|
-
import { handleMultiConsult, ConsultInputSchema, MULTI_CONSULT_TOOL_DEFINITION, } from './tools/consult.js';
|
|
23
|
-
import { logCliStatus } from './cli/check.js';
|
|
24
|
-
import { installCommands } from './commands.js';
|
|
25
|
-
import { initConfig } from './config.js';
|
|
26
|
-
// Read version from package.json
|
|
27
14
|
import { readFileSync } from 'fs';
|
|
28
15
|
import { join, dirname } from 'path';
|
|
29
16
|
import { fileURLToPath } from 'url';
|
|
17
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
18
|
+
import { installCommands } from './commands.js';
|
|
19
|
+
import { initConfig } from './config.js';
|
|
20
|
+
import { gracefulExit, installChildCleanupHooks } from './executor.js';
|
|
30
21
|
const __pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const VERSION = JSON.parse(readFileSync(__pkgPath, 'utf-8')).version;
|
|
23
|
+
const USAGE = `quorum v${VERSION}
|
|
24
|
+
|
|
25
|
+
Usage:
|
|
26
|
+
quorum Run the MCP server on stdio (what Claude Code launches)
|
|
27
|
+
quorum update Install or update the /multi-review and /multi-consult slash commands
|
|
28
|
+
quorum doctor Show detected reviewer CLIs, versions, and config
|
|
29
|
+
quorum --version Print the version
|
|
30
|
+
`;
|
|
31
|
+
function runUpdate() {
|
|
36
32
|
const result = installCommands();
|
|
37
|
-
if (result.success) {
|
|
38
|
-
console.log(`quorum v${VERSION}`);
|
|
39
|
-
if (result.removed.length > 0) {
|
|
40
|
-
console.log(`✓ Removed ${result.removed.length} deprecated commands: ${result.removed.map(c => `/${c}`).join(', ')}`);
|
|
41
|
-
}
|
|
42
|
-
console.log(`✓ Installed ${result.installed.length} slash commands: ${result.installed.map(c => `/${c}`).join(', ')}`);
|
|
43
|
-
process.exit(0);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
33
|
+
if (!result.success) {
|
|
46
34
|
console.error(`✗ Failed to install commands: ${result.error}`);
|
|
47
35
|
process.exit(1);
|
|
48
36
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// Create the MCP server
|
|
53
|
-
const server = new Server({
|
|
54
|
-
name: 'quorum',
|
|
55
|
-
version: VERSION,
|
|
56
|
-
}, {
|
|
57
|
-
capabilities: {
|
|
58
|
-
tools: {},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
// Handle tool listing
|
|
62
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
63
|
-
return {
|
|
64
|
-
tools: [
|
|
65
|
-
TOOL_DEFINITIONS.multi_review,
|
|
66
|
-
MULTI_CONSULT_TOOL_DEFINITION,
|
|
67
|
-
],
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
// Handle tool calls
|
|
71
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
72
|
-
const { name, arguments: args } = request.params;
|
|
73
|
-
try {
|
|
74
|
-
switch (name) {
|
|
75
|
-
case 'multi_review': {
|
|
76
|
-
const input = ReviewInputSchema.parse(args);
|
|
77
|
-
return await handleMultiReview(input);
|
|
78
|
-
}
|
|
79
|
-
case 'multi_consult': {
|
|
80
|
-
const input = ConsultInputSchema.parse(args);
|
|
81
|
-
return await handleMultiConsult(input);
|
|
82
|
-
}
|
|
83
|
-
default:
|
|
84
|
-
return {
|
|
85
|
-
content: [{
|
|
86
|
-
type: 'text',
|
|
87
|
-
text: `Unknown tool: ${name}`
|
|
88
|
-
}],
|
|
89
|
-
isError: true
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
95
|
-
return {
|
|
96
|
-
content: [{
|
|
97
|
-
type: 'text',
|
|
98
|
-
text: `Error: ${errorMessage}`
|
|
99
|
-
}],
|
|
100
|
-
isError: true
|
|
101
|
-
};
|
|
37
|
+
console.log(`quorum v${VERSION}`);
|
|
38
|
+
if (result.removed.length > 0) {
|
|
39
|
+
console.log(`✓ Retired ${result.removed.length} deprecated commands (kept as .deprecated.bak): ${result.removed.map((c) => `/${c}`).join(', ')}`);
|
|
102
40
|
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
41
|
+
console.log(`✓ Installed ${result.installed.length} slash commands: ${result.installed.map((c) => `/${c}`).join(', ')}`);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
async function startServer() {
|
|
45
|
+
// Adapters register themselves on import; the server module pulls them in.
|
|
46
|
+
const [{ createServer }, { logCliStatus }] = await Promise.all([
|
|
47
|
+
import('./server.js'),
|
|
48
|
+
import('./doctor.js'),
|
|
49
|
+
]);
|
|
107
50
|
try {
|
|
108
51
|
const cfg = initConfig();
|
|
109
|
-
console.error(cfg.created
|
|
110
|
-
? `[quorum] Initialized config at ${cfg.path}`
|
|
111
|
-
: `[quorum] Loaded config from ${cfg.path}`);
|
|
52
|
+
console.error(cfg.created ? `[quorum] Initialized config at ${cfg.path}` : `[quorum] Loaded config from ${cfg.path}`);
|
|
112
53
|
}
|
|
113
54
|
catch (error) {
|
|
114
55
|
const msg = error instanceof Error ? error.message : String(error);
|
|
115
|
-
console.error(`[quorum] Warning:
|
|
56
|
+
console.error(`[quorum] Warning: could not initialize config: ${msg}`);
|
|
116
57
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
console.error(`[quorum] Installed ${result.installed.length} slash commands`);
|
|
58
|
+
const install = installCommands();
|
|
59
|
+
if (install.success) {
|
|
60
|
+
console.error(`[quorum] Installed ${install.installed.length} slash commands`);
|
|
121
61
|
}
|
|
122
62
|
else {
|
|
123
|
-
console.error(`[quorum] Warning:
|
|
63
|
+
console.error(`[quorum] Warning: could not install commands: ${install.error}`);
|
|
124
64
|
}
|
|
125
|
-
// Log CLI availability status on startup
|
|
126
65
|
await logCliStatus();
|
|
66
|
+
// Reap reviewer processes if we are signalled or the client hangs up —
|
|
67
|
+
// a Codex/Claude run must not outlive the Claude Code session that asked for it.
|
|
68
|
+
installChildCleanupHooks();
|
|
69
|
+
process.stdin.once('end', () => { void gracefulExit(0); });
|
|
70
|
+
process.stdin.once('close', () => { void gracefulExit(0); });
|
|
71
|
+
const server = createServer(VERSION);
|
|
127
72
|
const transport = new StdioServerTransport();
|
|
128
73
|
await server.connect(transport);
|
|
129
|
-
console.error(
|
|
74
|
+
console.error(`[quorum] v${VERSION} running on stdio`);
|
|
75
|
+
}
|
|
76
|
+
const subcommand = process.argv[2];
|
|
77
|
+
switch (subcommand) {
|
|
78
|
+
case 'update':
|
|
79
|
+
case '--setup':
|
|
80
|
+
case '--commands':
|
|
81
|
+
runUpdate();
|
|
82
|
+
break;
|
|
83
|
+
case 'doctor':
|
|
84
|
+
case 'check': {
|
|
85
|
+
const { runDoctor } = await import('./doctor.js');
|
|
86
|
+
process.exit(await runDoctor(VERSION));
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case '--version':
|
|
90
|
+
case '-v':
|
|
91
|
+
console.log(VERSION);
|
|
92
|
+
process.exit(0);
|
|
93
|
+
break;
|
|
94
|
+
case '--help':
|
|
95
|
+
case '-h':
|
|
96
|
+
case 'help':
|
|
97
|
+
console.log(USAGE);
|
|
98
|
+
process.exit(0);
|
|
99
|
+
break;
|
|
100
|
+
case undefined:
|
|
101
|
+
startServer().catch((error) => {
|
|
102
|
+
console.error('[quorum] Fatal error:', error);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
console.error(`Unknown subcommand: ${subcommand}\n\n${USAGE}`);
|
|
108
|
+
process.exit(2);
|
|
130
109
|
}
|
|
131
|
-
main().catch((error) => {
|
|
132
|
-
console.error('Fatal error:', error);
|
|
133
|
-
process.exit(1);
|
|
134
|
-
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working-tree integrity check.
|
|
3
|
+
*
|
|
4
|
+
* Reviewers are read-only by contract, but not every CLI can enforce that:
|
|
5
|
+
* agy's file tools can write to the workspace even under `--sandbox`. The tool
|
|
6
|
+
* handlers therefore fingerprint the working tree before dispatch and compare
|
|
7
|
+
* after all passes settle, so a modified checkout is reported instead of
|
|
8
|
+
* silently trusted. Best-effort: outside a git repository there is nothing to
|
|
9
|
+
* compare and the check is skipped.
|
|
10
|
+
*/
|
|
11
|
+
/** `git status --porcelain` for `dir`, or null when it is not a git repository (or git is missing). */
|
|
12
|
+
export declare function snapshotWorkingTree(dir: string): string | null;
|
|
13
|
+
/** Paths whose status entry differs between two snapshots (added, modified, deleted, renamed). */
|
|
14
|
+
export declare function changedPaths(before: string | null, after: string | null): string[];
|
|
15
|
+
/** Tool-result warning for a working tree that changed while reviewers ran. */
|
|
16
|
+
export declare function tamperWarning(paths: string[]): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working-tree integrity check.
|
|
3
|
+
*
|
|
4
|
+
* Reviewers are read-only by contract, but not every CLI can enforce that:
|
|
5
|
+
* agy's file tools can write to the workspace even under `--sandbox`. The tool
|
|
6
|
+
* handlers therefore fingerprint the working tree before dispatch and compare
|
|
7
|
+
* after all passes settle, so a modified checkout is reported instead of
|
|
8
|
+
* silently trusted. Best-effort: outside a git repository there is nothing to
|
|
9
|
+
* compare and the check is skipped.
|
|
10
|
+
*/
|
|
11
|
+
import { execFileSync } from 'child_process';
|
|
12
|
+
/** `git status --porcelain` for `dir`, or null when it is not a git repository (or git is missing). */
|
|
13
|
+
export function snapshotWorkingTree(dir) {
|
|
14
|
+
try {
|
|
15
|
+
return execFileSync('git', ['-C', dir, 'status', '--porcelain', '--untracked-files=all'], {
|
|
16
|
+
encoding: 'utf-8',
|
|
17
|
+
timeout: 15_000,
|
|
18
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Paths whose status entry differs between two snapshots (added, modified, deleted, renamed). */
|
|
26
|
+
export function changedPaths(before, after) {
|
|
27
|
+
if (before === null || after === null)
|
|
28
|
+
return [];
|
|
29
|
+
const a = new Set(before.split('\n').filter(Boolean));
|
|
30
|
+
const b = new Set(after.split('\n').filter(Boolean));
|
|
31
|
+
const changed = new Set();
|
|
32
|
+
for (const line of a)
|
|
33
|
+
if (!b.has(line))
|
|
34
|
+
changed.add(line.slice(3));
|
|
35
|
+
for (const line of b)
|
|
36
|
+
if (!a.has(line))
|
|
37
|
+
changed.add(line.slice(3));
|
|
38
|
+
return [...changed].sort();
|
|
39
|
+
}
|
|
40
|
+
/** Tool-result warning for a working tree that changed while reviewers ran. */
|
|
41
|
+
export function tamperWarning(paths) {
|
|
42
|
+
const shown = paths.slice(0, 20).map((p) => ` - ${p}`).join('\n');
|
|
43
|
+
const more = paths.length > 20 ? `\n … and ${paths.length - 20} more` : '';
|
|
44
|
+
return [
|
|
45
|
+
'⚠️ **WORKING TREE CHANGED WHILE THE PANEL RAN.** Reviewers are read-only by contract, yet these paths changed:',
|
|
46
|
+
shown + more,
|
|
47
|
+
'If nobody edited the checkout during the run, a reviewer did: inspect with `git status` / `git diff` and restore before trusting the tree. Either way, the reviewers may have read a mix of old and new content — weigh their findings accordingly.',
|
|
48
|
+
].join('\n');
|
|
49
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-hoc structure check for model responses.
|
|
3
|
+
*
|
|
4
|
+
* Both prompts ask for a fixed set of `## ` headers. This does not parse the
|
|
5
|
+
* response — CC does that — it only reports which required headers are
|
|
6
|
+
* missing so CC can discount a model that drifted from the contract.
|
|
7
|
+
*/
|
|
8
|
+
export interface SectionValidation {
|
|
9
|
+
missing: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check a response for the required `## …` headers.
|
|
13
|
+
*
|
|
14
|
+
* - Fenced code blocks are stripped first so a quoted format-example skeleton
|
|
15
|
+
* cannot satisfy the check.
|
|
16
|
+
* - A header matches when the section name starts an H2 line as a whole word;
|
|
17
|
+
* trailing decoration (`:`, `— detail`, whitespace) is tolerated.
|
|
18
|
+
* - Case-sensitive. Bare bold (`**Recommendation**`), a different level
|
|
19
|
+
* (`### Recommendation`), and ALL-CAPS variants count as missing — that is
|
|
20
|
+
* the signal CC should see when a model drifts.
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateSections(output: string, required: readonly string[]): SectionValidation;
|
package/dist/sections.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-hoc structure check for model responses.
|
|
3
|
+
*
|
|
4
|
+
* Both prompts ask for a fixed set of `## ` headers. This does not parse the
|
|
5
|
+
* response — CC does that — it only reports which required headers are
|
|
6
|
+
* missing so CC can discount a model that drifted from the contract.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check a response for the required `## …` headers.
|
|
10
|
+
*
|
|
11
|
+
* - Fenced code blocks are stripped first so a quoted format-example skeleton
|
|
12
|
+
* cannot satisfy the check.
|
|
13
|
+
* - A header matches when the section name starts an H2 line as a whole word;
|
|
14
|
+
* trailing decoration (`:`, `— detail`, whitespace) is tolerated.
|
|
15
|
+
* - Case-sensitive. Bare bold (`**Recommendation**`), a different level
|
|
16
|
+
* (`### Recommendation`), and ALL-CAPS variants count as missing — that is
|
|
17
|
+
* the signal CC should see when a model drifts.
|
|
18
|
+
*/
|
|
19
|
+
export function validateSections(output, required) {
|
|
20
|
+
const stripped = output.replace(/```[\s\S]*?```/g, '');
|
|
21
|
+
const missing = [];
|
|
22
|
+
for (const section of required) {
|
|
23
|
+
const pattern = new RegExp(`^##[ \\t]+${escapeRegex(section)}\\b[^\\n]*$`, 'm');
|
|
24
|
+
if (!pattern.test(stripped))
|
|
25
|
+
missing.push(section);
|
|
26
|
+
}
|
|
27
|
+
return { missing };
|
|
28
|
+
}
|
|
29
|
+
function escapeRegex(s) {
|
|
30
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
31
|
+
}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server wiring.
|
|
3
|
+
*
|
|
4
|
+
* Tools are registered through the SDK's high-level API with their Zod shapes,
|
|
5
|
+
* so the JSON schema advertised to the client, the runtime validation, and the
|
|
6
|
+
* handler's input type all come from one definition and cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
export declare function createServer(version: string): McpServer;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server wiring.
|
|
3
|
+
*
|
|
4
|
+
* Tools are registered through the SDK's high-level API with their Zod shapes,
|
|
5
|
+
* so the JSON schema advertised to the client, the runtime validation, and the
|
|
6
|
+
* handler's input type all come from one definition and cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import { handleMultiReview, MULTI_REVIEW_DESCRIPTION, ReviewInputShape } from './tools/review.js';
|
|
10
|
+
import { handleMultiConsult, MULTI_CONSULT_DESCRIPTION, ConsultInputShape } from './tools/consult.js';
|
|
11
|
+
/**
|
|
12
|
+
* Both tools spawn external CLIs that read the working directory and call
|
|
13
|
+
* their own model APIs, but never write to the environment.
|
|
14
|
+
*/
|
|
15
|
+
const TOOL_ANNOTATIONS = {
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: false,
|
|
19
|
+
openWorldHint: true,
|
|
20
|
+
};
|
|
21
|
+
export function createServer(version) {
|
|
22
|
+
const server = new McpServer({ name: 'quorum', version }, { capabilities: { tools: {} } });
|
|
23
|
+
server.registerTool('multi_review', {
|
|
24
|
+
title: 'Multi-model review (standard + adversarial)',
|
|
25
|
+
description: MULTI_REVIEW_DESCRIPTION,
|
|
26
|
+
inputSchema: ReviewInputShape,
|
|
27
|
+
annotations: { ...TOOL_ANNOTATIONS, title: 'Multi-model review' },
|
|
28
|
+
}, async (args) => handleMultiReview(args));
|
|
29
|
+
server.registerTool('multi_consult', {
|
|
30
|
+
title: 'Multi-model consultation',
|
|
31
|
+
description: MULTI_CONSULT_DESCRIPTION,
|
|
32
|
+
inputSchema: ConsultInputShape,
|
|
33
|
+
annotations: { ...TOOL_ANNOTATIONS, title: 'Multi-model consultation' },
|
|
34
|
+
}, async (args) => handleMultiConsult(args));
|
|
35
|
+
return server;
|
|
36
|
+
}
|
package/dist/tools/consult.d.ts
CHANGED
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP
|
|
2
|
+
* MCP tool — multi_consult
|
|
3
3
|
*
|
|
4
|
-
* Asks
|
|
5
|
-
*
|
|
4
|
+
* Asks every available adapter the same question in parallel and returns each
|
|
5
|
+
* model's 5-section response to CC for synthesis.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* are fine. The check resolves symlinks via realpath so a symlinked alias of
|
|
13
|
-
* a sensitive directory is also caught.
|
|
14
|
-
*/
|
|
15
|
-
export declare function checkSensitiveWorkingDir(input: string): {
|
|
16
|
-
ok: true;
|
|
17
|
-
resolved: string;
|
|
18
|
-
} | {
|
|
19
|
-
ok: false;
|
|
20
|
-
reason: string;
|
|
21
|
-
};
|
|
22
|
-
export interface SectionValidation {
|
|
23
|
-
missing: string[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Lightweight check for the 5 expected `## …` headers in a model's consult
|
|
27
|
-
* response. Behaviors:
|
|
28
|
-
* - Strips fenced code blocks first so a quoted format-example skeleton
|
|
29
|
-
* doesn't falsely satisfy the check.
|
|
30
|
-
* - Requires the section name as a word boundary at the start of an H2 line,
|
|
31
|
-
* but tolerates trailing decoration (colon, em-dash continuation, etc.).
|
|
32
|
-
* - Case-sensitive on the section name. Bare bold (`**Recommendation**`),
|
|
33
|
-
* wrong level (`### Recommendation`), and ALL-CAPS variants all count as
|
|
34
|
-
* missing — that's the signal we want CC to see when models drift.
|
|
35
|
-
*/
|
|
8
|
+
import { SectionValidation } from '../sections.js';
|
|
9
|
+
import { ToolText } from './format.js';
|
|
10
|
+
export { checkSensitiveWorkingDir } from '../guards.js';
|
|
11
|
+
/** Check a consult response for the five required `## …` headers. */
|
|
36
12
|
export declare function validateConsultSections(output: string): SectionValidation;
|
|
13
|
+
export declare const ConsultInputShape: {
|
|
14
|
+
workingDir: z.ZodString;
|
|
15
|
+
question: z.ZodString;
|
|
16
|
+
relevantFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
customPrompt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
18
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<["high", "xhigh"]>>;
|
|
19
|
+
serviceTier: z.ZodOptional<z.ZodEnum<["default", "fast", "flex"]>>;
|
|
20
|
+
};
|
|
37
21
|
export declare const ConsultInputSchema: z.ZodObject<{
|
|
38
22
|
workingDir: z.ZodString;
|
|
39
23
|
question: z.ZodString;
|
|
@@ -57,48 +41,5 @@ export declare const ConsultInputSchema: z.ZodObject<{
|
|
|
57
41
|
customPrompt?: string | undefined;
|
|
58
42
|
}>;
|
|
59
43
|
export type ConsultInput = z.infer<typeof ConsultInputSchema>;
|
|
60
|
-
export declare
|
|
61
|
-
|
|
62
|
-
type: 'text';
|
|
63
|
-
text: string;
|
|
64
|
-
}>;
|
|
65
|
-
}>;
|
|
66
|
-
export declare const MULTI_CONSULT_TOOL_DEFINITION: {
|
|
67
|
-
name: string;
|
|
68
|
-
description: string;
|
|
69
|
-
inputSchema: {
|
|
70
|
-
type: string;
|
|
71
|
-
properties: {
|
|
72
|
-
workingDir: {
|
|
73
|
-
type: string;
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
question: {
|
|
77
|
-
type: string;
|
|
78
|
-
description: string;
|
|
79
|
-
};
|
|
80
|
-
relevantFiles: {
|
|
81
|
-
type: string;
|
|
82
|
-
items: {
|
|
83
|
-
type: string;
|
|
84
|
-
};
|
|
85
|
-
description: string;
|
|
86
|
-
};
|
|
87
|
-
customPrompt: {
|
|
88
|
-
type: string;
|
|
89
|
-
description: string;
|
|
90
|
-
};
|
|
91
|
-
reasoningEffort: {
|
|
92
|
-
type: string;
|
|
93
|
-
enum: string[];
|
|
94
|
-
description: string;
|
|
95
|
-
};
|
|
96
|
-
serviceTier: {
|
|
97
|
-
type: string;
|
|
98
|
-
enum: string[];
|
|
99
|
-
description: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
required: string[];
|
|
103
|
-
};
|
|
104
|
-
};
|
|
44
|
+
export declare const MULTI_CONSULT_DESCRIPTION: string;
|
|
45
|
+
export declare function handleMultiConsult(input: ConsultInput): Promise<ToolText>;
|