@in-the-loop-labs/pair-review 5.4.0 → 5.4.2
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-pair-loop/.claude-plugin/plugin.json +1 -1
- package/public/index.html +4 -0
- package/public/js/components/AdvancedConfigTab.js +18 -108
- package/public/js/components/VoiceCentricConfigTab.js +18 -108
- package/public/js/index.js +47 -5
- package/public/js/modules/diff-renderer.js +7 -6
- package/public/js/utils/council-timeout.js +203 -0
- package/public/local.html +4 -0
- package/public/pr.html +4 -0
- package/src/ai/antigravity-provider.js +76 -35
- package/src/ai/claude-provider.js +115 -39
- package/src/ai/codex-provider.js +19 -24
- package/src/ai/copilot-provider.js +59 -48
- package/src/ai/cursor-agent-provider.js +95 -133
- package/src/ai/opencode-provider.js +21 -2
- package/src/ai/provider.js +3 -3
- package/src/chat/session-manager.js +1 -1
- package/src/database.js +240 -59
- package/src/git/worktree-pool-lifecycle.js +152 -33
- package/src/git/worktree-pool-usage.js +20 -0
- package/src/git/worktree.js +14 -5
- package/src/main.js +25 -9
- package/src/routes/bulk-analysis-configs.js +1 -1
- package/src/routes/pr.js +11 -14
- package/src/routes/reviews.js +8 -30
- package/src/routes/setup.js +22 -9
- package/src/setup/pr-setup.js +12 -3
- package/src/utils/diff-file-content.js +62 -25
- package/src/utils/json-extractor.js +267 -13
- package/src/utils/pr-file-blob-cache.js +134 -0
- package/src/utils/process-liveness.js +64 -0
package/README.md
CHANGED
|
@@ -632,7 +632,7 @@ pair-review integrates with AI providers via their CLI tools:
|
|
|
632
632
|
|
|
633
633
|
- **Claude**: Uses Claude Code CLI
|
|
634
634
|
- **Antigravity**: Uses the Antigravity CLI (`agy`), the successor to the Gemini CLI. Install it with `curl -fsSL https://antigravity.google/cli/install.sh | bash` (macOS/Linux; it is not an npm package) — see the [Antigravity docs](https://antigravity.google/docs). Antigravity is an analysis-only provider: it runs as an agentic reviewer in non-interactive print mode and has **no chat/ACP mode**.
|
|
635
|
-
- **Codex**: Uses Codex CLI. GPT-5.6 Sol High (`gpt-5.6-sol-high`) remains the recommended default during rollout. GPT-6.1 Sol High (`gpt-6.1-sol-high`) and XHigh (`gpt-6.1-sol-xhigh`) are explicit choices for reviews and chat; Enterprise and Edu administrators must enable GPT-6.1 Sol access.
|
|
635
|
+
- **Codex**: Uses Codex CLI. GPT-5.6 Sol High (`gpt-5.6-sol-high`) remains the recommended default during rollout. GPT-6.1 Sol High (`gpt-6.1-sol-high`) and XHigh (`gpt-6.1-sol-xhigh`) are explicit choices for reviews and chat; Enterprise and Edu administrators must enable GPT-6.1 Sol access. GPT-6.1 Terra XHigh (`gpt-6.1-terra-xhigh`) is an explicit balanced choice; Enterprise access depends on workspace administrator controls.
|
|
636
636
|
- **GitHub Copilot**: Uses Copilot CLI
|
|
637
637
|
- **OpenCode**: Uses OpenCode CLI (requires model configuration)
|
|
638
638
|
- **Cursor**: Uses Cursor Agent CLI (streaming output with sandbox mode)
|
|
@@ -762,13 +762,13 @@ Use the provider-level `default_model` and `disabled_models` fields to tailor wh
|
|
|
762
762
|
"providers": {
|
|
763
763
|
"claude": {
|
|
764
764
|
"default_model": "sonnet-4.6",
|
|
765
|
-
"disabled_models": ["haiku", "fable"]
|
|
765
|
+
"disabled_models": ["haiku", "fable-5.2-xhigh"]
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
```
|
|
770
770
|
|
|
771
|
-
- `disabled_models` removes those models from the picker. It matches canonical ids only (`opus-5.5-
|
|
771
|
+
- `disabled_models` removes those models from the picker. It matches canonical ids only (`opus-5.5-high`, not the `opus` alias). An alias entry is ignored with a warning, so hiding a retired id such as `opus-4.7-high` never hides the newer model it now redirects to. To find the built-in IDs for a provider, see the comments in `config.example.json` (e.g. Claude ships `opus-5.5-medium`, `sonnet-4.6`, `haiku`, …).
|
|
772
772
|
- `default_model` selects which of the *remaining* models is the default. If it points at a model that is unknown or also disabled, the provider falls back to automatic selection (the model marked `default: true`, then the first `balanced`-tier model, then the first model).
|
|
773
773
|
- Prefer `default_model` over the per-model `default: true` flag, which is deprecated. Setting `default_model` suppresses the deprecation warning.
|
|
774
774
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@in-the-loop-labs/pair-review",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Your AI-powered code review partner - Close the feedback loop with AI coding agents",
|
|
5
5
|
"main": "src/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@changesets/cli": "^2.29.8",
|
|
86
|
-
"@playwright/test": "^1.
|
|
86
|
+
"@playwright/test": "^1.65.0",
|
|
87
87
|
"@vitest/coverage-v8": "^4.0.16",
|
|
88
88
|
"dompurify": "^3.2.6",
|
|
89
89
|
"esbuild": "^0.27.4",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-review",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-loop",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Agent-orchestrated review loop — implement, review with pair-review multi-model councils via the headless CLI, triage, fix, and repeat until a final review returns no blockers. MCP-independent.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
package/public/index.html
CHANGED
|
@@ -278,6 +278,9 @@
|
|
|
278
278
|
.help-modal-overlay.visible {
|
|
279
279
|
opacity: 1;
|
|
280
280
|
visibility: visible;
|
|
281
|
+
/* Become visible immediately on open so the close button can take
|
|
282
|
+
focus; the base rule still delays hiding until the fade-out ends. */
|
|
283
|
+
transition: opacity var(--transition-default), visibility 0s;
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
[data-theme="dark"] .help-modal-overlay {
|
|
@@ -1571,6 +1574,7 @@
|
|
|
1571
1574
|
<script src="/js/components/TextInputDialog.js"></script>
|
|
1572
1575
|
<script src="/js/components/TimeoutSelect.js"></script>
|
|
1573
1576
|
<script src="/js/components/AnalysisConfigModal.js"></script>
|
|
1577
|
+
<script src="/js/utils/council-timeout.js"></script>
|
|
1574
1578
|
<script src="/js/components/VoiceCentricConfigTab.js"></script>
|
|
1575
1579
|
<script src="/js/components/AdvancedConfigTab.js"></script>
|
|
1576
1580
|
<script src="/js/theme.js"></script>
|
|
@@ -44,6 +44,17 @@ class AdvancedConfigTab {
|
|
|
44
44
|
/** Default timeout in milliseconds (10 minutes) */
|
|
45
45
|
static DEFAULT_TIMEOUT = 600000;
|
|
46
46
|
|
|
47
|
+
/** DOM shape for the shared timeout mixin (see utils/council-timeout.js) */
|
|
48
|
+
static TIMEOUT_DOM = {
|
|
49
|
+
panelId: 'tab-panel-advanced',
|
|
50
|
+
voiceWrapperClass: 'participant-wrapper',
|
|
51
|
+
voiceKeys: ['level', 'index'],
|
|
52
|
+
timeoutClass: 'adv-timeout',
|
|
53
|
+
orchestrationTimeoutId: 'adv-orchestration-timeout',
|
|
54
|
+
orchestrationToggleId: 'adv-orchestration-timeout-toggle',
|
|
55
|
+
orchestrationRowId: 'orchestration-voice',
|
|
56
|
+
};
|
|
57
|
+
|
|
47
58
|
|
|
48
59
|
constructor(modal) {
|
|
49
60
|
this.modal = modal;
|
|
@@ -669,7 +680,7 @@ class AdvancedConfigTab {
|
|
|
669
680
|
this._updateOrchestrationTimeoutIcon(panel, e.target.value);
|
|
670
681
|
} else {
|
|
671
682
|
const { level, index } = e.target.dataset;
|
|
672
|
-
this._updateTimeoutIcon(panel, level, index, e.target.value);
|
|
683
|
+
this._updateTimeoutIcon(panel, { level, index }, e.target.value);
|
|
673
684
|
}
|
|
674
685
|
}
|
|
675
686
|
});
|
|
@@ -946,45 +957,6 @@ class AdvancedConfigTab {
|
|
|
946
957
|
iconBtn.classList.toggle('has-instructions', hasContent);
|
|
947
958
|
}
|
|
948
959
|
|
|
949
|
-
/**
|
|
950
|
-
* Get the default timeout for a provider, falling back to the static DEFAULT_TIMEOUT.
|
|
951
|
-
* @param {string} providerId - Provider ID (e.g., 'pi', 'claude')
|
|
952
|
-
* @returns {number} Default timeout in ms
|
|
953
|
-
*/
|
|
954
|
-
_getProviderDefaultTimeout(providerId) {
|
|
955
|
-
const provider = this.providers[providerId];
|
|
956
|
-
return provider?.defaultTimeout ?? AdvancedConfigTab.DEFAULT_TIMEOUT;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
/**
|
|
960
|
-
* Update the clock/timeout icon styling to indicate non-default timeout.
|
|
961
|
-
* @param {Element} panel - The council panel element
|
|
962
|
-
* @param {string} level - Level number
|
|
963
|
-
* @param {string} index - Voice index
|
|
964
|
-
* @param {string} value - Current timeout value (as string of ms)
|
|
965
|
-
*/
|
|
966
|
-
_updateTimeoutIcon(panel, level, index, value) {
|
|
967
|
-
const wrapper = panel.querySelector(`.participant-wrapper[data-level="${level}"][data-index="${index}"]`);
|
|
968
|
-
const iconBtn = wrapper?.querySelector(`.toggle-timeout-icon[data-level="${level}"][data-index="${index}"]`);
|
|
969
|
-
if (!iconBtn) return;
|
|
970
|
-
|
|
971
|
-
const providerId = wrapper?.querySelector('.voice-provider')?.value;
|
|
972
|
-
const defaultTimeout = this._getProviderDefaultTimeout(providerId);
|
|
973
|
-
const isNonDefault = parseInt(value, 10) !== defaultTimeout;
|
|
974
|
-
iconBtn.classList.toggle('has-custom-timeout', isNonDefault);
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
_updateOrchestrationTimeoutIcon(panel, value) {
|
|
978
|
-
const iconBtn = panel.querySelector('#adv-orchestration-timeout-toggle');
|
|
979
|
-
if (!iconBtn) return;
|
|
980
|
-
|
|
981
|
-
const orchRow = panel.querySelector('#orchestration-voice');
|
|
982
|
-
const providerId = orchRow?.querySelector('.voice-provider')?.value;
|
|
983
|
-
const defaultTimeout = this._getProviderDefaultTimeout(providerId);
|
|
984
|
-
const isNonDefault = parseInt(value, 10) !== defaultTimeout;
|
|
985
|
-
iconBtn.classList.toggle('has-custom-timeout', isNonDefault);
|
|
986
|
-
}
|
|
987
|
-
|
|
988
960
|
_updateOrchestrationInstructionsIcon(panel, value) {
|
|
989
961
|
const iconBtn = panel.querySelector('#adv-orchestration-instructions-toggle');
|
|
990
962
|
if (!iconBtn) return;
|
|
@@ -996,48 +968,6 @@ class AdvancedConfigTab {
|
|
|
996
968
|
iconBtn.classList.toggle('has-instructions', hasContent);
|
|
997
969
|
}
|
|
998
970
|
|
|
999
|
-
/**
|
|
1000
|
-
* When a voice's provider changes, update its timeout to the new provider's default,
|
|
1001
|
-
* preserving explicit user overrides via Math.max when the user had customized the value.
|
|
1002
|
-
* @param {HTMLSelectElement} providerSelect - The provider dropdown that changed
|
|
1003
|
-
*/
|
|
1004
|
-
_applyProviderDefaultTimeout(providerSelect) {
|
|
1005
|
-
const panel = this.modal.querySelector('#tab-panel-advanced');
|
|
1006
|
-
if (!panel) return;
|
|
1007
|
-
|
|
1008
|
-
const providerId = providerSelect.value;
|
|
1009
|
-
const newDefault = this._getProviderDefaultTimeout(providerId);
|
|
1010
|
-
const oldProviderId = providerSelect.dataset.previousProvider;
|
|
1011
|
-
const oldDefault = oldProviderId ? this._getProviderDefaultTimeout(oldProviderId) : null;
|
|
1012
|
-
|
|
1013
|
-
const isOrchestration = providerSelect.dataset.target === 'orchestration';
|
|
1014
|
-
if (isOrchestration) {
|
|
1015
|
-
const timeoutEl = panel.querySelector('#adv-orchestration-timeout');
|
|
1016
|
-
if (timeoutEl) {
|
|
1017
|
-
const currentValue = parseInt(timeoutEl.value, 10);
|
|
1018
|
-
const resolvedTimeout = (oldDefault !== null && currentValue !== oldDefault)
|
|
1019
|
-
? Math.max(currentValue, newDefault)
|
|
1020
|
-
: newDefault;
|
|
1021
|
-
timeoutEl.value = String(resolvedTimeout);
|
|
1022
|
-
this._updateOrchestrationTimeoutIcon(panel, String(resolvedTimeout));
|
|
1023
|
-
}
|
|
1024
|
-
} else {
|
|
1025
|
-
const { level, index } = providerSelect.dataset;
|
|
1026
|
-
const wrapper = providerSelect.closest('.participant-wrapper');
|
|
1027
|
-
const timeoutEl = wrapper?.querySelector('.adv-timeout');
|
|
1028
|
-
if (timeoutEl) {
|
|
1029
|
-
const currentValue = parseInt(timeoutEl.value, 10);
|
|
1030
|
-
const resolvedTimeout = (oldDefault !== null && currentValue !== oldDefault)
|
|
1031
|
-
? Math.max(currentValue, newDefault)
|
|
1032
|
-
: newDefault;
|
|
1033
|
-
timeoutEl.value = String(resolvedTimeout);
|
|
1034
|
-
this._updateTimeoutIcon(panel, level, index, String(resolvedTimeout));
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
providerSelect.dataset.previousProvider = providerId;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
971
|
// --- Dirty state tracking ---
|
|
1042
972
|
|
|
1043
973
|
_markDirty() {
|
|
@@ -1231,18 +1161,7 @@ class AdvancedConfigTab {
|
|
|
1231
1161
|
TimeoutSelect.mount(mount, { className: 'adv-timeout', title: 'Per-reviewer timeout' });
|
|
1232
1162
|
}
|
|
1233
1163
|
const timeoutEl = row?.querySelector('.adv-timeout');
|
|
1234
|
-
|
|
1235
|
-
if (timeoutEl && voice.timeout) {
|
|
1236
|
-
timeoutEl.value = String(voice.timeout);
|
|
1237
|
-
// Show the dropdown if non-default for this provider
|
|
1238
|
-
if (voice.timeout !== providerDefaultTimeout) {
|
|
1239
|
-
timeoutEl.style.display = '';
|
|
1240
|
-
}
|
|
1241
|
-
this._updateTimeoutIcon(panel, String(level), String(i), String(voice.timeout));
|
|
1242
|
-
} else if (timeoutEl) {
|
|
1243
|
-
// No saved timeout — apply the provider's default
|
|
1244
|
-
timeoutEl.value = String(providerDefaultTimeout);
|
|
1245
|
-
}
|
|
1164
|
+
this._restoreVoiceTimeout(panel, { level: String(level), index: String(i) }, timeoutEl, voice);
|
|
1246
1165
|
|
|
1247
1166
|
if (voice.customInstructions) {
|
|
1248
1167
|
const instrInput = participantWrapper?.querySelector(`.voice-instructions-input[data-level="${level}"][data-index="${i}"]`);
|
|
@@ -1280,20 +1199,7 @@ class AdvancedConfigTab {
|
|
|
1280
1199
|
}
|
|
1281
1200
|
|
|
1282
1201
|
// Restore consolidation timeout
|
|
1283
|
-
|
|
1284
|
-
const orchProviderDefaultTimeout = this._getProviderDefaultTimeout(consolSection.provider);
|
|
1285
|
-
if (orchTimeoutSelect && consolSection.timeout) {
|
|
1286
|
-
orchTimeoutSelect.value = String(consolSection.timeout);
|
|
1287
|
-
// Show the dropdown if non-default for this provider
|
|
1288
|
-
if (consolSection.timeout !== orchProviderDefaultTimeout) {
|
|
1289
|
-
orchTimeoutSelect.style.display = '';
|
|
1290
|
-
}
|
|
1291
|
-
this._updateOrchestrationTimeoutIcon(panel, String(consolSection.timeout));
|
|
1292
|
-
} else if (orchTimeoutSelect) {
|
|
1293
|
-
// No saved timeout — apply the provider's default
|
|
1294
|
-
orchTimeoutSelect.value = String(orchProviderDefaultTimeout);
|
|
1295
|
-
this._updateOrchestrationTimeoutIcon(panel, String(orchProviderDefaultTimeout));
|
|
1296
|
-
}
|
|
1202
|
+
this._restoreOrchestrationTimeout(panel, consolSection);
|
|
1297
1203
|
|
|
1298
1204
|
// Restore consolidation custom instructions
|
|
1299
1205
|
const orchInstrInput = panel.querySelector('#adv-orchestration-instructions');
|
|
@@ -1475,6 +1381,10 @@ class AdvancedConfigTab {
|
|
|
1475
1381
|
}
|
|
1476
1382
|
}
|
|
1477
1383
|
|
|
1384
|
+
// Shared timeout methods (public/js/utils/council-timeout.js). In the browser the
|
|
1385
|
+
// util's <script> tag loads first; unit tests load it via require().
|
|
1386
|
+
((typeof window !== 'undefined' && window.CouncilTimeout) || require('../utils/council-timeout.js')).mixInto(AdvancedConfigTab);
|
|
1387
|
+
|
|
1478
1388
|
// Export for use in other modules
|
|
1479
1389
|
if (typeof window !== 'undefined') {
|
|
1480
1390
|
window.AdvancedConfigTab = AdvancedConfigTab;
|
|
@@ -41,6 +41,17 @@ class VoiceCentricConfigTab {
|
|
|
41
41
|
/** Default timeout in milliseconds (10 minutes) */
|
|
42
42
|
static DEFAULT_TIMEOUT = 600000;
|
|
43
43
|
|
|
44
|
+
/** DOM shape for the shared timeout mixin (see utils/council-timeout.js) */
|
|
45
|
+
static TIMEOUT_DOM = {
|
|
46
|
+
panelId: 'tab-panel-council',
|
|
47
|
+
voiceWrapperClass: 'vc-reviewer',
|
|
48
|
+
voiceKeys: ['index'],
|
|
49
|
+
timeoutClass: 'vc-timeout',
|
|
50
|
+
orchestrationTimeoutId: 'vc-orchestration-timeout',
|
|
51
|
+
orchestrationToggleId: 'vc-orchestration-timeout-toggle',
|
|
52
|
+
orchestrationRowId: 'vc-orchestration-voice',
|
|
53
|
+
};
|
|
54
|
+
|
|
44
55
|
|
|
45
56
|
constructor(modal) {
|
|
46
57
|
this.modal = modal;
|
|
@@ -574,7 +585,7 @@ class VoiceCentricConfigTab {
|
|
|
574
585
|
this._updateOrchestrationTimeoutIcon(panel, e.target.value);
|
|
575
586
|
} else {
|
|
576
587
|
const idx = e.target.dataset.index;
|
|
577
|
-
this._updateTimeoutIcon(panel, idx, e.target.value);
|
|
588
|
+
this._updateTimeoutIcon(panel, { index: idx }, e.target.value);
|
|
578
589
|
}
|
|
579
590
|
}
|
|
580
591
|
});
|
|
@@ -707,87 +718,6 @@ class VoiceCentricConfigTab {
|
|
|
707
718
|
iconBtn.classList.toggle('has-instructions', hasContent);
|
|
708
719
|
}
|
|
709
720
|
|
|
710
|
-
/**
|
|
711
|
-
* Get the default timeout for a provider, falling back to the static DEFAULT_TIMEOUT.
|
|
712
|
-
* @param {string} providerId - Provider ID (e.g., 'pi', 'claude')
|
|
713
|
-
* @returns {number} Default timeout in ms
|
|
714
|
-
*/
|
|
715
|
-
_getProviderDefaultTimeout(providerId) {
|
|
716
|
-
const provider = this.providers[providerId];
|
|
717
|
-
return provider?.defaultTimeout ?? VoiceCentricConfigTab.DEFAULT_TIMEOUT;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* Update the clock/timeout icon styling to indicate non-default timeout.
|
|
722
|
-
* @param {Element} panel - The council panel element
|
|
723
|
-
* @param {string} index - Reviewer index
|
|
724
|
-
* @param {string} value - Current timeout value (as string of ms)
|
|
725
|
-
*/
|
|
726
|
-
_updateTimeoutIcon(panel, index, value) {
|
|
727
|
-
const wrapper = panel.querySelector(`.vc-reviewer[data-index="${index}"]`);
|
|
728
|
-
const iconBtn = wrapper?.querySelector(`.toggle-timeout-icon[data-index="${index}"]`);
|
|
729
|
-
if (!iconBtn) return;
|
|
730
|
-
|
|
731
|
-
const providerId = wrapper?.querySelector('.voice-provider')?.value;
|
|
732
|
-
const defaultTimeout = this._getProviderDefaultTimeout(providerId);
|
|
733
|
-
const isNonDefault = parseInt(value, 10) !== defaultTimeout;
|
|
734
|
-
iconBtn.classList.toggle('has-custom-timeout', isNonDefault);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
_updateOrchestrationTimeoutIcon(panel, value) {
|
|
738
|
-
const iconBtn = panel.querySelector('#vc-orchestration-timeout-toggle');
|
|
739
|
-
if (!iconBtn) return;
|
|
740
|
-
|
|
741
|
-
const orchRow = panel.querySelector('#vc-orchestration-voice');
|
|
742
|
-
const providerId = orchRow?.querySelector('.voice-provider')?.value;
|
|
743
|
-
const defaultTimeout = this._getProviderDefaultTimeout(providerId);
|
|
744
|
-
const isNonDefault = parseInt(value, 10) !== defaultTimeout;
|
|
745
|
-
iconBtn.classList.toggle('has-custom-timeout', isNonDefault);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
/**
|
|
749
|
-
* When a voice's provider changes, update its timeout to the new provider's default,
|
|
750
|
-
* preserving explicit user overrides via Math.max when the user had customized the value.
|
|
751
|
-
* @param {HTMLSelectElement} providerSelect - The provider dropdown that changed
|
|
752
|
-
*/
|
|
753
|
-
_applyProviderDefaultTimeout(providerSelect) {
|
|
754
|
-
const panel = this.modal.querySelector('#tab-panel-council');
|
|
755
|
-
if (!panel) return;
|
|
756
|
-
|
|
757
|
-
const providerId = providerSelect.value;
|
|
758
|
-
const newDefault = this._getProviderDefaultTimeout(providerId);
|
|
759
|
-
const oldProviderId = providerSelect.dataset.previousProvider;
|
|
760
|
-
const oldDefault = oldProviderId ? this._getProviderDefaultTimeout(oldProviderId) : null;
|
|
761
|
-
|
|
762
|
-
// Determine which timeout element to update
|
|
763
|
-
const isOrchestration = providerSelect.dataset.target === 'orchestration';
|
|
764
|
-
if (isOrchestration) {
|
|
765
|
-
const timeoutEl = panel.querySelector('#vc-orchestration-timeout');
|
|
766
|
-
if (timeoutEl) {
|
|
767
|
-
const currentValue = parseInt(timeoutEl.value, 10);
|
|
768
|
-
const resolvedTimeout = (oldDefault !== null && currentValue !== oldDefault)
|
|
769
|
-
? Math.max(currentValue, newDefault)
|
|
770
|
-
: newDefault;
|
|
771
|
-
timeoutEl.value = String(resolvedTimeout);
|
|
772
|
-
this._updateOrchestrationTimeoutIcon(panel, String(resolvedTimeout));
|
|
773
|
-
}
|
|
774
|
-
} else {
|
|
775
|
-
const idx = providerSelect.dataset.index;
|
|
776
|
-
const wrapper = providerSelect.closest('.vc-reviewer');
|
|
777
|
-
const timeoutEl = wrapper?.querySelector('.vc-timeout');
|
|
778
|
-
if (timeoutEl) {
|
|
779
|
-
const currentValue = parseInt(timeoutEl.value, 10);
|
|
780
|
-
const resolvedTimeout = (oldDefault !== null && currentValue !== oldDefault)
|
|
781
|
-
? Math.max(currentValue, newDefault)
|
|
782
|
-
: newDefault;
|
|
783
|
-
timeoutEl.value = String(resolvedTimeout);
|
|
784
|
-
this._updateTimeoutIcon(panel, idx, String(resolvedTimeout));
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
providerSelect.dataset.previousProvider = providerId;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
721
|
// --- Dropdown / model management ---
|
|
792
722
|
|
|
793
723
|
_updateAllVoiceDropdowns() {
|
|
@@ -1150,18 +1080,7 @@ class VoiceCentricConfigTab {
|
|
|
1150
1080
|
TimeoutSelect.mount(mount, { className: 'vc-timeout', title: 'Per-reviewer timeout' });
|
|
1151
1081
|
}
|
|
1152
1082
|
const timeoutEl = row.querySelector('.vc-timeout');
|
|
1153
|
-
|
|
1154
|
-
if (timeoutEl && voice.timeout) {
|
|
1155
|
-
timeoutEl.value = String(voice.timeout);
|
|
1156
|
-
// Show the dropdown if non-default for this provider
|
|
1157
|
-
if (voice.timeout !== providerDefaultTimeout) {
|
|
1158
|
-
timeoutEl.style.display = '';
|
|
1159
|
-
}
|
|
1160
|
-
this._updateTimeoutIcon(panel, String(i), String(voice.timeout));
|
|
1161
|
-
} else if (timeoutEl) {
|
|
1162
|
-
// No saved timeout — apply the provider's default
|
|
1163
|
-
timeoutEl.value = String(providerDefaultTimeout);
|
|
1164
|
-
}
|
|
1083
|
+
this._restoreVoiceTimeout(panel, { index: String(i) }, timeoutEl, voice);
|
|
1165
1084
|
}
|
|
1166
1085
|
|
|
1167
1086
|
if (voice.customInstructions) {
|
|
@@ -1202,20 +1121,7 @@ class VoiceCentricConfigTab {
|
|
|
1202
1121
|
}
|
|
1203
1122
|
|
|
1204
1123
|
// Restore orchestration timeout
|
|
1205
|
-
|
|
1206
|
-
const orchProviderDefaultTimeout = this._getProviderDefaultTimeout(vcConfig.orchestration.provider);
|
|
1207
|
-
if (orchTimeoutSelect && vcConfig.orchestration.timeout) {
|
|
1208
|
-
orchTimeoutSelect.value = String(vcConfig.orchestration.timeout);
|
|
1209
|
-
// Show the dropdown if non-default for this provider
|
|
1210
|
-
if (vcConfig.orchestration.timeout !== orchProviderDefaultTimeout) {
|
|
1211
|
-
orchTimeoutSelect.style.display = '';
|
|
1212
|
-
}
|
|
1213
|
-
this._updateOrchestrationTimeoutIcon(panel, String(vcConfig.orchestration.timeout));
|
|
1214
|
-
} else if (orchTimeoutSelect) {
|
|
1215
|
-
// No saved timeout — apply the provider's default
|
|
1216
|
-
orchTimeoutSelect.value = String(orchProviderDefaultTimeout);
|
|
1217
|
-
this._updateOrchestrationTimeoutIcon(panel, String(orchProviderDefaultTimeout));
|
|
1218
|
-
}
|
|
1124
|
+
this._restoreOrchestrationTimeout(panel, vcConfig.orchestration);
|
|
1219
1125
|
|
|
1220
1126
|
// Restore orchestration custom instructions
|
|
1221
1127
|
const orchInstrInput = panel.querySelector('#vc-orchestration-instructions');
|
|
@@ -1521,6 +1427,10 @@ class VoiceCentricConfigTab {
|
|
|
1521
1427
|
}
|
|
1522
1428
|
}
|
|
1523
1429
|
|
|
1430
|
+
// Shared timeout methods (public/js/utils/council-timeout.js). In the browser the
|
|
1431
|
+
// util's <script> tag loads first; unit tests load it via require().
|
|
1432
|
+
((typeof window !== 'undefined' && window.CouncilTimeout) || require('../utils/council-timeout.js')).mixInto(VoiceCentricConfigTab);
|
|
1433
|
+
|
|
1524
1434
|
// Export for use in other modules
|
|
1525
1435
|
if (typeof window !== 'undefined') {
|
|
1526
1436
|
window.VoiceCentricConfigTab = VoiceCentricConfigTab;
|
package/public/js/index.js
CHANGED
|
@@ -22,16 +22,23 @@
|
|
|
22
22
|
|
|
23
23
|
// ─── Help Modal ─────────────────────────────────────────────────────────────
|
|
24
24
|
|
|
25
|
+
/** Element that had focus before the help modal opened, refocused on close */
|
|
26
|
+
let helpModalReturnFocus = null;
|
|
27
|
+
|
|
25
28
|
function openHelpModal() {
|
|
26
29
|
const overlay = document.getElementById('help-modal-overlay');
|
|
30
|
+
helpModalReturnFocus = document.activeElement;
|
|
27
31
|
overlay.classList.add('visible');
|
|
28
32
|
document.body.style.overflow = 'hidden';
|
|
33
|
+
document.getElementById('help-modal-close').focus();
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
function closeHelpModal() {
|
|
32
37
|
const overlay = document.getElementById('help-modal-overlay');
|
|
33
38
|
overlay.classList.remove('visible');
|
|
34
39
|
document.body.style.overflow = '';
|
|
40
|
+
if (helpModalReturnFocus) helpModalReturnFocus.focus();
|
|
41
|
+
helpModalReturnFocus = null;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
// Set up help button
|
|
@@ -1268,8 +1275,19 @@
|
|
|
1268
1275
|
/**
|
|
1269
1276
|
* Fetch and display recent reviews (initial load).
|
|
1270
1277
|
* Resets pagination state and renders the full table from scratch.
|
|
1278
|
+
*
|
|
1279
|
+
* The help modal is opt-in: only the initial page load passes
|
|
1280
|
+
* `showHelpIfEmpty`, so a first-time user with no reviews is greeted with
|
|
1281
|
+
* it, while every refresh (single delete, bulk delete) that happens to
|
|
1282
|
+
* empty the list just shows the empty-state message.
|
|
1283
|
+
*
|
|
1284
|
+
* @param {Object} [options]
|
|
1285
|
+
* @param {boolean} [options.showHelpIfEmpty=false] - Open the help modal
|
|
1286
|
+
* when the list comes back empty.
|
|
1271
1287
|
*/
|
|
1272
|
-
async function loadRecentReviews() {
|
|
1288
|
+
async function loadRecentReviews(options) {
|
|
1289
|
+
const showHelpIfEmpty = Boolean(options && options.showHelpIfEmpty);
|
|
1290
|
+
|
|
1273
1291
|
prSelection.exit();
|
|
1274
1292
|
|
|
1275
1293
|
const container = document.getElementById('recent-reviews-container');
|
|
@@ -1294,8 +1312,9 @@
|
|
|
1294
1312
|
'<p>No PR reviews yet. Paste a PR URL above to get started.</p>' +
|
|
1295
1313
|
'</div>';
|
|
1296
1314
|
container.classList.remove('recent-reviews-loading');
|
|
1297
|
-
//
|
|
1298
|
-
|
|
1315
|
+
// Greet first-time users with the help modal, but only on initial
|
|
1316
|
+
// page load, never after the user emptied the list themselves.
|
|
1317
|
+
if (showHelpIfEmpty) openHelpModal();
|
|
1299
1318
|
return;
|
|
1300
1319
|
}
|
|
1301
1320
|
|
|
@@ -2459,6 +2478,27 @@
|
|
|
2459
2478
|
|
|
2460
2479
|
// ─── DOMContentLoaded Initialization ────────────────────────────────────────
|
|
2461
2480
|
|
|
2481
|
+
/** Start-review input to focus on load, keyed by tab pane id */
|
|
2482
|
+
const TAB_AUTOFOCUS_INPUT_IDS = {
|
|
2483
|
+
'pr-tab': 'pr-url-input',
|
|
2484
|
+
'local-tab': 'local-path-input'
|
|
2485
|
+
};
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* Focus the restored tab's start-review input so a review can be started by
|
|
2489
|
+
* pasting and pressing Enter. Leaves focus alone if the user already moved
|
|
2490
|
+
* it while the page was loading.
|
|
2491
|
+
* @param {string} tabId - Tab pane id restored on load
|
|
2492
|
+
*/
|
|
2493
|
+
function focusRestoredTabInput(tabId) {
|
|
2494
|
+
const inputId = TAB_AUTOFOCUS_INPUT_IDS[tabId];
|
|
2495
|
+
if (!inputId) return;
|
|
2496
|
+
if (document.activeElement && document.activeElement !== document.body) return;
|
|
2497
|
+
|
|
2498
|
+
const input = document.getElementById(inputId);
|
|
2499
|
+
if (input) input.focus();
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2462
2502
|
document.addEventListener('DOMContentLoaded', async function () {
|
|
2463
2503
|
// Load config and update command examples based on npx detection.
|
|
2464
2504
|
// Await so that window.__pairReview.enableGraphite (and other config
|
|
@@ -2475,9 +2515,11 @@
|
|
|
2475
2515
|
switchTab(tabBar, targetBtn);
|
|
2476
2516
|
}
|
|
2477
2517
|
}
|
|
2518
|
+
focusRestoredTabInput(savedTab);
|
|
2478
2519
|
|
|
2479
|
-
// Always load PR reviews (they show on initial load)
|
|
2480
|
-
|
|
2520
|
+
// Always load PR reviews (they show on initial load). This is the only
|
|
2521
|
+
// caller that opens the help modal for an empty list.
|
|
2522
|
+
loadRecentReviews({ showHelpIfEmpty: true });
|
|
2481
2523
|
|
|
2482
2524
|
// If local tab is active, load local reviews immediately
|
|
2483
2525
|
if (savedTab === 'local-tab') {
|
|
@@ -41,7 +41,10 @@ class DiffRenderer {
|
|
|
41
41
|
</svg>
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
// Map of file extensions to highlight.js language names
|
|
44
|
+
// Map of file extensions to highlight.js language names. Every value must be
|
|
45
|
+
// registered by the bundles pr.html and local.html load (the cdnjs common set
|
|
46
|
+
// plus their languages/*.min.js tags); tests/unit/hljs-language-map.test.js
|
|
47
|
+
// enforces this.
|
|
45
48
|
static LANGUAGE_MAP = {
|
|
46
49
|
// JavaScript/TypeScript
|
|
47
50
|
'js': 'javascript',
|
|
@@ -56,7 +59,6 @@ class DiffRenderer {
|
|
|
56
59
|
'xml': 'xml',
|
|
57
60
|
'css': 'css',
|
|
58
61
|
'scss': 'scss',
|
|
59
|
-
'sass': 'sass',
|
|
60
62
|
'less': 'less',
|
|
61
63
|
// Python
|
|
62
64
|
'py': 'python',
|
|
@@ -113,8 +115,7 @@ class DiffRenderer {
|
|
|
113
115
|
'r': 'r',
|
|
114
116
|
'lua': 'lua',
|
|
115
117
|
'perl': 'perl',
|
|
116
|
-
'pl': 'perl'
|
|
117
|
-
'vim': 'vim'
|
|
118
|
+
'pl': 'perl'
|
|
118
119
|
};
|
|
119
120
|
|
|
120
121
|
/**
|
|
@@ -447,9 +448,9 @@ class DiffRenderer {
|
|
|
447
448
|
}
|
|
448
449
|
|
|
449
450
|
// Apply syntax highlighting if highlight.js is available
|
|
450
|
-
|
|
451
|
+
const language = fileName ? DiffRenderer.detectLanguage(fileName) : null;
|
|
452
|
+
if (language && window.hljs?.getLanguage(language)) {
|
|
451
453
|
try {
|
|
452
|
-
const language = DiffRenderer.detectLanguage(fileName);
|
|
453
454
|
const highlighted = window.hljs.highlight(content, { language, ignoreIllegals: true });
|
|
454
455
|
let html = highlighted.value;
|
|
455
456
|
|