memory-bank/components/local-app-api.md
The Local App API defines the gRPC interfaces for the Local App service, which facilitates communication between a user's local machine and Gitpod workspaces. This API enables port tunneling, SSH connection management, and other local-to-remote interactions.
This API provides a standardized interface for:
The Local App API is implemented as a gRPC service defined in Protocol Buffer files. These definitions are used to generate client and server code in Go for use by the local app and other components in the system.
Provides methods for managing local-to-remote communication:
TunnelStatus: Streams the status of port tunnels for a workspace instanceAutoTunnel: Enables or disables automatic port tunneling for a workspace instanceResolveSSHConnection: Resolves SSH connection details for connecting to a workspaceRepresents the status of a port tunnel:
Contains SSH connection details:
TunnelStatus method uses server-side streaming to provide real-time updates on tunnel statusThe API uses Protocol Buffers version 3 (proto3) syntax, which provides forward and backward compatibility features. The service is designed to allow for the addition of new tunneling and connection options without breaking existing clients.
The Local App API uses Protocol Buffers and gRPC for defining interfaces. When changes are made to the .proto files, the corresponding code in various languages needs to be regenerated.
To regenerate the code:
Navigate to the local-app-api directory:
cd components/local-app-api
Run the generate script:
./generate.sh
This script performs the following actions:
protoc-gen-go and protoc-gen-go-grpcThe Local App API has a dependency on the Supervisor API for tunnel visibility definitions, which is included in the protoc generation process.
After regenerating the code, you may need to rebuild components that depend on the Local App API. This typically involves:
For Go components:
cd <component-directory>
go build ./...
Using Leeway (for CI/CD):
leeway build -D components/<component-name>:app
The Local App API is primarily used by the local-app component, which is a desktop application that runs on users' machines to facilitate communication with remote Gitpod workspaces.