@in-the-loop-labs/pair-review 5.4.1 → 5.4.3
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 +3 -3
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/skills/analyze/references/level1-balanced.md +1 -1
- package/plugin-code-critic/skills/analyze/references/level1-thorough.md +1 -1
- package/plugin-code-critic/skills/analyze/references/level2-balanced.md +2 -2
- package/plugin-code-critic/skills/analyze/references/level2-thorough.md +2 -2
- package/plugin-code-critic/skills/analyze/references/level3-balanced.md +2 -2
- package/plugin-code-critic/skills/analyze/references/level3-thorough.md +2 -2
- package/plugin-code-critic/skills/analyze/references/orchestration-balanced.md +3 -3
- package/plugin-code-critic/skills/analyze/references/orchestration-fast.md +1 -1
- package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +3 -3
- package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
- package/public/index.html +3 -0
- package/public/js/components/CouncilProgressModal.js +2 -9
- package/public/js/index.js +29 -0
- package/public/js/pr.js +21 -8
- package/public/js/utils/category-emoji.js +1 -1
- package/public/js/utils/header-anchor.js +38 -0
- package/public/local.html +3 -0
- package/public/pr.html +3 -0
- package/src/ai/antigravity-provider.js +76 -35
- package/src/ai/claude-provider.js +115 -39
- package/src/ai/codex-provider.js +84 -41
- package/src/ai/copilot-provider.js +38 -46
- package/src/ai/cursor-agent-provider.js +78 -135
- package/src/ai/executable-provider.js +1 -1
- package/src/ai/pi-format.js +42 -1
- package/src/ai/pi-style-provider.js +25 -10
- package/src/ai/prompts/baseline/consolidation/balanced.js +2 -2
- package/src/ai/prompts/baseline/consolidation/thorough.js +2 -2
- package/src/ai/prompts/baseline/level1/balanced.js +1 -1
- package/src/ai/prompts/baseline/level1/thorough.js +1 -1
- package/src/ai/prompts/baseline/level2/balanced.js +2 -2
- package/src/ai/prompts/baseline/level2/thorough.js +2 -2
- package/src/ai/prompts/baseline/level3/balanced.js +2 -2
- package/src/ai/prompts/baseline/level3/thorough.js +2 -2
- package/src/ai/prompts/baseline/orchestration/balanced.js +2 -2
- package/src/ai/prompts/baseline/orchestration/thorough.js +2 -2
- package/src/ai/prompts/shared/output-schema.js +6 -201
- package/src/ai/provider.js +3 -3
- package/src/chat/session-manager.js +1 -1
- package/src/main.js +7 -3
- package/src/routes/bulk-analysis-configs.js +1 -1
- package/src/utils/category-emoji.js +1 -1
|
@@ -22,33 +22,43 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
|
|
|
22
22
|
*
|
|
23
23
|
* GitHub Copilot CLI supports multiple AI models including OpenAI,
|
|
24
24
|
* Anthropic, and Google models via the --model flag.
|
|
25
|
-
*
|
|
26
|
-
* claude-sonnet-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Built-in models (as of November 2026): claude-haiku-5.5, gpt-5.6-luna (fast);
|
|
26
|
+
* claude-sonnet-5.5 (default), gpt-5.6-terra (balanced); claude-opus-5.5,
|
|
27
|
+
* gpt-5.6-sol (thorough). Any other id Copilot supports (gpt-6.1-sol,
|
|
28
|
+
* claude-fable-5.2, gemini-4-argon, ...) can be passed verbatim with --model or
|
|
29
|
+
* added via `providers.copilot.models`.
|
|
30
|
+
* Ids and prices: docs.github.com/en/copilot/reference/ai-models/supported-models
|
|
31
|
+
*
|
|
32
|
+
* Deprecated (November 2026): claude-sonnet-4.6, claude-opus-4.5, claude-opus-4.6
|
|
33
|
+
* (retired 2026-09-01), claude-opus-4.6-fast (retired 2026-06-29), gpt-5.4 and
|
|
34
|
+
* gpt-5.4-mini (retired 2026-10-19), claude-haiku-4.6 (never in Copilot's
|
|
35
|
+
* supported list), gpt-5.3-codex (still supported, dropped from the built-ins
|
|
36
|
+
* as superseded by GPT-5.6). None are aliased: their successors are different
|
|
37
|
+
* generations at different prices, so a saved council fails loudly rather than
|
|
38
|
+
* silently running another model.
|
|
29
39
|
*/
|
|
30
40
|
const COPILOT_MODELS = [
|
|
31
41
|
{
|
|
32
|
-
id: 'claude-haiku-
|
|
33
|
-
name: 'Claude Haiku
|
|
42
|
+
id: 'claude-haiku-5.5',
|
|
43
|
+
name: 'Claude Haiku 5.5',
|
|
34
44
|
tier: 'fast',
|
|
35
45
|
tagline: 'Quick Scan',
|
|
36
|
-
description: 'Rapid feedback for obvious issues, style checks, and simple logic errors',
|
|
46
|
+
description: 'Rapid, very low-cost feedback for obvious issues, style checks, and simple logic errors',
|
|
37
47
|
badge: 'Speedy',
|
|
38
48
|
badgeClass: 'badge-speed'
|
|
39
49
|
},
|
|
40
50
|
{
|
|
41
|
-
id: 'gpt-5.
|
|
42
|
-
name: 'GPT-5.
|
|
51
|
+
id: 'gpt-5.6-luna',
|
|
52
|
+
name: 'GPT-5.6 Luna',
|
|
43
53
|
tier: 'fast',
|
|
44
54
|
tagline: 'Fast & Cheap',
|
|
45
|
-
description: 'Low-cost
|
|
55
|
+
description: 'Low-cost OpenAI model for quick reviews with solid reasoning',
|
|
46
56
|
badge: 'Fast',
|
|
47
57
|
badgeClass: 'badge-speed'
|
|
48
58
|
},
|
|
49
59
|
{
|
|
50
|
-
id: 'claude-sonnet-
|
|
51
|
-
name: 'Claude Sonnet
|
|
60
|
+
id: 'claude-sonnet-5.5',
|
|
61
|
+
name: 'Claude Sonnet 5.5',
|
|
52
62
|
tier: 'balanced',
|
|
53
63
|
tagline: 'Best Balance',
|
|
54
64
|
description: 'Latest Sonnet—excellent code understanding with fast turnaround',
|
|
@@ -57,49 +67,31 @@ const COPILOT_MODELS = [
|
|
|
57
67
|
default: true
|
|
58
68
|
},
|
|
59
69
|
{
|
|
60
|
-
id: 'gpt-5.
|
|
61
|
-
name: 'GPT-5.
|
|
62
|
-
tier: '
|
|
63
|
-
tagline: '
|
|
64
|
-
description: '
|
|
65
|
-
badge: '
|
|
66
|
-
badgeClass: 'badge-
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: 'gpt-5.3-codex',
|
|
70
|
-
name: 'GPT-5.3 Codex',
|
|
71
|
-
tier: 'thorough',
|
|
72
|
-
tagline: 'Deep Code Analysis',
|
|
73
|
-
description: 'Industry-leading coding model—frontier performance for complex multi-file reviews',
|
|
74
|
-
badge: 'Thorough',
|
|
75
|
-
badgeClass: 'badge-power'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: 'claude-opus-4.5',
|
|
79
|
-
name: 'Claude Opus 4.5',
|
|
80
|
-
tier: 'thorough',
|
|
81
|
-
tagline: 'Deep Analysis',
|
|
82
|
-
description: 'Highly capable model for critical code reviews—strong reasoning for security and architecture',
|
|
83
|
-
badge: 'Premium',
|
|
84
|
-
badgeClass: 'badge-premium'
|
|
70
|
+
id: 'gpt-5.6-terra',
|
|
71
|
+
name: 'GPT-5.6 Terra',
|
|
72
|
+
tier: 'balanced',
|
|
73
|
+
tagline: 'Balanced OpenAI',
|
|
74
|
+
description: 'Mid-tier OpenAI model—strong coding quality at a moderate price',
|
|
75
|
+
badge: 'Balanced',
|
|
76
|
+
badgeClass: 'badge-balanced'
|
|
85
77
|
},
|
|
86
78
|
{
|
|
87
|
-
id: 'claude-opus-
|
|
88
|
-
name: 'Claude Opus
|
|
79
|
+
id: 'claude-opus-5.5',
|
|
80
|
+
name: 'Claude Opus 5.5',
|
|
89
81
|
tier: 'thorough',
|
|
90
82
|
tagline: 'Most Capable',
|
|
91
|
-
description: 'Most capable model for critical code reviews—deep reasoning for security and architecture',
|
|
83
|
+
description: 'Most capable Claude model for critical code reviews—deep reasoning for security and architecture',
|
|
92
84
|
badge: 'Premium',
|
|
93
85
|
badgeClass: 'badge-premium'
|
|
94
86
|
},
|
|
95
87
|
{
|
|
96
|
-
id: '
|
|
97
|
-
name: '
|
|
88
|
+
id: 'gpt-5.6-sol',
|
|
89
|
+
name: 'GPT-5.6 Sol',
|
|
98
90
|
tier: 'thorough',
|
|
99
|
-
tagline: '
|
|
100
|
-
description: '
|
|
101
|
-
badge: '
|
|
102
|
-
badgeClass: 'badge-
|
|
91
|
+
tagline: 'Deep Analysis',
|
|
92
|
+
description: 'Flagship OpenAI workhorse for complex multi-file and architectural reviews',
|
|
93
|
+
badge: 'Thorough',
|
|
94
|
+
badgeClass: 'badge-power'
|
|
103
95
|
}
|
|
104
96
|
];
|
|
105
97
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
const path = require('path');
|
|
18
18
|
const { spawn } = require('child_process');
|
|
19
|
-
const { AIProvider, registerProvider, quoteShellArgs } = require('./provider');
|
|
19
|
+
const { AIProvider, registerProvider, quoteShellArgs, modelMatches } = require('./provider');
|
|
20
20
|
const logger = require('../utils/logger');
|
|
21
21
|
const { extractJSON } = require('../utils/json-extractor');
|
|
22
22
|
const { CancellationError, isAnalysisCancelled } = require('../routes/shared');
|
|
@@ -29,11 +29,23 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
|
|
|
29
29
|
/**
|
|
30
30
|
* Cursor Agent model definitions with tier mappings
|
|
31
31
|
*
|
|
32
|
-
* Tier structure:
|
|
32
|
+
* Tier structure (as of November 2026):
|
|
33
33
|
* - free (auto): Cursor's default auto-routing model
|
|
34
|
-
* - fast (composer-2
|
|
35
|
-
* - balanced (composer-
|
|
36
|
-
* - thorough (
|
|
34
|
+
* - fast (composer-2.5-fast): Quick analysis
|
|
35
|
+
* - balanced (composer-2.5 (default)): Recommended for most reviews
|
|
36
|
+
* - thorough (gpt-5.3-codex-high): Deep analysis for complex code
|
|
37
|
+
*
|
|
38
|
+
* Any other model the account has enabled can be passed verbatim with --model
|
|
39
|
+
* (see `cursor-agent --list-models`) or added via `providers.cursor-agent.models`.
|
|
40
|
+
* Models and prices: cursor.com/docs/models
|
|
41
|
+
*
|
|
42
|
+
* Deprecated (November 2026): composer-2 (alias → composer-2.5, same line and
|
|
43
|
+
* price), composer-2-fast, composer-1.5 (Composer models superseded by
|
|
44
|
+
* Composer 2.5); gpt-5.3-codex-fast, gpt-5.3-codex-xhigh, gpt-5.4-high,
|
|
45
|
+
* gpt-5.4-medium, sonnet-4.5-thinking, sonnet-4.6-thinking, opus-4.5-thinking,
|
|
46
|
+
* opus-4.6-thinking, gemini-3-flash, gemini-3.1-pro (older generations, hidden
|
|
47
|
+
* by default in Cursor). Only composer-2 is aliased; the others' successors are
|
|
48
|
+
* different generations at different prices.
|
|
37
49
|
*/
|
|
38
50
|
const CURSOR_AGENT_MODELS = [
|
|
39
51
|
{
|
|
@@ -46,131 +58,33 @@ const CURSOR_AGENT_MODELS = [
|
|
|
46
58
|
badgeClass: 'badge-speed'
|
|
47
59
|
},
|
|
48
60
|
{
|
|
49
|
-
id: 'composer-2',
|
|
50
|
-
name: 'Composer 2',
|
|
51
|
-
tier: 'thorough',
|
|
52
|
-
tagline: 'Latest Composer',
|
|
53
|
-
description: 'Frontier-level coding model trained with compaction-in-the-loop RL—strong on long-horizon tasks requiring hundreds of actions',
|
|
54
|
-
badge: 'Latest',
|
|
55
|
-
badgeClass: 'badge-power'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 'composer-2-fast',
|
|
59
|
-
name: 'Composer 2 Fast',
|
|
61
|
+
id: 'composer-2.5-fast',
|
|
62
|
+
name: 'Composer 2.5 Fast',
|
|
60
63
|
tier: 'fast',
|
|
61
64
|
tagline: 'Fast Composer',
|
|
62
|
-
description: 'Same intelligence as Composer 2 with lower latency—
|
|
63
|
-
badge: 'Fast',
|
|
64
|
-
badgeClass: 'badge-speed'
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 'composer-1.5',
|
|
68
|
-
name: 'Composer 1.5',
|
|
69
|
-
tier: 'balanced',
|
|
70
|
-
tagline: 'Previous Composer',
|
|
71
|
-
description: 'Previous generation Cursor Composer model—positioned between Sonnet and Opus for multi-file edits',
|
|
72
|
-
badge: 'Previous Gen',
|
|
73
|
-
badgeClass: 'badge-balanced',
|
|
74
|
-
default: true
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: 'gpt-5.3-codex-fast',
|
|
78
|
-
name: 'GPT-5.3 Codex Fast',
|
|
79
|
-
tier: 'fast',
|
|
80
|
-
tagline: 'Lightning Fast',
|
|
81
|
-
description: 'Latest code-specialized model optimized for speed—quick scans for obvious issues',
|
|
82
|
-
badge: 'Fastest',
|
|
83
|
-
badgeClass: 'badge-speed'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: 'gemini-3-flash',
|
|
87
|
-
name: 'Gemini 3 Flash',
|
|
88
|
-
tier: 'fast',
|
|
89
|
-
tagline: 'Fast & Capable',
|
|
90
|
-
description: 'High SWE-bench scores at a fraction of the cost—great for quick reviews',
|
|
65
|
+
description: 'Same intelligence as Composer 2.5 with lower latency—quick scans for obvious issues',
|
|
91
66
|
badge: 'Fast',
|
|
92
67
|
badgeClass: 'badge-speed'
|
|
93
68
|
},
|
|
94
69
|
{
|
|
95
|
-
id: '
|
|
96
|
-
name: '
|
|
70
|
+
id: 'composer-2.5',
|
|
71
|
+
name: 'Composer 2.5',
|
|
97
72
|
tier: 'balanced',
|
|
98
73
|
tagline: 'Best Balance',
|
|
99
|
-
description: '
|
|
74
|
+
description: "Cursor's latest in-house coding model—near-frontier review quality at a fraction of the cost",
|
|
100
75
|
badge: 'Recommended',
|
|
101
|
-
badgeClass: 'badge-recommended'
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
id: 'sonnet-4.5-thinking',
|
|
105
|
-
name: 'Claude 4.5 Sonnet (Thinking)',
|
|
106
|
-
tier: 'balanced',
|
|
107
|
-
tagline: 'Previous Gen',
|
|
108
|
-
description: 'Previous generation extended thinking—still strong for thorough analysis',
|
|
109
|
-
badge: 'Previous Gen',
|
|
110
|
-
badgeClass: 'badge-balanced'
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: 'gemini-3.1-pro',
|
|
114
|
-
name: 'Gemini 3.1 Pro',
|
|
115
|
-
tier: 'balanced',
|
|
116
|
-
tagline: 'Latest Gemini',
|
|
117
|
-
description: 'Newest Gemini model—cutting-edge reasoning for complex multi-file reviews',
|
|
118
|
-
badge: 'Latest',
|
|
119
|
-
badgeClass: 'badge-balanced'
|
|
76
|
+
badgeClass: 'badge-recommended',
|
|
77
|
+
default: true,
|
|
78
|
+
aliases: ['composer-2']
|
|
120
79
|
},
|
|
121
80
|
{
|
|
122
81
|
id: 'gpt-5.3-codex-high',
|
|
123
82
|
name: 'GPT-5.3 Codex High',
|
|
124
83
|
tier: 'thorough',
|
|
125
84
|
tagline: 'Deep Code Analysis',
|
|
126
|
-
description:
|
|
127
|
-
badge: 'Thorough',
|
|
128
|
-
badgeClass: 'badge-power'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
id: 'gpt-5.3-codex-xhigh',
|
|
132
|
-
name: 'GPT-5.3 Codex Extra High',
|
|
133
|
-
tier: 'thorough',
|
|
134
|
-
tagline: 'Maximum Reasoning',
|
|
135
|
-
description: 'Highest reasoning effort for the most complex architectural reviews',
|
|
136
|
-
badge: 'Maximum',
|
|
137
|
-
badgeClass: 'badge-power'
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: 'opus-4.5-thinking',
|
|
141
|
-
name: 'Claude 4.5 Opus (Thinking)',
|
|
142
|
-
tier: 'thorough',
|
|
143
|
-
tagline: 'Deep Analysis',
|
|
144
|
-
description: 'Deep analysis with extended thinking for complex code reviews',
|
|
145
|
-
badge: 'Thorough',
|
|
146
|
-
badgeClass: 'badge-power'
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
id: 'opus-4.6-thinking',
|
|
150
|
-
name: 'Claude 4.6 Opus (Thinking)',
|
|
151
|
-
tier: 'thorough',
|
|
152
|
-
tagline: 'Most Capable',
|
|
153
|
-
description: 'Deep analysis with extended thinking—Cursor default for maximum review quality',
|
|
85
|
+
description: 'Code-specialized OpenAI model with high reasoning effort for complex multi-file reviews',
|
|
154
86
|
badge: 'Most Thorough',
|
|
155
87
|
badgeClass: 'badge-power'
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
id: 'gpt-5.4-high',
|
|
159
|
-
name: 'GPT-5.4 High',
|
|
160
|
-
tier: 'thorough',
|
|
161
|
-
tagline: 'Latest OpenAI',
|
|
162
|
-
description: 'Latest generation with high reasoning effort—strong for complex architectural reviews',
|
|
163
|
-
badge: 'Latest Gen',
|
|
164
|
-
badgeClass: 'badge-power'
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: 'gpt-5.4-medium',
|
|
168
|
-
name: 'GPT-5.4',
|
|
169
|
-
tier: 'thorough',
|
|
170
|
-
tagline: 'Latest Gen',
|
|
171
|
-
description: 'Latest generation at medium reasoning depth',
|
|
172
|
-
badge: 'Latest',
|
|
173
|
-
badgeClass: 'badge-power'
|
|
174
88
|
}
|
|
175
89
|
];
|
|
176
90
|
|
|
@@ -232,24 +146,21 @@ class CursorAgentProvider extends AIProvider {
|
|
|
232
146
|
const permissionArgs = configOverrides.yolo
|
|
233
147
|
? ['--yolo']
|
|
234
148
|
: ['--trust', '--sandbox', 'enabled'];
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
const
|
|
149
|
+
// Alias-aware: `--model` gets the canonical id and the override is matched on
|
|
150
|
+
// the union of selector, canonical id and aliases (see _resolveModelConfig).
|
|
151
|
+
const { cliModel, extraArgs, env } = this._resolveModelConfig(model);
|
|
152
|
+
const baseArgs = ['-p', '--output-format', 'stream-json', '--stream-partial-output', '--model', cliModel, ...permissionArgs];
|
|
239
153
|
|
|
240
154
|
// Merge env: provider env + model env
|
|
241
|
-
this.extraEnv =
|
|
242
|
-
...(configOverrides.env || {}),
|
|
243
|
-
...(modelConfig?.env || {})
|
|
244
|
-
};
|
|
155
|
+
this.extraEnv = env;
|
|
245
156
|
|
|
246
157
|
if (this.useShell) {
|
|
247
158
|
// In shell mode, build full command string with args
|
|
248
|
-
this.command = `${agentCmd} ${quoteShellArgs([...baseArgs, ...
|
|
159
|
+
this.command = `${agentCmd} ${quoteShellArgs([...baseArgs, ...extraArgs]).join(' ')}`;
|
|
249
160
|
this.args = [];
|
|
250
161
|
} else {
|
|
251
162
|
this.command = agentCmd;
|
|
252
|
-
this.args = [...baseArgs, ...
|
|
163
|
+
this.args = [...baseArgs, ...extraArgs];
|
|
253
164
|
}
|
|
254
165
|
}
|
|
255
166
|
|
|
@@ -760,16 +671,13 @@ class CursorAgentProvider extends AIProvider {
|
|
|
760
671
|
* @returns {string[]} Complete args array for the CLI
|
|
761
672
|
*/
|
|
762
673
|
buildArgsForModel(model) {
|
|
674
|
+
// Provider extra_args + model extra_args, resolved alias-aware
|
|
675
|
+
const { cliModel, extraArgs } = this._resolveModelConfig(model);
|
|
763
676
|
// Base args for extraction (text output, no tools needed)
|
|
764
677
|
// --trust needed to auto-approve the working directory without interactive prompt
|
|
765
|
-
const baseArgs = ['-p', '--output-format', 'text', '--trust', '--model',
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
// Model-specific extra_args (from the model config for the given model)
|
|
769
|
-
const modelConfig = this.configOverrides?.models?.find(m => m.id === model);
|
|
770
|
-
const modelArgs = modelConfig?.extra_args || [];
|
|
771
|
-
|
|
772
|
-
return [...baseArgs, ...providerArgs, ...modelArgs];
|
|
678
|
+
const baseArgs = ['-p', '--output-format', 'text', '--trust', '--model', cliModel];
|
|
679
|
+
|
|
680
|
+
return [...baseArgs, ...extraArgs];
|
|
773
681
|
}
|
|
774
682
|
|
|
775
683
|
/**
|
|
@@ -781,11 +689,46 @@ class CursorAgentProvider extends AIProvider {
|
|
|
781
689
|
* @returns {Object} Env vars to merge into the child environment
|
|
782
690
|
*/
|
|
783
691
|
_resolveEnvForModel(model) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
692
|
+
return this._resolveModelConfig(model).env;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Single id-or-alias resolution shared by the analysis constructor, the
|
|
697
|
+
* extraction args, and the extraction env, so the same selector always runs
|
|
698
|
+
* the same model with the same override.
|
|
699
|
+
*
|
|
700
|
+
* - The built-in entry matches by canonical id or alias (`composer-2` →
|
|
701
|
+
* `composer-2.5`).
|
|
702
|
+
* - A `providers.cursor-agent.models` override matches on the union of the
|
|
703
|
+
* selector, the built-in's canonical id, and its aliases, or by one of the
|
|
704
|
+
* override's own aliases. `applyConfigOverrides()` stores alias-keyed
|
|
705
|
+
* overrides under the canonical id, so an exact-id match would miss them.
|
|
706
|
+
* - `--model` gets the canonical id. Unknown ids pass through verbatim, so
|
|
707
|
+
* any model the account enables can still be named directly.
|
|
708
|
+
*
|
|
709
|
+
* @param {string} modelId - Selector (canonical id, alias, or any Cursor id)
|
|
710
|
+
* @returns {{ builtIn: Object|undefined, configModel: Object|undefined, cliModel: string, extraArgs: string[], env: Object }}
|
|
711
|
+
* @private
|
|
712
|
+
*/
|
|
713
|
+
_resolveModelConfig(modelId) {
|
|
714
|
+
const configOverrides = this.configOverrides || {};
|
|
715
|
+
|
|
716
|
+
const builtIn = CURSOR_AGENT_MODELS.find(m => modelMatches(m, modelId));
|
|
717
|
+
const modelKeys = new Set([modelId, builtIn?.id, ...(builtIn?.aliases || [])].filter(Boolean));
|
|
718
|
+
const configModel = configOverrides.models?.find(
|
|
719
|
+
m => modelKeys.has(m.id) || (m.aliases || []).some(a => modelKeys.has(a))
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
const cliModel = builtIn?.id || configModel?.id || modelId;
|
|
723
|
+
|
|
724
|
+
// Merge: provider config → per-model config (built-ins carry no args/env)
|
|
725
|
+
const extraArgs = [...(configOverrides.extra_args || []), ...(configModel?.extra_args || [])];
|
|
726
|
+
const env = {
|
|
727
|
+
...(configOverrides.env || {}),
|
|
728
|
+
...(configModel?.env || {})
|
|
788
729
|
};
|
|
730
|
+
|
|
731
|
+
return { builtIn, configModel, cliModel, extraArgs, env };
|
|
789
732
|
}
|
|
790
733
|
|
|
791
734
|
/**
|
|
@@ -65,7 +65,7 @@ Map the tool's output to this exact JSON schema:
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
Rules:
|
|
68
|
-
- Include a "reasoning" array with
|
|
68
|
+
- Include a "reasoning" array with concise evidence for how you mapped the tool output
|
|
69
69
|
- Map each review finding to one suggestion object
|
|
70
70
|
- Use "NEW" for old_or_new (external tools review the new version)
|
|
71
71
|
- Preserve severity if the tool provides it
|
package/src/ai/pi-format.js
CHANGED
|
@@ -203,6 +203,44 @@ function extractPiEventText(event, seenTexts) {
|
|
|
203
203
|
return text;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Extract the outcome of the last assistant message in a Pi JSONL event.
|
|
208
|
+
*
|
|
209
|
+
* Pi and OMP report a failed model request (for example, a provider refusal)
|
|
210
|
+
* as an assistant message with an `errorMessage`. The CLI writes this message
|
|
211
|
+
* only to stdout, so stderr alone does not explain the failure.
|
|
212
|
+
*
|
|
213
|
+
* Only the last assistant message in the event counts. A later message that
|
|
214
|
+
* succeeded replaces an earlier error, so a turn that the CLI retried
|
|
215
|
+
* successfully does not report its old error. Non-assistant messages and
|
|
216
|
+
* assistant messages whose `errorMessage` is empty or only whitespace give no
|
|
217
|
+
* signal either way and are ignored.
|
|
218
|
+
*
|
|
219
|
+
* @param {Object} event - Parsed Pi event object
|
|
220
|
+
* @returns {{errorMessage: string|null}|null} The last assistant message's
|
|
221
|
+
* outcome (`errorMessage` is null when it succeeded), or null when the event
|
|
222
|
+
* carries no assistant message
|
|
223
|
+
*/
|
|
224
|
+
function extractPiEventError(event) {
|
|
225
|
+
let messages = [];
|
|
226
|
+
if (event?.type === 'agent_end' && Array.isArray(event.messages)) {
|
|
227
|
+
messages = event.messages;
|
|
228
|
+
} else if (event?.type === 'message_end' || event?.type === 'turn_end') {
|
|
229
|
+
messages = [event.message];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
let outcome = null;
|
|
233
|
+
for (const msg of messages) {
|
|
234
|
+
if (msg?.role !== 'assistant') continue;
|
|
235
|
+
if (msg.errorMessage === undefined || msg.errorMessage === null) {
|
|
236
|
+
outcome = { errorMessage: null };
|
|
237
|
+
} else if (typeof msg.errorMessage === 'string' && msg.errorMessage.trim()) {
|
|
238
|
+
outcome = { errorMessage: msg.errorMessage.trim() };
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return outcome;
|
|
242
|
+
}
|
|
243
|
+
|
|
206
244
|
/**
|
|
207
245
|
* Accumulate only raw lines that could plausibly help the direct JSON fallback.
|
|
208
246
|
* Pi JSONL event envelopes are intentionally excluded because they are noisy
|
|
@@ -251,7 +289,7 @@ function accumulatePiRawFallbackLine(line, state, levelPrefix, parseResult, cliN
|
|
|
251
289
|
* Parse a single Pi JSONL line into accumulated assistant text.
|
|
252
290
|
*
|
|
253
291
|
* @param {string} line - One JSONL line
|
|
254
|
-
* @param {{textContent: string, seenTexts: Set<string>, rawOutput: string, rawOutputTruncated: boolean}} state - Parse state
|
|
292
|
+
* @param {{textContent: string, seenTexts: Set<string>, rawOutput: string, rawOutputTruncated: boolean, errorMessage?: string|null}} state - Parse state
|
|
255
293
|
* @param {string} levelPrefix - Prefix used in logs
|
|
256
294
|
* @param {string} [cliName='Pi'] - CLI name used in log messages
|
|
257
295
|
*/
|
|
@@ -262,6 +300,8 @@ function accumulatePiResponseLine(line, state, levelPrefix, cliName = 'Pi') {
|
|
|
262
300
|
try {
|
|
263
301
|
const event = JSON.parse(line);
|
|
264
302
|
state.textContent += extractPiEventText(event, state.seenTexts);
|
|
303
|
+
const outcome = extractPiEventError(event);
|
|
304
|
+
if (outcome) state.errorMessage = outcome.errorMessage;
|
|
265
305
|
parseResult = { status: 'parsed', value: event };
|
|
266
306
|
} catch {
|
|
267
307
|
logger.debug(`${levelPrefix} Skipping malformed JSONL line: ${line.substring(0, 100)}`);
|
|
@@ -527,6 +567,7 @@ module.exports = {
|
|
|
527
567
|
appendHeadTailBuffer,
|
|
528
568
|
formatHeadTailBuffer,
|
|
529
569
|
extractPiEventText,
|
|
570
|
+
extractPiEventError,
|
|
530
571
|
accumulatePiRawFallbackLine,
|
|
531
572
|
accumulatePiResponseLine,
|
|
532
573
|
appendPiChunkToLineBuffer,
|
|
@@ -132,7 +132,8 @@ class PiStyleProvider extends AIProvider {
|
|
|
132
132
|
textContent: '',
|
|
133
133
|
seenTexts: new Set(),
|
|
134
134
|
rawOutput: '',
|
|
135
|
-
rawOutputTruncated: false
|
|
135
|
+
rawOutputTruncated: false,
|
|
136
|
+
errorMessage: null
|
|
136
137
|
};
|
|
137
138
|
|
|
138
139
|
const settle = (fn, value) => {
|
|
@@ -224,6 +225,15 @@ class PiStyleProvider extends AIProvider {
|
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
227
|
|
|
228
|
+
// Process any remaining buffered line before the exit check, so that a
|
|
229
|
+
// final unterminated event can still supply the model error message.
|
|
230
|
+
if (lineBufferState.buffer.trim()) {
|
|
231
|
+
lineCount++;
|
|
232
|
+
emitStreamLine(lineBufferState.buffer);
|
|
233
|
+
this.logStreamLine(lineBufferState.buffer, lineCount, levelPrefix);
|
|
234
|
+
accumulatePiResponseLine(lineBufferState.buffer, responseState, levelPrefix, this.cliName);
|
|
235
|
+
}
|
|
236
|
+
|
|
227
237
|
const stderr = formatHeadTailBuffer(stderrCapture);
|
|
228
238
|
|
|
229
239
|
// Always log stderr if present
|
|
@@ -237,18 +247,15 @@ class PiStyleProvider extends AIProvider {
|
|
|
237
247
|
|
|
238
248
|
if (code !== 0) {
|
|
239
249
|
logger.error(`${levelPrefix} ${this.cliName} CLI exited with code ${code}`);
|
|
240
|
-
|
|
250
|
+
// The model error (for example, a provider refusal) is only on stdout.
|
|
251
|
+
if (responseState.errorMessage) {
|
|
252
|
+
logger.error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`);
|
|
253
|
+
}
|
|
254
|
+
const details = [responseState.errorMessage, stderr.trim()].filter(Boolean).join('\n');
|
|
255
|
+
settle(reject, new Error(`${levelPrefix} ${this.cliName} CLI exited with code ${code}: ${details}`));
|
|
241
256
|
return;
|
|
242
257
|
}
|
|
243
258
|
|
|
244
|
-
// Process any remaining buffered line
|
|
245
|
-
if (lineBufferState.buffer.trim()) {
|
|
246
|
-
lineCount++;
|
|
247
|
-
emitStreamLine(lineBufferState.buffer);
|
|
248
|
-
this.logStreamLine(lineBufferState.buffer, lineCount, levelPrefix);
|
|
249
|
-
accumulatePiResponseLine(lineBufferState.buffer, responseState, levelPrefix, this.cliName);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
259
|
logger.info(`${levelPrefix} ${this.cliName} CLI completed - received ${lineCount} JSONL events`);
|
|
253
260
|
|
|
254
261
|
// Parse the JSONL response
|
|
@@ -270,6 +277,14 @@ class PiStyleProvider extends AIProvider {
|
|
|
270
277
|
}
|
|
271
278
|
|
|
272
279
|
settle(resolve, parsed.data);
|
|
280
|
+
} else if (responseState.errorMessage) {
|
|
281
|
+
// The CLI exited 0 but the final model request failed. A later
|
|
282
|
+
// successful assistant message clears errorMessage, so it is only set
|
|
283
|
+
// here when the run ended on the error. Any earlier assistant text is
|
|
284
|
+
// pre-tool narration, not a review to extract, so the LLM extraction
|
|
285
|
+
// fallback would only cost a model call and hide the real cause.
|
|
286
|
+
logger.error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`);
|
|
287
|
+
settle(reject, new Error(`${levelPrefix} ${this.cliName} model error: ${responseState.errorMessage}`));
|
|
273
288
|
} else {
|
|
274
289
|
// Regex extraction failed, try LLM-based extraction as fallback
|
|
275
290
|
logger.warn(`${levelPrefix} Regex extraction failed: ${parsed.error}`);
|
|
@@ -149,7 +149,7 @@ Output JSON with this structure:
|
|
|
149
149
|
"description": "Detailed explanation",
|
|
150
150
|
"suggestion": "How to fix/improve (omit for praise)",
|
|
151
151
|
"confidence": 0.0-1.0,
|
|
152
|
-
"reasoning": ["
|
|
152
|
+
"reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
|
|
153
153
|
}
|
|
154
154
|
],
|
|
155
155
|
"fileLevelSuggestions": [{
|
|
@@ -160,7 +160,7 @@ Output JSON with this structure:
|
|
|
160
160
|
"description": "Explanation of the file-level observation",
|
|
161
161
|
"suggestion": "How to address the file-level concern (omit for praise items)",
|
|
162
162
|
"confidence": 0.0-1.0,
|
|
163
|
-
"reasoning": ["
|
|
163
|
+
"reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
|
|
164
164
|
}],
|
|
165
165
|
"summary": "Formatted markdown summary following the Summary Synthesis guidance above."
|
|
166
166
|
}
|
|
@@ -204,7 +204,7 @@ Output JSON with this structure:
|
|
|
204
204
|
"description": "Detailed explanation",
|
|
205
205
|
"suggestion": "How to fix/improve (omit for praise)",
|
|
206
206
|
"confidence": 0.0-1.0,
|
|
207
|
-
"reasoning": ["
|
|
207
|
+
"reasoning": ["Concise code evidence and impact supporting this issue"]
|
|
208
208
|
}
|
|
209
209
|
],
|
|
210
210
|
"fileLevelSuggestions": [{
|
|
@@ -215,7 +215,7 @@ Output JSON with this structure:
|
|
|
215
215
|
"description": "Explanation of the file-level observation",
|
|
216
216
|
"suggestion": "How to address the file-level concern (omit for praise items)",
|
|
217
217
|
"confidence": 0.0-1.0,
|
|
218
|
-
"reasoning": ["
|
|
218
|
+
"reasoning": ["Concise code evidence and impact supporting this issue"]
|
|
219
219
|
}],
|
|
220
220
|
"summary": "Formatted markdown summary following the Summary Synthesis Guidance above."
|
|
221
221
|
}
|
|
@@ -125,7 +125,7 @@ Omit severity for praise items.
|
|
|
125
125
|
"description": "Detailed explanation",
|
|
126
126
|
"suggestion": "How to fix/improve (omit for praise items)",
|
|
127
127
|
"confidence": 0.0-1.0,
|
|
128
|
-
"reasoning": ["
|
|
128
|
+
"reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
|
|
129
129
|
}],
|
|
130
130
|
"summary": "Brief summary of findings"
|
|
131
131
|
}
|
|
@@ -149,7 +149,7 @@ Output JSON with this structure:
|
|
|
149
149
|
"description": "Detailed explanation",
|
|
150
150
|
"suggestion": "How to fix/improve (omit this field for praise items - no action needed)",
|
|
151
151
|
"confidence": 0.0-1.0,
|
|
152
|
-
"reasoning": ["
|
|
152
|
+
"reasoning": ["Concise code evidence and impact supporting this issue"]
|
|
153
153
|
}],
|
|
154
154
|
"summary": "Brief summary of findings"
|
|
155
155
|
}
|
|
@@ -123,7 +123,7 @@ Omit severity for praise items.
|
|
|
123
123
|
"description": "Explanation mentioning why full file context was needed",
|
|
124
124
|
"suggestion": "How to fix/improve (omit for praise items)",
|
|
125
125
|
"confidence": 0.0-1.0,
|
|
126
|
-
"reasoning": ["
|
|
126
|
+
"reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
|
|
127
127
|
}],
|
|
128
128
|
"fileLevelSuggestions": [{
|
|
129
129
|
"file": "path/to/file",
|
|
@@ -133,7 +133,7 @@ Omit severity for praise items.
|
|
|
133
133
|
"description": "File-level observation (architecture, organization, naming, etc.)",
|
|
134
134
|
"suggestion": "How to address (omit for praise items)",
|
|
135
135
|
"confidence": 0.0-1.0,
|
|
136
|
-
"reasoning": ["
|
|
136
|
+
"reasoning": ["Concise code evidence and impact supporting this issue (optional)"]
|
|
137
137
|
}],
|
|
138
138
|
"summary": "Brief summary of file context findings"
|
|
139
139
|
}
|
|
@@ -180,7 +180,7 @@ Output JSON with this structure:
|
|
|
180
180
|
"description": "Detailed explanation mentioning why full file context was needed",
|
|
181
181
|
"suggestion": "How to fix/improve based on file context (omit for praise items)",
|
|
182
182
|
"confidence": 0.0-1.0,
|
|
183
|
-
"reasoning": ["
|
|
183
|
+
"reasoning": ["Concise code evidence and impact supporting this issue"]
|
|
184
184
|
}],
|
|
185
185
|
"fileLevelSuggestions": [{
|
|
186
186
|
"file": "path/to/file",
|
|
@@ -190,7 +190,7 @@ Output JSON with this structure:
|
|
|
190
190
|
"description": "Explanation of the file-level observation (architecture, organization, naming, etc.)",
|
|
191
191
|
"suggestion": "How to address the file-level concern (omit for praise items)",
|
|
192
192
|
"confidence": 0.0-1.0,
|
|
193
|
-
"reasoning": ["
|
|
193
|
+
"reasoning": ["Concise code evidence and impact supporting this issue"]
|
|
194
194
|
}],
|
|
195
195
|
"summary": "Brief summary of file context findings"
|
|
196
196
|
}
|