Skip to content

feat(safari): port the FSB extension to Safari via a native macOS wrapper - #145

Open
LakshmanTurlapati wants to merge 5 commits into
mainfrom
safari-extension-port
Open

LakshmanTurlapati wants to merge 5 commits into
mainfrom
safari-extension-port

Conversation

@LakshmanTurlapati

Copy link
Copy Markdown
Collaborator

Adds a Safari Web Extension port: a new safari/FSB Xcode project (Swift app, extension handler, native MCP socket bridge, granted-roots file reader) plus build-safari, release-safari, and sync-safari-version scripts, with esbuild and validate-extension updated to build and check the Safari bundle. The extension gets a platform-adapter that degrades CDP-only features (pointer, keyboard, network capture, file upload) to content-script fallbacks, and a native-messaging MCP transport used instead of the WebSocket bridge in Safari. Font Awesome moves to extension/assets/vendor (woff2 only), and the Chrome-only offscreen STT page is removed. New tests cover the adapter, native transport, CDP-degradation routing, pointer fallbacks, Safari manifest build, and source/version parity; the plan is in .planning/SAFARI-PORT-PLAN.md.

…pper

Add a Safari Web Extension target (safari/FSB Xcode project with a Swift
app, extension handler, and native MCP bridge) plus build/release/version
scripts. The extension gains a platform adapter that degrades CDP-only
features (pointer, keyboard, network capture, file upload) to content-script
fallbacks, and a native-messaging MCP transport used in place of the
WebSocket bridge. Font Awesome moves to assets/vendor, and the Chrome-only
offscreen STT page is removed. New tests cover the adapter, native transport,
manifest build, and source/version parity.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Refresh the generated date stamps in llms.txt, llms-full.txt, and
sitemap.xml produced by build-crawler-files.mjs.
… roots

- Give the content tab its own session key with a single writer so a page
  closing the workspace no longer overwrites the worker's tab id, and run
  tab/window listeners after hydration so an evicted worker doesn't write
  empty ids over the saved record.
- Release the native read handle on every non-drained exit (throw, not-ok
  chunk, host that never marks the last chunk) instead of pinning it until
  the host TTL.
- Store granted-root bookmarks in a file in the App Group container rather
  than a UserDefaults suite, whose per-process cache hid a fresh grant from a
  running extension until Safari quit.
Carry the Safari port onto main's hardened bridge. Main now classifies
upgrades by Origin: only chrome-extension:// origins can be the extension,
and an Origin-less socket must say relay:hello or be closed. That rejected
both Safari transports, so:

- bridge.ts accepts safari-web-extension:// origins alongside
  chrome-extension://, keeping main's host, pairing and pinning checks.
- The native transport sends the extension origin in its open frame and the
  container app dials :7225 with it as the Origin header, instead of relying
  on the removed "no Origin means allowed" branch.
- The bridge client keeps main's pairing subprotocols on the direct socket;
  the native socket connects unpaired.

Other conflicts:
- sidepanel.js: main's tab-surface sync and ownership refresh now resolve
  the target tab through getTargetTabs so Safari's workspace window is
  never mistaken for the content tab.
- Safari build: nativeMessaging is in the Chrome manifest now, so it is
  classified as kept; capture_screenshot is declared as having no DOM
  fallback; the importScripts pins move to main's 333/329.
- Rolled main's sidepanel and onboarding hash pins for the Safari edits and
  kept the native-free bridge-client check by rewording a comment.
…old-cache tabs

upload_file on Safari sent domSetFileInput straight to the tab, so a tab
whose content script was not loaded yet (freshly opened or reloaded) failed
with "Receiving end does not exist". It now runs ensureContentScriptInjected
first and targets frameId 0. It deliberately does not use
sendMessageWithRetry: a retry after a lost reply would set the file twice
and fire change twice, a double upload on auto-upload inputs.

resolveTargetTab fell back to an unscoped tabs.query({active:true}) when no
content tab was cached, which returns every window's active tab in no
particular order. It now asks windows.getLastFocused({windowTypes:['normal']})
first (the workspace is a popup window, so it is excluded), and keeps the old
query as the fallback when that API is missing, rejects, or returns the
workspace anyway.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant