Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: collaboration concept #12677

Closed
wants to merge 3 commits into from
Closed

DRAFT: collaboration concept #12677

wants to merge 3 commits into from

Conversation

msujew
Copy link
Member

@msujew msujew commented Jul 3, 2023

What it does

DO NOT MERGE THIS!

This PR provides a platform for discussion on the proposed collaboration feature. It will be followed up by a PR that actually implements this concept.

Please comment if you have any critique or questions with the approach outlined in the document. I'm happy to discuss, revise and extend the concept.

@msujew msujew added the collaboration issues related to collaboration label Jul 3, 2023
@msujew msujew marked this pull request as draft July 3, 2023 12:55
@JonasHelming JonasHelming mentioned this pull request Jul 4, 2023
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Thanks for the creation of this document! It gives a good first overview!

@@ -0,0 +1,137 @@
# Collaboration Concept

## Microsoft VSCode Live Share Extension
Copy link
Member

Choose a reason for hiding this comment

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

"VS Code offers collaboration support via the official Microsoft Live Share Extension. It offers the following features:"

At the end it would be nice to mention that we can't reuse the same protocol nor offer the same API to extensions because both have a proprietary license.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know, APIs cannot be licensed, only the implementation. If we were to offer a drop-in replacement for Microsoft's vsls that uses our custom collaboration feature implementation, we shouldn't infringe on any license agreements (fair use). See also Oracle v. Google.

@@ -0,0 +1,137 @@
# Collaboration Concept

Copy link
Member

Choose a reason for hiding this comment

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

I would start with a short motivational and overview, e.g.

"Collaboration is an often asked for feature in Theia. In this document we analyze the collaboration feature of VS Code, specify technical requirements and architecture for Theia and give an overview over the API concept."

- Mechanism for making the API available to other extensions, see [vsls](https://www.npmjs.com/package/vsls)

Similar to the tunnel feature, the connection between host and other users is accomplished using hole-punching.
I.e. a single central server serves as an intermediary to exchange messages. No messages are being exchanged directly between users.
Copy link
Member

Choose a reason for hiding this comment

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

According to the docs they do send messages directly between host and users if the network allows it, see https://learn.microsoft.com/en-us/visualstudio/liveshare/reference/connectivity#connection-modes. However every connection is authenticated via the cloud, so it's never fully private.

2. Virtual File System coming from the host user
3. Frontend message proxying for debug sync (i.e. debug launch or monaco language service requests need to be proxied to the plugin host and the results send back)
4. Terminal input + output syncing requires a yjs like approach for input and a broadcast for output
5. Broadcast required for Chat functionality
Copy link
Member

@sdirix sdirix Jul 4, 2023

Choose a reason for hiding this comment

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

Should we also list other potential requirements like:

  • privacy (e.g. allow to configure an own message server without going through one central public instance)
  • encryption
  • authentication
  • extensibility (for customized messages between plugins, similar to what VS Code offers)

Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

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

Thank you very much! This sounds very exciting!

Did I get that correctly that your example for the API concept is code that is expected to live in a Theia frontend extension? Is my understanding true that

  • any frontend extension can listen to and send requests, notifications, and broadcast messages
  • the frontend extension can then decide whether to directly process those messages or whether to forward this to the plugin host via main/ext communication?
  • there is a generic forwarder to the plugin host to support VS Code extensions that use the vsls API? If yes, how do we determine when to forward and when we don't, or do we forward all messages and the vsls API clients would decide whether to react?

Thanks again! Awesome initiative!

@msujew
Copy link
Member Author

msujew commented Jul 5, 2023

Did I get that correctly that your example for the API concept is code that is expected to live in a Theia frontend extension?

Yes.

any frontend extension can listen to and send requests, notifications, and broadcast messages

Depending on permissions (which I only mentioned in here). The frontend should reject any impermissible action.

the frontend extension can then decide whether to directly process those messages or whether to forward this to the plugin host via main/ext communication?

Right 👍

there is a generic forwarder to the plugin host to support VS Code extensions that use the vsls API? If yes, how do we determine when to forward and when we don't, or do we forward all messages and the vsls API clients would decide whether to react?

Good question, haven't put too much thought into that yet. First thought would be to have some sort of message wrapping, but not too sure. This is probably one of the last features that I plan to implement anyway.

Comment on lines +18 to +21
Similar to the tunnel feature, the connection between host and other users can be accomplished using hole-punching.
I.e. a single central server serves as an intermediary to exchange messages. No messages are being exchanged directly between users.
If possible - for example, if the users are on the same network - the extension will try to connect directly to the host,
see [here](https://learn.microsoft.com/en-us/visualstudio/liveshare/reference/connectivity#connection-modes).
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the "i.e." following the mention of "hole punching" as this term means establishing a direct connection through each peer's NAT by "punching holes" with the help of an intermediary server to know where to hit. I've also successfully managed to do hole punching in the past using UDP while TCP was more finicky (still worked). The implication means we'd need a UDP transport for direct connections? But that's only if you truly want to do hole punching over the internet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hole punching might not be the correct term here, right. In the end, all that we need to accomplish is that users can communicate with each other through some means, be it some intermediary server or whatever.

Copy link
Member

Choose a reason for hiding this comment

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

Fine if your goal is to abstract the API from how the communication might happen. Although properly laying down the expected modes of communication would help in designing said API: P2P vs Server-centric, how to handle auth/identity/permissions, etc...

If the goal is to be highly generic then the act of creating sessions must be defined at least partially by the embedding layer for the target IDE:

  1. Define the communication implementation (a.k.a "driver"? i.e. connect to some server and request a new room)
  2. Said driver may implement auth (i.e. prompt the user for credentials in the IDE? defer to some OAuth service?)

Assuming the server is built specifically for Theia, we can reuse some of Theia’s dependencies for this, i.e. socket-io for bidirectional, high-performance messaging on top of HTTP.


## API Concept
Copy link
Member

@paul-marechal paul-marechal Jul 11, 2023

Choose a reason for hiding this comment

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

What kind of API are we talking about here? Theia Extension API? VS Code Extension API?

Should we inject the vsls package the same way we do with the vscode API so that extensions relying on this package can work in Theia?

Should we take care to properly implement the groundwork feature in the framework before exposing it through the plugin API? (By contrast with webviews which are baked-in the plugin-ext package at the moment.)

Copy link
Member Author

Choose a reason for hiding this comment

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

What kind of API are we talking about here? Theia Extension API? VS Code Extension API?

Neither, the collaboration messaging infrastructure should be implemented independently of Theia (maybe another Eclipse project?) so that it can be reused for other IDEs as well. The API concept provided in here is for a general JS/TS library that can be used in Theia.

Should we inject the vsls package the same way we do with the vscode API so that extensions relying on this package can work in Theia?

Yes, that would be the mid-term plan. I wouldn't try to introduce a new Theia-only API to the plugin-ext. We should aim to replace the vsls package in the plugin host.

Copy link
Member

@paul-marechal paul-marechal Aug 8, 2023

Choose a reason for hiding this comment

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

Then is it fair to assume that this library must support at least what vsls supports? That would make for a good starting point when designing the API.

@msujew
Copy link
Member Author

msujew commented Aug 10, 2023

For anyone interested: I'm currently working on a PoC for this, the communication infrastructure is working as designed in this document and I've got workspace sharing and editor sync already in a working state:

2023-08-10.16-10-06.mp4

@msujew msujew mentioned this pull request Jan 24, 2024
1 task
@msujew
Copy link
Member Author

msujew commented Jan 24, 2024

Thanks everyone for the valuable feedback. This has been superseeded by #13309.

@msujew msujew closed this Jan 24, 2024
@msujew msujew deleted the msujew/collab-concept branch January 24, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collaboration issues related to collaboration
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants