Skip to content

fix(host): satisfy dsh 0.2.1 mandatory Peer (assertPeerLive / prepareInvocation) - #135

Open
qihaonanren wants to merge 1 commit into
omdsh-dev:mainfrom
qihaonanren:fix/dsh-0.2.1-mandatory-peer
Open

qihaonanren wants to merge 1 commit into
omdsh-dev:mainfrom
qihaonanren:fix/dsh-0.2.1-mandatory-peer

Conversation

@qihaonanren

Copy link
Copy Markdown

Fixes the 0.2.1 half of what #134 describes.

dsh 0.2.1 validates the Peer on both carriers, so passing undefined (the #102 remedy) is no longer enough:

  1. openWireStream($events) → assertPeerLive(peer) reads peer.signal → Cannot read properties of undefined (reading 'signal') immediately after hello.ok (WS 1011).
  2. prepareInvocation reads request.peer, so every gateway.invoke() throws the same way — that is also why side-panel messaging fails. This is an object property, not a positional argument, so an arity probe cannot detect it.

Change

  • add a never-disposed owner HOST_PEER (signal + principal.kind='owner' + interactions='answer')
  • pass it to wireStream.open instead of undefined
  • wrap the gateway in createRemoteHostApi so invoke() injects the peer once (Object.create keeps the prototype chain — spreading would drop TypertGatewayService methods)

Verified

On dsh 0.2.1-rc.3 + 0.0.7: before the patch the bridge closed 1011 within milliseconds of hello.ok; after it the connection stays open (30s+ observed) and browser_snapshot / browser_click / browser_type plus side-panel messaging all work.

Kept 0.2.0-compatible: the peer is only read when the host validates it.

…Invocation)

dsh 0.2.1 validates the Peer on both carriers:
- openWireStream($events) calls assertPeerLive(peer) + requireInteractions(peer)
- prepareInvocation reads request.peer

The 0.1.7 fix passed `undefined` for peer, which now throws
`Cannot read properties of undefined (reading '''signal''')` right after hello.ok
(WS close 1011), and every gateway.invoke() fails the same way (so side-panel
messaging is broken too).

Provide a never-disposed owner Peer and inject it into invoke() once.
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