An open-source, faster Devin alternative
TypeScript
docs/sdk: make Repos surface honest for v1/preview
Igor Zalutski79ec65e21702
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdxindex 90ef8704..120ceffd 100644--- a/docs/agent-sessions/api-reference.mdx+++ b/docs/agent-sessions/api-reference.mdx@@ -202,7 +202,7 @@ Destination body: `url`, `secret?`, `level?` (`user`), `types?[]`, `include_raw?| Method · Path | Purpose || --- | --- |-| `GET /sessions/:id/deliveries?destination=&status=&after=&limit=` | List deliveries — status, attempts, last response/error (paginated). |+| `GET /sessions/:id/deliveries?destination=&status=&after=&limit=` | List deliveries — status, attempts, last response/error. Returns `{ data }`; filter with `after` (a `created_at` cutoff) and `limit`. || `GET /sessions/:id/deliveries/:id` | One delivery, in detail. || `POST /sessions/:id/deliveries/:id/redeliver` | Re-send any delivery (not just dead-lettered). |@@ -257,13 +257,9 @@ Pass `key` **or** `credential` (or neither → org default). The agent's `limits## GitHub Apps & Repos-Connect a GitHub App to let OpenComputer obtain short-lived, repo-scoped tokens for the repositories agents may work in. A **Repo** is repository identity. See the [Repos & GitHub guide](/agent-sessions/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).-The OpenComputer-owned App is installed from its GitHub App install URL, not by minting an install URL through the SDK. Bring-your-own GitHub App modes use the same repo and session shapes. **No credential passes through this API.**--GitHub App `mode` values: `oc_app` (OpenComputer owns and mints), `byo_stored_key` (your-App key is encrypted in OpenComputer; OpenComputer mints), and `byo_broker` (your backend-owns the App key and returns operation-scoped short-lived tokens).+During preview, OpenComputer installs its App on your repository for you — contact us to enable a repo; there is no SDK method to mint an install URL. **No credential passes through this API.** Bring-your-own GitHub App modes (`byo_stored_key`, `byo_broker`) are **coming later — not yet available**; in preview only `oc_app` (OpenComputer owns and mints) works.<Tabs>@@ -273,7 +269,9 @@ owns the App key and returns operation-scoped short-lived tokens).| --- | --- || `oc.repos.create(params)` | Register (get-or-create) a repo. || `oc.repos.get(id)` · `oc.repos.list()` | Fetch / list. |-| `oc.repos.update(id, params)` | Update `name` / `appId`. |+| `oc.repos.update(id, params)` | Update `name`. |+| `oc.github.apps.list()` | List GitHub Apps available to your org. |+| `oc.github.installations.list()` | List GitHub App installations visible to OpenComputer. |</Tab>@@ -283,19 +281,23 @@ owns the App key and returns operation-scoped short-lived tokens).| --- | --- || `POST /repos` | Register (get-or-create) a repo. || `GET /repos/:id` · `GET /repos` | Fetch / list. |-| `PATCH /repos/:id` | Update `name` / `app_id`. |+| `PATCH /repos/:id` | Update `name`. |+| `GET /github/apps` | List GitHub Apps available to your org. |+| `GET /github/installations` | List GitHub App installations visible to OpenComputer. |</Tab></Tabs>-Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle), `app_id?`. **No `auth`** — auth resolves through the GitHub App. **Idempotent by `(provider, owner, repo)`** (201 fresh / 200 repeat). `app_id` is optional — the GitHub App this repo resolves to; defaults to your org's default App, then the OpenComputer App.+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 = { id, provider, owner, repo, name?, app_id?, created_at, updated_at }+Repo = { id, provider, owner, repo, name?, created_at, updated_at }```-Responses **never** contain a token or secret. (SDK camelCase: `appId`.) Registering a repo is **optional** under the OpenComputer App — a session can reference `"owner/repo"` directly.+Responses **never** contain a token or secret. Registering a repo is **optional** under the OpenComputer App — a session can reference `"owner/repo"` directly.++`GET /github/apps` lists the GitHub Apps available to your org (in preview, the OpenComputer App). `GET /github/installations` lists the App installations visible to OpenComputer — it may be **empty** for orgs using only the OpenComputer App (it surfaces bring-your-own installations once those modes are available).## Credentialsdiff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdxindex f953bd5e..a5388664 100644--- a/docs/agent-sessions/repos.mdx+++ b/docs/agent-sessions/repos.mdx@@ -7,13 +7,14 @@ Use Repos when a session needs private code. Giving an agent a GitHub token,authenticated remote, or `gh` session gives it whatever that token can do; hiding thetoken behind a proxy does not narrow that authority.-Repos make GitHub access operation-scoped. A **Repo** records owner/repo plus policy; 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, the agent edits files and calls the+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`.+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, the+agent edits files and calls the[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool;-OpenComputer enforces repo and operation policy, then commits and opens the PR outside the-agent sandbox.+OpenComputer commits and opens the PR outside the agent sandbox with a fresh, write-scoped+token.<Note>**Preview** — APIs may change before general availability.</Note>@@ -21,10 +22,10 @@ agent sandbox.| Concept | Role | Boundary || --- | --- | --- |-| GitHub App | Mints operation-scoped GitHub tokens. | Not repo policy or session refs. |-| Installation | GitHub account and repo selection. | `byo_broker` can keep this in your backend. |-| Repo | Owner/repo, optional App pin. | No tokens, private keys, or session refs. |-| Source | `ref`, `sha`, and local name for one session. | Auth comes from the Repo's App unless inline. |+| 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. || Git operations sandbox | Runs authenticated clone/fetch/publish work. | Separate from the agent; token lives only for one operation. |<Note>@@ -33,24 +34,19 @@ GitHub uses GitHub Apps as its auth surface. Other providers can add their own asurface while sessions continue to reference repos and sources the same way.</Note>-## GitHub App modes+## The OpenComputer GitHub App-| Mode | Who owns the App key | Who mints tokens | Use when |-| --- | --- | --- | --- |-| `oc_app` | OpenComputer | OpenComputer | You want private repo access with no App key handling. |-| `byo_stored_key` | You; encrypted in OpenComputer | OpenComputer | You want GitHub actions to appear as your own App without hosting a broker. |-| `byo_broker` | You; kept in your backend | Your broker endpoint | Your backend must own GitHub policy, token minting, and App lifecycle. |+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.-In all modes, 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.+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.-### OpenComputer GitHub App--Install the **OpenComputer** GitHub App and select the repositories agents may work in —-you choose the repos, and can change the selection or uninstall anytime. No keys to-manage, no endpoint to host. OpenComputer mints a fresh, narrowly-scoped token for each-operation, including retries and recovery.+During preview, OpenComputer installs its GitHub App on your repository for you — contact us+to enable a repo. Once a repo is enabled, reference it 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.<Warning>The App may request write-capable GitHub permissions on the repos you select. OpenComputer@@ -59,28 +55,14 @@ the minimum permission it needs, such as read-only for checkout and write only fpublish/comment action.</Warning>-Install the OC-owned App from its published GitHub App install URL. OpenComputer does not-expose an SDK method to mint that URL because the App is owned by OpenComputer. Once it's-installed on a repo, reference that repo in a session's `sources` (below) — OpenComputer-resolves the App and mints a token just in time.--You do not need to enumerate installations to use a repo. OpenComputer resolves the App-automatically when a session starts.--### Bring your own GitHub App--Use a bring-your-own App when you want GitHub audit logs, PRs, comments, and statuses to-come from your own App instead of OpenComputer's.+### Bring your own GitHub App (coming later)-`byo_stored_key` means OpenComputer stores your App private key encrypted and mints-operation-scoped installation tokens on demand. This keeps setup simple, but OpenComputer-is still the token authority.--`byo_broker` means your backend keeps the App key and owns the full GitHub lifecycle. When-OpenComputer needs a GitHub operation, it sends a signed request with the repo, operation,-ref/sha, and requested permissions; your broker returns a short-lived installation token-or denies the request. OpenComputer may not be able to list installations for `byo_broker`-Apps, because your backend owns that state.+<Note>+**Not yet available.** Bring-your-own GitHub App modes — `byo_stored_key` (OpenComputer+stores your App key encrypted and mints) and `byo_broker` (your backend owns the App key and+returns short-lived tokens) — are planned so that GitHub PRs, comments, and statuses can come+from your own App. In preview, only the OpenComputer App is available.+</Note>### Inline short-lived token@@ -129,8 +111,8 @@ until the first checkout, then purges it. Use this only when a GitHub App is not## Register a repo-Once the GitHub App is installed, register a repo — optional: any installed repo can be-used in a session directly; a Repo adds policy and a stable handle.+Once the GitHub App is enabled on a repo, register a repo — optional: any enabled repo can+be used in a session directly; a Repo gives you a stable handle to reference.<CodeGroup>@@ -138,7 +120,6 @@ used in a session directly; a Repo adds policy and a stable handle.const repo = await oc.repos.create({owner: "acme",repo: "web",- // appId: "gha_...", // optional: org default, then OC App});```@@ -152,8 +133,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 GitHub App. Optional `appId` pins a repo to a-specific App; otherwise OpenComputer uses your org default App, then the OpenComputer App.+passed** — auth resolves through the OpenComputer App. (Pinning a repo to a specific App is+coming later.)## Use it in a session@@ -238,9 +219,8 @@ just-in-time, write-scoped token. This requires a **configured GitHub App** —repo-scoped tokens just in time and destroys them. None reaches the agent's prompt,shell, files, env, the event log, or telemetry. (The one exception is inline-token auth,held encrypted only until the first checkout, then purged.)-- App private keys for the OpenComputer App and stored-key Apps live only in- OpenComputer's **control plane**, never in a sandbox. `byo_broker` App keys stay in your- backend.+- The OpenComputer App's private key lives only in OpenComputer's **control plane**, never+ in a sandbox.- Platform-mediated pushes use an `oc/<session>/…` branch namespace — **noprotected-branch push, no force-push.**- Submodules and Git LFS are not part of the checkout contract.diff --git a/sdks/typescript/src/agents/repos.ts b/sdks/typescript/src/agents/repos.tsindex 81cbd50a..33dcf3c7 100644--- a/sdks/typescript/src/agents/repos.ts+++ b/sdks/typescript/src/agents/repos.ts@@ -6,15 +6,10 @@ export interface CreateRepoParams {repo: string;/** Optional handle for your own reference; identity is (provider, owner, repo). */name?: string;- /** The GitHub App this repo resolves to (↔ `app_id` on the wire). Optional;- * defaults to your org's default App, then the OpenComputer App. */- appId?: string;}export interface UpdateRepoParams {name?: string;- /** The GitHub App this repo resolves to (↔ `app_id` on the wire). */- appId?: string;}export interface Repo {@@ -23,24 +18,23 @@ export interface Repo {owner: string;repo: string;name?: string;- /** The GitHub App this repo resolves to (auth lives there, not here). */- appId?: string;createdAt?: string;updatedAt?: string;}/**- * How a GitHub App mints operation-scoped tokens:- * - `oc_app`: OpenComputer owns the App key and mints.- * - `byo_stored_key`: you own the App; OpenComputer stores the key encrypted and mints.- * - `byo_broker`: your backend owns the App key/lifecycle and returns short-lived tokens.+ * How a GitHub App mints operation-scoped tokens. In preview, only `oc_app` is available:+ * - `oc_app`: OpenComputer owns the App key and mints (the only mode that works today).+ * - `byo_stored_key`, `byo_broker`: bring-your-own App modes — coming later, not yet+ * available. Left as open string values so future values don't break clients.*/export type GitHubAppMode = "oc_app" | "byo_stored_key" | "byo_broker" | (string & {});export type GitHubAppStatus = "active" | "suspended" | "revoked" | (string & {});/**- * A GitHub App authority for repo operations. The built-in OpenComputer App is `oc_app`;- * user-owned App modes are additive and keep the Repo/Source shape unchanged.+ * A GitHub App authority for repo operations. In preview the only App is the built-in+ * OpenComputer App (`oc_app`); user-owned App modes are planned and would keep the+ * Repo/Source shape unchanged.*/export interface GitHubApp {id: string; // gha_…@@ -55,8 +49,8 @@ export interface GitHubApp {/*** A GitHub App installation visible to OpenComputer. Installations are useful for setup- * status and preflight. `byo_broker` Apps may have no OpenComputer-visible installations- * because your backend owns that lifecycle.+ * status and preflight. In preview this may be empty for orgs using only the OpenComputer+ * App; it surfaces bring-your-own App installations once those modes are available.*/export interface GitHubInstallation {id: string; // ghi_…@@ -113,7 +107,8 @@ export class GitHub {}}-/** GitHub Apps available to your org. BYO App registration methods are additive later. */+/** GitHub Apps available to your org. In preview this lists the OpenComputer App; BYO App+ * registration methods are planned for later. */export class GitHubApps {constructor(private readonly http: Http) {}list(params: { limit?: number; cursor?: string } = {}): Promise<Page<GitHubApp>> {@@ -121,7 +116,8 @@ export class GitHubApps {}}-/** GitHub App installations visible to OpenComputer; optional for `byo_broker` Apps. */+/** GitHub App installations visible to OpenComputer. In preview this may be empty for orgs+ * using only the OpenComputer App; it surfaces BYO installations once available. */export class GitHubInstallations {constructor(private readonly http: Http) {}list(params: ListGitHubInstallationsParams = {}): Promise<Page<GitHubInstallation>> {diff --git a/sdks/typescript/src/agents/sessions.ts b/sdks/typescript/src/agents/sessions.tsindex 4e5d6c43..4fe441c8 100644--- a/sdks/typescript/src/agents/sessions.ts+++ b/sdks/typescript/src/agents/sessions.ts@@ -258,8 +258,8 @@ export class Session extends ClientSession {return this;}- /** Per-turn history (timing + outcome), paginated. */- turns(opts: { after?: string; limit?: number } = {}): Promise<ListPage<Turn>> {+ /** Per-turn history (timing + outcome), paginated. `cursor` = `nextCursor` from the previous page. */+ turns(opts: { cursor?: string; limit?: number } = {}): Promise<ListPage<Turn>> {return this.http.request("GET", `/sessions/${this.id}/turns`, { query: opts as Query });}turn(turnId: string): Promise<Turn> {