This commit addresses multiple issues affecting message delivery
to AI Studio:
1. Resolved a ReferenceError in `AIStudioProvider.sendChatMessage`
where `sendButton` was used before definition, preventing message
submission. The logging has been corrected.
2. Implemented logic in `background.js` to detect if an active
chat request to AI Studio is interrupted by a tab update
(e.g., navigation or reload). If an interruption is suspected,
the command is re-queued and re-sent to the content script
after the tab and debugger have re-initialized. This aims to
prevent requests from being lost due to page refreshes.
3. Ensured `currentRequestTargetTabId` is correctly managed and
nulled when request processing completes or fails, supporting
the resend logic.
These changes significantly improve the reliability of sending
messages to AI Studio, particularly in dynamic page environments.