cc-reviewer 2.0.0 ā 2.1.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/dist/adapters/base.d.ts +3 -6
- package/dist/adapters/codex.d.ts +3 -4
- package/dist/adapters/codex.js +76 -291
- package/dist/adapters/gemini.d.ts +3 -4
- package/dist/adapters/gemini.js +52 -243
- package/dist/decoders/codex.d.ts +11 -0
- package/dist/decoders/codex.js +29 -0
- package/dist/handoff.d.ts +3 -4
- package/dist/handoff.js +5 -57
- package/dist/schema.d.ts +6 -6
- package/dist/schema.js +1 -1
- package/dist/tools/feedback.d.ts +5 -6
- package/dist/tools/feedback.js +60 -335
- package/dist/tools/peer.d.ts +0 -2
- package/dist/tools/peer.js +19 -102
- package/package.json +1 -1
package/dist/tools/peer.js
CHANGED
|
@@ -23,78 +23,18 @@ function toPeerRequest(input) {
|
|
|
23
23
|
serviceTier: input.serviceTier,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
function formatPeerResult(result, modelName) {
|
|
27
27
|
if (!result.success) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const lines = [];
|
|
32
|
-
lines.push(`## ${modelName} Response\n`);
|
|
33
|
-
lines.push(`**Execution Time:** ${(result.executionTimeMs / 1000).toFixed(1)}s`);
|
|
34
|
-
lines.push(`**Confidence:** ${Math.round(output.confidence * 100)}%\n`);
|
|
35
|
-
// Main answer
|
|
36
|
-
lines.push(`### Answer\n`);
|
|
37
|
-
lines.push(output.answer);
|
|
38
|
-
lines.push('');
|
|
39
|
-
// Key points
|
|
40
|
-
if (output.key_points.length > 0) {
|
|
41
|
-
lines.push(`### Key Points\n`);
|
|
42
|
-
for (const point of output.key_points) {
|
|
43
|
-
lines.push(`- ${point}`);
|
|
44
|
-
}
|
|
45
|
-
lines.push('');
|
|
46
|
-
}
|
|
47
|
-
// Suggested actions
|
|
48
|
-
if (output.suggested_actions.length > 0) {
|
|
49
|
-
lines.push(`### Suggested Actions\n`);
|
|
50
|
-
const priorityEmoji = {
|
|
51
|
-
high: 'š“', medium: 'š”', low: 'š¢',
|
|
28
|
+
const emoji = {
|
|
29
|
+
cli_not_found: 'ā', timeout: 'ā±ļø', rate_limit: 'š«',
|
|
30
|
+
auth_error: 'š', cli_error: 'ā',
|
|
52
31
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
lines.push(` ${action.rationale}`);
|
|
59
|
-
lines.push('');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// File references
|
|
63
|
-
if (output.file_references.length > 0) {
|
|
64
|
-
lines.push(`### Files Examined\n`);
|
|
65
|
-
for (const ref of output.file_references) {
|
|
66
|
-
const loc = ref.lines ? `${ref.path}:${ref.lines}` : ref.path;
|
|
67
|
-
lines.push(`- \`${loc}\` ā ${ref.relevance}`);
|
|
68
|
-
}
|
|
69
|
-
lines.push('');
|
|
70
|
-
}
|
|
71
|
-
// Alternatives
|
|
72
|
-
if (output.alternatives && output.alternatives.length > 0) {
|
|
73
|
-
lines.push(`### Alternatives\n`);
|
|
74
|
-
for (const alt of output.alternatives) {
|
|
75
|
-
lines.push(`**${alt.topic}**`);
|
|
76
|
-
lines.push(` Current: ${alt.current_approach}`);
|
|
77
|
-
lines.push(` Alternative: ${alt.alternative}`);
|
|
78
|
-
lines.push(` Recommendation: ${alt.recommendation}`);
|
|
79
|
-
lines.push('');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return lines.join('\n');
|
|
83
|
-
}
|
|
84
|
-
function formatPeerErrorResponse(error, suggestion) {
|
|
85
|
-
const emoji = {
|
|
86
|
-
cli_not_found: 'ā',
|
|
87
|
-
timeout: 'ā±ļø',
|
|
88
|
-
rate_limit: 'š«',
|
|
89
|
-
auth_error: 'š',
|
|
90
|
-
parse_error: 'ā ļø',
|
|
91
|
-
cli_error: 'ā',
|
|
92
|
-
};
|
|
93
|
-
let response = `${emoji[error.type] || 'ā'} **${error.type}**: ${error.message}`;
|
|
94
|
-
if (suggestion) {
|
|
95
|
-
response += `\n\nš” ${suggestion}`;
|
|
32
|
+
let msg = `${emoji[result.error.type] || 'ā'} **${result.error.type}**: ${result.error.message}`;
|
|
33
|
+
if (result.suggestion)
|
|
34
|
+
msg += `\n\nš” ${result.suggestion}`;
|
|
35
|
+
return msg;
|
|
96
36
|
}
|
|
97
|
-
return
|
|
37
|
+
return `## ${modelName} Response\n\n**Execution Time:** ${(result.executionTimeMs / 1000).toFixed(1)}s\n\n${result.output}`;
|
|
98
38
|
}
|
|
99
39
|
// =============================================================================
|
|
100
40
|
// SINGLE MODEL HANDLERS
|
|
@@ -115,7 +55,7 @@ export async function handleAskCodex(input) {
|
|
|
115
55
|
}
|
|
116
56
|
const request = toPeerRequest(input);
|
|
117
57
|
const result = await adapter.runPeerRequest(request);
|
|
118
|
-
return { content: [{ type: 'text', text:
|
|
58
|
+
return { content: [{ type: 'text', text: formatPeerResult(result, 'Codex') }] };
|
|
119
59
|
}
|
|
120
60
|
export async function handleAskGemini(input) {
|
|
121
61
|
const adapter = getAdapter('gemini');
|
|
@@ -133,7 +73,7 @@ export async function handleAskGemini(input) {
|
|
|
133
73
|
}
|
|
134
74
|
const request = toPeerRequest(input);
|
|
135
75
|
const result = await adapter.runPeerRequest(request);
|
|
136
|
-
return { content: [{ type: 'text', text:
|
|
76
|
+
return { content: [{ type: 'text', text: formatPeerResult(result, 'Gemini') }] };
|
|
137
77
|
}
|
|
138
78
|
// =============================================================================
|
|
139
79
|
// MULTI-MODEL HANDLER
|
|
@@ -154,43 +94,20 @@ export async function handleAskMulti(input) {
|
|
|
154
94
|
return { adapter, result };
|
|
155
95
|
});
|
|
156
96
|
const results = await Promise.all(promises);
|
|
157
|
-
const successful = [];
|
|
158
|
-
const failed = [];
|
|
159
|
-
for (const { adapter, result } of results) {
|
|
160
|
-
if (result.success) {
|
|
161
|
-
successful.push({ model: adapter.id, output: result.output });
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
failed.push({ model: adapter.id, error: result.error.message });
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
97
|
const lines = [];
|
|
168
|
-
|
|
98
|
+
const allFailed = results.every(r => !r.result.success);
|
|
99
|
+
const someFailed = results.some(r => !r.result.success);
|
|
100
|
+
if (allFailed)
|
|
169
101
|
lines.push('## Multi-Model Response ā All Failed\n');
|
|
170
|
-
|
|
171
|
-
else if (failed.length > 0) {
|
|
102
|
+
else if (someFailed)
|
|
172
103
|
lines.push('## Multi-Model Response ā ļø Partial Success\n');
|
|
173
|
-
|
|
174
|
-
else {
|
|
104
|
+
else
|
|
175
105
|
lines.push('## Multi-Model Response ā\n');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
for (const { model, output } of successful) {
|
|
180
|
-
lines.push(`### ${model.charAt(0).toUpperCase() + model.slice(1)} Response\n`);
|
|
181
|
-
lines.push(formatPeerResponse({ success: true, output, executionTimeMs: 0 }, model));
|
|
182
|
-
lines.push('');
|
|
183
|
-
}
|
|
184
|
-
if (failed.length > 0) {
|
|
185
|
-
lines.push('### Failures\n');
|
|
186
|
-
for (const { model, error } of failed) {
|
|
187
|
-
lines.push(`**${model}:** ${error}`);
|
|
188
|
-
}
|
|
106
|
+
lines.push(`**Models:** ${availableAdapters.map(a => a.id).join(', ')}\n`);
|
|
107
|
+
for (const { adapter, result } of results) {
|
|
108
|
+
lines.push(formatPeerResult(result, adapter.getCapabilities().name));
|
|
189
109
|
lines.push('');
|
|
190
110
|
}
|
|
191
|
-
if (successful.length > 1) {
|
|
192
|
-
lines.push(`---\n\n**Synthesis Instructions:**\n- Compare perspectives from each model\n- Note agreements and disagreements\n- Use your judgment to form a final answer`);
|
|
193
|
-
}
|
|
194
111
|
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
195
112
|
}
|
|
196
113
|
// =============================================================================
|