feat: implement canonical page API minimum surface (Phase 4)#102
Open
feat: implement canonical page API minimum surface (Phase 4)#102
Conversation
Phase 4 of the connector contract unification plan: - playwright-runner/index.cjs: add url(), click(), fill(), press(), waitForSelector() as pass-throughs to the underlying Playwright page object. These were previously declared but undefined; the canonical page API in data-connectors types/connector.d.ts now requires them. - src-tauri/src/commands/connector.rs: add canonical manifest fields to the ConnectorMetadata struct — manifest_version, connector_id (aliased from legacy `id`), source_id, page_api_version, runtime_requirements, capabilities. Canonical connect_url, connect_selector, and icon now accept both the canonical snake_case and the legacy camelCase form via serde(alias). No behavior change beyond deserializing richer manifests. The Rust code that referenced metadata.id now reads metadata.connector_id (backed by the serde alias so old manifests still parse).
7 tasks
The regex used to prepend `return` to the top-level IIFE required a
leading `\n`, so any canonical connector whose IIFE is on line 1 (e.g.
steam-playwright.js starts with `(async () => {` directly) would fail to
match. The AsyncFunction then resolved to `undefined` immediately while
the script ran fire-and-forget, and the runner reported success with no
data.
Use `(?:^|\n)` and track whether the match started with a newline so
the replacement preserves the original line structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of the multi-repo connector contract unification plan. See
vana-com/data-connectorscontract freeze doc for the full background.Paired PRs:
page_api_version.Changes
playwright-runner/index.cjs: implementurl(),click(),fill(),press(),waitForSelector()as pass-throughs to the underlying Playwright page object. These were declared asundefinedbefore; the canonical contract now requires them.src-tauri/src/commands/connector.rs: extendConnectorMetadatawith the canonical manifest fields —manifest_version,connector_id(aliased from legacyid),source_id,page_api_version,runtime_requirements,capabilities. Canonicalconnect_url,connect_selector, andiconnow accept both the snake_case and legacy camelCase forms viaserde(alias).No observable behavior change beyond parsing richer manifests. Code that referenced
metadata.idnow readsmetadata.connector_id, backed by the serde alias so both old and new manifests deserialize correctly.Note on iCloud Notes
The iCloud Notes connector in data-connectors#59 advertises the
cg-legacy-page-apicapability because its script depends on CG-runtime-only page methods (getInput,frame_click/fill/evaluate/waitForSelector,keyboard_press/type) that are not part of the canonical minimum surface. It is already invisible to this runtime via two independent mechanisms:src/lib/platform/registry.ts(PLATFORM_REGISTRY), which is the hand-maintained frontend catalog that drives the connect list in data-connect.connectors/registry.json, which is the connector manifest allowlist.No explicit disable code is required in this PR. A belt-and-suspenders follow-up would be to have
playwright-runner/index.cjsload the manifest JSON alongside the script and reject any connector whosecapabilitiesarray containscg-legacy-page-api, but that is deferred as Phase 4+ hardening — the runner currently loads only the.js, not the metadata.Test plan
cargo check— cleanplaywright-runner/index.cjsin data-connect and confirm no regressionpresent: true, ok: true