Skip to content

feat(sdk/fresh): type-safe desktop bindings — oRPC MessagePort adapter over the bind channel #842

Description

@rickylabs

Part of #840.

Deno Desktop's webview↔runtime bindings have no built-in type bridge — the docs prescribe a hand-maintained bindings.d.ts (runtime/desktop/bindings #type-safety). NetScript replaces that with contract-first RPC:

  • A port shim adapting the bind channel (win.bind() / bindings.<name>(), JSON + Uint8Array, promise-based, per-window isolation) into a MessagePort-like pair.

  • oRPC's Message Port adapter on top (RPCHandler.upgrade(port) runtime-side, RPCLink webview-side — orpc.dev/docs/adapters/message-port): the same typed contracts/routers NetScript services already use, now spanning the window boundary. End-to-end types, no manual d.ts.

  • Integration: SDK provides the link + shim; @netscript/fresh wires the window side (desktop-gated, no-op in browser/Aspire mode — the POC's feature-detection pattern).

  • Constraint noted: serialization to string/binary by default; experimental_transfer used sparingly per oRPC guidance.

  • gate: typed round-trip incl. error mapping ({name,message,stack}) + Uint8Array payloads; per-window isolation test

  • gate: browser/Aspire no-op parity; jsr rubric on new SDK/fresh surface

Design source: PR #822 (rfc.md) + run .llm/runs/rfc-single-deployment--orchestrator/.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions