An open-source, faster Devin alternative
TypeScript
docs(repos): review fixes — accurate .git + App resolution wording
Igor Zalutski43bdd04064a9
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdxindex 194d29df..bd218bf7 100644--- a/docs/agent-sessions/api-reference.mdx+++ b/docs/agent-sessions/api-reference.mdx@@ -257,7 +257,7 @@ Pass `key` **or** `credential` (or neither → org default). The agent's `limits## GitHub Apps & Repos-The OpenComputer GitHub App lets OpenComputer obtain short-lived, repo-scoped tokens for the repositories agents may work in. A **Repo** is a stable repository handle that resolves to the OpenComputer App. See the [Repos & GitHub guide](/agent-sessions/repos).+A GitHub App lets OpenComputer obtain short-lived, repo-scoped tokens for the repositories agents may work in. A **Repo** is a stable repository handle that resolves to your configured GitHub App (the OpenComputer App by default, or your own). See the [Repos & GitHub guide](/agent-sessions/repos).During preview, **install the [OpenComputer GitHub App](https://github.com/apps/opencomputerdev/installations/new)** on the repos you want OpenComputer to work with (you pick the exact repos). **No credential passes through this API for the OpenComputer App.** You can also **bring your own GitHub App** (`byo_stored_key`) — register an existing App, or create one in one click via the [manifest flow](/agent-sessions/repos#bring-your-own-github-app); the App key is encrypted at rest and never returned. `byo_broker` is registrable but not yet used for minting.@@ -298,7 +298,7 @@ During preview, **install the [OpenComputer GitHub App](https://github.com/apps/</Tabs>-Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle). **No `auth`** — auth resolves through the OpenComputer App. **Idempotent by `(provider, owner, repo)`** (201 fresh / 200 repeat). (Pinning a repo to a specific App is coming later.)+Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle). **No `auth`** — auth resolves through your configured GitHub App (the OpenComputer App by default). **Idempotent by `(provider, owner, repo)`** (201 fresh / 200 repeat). (Pinning a repo to a specific App is coming later.)```Repo = { id, provider, owner, repo, name?, created_at, updated_at }diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdxindex 12efc728..13c828a0 100644--- a/docs/agent-sessions/repos.mdx+++ b/docs/agent-sessions/repos.mdx@@ -8,7 +8,8 @@ authenticated remote, or `gh` session gives it whatever that token can do; hidintoken behind a proxy does not narrow that authority.Repos make GitHub access operation-scoped. A **Repo** is a stable repository handle-(owner/repo) that resolves to the OpenComputer App; a **Source** pins `ref` and `sha`.+(owner/repo) that resolves to your configured GitHub App (the OpenComputer App by default);+a **Source** pins `ref` and `sha`.OpenComputer checks out the exact commit in a short-lived **Git operations sandbox**,copies only files into `/workspace/sources/<name>`, and destroys the token. For writes, theagent edits files and calls the@@ -25,7 +26,7 @@ token.| GitHub App | Mints operation-scoped GitHub tokens. | Not session refs. || Installation | GitHub account and repo selection. | The repos the App may work in. || Repo | A stable owner/repo handle. | No tokens, private keys, or session refs. |-| Source | `ref`, `sha`, and local name for one session. | Auth comes from the OpenComputer App unless inline. |+| Source | `ref`, `sha`, and local name for one session. | Auth comes from your configured GitHub App (OpenComputer App by default) unless inline. || Git operations sandbox | Runs authenticated clone/fetch/publish work. | Separate from the agent; token lives only for one operation. |<Note>@@ -59,7 +60,7 @@ sequenceDiagramGH-->>CP: Scoped tokenCP->>GitR: Inject token into this box's env onlyGitR->>GH: Clone at the pinned sha- GitR->>Store: Write files (no .git, no token)+ GitR->>Store: Write files (tokenless .git, no remote)Note over GitR: DestroyedStore->>Hands: Extract into /workspace/sources@@ -92,8 +93,9 @@ sequenceDiagram2. The control plane mints a **just-in-time token**: the GitHub App requests an installationtoken scoped to that one repo with read-only contents permission, and it is injected intothe sandbox's environment only — never `.git/config`, the command line, or any log.-3. The sandbox clones the exact `sha`, then writes the **files** (no `.git`, no remote, no- token) to dedicated object storage.+3. The sandbox clones the exact `sha`, then writes the **files** to dedicated object storage —+ with a shallow, **tokenless** `.git` (the token rode in via an in-memory header, never+ `.git/config`, and the remote is removed), so no credential travels with the bytes.4. The sandbox is destroyed; the token dies with it.5. The **hands** sandbox extracts those bytes into `/workspace/sources/<name>`.@@ -110,144 +112,67 @@ sequenceDiagramThe token is minted per operation, scoped to a single repo, lives only inside a box thatdoes nothing but Git, and is gone before the next turn.-## The OpenComputer GitHub App+## Connecting GitHub-In preview, the OpenComputer App is the only GitHub App: OpenComputer owns the App key and-mints a fresh, narrowly-scoped token for each operation, so you get private repo access with-no App key handling.+Pick one. Either way, OpenComputer mints a fresh, repo-scoped token **per operation** (read-only+for checkout, write only to publish) — the agent never holds one.-Each operation asks for the minimum GitHub permission it needs. Checkout needs read-only-contents access; write-capable actions ask for write access only for that operation.+<CardGroup cols={2}>+ <Card title="Install the OpenComputer App" icon="github" href="https://github.com/apps/opencomputerdev/installations/new">+ Zero setup. Choose the repos and go — OpenComputer owns the key and mints per operation.+ </Card>+ <Card title="Create your own App" icon="wand-magic-sparkles" href="#bring-your-own-app">+ GitHub creates it in a few clicks; OpenComputer federates it, so PRs come from your identity.+ </Card>+</CardGroup>-**Install the [OpenComputer GitHub App](https://github.com/apps/opencomputerdev/installations/new)**-on the repositories you want OpenComputer to work with — you choose the exact repos, so it-never needs org-wide access. Once it's installed on a repo, reference that repo in a session's-`sources` (below) and OpenComputer resolves the App and mints a token just in time. You do not-need to enumerate installations to use a repo.+### Bring your own App-<Warning>-The App may request write-capable GitHub permissions on the repos you select. OpenComputer-does **not** hand that broad authority to the agent: each operation gets a fresh token with-the minimum permission it needs, such as read-only for checkout and write only for a-publish/comment action.-</Warning>--### Bring your own GitHub App--Register your own GitHub App so pull requests, comments, and statuses come from **your** App-identity instead of OpenComputer's. Nothing else changes — OpenComputer still mints the same-per-operation, repo-scoped tokens; it just signs them with your App's key, which it stores-encrypted and never returns.--Creating a GitHub App is, by GitHub's design, a **user-facing flow through GitHub's UI** —-GitHub authenticates the person who creates and owns the App, so there's no API that mints one-on your behalf. OpenComputer hosts that flow behind a single link. (If you already have an App,-skip to [registering it directly](#already-have-an-app).)--**One-click — open a link (recommended).** Ask OpenComputer for a setup link and open it.-GitHub walks the user through creating the App; OpenComputer's callback captures the key,-encrypts it, and registers the App as `byo_stored_key`. You never render a form or touch the-private key.--<CodeGroup>--```ts TypeScript SDK-const { startUrl } = await oc.github.apps.createManifestUrl({- name: "Acme Agents",- isDefault: true,- // organization: "acme", // omit for a user-owned App-});-// Open startUrl in a browser (or print it in your CLI). After the user clicks-// "Create" on GitHub, OpenComputer registers the App — nothing else to call.-```--```http REST API-POST /v3/github/apps/manifest-Authorization: Bearer $OPENCOMPUTER_API_KEY+Use your own GitHub App so PRs, comments, and statuses come from **your** identity. OpenComputer+stores the key encrypted and signs the same per-operation tokens with it.-{ "name": "Acme Agents", "is_default": true }-// → { "start_url": "https://api.opencomputer.dev/v3/github/apps/manifest/start?token=…",-// "expires_at": "…" }-// Open start_url in a browser; OpenComputer hosts the GitHub redirect + key capture.-```--</CodeGroup>--**Embed it in your own product (developer-driven).** If you want the GitHub redirect to land in-*your* app (e.g. to attach the new App to your own user), host the redirect yourself: build the-manifest, render a top-level form that POSTs it to GitHub, then exchange the `code` GitHub-returns. (The form must be a top-level navigation, not fetch/XHR — GitHub shows the user its-App-creation screen.)+**Create one** — `createManifestUrl` returns a link; open it and GitHub walks you through+creating the App, then OpenComputer captures the key and registers it. (Creating an App is a+GitHub-UI flow, so it's a link to open, not a pure API call.)<CodeGroup>```ts TypeScript SDK-// 1. Build the manifest + the GitHub URL to submit it to.-const m = await oc.github.apps.createManifest({- redirectUrl: "https://your.app/github/callback",- name: "Acme Agents",-});-// 2. Render a form that POSTs m.manifest (JSON) as field m.field to m.postUrl.-// 3. In your redirect handler, exchange the code GitHub appended:-const app = await oc.github.apps.completeManifest({ code, isDefault: true });+const { startUrl } = await oc.github.apps.createManifestUrl({ name: "Your Agents" });+// open startUrl → click "Create" on GitHub → done``````http REST APIPOST /v3/github/apps/manifestAuthorization: Bearer $OPENCOMPUTER_API_KEY-{ "redirect_url": "https://your.app/github/callback", "name": "Acme Agents" }-// → { "manifest": { … }, "post_url": "https://github.com/settings/apps/new?state=…",-// "field": "manifest", "state": "…" }--// after GitHub redirects back to your redirect_url with ?code=…-POST /v3/github/apps/manifest/conversions-{ "code": "…", "is_default": true }-// → { "id": "gha_…", "mode": "byo_stored_key", … }+{ "name": "Your Agents" }+// → { "start_url": "…", "expires_at": "…" } — open start_url in a browser```</CodeGroup>-<a id="already-have-an-app" />-**Already have an App?** Register it directly with its numeric App id and private key.+**Already have one** — register it with its App id + private key:<CodeGroup>```ts TypeScript SDK-const app = await oc.github.apps.register({- mode: "byo_stored_key",- githubAppId: "123456",- privateKey: pem, // PKCS#1 or PKCS#8 PEM; encrypted at rest, never returned- isDefault: true,-});+await oc.github.apps.register({ mode: "byo_stored_key", githubAppId: "123456", privateKey: pem });``````http REST APIPOST /v3/github/appsAuthorization: Bearer $OPENCOMPUTER_API_KEY-{- "mode": "byo_stored_key",- "github_app_id": "123456",- "private_key": "-----BEGIN RSA PRIVATE KEY-----\n…",- "is_default": true-}+{ "mode": "byo_stored_key", "github_app_id": "123456", "private_key": "-----BEGIN…" }```</CodeGroup>-However you set it up, the last step is to **install the App on the repos you want** (from its-GitHub settings page) and reference those repos in `sources` exactly as with the OpenComputer-App — OpenComputer resolves your App and mints per operation. Rotate the key or change the-default with `oc.github.apps.update(id, { … })`; remove it (and its encrypted key) with-`oc.github.apps.delete(id)`.--<Note>-**`byo_broker` is registrable but not yet used for operations.** You can register a broker App-(`mode: "byo_broker"` with `brokerUrl` + `brokerSecret`) so it shows up in your apps list, but-minting through a broker is still coming — checkout and publish keep using the OpenComputer App-until it lands. `byo_stored_key` above is the supported way to use your own App today.-</Note>+Then **install your App on the repos** and reference them in `sources` as usual. List / rotate /+remove with `oc.github.apps.list()` · `update(id, …)` · `delete(id)`. Building this into your own+product with your own redirect? Use `createManifest` + `completeManifest`. (`byo_broker` can be+registered but isn't used for minting yet.)### Inline short-lived token@@ -319,8 +244,8 @@ Authorization: Bearer $OPENCOMPUTER_API_KEY</CodeGroup>Get-or-create, owner-scoped, idempotent by `(provider, owner, repo)`. **No credential is-passed** — auth resolves through the OpenComputer App. (Pinning a repo to a specific App is-coming later.)+passed** — auth resolves through your configured GitHub App (the OpenComputer App by default).+(Pinning a repo to a specific App is coming later.)## Use it in a session