diff --git a/chrome-extension/package.json b/chrome-extension/package.json index 17a23808..1bb62d3d 100755 --- a/chrome-extension/package.json +++ b/chrome-extension/package.json @@ -1,6 +1,6 @@ { "name": "chrome-extension", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - core settings", "type": "module", "private": true, diff --git a/chrome-extension/public/pyodide/package.json b/chrome-extension/public/pyodide/package.json index 09c7b727..f8995f47 100755 --- a/chrome-extension/public/pyodide/package.json +++ b/chrome-extension/public/pyodide/package.json @@ -1,6 +1,6 @@ { "name": "pyodide", - "version": "0.27.1571", + "version": "0.27.1572", "description": "The Pyodide JavaScript package", "keywords": [ "python", diff --git a/chrome-extension/src/background/index.ts b/chrome-extension/src/background/index.ts index 524f70e8..91a572ed 100755 --- a/chrome-extension/src/background/index.ts +++ b/chrome-extension/src/background/index.ts @@ -27,6 +27,21 @@ interface ExtensionMessage { [key: string]: any; } +/** + * Response for GET_ACTIVE_TAB_INFO and GET_ACTIVE_TAB_URL messages + * Contains information about the active tab including its URL and unique identifier + */ +interface ActiveTabInfo { + /** The URL of the active tab, or 'about:blank' if unavailable */ + url: string; + /** The numeric ID of the active tab, or -1 if unavailable */ + tabId: number; + /** Timestamp when the info was retrieved */ + timestamp: number; + /** Error message if the tab info could not be retrieved */ + error?: string; +} + console.log('[background] Starting Offscreen Document integration - REFACTORED BACKGROUND ARCHITECTURE'); // Функция для отправки обновлений чата плагина @@ -3072,6 +3087,77 @@ async function handleMessage(message: any, sender: any): Promise { } } + // Обработка GET_ACTIVE_TAB_INFO и GET_ACTIVE_TAB_URL сообщений (поддержка обоих для совместимости) + if (message.type === 'GET_ACTIVE_TAB_INFO' || message.type === 'GET_ACTIVE_TAB_URL') { + console.log(`[background][PORT][GET_ACTIVE_TAB_INFO] Processing ${message.type} request`); + + try { + // Запрашиваем активную вкладку в текущем окне + const tabs = await chrome.tabs.query({ active: true, currentWindow: true }); + + // Логируем результат запроса + if (!tabs || tabs.length === 0) { + console.warn('[background][PORT][GET_ACTIVE_TAB_INFO] ⚠️ No active tab found by query'); + // Возвращаем разумные значения по умолчанию + return { + url: 'about:blank', + tabId: -1, + timestamp: Date.now() + }; + } + + const activeTab = tabs[0]; + + if (!activeTab) { + console.warn('[background][PORT][GET_ACTIVE_TAB_INFO] ⚠️ Active tab is null or undefined'); + return { + url: 'about:blank', + tabId: -1, + timestamp: Date.now() + }; + } + + if (!activeTab.id) { + console.warn('[background][PORT][GET_ACTIVE_TAB_INFO] ⚠️ Active tab has no ID'); + return { + url: activeTab.url || 'about:blank', + tabId: -1, + timestamp: Date.now() + }; + } + + const tabInfo = { + url: activeTab.url || 'about:blank', + tabId: activeTab.id, + timestamp: Date.now() + }; + + console.log('[background][PORT][GET_ACTIVE_TAB_INFO] ✅ Successfully retrieved active tab info:', { + tabId: tabInfo.tabId, + urlLength: tabInfo.url.length, + hasUrl: !!activeTab.url + }); + + return tabInfo; + + } catch (error: unknown) { + console.error('[background][PORT][GET_ACTIVE_TAB_INFO] ❌ Error retrieving active tab info:', error); + console.error('[background][PORT][GET_ACTIVE_TAB_INFO] Error details:', { + message: (error as Error).message, + stack: (error as Error).stack, + timestamp: new Date().toISOString() + }); + + // Возвращаем разумные значения по умолчанию при ошибке + return { + url: 'about:blank', + tabId: -1, + error: (error as Error).message, + timestamp: Date.now() + }; + } + } + // Обработка HOST API сообщений if (message.command) { // Используем существующую функцию handleHostApiMessage, но адаптируем для возврата результата diff --git a/chrome-extension/src/background/package.json b/chrome-extension/src/background/package.json index c4526907..70bc16b9 100755 --- a/chrome-extension/src/background/package.json +++ b/chrome-extension/src/background/package.json @@ -1,6 +1,6 @@ { "name": "chrome-extension-background", - "version": "1.0.1021", + "version": "1.0.1022", "scripts": { "build": "webpack --mode=production", "dev": "webpack --mode=development --watch" diff --git a/package.json b/package.json index 6a066992..836c35ce 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agent-plugins-platform", - "version": "1.0.1546", + "version": "1.0.1547", "description": "Browser extension that enables Python plugin execution using Pyodide and MCP protocol", "license": "MIT", "private": true, diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 1f0668c3..6397259f 100755 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@extension/dev-utils", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - dev utils", "type": "module", "private": true, diff --git a/packages/env/package.json b/packages/env/package.json index 80564f5e..1b659fa0 100755 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@extension/env", - "version": "0.5.1551", + "version": "0.5.1552", "description": "chrome extension - environment variables", "type": "module", "private": true, diff --git a/packages/hmr/package.json b/packages/hmr/package.json index 718dd466..b14e050f 100755 --- a/packages/hmr/package.json +++ b/packages/hmr/package.json @@ -1,6 +1,6 @@ { "name": "@extension/hmr", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - hot module reload/refresh", "type": "module", "private": true, diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 8593d442..3a25d8d9 100755 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@extension/i18n", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - internationalization", "type": "module", "private": true, diff --git a/packages/module-manager/package.json b/packages/module-manager/package.json index 037267ee..1406471d 100755 --- a/packages/module-manager/package.json +++ b/packages/module-manager/package.json @@ -1,6 +1,6 @@ { "name": "@extension/module-manager", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - module manager", "type": "module", "private": true, diff --git a/packages/shared/package.json b/packages/shared/package.json index 386023b6..426010f2 100755 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@extension/shared", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - shared code", "type": "module", "private": true, diff --git a/packages/storage/package.json b/packages/storage/package.json index 2d835c6b..e22bbc55 100755 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,6 +1,6 @@ { "name": "@extension/storage", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - storage", "type": "module", "private": true, diff --git a/packages/tailwindcss-config/package.json b/packages/tailwindcss-config/package.json index ec157144..6b248621 100755 --- a/packages/tailwindcss-config/package.json +++ b/packages/tailwindcss-config/package.json @@ -1,6 +1,6 @@ { "name": "@extension/tailwindcss-config", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - tailwindcss configuration", "main": "tailwind.config.ts", "private": true, diff --git a/packages/tsconfig/package.json b/packages/tsconfig/package.json index f30e0c10..0856fe4a 100755 --- a/packages/tsconfig/package.json +++ b/packages/tsconfig/package.json @@ -1,6 +1,6 @@ { "name": "@extension/tsconfig", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - tsconfig", "private": true, "sideEffects": false diff --git a/packages/ui/package.json b/packages/ui/package.json index edcc669f..2978d8f8 100755 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@extension/ui", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - ui components", "type": "module", "private": true, diff --git a/packages/vite-config/package.json b/packages/vite-config/package.json index 8da7f9fd..d471fa51 100755 --- a/packages/vite-config/package.json +++ b/packages/vite-config/package.json @@ -1,6 +1,6 @@ { "name": "@extension/vite-config", - "version": "0.5.1572", + "version": "0.5.1573", "description": "chrome extension - vite base configuration", "type": "module", "private": true, diff --git a/packages/zipper/package.json b/packages/zipper/package.json index eeb61a52..dd2fa2d2 100755 --- a/packages/zipper/package.json +++ b/packages/zipper/package.json @@ -1,6 +1,6 @@ { "name": "@extension/zipper", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - zipper", "type": "module", "private": true, diff --git a/pages/content-runtime/package.json b/pages/content-runtime/package.json index 8ec5cfbd..fe7a49f5 100755 --- a/pages/content-runtime/package.json +++ b/pages/content-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@extension/content-runtime-script", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - content runtime script", "type": "module", "private": true, diff --git a/pages/content-ui/package.json b/pages/content-ui/package.json index f15a1e40..e0cde463 100755 --- a/pages/content-ui/package.json +++ b/pages/content-ui/package.json @@ -1,6 +1,6 @@ { "name": "@extension/content-ui", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - content ui", "type": "module", "private": true, diff --git a/pages/content/package.json b/pages/content/package.json index 2364cdb1..fcd6b29c 100755 --- a/pages/content/package.json +++ b/pages/content/package.json @@ -1,6 +1,6 @@ { "name": "@extension/content-script", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - content script", "type": "module", "private": true, diff --git a/pages/devtools/package.json b/pages/devtools/package.json index 2593921f..7d961b11 100755 --- a/pages/devtools/package.json +++ b/pages/devtools/package.json @@ -1,6 +1,6 @@ { "name": "@extension/devtools", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - devtools", "type": "module", "private": true, diff --git a/pages/new-tab/package.json b/pages/new-tab/package.json index ecc4af5b..bc803453 100755 --- a/pages/new-tab/package.json +++ b/pages/new-tab/package.json @@ -1,6 +1,6 @@ { "name": "@extension/new-tab", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - new tab", "type": "module", "private": true, diff --git a/pages/options/package.json b/pages/options/package.json index c525dd75..9002d32f 100755 --- a/pages/options/package.json +++ b/pages/options/package.json @@ -1,6 +1,6 @@ { "name": "@extension/options", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - options", "type": "module", "private": true, diff --git a/pages/side-panel/package.json b/pages/side-panel/package.json index aaf24f64..745ab131 100755 --- a/pages/side-panel/package.json +++ b/pages/side-panel/package.json @@ -1,6 +1,6 @@ { "name": "@extension/sidepanel", - "version": "0.5.1564", + "version": "0.5.1565", "description": "chrome extension - side panel", "type": "module", "private": true, diff --git a/platform-core/public/pyodide/package.json b/platform-core/public/pyodide/package.json index 0584a5d2..6a8c6e1f 100755 --- a/platform-core/public/pyodide/package.json +++ b/platform-core/public/pyodide/package.json @@ -1,6 +1,6 @@ { "name": "pyodide", - "version": "0.27.1569", + "version": "0.27.1570", "description": "The Pyodide JavaScript package", "keywords": [ "python", diff --git a/public/pyodide/package.json b/public/pyodide/package.json index 09c7b727..f8995f47 100755 --- a/public/pyodide/package.json +++ b/public/pyodide/package.json @@ -1,6 +1,6 @@ { "name": "pyodide", - "version": "0.27.1571", + "version": "0.27.1572", "description": "The Pyodide JavaScript package", "keywords": [ "python",