synabun 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +1 -1
- package/browser-extension/content.js +189 -0
- package/browser-extension/engine.js +508 -0
- package/browser-extension/icons/icon-128.png +0 -0
- package/browser-extension/icons/icon-16.png +0 -0
- package/browser-extension/icons/icon-32.png +0 -0
- package/browser-extension/icons/icon-48.png +0 -0
- package/browser-extension/icons/status-off-16.png +0 -0
- package/browser-extension/icons/status-off-32.png +0 -0
- package/browser-extension/icons/status-off-48.png +0 -0
- package/browser-extension/icons/status-on-16.png +0 -0
- package/browser-extension/icons/status-on-32.png +0 -0
- package/browser-extension/icons/status-on-48.png +0 -0
- package/browser-extension/manifest.json +56 -0
- package/browser-extension/popup-strings.js +250 -0
- package/browser-extension/popup-view.js +151 -0
- package/browser-extension/popup.css +166 -0
- package/browser-extension/popup.html +108 -0
- package/browser-extension/popup.js +359 -0
- package/browser-extension/protocol.js +232 -0
- package/browser-extension/service-worker.js +275 -0
- package/browser-extension/setup-content.js +36 -0
- package/browser-extension/tokens.css +326 -0
- package/docs/browser-extension-bridge.md +84 -0
- package/docs/whatsapp.md +1 -1
- package/lib/data-home-files.js +45 -0
- package/lib/data-home-migration.js +34 -58
- package/mcp-server/dist/http.d.ts +2 -0
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +9 -1
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts +11 -0
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +38 -3
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
- package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
- package/mcp-server/dist/services/browser-route-flow.js +10 -3
- package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
- package/mcp-server/dist/services/codex-config-heal.js +7 -0
- package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +95 -3
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +168 -23
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/team-context.d.ts +18 -0
- package/mcp-server/dist/services/team-context.d.ts.map +1 -0
- package/mcp-server/dist/services/team-context.js +29 -0
- package/mcp-server/dist/services/team-context.js.map +1 -0
- package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
- package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +22 -6
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-list.js +4 -0
- package/mcp-server/dist/services/tool-list.js.map +1 -1
- package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
- package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
- package/mcp-server/dist/services/tool-runtime.js +18 -1
- package/mcp-server/dist/services/tool-runtime.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
- package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
- package/mcp-server/dist/tools/agent-definition.js +483 -0
- package/mcp-server/dist/tools/agent-definition.js.map +1 -0
- package/mcp-server/dist/tools/agents.d.ts +92 -9
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +163 -20
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +70 -6
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/git-tools.d.ts +4 -2
- package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/git-tools.js +283 -2
- package/mcp-server/dist/tools/git-tools.js.map +1 -1
- package/mcp-server/dist/tools/morelogin.d.ts +8 -2
- package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
- package/mcp-server/dist/tools/morelogin.js +22 -5
- package/mcp-server/dist/tools/morelogin.js.map +1 -1
- package/mcp-server/dist/tools/team.d.ts +32 -0
- package/mcp-server/dist/tools/team.d.ts.map +1 -0
- package/mcp-server/dist/tools/team.js +87 -0
- package/mcp-server/dist/tools/team.js.map +1 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +9 -1
- package/mcp-server/src/index.ts +34 -4
- package/mcp-server/src/services/browser-route-flow.ts +12 -5
- package/mcp-server/src/services/codex-config-heal.ts +7 -0
- package/mcp-server/src/services/neural-interface.ts +191 -29
- package/mcp-server/src/services/team-context.ts +27 -0
- package/mcp-server/src/services/tool-catalog.ts +26 -8
- package/mcp-server/src/services/tool-list.ts +4 -0
- package/mcp-server/src/services/tool-runtime.ts +21 -2
- package/mcp-server/src/tools/agent-definition.ts +458 -0
- package/mcp-server/src/tools/agents.ts +177 -19
- package/mcp-server/src/tools/browser-advanced.ts +60 -6
- package/mcp-server/src/tools/git-tools.ts +249 -3
- package/mcp-server/src/tools/morelogin.ts +20 -5
- package/mcp-server/src/tools/team.ts +97 -0
- package/neural-interface/i18n/en.json +1119 -47
- package/neural-interface/i18n/pt-BR.json +1119 -47
- package/neural-interface/lib/account-usage.js +1 -1
- package/neural-interface/lib/agents/builtins.json +207 -0
- package/neural-interface/lib/agents/density.js +101 -0
- package/neural-interface/lib/agents/forge-host.js +223 -0
- package/neural-interface/lib/agents/native-export-targets.js +190 -0
- package/neural-interface/lib/agents/native-export.js +365 -0
- package/neural-interface/lib/agents/registry.js +885 -0
- package/neural-interface/lib/agents/resolve.js +603 -0
- package/neural-interface/lib/agents/schema.js +642 -0
- package/neural-interface/lib/agents/split.js +37 -0
- package/neural-interface/lib/agents-studio-api.js +591 -0
- package/neural-interface/lib/assistant-api.js +76 -7
- package/neural-interface/lib/assistant-brains/opencode.js +60 -11
- package/neural-interface/lib/assistant-catalog.js +2 -0
- package/neural-interface/lib/assistant-continuity.js +49 -0
- package/neural-interface/lib/assistant-dispatch.js +351 -121
- package/neural-interface/lib/assistant-persona.js +105 -8
- package/neural-interface/lib/assistant-route-gate.js +24 -9
- package/neural-interface/lib/assistant-router.js +432 -47
- package/neural-interface/lib/assistant-run-tail.js +151 -0
- package/neural-interface/lib/assistant-run-wait.js +183 -0
- package/neural-interface/lib/assistant-runtime.js +449 -94
- package/neural-interface/lib/assistant-task-prompt.js +11 -2
- package/neural-interface/lib/assistant-usage.js +3 -2
- package/neural-interface/lib/automation-approval.js +2 -2
- package/neural-interface/lib/backup-service.js +64 -105
- package/neural-interface/lib/browser-close-evidence.js +80 -0
- package/neural-interface/lib/browser-default.js +210 -0
- package/neural-interface/lib/browser-extension-adapter.js +264 -0
- package/neural-interface/lib/browser-extension-bridge.js +441 -0
- package/neural-interface/lib/browser-extension-folder.js +116 -0
- package/neural-interface/lib/browser-extension-setup.js +140 -0
- package/neural-interface/lib/browser-profile-choices.js +3 -3
- package/neural-interface/lib/browser-tool-policy.js +1 -1
- package/neural-interface/lib/claude-account-links.js +301 -0
- package/neural-interface/lib/claude-accounts.js +45 -20
- package/neural-interface/lib/claude-agent-bridge.js +142 -10
- package/neural-interface/lib/claude-model-catalog.js +6 -0
- package/neural-interface/lib/claude-panel-session.js +33 -0
- package/neural-interface/lib/codex-accounts.js +67 -24
- package/neural-interface/lib/coordination/README.md +384 -0
- package/neural-interface/lib/coordination/service.js +563 -0
- package/neural-interface/lib/coordination/store.js +1138 -0
- package/neural-interface/lib/db.js +22 -1
- package/neural-interface/lib/effort-levels.js +10 -1
- package/neural-interface/lib/memory-list-page.js +49 -0
- package/neural-interface/lib/memory-list-stamp.js +60 -0
- package/neural-interface/lib/morelogin-outside-close.js +186 -0
- package/neural-interface/lib/morelogin-profile-failures.js +206 -0
- package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
- package/neural-interface/lib/morelogin.js +194 -8
- package/neural-interface/lib/native-loop-runtime.js +26 -7
- package/neural-interface/lib/opencode-build-preflight.js +28 -8
- package/neural-interface/lib/opencode-native-boundary.js +83 -13
- package/neural-interface/lib/opencode-serve-records.js +14 -9
- package/neural-interface/lib/page-session.js +1 -1
- package/neural-interface/lib/peer-identity.js +73 -29
- package/neural-interface/lib/process-identity.js +68 -7
- package/neural-interface/lib/request-gate.js +3 -0
- package/neural-interface/lib/screenshot-location.js +33 -0
- package/neural-interface/lib/session-cache-builder.js +41 -3
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
- package/neural-interface/lib/studio-attention.js +56 -0
- package/neural-interface/lib/teams/README.md +382 -0
- package/neural-interface/lib/teams/api.js +287 -0
- package/neural-interface/lib/teams/brief.js +185 -0
- package/neural-interface/lib/teams/claims.js +315 -0
- package/neural-interface/lib/teams/git.js +293 -0
- package/neural-interface/lib/teams/index.js +122 -0
- package/neural-interface/lib/teams/integration.js +580 -0
- package/neural-interface/lib/teams/landing.js +184 -0
- package/neural-interface/lib/teams/recovery.js +256 -0
- package/neural-interface/lib/teams/scheduler.js +1474 -0
- package/neural-interface/lib/teams/schema.js +559 -0
- package/neural-interface/lib/teams/state.js +181 -0
- package/neural-interface/lib/teams/test-runner.js +86 -0
- package/neural-interface/lib/teams/test-sandbox.js +99 -0
- package/neural-interface/lib/teams/worktrees.js +757 -0
- package/neural-interface/lib/tool-permission-choices.js +226 -0
- package/neural-interface/lib/whatsapp/cards.js +24 -10
- package/neural-interface/lib/worker-confinement.js +206 -6
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +107 -0
- package/neural-interface/public/index.html +103 -12
- package/neural-interface/public/offline.html +4 -3
- package/neural-interface/public/shared/agent-runtime-options.js +3 -1
- package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
- package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
- package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
- package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
- package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
- package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
- package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
- package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
- package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
- package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
- package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
- package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
- package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
- package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
- package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
- package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
- package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
- package/neural-interface/public/shared/agy/agy-panel.js +142 -28
- package/neural-interface/public/shared/agy/agy-styles.js +25 -5
- package/neural-interface/public/shared/api.js +2 -1
- package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
- package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
- package/neural-interface/public/shared/assistant/asst-control.js +3 -0
- package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
- package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
- package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
- package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
- package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
- package/neural-interface/public/shared/assistant/asst-render.js +37 -6
- package/neural-interface/public/shared/assistant/asst-route.js +80 -12
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
- package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
- package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
- package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
- package/neural-interface/public/shared/assistant/asst-state.js +66 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
- package/neural-interface/public/shared/assistant/route-identity.js +16 -0
- package/neural-interface/public/shared/cc-dropdown.js +21 -15
- package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
- package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
- package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
- package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
- package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
- package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
- package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
- package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
- package/neural-interface/public/shared/code-copy.js +120 -0
- package/neural-interface/public/shared/constants.js +7 -0
- package/neural-interface/public/shared/context-menu-model.js +1 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
- package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
- package/neural-interface/public/shared/cp/cp-styles.js +9 -0
- package/neural-interface/public/shared/dom-change-flag.js +66 -0
- package/neural-interface/public/shared/dom-morph.js +124 -0
- package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
- package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
- package/neural-interface/public/shared/html-shell.js +34 -4
- package/neural-interface/public/shared/i18n.js +14 -1
- package/neural-interface/public/shared/idle-queue.js +78 -0
- package/neural-interface/public/shared/iface-config.js +227 -0
- package/neural-interface/public/shared/lazy-module.js +108 -0
- package/neural-interface/public/shared/memory-list.js +117 -0
- package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
- package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
- package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
- package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
- package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
- package/neural-interface/public/shared/owner-authority-view.js +4 -10
- package/neural-interface/public/shared/page-session.js +1 -1
- package/neural-interface/public/shared/schedules-view.js +2 -2
- package/neural-interface/public/shared/session-project-items.js +11 -0
- package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
- package/neural-interface/public/shared/settings/settings-ia.js +4 -2
- package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
- package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
- package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
- package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
- package/neural-interface/public/shared/sidepanel-shown.js +73 -0
- package/neural-interface/public/shared/start-bridge.js +2 -2
- package/neural-interface/public/shared/storage.js +6 -1
- package/neural-interface/public/shared/studio-attention.js +83 -0
- package/neural-interface/public/shared/styles.css +694 -50
- package/neural-interface/public/shared/term-browser-tabs.js +34 -0
- package/neural-interface/public/shared/transcript-rows.js +334 -0
- package/neural-interface/public/shared/tray-auto-close.js +106 -0
- package/neural-interface/public/shared/ui-agents.js +97 -0
- package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
- package/neural-interface/public/shared/ui-automation-studio.js +3 -3
- package/neural-interface/public/shared/ui-claude-panel.js +162 -95
- package/neural-interface/public/shared/ui-code-copy.js +256 -0
- package/neural-interface/public/shared/ui-codex-panel.js +14 -10
- package/neural-interface/public/shared/ui-context-menu.js +1 -1
- package/neural-interface/public/shared/ui-file-explorer.js +2 -3
- package/neural-interface/public/shared/ui-games.js +1 -1
- package/neural-interface/public/shared/ui-loading.js +83 -19
- package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
- package/neural-interface/public/shared/ui-menubar.js +23 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +50 -21
- package/neural-interface/public/shared/ui-navbar.js +15 -9
- package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
- package/neural-interface/public/shared/ui-owner-authority.js +48 -25
- package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
- package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
- package/neural-interface/public/shared/ui-sessions.js +3 -3
- package/neural-interface/public/shared/ui-settings-entry.js +55 -0
- package/neural-interface/public/shared/ui-settings.js +363 -400
- package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
- package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
- package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
- package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
- package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
- package/neural-interface/public/shared/ui-styleguide.js +10 -2
- package/neural-interface/public/shared/ui-sync.js +6 -0
- package/neural-interface/public/shared/ui-terminal.js +13 -9
- package/neural-interface/public/shared/ui-tooltip.js +28 -7
- package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
- package/neural-interface/public/shared/ui-tray-columns.js +375 -0
- package/neural-interface/public/shared/ui-whiteboard.js +51 -6
- package/neural-interface/public/shared/ui-worker-end.js +28 -1
- package/neural-interface/public/shared/ui-workspaces.js +13 -0
- package/neural-interface/public/shared/window-keys.js +71 -0
- package/neural-interface/public/sw.js +4 -3
- package/neural-interface/public/variant/2d/main.js +2 -0
- package/neural-interface/public/variant/3d/app.js +620 -0
- package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
- package/neural-interface/public/variant/3d/main.js +30 -544
- package/neural-interface/public/variant/3d/map-controls.js +4 -2
- package/neural-interface/public/vendor/fonts/fonts.css +508 -0
- package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/manifest.json +142 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
- package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
- package/neural-interface/scripts/boot-graph.mjs +270 -0
- package/neural-interface/scripts/vendor-fonts.mjs +124 -0
- package/neural-interface/server.js +1083 -164
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -1
- package/skills/agent-forge/SKILL.md +182 -0
- package/skills/agent-forge/evals/evals.json +56 -0
- package/skills/agent-forge/references/definition-fields.md +61 -0
- package/skills/agent-forge/references/examples.md +105 -0
- package/skills/agent-forge/references/instructions.md +51 -0
- package/skills/agent-forge/references/review-and-export.md +84 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>SynaBun Browser Bridge</title><link rel="stylesheet" href="tokens.css"><link rel="stylesheet" href="popup.css"><body>
|
|
2
|
+
<!-- The toolbar popup (docs/design/browser-extension: "Extension popup"). Am I connected, what may agents use, which
|
|
3
|
+
tabs do they hold. Every word comes from popup-strings.js in the browser's language (popup.js fills it in); what
|
|
4
|
+
the popup shows is decided by popup-view.js. -->
|
|
5
|
+
<div class="popup" id="popup" data-state="loading" aria-busy="true">
|
|
6
|
+
<header class="p-head">
|
|
7
|
+
<div class="p-brand"><img src="icons/icon-32.png" alt="" width="32" height="32"><div class="p-brand-text"><strong>SynaBun</strong><small id="p-brand-sub"></small></div></div>
|
|
8
|
+
<button type="button" class="p-icon-btn" id="p-open-app" data-action="open-app" aria-label="Open SynaBun" title="Open SynaBun"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17 17 7M8 7h9v9"></path></svg></button>
|
|
9
|
+
</header>
|
|
10
|
+
|
|
11
|
+
<section class="p-section p-top" aria-labelledby="p-status-title">
|
|
12
|
+
<div class="p-status" id="p-status" data-tone="">
|
|
13
|
+
<span class="p-status-symbol" aria-hidden="true">
|
|
14
|
+
<svg class="p-sym" data-sym="good" viewBox="0 0 24 24"><path d="m5 12 4 4 10-10"></path></svg>
|
|
15
|
+
<svg class="p-sym" data-sym="warn" viewBox="0 0 24 24"><path d="M9 5v14M15 5v14"></path></svg>
|
|
16
|
+
<svg class="p-sym" data-sym="sync" viewBox="0 0 24 24"><path d="M20 7a9 9 0 0 0-15-1L2 9m0-6v6h6M4 17a9 9 0 0 0 15 1l3-3m0 6v-6h-6"></path></svg>
|
|
17
|
+
<svg class="p-sym" data-sym="bad" viewBox="0 0 24 24"><path d="m12 3 10 18H2L12 3ZM12 9v5M12 17h.01"></path></svg>
|
|
18
|
+
<svg class="p-sym" data-sym="link" viewBox="0 0 24 24"><path d="M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1"></path></svg>
|
|
19
|
+
</span>
|
|
20
|
+
<div class="p-status-body">
|
|
21
|
+
<h1 class="p-status-title" id="p-status-title" tabindex="-1"></h1>
|
|
22
|
+
<p class="p-status-help" id="p-status-help"></p>
|
|
23
|
+
<div class="p-actions" id="p-status-actions" hidden><button type="button" class="p-btn p-btn-primary" id="p-primary" hidden></button></div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="p-mode" id="p-mode" hidden>
|
|
28
|
+
<span class="p-label" id="p-mode-label"></span>
|
|
29
|
+
<div class="p-dropdown" id="p-mode-dropdown">
|
|
30
|
+
<button type="button" class="p-dropdown-trigger" id="p-mode-trigger" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="p-mode-list" aria-labelledby="p-mode-label p-mode-value"><span id="p-mode-value"></span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button>
|
|
31
|
+
<div class="p-dropdown-menu" id="p-mode-list" role="listbox" aria-labelledby="p-mode-label" hidden>
|
|
32
|
+
<div class="p-dropdown-item" role="option" id="p-mode-full" data-value="full" aria-selected="true"></div>
|
|
33
|
+
<div class="p-dropdown-item" role="option" id="p-mode-restricted" data-value="restricted" aria-selected="false"></div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<p class="p-mode-help" id="p-mode-help"></p>
|
|
37
|
+
</div>
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
<section class="p-section" id="p-activity" aria-labelledby="p-activity-title" hidden>
|
|
41
|
+
<div class="p-section-title"><h2 id="p-activity-title" tabindex="-1"></h2><span id="p-activity-count"></span></div>
|
|
42
|
+
<p class="p-caption" id="p-activity-summary"></p>
|
|
43
|
+
<div class="p-tab-list" id="p-groups"></div>
|
|
44
|
+
<div class="p-empty" id="p-empty" hidden>
|
|
45
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="7" width="15" height="13" rx="2"></rect><path d="M7 3h12a2 2 0 0 1 2 2v11M3 11h15"></path></svg>
|
|
46
|
+
<h3 id="p-empty-title"></h3><p id="p-empty-help"></p>
|
|
47
|
+
</div>
|
|
48
|
+
<p class="p-helper" id="p-activity-help"></p>
|
|
49
|
+
</section>
|
|
50
|
+
|
|
51
|
+
<section class="p-section" id="p-shared" aria-labelledby="p-shared-title" hidden>
|
|
52
|
+
<h2 id="p-shared-title"></h2>
|
|
53
|
+
<div class="p-list" id="p-sites"></div>
|
|
54
|
+
<div class="p-empty" id="p-shared-empty" hidden><h3 id="p-shared-empty-title"></h3><p id="p-shared-empty-help"></p></div>
|
|
55
|
+
<h3 class="p-subhead" id="p-waiting-title" hidden></h3>
|
|
56
|
+
<div class="p-list" id="p-waiting"></div>
|
|
57
|
+
<div class="p-actions"><button type="button" class="p-btn p-btn-primary" id="share" data-action="share"></button><button type="button" class="p-btn" id="site" data-action="site"></button></div>
|
|
58
|
+
<label class="p-check"><input type="checkbox" id="newTabs"><span id="p-newtabs-label"></span></label>
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<details class="p-details" id="p-files" hidden>
|
|
62
|
+
<summary id="p-files-summary"></summary>
|
|
63
|
+
<div class="p-details-body">
|
|
64
|
+
<label class="p-check"><input type="checkbox" id="downloads"><span id="p-downloads-label"></span></label>
|
|
65
|
+
<p id="p-download-note"></p>
|
|
66
|
+
<p class="p-notice" id="p-downloads-denied" role="status" hidden></p>
|
|
67
|
+
<h3 id="p-upload-title"></h3>
|
|
68
|
+
<p id="p-upload-help"></p>
|
|
69
|
+
<p id="p-limits"></p>
|
|
70
|
+
<details class="p-details p-details-nested" id="p-connection">
|
|
71
|
+
<summary id="p-connection-summary"></summary>
|
|
72
|
+
<p class="p-details-body"><span id="p-bridge-label"></span> <code id="p-bridge"></code></p>
|
|
73
|
+
</details>
|
|
74
|
+
</div>
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
<details class="p-details" id="p-pair-code" hidden>
|
|
78
|
+
<summary id="p-pair-summary"></summary>
|
|
79
|
+
<form class="p-details-body p-pair" id="pair">
|
|
80
|
+
<p id="p-pair-help"></p>
|
|
81
|
+
<label class="p-field" for="port"><span id="p-port-label"></span><input id="port" type="number" min="1024" max="65535" value="3345" inputmode="numeric"></label>
|
|
82
|
+
<label class="p-field" for="code"><span id="p-code-label"></span><input id="code" autocomplete="off" spellcheck="false" maxlength="24"></label>
|
|
83
|
+
<button class="p-btn" id="p-pair-submit" type="submit"></button>
|
|
84
|
+
</form>
|
|
85
|
+
</details>
|
|
86
|
+
|
|
87
|
+
<footer class="p-footer" id="p-footer">
|
|
88
|
+
<button type="button" class="p-btn p-btn-ghost" id="p-footer-app" data-action="open-app"></button>
|
|
89
|
+
<span class="p-footer-end">
|
|
90
|
+
<button type="button" class="p-btn p-btn-ghost" id="disconnect" data-action="confirm-disconnect" hidden></button>
|
|
91
|
+
<button type="button" class="p-btn p-btn-ghost p-btn-danger" id="revoke" data-action="confirm-revoke" hidden></button>
|
|
92
|
+
</span>
|
|
93
|
+
<div class="p-footer-end p-footer-tools">
|
|
94
|
+
<button type="button" class="p-btn p-btn-ghost" id="p-open-extensions" data-action="open-extensions"></button>
|
|
95
|
+
<button type="button" class="p-btn p-btn-ghost" id="p-reload-extension" data-action="reload-extension"></button>
|
|
96
|
+
</div>
|
|
97
|
+
</footer>
|
|
98
|
+
|
|
99
|
+
<p class="p-sr-only" id="p-live" role="status" aria-live="polite"></p>
|
|
100
|
+
<p class="p-toast" id="p-toast" role="status" aria-live="polite"></p>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<dialog class="p-dialog" id="p-confirm" aria-labelledby="p-confirm-title" aria-describedby="p-confirm-body">
|
|
104
|
+
<h2 id="p-confirm-title"></h2>
|
|
105
|
+
<p id="p-confirm-body"></p>
|
|
106
|
+
<div class="p-actions p-dialog-actions"><button type="button" class="p-btn" id="p-confirm-cancel" data-action="cancel-confirm"></button><button type="button" class="p-btn" id="p-confirm-ok" data-action="do-confirm"></button></div>
|
|
107
|
+
</dialog>
|
|
108
|
+
<script type="module" src="popup.js"></script></body></html>
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
// The toolbar popup's DOM glue (popup.html). popup-view.js decides what is shown. Bridge actions go to the service
|
|
2
|
+
// worker (docs/browser-extension-bridge.md). The popup opens its own links and reloads the extension directly.
|
|
3
|
+
// Disconnect, Revoke pairing, a mode change and removing a shared site are confirmed first. Take back is immediate
|
|
4
|
+
// and keeps the tab open.
|
|
5
|
+
import { publicOrigin, hostPattern } from './protocol.js';
|
|
6
|
+
import { popupLocale, translator } from './popup-strings.js';
|
|
7
|
+
import { popupView } from './popup-view.js';
|
|
8
|
+
|
|
9
|
+
const $ = id => document.getElementById(id);
|
|
10
|
+
const locale = popupLocale([globalThis.chrome?.i18n?.getUILanguage?.(), ...(globalThis.navigator?.languages || []), globalThis.navigator?.language].filter(Boolean));
|
|
11
|
+
const t = translator(locale);
|
|
12
|
+
const coded = code => Object.assign(new Error(code), { code });
|
|
13
|
+
|
|
14
|
+
async function ask(message) {
|
|
15
|
+
const result = await chrome.runtime.sendMessage(message);
|
|
16
|
+
if (!result?.ok) throw Object.assign(new Error(result?.error || 'EXTENSION_UNAVAILABLE'), { code: result?.code || 'EXTENSION_UNAVAILABLE' });
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
// Whether a pairing credential is stored: its size only, never its value. null where the browser cannot say.
|
|
20
|
+
async function storedPairing() {
|
|
21
|
+
try { const bytes = await chrome.storage.local.getBytesInUse?.('credential'); return typeof bytes === 'number' ? bytes > 0 : null; }
|
|
22
|
+
catch { return null; }
|
|
23
|
+
}
|
|
24
|
+
// SynaBun's own address, from this extension's manifest (the setup page's content script names the app's origin).
|
|
25
|
+
function appOrigin() {
|
|
26
|
+
try {
|
|
27
|
+
const own = chrome.runtime.getManifest().content_scripts || [];
|
|
28
|
+
const pattern = own.flatMap(entry => entry.js?.includes('setup-content.js') ? entry.matches || [] : [])[0];
|
|
29
|
+
if (pattern) return new URL(pattern.replace(/\*$/, '')).origin;
|
|
30
|
+
} catch {}
|
|
31
|
+
return 'http://127.0.0.1:3344';
|
|
32
|
+
}
|
|
33
|
+
const openTab = url => chrome.tabs.create({ url });
|
|
34
|
+
|
|
35
|
+
// ── the words that never change while the popup is open ──
|
|
36
|
+
function fixedText() {
|
|
37
|
+
document.documentElement.lang = locale;
|
|
38
|
+
const set = (id, key) => { const node = $(id); if (node) node.textContent = t(key); };
|
|
39
|
+
let version;
|
|
40
|
+
try { version = chrome.runtime.getManifest().version; } catch {}
|
|
41
|
+
$('p-brand-sub').textContent = version ? `${t('brandSub')} · v${version}` : t('brandSub');
|
|
42
|
+
const openApp = $('p-open-app'); openApp.setAttribute('aria-label', t('openApp')); openApp.setAttribute('title', t('openApp'));
|
|
43
|
+
set('p-footer-app', 'openApp'); set('disconnect', 'disconnect'); set('revoke', 'revoke');
|
|
44
|
+
set('p-open-extensions', 'openExtensions'); set('p-reload-extension', 'reloadExtension');
|
|
45
|
+
set('p-mode-label', 'agentAccess'); set('p-mode-full', 'full'); set('p-mode-restricted', 'restricted');
|
|
46
|
+
set('p-empty-title', 'emptyTitle'); set('p-empty-help', 'emptyHelp');
|
|
47
|
+
set('p-shared-title', 'sharedSites'); set('p-shared-empty-title', 'noShared'); set('p-shared-empty-help', 'noSharedHelp'); set('p-waiting-title', 'sharedTabs');
|
|
48
|
+
set('share', 'shareTab'); set('site', 'shareSite'); set('p-newtabs-label', 'newTabs');
|
|
49
|
+
set('p-files-summary', 'advanced'); set('p-downloads-label', 'downloads'); set('p-download-note', 'downloadNote'); set('p-downloads-denied', 'downloadsDenied');
|
|
50
|
+
set('p-upload-title', 'uploadFolder'); set('p-upload-help', 'uploadHelpPopup'); set('p-limits', 'limits');
|
|
51
|
+
set('p-connection-summary', 'details'); set('p-bridge-label', 'bridge');
|
|
52
|
+
set('p-pair-summary', 'pairCode'); set('p-pair-help', 'pairCodeHelp'); set('p-port-label', 'pairPort'); set('p-code-label', 'pairCodeLabel'); set('p-pair-submit', 'pairAction');
|
|
53
|
+
set('p-confirm-cancel', 'cancel');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ── state ──
|
|
57
|
+
let view = null, lastState = '', refreshing = false, portTouched = false;
|
|
58
|
+
const busy = new Set(), rowErrors = new Set();
|
|
59
|
+
|
|
60
|
+
const SYMBOLS = { connected: 'good', disconnected: 'warn', connecting: 'sync', reconnecting: 'sync', loading: 'sync', error: 'bad', unpaired: 'link' };
|
|
61
|
+
const PRIMARY_LABEL = { resume: 'reconnect', connect: 'connect', retry: 'retry', 'open-app': 'openApp' };
|
|
62
|
+
|
|
63
|
+
// Children of `container` follow `items` in order, each kept by its key so focus and scroll survive a refresh.
|
|
64
|
+
function reconcile(container, items, key, make, update) {
|
|
65
|
+
const existing = new Map([...container.children].map(el => [el.dataset.key, el]));
|
|
66
|
+
items.forEach((item, i) => {
|
|
67
|
+
const k = key(item);
|
|
68
|
+
let el = existing.get(k);
|
|
69
|
+
if (!el) { el = make(item); el.dataset.key = k; }
|
|
70
|
+
existing.delete(k);
|
|
71
|
+
update(el, item);
|
|
72
|
+
if (container.children[i] !== el) container.insertBefore(el, container.children[i] || null);
|
|
73
|
+
});
|
|
74
|
+
for (const el of existing.values()) el.remove();
|
|
75
|
+
}
|
|
76
|
+
function element(tag, className, attrs = {}) {
|
|
77
|
+
const el = document.createElement(tag);
|
|
78
|
+
if (className) el.className = className;
|
|
79
|
+
for (const [name, value] of Object.entries(attrs)) el.setAttribute(name, value);
|
|
80
|
+
return el;
|
|
81
|
+
}
|
|
82
|
+
function textOnce(node, text) { if (node.textContent !== text) node.textContent = text; }
|
|
83
|
+
|
|
84
|
+
// A tab row: its title and safe address, and one action (Take back, or Stop sharing for a shared tab nobody holds).
|
|
85
|
+
function makeRow(kind) {
|
|
86
|
+
return () => {
|
|
87
|
+
const row = element('div', 'p-row');
|
|
88
|
+
const text = element('div', 'p-row-text');
|
|
89
|
+
text.append(element('span', 'p-row-title'), element('span', 'p-row-address'));
|
|
90
|
+
const button = element('button', 'p-btn', { type: 'button', 'data-action': kind });
|
|
91
|
+
const error = element('p', 'p-row-error', { role: 'alert' }); error.hidden = true;
|
|
92
|
+
row.append(text, button, error);
|
|
93
|
+
return row;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function updateRow(row, tab, { kind, agent = '', disabled }) {
|
|
97
|
+
row.dataset.handle = tab.handle; row.dataset.stale = String(!!disabled);
|
|
98
|
+
const [text, button, error] = row.children;
|
|
99
|
+
const [title, address] = text.children;
|
|
100
|
+
textOnce(title, tab.title); title.setAttribute('title', tab.title);
|
|
101
|
+
textOnce(address, tab.address);
|
|
102
|
+
button.dataset.handle = tab.handle;
|
|
103
|
+
const pending = busy.has(tab.handle);
|
|
104
|
+
textOnce(button, t(pending ? 'busy' : kind === 'take-back' ? 'takeBack' : 'stopSharing'));
|
|
105
|
+
button.setAttribute('aria-label', kind === 'take-back' ? t('takeBackLabel', { title: tab.title, agent }) : t('stopSharingLabel', { title: tab.title }));
|
|
106
|
+
button.disabled = !!disabled || pending;
|
|
107
|
+
error.hidden = !rowErrors.has(tab.handle);
|
|
108
|
+
textOnce(error, rowErrors.has(tab.handle) ? t('actionError') : '');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function render(next) {
|
|
112
|
+
view = next;
|
|
113
|
+
const popup = $('popup');
|
|
114
|
+
popup.dataset.state = view.state; popup.setAttribute('aria-busy', 'false');
|
|
115
|
+
// status
|
|
116
|
+
const status = $('p-status'); status.dataset.tone = view.tone; status.dataset.sym = SYMBOLS[view.state] || 'sync';
|
|
117
|
+
textOnce($('p-status-title'), view.title); textOnce($('p-status-help'), view.help);
|
|
118
|
+
const primary = $('p-primary');
|
|
119
|
+
primary.hidden = !view.primary; $('p-status-actions').hidden = !view.primary;
|
|
120
|
+
if (view.primary) { primary.dataset.action = view.primary; textOnce(primary, t(PRIMARY_LABEL[view.primary])); primary.className = `p-btn ${view.primary === 'open-app' ? '' : 'p-btn-primary'}`.trim(); }
|
|
121
|
+
// A connection change is announced once, never every poll.
|
|
122
|
+
if (view.state !== lastState) { lastState = view.state; $('p-live').textContent = `${t('statusLabel')}: ${view.title}`; }
|
|
123
|
+
// agent access
|
|
124
|
+
$('p-mode').hidden = !view.showMode;
|
|
125
|
+
const chosen = view.full ? 'full' : 'restricted';
|
|
126
|
+
textOnce($('p-mode-value'), t(chosen));
|
|
127
|
+
for (const option of $('p-mode-list').children) option.setAttribute('aria-selected', String(option.dataset.value === chosen));
|
|
128
|
+
textOnce($('p-mode-help'), t(view.full ? 'fullHelp' : 'restrictedHelp'));
|
|
129
|
+
// activity: the tabs agents hold, by agent
|
|
130
|
+
$('p-activity').hidden = !view.showActivity;
|
|
131
|
+
const total = view.groups.reduce((sum, g) => sum + g.tabs.length, 0);
|
|
132
|
+
textOnce($('p-activity-title'), t(view.stale ? 'pausedTabs' : 'controlled'));
|
|
133
|
+
textOnce($('p-activity-count'), total ? String(total) : '');
|
|
134
|
+
$('p-activity-summary').hidden = !total; textOnce($('p-activity-summary'), view.summary);
|
|
135
|
+
reconcile($('p-groups'), view.groups, g => g.owner, () => {
|
|
136
|
+
const group = element('div', 'p-agent');
|
|
137
|
+
const heading = element('div', 'p-agent-heading');
|
|
138
|
+
heading.append(element('span', 'p-agent-mark', { 'aria-hidden': 'true' }), element('span', 'p-agent-name'));
|
|
139
|
+
group.append(heading, element('div', 'p-agent-tabs'));
|
|
140
|
+
return group;
|
|
141
|
+
}, (group, g) => {
|
|
142
|
+
const [heading, list] = group.children;
|
|
143
|
+
textOnce(heading.children[0], g.mark); textOnce(heading.children[1], g.label);
|
|
144
|
+
reconcile(list, g.tabs, tab => tab.handle, makeRow('take-back'), (row, tab) => updateRow(row, tab, { kind: 'take-back', agent: g.label, disabled: !view.live }));
|
|
145
|
+
});
|
|
146
|
+
$('p-empty').hidden = !(view.live && !total);
|
|
147
|
+
textOnce($('p-activity-help'), t(view.stale ? 'staleHelp' : 'takeBackHelp'));
|
|
148
|
+
$('p-activity-help').hidden = !total;
|
|
149
|
+
// restricted mode: what the owner shares
|
|
150
|
+
$('p-shared').hidden = !view.showShared;
|
|
151
|
+
reconcile($('p-sites'), view.sites, site => site, () => {
|
|
152
|
+
const row = element('div', 'p-row');
|
|
153
|
+
const text = element('div', 'p-row-text'); text.append(element('code', 'p-row-title'));
|
|
154
|
+
row.append(text, element('button', 'p-btn p-btn-ghost p-btn-danger', { type: 'button', 'data-action': 'confirm-site' }));
|
|
155
|
+
return row;
|
|
156
|
+
}, (row, site) => {
|
|
157
|
+
textOnce(row.children[0].children[0], site);
|
|
158
|
+
const button = row.children[1]; button.dataset.site = site; textOnce(button, t('removeSite')); button.setAttribute('aria-label', t('removeSiteLabel', { site }));
|
|
159
|
+
});
|
|
160
|
+
reconcile($('p-waiting'), view.showShared ? view.waiting : [], tab => tab.handle, makeRow('stop-sharing'), (row, tab) => updateRow(row, tab, { kind: 'stop-sharing', disabled: !view.live }));
|
|
161
|
+
$('p-waiting-title').hidden = !view.waiting.length;
|
|
162
|
+
$('p-shared-empty').hidden = !!(view.sites.length || view.waiting.length);
|
|
163
|
+
$('newTabs').checked = view.options.allowNewTabs; $('downloads').checked = view.options.downloads;
|
|
164
|
+
// files and limits, the typed code
|
|
165
|
+
$('p-files').hidden = !view.showFiles;
|
|
166
|
+
textOnce($('p-bridge'), `127.0.0.1:${view.port}`);
|
|
167
|
+
$('p-pair-code').hidden = !view.showPairCode;
|
|
168
|
+
if (!portTouched) $('port').value = String(view.port);
|
|
169
|
+
// footer
|
|
170
|
+
$('disconnect').hidden = !view.canDisconnect;
|
|
171
|
+
$('revoke').hidden = !view.canRevoke;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function refresh() {
|
|
175
|
+
if (refreshing) return;
|
|
176
|
+
refreshing = true;
|
|
177
|
+
try {
|
|
178
|
+
let result = null;
|
|
179
|
+
try { result = await ask({ action: 'status' }); } catch { result = null; }
|
|
180
|
+
render(popupView(result, { paired: result ? await storedPairing() : null, t }));
|
|
181
|
+
} finally { refreshing = false; }
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ── feedback ──
|
|
185
|
+
let toastTimer;
|
|
186
|
+
function toast(text, tone = '') {
|
|
187
|
+
const node = $('p-toast'); node.textContent = text; node.dataset.tone = tone;
|
|
188
|
+
clearTimeout(toastTimer); toastTimer = setTimeout(() => { node.textContent = ''; }, 6000);
|
|
189
|
+
}
|
|
190
|
+
function failure(error) {
|
|
191
|
+
const code = String(error?.code || '');
|
|
192
|
+
if (code === 'SITE_DENIED') return t('siteDenied');
|
|
193
|
+
if (code === 'EXTENSION_UNAVAILABLE') return t('unavailable');
|
|
194
|
+
return t('actionFailed', { code: code || 'OPERATION_FAILED' });
|
|
195
|
+
}
|
|
196
|
+
// Runs one owner action, says how it went, and shows the worker's state after it.
|
|
197
|
+
async function run(fn, done) {
|
|
198
|
+
try { await fn(); if (done) toast(done); }
|
|
199
|
+
catch (error) { toast(failure(error), 'bad'); }
|
|
200
|
+
await refresh();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ── confirmations (a styled <dialog>; Cancel has the focus first; focus returns where it came from) ──
|
|
204
|
+
const CONFIRMS = {
|
|
205
|
+
disconnect: ['disconnectTitle', 'disconnectBody', 'disconnect', 'danger'],
|
|
206
|
+
revoke: ['revokeTitle', 'revokeBody', 'revoke', 'danger'],
|
|
207
|
+
restrict: ['restrictTitle', 'restrictBody', 'restrictConfirm', 'primary'],
|
|
208
|
+
full: ['fullTitle', 'fullBody', 'fullConfirm', 'primary'],
|
|
209
|
+
site: ['removeTitle', 'removeBody', 'removeSite', 'danger'],
|
|
210
|
+
};
|
|
211
|
+
let pending = null;
|
|
212
|
+
function confirmFirst(kind, opener, action) {
|
|
213
|
+
const [title, body, ok, tone] = CONFIRMS[kind];
|
|
214
|
+
const dialog = $('p-confirm');
|
|
215
|
+
$('p-confirm-title').textContent = t(title); $('p-confirm-body').textContent = t(body);
|
|
216
|
+
const button = $('p-confirm-ok'); button.textContent = t(ok); button.className = `p-btn p-btn-${tone}`;
|
|
217
|
+
dialog.dataset.kind = kind;
|
|
218
|
+
pending = { action, opener };
|
|
219
|
+
if (typeof dialog.showModal === 'function') dialog.showModal(); else dialog.setAttribute('open', '');
|
|
220
|
+
$('p-confirm-cancel').focus();
|
|
221
|
+
}
|
|
222
|
+
function closeConfirm() {
|
|
223
|
+
const dialog = $('p-confirm'), opener = pending?.opener;
|
|
224
|
+
pending = null;
|
|
225
|
+
if (typeof dialog.close === 'function' && dialog.open) dialog.close(); else dialog.removeAttribute('open');
|
|
226
|
+
if (opener?.isConnected && !opener.hidden) opener.focus(); else $('p-status-title').focus?.();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ── the mode dropdown: the app's .cc-dropdown keyboard model (never a native select) ──
|
|
230
|
+
const trigger = () => $('p-mode-trigger'), options = () => [...$('p-mode-list').children];
|
|
231
|
+
let highlighted = 0, typed = '', typedAt = 0;
|
|
232
|
+
function openMenu(open) {
|
|
233
|
+
const menu = $('p-mode-list');
|
|
234
|
+
menu.hidden = !open; trigger().setAttribute('aria-expanded', String(open));
|
|
235
|
+
if (open) highlight(options().findIndex(o => o.getAttribute('aria-selected') === 'true'));
|
|
236
|
+
else { trigger().removeAttribute('aria-activedescendant'); for (const o of options()) o.classList.remove('p-highlight'); }
|
|
237
|
+
}
|
|
238
|
+
function highlight(index) {
|
|
239
|
+
const list = options();
|
|
240
|
+
highlighted = Math.max(0, Math.min(list.length - 1, index));
|
|
241
|
+
list.forEach((o, i) => o.classList.toggle('p-highlight', i === highlighted));
|
|
242
|
+
trigger().setAttribute('aria-activedescendant', list[highlighted].id);
|
|
243
|
+
}
|
|
244
|
+
function choose(value) {
|
|
245
|
+
openMenu(false); trigger().focus();
|
|
246
|
+
const full = value === 'full';
|
|
247
|
+
if (!view || full === view.full) return;
|
|
248
|
+
confirmFirst(full ? 'full' : 'restrict', trigger(), () => run(() => ask({ action: 'mode', fullControl: full }), t('modeSaved')));
|
|
249
|
+
}
|
|
250
|
+
function menuKey(event) {
|
|
251
|
+
const open = trigger().getAttribute('aria-expanded') === 'true', list = options();
|
|
252
|
+
if (event.key === 'Tab') { if (open) openMenu(false); return; }
|
|
253
|
+
if (event.key === 'Escape') { if (open) { event.preventDefault(); openMenu(false); } return; }
|
|
254
|
+
if (['ArrowDown', 'ArrowUp', 'Home', 'End', 'PageDown', 'PageUp', 'Enter', ' '].includes(event.key)) {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
if (!open) { openMenu(true); return; }
|
|
257
|
+
if (event.key === 'Enter' || event.key === ' ') { choose(list[highlighted].dataset.value); return; }
|
|
258
|
+
const step = { ArrowDown: 1, ArrowUp: -1, PageDown: 10, PageUp: -10 }[event.key];
|
|
259
|
+
highlight(event.key === 'Home' ? 0 : event.key === 'End' ? list.length - 1 : highlighted + step);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (event.key?.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
263
|
+
if (Date.now() - typedAt > 600) typed = '';
|
|
264
|
+
typedAt = Date.now(); typed += event.key.toLowerCase();
|
|
265
|
+
if (!open) openMenu(true);
|
|
266
|
+
const i = list.findIndex(o => o.textContent.toLowerCase().startsWith(typed));
|
|
267
|
+
if (i >= 0) highlight(i);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ── actions ──
|
|
272
|
+
function nextFocus(button) {
|
|
273
|
+
// After a row leaves, the focus goes to the next row's action, else the previous one, else the section title.
|
|
274
|
+
const all = [...$('popup').querySelectorAll('[data-action="take-back"]')];
|
|
275
|
+
const i = all.indexOf(button);
|
|
276
|
+
return all[i + 1] || all[i - 1] || null;
|
|
277
|
+
}
|
|
278
|
+
async function takeBack(button, verb) {
|
|
279
|
+
const handle = button.dataset.handle;
|
|
280
|
+
if (!handle || busy.has(handle)) return;
|
|
281
|
+
const after = nextFocus(button);
|
|
282
|
+
busy.add(handle); rowErrors.delete(handle); render(view);
|
|
283
|
+
let ok = false;
|
|
284
|
+
try { await ask({ action: 'revokeTab', tab: handle }); ok = true; }
|
|
285
|
+
catch { rowErrors.add(handle); }
|
|
286
|
+
finally { busy.delete(handle); }
|
|
287
|
+
await refresh();
|
|
288
|
+
if (ok) {
|
|
289
|
+
toast(t(verb === 'take-back' ? 'takenBack' : 'saved'));
|
|
290
|
+
if (!button.isConnected) (after?.isConnected ? after : $('p-activity-title'))?.focus?.();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
async function act(action, target) {
|
|
294
|
+
if (action === 'open-app') { await openTab(`${appOrigin()}/`); return; }
|
|
295
|
+
if (action === 'open-extensions') {
|
|
296
|
+
try { await openTab('chrome://extensions/'); }
|
|
297
|
+
catch { toast(t('openExtensionsFailed'), 'bad'); }
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (action === 'reload-extension') {
|
|
301
|
+
try { chrome.runtime.reload(); }
|
|
302
|
+
catch { toast(t('reloadExtensionFailed'), 'bad'); }
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (action === 'connect') { await openTab(`${appOrigin()}/extension-setup`); toast(t('connectOpened')); return; }
|
|
306
|
+
if (action === 'retry') { await refresh(); return; }
|
|
307
|
+
if (action === 'resume') { await run(() => ask({ action: 'resume' }), t('reconnectingToast')); return; }
|
|
308
|
+
if (action === 'confirm-disconnect') { confirmFirst('disconnect', target, () => run(() => ask({ action: 'disconnect' }), t('disconnectedToast'))); return; }
|
|
309
|
+
if (action === 'confirm-revoke') { confirmFirst('revoke', target, () => run(() => ask({ action: 'revoke' }), t('revokedToast'))); return; }
|
|
310
|
+
if (action === 'confirm-site') { const site = target.dataset.site; confirmFirst('site', target, () => run(() => ask({ action: 'revokeSite', site }), t('saved'))); return; }
|
|
311
|
+
if (action === 'take-back' || action === 'stop-sharing') { await takeBack(target, action); return; }
|
|
312
|
+
if (action === 'cancel-confirm') { closeConfirm(); return; }
|
|
313
|
+
if (action === 'do-confirm') { const next = pending?.action; closeConfirm(); if (next) await next(); return; }
|
|
314
|
+
// Restricted mode: share the browser's active tab (and its site), or only its site for new tabs. The site permission
|
|
315
|
+
// is asked in this click, as before.
|
|
316
|
+
if (action === 'share' || action === 'site') {
|
|
317
|
+
const siteOnly = action === 'site';
|
|
318
|
+
await run(async () => {
|
|
319
|
+
const tab = (await chrome.tabs.query({ active: true, currentWindow: true }))[0];
|
|
320
|
+
const site = publicOrigin(tab?.url);
|
|
321
|
+
if (!await chrome.permissions.request({ origins: [hostPattern(site)] })) throw coded('SITE_DENIED');
|
|
322
|
+
await ask({ action: 'share', tab: tab.id, siteOnly });
|
|
323
|
+
}, t(siteOnly ? 'siteToast' : 'sharedToast'));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function wire() {
|
|
328
|
+
document.addEventListener('click', event => {
|
|
329
|
+
const option = event.target.closest?.('[role="option"]');
|
|
330
|
+
if (option && $('p-mode-list').contains(option)) { choose(option.dataset.value); return; }
|
|
331
|
+
if (event.target.closest?.('.p-dropdown-trigger')) { openMenu(trigger().getAttribute('aria-expanded') !== 'true'); return; }
|
|
332
|
+
const target = event.target.closest?.('[data-action]');
|
|
333
|
+
if (target && !target.disabled) void act(target.dataset.action, target);
|
|
334
|
+
});
|
|
335
|
+
trigger().addEventListener('keydown', menuKey);
|
|
336
|
+
document.addEventListener('pointerdown', event => { if (!event.target.closest?.('.p-dropdown')) openMenu(false); });
|
|
337
|
+
const dialog = $('p-confirm');
|
|
338
|
+
// Escape cancels (the dialog's own cancel event); the focus goes back to the control that opened it.
|
|
339
|
+
dialog.addEventListener('cancel', event => { event.preventDefault(); closeConfirm(); });
|
|
340
|
+
for (const id of ['newTabs', 'downloads']) $(id).addEventListener('change', () => run(async () => {
|
|
341
|
+
$('p-downloads-denied').hidden = true;
|
|
342
|
+
if (id === 'downloads' && $('downloads').checked && !await chrome.permissions.request({ permissions: ['downloads'] })) {
|
|
343
|
+
$('downloads').checked = false; $('p-downloads-denied').hidden = false; $('p-files').open = true;
|
|
344
|
+
}
|
|
345
|
+
await ask({ action: 'options', options: { allowNewTabs: $('newTabs').checked, downloads: $('downloads').checked } });
|
|
346
|
+
}, t('saved')));
|
|
347
|
+
$('port').addEventListener('input', () => { portTouched = true; });
|
|
348
|
+
$('pair').addEventListener('submit', event => {
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
void run(async () => { await ask({ action: 'pair', code: $('code').value, port: Number($('port').value) }); $('code').value = ''; }, t('pairStarted'));
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
fixedText();
|
|
355
|
+
wire();
|
|
356
|
+
render(popupView(undefined, { t }));
|
|
357
|
+
await refresh();
|
|
358
|
+
const timer = setInterval(() => { void refresh(); }, 1500);
|
|
359
|
+
window.addEventListener('unload', () => clearInterval(timer));
|