@simonren/quorum 0.9.0 → 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 -20
  13. package/dist/adapters/gemini.js +56 -148
  14. package/dist/adapters/index.d.ts +8 -5
  15. package/dist/adapters/index.js +7 -8
  16. package/dist/config.d.ts +116 -28
  17. package/dist/config.js +50 -28
  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
@@ -1,117 +0,0 @@
1
- /**
2
- * MCP Tool Implementations — Review Tools
3
- *
4
- * Returns raw reviewer text to CC. No JSON parsing, no reformatting.
5
- * CC handles interpretation and synthesis.
6
- */
7
- import { z } from 'zod';
8
- import { getAvailableAdapters, } from '../adapters/index.js';
9
- // =============================================================================
10
- // INPUT SCHEMAS
11
- // =============================================================================
12
- export const ReviewInputSchema = z.object({
13
- workingDir: z.string().describe('Working directory for the CLI to operate in'),
14
- ccOutput: z.string().describe("Claude Code's output to review (findings, plan, analysis)"),
15
- outputType: z.enum(['plan', 'findings', 'analysis', 'proposal']).describe('Type of output being reviewed'),
16
- analyzedFiles: z.array(z.string()).optional().describe('File paths that CC analyzed'),
17
- focusAreas: z.array(z.enum([
18
- 'security', 'performance', 'architecture', 'correctness',
19
- 'maintainability', 'scalability', 'testing', 'documentation'
20
- ])).optional().describe('Areas to focus the review on'),
21
- customPrompt: z.string().optional().describe('Custom instructions for the reviewer'),
22
- reasoningEffort: z.enum(['high', 'xhigh']).optional().describe('Codex reasoning effort level (default: high, use xhigh for deeper analysis)'),
23
- serviceTier: z.enum(['default', 'fast', 'flex']).optional().describe('Codex service tier (default when omitted: fast = priority processing, ~2x cost; flex = 50% cheaper/slower; default = API default tier)')
24
- });
25
- // =============================================================================
26
- // HELPERS
27
- // =============================================================================
28
- function toReviewRequest(input) {
29
- return {
30
- workingDir: input.workingDir,
31
- ccOutput: input.ccOutput,
32
- outputType: input.outputType,
33
- analyzedFiles: input.analyzedFiles,
34
- focusAreas: input.focusAreas,
35
- customPrompt: input.customPrompt,
36
- reasoningEffort: input.reasoningEffort,
37
- serviceTier: input.serviceTier,
38
- };
39
- }
40
- function formatResult(result, modelName) {
41
- if (!result.success) {
42
- const emoji = {
43
- cli_not_found: '❌', timeout: '⏱️', rate_limit: '🚫',
44
- auth_error: '🔐', cli_error: '❌',
45
- };
46
- let msg = `${emoji[result.error.type] || '❌'} **${result.error.type}**: ${result.error.message}`;
47
- if (result.suggestion)
48
- msg += `\n\n💡 ${result.suggestion}`;
49
- return msg;
50
- }
51
- return `## ${modelName} Review\n\n**Execution Time:** ${(result.executionTimeMs / 1000).toFixed(1)}s\n\n${result.output}`;
52
- }
53
- // =============================================================================
54
- // MULTI-MODEL HANDLER
55
- // =============================================================================
56
- export async function handleMultiReview(input) {
57
- const request = toReviewRequest(input);
58
- const availableAdapters = await getAvailableAdapters();
59
- if (availableAdapters.length === 0) {
60
- return { content: [{ type: 'text', text: '❌ No AI CLIs found.\n\nInstall at least one:\n - Codex: npm install -g @openai/codex-cli\n - Gemini (agy): curl -fsSL https://antigravity.google/cli/install.sh | bash' }] };
61
- }
62
- // Spawn 2 reviews per adapter: standard + adversarial (all in parallel)
63
- // customPrompt steers the adversarial focus only — strip it from standard pass to avoid bias
64
- const { customPrompt, ...standardRequest } = request;
65
- const reviewPromises = availableAdapters.flatMap((adapter) => [
66
- adapter.runReview({ ...standardRequest }).then(result => ({ adapter, result, mode: 'standard' })),
67
- adapter.runReview({ ...request, reviewMode: 'adversarial' }).then(result => ({ adapter, result, mode: 'adversarial' })),
68
- ]);
69
- const results = await Promise.all(reviewPromises);
70
- const standardResults = results.filter(r => r.mode === 'standard');
71
- const adversarialResults = results.filter(r => r.mode === 'adversarial');
72
- const allFailed = results.every(r => !r.result.success);
73
- const someFailed = results.some(r => !r.result.success);
74
- const lines = [];
75
- if (allFailed)
76
- lines.push('## Multi-Model Review ❌ All Failed\n');
77
- else if (someFailed)
78
- lines.push('## Multi-Model Review ⚠️ Partial Success\n');
79
- else
80
- lines.push('## Multi-Model Review ✓\n');
81
- lines.push(`**Models:** ${availableAdapters.map(a => a.id).join(', ')} (standard + adversarial)\n`);
82
- // Standard section
83
- lines.push('## Standard Review Findings\n');
84
- for (const { adapter, result } of standardResults) {
85
- lines.push(formatResult(result, adapter.getCapabilities().name));
86
- lines.push('');
87
- }
88
- // Adversarial section
89
- lines.push('## Challenge Review Findings\n');
90
- for (const { adapter, result } of adversarialResults) {
91
- lines.push(formatResult(result, `${adapter.getCapabilities().name} (Adversarial)`));
92
- lines.push('');
93
- }
94
- return { content: [{ type: 'text', text: lines.join('\n') }] };
95
- }
96
- // =============================================================================
97
- // TOOL DEFINITIONS
98
- // =============================================================================
99
- export const TOOL_DEFINITIONS = {
100
- multi_review: {
101
- name: 'multi_review',
102
- description: "Use when reviewing existing CC-produced work (plan, findings, code). Requires 'ccOutput' — CC's prior output to evaluate. Runs parallel standard AND adversarial reviews from all available models. For asking the panel an open question with no prior CC-produced work to review, use 'multi_consult' instead. The discriminator is the shape of the input, not the user's phrasing.",
103
- inputSchema: {
104
- type: 'object',
105
- properties: {
106
- workingDir: { type: 'string', description: 'Working directory for the CLI to operate in' },
107
- ccOutput: { type: 'string', description: "Claude Code's output to review (findings, plan, analysis)" },
108
- outputType: { type: 'string', enum: ['plan', 'findings', 'analysis', 'proposal'], description: 'Type of output being reviewed' },
109
- analyzedFiles: { type: 'array', items: { type: 'string' }, description: 'File paths that CC analyzed' },
110
- focusAreas: { type: 'array', items: { type: 'string', enum: ['security', 'performance', 'architecture', 'correctness', 'maintainability', 'scalability', 'testing', 'documentation'] }, description: 'Areas to focus the review on' },
111
- customPrompt: { type: 'string', description: 'Custom instructions for standard review + adversarial focus steering' },
112
- serviceTier: { type: 'string', enum: ['default', 'fast', 'flex'], description: 'Codex service tier — only applies to Codex. Omit for fast default; fast = priority ~2x cost, flex = 50% cheaper/slower, default = API default tier.' }
113
- },
114
- required: ['workingDir', 'ccOutput', 'outputType']
115
- }
116
- },
117
- };