Skip to content

Browser-compatible transport seam for ClientRuntime#76

Merged
gmpassos merged 1 commit into
masterfrom
web-client-browser-transport
Jun 28, 2026
Merged

Browser-compatible transport seam for ClientRuntime#76
gmpassos merged 1 commit into
masterfrom
web-client-browser-transport

Conversation

@gmpassos

Copy link
Copy Markdown
Contributor

Summary

Makes the OmnyShell client compile to JavaScript and run in a browser, so a pure web client (omnyshell_web) can reuse ClientRuntime over the platform WebSocket instead of reimplementing the protocol. Native CLI / Hub / Node behaviour is unchanged.

Changes

  • Transport seam: ClientConfig.connectionFactory (a ConnectionFactory), resolved via a conditional import that selects a dart:io wss:// socket on the VM and the browser WebSocket (WsChannelConnection) under dart2js.
  • TLS knobs relocated: ioConnectionFactory({securityContext, onBadCertificate, pingInterval}), exported from omnyshell_client.dart, builds the native factory. The CLI's --ca / --insecure-skip-verify behaviour is unchanged.
  • dart:io isolated from the client graph: PlatformInfo.local() moved to a dart:io-only extension (platform_info_io.dart); the local-tunnel TCP bridge sits behind a conditional-import factory; PlatformInfo is now dart:io-free.
  • Drop detection: ClientConfig.onDisconnected.
  • Browser barrel: package:omnyshell/omnyshell_client_web.dart exports only the JS-compatible subset.
  • Embedded example updated; bumped to 1.29.0 with CHANGELOG.

Breaking change

ClientConfig no longer accepts securityContext / onBadCertificate (those dart:io types blocked browser compilation). Native callers migrate to:

ClientConfig(
  hubUri: uri,
  credentials: creds,
  connectionFactory: ioConnectionFactory(
    securityContext: ...,
    onBadCertificate: ...,
  ),
)

HubConfig and NodeConfig are unaffected.

Verification

  • dart analyze . — clean.
  • dart test — all 471 tests pass.
  • dart compile js of an entrypoint importing ClientRuntime produces no "dart:io not supported" errors.

🤖 Generated with Claude Code

Make the OmnyShell client compile to JavaScript and run in a browser, so a
pure web client can reuse ClientRuntime instead of reimplementing the protocol.
Native CLI/Hub/Node behaviour is unchanged.

- Add ClientConfig.connectionFactory (ConnectionFactory) with a conditional
  import selecting a dart:io wss:// socket on the VM and the platform WebSocket
  (WsChannelConnection) under dart2js.
- Move TLS trust overrides out of ClientConfig into ioConnectionFactory(...)
  (exported from omnyshell_client.dart); CLI --ca/--insecure-skip-verify
  unchanged. BREAKING: ClientConfig.securityContext/onBadCertificate removed.
- Isolate dart:io from the client graph: PlatformInfo.local() -> io-only
  extension; local-tunnel TCP bridge behind a conditional-import factory.
- Add ClientConfig.onDisconnected for drop detection.
- Add browser-safe barrel lib/omnyshell_client_web.dart.
- Fix embedded example to use connectionFactory: ioConnectionFactory(...).
- Bump to 1.29.0; update CHANGELOG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gmpassos gmpassos merged commit e1196f7 into master Jun 28, 2026
5 checks passed
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