Update src/ai-repo-commander.user.js

 Increase API timeout from 30s to 60s

 Prevent scanning when paused

Recommended (nice to have):
3.  Make API timeout configurable
4.  Optimize timing values based on your successful test
This commit is contained in:
rob 2025-10-07 23:05:27 +00:00
parent 59379336e2
commit 3575dec2ee
1 changed files with 12 additions and 6 deletions

View File

@ -32,9 +32,12 @@
DEBUG_WATCH_MS: 120000, DEBUG_WATCH_MS: 120000,
DEBUG_MAX_LINES: 400, DEBUG_MAX_LINES: 400,
DEBUG_SHOW_PANEL: true, DEBUG_SHOW_PANEL: true,
DEBOUNCE_DELAY: 5000, // bot-typing protection
// Timing & API
DEBOUNCE_DELAY: 3000, // was 5000
MAX_RETRIES: 2, MAX_RETRIES: 2,
VERSION: '1.4.0', VERSION: '1.4.0',
API_TIMEOUT_MS: 60000, // NEW: configurable API timeout
PROCESS_EXISTING: false, PROCESS_EXISTING: false,
ASSISTANT_ONLY: true, ASSISTANT_ONLY: true,
@ -52,10 +55,10 @@
POST_PASTE_DELAY_MS: 250, POST_PASTE_DELAY_MS: 250,
SUBMIT_MODE: 'button_first', // 'button_first' | 'enter_only' | 'smart' SUBMIT_MODE: 'button_first', // 'button_first' | 'enter_only' | 'smart'
// Streaming-complete hardening (DeepSeek #2) // Streaming-complete hardening
REQUIRE_TERMINATOR: true, // require trailing '---' line REQUIRE_TERMINATOR: true, // require trailing '---' line
SETTLE_CHECK_MS: 1500, // time to see the block remain unchanged SETTLE_CHECK_MS: 800, // was 1500
SETTLE_POLL_MS: 300, // poll interval for stability SETTLE_POLL_MS: 200, // was 300
// Runtime toggles // Runtime toggles
RUNTIME: { PAUSED: false } RUNTIME: { PAUSED: false }
@ -285,6 +288,9 @@
<label style="display:flex;align-items:center;gap:8px;margin:4px 0;"> <label style="display:flex;align-items:center;gap:8px;margin:4px 0;">
SETTLE_POLL_MS <input class="rc-num" data-key="SETTLE_POLL_MS" type="number" min="50" step="50" style="width:120px;background:#0b1220;color:#e5e7eb;border:1px solid #374151;border-radius:4px;padding:2px 6px;"> SETTLE_POLL_MS <input class="rc-num" data-key="SETTLE_POLL_MS" type="number" min="50" step="50" style="width:120px;background:#0b1220;color:#e5e7eb;border:1px solid #374151;border-radius:4px;padding:2px 6px;">
</label> </label>
<label style="display:flex;align-items:center;gap:8px;margin:4px 0;">
API_TIMEOUT_MS <input class="rc-num" data-key="API_TIMEOUT_MS" type="number" min="10000" step="5000" style="width:120px;background:#0b1220;color:#e5e7eb;border:1px solid #374151;border-radius:4px;padding:2px 6px;">
</label>
</div> </div>
<div style="grid-column:1 / -1;"> <div style="grid-column:1 / -1;">
<h4 style="margin:8px 0 6px 0;">Config JSON</h4> <h4 style="margin:8px 0 6px 0;">Config JSON</h4>
@ -435,12 +441,12 @@
}); });
// Set initial UI states // Set initial UI states
const pauseBtn = root.querySelector('.rc-pause');
pauseBtn.textContent = this.cfg.RUNTIME.PAUSED ? 'Resume' : 'Pause'; pauseBtn.textContent = this.cfg.RUNTIME.PAUSED ? 'Resume' : 'Pause';
if (this.cfg.RUNTIME.PAUSED) { if (this.cfg.RUNTIME.PAUSED) {
pauseBtn.style.background = '#f59e0b'; pauseBtn.style.background = '#f59e0b';
pauseBtn.style.color = '#111827'; pauseBtn.style.color = '#111827';
} }
} }
_renderRow(e) { _renderRow(e) {
@ -846,7 +852,7 @@
url: command.url, url: command.url,
headers: { 'X-Bridge-Key': bridgeKey, 'Content-Type': 'application/json' }, headers: { 'X-Bridge-Key': bridgeKey, 'Content-Type': 'application/json' },
data: JSON.stringify(command), data: JSON.stringify(command),
timeout: 30000, timeout: CONFIG.API_TIMEOUT_MS || 60000,
onload: (response) => (response.status >= 200 && response.status < 300) onload: (response) => (response.status >= 200 && response.status < 300)
? resolve(response) ? resolve(response)
: reject(new Error(`API Error ${response.status}: ${response.statusText}`)), : reject(new Error(`API Error ${response.status}: ${response.statusText}`)),