Double-execution / wrong “Run again” target:
You now fingerprint per message and per sub-command (markElement(el, idx+1)) and render per-command “Run again [#n]” buttons. That removes the old single-block ambiguity and prevents re-exec on reloads.
Cold-start / resume spam:
On resume you call markExistingHitsAsProcessed() which marks visible commands and injects Run-again buttons instead of auto-executing. That stops surprise replays after page refresh or unpause.
Streaming “half blocks” firing too early:
waitForStableCompleteBlock() + the required @end@ terminator and the settle window (SETTLE_CHECK_MS/SETTLE_POLL_MS) means you only act on a fully streamed, stable block.
Multi-command messages:
extractAllCompleteBlocks() + queueing each hit with unique render keys/labels gives correct detection, dedupe, status lines, and retries per block.
YAML | blocks cutting off at new keys:
The parser now ends a | block on any unindented key:—fixing prior cases where multi-line fields (content/body) swallowed following keys or vice-versa.
Composer/paste flakiness across models:
You added a robust paste stack (ClipboardEvent → ProseMirror HTML → execCommand → textarea/value → contentEditable → GM_setClipboard fallback) and waitForComposerReady() with send-button checks. That should address “pasted but empty” and “submit didn’t fire”.
Long response pastes breaking fences / hitting limits:
ResponseBuffer consolidates outputs, and splitRespectingCodeFence() keeps single fenced blobs intact across chunks while honoring MAX_PASTE_CHARS.
History that didn’t survive reloads / wrong thread:
Conversation-scoped persistent dedupe (ConvHistory with TTL) plus a stronger fingerprint (command hash + previous-context hash + DOM hint + ordinal) prevents cross-thread collisions and stale replays.
Emergency stop + rate limiting:
Queue rate-cap + STOP handler will keep you safe from API storms and let you halt mid-flight cleanly.
Resume-safe behavior (no accidental re-runs after unpausing; Run again buttons instead).
Simple example: true opt-out that silently skips execution.
Better paste fidelity for triple-backtick blocks in the composer.
Helpful timing comments for future tuning.
Version set to 1.6.2.
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!
1. Two Helper Methods (added to DebugConsole class):
flashBtn(btn, label, ms) - Temporarily disables button, shows checkmark feedback
toast(msg, ms) - Shows temporary toast notification in bottom-right of panel
2. Enhanced All Button Click Handlers:
Copy buttons - Flash "Copied ✓" and show toast
Pause/Resume - Flash "Paused ✓" or "Resumed ✓" with toast
STOP API - Flash "Stopped ✓" with toast
Clear History - Flash "Cleared ✓" with toast
Toggles & Number inputs - Show inline toast feedback
Save/Reset Config - Flash button and show toast
Bridge Key buttons - Flash and show toast feedback
Run Again buttons - Flash "Running ✓" or "Dismissed ✓"
3. Version Bump:
Updated from v1.5.1 to v1.5.2
Manual reruns are explicit: keeping the fingerprint marked prevents surprise re-execution on refresh, but you can always click “Run again” to force it.
1. Fixed Outdated Regex (2 locations)
Before: /No complete \^%\$bridge/ (looking for old delimiter)
After: /No complete @bridge@/ (looking for new delimiter)
Impact: Parse errors now properly show "Run again" UI instead of silently failing
2. Removed History Unmarking (2 locations)
Removed: this.history.unmarkElement(el) from both cold start and already-processed branches
Why: Keeps commands marked in history to prevent auto-replay on reload
Behavior: "Run again" button executes immediately but doesn't remove the persistent marker
New Command Delimiters
^%$bridge → @bridge@ (easier to type/remember)
--- → @end@ (won't conflict with markdown horizontal rules!)
Updated All Regex Patterns
Command detection
Block extraction
Completion checking
Fingerprinting
Updated Test Commands
All examples now use @bridge@ / @end@
Added example showing --- working inside content blocks
New Command Format:
yaml@bridge@
action: update_file
repo: test-repo
path: docs/README.md
content: |
# My Markdown
This has a horizontal rule:
---
No problem! The @end@ terminator is distinctive.
body: Optional description
@end@
changed command history aproach.
More resilient - Handles edge cases in long conversations and streaming responses
Better cleanup - Won't leak memory from stuck operations
Cancellable operations - Can be stopped mid-flight without errors
Better debugging - Magic numbers replaced with named config values
Improved UX - Error states now offer recovery options
✅ 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