Skip to content

docs: connector authoring guidelines for desktop/mobile portability - #16

Open
volod-vana wants to merge 1 commit into
PDP-Connect:mainfrom
volod-vana:volod/connector-authoring-guidelines
Open

docs: connector authoring guidelines for desktop/mobile portability#16
volod-vana wants to merge 1 commit into
PDP-Connect:mainfrom
volod-vana:volod/connector-authoring-guidelines

Conversation

@volod-vana

Copy link
Copy Markdown
Contributor

Connectors are written against the page API, not against a browser. Desktop implements it with Playwright + Chromium; mobile implements it with a native WebView shim. A connector that only assumes the page contract runs on both - one that assumes Chromium on a laptop does not.

This adds CONNECTOR-GUIDELINES.md documenting the rules that keep that true, plus a link from the "Building a new connector" section.

Every rule is a failure actually hit while running real connectors on both runtimes, not a hypothetical:

  1. Detect state from APIs, not page chrome. The most common break. A login check keyed on nav[aria-label="Chat history"] / [data-testid="profile-button"] never fires on a phone viewport, so the connector waits forever for a login that already happened. A session-endpoint check is layout independent - and more robust on desktop too.
  2. Make the run resumable. Mobile can lose the runtime mid-run (OS kills the WebView, user backgrounds the app). There is no pause-and-continue; only what you checkpointed survives.
  3. Fetch from inside the page, do not intercept the network. Reading response bodies off the app's own traffic is desktop-only in practice - iOS has no API for it, Android only partial. Fine as a fallback, not as the primary data path.
  4. Keep page.evaluate payloads self-contained. No in-page eval/new Function: strict CSP rejects them, and mobile has no debugger-protocol escape hatch the way desktop does.
  5. Never require credentials from the driver. requestInput is optional and absent on mobile by design - we do not want the app handling a user's third-party password. Always keep the showBrowser + promptUser fallback, and treat the showBrowser URL as a hint.
  6. Declare desktop-only capabilities and fail cleanly. Binary download + unzip, cross-origin iframes, network response bodies. A clean failure routes to desktop handoff; a silent one looks like a broken app.
  7. Report progress and bound the work. Runtime scales with the user's data - a small account finishes in under a minute, a large one can run far longer. The UI can only be honest about that if the connector emits counts.
  8. Do not assume desktop layout or viewport.

Also includes a capability matrix (desktop vs iOS vs Android) and a pre-PR checklist.

Context: written after running unmodified connectors from this repo on a phone through a page-API shim. Most of the corpus ports as-is; the exceptions are exactly the capabilities in rule 6.

@volod-vana
volod-vana force-pushed the volod/connector-authoring-guidelines branch from 1fbc5e3 to 5eafcd8 Compare July 29, 2026 15:21
Connectors are written against the page API, not against a browser. Desktop
implements it with Playwright + Chromium, mobile with a native WebView shim, so a
connector that only assumes the page contract runs on both.

Documents the eight rules that keep that true, each one a failure hit while running
real connectors on both runtimes:

- detect state from APIs, not page chrome (the desktop-layout login check is the
  most common break)
- make runs resumable, because mobile can lose the runtime mid-run
- fetch from inside the page instead of intercepting the network (iOS has no
  response-body interception)
- keep evaluate payloads self-contained, no in-page eval (strict CSP rejects it and
  mobile has no debugger-protocol escape hatch)
- never require credentials from the driver; requestInput is optional by design
- declare desktop-only capabilities and fail cleanly to desktop handoff
- report progress with counts; runtime scales with the user's data
- do not assume desktop layout or viewport

Includes a capability matrix (desktop vs iOS vs Android) and a pre-PR checklist.

Signed-off-by: Volod <volod@vana.com>
@volod-vana
volod-vana force-pushed the volod/connector-authoring-guidelines branch from 5eafcd8 to 152ca31 Compare July 29, 2026 15:22
tnunamak added a commit that referenced this pull request Aug 18, 2026
Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>
tnunamak added a commit that referenced this pull request Aug 18, 2026
* chore: add Apache-2.0 SPDX headers to source files

Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>

* fix: place "use client"/"use server" before SPDX header (76 files)

The header sweep inserted the copyright/SPDX comment above the directive,
demoting it from the first statement. Next.js requires the directive to lead
the file for the client/server boundary to register. Reorder so the directive
is line 1 and the header follows.

Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>
Assisted-by: AI

* chore: add SPDX header to test-runner-contract test (post-migration file)

The remote-surface 1.x migration (#16) added this file after the header
sweep; bring it in line with its siblings.

Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>
Assisted-by: AI

* chore: header the 4 NUL-bearing first-party source files

These were deferred in the original sweep ("needs human judgment") because
they embed a literal NUL as a composite-key delimiter (\`\${a}\x00\${b}\`),
which trips header tooling. Verified the NUL is intentional content, not
corruption; header prepended (after shebang where present), NUL preserved.

Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>
Assisted-by: AI

---------

Signed-off-by: Tim Nunamaker <tnunamak@gmail.com>
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