From a65a453feb58c7c4ec6158cb5842ba63c6d216f9 Mon Sep 17 00:00:00 2001 From: rob Date: Thu, 9 Oct 2025 23:56:52 +0000 Subject: [PATCH] Update src/ai-repo-commander.user.js 1. Queue Configuration (lines 59-62) QUEUE_MIN_DELAY_MS: 800 - Minimum delay between command executions QUEUE_MAX_PER_MINUTE: 15 - Rate limiting cap QUEUE_MAX_PER_MESSAGE: 5 - Maximum commands per assistant message QUEUE_WAIT_FOR_COMPOSER_MS: 6000 - Timeout for waiting for composer ready state 2. ExecutionQueue Class (lines 830-862) Self-contained queue with rate limiting Automatically drains commands with proper delays Respects per-minute rate limits Provides size change callbacks for UI updates 3. Multi-Command Detection (lines 328-352) extractAllCompleteBlocks() - Finds all @bridge@ blocks in text findAllCommandsInMessage() - Extracts all commands from a message element attachQueueBadge() - Shows visual indicator of queued commands waitForComposerReady() - Waits for safe state before pasting 4. Enhanced History with Per-Command Deduplication (lines 619-685) Extended fingerprinting with optional suffix for multi-command support Each command in a message gets unique tracking (e.g., #1, #2, etc.) 5. Queue Integration in Scanning (lines 1116-1165) Automatically detects and queues multiple commands Shows badge indicating how many commands were queued Respects QUEUE_MAX_PER_MESSAGE limit enqueueCommand() method handles individual command execution 6. Enhanced Emergency Stop (lines 1323-1345) Clears the entire queue when STOP is activated Reports how many commands were cancelled 7. UI Improvements "Clear Queue" button in header showing current queue size Queue settings in Tools & Settings panel Real-time queue size updates 8. Global API (line 1384) window.AI_REPO_QUEUE.clear() - Clear all queued commands window.AI_REPO_QUEUE.size() - Get current queue size window.AI_REPO_QUEUE.cancelOne(predicate) - Cancel specific command The script now handles multiple commands in a single assistant message gracefully, with proper rate limiting, visual feedback, and robust error handling! --- src/ai-repo-commander.user.js | 401 ++++++++++++++++++++++++++-------- 1 file changed, 314 insertions(+), 87 deletions(-) diff --git a/src/ai-repo-commander.user.js b/src/ai-repo-commander.user.js index 7dde7c6..fa7b972 100644 --- a/src/ai-repo-commander.user.js +++ b/src/ai-repo-commander.user.js @@ -1,8 +1,8 @@ // ==UserScript== // @name AI Repo Commander // @namespace http://tampermonkey.net/ -// @version 1.5.2 -// @description Execute @bridge@ YAML commands from AI assistants (safe & robust): complete-block detection, streaming-settle, persistent dedupe, paste+autosubmit, debug console with Tools/Settings, draggable/collapsible panel +// @version 1.6.0 +// @description Execute @bridge@ YAML commands from AI assistants (safe & robust): complete-block detection, streaming-settle, persistent dedupe, paste+autosubmit, debug console with Tools/Settings, draggable/collapsible panel, multi-command queue // @author Your Name // @match https://chat.openai.com/* // @match https://chatgpt.com/* @@ -36,7 +36,7 @@ // Timing & API DEBOUNCE_DELAY: 3000, MAX_RETRIES: 2, - VERSION: '1.5.2', + VERSION: '1.6.0', API_TIMEOUT_MS: 60000, PROCESS_EXISTING: false, @@ -72,6 +72,12 @@ SCAN_DEBOUNCE_MS: 250, FAST_WARN_MS: 50, SLOW_WARN_MS: 60_000, + + // Queue management + QUEUE_MIN_DELAY_MS: 800, + QUEUE_MAX_PER_MINUTE: 15, + QUEUE_MAX_PER_MESSAGE: 5, + QUEUE_WAIT_FOR_COMPOSER_MS: 6000, }; function loadSavedConfig() { @@ -295,6 +301,7 @@ +
@@ -338,6 +345,21 @@ API_TIMEOUT_MS +
+

Queue Settings

+ + + + +

Bridge Configuration