{"id":40587307,"url":"https://github.com/recode-sh/agent","last_synced_at":"2026-01-21T03:07:51.449Z","repository":{"id":64304058,"uuid":"497952790","full_name":"recode-sh/agent","owner":"recode-sh","description":"The agent that runs in the development environments created by the Recode CLI","archived":false,"fork":false,"pushed_at":"2022-06-04T16:30:45.000Z","size":145,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-22T18:03:47.385Z","etag":null,"topics":["grpc","recode","ssh"],"latest_commit_sha":null,"homepage":"https://recode.sh","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/recode-sh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-30T13:21:38.000Z","updated_at":"2022-09-01T02:38:04.000Z","dependencies_parsed_at":"2023-01-15T10:15:45.995Z","dependency_job_id":null,"html_url":"https://github.com/recode-sh/agent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/recode-sh/agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recode-sh%2Fagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recode-sh%2Fagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recode-sh%2Fagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recode-sh%2Fagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recode-sh","download_url":"https://codeload.github.com/recode-sh/agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recode-sh%2Fagent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28624344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","recode","ssh"],"created_at":"2026-01-21T03:07:51.384Z","updated_at":"2026-01-21T03:07:51.443Z","avatar_url":"https://github.com/recode-sh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Agent\n\nThis repository contains the source code of the Recode Agent. \n\nThe Recode Agent is installed in the instance running your development environment during its creation (most of the time via `cloud-init` but it may vary depending on the cloud provider used).\n\nThe main role of the Recode Agent is to enable communication between your development environment, the [Recode CLI](https://github.com/recode-sh/cli) and your code editor.\n\nIt is composed of two components: \n\n - A `SSH server`.\n\n - A `gRPC server`.\n\n## Table of contents\n- [Requirements](#requirements)\n- [Usage](#usage)\n  - [Generating the gRPC server's code](#generating-the-grpc-servers-code)\n- [Agent](#agent)\n  - [SSH Server](#ssh-server)\n  - [GRPC Server](#grpc-server)\n- [The future](#the-future)\n- [License](#license)\n\n## Requirements\n\nThe Recode Agent only works on nix-based OS and requires:\n\n  - `go \u003e= 1.17`\n\n  - `protoc \u003e= 3.0` (see [Protocol Buffer Compiler Installation](https://grpc.io/docs/protoc-installation/))\n  \n  - `google.golang.org/protobuf/cmd/protoc-gen-go@latest` (install via `go install`)\n  \n  - `google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest` (install via `go install`)\n\n## Usage\n\nThe Recode agent could be run using the `go run main.go` command. \n\nThe `gRPC server` will listen on an Unix socket at `/tmp/recode_grpc.sock` whereas the `SSH server` will listen on `:2200` by default.\n\n### Generating the gRPC server's code\n\nThe `gRPC server`'s code could be generated by running the following command **in the `proto` directory**:\n\n```bash\nprotoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative agent.proto \n```\n\n## Agent\n\nThe `SSH server` lets you access your development environment via `SSH` without having to install and configure it. \n\nThe `gRPC server`, on the other hand, is used to enable communication with the [Recode CLI](https://github.com/recode-sh/cli) (via `SSH`, using the OpenSSH's `Unix domain socket forwarding` feature).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/1233275/172016265-becc3ab0-dbd0-48d2-8623-2bd1dab9873b.png\" alt=\"infra\" /\u003e\n\u003c/p\u003e\n\n### SSH Server\n\nThe `SSH server` is the sole public-facing component. It will listen on port `2200` and redirect traffic to the `gRPC server` or to the `development environment` depending on the requested `channel type`.\n\n**The authentication will be done using the Public Key authentication method**. The key pair will be generated once, during the creation of the development environment.\n\n### GRPC server\n\nThe `gRPC server` listens on an Unix socket and, as a result, is not public-facing. It will be accessed by the [Recode CLI](https://github.com/recode-sh/cli) via `SSH`, using the OpenSSH's `Unix domain socket forwarding` feature.\n\nIt is principally used to build (and `--rebuild`) your development environment as you can see in the service definition:\n\n```proto\nservice Agent {\n  rpc InitInstance (InitInstanceRequest) returns (stream InitInstanceReply) {}\n  rpc BuildAndStartDevEnv (BuildAndStartDevEnvRequest) returns (stream BuildAndStartDevEnvReply) {}\n}\n\nmessage InitInstanceRequest {\n  string dev_env_name_slug = 1;\n  string github_user_email = 2;\n  string user_full_name = 3;\n}\n\nmessage InitInstanceReply {\n  string log_line_header = 1;\n  string log_line = 2;\n  optional string github_ssh_public_key_content = 3;\n  optional string github_gpg_public_key_content = 4;\n}\n\nmessage BuildAndStartDevEnvRequest {\n  string dev_env_repo_owner = 1;\n  string dev_env_repo_name = 2;\n  string user_config_repo_owner = 3;\n  string user_config_repo_name = 4;\n}\n\nmessage BuildAndStartDevEnvReply {\n  string log_line_header = 1;\n  string log_line = 2;\n}\n```\n\nThe `InitInstance` method will run a [shell script](https://github.com/recode-sh/agent/blob/main/internal/grpcserver/init_instance.sh) that will, among other things, install `Docker` and generate the `SSH` and `GPG` keys used in GitHub.\n\nThe `BuildAndStartDevEnv` method will clone your repositories, build your `dev_env.Dockerfile` files and run your `hooks`.\n\n**The two methods are idempotent**.\n\n## The future\n\nThis project is **100% community-driven**, meaning that except for bug fixes \u003cins\u003e**no more features will be added**\u003c/ins\u003e. \n\nThe only features that will be added are the ones that will be [posted as an issue](https://github.com/recode-sh/cli/issues/new) and that will receive a significant amount of upvotes **(\u003e= 10 currently)**.\n\n## License\n\nRecode is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecode-sh%2Fagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecode-sh%2Fagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecode-sh%2Fagent/lists"}