diff --git a/README.md b/README.md
index 42882a2..5254f14 100644
--- a/README.md
+++ b/README.md
@@ -1,62 +1,253 @@
-
BrowseBot (Findbar Only)
+BrowseBot
-A **fork** of [Vertex-Mods/Browse-Bot](https://github.com/Vertex-Mods/Browse-Bot) scoped to **Findbar AI only**: a floating, page-aware chat on the native findbar in **Zen Browser**. URL bar AI and agentic browser tools are removed.
+Inspired by Arc Browser, this script transforms the standard findbar and URL bar in **Zen Browser** into modern, AI-powered command interfaces. The findbar becomes a floating chat panel for deep interaction with page content, while the URL bar offers quick AI-powered actions and searches.
-## Features
+https://github.com/user-attachments/assets/40dae6f6-065c-4852-be07-f29d00ec99ae
-- **Floating chat UI** on the findbar (minimal Arc-style mode + expanded chat)
-- **Multi-provider LLM** (Gemini, Mistral, OpenAI, Claude, Grok, Perplexity, Cerebras, Ollama)
-- **Page content awareness** โ page text is sent in the system prompt for Q&A
-- **Optional citations** (structured quotes from the page)
-- **Streaming responses**
-- **Context menu** โ Ask AI / summarize with selection templates
-- **Zen Command Palette** โ Summarize page, expand findbar, open settings
-- **Customizable** via Sine settings or `about:config`
+## ๐ Features
-## Removed (vs upstream Browse-Bot)
+- ๐จ **Floating Chat UI**: A sleek, draggable, and resizable findbar that transforms into an AI chat panel.
+- ๐ **URL Bar AI Commands**: Activate an AI command mode directly in your URL bar for quick actions.
+- ๐ค **Multi-Provider Support**: Integrates with Google Gemini, Mistral AI, OpenAI, Anthropic Claude, xAI Grok, Perplexity AI, Cerebras, and local models via Ollama.
+- ๐ง **Page Content Awareness**: Lets the AI read the current page's text, HTML, and even YouTube transcripts to provide context-aware answers.
+- ๐ **Powerful AI Tool-belt**: Empowers the AI to control the browserโmanage tabs, workspaces, bookmarks, perform searches, and interact with page elements.
+- ๐ฑ๏ธ **Context Menu Integration**: Right-click to quickly ask the AI about selected text or summarize the current page.
+- ๐ **Citation Support**: Get direct quotes from the page text that support the AI's answer.
+- ๐ง **Highly Customizable**: Fine-tune every aspect through an sine settings or `about:config`.
+- โจ๏ธ **Custom Shortcuts**: Configure keyboard shortcuts to open the AI chat and URL bar commands.
-- URL bar AI (`Ctrl+Space` command mode)
-- Agentic mode and all browser tool calls (tabs, search, workspaces, etc.)
-- YouTube transcript tools (page text only)
+## Demo Videos
-## Installation (Sine)
+### URL Bar AI
-1. Install [Sine](https://github.com/CosmoCreeper/Sine) on Zen Browser.
-2. Install this mod from your fork or a Sine catalog entry pointing at `Zylaah/Browse-Bot` (branch `findbar-only`).
-3. Restart Zen when prompted.
+https://github.com/user-attachments/assets/78e37797-0e6a-4176-8eb2-e5e03f868db3
-## Usage
+### Agentic mode (with new tool calls)
-1. Configure an API key (or use Ollama locally) when prompted.
-2. `Ctrl+F` โ open findbar; **Alt+Enter** or **Ask** sends to AI (minimal mode).
-3. `Ctrl+Shift+F` โ open findbar directly in AI chat (configurable).
-4. Right-click โ **Ask AI** / summarize (if enabled).
+https://github.com/user-attachments/assets/a8f3113e-97e6-42a6-8300-f99f0268274b
-## Key preferences
+## ๐ ๏ธ Technologies used
-| Preference | Default | Description |
-| ---------- | ------- | ----------- |
-| `extension.browse-bot.findbar-ai.enabled` | `true` | Master toggle |
-| `extension.browse-bot.llm-provider` | `gemini` | AI provider |
-| `extension.browse-bot.findbar-ai.stream-enabled` | `true` | Stream replies |
-| `extension.browse-bot.findbar-ai.citations-enabled` | `false` | Quote-based citations (incompatible with streaming) |
-| `extension.browse-bot.findbar-ai.shortcut-findbar` | `ctrl+shift+f` | Open AI findbar |
+- **[Vercel AI SDK](https://ai-sdk.dev/)**: For managing multiple Providers for AI.
+- **[Zod](https://zod.dev/)**: Schema validation (making sure AI is giving output in correct format and calling correct tools).
+- **[Marked](https://marked.js.org/)**: For markdown parsing.
-See Sine settings or upstream README for full provider keys and findbar appearance prefs.
+## ๐จ Caution
-## Privacy
+- **Privacy**: To answer questions about a webpage, this script sends the text content of the page to your selected provider. Please be aware of the privacy implications before using this feature on pages with sensitive information. Or if you are using ollama you don't have to worry about this.
-Page text is sent to your chosen LLM provider (except Ollama). Do not use on sensitive pages unless you trust the provider.
+- **Prompt Injectation**: Be aware of [prompt injectation](https://en.wikipedia.org/wiki/Prompt_injection) attacks and use this mod only in websites you trust.
-## Credits
+## โ๏ธ Installation
-Based on [Browse-Bot](https://github.com/Vertex-Mods/Browse-Bot) by Bibek Bhusal / Vertex Mods.
+### Sine
-## License
+1. Install latest version of [Sine](https://github.com/CosmoCreeper/Sine) (if you haven't already).
+2. Restart Zen Browser.
+3. Open settings and go to the `Sine` tab.
+4. Search for `BrowseBot`.
+5. Click Install.
+6. A toast for restart should appear โ click on that to restart Zen.
+7. Enjoy your new AI assistant! โจ
-MIT โ see [LICENSE](./LICENSE).
+> [!NOTE]
+> If you want to try Early Beta version you can use the beta branch `https://github.com/Vertex-Mods/Browse-Bot/tree/beta`
+
+### Manual Install (`fx-autoconfig`)
+
+For advanced users or those not using Sine or who are willing to contribute:
+
+1. **Setup `fx-autoconfig`**: If you haven't already, follow the setup instructions at [MrOtherGuy/fx-autoconfig](https://github.com/MrOtherGuy/fx-autoconfig).
+
+2. **Clone this Repository**: Open a terminal or command prompt, navigate to the `js` directory created by `fx-autoconfig` inside your profile folder, and clone the repository with the name `custom`:
+
+ ```bash
+ git clone https://github.com/BibekBhusal0/zen-custom-js.git custom
+ ```
+
+3. **Bundle the Script**: This script uses modern JavaScript that needs to be bundled. Navigate into the new directory and run the build command:
+
+ ```bash
+ cd custom
+ npm install
+ npm run build
+ ```
+
+4. **Import the Script**: In your JS directory, create a new file `import.uc.mjs` (or add to an existing one), and add the following line:
+
+ ```javascript
+ import "./custom/dist/browse-bot.uc.js";
+ ```
+
+5. **Import the Styles**: In your `userChrome.css` file, add the following line:
+
+ ```css
+ @import "js/custom/findbar-ai/style.css";
+ ```
+
+6. **Restart Zen Browser**: Restart the browser for all changes to take effect. You might need to clear the startup cache from `about:support`.
+
+## ๐ Usage
+
+### Findbar AI Chat
+
+1. **Configure Provider**: After installation, press `Ctrl+Shift+F`. For most providers, BrowseBot will prompt you to select a provider and set an API key. For **Ollama**, no initial setup is required, and it will default to the local address. You can configure the Base URL in the settings.
+2. **Save the Key**: Paste the key into the input field and click "Save". The chat interface will now appear.
+3. **Start Chatting**:
+ - Press `Ctrl+F` to open the standard findbar.
+ - In the default (non-minimal) view, click the "Expand" button to switch to AI chat. In Minimal Mode, just enter your query and click "Ask".
+ - Type your questions about the current page and press on send button.
+ - Use `Ctrl+Shift+F` to open the AI chat directly, using any text you have selected on the page as the initial prompt (this shortcut will not work if it has been changed).
+
+### URL Bar AI Commands
+
+1. Press `Ctrl+Space` to activate AI mode in the URL bar (this shortcut will not work if has been changed).
+2. Type your command directly (e.g., "search for red pandas", "open github", "close all youtube tabs").
+3. Press `Enter` to execute the command. The AI will perform the action, often providing feedback via a small toast notification.
+
+### Command Palette Integration
+
+BrowseBot integrates with Zen Command Palette to provide quick access to common actions:
+
+1. Press `Ctrl+L` to open the palette.
+2. Available BrowseBot commands:
+ - **Summarize Page**: Opens the findbar AI and prompts to summarize the current page.
+ - **Open BrowseBot Settings**: Opens the BrowseBot settings modal.
+ - **Toggle URL bar AI mode**: Activates AI mode in the URL bar.
+ - **Expand findbar AI**: Opens the findbar directly in AI chat mode.
+
+## ๐ง Customization
+
+You can customize the BrowseBot through the settings modal (found in the chat header) or via `about:config`.
+
+
+Preferences (`about:config`)
+
+| Preference | Type | Default | Description |
+| --------------------------------------------------------------------- | ------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
+| `extension.browse-bot.findbar-ai.enabled` | Boolean | `true` | Toggles the findbar AI feature on or off. |
+| `extension.browse-bot.urlbar-ai-enabled` | Boolean | `true` | Toggles the URL bar AI feature on or off. |
+| `extension.browse-bot.urlbar-ai.hide-suggestions` | Boolean | `true` | Hides autocomplete suggestions in the URL bar when AI mode is active. |
+| `extension.browse-bot.urlbar-ai.animations-enabled` | Boolean | `true` | Enables animations for the URL bar AI. |
+| `extension.browse-bot.findbar-ai.minimal` | Boolean | `true` | Toggles a simpler, more compact UI for the findbar. |
+| `extension.browse-bot.findbar-ai.persist-chat` | Boolean | `false` | Persists chat history across tab switches (but not browser restarts). |
+| `extension.browse-bot.findbar-ai.dnd-enabled` | Boolean | `true` | Enables dragging to move and resizing of the findbar window. |
+| `extension.browse-bot.findbar-ai.remember-dimensions` | Boolean | `true` | Remembers the size of the findbar window across sessions. |
+| `extension.browse-bot.findbar-ai.width` | Number | `500` | The width of the findbar. |
+| `extension.browse-bot.findbar-ai.position` | String | `"top-right"` | Sets the corner where the findbar snaps. Options: `top-left`, `top-right`, `bottom-left`, `bottom-right`. |
+| `extension.browse-bot.findbar-ai.background-style` | String | `"solid"` | The background style of the findbar. Options: `solid`, `acrylic`, `pseudo`. |
+| `extension.browse-bot.llm-provider` | String | `"gemini"` | Which AI provider to use. Options: `gemini`, `mistral`, `openai`, `claude`, `grok`, `perplexity`, `cerebras`, `ollama`. |
+| `extension.browse-bot.cerebras-api-key` | String | _(empty)_ | Your API key for Cerebras AI. |
+| `extension.browse-bot.cerebras-model` | String | `"llama3.1-8b"` | The specific Cerebras model to use. |
+| `extension.browse-bot.gemini-api-key` | String | _(empty)_ | Your API key for Google Gemini. |
+| `extension.browse-bot.gemini-model` | String | `"gemini-2.5-flash"` | The specific Gemini model to use. |
+| `extension.browse-bot.mistral-api-key` | String | _(empty)_ | Your API key for Mistral AI. |
+| `extension.browse-bot.mistral-model` | String | `"mistral-medium-latest"` | The specific Mistral model to use. |
+| `extension.browse-bot.openai-api-key` | String | _(empty)_ | Your API key for OpenAI. |
+| `extension.browse-bot.openai-model` | String | `"gpt-5.2"` | The specific OpenAI model to use. |
+| `extension.browse-bot.claude-api-key` | String | _(empty)_ | Your API key for Anthropic Claude. |
+| `extension.browse-bot.claude-model` | String | `"claude-opus-4-5"` | The specific Claude model to use. |
+| `extension.browse-bot.grok-api-key` | String | _(empty)_ | Your API key for xAI Grok. |
+| `extension.browse-bot.grok-model` | String | `"grok-4"` | The specific Grok model to use. |
+| `extension.browse-bot.perplexity-api-key` | String | _(empty)_ | Your API key for Perplexity AI. |
+| `extension.browse-bot.perplexity-model` | String | `"sonar"` | The specific Perplexity model to use. |
+| `extension.browse-bot.ollama-base-url` | String | `http://localhost:11434/api` | The base URL for your local Ollama API. |
+| `extension.browse-bot.ollama-model` | String | `"mixtral:8x7b"` | The specific Ollama model to use. |
+| `extension.browse-bot.findbar-ai.context-menu-enabled` | Boolean | `true` | Toggles the "Ask AI" item in the right-click context menu. |
+| `extension.browse-bot.findbar-ai.context-menu-autosend` | Boolean | `true` | If true, clicking the context menu item sends the request to the AI immediately. |
+| `extension.browse-bot.findbar-ai.context-menu-command-no-selection` | String | `"Summarize current page"` | The command to send when no text is selected. |
+| `extension.browse-bot.findbar-ai.context-menu-command-with-selection` | String | `"Explain this in context of current page:\n\n{selection}"` | The command to send when text is selected. `{selection}` is the placeholder. |
+| `extension.browse-bot.findbar-ai.agentic-mode` | Boolean | `false` | If true, allows the AI to use tools to interact with the browser. |
+| `extension.browse-bot.findbar-ai.max-tool-calls` | Number | `5` | The maximum number of consecutive tool calls the AI can make in one turn. |
+| `extension.browse-bot.custom-system-prompt` | String | _(empty)_ | Custom system prompt to override the default AI behavior. |
+| `extension.browse-bot.findbar-ai.conform-before-tool-call` | Boolean | `true` | If true, prompts you for confirmation before the AI executes any tools. |
+| `extension.browse-bot.findbar-ai.stream-enabled` | Boolean | `true` | AI response will be streamed in chunks. |
+| `extension.browse-bot.findbar-ai.citations-enabled` | Boolean | `false` | If true, the AI will try to cite its sources from the page content. |
+| `extension.browse-bot.llm.temperature` | Number | `0.7` | Controls randomness. |
+| `extension.browse-bot.llm.top-p` | Number | `1.0` | Nucleus sampling limits. |
+| `extension.browse-bot.llm.top-k` | Number | `40` | Limits sampling to top K tokens. |
+| `extension.browse-bot.llm.frequency-penalty` | Number | `0.0` | Penalizes frequent tokens. |
+| `extension.browse-bot.llm.presence-penalty` | Number | `0.0` | Penalizes repeated tokens. |
+| `extension.browse-bot.llm.max-output-tokens` | Number | `2048` | Maximum number of tokens to generate. |
+| `extension.browse-bot.findbar-ai.shortcut-findbar` | String | `"ctrl+shift+f"` | Keyboard shortcut to open findbar AI. Format: `ctrl+shift+f` (press keys to record in settings). |
+| `extension.browse-bot.urlbar-ai.shortcut-urlbar` | String | `"ctrl+space"` | Keyboard shortcut to toggle URL bar AI mode. Format: `ctrl+space` (press keys to record in settings). |
+| `extension.browse-bot.debug-mode` | Boolean | `false` | Set to `true` to enable verbose logging in the Browser Console for troubleshooting. |
+
+> [!WARNING]
+> Don't turn on both Agentic Mode Citations at the same time. The AI might not function properly.
+
+
+
+### โจ๏ธ Keymaps
+
+Default keyboard shortcuts:
+
+| Shortcut | Action |
+| -------------- | ----------------------------------------------------------------------------------------------------------- |
+| `Ctrl+Shift+F` | Opens the findbar directly into the expanded AI mode. |
+| `Ctrl+Space` | Toggles the URL bar into AI command mode. |
+| `Escape` | If the AI interface is expanded, it collapses to the standard findbar. If not expanded, closes the findbar. |
+| `Alt + Enter` | Sends the text from the standard findbar to the AI, expanding the view. |
+
+> [!NOTE]
+> You can customize these shortcuts in the Settings modal under "Keyboard Shortcuts".
+
+## ๐จ Tool-calls
+
+AI can also make tool calls to perform actions within the browser. To enable this, go to `about:config` or the settings and set `extension.browse-bot.findbar-ai.agentic-mode` to `true`.
+
+> [!NOTE]
+> The **Findbar AI** has access to all tools listed below in Agentic Mode (except for bookmarks). The **URL Bar AI** uses a focused subset for quick actions: `Search`, `Navigation`, `Tab Management`, `Workspace Management`, and `UI Feedback`.
+
+Currently available tool calls are:
+
+- **Search**: Searches a term on your default or a specified search engine.
+- **Navigation**: `openLink` in various locations (current/new tab, window, private, glance, splits), `newSplit` with multiple URLs, and `splitExistingTabs`.
+- **Tab Management**: A full suite of tools to `getAllTabs`, `searchTabs`, `closeTabs`, `reorderTab`, `addTabsToFolder`, `removeTabsFromFolder`, `createTabFolder`, `addTabsToEssentials`, and `removeTabsFromEssentials`.
+- **Page Interaction**: `getPageTextContent` to read text, `getHTMLContent` for the full source, `clickElement` using a CSS selector, and `fillForm` inputs.
+- **YouTube**: `getYoutubeTranscript`, `getYoutubeDescription`, and `getYoutubeComments` for the current video.
+- **Bookmark Management**: A full suite of tools to `searchBookmarks`, `getAllBookmarks`, `createBookmark`, `addBookmarkFolder`, `updateBookmark`, and `deleteBookmark`. Bookmark management tools are disabled due to confustion with tab folder and bookmark fodler.
+- **Workspace Management**: Tools to `getAllWorkspaces`, `createWorkspace`, `updateWorkspace`, `deleteWorkspace`, `moveTabsToWorkspace`, and `reorderWorkspace`.
+- **UI Feedback**: `showToast` to display temporary notifications to the user.
+
+## โ๏ธ Development Roadmap
+
+- [ ] Pin/unpin the findbar
+- [x] Context Menu integration
+- [x] Different themes (glass, light, dark, etc.)
+- [ ] Smooth animations for all interactions
+- [x] Custom system prompts
+- [x] Add Settings.
+- [ ] Copy Button
+- [ ] Markdown Formatting toggle
+- [ ] Slash Command and variables
+- [x] Adding more tools (tab groups, workspaces, background search)
+- [x] Giving AI YouTube transcript
+- [ ] Tagging multiple tabs
+- [x] Advanced LLM parameters (temperature, top-k, etc.)
+- [x] Keyboard shortcut customization
+- [x] Add more models (GPT-5, Gemini 2.5, DeepSeek R1, etc.)
+
+## ๐ Bugs and potential issues (I am working on fixing them)
+
+- If AI makes tool call to open tab or change workspace, history might not persist correctly.
+- In settings text encoding is broken (for chinese text).
+- Styles in glance
+
+## ๐ Credits and Acknowledgements
+
+- This mod is released through [Vertex Mods](https://github.com/Vertex-Mods/), and I, [Bibek Bhusal](https://github.com/BibekBhusal0), am the creator of this mod.
+- **[natsumi-browser](https://github.com/greeeen-dev/natsumi-browser)**: For inspiration on the modern, floating UI styles in Findbar.
+- **[Arc-2.0](https://github.com/YashjitPal/Arc-2.0)**: For inspiration for animation for URL bar.
+- **[Arcline](https://github.com/ferrocyante/arcline)**: For implementation of pseudo background.
+- **[aminomancer/uc.css.js](https://github.com/aminomancer/uc.css.js)**: The `_overrideFindbarMatchesDisplay` function in `findbar-ai.uc.js` is adapted from `JS/findbarMods.uc.js` under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0).
+- **[12th-devs](https://github.com/12th-devs/)** for helping me in each step of developement, styling, and design.
+
+## ๐ License
+
+This is licensed under MIT license. Check [License](./LICENSE) for more details.
diff --git a/browse-bot.uc.mjs b/browse-bot.uc.mjs
index fd8265a..eb9b671 100644
--- a/browse-bot.uc.mjs
+++ b/browse-bot.uc.mjs
@@ -1,8 +1,8 @@
// ==UserScript==
// @name Browse Bot
-// @description Findbar-only AI chat for Zen Browser โ page-aware Q&A without URL bar or agentic tools.
+// @description Transforms the standard Zen Browser findbar into a modern, floating, AI-powered chat interface. Inspired by Arc Browser.
// @author Bibek Bhusal
-// @version 3.0.0-findbar-only
+// @version 2.5.82
// @lastUpdated 2026-02-05
// @ignorecache
// @homepage https://github.com/Vertex-Mods/Browse-Bot
@@ -13,7 +13,7 @@
// To make changes, please edit the source files in the repository:
// https://github.com/BibekBhusal0/zen-custom-js
-import { n as number, o as object, s as string, a as array, c as createCerebras, b as createPerplexity, d as createOpenAI, e as createOllama, f as createMistral, x as xai, g as createGoogleGenerativeAI, h as createAnthropic, j as generateText, k as streamText, l as output_exports } from './vercel-ai-sdk.uc.mjs';
+import { n as number, t as tool, o as object, s as string, a as array, c as createCerebras, b as createPerplexity, d as createOpenAI, e as createOllama, f as createMistral, x as xai, g as createGoogleGenerativeAI, h as createAnthropic, i as stepCountIs, j as generateText, k as streamText, l as output_exports } from './vercel-ai-sdk.uc.mjs';
function setPref(key, value) {
try {
@@ -131,7 +131,10 @@ class BrowseBotPREFS extends PREFS$1 {
static REMEMBER_DIMENSIONS = "extension.browse-bot.findbar-ai.remember-dimensions";
static WIDTH = "extension.browse-bot.findbar-ai.width";
static STREAM_ENABLED = "extension.browse-bot.findbar-ai.stream-enabled";
+ static AGENTIC_MODE = "extension.browse-bot.findbar-ai.agentic-mode";
static CITATIONS_ENABLED = "extension.browse-bot.findbar-ai.citations-enabled";
+ static MAX_TOOL_CALLS = "extension.browse-bot.findbar-ai.max-tool-calls";
+ static CONFORMATION = "extension.browse-bot.findbar-ai.conform-before-tool-call";
static CONTEXT_MENU_ENABLED = "extension.browse-bot.findbar-ai.context-menu-enabled";
static CONTEXT_MENU_AUTOSEND = "extension.browse-bot.findbar-ai.context-menu-autosend";
static CONTEXT_MENU_COMMAND_WITH_SELECTION =
@@ -142,6 +145,11 @@ class BrowseBotPREFS extends PREFS$1 {
static CUSTOM_SYSTEM_PROMPT = "extension.browse-bot.custom-system-prompt";
static SHORTCUT_FINDBAR = "extension.browse-bot.findbar-ai.shortcut-findbar";
+ static SHORTCUT_URLBAR = "extension.browse-bot.urlbar-ai.shortcut-urlbar";
+
+ static URLBAR_AI_ENABLED = "extension.browse-bot.urlbar-ai-enabled";
+ static URLBAR_AI_HIDE_SUGGESTIONS = "extension.browse-bot.urlbar-ai.hide-suggestions";
+ static URLBAR_AI_ANIMATIONS_ENABLED = "extension.browse-bot.urlbar-ai.animations-enabled";
static SOLID_BG = "extension.browse-bot.solid-bg";
@@ -176,7 +184,11 @@ class BrowseBotPREFS extends PREFS$1 {
static defaultValues = {
[BrowseBotPREFS.ENABLED]: true,
+ [BrowseBotPREFS.URLBAR_AI_ENABLED]: true,
+ [BrowseBotPREFS.URLBAR_AI_HIDE_SUGGESTIONS]: true,
+ [BrowseBotPREFS.URLBAR_AI_ANIMATIONS_ENABLED]: true,
[BrowseBotPREFS.MINIMAL]: true,
+ [BrowseBotPREFS.AGENTIC_MODE]: false,
[BrowseBotPREFS.DEBUG_MODE]: false,
[BrowseBotPREFS.PERSIST]: false,
[BrowseBotPREFS.STREAM_ENABLED]: true,
@@ -207,8 +219,11 @@ class BrowseBotPREFS extends PREFS$1 {
[BrowseBotPREFS.POSITION]: "top-right",
[BrowseBotPREFS.REMEMBER_DIMENSIONS]: true,
[BrowseBotPREFS.WIDTH]: 500,
+ [BrowseBotPREFS.MAX_TOOL_CALLS]: 5,
+ [BrowseBotPREFS.CONFORMATION]: true,
[BrowseBotPREFS.BACKGROUND_STYLE]: "solid",
[BrowseBotPREFS.SHORTCUT_FINDBAR]: "ctrl+shift+f",
+ [BrowseBotPREFS.SHORTCUT_URLBAR]: "ctrl+space",
[BrowseBotPREFS.CUSTOM_SYSTEM_PROMPT]: "",
[BrowseBotPREFS.LLM_TEMPERATURE]: 0.7,
[BrowseBotPREFS.LLM_TOP_P]: 1.0,
@@ -231,7 +246,11 @@ class BrowseBotPREFS extends PREFS$1 {
"extension.browse-bot.dnd-enabled": this.DND_ENABLED,
"extension.browse-bot.position": this.POSITION,
"extension.browse-bot.stream-enabled": this.STREAM_ENABLED,
+ "extension.browse-bot.god-mode": this.AGENTIC_MODE,
+ "extension.browse-bot.findbar-god-mode": this.AGENTIC_MODE,
"extension.browse-bot.citations-enabled": this.CITATIONS_ENABLED,
+ "extension.browse-bot.max-tool-calls": this.MAX_TOOL_CALLS,
+ "extension.browse-bot.conform-before-tool-call": this.CONFORMATION,
"extension.browse-bot.context-menu-enabled": this.CONTEXT_MENU_ENABLED,
"extension.browse-bot.context-menu-autosend": this.CONTEXT_MENU_AUTOSEND,
};
@@ -275,6 +294,14 @@ class BrowseBotPREFS extends PREFS$1 {
this.setPref(this.STREAM_ENABLED, value);
}
+ static set agenticMode(value) {
+ this.setPref(this.AGENTIC_MODE, value);
+ }
+
+ static get agenticMode() {
+ return this.getPref(this.AGENTIC_MODE);
+ }
+
static get citationsEnabled() {
return this.getPref(this.CITATIONS_ENABLED);
}
@@ -339,6 +366,14 @@ class BrowseBotPREFS extends PREFS$1 {
return this.backgroundStyle === "pseudo";
}
+ static get maxToolCalls() {
+ return this.getPref(this.MAX_TOOL_CALLS);
+ }
+
+ static set maxToolCalls(value) {
+ this.setPref(this.MAX_TOOL_CALLS, value);
+ }
+
// static get copyBtnEnabled() {
// return this.getPref(this.COPY_BTN_ENABLED);
// }
@@ -355,6 +390,14 @@ class BrowseBotPREFS extends PREFS$1 {
// this.setPref(this.MARKDOWN_ENABLED, value);
// }
+ static get conformation() {
+ return this.getPref(this.CONFORMATION);
+ }
+
+ static set conformation(value) {
+ this.setPref(this.CONFORMATION, value);
+ }
+
// static get showToolCall() {
// return this.getPref(this.SHOW_TOOL_CALL);
// }
@@ -459,6 +502,14 @@ class BrowseBotPREFS extends PREFS$1 {
this.setPref(this.SHORTCUT_FINDBAR, value);
}
+ static get shortcutUrlbar() {
+ return this.getPref(this.SHORTCUT_URLBAR);
+ }
+
+ static set shortcutUrlbar(value) {
+ this.setPref(this.SHORTCUT_URLBAR, value);
+ }
+
static get customSystemPrompt() {
return this.getPref(this.CUSTOM_SYSTEM_PROMPT);
}
@@ -478,6 +529,15 @@ async function frameScript() {
};
};
+ const extractRelevantContent = () => {
+ const clonedBody = content.document.body.cloneNode(true);
+ const elementsToRemove = clonedBody.querySelectorAll(
+ "script, style, meta, noscript, iframe, svg, canvas, img, video, audio, object, embed, applet, link, head"
+ );
+ elementsToRemove.forEach((el) => el.remove());
+ return clonedBody.innerHTML;
+ };
+
const extractTextContent = (trimWhiteSpace = true) => {
const clonedBody = content.document.body.cloneNode(true);
const elementsToRemove = clonedBody.querySelectorAll(
@@ -508,7 +568,111 @@ async function frameScript() {
.trim();
};
+ async function getYouTubeTranscript() {
+ const win = content;
+ const doc = content.document;
+
+ async function ensureBodyAvailable() {
+ if (doc.body) return;
+ await new Promise((resolve) => {
+ const check = () => {
+ if (doc.body) resolve();
+ else win.setTimeout(check, 50);
+ };
+ check();
+ });
+ }
+
+ function waitForSelectorWithObserver(selector, timeout = 5000) {
+ return new Promise((resolve, reject) => {
+ ensureBodyAvailable()
+ .then(() => {
+ const el = doc.querySelector(selector);
+ if (el) return resolve(el);
+
+ const observer = new win.MutationObserver(() => {
+ const el = doc.querySelector(selector);
+ if (el) {
+ observer.disconnect();
+ resolve(el);
+ }
+ });
+
+ observer.observe(doc.body, {
+ childList: true,
+ subtree: true,
+ });
+
+ win.setTimeout(() => {
+ observer.disconnect();
+ reject(new Error(`Timeout waiting for ${selector}`));
+ }, timeout);
+ })
+ .catch((e) => {
+ reject(new Error(`waitForSelectorWithObserver failed: ${e.message}`));
+ });
+ });
+ }
+
+ if (!doc.querySelector("ytd-transcript-renderer")) {
+ const button = doc.querySelector('button[aria-label="Show transcript"]');
+ if (!button)
+ throw new Error('"Show transcript" button not found โ transcript may not be available.');
+ button.click();
+ await waitForSelectorWithObserver("ytd-transcript-renderer", 5000);
+ }
+
+ await waitForSelectorWithObserver("ytd-transcript-segment-renderer .segment-text", 5000);
+
+ const segments = Array.from(
+ doc.querySelectorAll("ytd-transcript-segment-renderer .segment-text")
+ );
+ if (!segments.length) throw new Error("Transcript segments found, but all are empty.");
+
+ const transcript = segments
+ .map((el) => el.textContent.trim())
+ .filter(Boolean)
+ .join("\n");
+ return transcript;
+ }
+
+ const getYoutubeDescription = async () => {
+ const descriptionContainer = content.document.querySelector("#description-inline-expander");
+ if (descriptionContainer) {
+ const expandButton =
+ descriptionContainer.querySelector("#expand") ||
+ descriptionContainer.querySelector("#expand-button") ||
+ descriptionContainer.querySelector("tp-yt-paper-button#more");
+ // Check if button is visible, as it's hidden when expanded
+ if (expandButton && expandButton.offsetParent !== null) {
+ expandButton.click();
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ }
+ }
+
+ const desc = content.document.querySelector(
+ "#description-inline-expander .yt-core-attributed-string, #description .content, .ytd-expandable-video-description-body-renderer .yt-core-attributed-string"
+ );
+ return desc ? desc.textContent.trim() : "Description not found.";
+ };
+
+ const getYoutubeComments = (count = 10) => {
+ const comments = Array.from(
+ content.document.querySelectorAll("ytd-comment-thread-renderer #content-text")
+ ).slice(0, count);
+ if (comments.length === 0) return ["No comments found or they are not loaded yet."];
+ return comments.map((c) => c.textContent.trim());
+ };
+
const handlers = {
+ GetPageHTMLContent: () => {
+ return {
+ content: extractRelevantContent(),
+ url: getUrlAndTitle().url,
+ title: getUrlAndTitle().title,
+ };
+ },
+
GetSelectedText: () => {
const selection = content.getSelection();
return {
@@ -524,6 +688,41 @@ async function frameScript() {
...getUrlAndTitle(),
};
},
+
+ ClickElement: ({ selector }) => {
+ const element = content.document.querySelector(selector);
+ if (!element) {
+ throw new Error(`Element with selector "${selector}" not found.`);
+ }
+ element.click();
+ return { result: `Clicked element with selector "${selector}".` };
+ },
+
+ FillForm: ({ selector, value }) => {
+ const element = content.document.querySelector(selector);
+ if (!element) {
+ throw new Error(`Element with selector "${selector}" not found.`);
+ }
+ element.value = value;
+ element.dispatchEvent(new Event("input", { bubbles: true }));
+ return {
+ result: `Filled element with selector "${selector}" with value "${value}".`,
+ };
+ },
+
+ GetYoutubeTranscript: async () => {
+ const transcript = await getYouTubeTranscript();
+ return { transcript };
+ },
+
+ GetYoutubeDescription: async () => {
+ const description = await getYoutubeDescription();
+ return { description };
+ },
+
+ GetYoutubeComments: ({ count }) => {
+ return { comments: getYoutubeComments(count) };
+ },
};
addMessageListener("FindbarAI:Command", async function (msg) {
@@ -588,6 +787,13 @@ const messageManagerAPI = {
};
},
+ async getHTMLContent() {
+ return this.send("GetPageHTMLContent").catch((error) => {
+ PREFS.debugError("Failed to get page HTML content:", error);
+ return {};
+ });
+ },
+
async getSelectedText() {
return this.send("GetSelectedText")
.then((result) => {
@@ -608,6 +814,41 @@ const messageManagerAPI = {
return this.getUrlAndTitle();
});
},
+
+ async clickElement(selector) {
+ return this.send("ClickElement", { selector }).catch((error) => {
+ PREFS.debugError(`Failed to click element with selector "${selector}":`, error);
+ return { error: `Failed to click element with selector "${selector}".` };
+ });
+ },
+
+ async fillForm(selector, value) {
+ return this.send("FillForm", { selector, value }).catch((error) => {
+ PREFS.debugError(`Failed to fill form with selector "${selector}":`, error);
+ return { error: `Failed to fill form with selector "${selector}".` };
+ });
+ },
+
+ async getYoutubeTranscript() {
+ return this.send("GetYoutubeTranscript").catch((error) => {
+ PREFS.debugError("Failed to get youtube transcript:", error);
+ return { error: `Failed to get youtube transcript: ${error.message}` };
+ });
+ },
+
+ async getYoutubeDescription() {
+ return this.send("GetYoutubeDescription").catch((error) => {
+ PREFS.debugError("Failed to get youtube description:", error);
+ return { error: `Failed to get youtube description: ${error.message}` };
+ });
+ },
+
+ async getYoutubeComments(count) {
+ return this.send("GetYoutubeComments", { count }).catch((error) => {
+ PREFS.debugError("Failed to get youtube comments:", error);
+ return { error: `Failed to get youtube comments: ${error.message}` };
+ });
+ },
};
const parseElement = (elementString, type = "html") => {
@@ -1231,35 +1472,63 @@ const SettingsModal = {
findbarResetPrefs
);
- // Section 2: Keyboard Shortcuts
+ // Section 2: URLBar AI
+ const urlbarSettings = [
+ { label: "Enable URLBar AI", pref: PREFS.URLBAR_AI_ENABLED },
+ { label: "Enable Animations", pref: PREFS.URLBAR_AI_ANIMATIONS_ENABLED },
+ { label: "Hide Suggestions", pref: PREFS.URLBAR_AI_HIDE_SUGGESTIONS },
+ ];
+ const urlbarSectionHtml = this._createCheckboxSectionHtml(
+ "URLBar AI",
+ urlbarSettings,
+ false,
+ "",
+ "",
+ urlbarSettings.map((s) => s.pref)
+ );
+
+ // Section 3: Keyboard Shortcuts
const shortcutFindbarHtml = this._generateShortcutInputHtml(
PREFS.SHORTCUT_FINDBAR,
"Open Findbar AI"
);
+ const shortcutUrlbarHtml = this._generateShortcutInputHtml(
+ PREFS.SHORTCUT_URLBAR,
+ "Toggle URLBar AI"
+ );
const shortcutsSectionHtml = `