@in-the-loop-labs/pair-review 5.3.4 → 5.3.6

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 (59) hide show
  1. package/README.md +13 -1
  2. package/bin/git-diff-lines +2 -1
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json +1 -1
  5. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  6. package/plugin-code-critic/skills/analyze/scripts/git-diff-lines +104 -25
  7. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  8. package/public/css/pr.css +162 -46
  9. package/public/css/styles.css +0 -12
  10. package/public/js/components/AIPanel.js +3 -2
  11. package/public/js/components/AnalysisConfigModal.js +4 -1
  12. package/public/js/components/ChatPanel.js +39 -8
  13. package/public/js/components/PanelGroup.js +115 -21
  14. package/public/js/components/SuggestionNavigator.js +16 -3
  15. package/public/js/local.js +7 -12
  16. package/public/js/modules/diff-renderer.js +13 -0
  17. package/public/js/modules/file-comment-manager.js +19 -10
  18. package/public/js/modules/hunk-parser.js +39 -2
  19. package/public/js/modules/panel-resizer.js +41 -3
  20. package/public/js/modules/pierre-bridge.js +11 -2
  21. package/public/js/modules/suggestion-manager.js +128 -33
  22. package/public/js/pr.js +132 -29
  23. package/public/js/repo-settings.js +35 -19
  24. package/public/js/utils/git-paths.js +140 -0
  25. package/public/js/utils/smart-truncate.js +88 -0
  26. package/public/local.html +6 -0
  27. package/public/pr.html +6 -0
  28. package/src/ai/analyzer.js +15 -13
  29. package/src/ai/antigravity-provider.js +44 -24
  30. package/src/ai/cursor-agent-provider.js +4 -4
  31. package/src/ai/muse-provider.js +68 -3
  32. package/src/ai/summary-generator.js +8 -5
  33. package/src/chat/acp-bridge.js +26 -1
  34. package/src/chat/claude-code-bridge.js +10 -0
  35. package/src/chat/codex-bridge.js +10 -0
  36. package/src/chat/pi-bridge.js +10 -0
  37. package/src/chat/session-manager.js +333 -19
  38. package/src/config.js +40 -26
  39. package/src/git/diff-flags.js +26 -12
  40. package/src/git/worktree.js +21 -43
  41. package/src/github/client.js +0 -88
  42. package/src/github/impl/graphql/pending-review-comments.js +5 -1
  43. package/src/github/impl/host/pending-review-comments.js +75 -11
  44. package/src/github/submit-pr-context.js +56 -0
  45. package/src/local-review.js +34 -17
  46. package/src/main.js +80 -106
  47. package/src/routes/chat.js +44 -1
  48. package/src/routes/executable-analysis.js +14 -15
  49. package/src/routes/local.js +3 -5
  50. package/src/routes/pr.js +18 -105
  51. package/src/server.js +5 -3
  52. package/src/settings/registry.js +10 -0
  53. package/src/setup/pr-setup.js +1 -1
  54. package/src/setup/stack-setup.js +1 -1
  55. package/src/utils/diff-annotator.js +175 -25
  56. package/src/utils/diff-file-content.js +4 -26
  57. package/src/utils/diff-file-list.js +178 -42
  58. package/src/utils/git-paths.js +77 -0
  59. package/src/utils/paths.js +1 -25
@@ -0,0 +1,140 @@
1
+ // Copyright 2026 Tim Perkins (tjwp) | SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Git path decoding, shared by the server and the browser.
4
+ *
5
+ * pair-review runs every path-producing git command with core.quotePath=false,
6
+ * so non-ASCII names come out verbatim. Git still C-quotes a path that contains
7
+ * a control character, `"` or `\`: `tab<TAB>name.js` appears in a `diff --git`
8
+ * header as `"a/tab\tname.js"`. Diff text cached by older versions (written
9
+ * with git's default core.quotePath=true) also carries octal-escaped UTF-8
10
+ * (`"a/caf\303\251.js"`) until the review is refreshed.
11
+ *
12
+ * The browser reads paths straight out of the diff text (parseUnifiedDiff keys
13
+ * patches by them, Local mode builds its file list from them, Pierre names
14
+ * files from them), so it decodes headers exactly like the server. This file
15
+ * is the ONE implementation: src/utils/git-paths.js re-exports it for the
16
+ * server, and pr.html / local.html load it for the browser.
17
+ */
18
+ (function () {
19
+ const QUOTED_PATH = '"(?:[^"\\\\]|\\\\.)*"';
20
+ const DIFF_GIT_PATHS_RE = new RegExp(`^(${QUOTED_PATH}|a\\/.+?) (${QUOTED_PATH}|b\\/.+)$`);
21
+ const DECODE_ESCAPES = { a: '\x07', b: '\b', t: '\t', n: '\n', v: '\v', f: '\f', r: '\r' };
22
+
23
+ /**
24
+ * Decode a git C-quoted path (including octal-escaped UTF-8 bytes). An
25
+ * unquoted value is returned unchanged: git always quotes a path that
26
+ * begins with `"`, so a leading quote is unambiguous.
27
+ * @param {string} value - Path as printed by git
28
+ * @returns {string} Real path
29
+ */
30
+ function decodeGitPath(value) {
31
+ if (typeof value !== 'string' || value.length < 2 || !value.startsWith('"') || !value.endsWith('"')) {
32
+ return value;
33
+ }
34
+ const encoder = new TextEncoder();
35
+ const bytes = [];
36
+ for (const match of value.slice(1, -1).matchAll(/\\([0-7]{1,3}|.)|([^\\]+)/gs)) {
37
+ if (match[2] !== undefined) {
38
+ bytes.push(...encoder.encode(match[2]));
39
+ } else if (/^[0-7]/.test(match[1])) {
40
+ bytes.push(parseInt(match[1], 8) & 0xff);
41
+ } else {
42
+ bytes.push(...encoder.encode(DECODE_ESCAPES[match[1]] ?? match[1]));
43
+ }
44
+ }
45
+ // ignoreBOM: a name that begins with U+FEFF keeps it (the default decoder
46
+ // would strip a leading EF BB BF as a byte order mark).
47
+ return new TextDecoder('utf-8', { ignoreBOM: true }).decode(new Uint8Array(bytes));
48
+ }
49
+
50
+ /**
51
+ * Parse the old and new paths from a `diff --git` header line. Either side
52
+ * may be C-quoted independently.
53
+ *
54
+ * An unquoted header for an unrenamed file is `a/<p> b/<p>`, split at its
55
+ * midpoint, so a name containing ` b/` (`x b/y.js`) still parses. Other
56
+ * unquoted headers split at the first ` b/`; parsePatchPaths corrects a
57
+ * rename or copy from its `rename from` / `rename to` lines.
58
+ *
59
+ * @param {string} headerLine - First line of a per-file patch
60
+ * @returns {{ oldPath: string, newPath: string }|null} Decoded paths without
61
+ * their `a/` / `b/` prefixes, or null when the line is not a git header
62
+ */
63
+ function parseDiffGitPaths(headerLine) {
64
+ if (typeof headerLine !== 'string' || !headerLine.startsWith('diff --git ')) return null;
65
+ const rest = headerLine.slice('diff --git '.length);
66
+
67
+ const half = (rest.length - 1) / 2;
68
+ if (Number.isInteger(half) && rest.startsWith('a/') && rest.startsWith(' b/', half)) {
69
+ const oldPath = rest.slice(2, half);
70
+ if (oldPath === rest.slice(half + 3)) {
71
+ return { oldPath, newPath: oldPath };
72
+ }
73
+ }
74
+
75
+ const match = rest.match(DIFF_GIT_PATHS_RE);
76
+ if (!match) return null;
77
+ const oldPath = decodeGitPath(match[1]);
78
+ const newPath = decodeGitPath(match[2]);
79
+ if (!oldPath.startsWith('a/') || !newPath.startsWith('b/')) return null;
80
+ return { oldPath: oldPath.slice(2), newPath: newPath.slice(2) };
81
+ }
82
+
83
+ // Extended header lines git prints between `diff --git` and the first hunk
84
+ // can name the old and new paths explicitly. Copies use `copy from/to`.
85
+ const PATCH_PATH_LINE_RE = /^(?:rename|copy) (from|to) (.+)$/;
86
+ // Lines that end the extended header: nothing after them names a path.
87
+ const PATCH_HEADER_END_RE = /^(?:@@|--- |\+\+\+ |Binary files |GIT binary patch$|diff --git )/;
88
+ // Longest git extended header: old mode, new mode, similarity index,
89
+ // rename from, rename to, index. Lines past this never name a path.
90
+ const MAX_EXTENDED_HEADER_LINES = 8;
91
+
92
+ /**
93
+ * Resolve the old and new paths of one per-file patch.
94
+ *
95
+ * A renamed or copied file's unquoted `diff --git` header is ambiguous when
96
+ * a path contains ` b/` (`git mv 'x b/y.js' z.js` prints
97
+ * `diff --git a/x b/y.js b/z.js`). Git also prints `rename from` /
98
+ * `rename to` (or `copy from` / `copy to`) lines that each hold exactly one
99
+ * path, so those win over the header split. Every other patch has the same
100
+ * path on both sides, which parseDiffGitPaths splits unambiguously.
101
+ *
102
+ * @param {string|string[]} patch - Per-file patch text, or the diff's lines
103
+ * @param {number} [start=0] - Index of the `diff --git` line when `patch` is
104
+ * an array of lines
105
+ * @returns {{ oldPath: string, newPath: string }|null} Decoded paths, or null
106
+ * when the first line is not a git header
107
+ */
108
+ function parsePatchPaths(patch, start = 0) {
109
+ const lines = typeof patch === 'string'
110
+ ? patch.split('\n', MAX_EXTENDED_HEADER_LINES + 1)
111
+ : patch;
112
+ if (!Array.isArray(lines)) return null;
113
+ const paths = parseDiffGitPaths(lines[start]);
114
+ if (!paths) return null;
115
+
116
+ const end = Math.min(lines.length, start + 1 + MAX_EXTENDED_HEADER_LINES);
117
+ for (let i = start + 1; i < end; i++) {
118
+ const line = lines[i];
119
+ if (PATCH_HEADER_END_RE.test(line)) break;
120
+ const match = line.match(PATCH_PATH_LINE_RE);
121
+ if (!match) continue;
122
+ if (match[1] === 'from') {
123
+ paths.oldPath = decodeGitPath(match[2]);
124
+ } else {
125
+ paths.newPath = decodeGitPath(match[2]);
126
+ }
127
+ }
128
+ return paths;
129
+ }
130
+
131
+ const GitPaths = { decodeGitPath, parseDiffGitPaths, parsePatchPaths };
132
+
133
+ if (typeof window !== 'undefined') {
134
+ window.GitPaths = GitPaths;
135
+ }
136
+
137
+ if (typeof module !== 'undefined' && module.exports) {
138
+ module.exports = GitPaths;
139
+ }
140
+ })();
@@ -0,0 +1,88 @@
1
+ // Copyright 2026 The pair-review Authors | SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * SmartTruncate - single-line truncation; the full text shows as a native
4
+ * `title` only when clipped. Modes: 'end' (titles) and 'start' (paths, keeps
5
+ * the file name). Use SmartTruncate.apply(el, opts), or just the
6
+ * `smart-truncate` class for 'end'.
7
+ */
8
+ class SmartTruncate {
9
+ static ROOT_CLASS = 'smart-truncate';
10
+ static START_CLASS = 'smart-truncate--start';
11
+ static TEXT_CLASS = 'smart-truncate__text';
12
+
13
+ /**
14
+ * @param {HTMLElement} el
15
+ * @param {Object} [options]
16
+ * @param {'start'|'end'} [options.mode='end']
17
+ * @param {string} [options.fullText] - Tooltip text; defaults to textContent
18
+ * @returns {HTMLElement} el
19
+ */
20
+ static apply(el, options = {}) {
21
+ if (!el) return el;
22
+ const { mode = 'end', fullText } = options;
23
+
24
+ el.classList.add(SmartTruncate.ROOT_CLASS);
25
+
26
+ // 'start' needs an isolated LTR wrapper inside the RTL box (see pr.css)
27
+ const first = el.firstElementChild;
28
+ const wrapper = el.childNodes.length === 1 && first?.classList.contains(SmartTruncate.TEXT_CLASS)
29
+ ? first
30
+ : null;
31
+ if (mode === 'start') {
32
+ el.classList.add(SmartTruncate.START_CLASS);
33
+ if (!wrapper) {
34
+ const inner = el.ownerDocument.createElement('span');
35
+ inner.className = SmartTruncate.TEXT_CLASS;
36
+ inner.append(...el.childNodes);
37
+ el.appendChild(inner);
38
+ }
39
+ } else {
40
+ el.classList.remove(SmartTruncate.START_CLASS);
41
+ wrapper?.replaceWith(...wrapper.childNodes);
42
+ }
43
+
44
+ if (typeof fullText === 'string') {
45
+ el.dataset.fullText = fullText;
46
+ } else {
47
+ delete el.dataset.fullText;
48
+ }
49
+ return el;
50
+ }
51
+
52
+ static isTruncated(el) {
53
+ return !!el?.isConnected && el.scrollWidth > el.clientWidth;
54
+ }
55
+
56
+ static getFullText(el) {
57
+ if (!el) return '';
58
+ if (typeof el.dataset?.fullText === 'string') return el.dataset.fullText;
59
+ return (el.textContent || '').trim();
60
+ }
61
+
62
+ // Runs on every hover, before the browser reads `title` for its tooltip,
63
+ // so it stays correct after resizes. With no `title`, an ancestor's title
64
+ // (e.g. a collapsed card's "Dismissed") shows as before.
65
+ static onMouseOver(event) {
66
+ const el = event.target.closest?.(`.${SmartTruncate.ROOT_CLASS}`);
67
+ if (!el) return;
68
+ const text = SmartTruncate.isTruncated(el) ? SmartTruncate.getFullText(el) : '';
69
+ // An empty `title` would also hide an ancestor's tooltip, so remove it
70
+ if (text) {
71
+ el.title = text;
72
+ } else {
73
+ el.removeAttribute('title');
74
+ }
75
+ }
76
+ }
77
+
78
+ if (typeof document !== 'undefined') {
79
+ document.addEventListener('mouseover', SmartTruncate.onMouseOver);
80
+ }
81
+
82
+ if (typeof window !== 'undefined') {
83
+ window.SmartTruncate = SmartTruncate;
84
+ }
85
+
86
+ if (typeof module !== 'undefined' && module.exports) {
87
+ module.exports = { SmartTruncate };
88
+ }
package/public/local.html CHANGED
@@ -569,6 +569,9 @@
569
569
  <!-- DOMPurify sanitizes rendered markdown HTML (must load before markdown.js) -->
570
570
  <script src="https://cdn.jsdelivr.net/npm/dompurify@3.2.6/dist/purify.min.js"></script>
571
571
 
572
+ <!-- Git path decoding (diff --git header parsing; must load before pr.js) -->
573
+ <script src="/js/utils/git-paths.js"></script>
574
+
572
575
  <!-- Markdown renderer utility -->
573
576
  <script src="/js/utils/markdown.js"></script>
574
577
 
@@ -583,6 +586,9 @@
583
586
  <!-- Category emoji mapping -->
584
587
  <script src="/js/utils/category-emoji.js"></script>
585
588
 
589
+ <!-- Truncation with full-text title -->
590
+ <script src="/js/utils/smart-truncate.js"></script>
591
+
586
592
  <!-- Suggestion UI utility -->
587
593
  <script src="/js/utils/suggestion-ui.js"></script>
588
594
 
package/public/pr.html CHANGED
@@ -374,6 +374,9 @@
374
374
  <!-- DOMPurify sanitizes rendered markdown HTML (must load before markdown.js) -->
375
375
  <script src="https://cdn.jsdelivr.net/npm/dompurify@3.2.6/dist/purify.min.js"></script>
376
376
 
377
+ <!-- Git path decoding (diff --git header parsing; must load before pr.js) -->
378
+ <script src="/js/utils/git-paths.js"></script>
379
+
377
380
  <!-- Markdown renderer utility -->
378
381
  <script src="/js/utils/markdown.js"></script>
379
382
 
@@ -388,6 +391,9 @@
388
391
  <!-- Category emoji mapping -->
389
392
  <script src="/js/utils/category-emoji.js"></script>
390
393
 
394
+ <!-- Truncation with full-text title -->
395
+ <script src="/js/utils/smart-truncate.js"></script>
396
+
391
397
  <!-- Suggestion UI utility -->
392
398
  <script src="/js/utils/suggestion-ui.js"></script>
393
399
 
@@ -15,7 +15,8 @@ const { buildFileLineCountMap, validateSuggestionLineNumbers } = require('../uti
15
15
  const { getPromptBuilder } = require('./prompts');
16
16
  const { formatValidFiles } = require('./prompts/shared/valid-files');
17
17
  const { ADVERSARIAL_VERIFICATION_SECTION } = require('./prompts/shared/adversarial-verification');
18
- const { GIT_DIFF_FLAGS } = require('../git/diff-flags');
18
+ const { GIT_DIFF_FLAGS, GIT_PATH_CONFIG } = require('../git/diff-flags');
19
+ const { splitNulPaths } = require('../utils/git-paths');
19
20
  const {
20
21
  buildAnalysisLineNumberGuidance,
21
22
  buildOrchestrationLineNumberGuidance: buildOrchestrationGuidance,
@@ -1003,10 +1004,10 @@ Do NOT create suggestions for any files not in this list. If you cannot find iss
1003
1004
  async getChangedFilesList(worktreePath, prMetadata) {
1004
1005
  try {
1005
1006
  const { stdout } = await execPromise(
1006
- `git diff ${GIT_DIFF_FLAGS} ${prMetadata.base_sha}...${prMetadata.head_sha} --name-only`,
1007
+ `git ${GIT_PATH_CONFIG} diff ${GIT_DIFF_FLAGS} ${prMetadata.base_sha}...${prMetadata.head_sha} --name-only -z`,
1007
1008
  { cwd: worktreePath }
1008
1009
  );
1009
- return stdout.trim().split('\n').filter(f => f.length > 0);
1010
+ return splitNulPaths(stdout);
1010
1011
  } catch (error) {
1011
1012
  logger.warn(`Could not get changed files list: ${error.message}`);
1012
1013
  return [];
@@ -1027,27 +1028,27 @@ Do NOT create suggestions for any files not in this list. If you cannot find iss
1027
1028
  try {
1028
1029
  // Get modified tracked files (unstaged)
1029
1030
  const { stdout: unstaged } = await execPromise(
1030
- `git diff ${GIT_DIFF_FLAGS} --name-only`,
1031
+ `git ${GIT_PATH_CONFIG} diff ${GIT_DIFF_FLAGS} --name-only -z`,
1031
1032
  { cwd: localPath }
1032
1033
  );
1033
1034
 
1034
1035
  // Get untracked files
1035
1036
  const { stdout: untracked } = await execPromise(
1036
- 'git ls-files --others --exclude-standard',
1037
+ `git ${GIT_PATH_CONFIG} ls-files -z --others --exclude-standard`,
1037
1038
  { cwd: localPath }
1038
1039
  );
1039
1040
 
1040
- const unstagedFiles = unstaged.trim().split('\n').filter(f => f.length > 0);
1041
- const untrackedFiles = untracked.trim().split('\n').filter(f => f.length > 0);
1041
+ const unstagedFiles = splitNulPaths(unstaged);
1042
+ const untrackedFiles = splitNulPaths(untracked);
1042
1043
  const allFiles = [...unstagedFiles, ...untrackedFiles];
1043
1044
 
1044
1045
  // Include staged files when scope includes staged
1045
1046
  if (options.includeStaged) {
1046
1047
  const { stdout: staged } = await execPromise(
1047
- `git diff ${GIT_DIFF_FLAGS} --cached --name-only`,
1048
+ `git ${GIT_PATH_CONFIG} diff ${GIT_DIFF_FLAGS} --cached --name-only -z`,
1048
1049
  { cwd: localPath }
1049
1050
  );
1050
- const stagedFiles = staged.trim().split('\n').filter(f => f.length > 0);
1051
+ const stagedFiles = splitNulPaths(staged);
1051
1052
  allFiles.push(...stagedFiles);
1052
1053
  }
1053
1054
 
@@ -1341,10 +1342,11 @@ ${description || '(No description provided)'}
1341
1342
  const isLocal = prMetadata.reviewType === 'local';
1342
1343
  if (isLocal) {
1343
1344
  // For local mode, diff against HEAD to see working directory changes
1344
- return suffix ? `git diff ${GIT_DIFF_FLAGS} HEAD ${suffix}` : `git diff ${GIT_DIFF_FLAGS} HEAD`;
1345
+ const localCmd = `git ${GIT_PATH_CONFIG} diff ${GIT_DIFF_FLAGS} HEAD`;
1346
+ return suffix ? `${localCmd} ${suffix}` : localCmd;
1345
1347
  }
1346
1348
  // For PR mode, diff between base and head commits
1347
- const baseCmd = `git diff ${GIT_DIFF_FLAGS} ${prMetadata.base_sha}...${prMetadata.head_sha}`;
1349
+ const baseCmd = `git ${GIT_PATH_CONFIG} diff ${GIT_DIFF_FLAGS} ${prMetadata.base_sha}...${prMetadata.head_sha}`;
1348
1350
  return suffix ? `${baseCmd} ${suffix}` : baseCmd;
1349
1351
  }
1350
1352
 
@@ -2408,9 +2410,9 @@ If you are unsure, use "NEW" - it is correct for the vast majority of suggestion
2408
2410
  try {
2409
2411
  // Step 1: Detect primary language(s) from changed files
2410
2412
  // For local mode, use git diff HEAD; for PR mode, use base...head
2411
- const diffCmd = this.buildGitDiffCommand(prMetadata, '--name-only');
2413
+ const diffCmd = this.buildGitDiffCommand(prMetadata, '--name-only -z');
2412
2414
  const { stdout: changedFiles } = await execPromise(diffCmd, { cwd: worktreePath });
2413
- const files = changedFiles.trim().split('\n').filter(f => f.length > 0);
2415
+ const files = splitNulPaths(changedFiles);
2414
2416
 
2415
2417
  const languages = this.detectLanguages(files);
2416
2418
  logger.info(`Detected languages: ${languages.join(', ')}`);
@@ -6,7 +6,7 @@
6
6
  * the official successor to the Gemini CLI.
7
7
  *
8
8
  * ============================================================================
9
- * HOW THIS ADAPTER DRIVES `agy` (verified against agy 1.0.16)
9
+ * HOW THIS ADAPTER DRIVES `agy` (verified against agy 1.0.16; models re-verified against 1.3.5)
10
10
  * ============================================================================
11
11
  * The Antigravity CLI's non-interactive "print" mode (`agy -p`) IS a real
12
12
  * agentic loop — it reads files, searches the tree, and runs shell commands to
@@ -94,16 +94,35 @@ const TIMEOUT_BACKSTOP_GRACE_MS = 15000;
94
94
  * We curate the Gemini-family models here — Antigravity is the Gemini CLI's
95
95
  * successor and its native models are Gemini. Ordered thorough -> balanced ->
96
96
  * fast, matching the other providers' pickers. Gemini 3.8 Flash at high effort
97
- * is the thorough-tier default: it is the strongest Gemini agy exposes today
97
+ * is the default: it is the strongest Gemini every agy plan can run
98
98
  * (DeepSWE v1.1 73.7, Terminal-Bench 2.1 89.4 — on par with GPT-6 Astra and
99
- * Muse 1.3), so "Flash" now describes latency, not capability. Gemini 3.1 Pro
100
- * (Low/High, Feb 2026) is the previous-generation Pro line and stays on the
101
- * balanced/thorough tiers for anyone who prefers it. Gemini 3.8 Flash at low
102
- * effort is the sole fast-tier entry, which also makes it the JSON-extraction
103
- * model (getFastTierModel() picks the first `tier: 'fast'` model — position
104
- * in this array does not matter). Retired ids (3.5 Flash) are kept as aliases
105
- * of their 3.8 Flash counterparts so saved selections keep working. `agy` also
106
- * exposes Claude and GPT-OSS models; those remain reachable via a
99
+ * Muse 1.3), so "Flash" now describes latency, not capability. Gemini 4 Argon
100
+ * (Oct 2026) is Google's new frontier model, but agy gates it to Google AI
101
+ * Ultra and eligible Enterprise subscriptions; on any other plan agy exits 1
102
+ * with `"Gemini 4 Argon" is unavailable: ... available to Ultra plan
103
+ * subscribers`, so it is an explicit thorough-tier choice and never the
104
+ * default. It also never LEADS the thorough tier: provider-switch paths
105
+ * (AnalysisConfigModal.selectProvider, RepoSettingsPage) map the previous
106
+ * model's tier onto the first model of that tier here, so a thorough Claude
107
+ * selection switched to Antigravity must land on a model every plan can run.
108
+ * agy (1.3.5) recognizes Argon only by its bare display name —
109
+ * `Gemini 4 Argon (High)`, `gemini-4-argon`, and `gemini-4-argon-high` are all
110
+ * "not recognized" — and runs it at the server-default effort, which is High.
111
+ * Gemini 3.8 Flash at medium effort is the balanced entry and at low effort
112
+ * the sole fast-tier entry, which also makes it the JSON-extraction model
113
+ * (getFastTierModel() picks the first `tier: 'fast'` model — position in this
114
+ * array does not matter). Retired ids (3.5 Flash) are kept as aliases of their
115
+ * 3.8 Flash counterparts so saved selections keep working.
116
+ *
117
+ * Deprecated: gemini-3.1-pro-high, gemini-3.1-pro-low (alias gemini-3.1-pro) —
118
+ * agy 1.3.5 no longer offers 3.1 Pro ("not recognized as a known model").
119
+ * They are deliberately NOT aliased onto another model (3.8 Flash is a
120
+ * different line; Argon is plan-gated). The browser resolvers fall back to the
121
+ * provider default for a saved selection that is no longer in the catalog;
122
+ * headless, MCP, and saved-council runs pass the id through and agy fails with
123
+ * an unknown-model error.
124
+ *
125
+ * `agy` also exposes Claude and GPT-OSS models; those remain reachable via a
107
126
  * `providers.antigravity.models` config override but are intentionally left
108
127
  * out of the default picker to keep the cross-provider model-mismatch guard
109
128
  * and the UX unambiguous.
@@ -117,30 +136,31 @@ const ANTIGRAVITY_MODELS = [
117
136
  name: '3.8 Flash (High)',
118
137
  tier: 'thorough',
119
138
  tagline: 'Frontier Review',
120
- description: 'Gemini 3.8 Flash at high effort is the strongest Gemini on agy — DeepSWE v1.1 73.7, Terminal-Bench 2.1 89.4, on par with GPT-6 Astra and Muse 1.3. "Flash" now means latency, not capability. Uses the thorough prompt set.',
139
+ description: 'Gemini 3.8 Flash at high effort is the strongest Gemini available on every agy plan — DeepSWE v1.1 73.7, Terminal-Bench 2.1 89.4, on par with GPT-6 Astra and Muse 1.3. "Flash" now means latency, not capability. Uses the thorough prompt set.',
121
140
  badge: 'Recommended',
122
141
  badgeClass: 'badge-recommended',
123
142
  default: true
124
143
  },
125
144
  {
126
- id: 'gemini-3.1-pro-high',
127
- cliName: 'Gemini 3.1 Pro (High)',
128
- name: '3.1 Pro (High)',
145
+ id: 'gemini-4-argon',
146
+ // agy rejects every effort-suffixed form for Argon; the bare display name
147
+ // is the only accepted --model value, and it runs at High (Argon's default).
148
+ cliName: 'Gemini 4 Argon',
149
+ name: '4 Argon',
129
150
  tier: 'thorough',
130
- tagline: 'Deep Dive',
131
- description: 'Previous-generation Pro (Feb 2026) at maximum reasoning effort — slower and now outscored by 3.8 Flash (High), kept for reviewers who prefer the Pro line',
132
- badge: 'Deep Dive',
151
+ tagline: 'Frontier — Ultra Plan',
152
+ description: 'Gemini 4 Argon (Oct 2026), Google\'s frontier model, at its default High effort. Requires a Google AI Ultra or eligible Gemini Enterprise subscription — on other plans agy refuses it as unavailable. Uses the thorough prompt set.',
153
+ badge: 'Ultra Plan',
133
154
  badgeClass: 'badge-power'
134
155
  },
135
156
  {
136
- id: 'gemini-3.1-pro-low',
137
- cliName: 'Gemini 3.1 Pro (Low)',
138
- aliases: ['gemini-3.1-pro'],
139
- name: '3.1 Pro (Low)',
157
+ id: 'gemini-3.8-flash-medium',
158
+ cliName: 'Gemini 3.8 Flash (Medium)',
159
+ name: '3.8 Flash (Medium)',
140
160
  tier: 'balanced',
141
- tagline: 'Previous-Gen Pro',
142
- description: 'Previous-generation Pro (Feb 2026) at low effort — a large-context middle ground, superseded as the default by 3.8 Flash (High)',
143
- badge: 'Previous Gen',
161
+ tagline: 'Standard Review',
162
+ description: 'Gemini 3.8 Flash at medium effort — a faster, cheaper middle ground for routine PRs',
163
+ badge: 'Balanced',
144
164
  badgeClass: 'badge-balanced'
145
165
  },
146
166
  {
@@ -32,7 +32,7 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
32
32
  * Tier structure:
33
33
  * - free (auto): Cursor's default auto-routing model
34
34
  * - fast (composer-2-fast, gpt-5.3-codex-fast, gemini-3-flash): Quick analysis
35
- * - balanced (composer-1.5, sonnet-4.6-thinking, sonnet-4.5-thinking, gemini-3.1-pro): Recommended for most reviews
35
+ * - balanced (composer-1.5 (default), sonnet-4.6-thinking, sonnet-4.5-thinking, gemini-3.1-pro): Recommended for most reviews
36
36
  * - thorough (composer-2, gpt-5.3-codex-high, gpt-5.3-codex-xhigh, opus-4.5-thinking, opus-4.6-thinking): Deep analysis for complex code
37
37
  */
38
38
  const CURSOR_AGENT_MODELS = [
@@ -70,7 +70,8 @@ const CURSOR_AGENT_MODELS = [
70
70
  tagline: 'Previous Composer',
71
71
  description: 'Previous generation Cursor Composer model—positioned between Sonnet and Opus for multi-file edits',
72
72
  badge: 'Previous Gen',
73
- badgeClass: 'badge-balanced'
73
+ badgeClass: 'badge-balanced',
74
+ default: true
74
75
  },
75
76
  {
76
77
  id: 'gpt-5.3-codex-fast',
@@ -97,8 +98,7 @@ const CURSOR_AGENT_MODELS = [
97
98
  tagline: 'Best Balance',
98
99
  description: 'Latest Sonnet with extended thinking—excellent quality-to-cost ratio for thorough reviews',
99
100
  badge: 'Recommended',
100
- badgeClass: 'badge-recommended',
101
- default: true
101
+ badgeClass: 'badge-recommended'
102
102
  },
103
103
  {
104
104
  id: 'sonnet-4.5-thinking',
@@ -152,9 +152,9 @@ function attemptIdOf(record) {
152
152
  /**
153
153
  * Muse model definitions with tier mappings.
154
154
  *
155
- * Muse exposes two real CLI model IDs per generation; everything below is a
156
- * reasoning-effort variant over the current pair, using the same `cli_model` +
157
- * `extra_args` pattern as the Codex provider:
155
+ * Every entry below is a reasoning-effort variant over a real CLI model ID,
156
+ * using the same `cli_model` + `extra_args` pattern as the Codex provider.
157
+ * Muse Spark exposes two real CLI model IDs per generation:
158
158
  * - muse-spark-1.3 — $1.25/$4.25 per MTok ($0.15 cached), ~1M context
159
159
  * - muse-spark-1.3-contributor — $0.10/$0.20 per MTok ($0.002 cached), discounted
160
160
  * because submitted content may be used by Meta for product improvement
@@ -167,6 +167,19 @@ function attemptIdOf(record) {
167
167
  * alias of its 1.3 twin at the same reasoning effort. Saved councils and configs
168
168
  * upgrade in place instead of falling through to muse's own default.
169
169
  *
170
+ * Muse Wonder (released 2026-10-12) is Meta's frontier line, thorough tier only:
171
+ * - muse-wonder-1.0 — $4/$20 per MTok ($0.20 cached), ~1M context; served
172
+ * through the Meta Model API as well as Muse Code
173
+ * - muse-wonder-full-1.0 — the larger variant, sold ONLY inside Muse Code Power
174
+ * Usage ($50/mo) and Maximum Usage ($200/mo) subscriptions, never through the
175
+ * API. Accounts without that plan get "does not exist or you lack access".
176
+ * Meta's model card (max effort): DeepSWE 1.1 79.0 (Full) / 78.8 (Wonder),
177
+ * SWE-Marathon 57.5 / 53.1. Neither becomes the default: Wonder costs ~3x
178
+ * Spark per input token and ~5x per output token, and Full is gated by plan.
179
+ * Muse Code subscriptions default to contributor mode (Meta may train on the
180
+ * content), so every Wonder entry pins `--contributor-mode off` for that run.
181
+ * There is no Wonder contributor model id, so Wonder has no contributor twins.
182
+ *
170
183
  * Do NOT treat the locally cached catalog (~/.local/share/muse/model-catalog/)
171
184
  * as authoritative: it lags the CLI and still listed only 1.2 after 1.3 worked.
172
185
  *
@@ -182,8 +195,60 @@ function attemptIdOf(record) {
182
195
  * followed by its contributor twin, so that getFastTierModel() — which picks the
183
196
  * FIRST `fast` model — selects the non-data-sharing model for auxiliary work
184
197
  * like JSON extraction. Never put a contributor entry ahead of its twin.
198
+ *
199
+ * The first `thorough` entry matters too: switching provider in the analysis
200
+ * config modal or repo settings picks the FIRST model of the current tier
201
+ * (repo settings then saves it as the repo's default_model). It must run on
202
+ * every account, so `muse-wonder-1.0-high` stays first and a plan-gated
203
+ * `-full-` entry must never lead.
185
204
  */
186
205
  const MUSE_MODELS = [
206
+ {
207
+ id: 'muse-wonder-1.0-high',
208
+ aliases: ['muse-wonder-1.0', 'muse-wonder'],
209
+ cli_model: 'muse-wonder-1.0',
210
+ extra_args: ['--reasoning-effort', 'high', '--contributor-mode', 'off'],
211
+ name: 'Muse Wonder High',
212
+ tier: 'thorough',
213
+ tagline: 'Frontier Review',
214
+ description: 'Meta\'s frontier model at high reasoning effort with roughly 1M tokens of context—a big step up from Muse Spark on multi-file and long-horizon changes. Several times the cost of Muse Spark ($4/$20 per MTok).',
215
+ badge: 'Frontier',
216
+ badgeClass: 'badge-power'
217
+ },
218
+ {
219
+ id: 'muse-wonder-1.0-max',
220
+ cli_model: 'muse-wonder-1.0',
221
+ extra_args: ['--reasoning-effort', 'max', '--contributor-mode', 'off'],
222
+ name: 'Muse Wonder Max',
223
+ tier: 'thorough',
224
+ tagline: 'Frontier Reasoning',
225
+ description: 'Meta\'s frontier model at maximum reasoning effort for architecture, concurrency, and security-sensitive reviews. Several times the cost of Muse Spark ($4/$20 per MTok).',
226
+ badge: 'Frontier',
227
+ badgeClass: 'badge-power'
228
+ },
229
+ {
230
+ id: 'muse-wonder-full-1.0-high',
231
+ aliases: ['muse-wonder-full-1.0', 'muse-wonder-full'],
232
+ cli_model: 'muse-wonder-full-1.0',
233
+ extra_args: ['--reasoning-effort', 'high', '--contributor-mode', 'off'],
234
+ name: 'Muse Wonder Full High',
235
+ tier: 'thorough',
236
+ tagline: 'Flagship Review',
237
+ description: 'Meta\'s largest frontier model at high reasoning effort—flagship-quality review with less latency than Max. Requires a Muse Code Power Usage or Maximum Usage subscription; not served through the pay-as-you-go API.',
238
+ badge: 'Subscription',
239
+ badgeClass: 'badge-power'
240
+ },
241
+ {
242
+ id: 'muse-wonder-full-1.0-max',
243
+ cli_model: 'muse-wonder-full-1.0',
244
+ extra_args: ['--reasoning-effort', 'max', '--contributor-mode', 'off'],
245
+ name: 'Muse Wonder Full Max',
246
+ tier: 'thorough',
247
+ tagline: 'Largest Model',
248
+ description: 'Meta\'s largest frontier model at maximum reasoning effort, built for long-running agentic work—the deepest Muse review of large, cross-cutting changes. Requires a Muse Code Power Usage or Maximum Usage subscription; not served through the pay-as-you-go API.',
249
+ badge: 'Most Capable',
250
+ badgeClass: 'badge-power'
251
+ },
187
252
  {
188
253
  id: 'muse-spark-1.3-max',
189
254
  // `-ultra` ids resolve here because ultra is gate-closed and degrades to
@@ -3,6 +3,7 @@
3
3
  const crypto = require('crypto');
4
4
  const path = require('path');
5
5
  const logger = require('../utils/logger');
6
+ const { countPatchStats } = require('../utils/diff-file-list');
6
7
 
7
8
  const defaults = {
8
9
  parseUnifiedDiffHunks: require('../utils/diff-hunks').parseUnifiedDiffHunks,
@@ -24,8 +25,12 @@ const defaults = {
24
25
  };
25
26
 
26
27
  /**
27
- * Count '+' lines in parsed hunks to gate summary generation by added-line volume.
28
- * Hunk-header lines are not '+'-prefixed by `parseUnifiedDiffHunks`, so this is safe.
28
+ * Count added lines in parsed hunks to gate summary generation by added-line volume.
29
+ *
30
+ * Every '+' line in a hunk body is an addition — including an added `++ x`
31
+ * line, which the diff spells `+++ x` — so no `+++` exclusion applies here.
32
+ * Counting goes through `countPatchStats`, which also bounds each hunk by the
33
+ * line counts its `@@` header declares.
29
34
  * @param {Map<string, Array<{header: string, lines: string[]}>>} hunksByFile
30
35
  * @returns {number}
31
36
  */
@@ -33,9 +38,7 @@ function countAddedLines(hunksByFile) {
33
38
  let total = 0;
34
39
  for (const hunks of hunksByFile.values()) {
35
40
  for (const hunk of hunks) {
36
- for (const line of hunk.lines) {
37
- if (line.startsWith('+') && !line.startsWith('+++')) total++;
38
- }
41
+ total += countPatchStats([hunk.header, ...hunk.lines].join('\n')).insertions;
39
42
  }
40
43
  }
41
44
  return total;