Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Sep 3, 2024

Refs: #23

Title technically correct.

> await kernel.capTpCall('whatIsTheGreatFrangooly', [])
< "Crowned with Chaos"

This establishes a CapTP connection using @endo/captp over @ocap/streams between the offscreen document and the (currently singular) iframe. The iframe exposes a bootstrap object with a single method, which is called by the offscreen.

Status

  • unresolved messages are not handled on delete, but they are enumerated and complained about
  • capTp is unit tested by a mock of the above process
  • not unit tested:
    • background.ts
    • offscreen.ts
    • iframe.ts
  • The implementation could use a lot of cleanup.
  • In particular I'm not committed to the current stream multiplexing implementation via StreamPayloadEnvelope.label.
    This ensures separate handling for Command and CapTP messages, which we need, but the current implementation is unlikely the ideal one.
  • the envelope solution is explicit and works well; I don't recommend fixing it

@socket-security
Copy link

socket-security bot commented Sep 3, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@grypez grypez force-pushed the grypez/captp-conformal branch from d8c48c4 to 3677520 Compare September 3, 2024 15:02
@grypez
Copy link
Contributor Author

grypez commented Sep 3, 2024

@SocketSecurity ignore npm/@endo/captp@4.3.0 npm/@endo/exo@1.5.3 npm/@endo/patterns@1.4.3

We have a close working relationship with the @Endo contributors and can rely on them for defensively correct implementations.

@grypez
Copy link
Contributor Author

grypez commented Sep 3, 2024

@SocketSecurity ignore npm/rimraf@3.0.2

We explicitly require rimraf^6.0.1

@grypez grypez force-pushed the grypez/captp-conformal branch from 3f638e3 to 918f800 Compare September 9, 2024 22:33
@grypez

This comment was marked as resolved.

@grypez grypez force-pushed the grypez/captp-conformal branch 2 times, most recently from 822f49f to 4c5788a Compare September 10, 2024 06:50
@grypez

This comment was marked as resolved.

@grypez grypez changed the title vat connections feat(extension): Add distributed object capability programming Sep 10, 2024
@grypez grypez force-pushed the grypez/captp-conformal branch from 4c5788a to 19f16cb Compare September 11, 2024 10:48
@grypez grypez marked this pull request as ready for review September 11, 2024 17:32
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! See inline comments.

| DataObject[]
| { [key: string]: DataObject };

export enum ExtensionTarget {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to put this in an enum, but might I suggest MessageTarget instead for the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ExtensionMessageTarget?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd work, although we're in the extension package, and there is only one kind of message. Also, if we do ExtensionMessageTarget, we should rename MessageId to ExtensionMessageId. Do you see a need to disambiguate it from anything in particular?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do.

The word Extension in this enum is to clarify that there are a finitely enumerable set of targets to which one can send an ExtensionMessage, and those targets are enumerated by ExtensionMessageTargets. The underlying extension framework responds to the targets 'background' and 'offscreen', so these are extension targets.

MessageId is only used when sending messages to iframes, or in this implementation the iframe. As we approach $n$ iframes, I want to reserve the possibility of targeting a particular vat's iframe using the target key. That may be a faulty reservation. But in any case we don't use MessageId when sending an ExtensionMessage, so we shouldn't rename it to ExtensionMessageId.

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@grypez grypez merged commit 784c42e into main Sep 12, 2024
@grypez grypez deleted the grypez/captp-conformal branch September 12, 2024 20:34
@rekmarks rekmarks added the critical path High-priority issues that structure the rest of our work label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

critical path High-priority issues that structure the rest of our work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants