theseus/bundled-addons/translate/addon.json

27 lines
1.6 KiB
JSON
Raw Normal View History

feat(theseus/translate): new sidebar add-on — right-click Translate selection Adds a bundled add-on `translate` with a sidebar panel + a right-click "Translate selection" menu item. Two swappable backends: - LibreTranslate (default) — free MIT engine; the panel's Settings tab lets the user point at any instance (public or self-hosted) and drop in an API key if one's required. - Google (unofficial free endpoint at translate.googleapis.com/ translate_a/single) — no key, wide coverage, but unofficial and Google can break it any time. Opt-in fallback. Flow: user selects text on a page, right-clicks -> "Translate selection". Add-on's context-menu handler stashes the selection under storage.__pending and calls api.revealSidebar("main"); the panel loads, drains __pending on first paint, and translates. Ctrl/Cmd+Enter in the input textarea also translates. Source + target language choices, browser-language default target, swap button, copy-to- clipboard on the output, settings gear. Depends on a new "context-menu-item" capability + api.revealSidebar hook in addons-host.js / main.js. Those wiring changes are prepared but not committed here — a parallel session is refactoring the same functions concurrently, so the safe path is to land translate/ first and let the wiring go in alongside the next host-facing commit. Until the wiring lands, the manifest's "context-menu-item" cap is silently dropped (per validateManifest's unknown-caps policy) and the sidebar panel + the panel's translation UI still work standalone — the right-click entry point is what's gated.
2026-09-20 17:50:06 +02:00
{
"id": "translate",
"name": "Translate",
translate 0.1.5 → 0.1.6: name the detected language in the source select Auto-detect already worked — the backend returns detectedLanguage:{language,confidence} and the panel put it in the status line. But that only appeared after a translation had already run, in small text, away from the control that raised the question. You could not tell what "Auto-detect" had decided before committing to it. The first row of the source select now says "Auto-detect · German", and it says so while you are still typing. Detection runs on its own via LibreTranslate's /detect, debounced 700 ms and gated at 12 characters, because a detector given two words is guessing and firing per keystroke would pound a public mirror for nothing. It chains the same mirror fallback as translation, so a dead primary does not make detection look broken while translating still works. Confidence below 60 renders as "German?" rather than silently asserting a coin-flip. The Google backend has no detect-only route, so there doDetect returns null instead of burning a request, and the label is filled from the translation response — which every backend returns anyway, so a skipped or failed detect is never worse than before. Detection retires when a source is named explicitly, comes back on returning to Auto-detect, and is wiped by clear. A right-click selection schedules one too, since that text arrives with no keystroke. Verified against the real mirror (de/fr/ja at 100/100/90%) and in the harness: short text fires nothing, long text fires once, four rapid edits debounce to one call, and every transition above lands. Also adds the xray removal script used to take the old engine off all three exits now that they run sing-box.
2026-09-28 21:50:00 +02:00
"version": "0.1.6",
feat(theseus/translate): new sidebar add-on — right-click Translate selection Adds a bundled add-on `translate` with a sidebar panel + a right-click "Translate selection" menu item. Two swappable backends: - LibreTranslate (default) — free MIT engine; the panel's Settings tab lets the user point at any instance (public or self-hosted) and drop in an API key if one's required. - Google (unofficial free endpoint at translate.googleapis.com/ translate_a/single) — no key, wide coverage, but unofficial and Google can break it any time. Opt-in fallback. Flow: user selects text on a page, right-clicks -> "Translate selection". Add-on's context-menu handler stashes the selection under storage.__pending and calls api.revealSidebar("main"); the panel loads, drains __pending on first paint, and translates. Ctrl/Cmd+Enter in the input textarea also translates. Source + target language choices, browser-language default target, swap button, copy-to- clipboard on the output, settings gear. Depends on a new "context-menu-item" capability + api.revealSidebar hook in addons-host.js / main.js. Those wiring changes are prepared but not committed here — a parallel session is refactoring the same functions concurrently, so the safe path is to land translate/ first and let the wiring go in alongside the next host-facing commit. Until the wiring lands, the manifest's "context-menu-item" cap is silently dropped (per validateManifest's unknown-caps policy) and the sidebar panel + the panel's translation UI still work standalone — the right-click entry point is what's gated.
2026-09-20 17:50:06 +02:00
"description": "Right-click a selection to translate it. Sidebar panel with LibreTranslate or Google as the backend.",
"author": "Silent Mode",
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij4gPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTEuNSIgZmlsbD0iIzFkNGVkOCIvPiA8cmVjdCB4PSIwIiB5PSIwLjYiIHdpZHRoPSIxMy40IiBoZWlnaHQ9IjEzLjQiIHJ4PSIyLjgiIGZpbGw9IiNmZmYiLz4gPHRleHQgeD0iNi43IiB5PSIxMi4xIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0ic3lzdGVtLXVpLFNlZ29lIFVJLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTIuNCIgZm9udC13ZWlnaHQ9IjgwMCIgZmlsbD0iIzFkNGVkOCI+QTwvdGV4dD4gPHJlY3QgeD0iMTAuNiIgeT0iMTAiIHdpZHRoPSIxMy40IiBoZWlnaHQ9IjEzLjQiIHJ4PSIyLjgiIGZpbGw9IiMwYjEyMjAiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjEiLz4gPGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIuMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBmaWxsPSJub25lIj4gPHBhdGggZD0iTTE3LjMgMTIuMnYxLjEiLz4gPHBhdGggZD0iTTEzLjUgMTQuNmg3LjYiLz4gPHBhdGggZD0iTTE4LjIgMTUuNyAxMy45IDIxIi8+IDxwYXRoIGQ9Ik0xNi41IDE1LjcgMjAuOCAyMSIvPiA8L2c+IDwvc3ZnPg==",
feat(theseus/translate): new sidebar add-on — right-click Translate selection Adds a bundled add-on `translate` with a sidebar panel + a right-click "Translate selection" menu item. Two swappable backends: - LibreTranslate (default) — free MIT engine; the panel's Settings tab lets the user point at any instance (public or self-hosted) and drop in an API key if one's required. - Google (unofficial free endpoint at translate.googleapis.com/ translate_a/single) — no key, wide coverage, but unofficial and Google can break it any time. Opt-in fallback. Flow: user selects text on a page, right-clicks -> "Translate selection". Add-on's context-menu handler stashes the selection under storage.__pending and calls api.revealSidebar("main"); the panel loads, drains __pending on first paint, and translates. Ctrl/Cmd+Enter in the input textarea also translates. Source + target language choices, browser-language default target, swap button, copy-to- clipboard on the output, settings gear. Depends on a new "context-menu-item" capability + api.revealSidebar hook in addons-host.js / main.js. Those wiring changes are prepared but not committed here — a parallel session is refactoring the same functions concurrently, so the safe path is to land translate/ first and let the wiring go in alongside the next host-facing commit. Until the wiring lands, the manifest's "context-menu-item" cap is silently dropped (per validateManifest's unknown-caps policy) and the sidebar panel + the panel's translation UI still work standalone — the right-click entry point is what's gated.
2026-09-20 17:50:06 +02:00
"main": "index.js",
Theseus: start extensions on first use, Startup switches in Settings Every enabled add-on used to be activated synchronously in initAddons(), during app.whenReady and before the window exists. That is the largest launch cost left (boot tracer, 2026-10-03). An add-on can now say "activation": "on-demand" in addon.json. It is then listed at launch but not started. Its declared surfaces stay live: "panels" (new: sidebar panels declared up front), toolbar-menu, context-menu-items and the page-inject bridge, whose source is read on the first matching page. activate() runs on first real use: a panel opened, a menu or context item picked, a message from its panel, tab or page bridge, a Settings addon-invoke, a wiz:// link (for Aegis). All of those go through AddonHost.dispatch(), which starts the add-on and waits for it, so no call is dropped. Concurrent callers share one activation, and activations run one at a time. Startup stays the default: the host cannot tell what an older add-on does in activate(). request-filter add-ons and add-ons that declare no surface are forced to startup. If activate() returns a promise, calls wait for it (at most 5 s). api.startAtLaunch(bool) lets an on-demand add-on ask to be started at launch again (for live relay sessions). Converted: notepad, screenshot, translate, docx-editor, pdf-editor, vpn (none has launch-time work: no file association, no auto-connect, and add-on file tabs are not part of the saved session). Shield and Cookie Pop-ups stay startup: Shield owns the request filter and must see the first request; Cookie Pop-ups costs ~6 ms and acts unasked on every page. Aegis stays startup and untouched: another session owns it. See NOTE-aegis-on-demand.md (next commit). Settings › Performance › Startup: - "Start extensions when first used" (default on). Off = all at launch; switching it off starts the waiting add-ons immediately. - "Start the wallet at launch". Shown disabled with a hint until the installed Aegis manifest allows on-demand. It applies with no Settings change once Aegis opts in. - "Preload common menus" gates prewarmOverlays(). - "Use lightest" preset. New keys are plain SETTINGS_DEFAULTS through the existing settings-set. No new IPC channels. Measured: boot-trace, fresh profile, --seconds 20 so the 30 s add-on OTA poll can't swap Aegis mid-series; warm runs 2-3 of two paired series. - Add-on activation at launch: 121-154 ms -> 104-174 ms. The six converted add-ons went from 16-20 ms to 0. The rest is Shield (83-148 ms, noisy) and Aegis (15 ms in this tree's 0.9.0). - Toolbar painted: 1278-1584 ms -> 1282-1481 ms (within noise). - With "Preload common menus" off: 0 overlays prewarmed, 8 processes instead of 11, about 50-70 MB less at 15 s. The bundled add-on versions are not bumped. Existing profiles keep their old addon.json, and so stay on startup activation, until those add-ons ship with a higher version (seedBundledAddons only reseeds a strictly newer bundle).
2026-10-03 16:05:32 +02:00
"activation": "on-demand",
"panels": [
{ "id": "main", "title": "Translate", "page": "panel.html" }
],
translate 0.1.2 → 0.1.3: real icon, bigger text, zoom, auto-translate on language change Auto-translate: changing either language only called saveUi(), so the pane below kept showing the previous language's result with nothing to say it was stale — you had to notice and press Translate. Both selects now re-run the translation, guarded on empty input and on source === target (which would only echo the input back). Text size: the panes were 13.5px, small for reading a paragraph in a language you don't know well, which is the entire job. Base is now 15px, driven by a --tsize custom property so both panes stay matched. Zoom: −/+ either side of a percentage in the header, 70–220% in steps of 10, clamped with the buttons disabling at each end. Click the percentage to reset. Ctrl/Cmd with +, - or 0 does the same from either pane. Persists per-machine alongside the language choice. Icon: a globe with an A tile and a 文 tile, replacing the 🌐 emoji that was indistinguishable from every other globe in the dock. Drawn against the 16px and 18px rasterizations rather than at a comfortable size — the first pass used a font glyph for 文 and it turned to grey mush at 16px, so the strokes are hand-drawn paths thick enough to survive. Also drops the hardcoded icon in registerSidebarPanel, which would otherwise shadow the manifest's mark. Verified in a harness with a stubbed host API: language change fires exactly one request, the two guards fire none, zoom clamps and persists, and the layout holds at sidebar width.
2026-09-27 18:00:46 +02:00
"capabilities": [
"sidebar-panel",
"context-menu-item"
],
feat(theseus/translate): new sidebar add-on — right-click Translate selection Adds a bundled add-on `translate` with a sidebar panel + a right-click "Translate selection" menu item. Two swappable backends: - LibreTranslate (default) — free MIT engine; the panel's Settings tab lets the user point at any instance (public or self-hosted) and drop in an API key if one's required. - Google (unofficial free endpoint at translate.googleapis.com/ translate_a/single) — no key, wide coverage, but unofficial and Google can break it any time. Opt-in fallback. Flow: user selects text on a page, right-clicks -> "Translate selection". Add-on's context-menu handler stashes the selection under storage.__pending and calls api.revealSidebar("main"); the panel loads, drains __pending on first paint, and translates. Ctrl/Cmd+Enter in the input textarea also translates. Source + target language choices, browser-language default target, swap button, copy-to- clipboard on the output, settings gear. Depends on a new "context-menu-item" capability + api.revealSidebar hook in addons-host.js / main.js. Those wiring changes are prepared but not committed here — a parallel session is refactoring the same functions concurrently, so the safe path is to land translate/ first and let the wiring go in alongside the next host-facing commit. Until the wiring lands, the manifest's "context-menu-item" cap is silently dropped (per validateManifest's unknown-caps policy) and the sidebar panel + the panel's translation UI still work standalone — the right-click entry point is what's gated.
2026-09-20 17:50:06 +02:00
"context-menu-items": [
{
"id": "translate-selection",
"label": "Translate selection",
"when": "selectionText",
"icon": "🌐"
}
],
"updateURL": "https://navigate.st/bns/theseus.x/extensions/translate/updates.json"
}