theseus/bundled-addons/notepad/addon.json

15 lines
392 B
JSON
Raw Normal View History

Theseus: add-on framework MVP + Notepad reference add-on New subsystem for extending Theseus with folders on disk. Each add-on lives at <userData>/addons/<id>/ with an addon.json manifest and a CommonJS entry that exports activate(api). Nothing about a private add-on ships in the public installer - drop the folder, restart, it's live. Bundled reference add-ons ride in the packaged app under resources/bundled-addons/ and are seeded into <userData>/addons/ on first boot; the framework treats seeded and drop-in add-ons the same. Files: - addons-host.js Loader + api.registerSidebarPanel() + per- addon storage on <userData>/addons-data/. Kept at the CommonJS-scoped top level (lib/ is ESM-scoped via its own package.json). - sidebar-preload.js Runs in every sidebar panel. Exposes window.silentmode.storage.{get,set,all} + onVisibility. Main-side handlers derive the add-on id from the sender file:// URL, so a panel can only touch its own store. - bundled-addons/notepad/ Reference add-on: addon.json, index.js, note.html. Autosaving textarea with char / word count. main.js: - Extension point: sidebar-panel. One right-anchored WebContentsView (SIDEBAR_W=340) hosts the current panel; layout() shrinks the tab views by the sidebar width when visible. First registered panel wins for MVP; picker for multiple panels lands later. - initAddons() at app.whenReady(): seedBundledAddons, then AddonHost.discoverAndActivate. - IPC surface: sidebar-toggle / sidebar-open / sidebar-close / sidebar-state, addons-list / addons-set-enabled / addons-reveal / addons-open-dir / addons-reload, and origin-gated addon-storage-get/set/all. - Settings gains `disabledAddons: []` — off-toggled ids persist and the loader honours them without a restart (discoverAndActivate runs again on toggle). chrome.html: toolbar sidebar-toggle button, hidden until at least one add-on has registered a sidebar panel. settings.html: new "Add-ons" section under privacy. Lists installed add-ons with icon / name / version / description / capabilities; per-add-on enable/disable toggle + Show folder button; page-level Reload and Open add-ons folder buttons; warning note about the trust model. package.json: build.files gains sidebar-preload.js + addons-host.js. extraResources gains bundled-addons/ so the packaged app carries the reference notepad for the first-boot seed. Verified: `npm start` boots, addons-host discovers the notepad, activates it, registers one sidebar panel. Log confirms "1 installed, 1 enabled, 1 sidebar panels". Actual sidebar rendering + notepad UI need clicked-through validation on a real install. Not shipped yet - deploy still blocked on the fail2ban VPS SSH ban. Ships as 0.2.0 once SSH clears (this is a new subsystem, not a fix).
2026-08-31 13:51:08 +02:00
{
"id": "notepad",
"name": "Notepad",
"version": "0.1.0",
"description": "Right-sidebar notes. Text lives on this machine only, autosaves as you type.",
"author": "Silent Mode",
"icon": "📝",
"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": "Notepad", "icon": "📝", "page": "note.html" }
],
Theseus: add-on framework MVP + Notepad reference add-on New subsystem for extending Theseus with folders on disk. Each add-on lives at <userData>/addons/<id>/ with an addon.json manifest and a CommonJS entry that exports activate(api). Nothing about a private add-on ships in the public installer - drop the folder, restart, it's live. Bundled reference add-ons ride in the packaged app under resources/bundled-addons/ and are seeded into <userData>/addons/ on first boot; the framework treats seeded and drop-in add-ons the same. Files: - addons-host.js Loader + api.registerSidebarPanel() + per- addon storage on <userData>/addons-data/. Kept at the CommonJS-scoped top level (lib/ is ESM-scoped via its own package.json). - sidebar-preload.js Runs in every sidebar panel. Exposes window.silentmode.storage.{get,set,all} + onVisibility. Main-side handlers derive the add-on id from the sender file:// URL, so a panel can only touch its own store. - bundled-addons/notepad/ Reference add-on: addon.json, index.js, note.html. Autosaving textarea with char / word count. main.js: - Extension point: sidebar-panel. One right-anchored WebContentsView (SIDEBAR_W=340) hosts the current panel; layout() shrinks the tab views by the sidebar width when visible. First registered panel wins for MVP; picker for multiple panels lands later. - initAddons() at app.whenReady(): seedBundledAddons, then AddonHost.discoverAndActivate. - IPC surface: sidebar-toggle / sidebar-open / sidebar-close / sidebar-state, addons-list / addons-set-enabled / addons-reveal / addons-open-dir / addons-reload, and origin-gated addon-storage-get/set/all. - Settings gains `disabledAddons: []` — off-toggled ids persist and the loader honours them without a restart (discoverAndActivate runs again on toggle). chrome.html: toolbar sidebar-toggle button, hidden until at least one add-on has registered a sidebar panel. settings.html: new "Add-ons" section under privacy. Lists installed add-ons with icon / name / version / description / capabilities; per-add-on enable/disable toggle + Show folder button; page-level Reload and Open add-ons folder buttons; warning note about the trust model. package.json: build.files gains sidebar-preload.js + addons-host.js. extraResources gains bundled-addons/ so the packaged app carries the reference notepad for the first-boot seed. Verified: `npm start` boots, addons-host discovers the notepad, activates it, registers one sidebar panel. Log confirms "1 installed, 1 enabled, 1 sidebar panels". Actual sidebar rendering + notepad UI need clicked-through validation on a real install. Not shipped yet - deploy still blocked on the fail2ban VPS SSH ban. Ships as 0.2.0 once SSH clears (this is a new subsystem, not a fix).
2026-08-31 13:51:08 +02:00
"capabilities": ["sidebar-panel"]
}