Skip to content

feat(client): support isolated RPC connections - #401

Draft
dvcolomban wants to merge 4 commits into
devframes:mainfrom
dvcolomban:dvcol/connection-isolation
Draft

dvcolomban wants to merge 4 commits into
devframes:mainfrom
dvcolomban:dvcol/connection-isolation

Conversation

@dvcolomban

@dvcolomban dvcolomban commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Background (Why)

An external viewer can own RPC connections to several independent Devframe endpoints in one browser document. A previously cached connection can override a later baseURL, and shared window/localStorage credentials plus the authentication BroadcastChannel can overwrite another endpoint's remembered token. Explicit connection descriptors select the endpoint but still participate in that shared authentication state.

This affects multi-project dashboards and applications that manage their own credential persistence. The downstream use case and reproduced behavior are recorded in dvcol/devkit-extension#7.

Changes (What)

Add isolated?: boolean to DevframeConnection. An isolated connection bypasses shared connection discovery and credential storage, and does not create the shared authentication BroadcastChannel. Token and OTP updates retain the setting on that connection descriptor.

Setup accepts a complete connection or an isolation-only input before fetching metadata:

const connection = await setupDevframeConnection({
  baseURL: 'http://localhost:5173/',
  connection: { isolated: true },
})
const rpc = await connectDevframe({ connection })

Reusing the descriptor preserves isolation. Omitting isolated or using false keeps existing shared behavior. Discovery and credential finalization are separate; token/OTP updates share one helper. Authentication channel creation uses a ternary inside its existing try/catch. No separate storage interface or standalone isolation toggle is introduced.

Verification (Testing)

The six affected connection/auth files pass all 39 tests, including fetched-descriptor reuse, independent authentication updates, reconnecting from a retained descriptor, shared defaults and transport disposal. Browser storage and transport I/O are mocked at their existing boundaries; these tests do not claim a new end-to-end browser run.

All 92 devframe API snapshot checks pass. Package build/typecheck and changed-file ESLint pass. The downstream installed backport also passes 19 server tests, four negative type fixtures and 18 real native-host tests. Full monorepo validation runs in PR CI.

@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

@dvcolomban is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/devframe/src/client/connection.ts
Comment thread packages/devframe/src/client/connection.ts
Comment thread packages/devframe/src/client/connection.ts
Comment thread packages/devframe/src/client/rpc.ts Outdated
Comment thread packages/devframe/src/client/rpc.ts Outdated
Comment thread tests/__snapshots__/tsnapi/devframe/client.snapshot.d.ts

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