memory-bank/components/gitpod-protocol.md
The Gitpod Protocol component serves as the core type definition and shared protocol library for the Gitpod platform. It defines the data structures, interfaces, and utility functions that are used across various components of the system, providing a consistent and type-safe way to communicate between services.
The primary purposes of the Gitpod Protocol component are:
The Gitpod Protocol component is primarily a TypeScript library with additional language bindings for Go and Java. It consists of several key modules:
The component is designed to be imported by other components that need to interact with Gitpod's data model or services.
src/protocol.ts: Core data structures and interfacessrc/gitpod-service.ts: Main service interface definitionssrc/workspace-instance.ts: Workspace instance related typessrc/teams-projects-protocol.ts: Team and project related typessrc/messaging/: WebSocket and messaging infrastructuresrc/encryption/: Encryption and security utilitiessrc/util/: Common utility functionssrc/experiments/: Feature flag and experimentation supportgo/: Go language bindingsjava/: Java language bindingsThe Gitpod Protocol defines numerous core data structures, including:
User: User account informationIdentity: Authentication provider identityToken: Authentication tokensOrganization (defined in src/teams-projects-protocol.ts): Represents a team/organization, including its settingsGitpodToken: API tokensAuthProviderInfo: Authentication provider metadataAuthProviderEntry: Authentication provider configurationWorkspace: Workspace metadata and configurationWorkspaceInstance: Running workspace instanceWorkspaceContext: Context for workspace creationWorkspaceConfig: Configuration for workspacesWorkspaceImageSource: Source for workspace imagesPrebuiltWorkspace: Prebuild informationRepository: Source code repository informationCommit: Git commit informationCommitContext: Context for a specific commitPullRequestContext: Context for a pull requestIssueContext: Context for an issueEnvVar: Environment variableUserEnvVar: User-specific environment variableProjectEnvVar: Project-specific environment variableOrgEnvVar: Organization-specific environment variablePortConfig: Port forwarding configurationTaskConfig: Task definitionImageConfig: Workspace image configurationVSCodeConfig: VS Code specific configurationJetBrainsConfig: JetBrains IDE specific configurationThe protocol defines interfaces for various Gitpod services:
GitpodClient: Client-side interface for Gitpod serviceGitpodServer: Server-side interface for Gitpod serviceHeadlessLogService: Service for headless workspace logsWorkspaceInstancePort: Service for workspace portsIDEFrontendService: Service for IDE frontend integrationThe protocol includes infrastructure for real-time messaging:
JsonRpcProxy: JSON-RPC based proxy for service communicationWebSocketConnection: WebSocket connection managementEventEmitter: Event-based communicationDisposable: Resource managementThe protocol provides encryption utilities:
EncryptionService: Service for encrypting and decrypting dataKeyProvider: Provider for encryption keysCryptoKeyStore: Storage for cryptographic keysThe Gitpod Protocol provides bindings for multiple languages:
The Gitpod Protocol integrates with:
The Gitpod Protocol is typically used to: