synabun 2.4.1 → 2.4.3
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 +50 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +46 -6
- package/lib/data-home-files.js +4 -2
- package/lib/first-launch-protection.js +8 -2
- package/lib/release-npm-ci.mjs +23 -1
- package/lib/update-snapshot.js +11 -4
- package/mcp-server/dist/http.d.ts.map +1 -1
- package/mcp-server/dist/http.js +25 -2
- package/mcp-server/dist/http.js.map +1 -1
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +62 -17
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/browser-bench.d.ts +22 -22
- package/mcp-server/dist/services/memory-maintenance.d.ts +1 -0
- package/mcp-server/dist/services/memory-maintenance.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-maintenance.js +34 -45
- package/mcp-server/dist/services/memory-maintenance.js.map +1 -1
- package/mcp-server/dist/services/memory-migration-copy.d.ts +144 -0
- package/mcp-server/dist/services/memory-migration-copy.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-migration-copy.js +467 -0
- package/mcp-server/dist/services/memory-migration-copy.js.map +1 -0
- package/mcp-server/dist/services/memory-migration-worker.d.ts +2 -0
- package/mcp-server/dist/services/memory-migration-worker.d.ts.map +1 -0
- package/mcp-server/dist/services/memory-migration-worker.js +60 -0
- package/mcp-server/dist/services/memory-migration-worker.js.map +1 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts +4 -0
- package/mcp-server/dist/services/memory-retrieval.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-retrieval.js +188 -40
- package/mcp-server/dist/services/memory-retrieval.js.map +1 -1
- package/mcp-server/dist/services/memory-schema.d.ts +58 -2
- package/mcp-server/dist/services/memory-schema.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-schema.js +190 -13
- package/mcp-server/dist/services/memory-schema.js.map +1 -1
- package/mcp-server/dist/services/memory-sessions.d.ts +19 -1
- package/mcp-server/dist/services/memory-sessions.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-sessions.js +56 -20
- package/mcp-server/dist/services/memory-sessions.js.map +1 -1
- package/mcp-server/dist/services/memory-verification.d.ts.map +1 -1
- package/mcp-server/dist/services/memory-verification.js +8 -5
- package/mcp-server/dist/services/memory-verification.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +5 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +19 -2
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/retrieval-reader-worker.d.ts +2 -0
- package/mcp-server/dist/services/retrieval-reader-worker.d.ts.map +1 -0
- package/mcp-server/dist/services/retrieval-reader-worker.js +76 -0
- package/mcp-server/dist/services/retrieval-reader-worker.js.map +1 -0
- package/mcp-server/dist/services/retrieval-reader.d.ts +38 -0
- package/mcp-server/dist/services/retrieval-reader.d.ts.map +1 -0
- package/mcp-server/dist/services/retrieval-reader.js +145 -0
- package/mcp-server/dist/services/retrieval-reader.js.map +1 -0
- package/mcp-server/dist/services/sqlite-write.d.ts +14 -0
- package/mcp-server/dist/services/sqlite-write.d.ts.map +1 -0
- package/mcp-server/dist/services/sqlite-write.js +94 -0
- package/mcp-server/dist/services/sqlite-write.js.map +1 -0
- package/mcp-server/dist/services/sqlite.d.ts +39 -0
- package/mcp-server/dist/services/sqlite.d.ts.map +1 -1
- package/mcp-server/dist/services/sqlite.js +249 -8
- package/mcp-server/dist/services/sqlite.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.d.ts +1 -1
- package/mcp-server/dist/services/typesafe-config.d.ts +7 -1
- package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
- package/mcp-server/dist/services/typesafe-config.js +32 -10
- package/mcp-server/dist/services/typesafe-config.js.map +1 -1
- package/mcp-server/dist/services/typesafe.d.ts.map +1 -1
- package/mcp-server/dist/services/typesafe.js +9 -7
- package/mcp-server/dist/services/typesafe.js.map +1 -1
- package/mcp-server/dist/services/vector-cache.d.ts +32 -0
- package/mcp-server/dist/services/vector-cache.d.ts.map +1 -1
- package/mcp-server/dist/services/vector-cache.js +161 -8
- package/mcp-server/dist/services/vector-cache.js.map +1 -1
- package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
- package/mcp-server/dist/tools/agents.d.ts +11 -7
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +27 -9
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts +1 -1
- package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-advanced.js +10 -3
- package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
- package/mcp-server/dist/tools/browser-extension-setup.d.ts +5 -0
- package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -0
- package/mcp-server/dist/tools/browser-extension-setup.js +29 -0
- package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -0
- package/mcp-server/dist/tools/browser-interact.d.ts.map +1 -1
- package/mcp-server/dist/tools/browser-interact.js +6 -1
- package/mcp-server/dist/tools/browser-interact.js.map +1 -1
- package/mcp-server/dist/tools/fb-groups.d.ts +2 -2
- package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
- package/mcp-server/dist/tools/tool-groups.d.ts +1 -1
- package/mcp-server/package-lock.json +5 -5
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/http.ts +20 -2
- package/mcp-server/src/index.ts +59 -17
- package/mcp-server/src/services/memory-maintenance.ts +31 -28
- package/mcp-server/src/services/memory-migration-copy.ts +419 -0
- package/mcp-server/src/services/memory-migration-worker.ts +55 -0
- package/mcp-server/src/services/memory-retrieval.ts +173 -32
- package/mcp-server/src/services/memory-schema.ts +194 -12
- package/mcp-server/src/services/memory-sessions.ts +54 -21
- package/mcp-server/src/services/memory-verification.ts +7 -4
- package/mcp-server/src/services/neural-interface.ts +22 -2
- package/mcp-server/src/services/retrieval-reader-worker.ts +67 -0
- package/mcp-server/src/services/retrieval-reader.ts +131 -0
- package/mcp-server/src/services/sqlite-write.ts +60 -0
- package/mcp-server/src/services/sqlite.ts +246 -8
- package/mcp-server/src/services/typesafe-config.ts +25 -6
- package/mcp-server/src/services/typesafe.ts +9 -7
- package/mcp-server/src/services/vector-cache.ts +154 -9
- package/mcp-server/src/tools/agents.ts +26 -9
- package/mcp-server/src/tools/browser-advanced.ts +10 -3
- package/mcp-server/src/tools/browser-extension-setup.ts +36 -0
- package/mcp-server/src/tools/browser-interact.ts +5 -1
- package/neural-interface/i18n/en.json +313 -2
- package/neural-interface/i18n/pt-BR.json +321 -10
- package/neural-interface/lib/agents/split.js +32 -4
- package/neural-interface/lib/assistant-api.js +52 -8
- package/neural-interface/lib/assistant-brains/claude.js +2 -0
- package/neural-interface/lib/assistant-brains/opencode.js +121 -7
- package/neural-interface/lib/assistant-catalog.js +2 -2
- package/neural-interface/lib/assistant-config.js +0 -7
- package/neural-interface/lib/assistant-dispatch.js +281 -95
- package/neural-interface/lib/assistant-envelope.js +40 -0
- package/neural-interface/lib/assistant-persona.js +16 -4
- package/neural-interface/lib/assistant-pricing.js +65 -14
- package/neural-interface/lib/assistant-router.js +131 -47
- package/neural-interface/lib/assistant-run-wait.js +45 -28
- package/neural-interface/lib/assistant-runtime.js +133 -42
- package/neural-interface/lib/backup-contents.js +158 -0
- package/neural-interface/lib/backup-crypto-io.js +330 -0
- package/neural-interface/lib/backup-crypto-worker.js +130 -0
- package/neural-interface/lib/backup-crypto.js +525 -0
- package/neural-interface/lib/backup-download.js +268 -0
- package/neural-interface/lib/backup-encryption.js +318 -0
- package/neural-interface/lib/backup-groups.js +287 -0
- package/neural-interface/lib/backup-restore-session.js +176 -0
- package/neural-interface/lib/backup-restore-stage.js +60 -0
- package/neural-interface/lib/backup-service.js +788 -233
- package/neural-interface/lib/backup-zip-reader.js +30 -18
- package/neural-interface/lib/backup-zip-writer.js +34 -10
- package/neural-interface/lib/browser-extension-adapter.js +89 -15
- package/neural-interface/lib/browser-extension-archive.js +149 -0
- package/neural-interface/lib/browser-extension-bridge.js +24 -10
- package/neural-interface/lib/browser-extension-folder.js +596 -76
- package/neural-interface/lib/browser-extension-package.js +200 -0
- package/neural-interface/lib/browser-extension-pin.js +84 -0
- package/neural-interface/lib/browser-extension-pin.json +33 -0
- package/{browser-extension/protocol.js → neural-interface/lib/browser-extension-protocol.js} +91 -6
- package/neural-interface/lib/browser-extension-setup.js +105 -18
- package/neural-interface/lib/claude-agent-bridge.js +1 -0
- package/neural-interface/lib/claude-session-cleanup.js +5 -1
- package/neural-interface/lib/cli-install.js +23 -3
- package/neural-interface/lib/cli-update-planner.js +171 -9
- package/neural-interface/lib/client-diagnostics.js +42 -0
- package/neural-interface/lib/confined-fs.js +7 -2
- package/neural-interface/lib/coordination/README.md +8 -2
- package/neural-interface/lib/coordination/contract.js +161 -0
- package/neural-interface/lib/coordination/database.js +999 -0
- package/neural-interface/lib/coordination/operations.js +436 -0
- package/neural-interface/lib/coordination/service.js +68 -537
- package/neural-interface/lib/coordination/storage-worker.js +101 -0
- package/neural-interface/lib/coordination/store.js +219 -1111
- package/neural-interface/lib/db.js +70 -32
- package/neural-interface/lib/health-count.js +37 -0
- package/neural-interface/lib/loop-stall.js +139 -0
- package/neural-interface/lib/maritaca/client.js +2 -2
- package/neural-interface/lib/maritaca/models.js +12 -17
- package/neural-interface/lib/maritaca/opencode.js +4 -2
- package/neural-interface/lib/memory-api.js +9 -1
- package/neural-interface/lib/memory-session-capture.js +42 -10
- package/neural-interface/lib/memory-store-gate.js +313 -0
- package/neural-interface/lib/memory-store-migrate.js +65 -0
- package/neural-interface/lib/memory-timers.js +7 -7
- package/neural-interface/lib/native-loop-providers.js +23 -17
- package/neural-interface/lib/native-loop-runtime.js +48 -9
- package/neural-interface/lib/opencode-build-preflight.js +18 -1
- package/neural-interface/lib/opencode-native-boundary.js +69 -8
- package/neural-interface/lib/opencode-provider-view.js +14 -3
- package/neural-interface/lib/opencode-shell-read.js +107 -0
- package/neural-interface/lib/opencode-stop-failures.js +40 -0
- package/neural-interface/lib/opencode-turn-release.js +173 -0
- package/neural-interface/lib/opencode-v2-client.js +4 -1
- package/neural-interface/lib/opencode-v2-ws-requests.js +65 -1
- package/neural-interface/lib/opencode2-client.js +343 -7
- package/neural-interface/lib/opencode2-translate.js +161 -4
- package/neural-interface/lib/recall-impact.js +122 -0
- package/neural-interface/lib/scratch-evidence.js +420 -0
- package/neural-interface/lib/scratch-process-guard.js +139 -0
- package/neural-interface/lib/scratch-references.js +279 -0
- package/neural-interface/lib/scratch-retention-core.js +385 -0
- package/neural-interface/lib/scratch-retention-worker.js +37 -0
- package/neural-interface/lib/scratch-retention.js +151 -0
- package/neural-interface/lib/session-cache-builder.js +31 -43
- package/neural-interface/lib/session-cache-worker.js +157 -0
- package/neural-interface/lib/session-indexer.js +28 -21
- package/neural-interface/lib/session-search-index.js +85 -0
- package/neural-interface/lib/skills/creation.js +1 -1
- package/neural-interface/lib/sqlite-integrity-worker.js +3 -1
- package/neural-interface/lib/style-guide/store.js +43 -3
- package/neural-interface/lib/system-restore.js +50 -0
- package/neural-interface/lib/teams/api.js +15 -6
- package/neural-interface/lib/teams/claims.js +67 -31
- package/neural-interface/lib/teams/index.js +7 -7
- package/neural-interface/lib/teams/integration.js +40 -40
- package/neural-interface/lib/teams/landing.js +6 -6
- package/neural-interface/lib/teams/recovery.js +24 -23
- package/neural-interface/lib/teams/scheduler.js +194 -95
- package/neural-interface/lib/teams/state.js +14 -14
- package/neural-interface/lib/teams/worktrees.js +27 -27
- package/neural-interface/lib/terminal-token-redaction.js +83 -0
- package/neural-interface/lib/whatsapp/bridge.js +54 -7
- package/neural-interface/lib/worker-confinement.js +47 -2
- package/neural-interface/lib/worker-mcp-channel.js +2 -0
- package/neural-interface/lib/worker-resume.js +5 -0
- package/neural-interface/lib/worker-stop.js +86 -0
- package/neural-interface/package-lock.json +5 -5
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +5 -2
- package/neural-interface/public/index.html +233 -24
- package/neural-interface/public/onboarding.html +259 -34
- package/neural-interface/public/shared/agents/studio/ax-library.js +0 -6
- package/neural-interface/public/shared/agents/studio/ax-main.js +14 -7
- package/neural-interface/public/shared/agy/agy-options.js +11 -0
- package/neural-interface/public/shared/agy/agy-panel.js +67 -20
- package/neural-interface/public/shared/agy/agy-styles.js +14 -12
- package/neural-interface/public/shared/agy/agy-tabs-logic.js +4 -1
- package/neural-interface/public/shared/api.js +1 -1
- package/neural-interface/public/shared/assistant/asst-api.js +28 -3
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +13 -6
- package/neural-interface/public/shared/assistant/asst-control.js +2 -0
- package/neural-interface/public/shared/assistant/asst-motion-gate.js +78 -4
- package/neural-interface/public/shared/assistant/asst-panel.js +87 -3
- package/neural-interface/public/shared/assistant/asst-rack-styles.js +27 -0
- package/neural-interface/public/shared/assistant/asst-render.js +243 -44
- package/neural-interface/public/shared/assistant/asst-route.js +100 -21
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +1 -1
- package/neural-interface/public/shared/assistant/asst-shell-logic.js +200 -0
- package/neural-interface/public/shared/assistant/asst-shell.js +111 -0
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +4 -2
- package/neural-interface/public/shared/assistant/asst-state.js +11 -0
- package/neural-interface/public/shared/assistant/asst-styles.js +11 -23
- package/neural-interface/public/shared/assistant/route-identity.js +2 -1
- package/neural-interface/public/shared/cdx/cdx-render.js +9 -0
- package/neural-interface/public/shared/cdx/cdx-settings.js +3 -1
- package/neural-interface/public/shared/cdx/cdx-styles.js +6 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +54 -9
- package/neural-interface/public/shared/client-diagnostics.js +94 -0
- package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
- package/neural-interface/public/shared/cp/cp-styles.js +1 -1
- package/neural-interface/public/shared/effort-i18n.js +118 -0
- package/neural-interface/public/shared/extension-setup/es-page.js +10 -4
- package/neural-interface/public/shared/extension-setup/es-view.js +25 -10
- package/neural-interface/public/shared/html-shell.js +4 -52
- package/neural-interface/public/shared/loading-diagnostic-entry.js +64 -0
- package/neural-interface/public/shared/memory-store-wait.js +52 -0
- package/neural-interface/public/shared/morelogin-profile-field.js +1 -1
- package/neural-interface/public/shared/mtc/mtc-logic.js +2 -1
- package/neural-interface/public/shared/mtc/mtc-panel.js +25 -3
- package/neural-interface/public/shared/mtc/mtc-styles.js +13 -12
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +7 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +5 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-location-logic.js +109 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +1 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +8 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +152 -8
- package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +53 -4
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +52 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +22 -2
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-block.js +165 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-logic.js +346 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-shell.js +108 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +49 -3
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +67 -93
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools-logic.js +20 -5
- package/neural-interface/public/shared/ocp-v2/ocp-v2-tools.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-variantpicker.js +17 -6
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +7 -2
- package/neural-interface/public/shared/output-format.js +294 -0
- package/neural-interface/public/shared/provider-icons.js +6 -0
- package/neural-interface/public/shared/schedules-view.js +2 -1
- package/neural-interface/public/shared/server-presence.js +77 -0
- package/neural-interface/public/shared/settings/settings-backup-contents.js +241 -0
- package/neural-interface/public/shared/settings/settings-backup-download.js +298 -0
- package/neural-interface/public/shared/settings/settings-backup-encryption-pane.js +335 -0
- package/neural-interface/public/shared/settings/settings-backup-encryption.js +545 -0
- package/neural-interface/public/shared/settings/settings-browser-extension.js +54 -12
- package/neural-interface/public/shared/settings/settings-ia.js +1 -1
- package/neural-interface/public/shared/shell-stop-view.js +83 -0
- package/neural-interface/public/shared/skills/studio/sx-geometry.js +12 -3
- package/neural-interface/public/shared/skills/studio/sx-main.js +14 -7
- package/neural-interface/public/shared/studio-attention.js +6 -0
- package/neural-interface/public/shared/styles.css +341 -437
- package/neural-interface/public/shared/tour/tour-actor.js +14 -3
- package/neural-interface/public/shared/transcript-rows.js +28 -3
- package/neural-interface/public/shared/tray-auto-close.js +49 -6
- package/neural-interface/public/shared/ui-agents.js +1 -2
- package/neural-interface/public/shared/ui-automation-studio.js +168 -108
- package/neural-interface/public/shared/ui-claude-panel.js +62 -65
- package/neural-interface/public/shared/ui-loading.js +124 -17
- package/neural-interface/public/shared/ui-native-loop-router.js +52 -0
- package/neural-interface/public/shared/ui-navbar.js +2 -1
- package/neural-interface/public/shared/ui-output.js +533 -0
- package/neural-interface/public/shared/ui-schedules-studio.js +165 -128
- package/neural-interface/public/shared/ui-scroll-follow.js +101 -6
- package/neural-interface/public/shared/ui-sessions.js +2 -2
- package/neural-interface/public/shared/ui-settings-entry.js +18 -0
- package/neural-interface/public/shared/ui-settings.js +224 -65
- package/neural-interface/public/shared/ui-sidepanel-tray.js +3 -2
- package/neural-interface/public/shared/ui-tooltip.js +16 -0
- package/neural-interface/public/shared/ui-tutorial.js +5 -6
- package/neural-interface/public/shared/ui-worker-end.js +27 -8
- package/neural-interface/public/shared/worker-end.js +9 -4
- package/neural-interface/public/variant/2d/main.js +5 -0
- package/neural-interface/public/variant/3d/app.js +10 -0
- package/neural-interface/public/variant/3d/main.js +5 -1
- package/neural-interface/scripts/scratch-retention.mjs +20 -0
- package/neural-interface/server.js +725 -173
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -2
- package/scripts/restore-data-home-from-backup.mjs +175 -8
- package/setup.js +18 -4
- package/browser-extension/content.js +0 -189
- package/browser-extension/engine.js +0 -508
- 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 +0 -56
- package/browser-extension/popup-strings.js +0 -250
- package/browser-extension/popup-view.js +0 -151
- package/browser-extension/popup.css +0 -166
- package/browser-extension/popup.html +0 -108
- package/browser-extension/popup.js +0 -359
- package/browser-extension/service-worker.js +0 -275
- package/browser-extension/setup-content.js +0 -36
- package/browser-extension/tokens.css +0 -326
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { channel, command, CONTROL, equalMac, fail, hostPattern, localDeadline, mac, nonce, object, pairingKey, parse, payload, QUEUE_LIMIT, reserve, safeError } from './protocol.js';
|
|
2
|
-
import { createEngine } from './engine.js';
|
|
3
|
-
import { badgeFor } from './popup-view.js';
|
|
4
|
-
import { popupLocale, translator } from './popup-strings.js';
|
|
5
|
-
let socket = null, wire = null, credential = null, port = 3345, paused = false, pairing = false;
|
|
6
|
-
// Handshakes in a row the server refused for the stored credential (it closed the socket after our resume hello):
|
|
7
|
-
// the server no longer takes that pairing (revoked, expired, a server that lost it), so SynaBun's setup page may pair
|
|
8
|
-
// this extension again (setupPair). Reset by every connection that authenticates.
|
|
9
|
-
let refusals = 0;
|
|
10
|
-
// The manifest version, sent in the hello so SynaBun can tell the owner when the browser runs an older copy than its
|
|
11
|
-
// extension folder holds (Reload needed). Absent where the runtime has no manifest (tests).
|
|
12
|
-
const extensionVersion = (() => { try { return String(chrome.runtime.getManifest?.()?.version || '') || null; } catch { return null; } })();
|
|
13
|
-
// `incoming` authenticates messages in order and is never held up by a command; `work` runs ordinary commands one at a time.
|
|
14
|
-
let delay = 1000, reconnectTimer, retryAt = 0, status = 'Disconnected', outbound = Promise.resolve(), incoming = Promise.resolve(), work = Promise.resolve();
|
|
15
|
-
// Bind queued sends to their original channel. A late signature must never go to a replacement socket.
|
|
16
|
-
const send = value => {
|
|
17
|
-
const ws = socket, channelOut = wire;
|
|
18
|
-
outbound = outbound.catch(() => {}).then(async () => {
|
|
19
|
-
if (!channelOut || socket !== ws || wire !== channelOut || ws?.readyState !== WebSocket.OPEN) return;
|
|
20
|
-
payload(value);
|
|
21
|
-
await channelOut.encode(value, raw => {
|
|
22
|
-
if (socket !== ws || wire !== channelOut || ws.readyState !== WebSocket.OPEN) fail('NOT_CONNECTED');
|
|
23
|
-
ws.send(raw);
|
|
24
|
-
});
|
|
25
|
-
}); return outbound;
|
|
26
|
-
};
|
|
27
|
-
const engine = createEngine(chrome, {
|
|
28
|
-
async readUpload(id, index, timeout) {
|
|
29
|
-
const response = await fetch(`http://127.0.0.1:${port}/upload/${index}`, {
|
|
30
|
-
method: 'POST', headers: { Authorization: `Bearer ${id}` }, redirect: 'error',
|
|
31
|
-
credentials: 'omit', cache: 'no-store', signal: AbortSignal.timeout(Math.ceil(timeout)),
|
|
32
|
-
});
|
|
33
|
-
if (!response.ok) fail(response.status === 400 ? await response.text() : 'CANCELLED');
|
|
34
|
-
return response.blob();
|
|
35
|
-
},
|
|
36
|
-
save: async value => {
|
|
37
|
-
const { tabs, ...prefs } = value;
|
|
38
|
-
await chrome.storage.session.set({ bridgeTabs: tabs });
|
|
39
|
-
await chrome.storage.local.set({ bridgePrefs: prefs });
|
|
40
|
-
},
|
|
41
|
-
changed: inventory => { if (wire) void send({ type: 'state', inventory }).catch(() => {}); void badge().catch(() => {}); },
|
|
42
|
-
});
|
|
43
|
-
// The toolbar icon and its tooltip (docs/design/browser-extension → Toolbar badge): no badge text, a status dot in the
|
|
44
|
-
// icon's corner instead: green while connected to SynaBun (agents holding tabs or not), red otherwise (connecting,
|
|
45
|
-
// reconnecting, paused, not paired, refused). The tooltip says the exact state and the number of agent tabs in the
|
|
46
|
-
// browser's language. Only what this worker already knows is read; nothing here changes the connection.
|
|
47
|
-
const badgeText = translator(popupLocale([(() => { try { return chrome.i18n?.getUILanguage?.(); } catch { return ''; } })(), globalThis.navigator?.language].filter(Boolean)));
|
|
48
|
-
async function badge() {
|
|
49
|
-
let controlled = 0;
|
|
50
|
-
try { controlled = engine.current().tabs.filter(tab => tab.owner).length; } catch {}
|
|
51
|
-
const shown = badgeFor({ connected: !!wire, paired: !!credential, paused, connecting: status === 'Connecting', refused: refusals, controlled }, badgeText);
|
|
52
|
-
// Side by side: one call that never settles (a busy toolbar) holds up neither of the others.
|
|
53
|
-
await Promise.all([
|
|
54
|
-
chrome.action.setIcon({ path: { ...shown.icon } }),
|
|
55
|
-
chrome.action.setBadgeText({ text: '' }),
|
|
56
|
-
chrome.action.setTitle({ title: shown.title }),
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
const ready = (async () => {
|
|
60
|
-
await chrome.storage.local.setAccessLevel({ accessLevel: 'TRUSTED_CONTEXTS' });
|
|
61
|
-
const saved = await chrome.storage.local.get(['credential', 'port', 'paused', 'bridgePrefs']);
|
|
62
|
-
const session = await chrome.storage.session.get('bridgeTabs');
|
|
63
|
-
credential = saved.credential || null; port = saved.port || 3345; paused = saved.paused === true;
|
|
64
|
-
await engine.restore({ ...saved.bridgePrefs, tabs: session.bridgeTabs || [] });
|
|
65
|
-
await chrome.alarms.create('synabun-reconnect', { periodInMinutes: 0.5 });
|
|
66
|
-
void badge().catch(() => {});
|
|
67
|
-
})();
|
|
68
|
-
// Ends a connection. The engine's connection generation moves first, synchronously, so nothing that came on it does
|
|
69
|
-
// anything more: a queued command is refused before it starts, a running one before its next browser action.
|
|
70
|
-
function drop(ws) { if (socket === ws) engine.disconnected(); ws.close(); }
|
|
71
|
-
const coded = code => Object.assign(new Error(code), { code });
|
|
72
|
-
// Runs a command and answers on the connection it came on, if that connection is still the current one. A server
|
|
73
|
-
// revoke or disconnect ends that connection only: a pairing, resume or pause made in the popup meanwhile is newer and
|
|
74
|
-
// wins (`connection` is the generation the control message itself set).
|
|
75
|
-
async function answer(ws, message, running, connection) {
|
|
76
|
-
let result;
|
|
77
|
-
try { result = await running; } catch (error) { result = safeError(error); }
|
|
78
|
-
if (socket === ws && wire) {
|
|
79
|
-
try { await send({ type: 'result', id: message.id, result, inventory: engine.current() }); }
|
|
80
|
-
catch (error) { await send({ type: 'result', id: message.id, result: safeError(error), inventory: engine.current() }).catch(() => {}); }
|
|
81
|
-
}
|
|
82
|
-
const current = () => socket === ws && engine.ticket().connection === connection;
|
|
83
|
-
if (message.op === 'revoke' && current()) { credential = null; await chrome.storage.local.remove('credential'); drop(ws); }
|
|
84
|
-
if (message.op === 'disconnect' && current()) { paused = true; await chrome.storage.local.set({ paused }); drop(ws); }
|
|
85
|
-
}
|
|
86
|
-
// Ordinary commands not yet finished, by id, so the server's cancel can stop one ahead of the queue.
|
|
87
|
-
const commands = new Map();
|
|
88
|
-
// Queues an ordinary command under its deadline (`held.expires`, set when the message arrived). One timer, armed at
|
|
89
|
-
// arrival: at the deadline the command's ticket is stopped (so nothing it would still do reaches the browser) and it is
|
|
90
|
-
// answered TIMEOUT on its own channel if that is still current. A command still queued then is dropped and never starts,
|
|
91
|
-
// and so is one whose turn comes later than `held.startBy` (one margin before its deadline). Once it starts, the timer
|
|
92
|
-
// is re-armed for the earlier of the deadline and QUEUE_LIMIT, the watchdog for a browser call that never returns;
|
|
93
|
-
// either way the queue moves on to the next command at once. The server's cancel calls the same `expire`.
|
|
94
|
-
function enqueue(ws, message, held) {
|
|
95
|
-
let timer, started = false, expire;
|
|
96
|
-
const limit = new Promise((_resolve, reject) => { expire = () => { held.stopped = true; reject(coded('TIMEOUT')); }; });
|
|
97
|
-
limit.catch(() => { if (!started) void answer(ws, message, limit).catch(() => {}); });
|
|
98
|
-
// A delay above 2^31-1 ms would fire at once; no real deadline comes near it.
|
|
99
|
-
const arm = ms => { clearTimeout(timer); timer = setTimeout(expire, Math.min(2147483647, Math.max(0, ms))); };
|
|
100
|
-
const done = () => { clearTimeout(timer); if (commands.get(message.id) === expire) commands.delete(message.id); };
|
|
101
|
-
commands.set(message.id, expire);
|
|
102
|
-
arm(held.expires - engine.now());
|
|
103
|
-
work = work.catch(() => {}).then(() => {
|
|
104
|
-
if (!held.stopped && engine.now() >= held.startBy) expire();
|
|
105
|
-
if (held.stopped) { done(); return; }
|
|
106
|
-
started = true; arm(Math.min(QUEUE_LIMIT, held.expires - engine.now()));
|
|
107
|
-
return answer(ws, message, Promise.race([engine.execute(message, held), limit]).finally(done));
|
|
108
|
-
}).catch(() => {}); // A command failure is an answer, never a transport revocation.
|
|
109
|
-
}
|
|
110
|
-
function schedule() {
|
|
111
|
-
clearTimeout(reconnectTimer);
|
|
112
|
-
if (!paused && credential) {
|
|
113
|
-
retryAt = Date.now() + delay;
|
|
114
|
-
// Alarms wake a suspended MV3 worker; the timer gives a live worker the shorter backoff.
|
|
115
|
-
void chrome.alarms.create('synabun-retry', { when: retryAt });
|
|
116
|
-
reconnectTimer = setTimeout(() => { void connect(); }, delay); delay = Math.min(delay * 2, 30000);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async function connect() {
|
|
120
|
-
await ready;
|
|
121
|
-
if (paused || !credential || socket && [0, 1].includes(socket.readyState)) return;
|
|
122
|
-
let ws;
|
|
123
|
-
try { ws = new WebSocket(`ws://127.0.0.1:${port}/bridge`); } catch { schedule(); return; }
|
|
124
|
-
socket = ws;
|
|
125
|
-
let session, key, client = nonce(), hello = null; wire = null; status = 'Connecting';
|
|
126
|
-
// Register socket callbacks before any Chrome API await: a delayed badge must not lose the challenge.
|
|
127
|
-
void badge().catch(() => {});
|
|
128
|
-
const timer = setTimeout(() => { if (!wire) ws.close(); }, 10000);
|
|
129
|
-
ws.onmessage = event => {
|
|
130
|
-
// A command's deadline counts from here, before it waits to be authenticated.
|
|
131
|
-
const receivedAt = engine.now();
|
|
132
|
-
incoming = incoming.catch(() => {}).then(async () => {
|
|
133
|
-
if (socket !== ws) return;
|
|
134
|
-
if (!wire) {
|
|
135
|
-
const msg = parse(event.data, 2048);
|
|
136
|
-
if (msg.type === 'challenge' && !session) {
|
|
137
|
-
object(msg, ['type', 'session']); if (!/^[a-f0-9]{32}$/.test(msg.session)) fail('INVALID_MESSAGE');
|
|
138
|
-
session = msg.session; key = credential; hello = pairing ? 'pair' : 'resume';
|
|
139
|
-
ws.send(JSON.stringify({ type: 'hello', mode: hello, client, proof: await mac(key, `hello:${session}:${client}`), ...(extensionVersion ? { version: extensionVersion } : {}) }));
|
|
140
|
-
} else {
|
|
141
|
-
object(msg, ['type', 'proof']);
|
|
142
|
-
if (msg.type !== 'welcome' || !session || !await equalMac(key, `welcome:${session}:${client}`, msg.proof)) fail('AUTH_FAILED');
|
|
143
|
-
// A pairing, revoke or pause in the popup during that await replaced or ended this socket's authority.
|
|
144
|
-
if (socket !== ws || credential !== key || paused) fail('AUTH_FAILED');
|
|
145
|
-
wire = channel(key, session, 'extension'); pairing = false; refusals = 0; delay = 1000; retryAt = 0; clearTimeout(timer); clearTimeout(reconnectTimer);
|
|
146
|
-
await chrome.storage.local.set({ credential: key, port, paused: false });
|
|
147
|
-
status = 'Connected'; void badge().catch(() => {}); await send({ type: 'state', inventory: engine.current() });
|
|
148
|
-
}
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
// The socket, its channel and the generations are taken before decoding: a pause, unpairing or new pairing
|
|
152
|
-
// that completes during the await ends this message's authority, and nothing of it reaches the browser.
|
|
153
|
-
const channelIn = wire, arrived = engine.ticket();
|
|
154
|
-
const message = payload(await channelIn.decode(event.data));
|
|
155
|
-
if (socket !== ws || wire !== channelIn || engine.ticket().connection !== arrived.connection) {
|
|
156
|
-
// Refused with no effect, control messages included; an answer goes only to the channel it came on, if open.
|
|
157
|
-
if (message.type === 'command' && socket === ws && wire === channelIn) {
|
|
158
|
-
await send({ type: 'result', id: message.id, result: safeError(coded('NOT_CONNECTED')), inventory: engine.current() });
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (message.type === 'ping') { await send({ type: 'pong' }); return; }
|
|
163
|
-
// The server stopped waiting for a command: stop it now, ahead of the queue, as at its deadline.
|
|
164
|
-
if (message.type === 'cancel') { commands.get(message.id)?.(); return; }
|
|
165
|
-
command(message);
|
|
166
|
-
// Owner revocations apply at once, ahead of commands still queued or running; those then find their ticket stale.
|
|
167
|
-
if (CONTROL.includes(message.op)) {
|
|
168
|
-
const running = engine.execute(message);
|
|
169
|
-
await answer(ws, message, running, engine.ticket().connection); return;
|
|
170
|
-
}
|
|
171
|
-
// An ordinary command keeps the approval and connection generations of the moment it arrived (before its
|
|
172
|
-
// decoding) and its deadline from that same moment, then waits its turn (enqueue).
|
|
173
|
-
const expires = localDeadline(receivedAt, message.deadline);
|
|
174
|
-
enqueue(ws, message, { ...arrived, stopped: false, expires, startBy: expires - reserve(message.deadline) });
|
|
175
|
-
}).catch(() => { status = 'Connection refused — pair again'; drop(ws); });
|
|
176
|
-
};
|
|
177
|
-
ws.onerror = () => { status = 'Not connected — check SynaBun and the port'; };
|
|
178
|
-
ws.onclose = () => {
|
|
179
|
-
clearTimeout(timer); if (socket !== ws) return;
|
|
180
|
-
// Closed after our resume hello and before a welcome: the server refused the stored credential.
|
|
181
|
-
if (!wire && hello === 'resume') refusals++;
|
|
182
|
-
engine.disconnected(); socket = wire = null; status = paused ? 'Paused' : 'Disconnected — reconnecting'; void badge().catch(() => {}); schedule();
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
chrome.alarms.onAlarm.addListener(alarm => {
|
|
186
|
-
if (['synabun-reconnect', 'synabun-retry'].includes(alarm.name)) {
|
|
187
|
-
if (Date.now() >= retryAt) void connect();
|
|
188
|
-
void ready.then(() => engine.opened()).catch(() => {});
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
chrome.tabs.onActivated.addListener(() => engine.activated());
|
|
192
|
-
chrome.tabs.onRemoved.addListener(id => { void ready.then(() => engine.closed(id)); });
|
|
193
|
-
chrome.tabs.onUpdated.addListener((id, change) => {
|
|
194
|
-
if (change.url) void ready.then(() => engine.updated(id));
|
|
195
|
-
else if (change.title !== undefined) void ready.then(() => engine.retitled(id));
|
|
196
|
-
});
|
|
197
|
-
// Full control lists every tab of the browser: a new one is listed as soon as it opens.
|
|
198
|
-
chrome.tabs.onCreated.addListener(() => { void ready.then(() => engine.opened()); });
|
|
199
|
-
chrome.permissions.onRemoved.addListener(() => { engine.withdrawn(); void ready.then(async () => {
|
|
200
|
-
for (const site of engine.current().sites) if (!await chrome.permissions.contains({ origins: [hostPattern(site)] })) await engine.revokeSite(site);
|
|
201
|
-
}); });
|
|
202
|
-
// ── One-button setup: SynaBun's "Connect your browser" page hands over a one-time token (setup-content.js) ──
|
|
203
|
-
// Accepted only from this extension's own content script, in the top frame of a tab, on exactly the setup page's origin
|
|
204
|
-
// and path as this manifest names them (SynaBun's app port on 127.0.0.1 and localhost), from a tab no agent holds, and
|
|
205
|
-
// only while this extension needs pairing: never paired, or the server refused its stored credential twice in a row.
|
|
206
|
-
// A paired, working or paused extension is never re-paired by a page (the popup and SynaBun's typed code still can).
|
|
207
|
-
// The token is used exactly like a typed code (pairingKey, the same HMAC handshake): it never crosses the socket, and
|
|
208
|
-
// the server accepts it once. Nothing of it is stored but the credential the handshake derives, as with a typed code.
|
|
209
|
-
const SETUP_KIND = 'synabun-setup-pair';
|
|
210
|
-
function setupPages() {
|
|
211
|
-
try {
|
|
212
|
-
return (chrome.runtime.getManifest?.()?.content_scripts || []).flatMap(entry => entry.js?.includes('setup-content.js') ? entry.matches || [] : [])
|
|
213
|
-
.map(pattern => { const u = new URL(pattern.replace(/\*$/, '')); return `${u.origin}${u.pathname}`; });
|
|
214
|
-
} catch { return []; }
|
|
215
|
-
}
|
|
216
|
-
function setupSender(sender) {
|
|
217
|
-
if (sender?.id !== chrome.runtime.id || !sender.tab || !Number.isSafeInteger(sender.tab.id) || sender.frameId !== 0) return false;
|
|
218
|
-
let u; try { u = new URL(sender.url); } catch { return false; }
|
|
219
|
-
if (u.protocol !== 'http:' || u.username || u.password) return false;
|
|
220
|
-
if (sender.origin !== undefined && sender.origin !== u.origin) return false;
|
|
221
|
-
return setupPages().includes(`${u.origin}${u.pathname}`);
|
|
222
|
-
}
|
|
223
|
-
let setupAt = 0;
|
|
224
|
-
async function setupPair(msg, sender) {
|
|
225
|
-
await ready;
|
|
226
|
-
const refuse = code => ({ ok: false, code });
|
|
227
|
-
try { object(msg, ['kind', 'token', 'bridgePort']); } catch { return refuse('INVALID_MESSAGE'); }
|
|
228
|
-
if (msg.kind !== SETUP_KIND || typeof msg.token !== 'string' || !/^[a-f0-9]{64}$/.test(msg.token)
|
|
229
|
-
|| !Number.isInteger(msg.bridgePort) || msg.bridgePort < 1024 || msg.bridgePort > 65535) return refuse('INVALID_MESSAGE');
|
|
230
|
-
// A tab an agent holds is never where pairing comes from (agents never reach SynaBun's pages anyway).
|
|
231
|
-
if (engine.heldByAgent(sender.tab.id)) return refuse('NOT_OWNED');
|
|
232
|
-
if (wire) return refuse('ALREADY_CONNECTED');
|
|
233
|
-
if (credential && paused) return refuse('PAUSED');
|
|
234
|
-
if (credential && !pairing && refusals < 2) return refuse('ALREADY_PAIRED');
|
|
235
|
-
if (Date.now() - setupAt < 2000) return refuse('BUSY');
|
|
236
|
-
setupAt = Date.now();
|
|
237
|
-
// A new pairing ends what the old one allowed, before anything is awaited (as the popup's pair does).
|
|
238
|
-
engine.disconnected(); socket?.close(); socket = wire = null; await engine.clear();
|
|
239
|
-
credential = await pairingKey(msg.token); port = msg.bridgePort; pairing = true; paused = false; refusals = 0; void connect();
|
|
240
|
-
return { ok: true };
|
|
241
|
-
}
|
|
242
|
-
chrome.runtime.onMessage.addListener((msg, sender, respond) => {
|
|
243
|
-
if (sender.tab) {
|
|
244
|
-
if (msg?.kind !== SETUP_KIND || !setupSender(sender)) return;
|
|
245
|
-
setupPair(msg, sender).then(respond, () => respond({ ok: false, code: 'REFUSED' }));
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
if (sender.id !== chrome.runtime.id || sender.url !== chrome.runtime.getURL('popup.html') || sender.tab) return;
|
|
249
|
-
(async () => {
|
|
250
|
-
await ready; object(msg, ['action', 'code', 'port', 'tab', 'site', 'options', 'siteOnly', 'fullControl']);
|
|
251
|
-
if (msg.action === 'pair') {
|
|
252
|
-
if (!/^[a-fA-F0-9-]{20,24}$/.test(msg.code) || !Number.isInteger(msg.port) || msg.port < 1024 || msg.port > 65535) fail('INVALID_MESSAGE');
|
|
253
|
-
// A new pairing ends what the old one allowed, before anything is awaited.
|
|
254
|
-
engine.disconnected(); socket?.close(); socket = wire = null; await engine.clear();
|
|
255
|
-
credential = await pairingKey(msg.code); port = msg.port; pairing = true; paused = false; void connect();
|
|
256
|
-
} else if (msg.action === 'share') await engine.share(msg.tab, msg.siteOnly === true);
|
|
257
|
-
else if (msg.action === 'revokeTab') await engine.revokeTab(msg.tab);
|
|
258
|
-
else if (msg.action === 'revokeSite') await engine.revokeSite(msg.site);
|
|
259
|
-
else if (msg.action === 'options') await engine.options(msg.options);
|
|
260
|
-
// The owner's mode switch. Restricted takes effect here at once (a revocation); the server hears it with the
|
|
261
|
-
// next inventory, which carries the newer mode version.
|
|
262
|
-
else if (msg.action === 'mode') { if (typeof msg.fullControl !== 'boolean') fail('INVALID_MESSAGE'); await engine.setMode(msg.fullControl); }
|
|
263
|
-
else if (msg.action === 'disconnect') { engine.disconnected(); paused = true; await chrome.storage.local.set({ paused }); socket?.close(); }
|
|
264
|
-
else if (msg.action === 'resume') { paused = false; await chrome.storage.local.set({ paused }); void connect(); }
|
|
265
|
-
else if (msg.action === 'revoke') {
|
|
266
|
-
engine.disconnected(); const cleared = engine.clear();
|
|
267
|
-
await send({ type: 'unpair' }); credential = null; paused = true; socket?.close(); await cleared;
|
|
268
|
-
await chrome.storage.local.remove('credential'); await chrome.storage.local.set({ paused });
|
|
269
|
-
} else if (msg.action !== 'status') fail('INVALID_MESSAGE');
|
|
270
|
-
if (msg.action !== 'status') void badge().catch(() => {});
|
|
271
|
-
return { ok: true, status, connected: !!wire, port, ...engine.current() };
|
|
272
|
-
})().then(respond, error => respond(safeError(error)));
|
|
273
|
-
return true;
|
|
274
|
-
});
|
|
275
|
-
void connect();
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// SynaBun's "Connect your browser" page (/extension-setup on SynaBun's own app port; the manifest's content_scripts
|
|
2
|
-
// names exactly that origin and path, and the copy SynaBun prepares names the port it runs on). This script tells the
|
|
3
|
-
// page the extension is installed, and hands the service worker the page's one-time pairing token. Nothing else.
|
|
4
|
-
//
|
|
5
|
-
// It runs in the isolated world, top frame only, and acts only on that exact origin and path (checked again here and
|
|
6
|
-
// by the service worker against sender.url). It never reads anything but the one ticket element the page fills in,
|
|
7
|
-
// sends nothing anywhere but to this extension's service worker, and keeps no token: the service worker decides
|
|
8
|
-
// whether to pair (only an extension that needs pairing does) and the server accepts a token once.
|
|
9
|
-
(() => {
|
|
10
|
-
const allowed = (() => {
|
|
11
|
-
try {
|
|
12
|
-
const own = chrome.runtime.getManifest().content_scripts || [];
|
|
13
|
-
return own.flatMap(entry => entry.js?.includes('setup-content.js') ? entry.matches || [] : [])
|
|
14
|
-
.map(pattern => { const u = new URL(pattern.replace(/\*$/, '')); return `${u.origin}${u.pathname}`; });
|
|
15
|
-
} catch { return []; }
|
|
16
|
-
})();
|
|
17
|
-
if (window.top !== window || location.protocol !== 'http:' || !allowed.includes(`${location.origin}${location.pathname}`)) return;
|
|
18
|
-
const root = document.documentElement;
|
|
19
|
-
// The page shows "Extension found" from this; it holds the version only.
|
|
20
|
-
root.dataset.synabunExtension = String(chrome.runtime.getManifest().version || '');
|
|
21
|
-
let sent = '';
|
|
22
|
-
async function offer() {
|
|
23
|
-
const ticket = document.getElementById('synabun-setup-ticket');
|
|
24
|
-
const token = ticket?.dataset.token || '', bridgePort = Number(ticket?.dataset.bridgePort);
|
|
25
|
-
if (!/^[a-f0-9]{64}$/.test(token) || token === sent) return;
|
|
26
|
-
sent = token;
|
|
27
|
-
root.dataset.synabunPair = 'sent';
|
|
28
|
-
let answer;
|
|
29
|
-
try { answer = await chrome.runtime.sendMessage({ kind: 'synabun-setup-pair', token, bridgePort }); }
|
|
30
|
-
catch { answer = { ok: false, code: 'EXTENSION_UNAVAILABLE' }; }
|
|
31
|
-
// The page reads the outcome's code only (pairing itself is reported by the server's status).
|
|
32
|
-
root.dataset.synabunPair = answer?.ok ? 'started' : String(answer?.code || 'REFUSED').replace(/[^A-Z_]/g, '').slice(0, 40);
|
|
33
|
-
}
|
|
34
|
-
new MutationObserver(() => { void offer(); }).observe(root, { subtree: true, childList: true, attributes: true, attributeFilter: ['data-token'] });
|
|
35
|
-
void offer();
|
|
36
|
-
})();
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/* SynaBun Style Guide rev 19: design tokens. Generated, do not edit by hand. */
|
|
2
|
-
:root {
|
|
3
|
-
color-scheme: dark;
|
|
4
|
-
--color-primary-50: #cccccc;
|
|
5
|
-
--color-primary-100: #cccccc;
|
|
6
|
-
--color-primary-200: #cccccc;
|
|
7
|
-
--color-primary-300: #cccccc;
|
|
8
|
-
--color-primary-400: #cccccc;
|
|
9
|
-
--color-primary-500: #cccccc;
|
|
10
|
-
--color-primary-600: #cccccc;
|
|
11
|
-
--color-primary-700: #cccccc;
|
|
12
|
-
--color-primary-800: #cccccc;
|
|
13
|
-
--color-primary-900: #cccccc;
|
|
14
|
-
--color-primary-950: #cccccc;
|
|
15
|
-
--color-secondary-50: #d4a27f;
|
|
16
|
-
--color-secondary-100: #d4a27f;
|
|
17
|
-
--color-secondary-200: #d4a27f;
|
|
18
|
-
--color-secondary-300: #d4a27f;
|
|
19
|
-
--color-secondary-400: #d4a27f;
|
|
20
|
-
--color-secondary-500: #d4a27f;
|
|
21
|
-
--color-secondary-600: #d4a27f;
|
|
22
|
-
--color-secondary-700: #d4a27f;
|
|
23
|
-
--color-secondary-800: #d4a27f;
|
|
24
|
-
--color-secondary-900: #d4a27f;
|
|
25
|
-
--color-secondary-950: #d4a27f;
|
|
26
|
-
--color-accent-50: #ffd700;
|
|
27
|
-
--color-accent-100: #ffd700;
|
|
28
|
-
--color-accent-200: #ffd700;
|
|
29
|
-
--color-accent-300: #ffd700;
|
|
30
|
-
--color-accent-400: #ffd700;
|
|
31
|
-
--color-accent-500: #ffd700;
|
|
32
|
-
--color-accent-600: #ffd700;
|
|
33
|
-
--color-accent-700: #ffd700;
|
|
34
|
-
--color-accent-800: #ffd700;
|
|
35
|
-
--color-accent-900: #ffd700;
|
|
36
|
-
--color-accent-950: #ffd700;
|
|
37
|
-
--color-neutral-50: #ffffff;
|
|
38
|
-
--color-neutral-100: #ededed;
|
|
39
|
-
--color-neutral-200: #e0e0e0;
|
|
40
|
-
--color-neutral-300: #cccccc;
|
|
41
|
-
--color-neutral-400: #d0d0d0;
|
|
42
|
-
--color-neutral-500: #1c1c1e;
|
|
43
|
-
--color-neutral-600: #16161a;
|
|
44
|
-
--color-neutral-700: #131316;
|
|
45
|
-
--color-neutral-800: #121214;
|
|
46
|
-
--color-neutral-900: #0a0a0c;
|
|
47
|
-
--color-neutral-950: #050505;
|
|
48
|
-
--color-success: #86efac;
|
|
49
|
-
--color-warning: #fbbf24;
|
|
50
|
-
--color-danger: #fca5a5;
|
|
51
|
-
--color-info: #cccccc;
|
|
52
|
-
--color-globalDanger: #ff5252;
|
|
53
|
-
--color-globalWarning: #ffb74d;
|
|
54
|
-
--color-connected: #30d158;
|
|
55
|
-
--color-codexSuccess: #22c55e;
|
|
56
|
-
--color-codexWarning: #f59e0b;
|
|
57
|
-
--color-codexDanger: #ef4444;
|
|
58
|
-
--color-running: #0ea5e9;
|
|
59
|
-
--color-claudeSuccess: #5fcf83;
|
|
60
|
-
--color-claudeError: #ef7070;
|
|
61
|
-
--color-working: #d4a848;
|
|
62
|
-
--gradient-settings-icon-tile: linear-gradient(180deg, color-mix(in oklab, #6168c9 84%, #fff) 0%, #6168c9 100%);
|
|
63
|
-
--gradient-assistant-gold-wash: radial-gradient(120% 55% at 0% 0%, rgba(255,215,0,.0595) 0%, rgba(255,215,0,.0459) 14%, rgba(255,215,0,.0306) 28%, rgba(255,215,0,.017) 42%, rgba(255,215,0,.0068) 54%, transparent 66%);
|
|
64
|
-
--font-heading: "Space Grotesk", Inter, sans-serif;
|
|
65
|
-
--font-body: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, system-ui, sans-serif;
|
|
66
|
-
--font-mono: "JetBrains Mono", ui-monospace, SF Mono, Menlo, Consolas, monospace;
|
|
67
|
-
--font-display: Caveat, cursive;
|
|
68
|
-
--text-display-size: 1.75rem;
|
|
69
|
-
--text-display-weight: 600;
|
|
70
|
-
--text-display-line-height: 1.2;
|
|
71
|
-
--text-display-letter-spacing: 0;
|
|
72
|
-
--text-display-font: var(--font-heading);
|
|
73
|
-
--text-h1-size: 1.75rem;
|
|
74
|
-
--text-h1-weight: 600;
|
|
75
|
-
--text-h1-line-height: 1.2;
|
|
76
|
-
--text-h1-letter-spacing: 0;
|
|
77
|
-
--text-h1-font: var(--font-heading);
|
|
78
|
-
--text-h2-size: 1.25rem;
|
|
79
|
-
--text-h2-weight: 600;
|
|
80
|
-
--text-h2-line-height: 1.25;
|
|
81
|
-
--text-h2-letter-spacing: 0;
|
|
82
|
-
--text-h2-font: var(--font-heading);
|
|
83
|
-
--text-h3-size: 1.125rem;
|
|
84
|
-
--text-h3-weight: 550;
|
|
85
|
-
--text-h3-line-height: 1.3;
|
|
86
|
-
--text-h3-letter-spacing: 0;
|
|
87
|
-
--text-h3-font: var(--font-heading);
|
|
88
|
-
--text-h4-size: 0.9375rem;
|
|
89
|
-
--text-h4-weight: 600;
|
|
90
|
-
--text-h4-line-height: 1.3;
|
|
91
|
-
--text-h4-letter-spacing: 0;
|
|
92
|
-
--text-h4-font: var(--font-heading);
|
|
93
|
-
--text-body-lg-size: 0.9375rem;
|
|
94
|
-
--text-body-lg-weight: 400;
|
|
95
|
-
--text-body-lg-line-height: 1.5;
|
|
96
|
-
--text-body-lg-letter-spacing: 0;
|
|
97
|
-
--text-body-lg-font: var(--font-body);
|
|
98
|
-
--text-body-size: 0.8125rem;
|
|
99
|
-
--text-body-weight: 400;
|
|
100
|
-
--text-body-line-height: 1.45;
|
|
101
|
-
--text-body-letter-spacing: 0;
|
|
102
|
-
--text-body-font: var(--font-body);
|
|
103
|
-
--text-body-sm-size: 0.875rem;
|
|
104
|
-
--text-body-sm-weight: 400;
|
|
105
|
-
--text-body-sm-line-height: 1.5;
|
|
106
|
-
--text-body-sm-letter-spacing: 0;
|
|
107
|
-
--text-body-sm-font: var(--font-body);
|
|
108
|
-
--text-caption-size: 0.75rem;
|
|
109
|
-
--text-caption-weight: 400;
|
|
110
|
-
--text-caption-line-height: 1.45;
|
|
111
|
-
--text-caption-letter-spacing: 0;
|
|
112
|
-
--text-caption-font: var(--font-body);
|
|
113
|
-
--text-overline-size: 0.7188rem;
|
|
114
|
-
--text-overline-weight: 600;
|
|
115
|
-
--text-overline-line-height: 1.3;
|
|
116
|
-
--text-overline-letter-spacing: 0.02em;
|
|
117
|
-
--text-overline-font: var(--font-body);
|
|
118
|
-
--text-button-size: 0.75rem;
|
|
119
|
-
--text-button-weight: 500;
|
|
120
|
-
--text-button-line-height: 1;
|
|
121
|
-
--text-button-letter-spacing: 0;
|
|
122
|
-
--text-button-font: var(--font-body);
|
|
123
|
-
--text-code-size: 0.75rem;
|
|
124
|
-
--text-code-weight: 400;
|
|
125
|
-
--text-code-line-height: 1.5;
|
|
126
|
-
--text-code-letter-spacing: 0;
|
|
127
|
-
--text-code-font: var(--font-mono);
|
|
128
|
-
--text-handwritten-size: 1.375rem;
|
|
129
|
-
--text-handwritten-weight: 400;
|
|
130
|
-
--text-handwritten-line-height: 1.15;
|
|
131
|
-
--text-handwritten-letter-spacing: 0;
|
|
132
|
-
--text-handwritten-font: var(--font-display);
|
|
133
|
-
--text-opencode-size: 0.7813rem;
|
|
134
|
-
--text-opencode-weight: 400;
|
|
135
|
-
--text-opencode-line-height: 1.55;
|
|
136
|
-
--text-opencode-letter-spacing: 0;
|
|
137
|
-
--text-opencode-font: var(--font-mono);
|
|
138
|
-
--text-transcript-size: 0.75rem;
|
|
139
|
-
--text-transcript-weight: 400;
|
|
140
|
-
--text-transcript-line-height: 1.65;
|
|
141
|
-
--text-transcript-letter-spacing: 0;
|
|
142
|
-
--text-transcript-font: var(--font-body);
|
|
143
|
-
--text-panel-meta-size: 0.6875rem;
|
|
144
|
-
--text-panel-meta-weight: 400;
|
|
145
|
-
--text-panel-meta-line-height: 1.4;
|
|
146
|
-
--text-panel-meta-letter-spacing: 0;
|
|
147
|
-
--text-panel-meta-font: var(--font-mono);
|
|
148
|
-
--text-panel-code-size: 0.6563rem;
|
|
149
|
-
--text-panel-code-weight: 400;
|
|
150
|
-
--text-panel-code-line-height: 1.5;
|
|
151
|
-
--text-panel-code-letter-spacing: 0;
|
|
152
|
-
--text-panel-code-font: var(--font-mono);
|
|
153
|
-
--text-terminal-size: 0.75rem;
|
|
154
|
-
--text-terminal-weight: 400;
|
|
155
|
-
--text-terminal-line-height: 1;
|
|
156
|
-
--text-terminal-letter-spacing: 0;
|
|
157
|
-
--text-terminal-font: var(--font-mono);
|
|
158
|
-
--text-settings-title-size: 0.8125rem;
|
|
159
|
-
--text-settings-title-weight: 600;
|
|
160
|
-
--text-settings-title-line-height: 1.35;
|
|
161
|
-
--text-settings-title-letter-spacing: 0;
|
|
162
|
-
--text-settings-title-font: var(--font-body);
|
|
163
|
-
--text-settings-nav-size: 0.8438rem;
|
|
164
|
-
--text-settings-nav-weight: 400;
|
|
165
|
-
--text-settings-nav-line-height: 1.3;
|
|
166
|
-
--text-settings-nav-letter-spacing: 0;
|
|
167
|
-
--text-settings-nav-font: var(--font-body);
|
|
168
|
-
--text-settings-page-size: 1.25rem;
|
|
169
|
-
--text-settings-page-weight: 600;
|
|
170
|
-
--text-settings-page-line-height: 1.25;
|
|
171
|
-
--text-settings-page-letter-spacing: 0;
|
|
172
|
-
--text-settings-page-font: var(--font-body);
|
|
173
|
-
--text-tooltip-size: 0.7813rem;
|
|
174
|
-
--text-tooltip-weight: 500;
|
|
175
|
-
--text-tooltip-line-height: 1.4;
|
|
176
|
-
--text-tooltip-letter-spacing: 0.02em;
|
|
177
|
-
--text-tooltip-font: var(--font-body);
|
|
178
|
-
--space-xs: 4px;
|
|
179
|
-
--space-sm: 8px;
|
|
180
|
-
--space-md: 12px;
|
|
181
|
-
--space-lg: 16px;
|
|
182
|
-
--space-xl: 24px;
|
|
183
|
-
--space-2xl: 32px;
|
|
184
|
-
--space-3xl: 48px;
|
|
185
|
-
--space-4xl: 64px;
|
|
186
|
-
--space-hairline: 0.5px;
|
|
187
|
-
--space-micro: 2px;
|
|
188
|
-
--space-compact: 6px;
|
|
189
|
-
--space-control: 10px;
|
|
190
|
-
--space-rowX: 14px;
|
|
191
|
-
--space-rowY: 8px;
|
|
192
|
-
--space-guideCard: 20px;
|
|
193
|
-
--space-settingsInset: 22px;
|
|
194
|
-
--space-frameGap: 8px;
|
|
195
|
-
--radius-none: 0;
|
|
196
|
-
--radius-sm: 4px;
|
|
197
|
-
--radius-md: 8px;
|
|
198
|
-
--radius-lg: 12px;
|
|
199
|
-
--radius-xl: 16px;
|
|
200
|
-
--radius-pill: 999px;
|
|
201
|
-
--radius-check: 3px;
|
|
202
|
-
--radius-control: 5px;
|
|
203
|
-
--radius-small: 6px;
|
|
204
|
-
--radius-ctl: 7px;
|
|
205
|
-
--radius-tile: 7.5px;
|
|
206
|
-
--radius-card: 8px;
|
|
207
|
-
--radius-group: 9px;
|
|
208
|
-
--radius-button: 10px;
|
|
209
|
-
--radius-bubble: 14px;
|
|
210
|
-
--radius-shell: 16px;
|
|
211
|
-
--radius-chip: 20px;
|
|
212
|
-
--radius-input: var(--radius-control);
|
|
213
|
-
--radius-badge: var(--radius-none);
|
|
214
|
-
--radius-modal: var(--radius-button);
|
|
215
|
-
--radius-guide: var(--radius-card);
|
|
216
|
-
--radius-sidepanel: var(--radius-shell);
|
|
217
|
-
--radius-assistantCard: var(--radius-button);
|
|
218
|
-
--radius-assistantField: var(--radius-md);
|
|
219
|
-
--radius-assistantBadge: var(--radius-small);
|
|
220
|
-
--radius-frame: var(--radius-shell);
|
|
221
|
-
--border-thin: 1px;
|
|
222
|
-
--border-thick: 2px;
|
|
223
|
-
--border-hairline: 0.5px;
|
|
224
|
-
--shadow-none: none;
|
|
225
|
-
--shadow-sm: 0 1px 2px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.2), 0 5px 14px rgba(0,0,0,.12);
|
|
226
|
-
--shadow-md: 0 1px 3px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.2), 0 12px 28px rgba(0,0,0,.15);
|
|
227
|
-
--shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 6px 16px rgba(0,0,0,.2), 0 20px 44px rgba(0,0,0,.15);
|
|
228
|
-
--shadow-xs: 0 1px 2px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.15);
|
|
229
|
-
--shadow-xl: 0 2px 6px rgba(0,0,0,.3), 0 10px 24px rgba(0,0,0,.2), 0 28px 56px rgba(0,0,0,.14);
|
|
230
|
-
--shadow-2xl: 0 4px 8px rgba(0,0,0,.3), 0 14px 32px rgba(0,0,0,.2), 0 40px 72px rgba(0,0,0,.14);
|
|
231
|
-
--shadow-highlight: inset 0 .5px 0 rgba(255,255,255,.07);
|
|
232
|
-
--shadow-popover: 0 12px 32px rgba(0,0,0,.4);
|
|
233
|
-
--shadow-assistantCard: 0 1px 2px rgba(0,0,0,.45);
|
|
234
|
-
--shadow-assistantPopover: 0 18px 44px rgba(0,0,0,.62), 0 3px 10px rgba(0,0,0,.5);
|
|
235
|
-
--shadow-sidepanel: 0 0 0 .5px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.15), 0 4px 8px rgba(0,0,0,.12), 0 12px 24px rgba(0,0,0,.14), 0 32px 64px rgba(0,0,0,.18);
|
|
236
|
-
--duration-fast: 150ms;
|
|
237
|
-
--duration-normal: 200ms;
|
|
238
|
-
--duration-slow: 320ms;
|
|
239
|
-
--duration-instant: 80ms;
|
|
240
|
-
--duration-assistantFast: 140ms;
|
|
241
|
-
--duration-moderate: 240ms;
|
|
242
|
-
--duration-codex: 250ms;
|
|
243
|
-
--duration-opacity: 280ms;
|
|
244
|
-
--ease-standard: ease;
|
|
245
|
-
--ease-enter: cubic-bezier(.16,1,.3,1);
|
|
246
|
-
--ease-exit: cubic-bezier(.2,0,1,.9);
|
|
247
|
-
--ease-codex: cubic-bezier(.2,0,0,1);
|
|
248
|
-
--ease-assistant: cubic-bezier(.2,0,.38,.9);
|
|
249
|
-
--ease-assistantEnter: cubic-bezier(0,0,.38,.9);
|
|
250
|
-
--ease-emphasized: cubic-bezier(.4,.14,.3,1);
|
|
251
|
-
--breakpoint-compact: 390px;
|
|
252
|
-
--breakpoint-actions: 480px;
|
|
253
|
-
--breakpoint-stack: 560px;
|
|
254
|
-
--breakpoint-sidebar: 760px;
|
|
255
|
-
--breakpoint-guideRail: 899px;
|
|
256
|
-
--z-dropdown: 99999;
|
|
257
|
-
--z-sticky: 3;
|
|
258
|
-
--z-overlay: 299999;
|
|
259
|
-
--z-modal: 300000;
|
|
260
|
-
--z-popover: 99999;
|
|
261
|
-
--z-toast: 300050;
|
|
262
|
-
--z-claude: 200;
|
|
263
|
-
--z-codex: 205;
|
|
264
|
-
--z-assistant: 205;
|
|
265
|
-
--z-opencode: 10001;
|
|
266
|
-
--z-lightbox: 400000;
|
|
267
|
-
--z-tooltip: 500000;
|
|
268
|
-
--z-contextMenu: 1000000;
|
|
269
|
-
--container-max: 1180px;
|
|
270
|
-
--container-padding: 24px;
|
|
271
|
-
--grid-columns: 2;
|
|
272
|
-
--grid-gutter: 16px;
|
|
273
|
-
--color-background: #050505;
|
|
274
|
-
--color-surface: #1c1c1ed9;
|
|
275
|
-
--color-surface-raised: #16161af2;
|
|
276
|
-
--color-text: #ffffffe6;
|
|
277
|
-
--color-text-muted: #ffffff8c;
|
|
278
|
-
--color-border: #ffffff1a;
|
|
279
|
-
--color-primary: #636363;
|
|
280
|
-
--color-on-primary: #ffffff;
|
|
281
|
-
--color-secondary: #ededed;
|
|
282
|
-
--color-on-secondary: #171717;
|
|
283
|
-
--color-accent: #ffd700d9;
|
|
284
|
-
--color-on-accent: #0a0a0c;
|
|
285
|
-
--color-link: #cccccce6;
|
|
286
|
-
--color-focus: #93c5fd;
|
|
287
|
-
--color-text-bright: #ffffffe6;
|
|
288
|
-
--color-text-primary: #ffffffb3;
|
|
289
|
-
--color-text-secondary: #ffffff80;
|
|
290
|
-
--color-text-quiet: #ffffff4d;
|
|
291
|
-
--color-text-faint: #ffffff33;
|
|
292
|
-
--color-surface-subtle: #ffffff0a;
|
|
293
|
-
--color-surface-light: #ffffff0f;
|
|
294
|
-
--color-surface-hover: #ffffff14;
|
|
295
|
-
--color-surface-medium: #ffffff1a;
|
|
296
|
-
--color-surface-active: #ffffff24;
|
|
297
|
-
--color-border-subtle: #ffffff0f;
|
|
298
|
-
--color-border-light: #ffffff1a;
|
|
299
|
-
--color-border-hover: #ffffff29;
|
|
300
|
-
--color-border-visible: #ffffff38;
|
|
301
|
-
--color-panel-shell: #101216eb;
|
|
302
|
-
--color-panel-header: #16161af2;
|
|
303
|
-
--color-assistant-background: #0a0a0c;
|
|
304
|
-
--color-assistant-card: #0f0f11;
|
|
305
|
-
--color-assistant-popover: #131316;
|
|
306
|
-
--color-settings-text: #ffffffeb;
|
|
307
|
-
--color-settings-help: #ffffff8c;
|
|
308
|
-
--color-settings-group: #ffffff08;
|
|
309
|
-
--color-settings-field: #00000040;
|
|
310
|
-
--color-settings-focus: #93c5fd;
|
|
311
|
-
--color-accent-source-cyan: #4fc2f8;
|
|
312
|
-
--color-primary-hover: #717171;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
@media (prefers-reduced-motion: reduce) {
|
|
316
|
-
:root {
|
|
317
|
-
--duration-fast: 0ms;
|
|
318
|
-
--duration-normal: 0ms;
|
|
319
|
-
--duration-slow: 0ms;
|
|
320
|
-
--duration-instant: 0ms;
|
|
321
|
-
--duration-assistantFast: 0ms;
|
|
322
|
-
--duration-moderate: 0ms;
|
|
323
|
-
--duration-codex: 0ms;
|
|
324
|
-
--duration-opacity: 0ms;
|
|
325
|
-
}
|
|
326
|
-
}
|