Skip to content

An open-source, faster Devin alternative

TypeScript

docs/sdk: model github installs explicitly

Igor Zalutskif591c2d37456
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index 228245c7..101c44a7 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -74,9 +74,9 @@ Turn = {
}
SessionSource = // a sources[] entry — WIRE shape, snake_case
- { repo, ref, sha, name? } // a registered repo id or "owner/repo" — auth via your connection
+ { repo, ref, sha, name? } // a registered repo id or "owner/repo" — GitHub App auth
| { url, ref, sha, name?, auth } // inline shortcut; name defaults to repo name, type defaults "git"
-SourceAuth = // inline path ONLY (connection-backed repos need none)
+SourceAuth = // inline path ONLY (GitHub App-backed repos need none)
{ type: "risky_short_lived_token", token, expires_at } // workaround; short-lived; can't refresh
// SDK is camelCase: expiresAt (wire expires_at).
SourceSummary = { name, status, path, sha, resolved_sha?,
@@ -255,11 +255,11 @@ Create body: `name`, `prompt`, `model`, `runtime?` (`claude` | `codex`), `key?`,
Pass `key` **or** `credential` (or neither → org default). The agent's `limits` are the defaults for its sessions; a session's own `limits` override. Each agent has a monotonic `revision` (bumped on PATCH) that sessions pin in `agent_snapshot.revision`, so you can tell which version produced a run.
-## GitHub connections & Repos
+## GitHub App installations & Repos
-Auth lives on a **connection** (how OpenComputer mints tokens for your org); a **Repo** is repo identity + policy that references it. See the [Repos guide](/agent-sessions/repos).
+Install the **OpenComputer GitHub App** to let OpenComputer mint short-lived, repo-scoped tokens for the GitHub accounts and repositories you select. A **Repo** is repository identity + policy. See the [Repos guide](/agent-sessions/repos).
-**Connect GitHub** by installing the **OpenComputer GitHub App** (recommended, durable; bring-your-own App + broker coming soon). The install captures an owner-scoped connection; OpenComputer then mints short-lived, repo-scoped tokens just in time. **No credential passes through this API.**
+The OC-owned App is installed from the dashboard or GitHub, not by minting an install URL through the SDK. Bring-your-own GitHub App support will add a separate GitHub App entity later; repo and session shapes stay the same. **No credential passes through this API.**
<Tabs>
@@ -267,11 +267,10 @@ Auth lives on a **connection** (how OpenComputer mints tokens for your org); a *
| Call | Purpose |
| --- | --- |
-| `oc.github.connections.installUrl(params?)` | Create a GitHub App installation URL. |
+| `oc.github.installations.list()` | List OpenComputer GitHub App installations available to your org. |
| `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 policy `defaults`. |
-| `oc.github.connections.list()` | List connected GitHub Apps (installs). |
</Tab>
@@ -279,26 +278,23 @@ Auth lives on a **connection** (how OpenComputer mints tokens for your org); a *
| Method · Path | Purpose |
| --- | --- |
-| `POST /github/connections/install-url` | Create a GitHub App installation URL. |
+| `GET /github/installations` | List OpenComputer GitHub App installations available to your org. |
| `POST /repos` | Register (get-or-create) a repo. |
| `GET /repos/:id` · `GET /repos` | Fetch / list. |
| `PATCH /repos/:id` | Update policy `defaults`. |
-| `GET /github/connections` | List connected GitHub Apps (installs). |
</Tab>
</Tabs>
-Install URL body: `account?`, `redirect_url?`; response `{ url }`. Redirect the user to `url`, then list connections after GitHub returns to your app.
-
-Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle), `connection_id?`, `defaults?`. **No `auth`** — auth comes from your GitHub connection. **Idempotent by `(provider, owner, repo)`** (201 fresh / 200 repeat). `defaults`: `{ branch_namespace?, allow? }` — `allow` is a **GitHub permission ceiling** (e.g. `contents:read`, `pull_requests:write`).
+Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle), `installation_id?`, `defaults?`. **No `auth`** — auth comes from the GitHub App installation. **Idempotent by `(provider, owner, repo)`** (201 fresh / 200 repeat). `defaults`: `{ branch_namespace?, allow? }` — `allow` is a **GitHub permission ceiling** (e.g. `contents:read`, `pull_requests:write`).
```
-Repo = { id, provider, owner, repo, name?, connection_id?, defaults?, created_at, updated_at }
-Connection = { id, provider, type, status, account_login, created_at } // type: oc_app (byo_* coming soon)
+Repo = { id, provider, owner, repo, name?, installation_id?, defaults?, created_at, updated_at }
+GitHubInstallation = { id, account_login, status, repository_selection?, created_at }
```
-Responses **never** contain a token or secret. (SDK camelCase: `branchNamespace`, `connectionId`, `accountLogin`.) Registering a repo is **optional** under the OpenComputer App — a session can reference `"owner/repo"` directly.
+Responses **never** contain a token or secret. (SDK camelCase: `branchNamespace`, `installationId`, `accountLogin`.) Registering a repo is **optional** under the OpenComputer App — a session can reference `"owner/repo"` directly.
## Credentials
diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdx
index 39bf63ba..833748c2 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -31,30 +31,14 @@ the minimum permission it needs, such as read-only for checkout and write only f
publish/comment action.
</Warning>
-Start the install from your dashboard (**Integrations → GitHub**) or create an install URL
-from your backend:
+Start the install from your dashboard (**Integrations → GitHub**) or from the public
+OpenComputer GitHub App page. No API call is needed to install the OC-owned App.
-<CodeGroup>
-
-```ts TypeScript SDK
-const url = await oc.github.connections.installUrl({ account: "acme" });
-redirectUserTo(url);
-```
-
-```http REST API
-POST /v3/github/connections/install-url
-Authorization: Bearer $OPENCOMPUTER_API_KEY
-
-{ "account": "acme" }
-```
-
-</CodeGroup>
-
-After GitHub returns to your app, verify the connection:
+After installation, you can verify which GitHub accounts are available:
```ts
-const connections = await oc.github.connections.list();
-// [{ id: "conn_...", accountLogin: "acme", status: "active" }]
+const installs = await oc.github.installations.list();
+// [{ id: "ghi_...", accountLogin: "acme", status: "active" }]
```
### Inline short-lived token
@@ -103,15 +87,15 @@ installed the App yet — **prefer the GitHub App.**
### Bring your own GitHub App (not yet available)
Not built yet — here's how we expect it to work. To have PRs and comments appear as
-*your own* App (branding, audit), you'll connect your GitHub App one of two ways: register
-its App id + private key with OpenComputer (OpenComputer mints the tokens), or keep the
-key and host a small endpoint OpenComputer calls to mint. Either way the repo model and
-session API below are unchanged.
+*your own* App (branding, audit), you'll register a GitHub App entity with OpenComputer:
+either store its App id + private key in OpenComputer, or keep the key and host a small
+token-broker endpoint. That App will then have its own installations. The repo and session
+shape below stay the same.
## Register a repo
-Once GitHub is connected, 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 installed, register a repo — optional: any installed repo can be
+used in a session directly; a Repo adds policy and a stable handle.
<CodeGroup>
@@ -133,7 +117,7 @@ Authorization: Bearer $OPENCOMPUTER_API_KEY
</CodeGroup>
Get-or-create, owner-scoped, idempotent by `(provider, owner, repo)`. **No credential is
-passed** — auth comes from your GitHub connection. Optional `defaults`:
+passed** — auth comes from the GitHub App installation. Optional `defaults`:
`{ branchNamespace, allow }` (`allow` is a GitHub permission ceiling; OpenComputer still
mints the minimum token per operation).
@@ -214,7 +198,7 @@ git-ops sandbox — the agent never runs authenticated `git`/`gh` and never sees
## Guarantees
-- **Connection-backed tokens are never stored** — OpenComputer mints short-lived,
+- **GitHub App-backed tokens are never stored** — OpenComputer mints short-lived,
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 the inline-token
workaround, held encrypted only until the first checkout, then purged.)
diff --git a/docs/agent-sessions/triggers.mdx b/docs/agent-sessions/triggers.mdx
index 2d3a220d..87fecfcd 100644
--- a/docs/agent-sessions/triggers.mdx
+++ b/docs/agent-sessions/triggers.mdx
@@ -18,9 +18,11 @@ on = "issue.labeled:agent"
- **Routing:** a routing key groups events into sessions — by default one session per issue; a comment on a PR the agent opened resumes the session that opened it.
- **Who can trigger:** restricted to members of your organization by default, configurable per agent.
-## Connections
+## Integrations
-Triggers, and the deliveries that carry work back out, run through **connections** — integrations the platform operates, so the agent holds no tokens. Installing the OpenComputer GitHub App is the whole GitHub integration; a Slack connection powers the Slack [channel](/agent-sessions/channels). Model provider keys are connections too.
+Triggers, and the deliveries that carry work back out, run through platform-operated
+integrations, so the agent holds no tokens. Installing the OpenComputer GitHub App is the
+GitHub integration; a Slack integration powers the Slack [channel](/agent-sessions/channels).
## Deliveries
diff --git a/sdks/typescript/src/agents/client.ts b/sdks/typescript/src/agents/client.ts
index c0c6d118..008613f8 100644
--- a/sdks/typescript/src/agents/client.ts
+++ b/sdks/typescript/src/agents/client.ts
@@ -22,7 +22,7 @@ export class OpenComputer {
readonly sessions: Sessions;
readonly credentials: Credentials;
readonly repos: Repos;
- /** GitHub integration (`oc.github.connections.list()`). Connect via the OpenComputer App. */
+ /** GitHub integration (`oc.github.installations.list()`). Connect via the OpenComputer App. */
readonly github: GitHub;
constructor(opts: OpenComputerOptions) {
diff --git a/sdks/typescript/src/agents/index.ts b/sdks/typescript/src/agents/index.ts
index 75f055b9..6f29e844 100644
--- a/sdks/typescript/src/agents/index.ts
+++ b/sdks/typescript/src/agents/index.ts
@@ -9,10 +9,10 @@ export type {
} from "./sessions.js";
export { Agents } from "./agents.js";
export type { CreateAgentParams, UpdateAgentParams, Page } from "./agents.js";
-export { Repos, GitHub, Connections } from "./repos.js";
+export { Repos, GitHub, GitHubInstallations } from "./repos.js";
export type {
CreateRepoParams, UpdateRepoParams, Repo, RepoDefaults, GitHubPermission,
- Connection, ConnectionInstallUrlParams,
+ GitHubInstallation,
} from "./repos.js";
export { Credentials } from "./credentials.js";
export type { CreateCredentialParams } from "./credentials.js";
diff --git a/sdks/typescript/src/agents/repos.ts b/sdks/typescript/src/agents/repos.ts
index cc51577e..9fc2f912 100644
--- a/sdks/typescript/src/agents/repos.ts
+++ b/sdks/typescript/src/agents/repos.ts
@@ -22,15 +22,15 @@ export interface CreateRepoParams {
repo: string;
/** Optional handle for your own reference; identity is (provider, owner, repo). */
name?: string;
- /** Optional explicit GitHub connection id. Defaults to your org's connection. */
- connectionId?: string;
+ /** Optional explicit GitHub App installation id. Usually resolved from owner/repo. */
+ installationId?: string;
defaults?: RepoDefaults;
}
export interface UpdateRepoParams {
defaults?: RepoDefaults;
name?: string;
- connectionId?: string;
+ installationId?: string;
}
export interface Repo {
@@ -39,43 +39,35 @@ export interface Repo {
owner: string;
repo: string;
name?: string;
- /** The GitHub connection that authorizes this repo (auth lives there, not here). */
- connectionId?: string;
+ /** The GitHub App installation that authorizes this repo (auth lives there, not here). */
+ installationId?: string;
defaults?: RepoDefaults;
createdAt?: string;
updatedAt?: string;
}
/**
- * How OpenComputer mints GitHub tokens for your org. Created by **installing the
- * OpenComputer GitHub App** (recommended) — bring-your-own App + broker are coming soon.
- * No GitHub credential is ever returned.
+ * An installation of the OpenComputer GitHub App on a GitHub user/org. OpenComputer uses
+ * this to mint short-lived, repo-scoped tokens just in time; no token is ever returned.
*/
-export interface Connection {
- id: string; // conn_…
- provider: string;
- /** `oc_app` today; `byo_app_key` / `byo_broker` coming soon. */
- type: "oc_app" | "byo_app_key" | "byo_broker";
+export interface GitHubInstallation {
+ id: string; // ghi_…
status: "active" | "suspended" | "revoked";
/** The GitHub org/user the App is installed on. */
accountLogin: string;
+ /** GitHub's raw installation id, when exposed for audit/debug. */
+ githubInstallationId?: number;
+ repositorySelection?: "all" | "selected";
createdAt?: string;
}
export interface Page<T> { data: T[]; nextCursor?: string | null; }
-export interface ConnectionInstallUrlParams {
- /** Optional GitHub org/user login to preselect when GitHub supports it. */
- account?: string;
- /** Optional app URL to return to after setup completes. */
- redirectUrl?: string;
-}
-
/**
* Repos — repository identity + policy (the "where" a session works), analogous to
- * {@link Agents}. Auth comes from your GitHub {@link Connection}; no credential is passed
- * here. Register once and reference from `sources: [{ repo, ref, sha }]`. A session can
- * also reference `"owner/repo"` directly without creating a Repo handle. See the
+ * {@link Agents}. Auth comes from a GitHub App installation; no credential is passed here.
+ * Register once and reference from `sources: [{ repo, ref, sha }]`. A session can also
+ * reference `"owner/repo"` directly without creating a Repo handle. See the
* [Repos guide](https://docs.opencomputer.dev/agent-sessions/repos).
*/
export class Repos {
@@ -96,26 +88,18 @@ export class Repos {
}
}
-/** GitHub integration surface (`oc.github`). v1: list your connected installs. */
+/** GitHub integration surface (`oc.github`). v1: list OpenComputer App installations. */
export class GitHub {
- readonly connections: Connections;
+ readonly installations: GitHubInstallations;
constructor(http: Http) {
- this.connections = new Connections(http);
+ this.installations = new GitHubInstallations(http);
}
}
-/** Connected GitHub Apps (installs) for your org. Created via the install flow, not the API. */
-export class Connections {
+/** OpenComputer GitHub App installations available to your org. */
+export class GitHubInstallations {
constructor(private readonly http: Http) {}
- /** Create a GitHub App installation URL. Redirect your user to this URL, then poll/list. */
- async installUrl(params: ConnectionInstallUrlParams = {}): Promise<string> {
- const r = await this.http.request<{ url: string }>(
- "POST", "/github/connections/install-url",
- { body: params },
- );
- return r.url;
- }
- list(): Promise<Page<Connection>> {
- return this.http.request("GET", "/github/connections");
+ list(): Promise<Page<GitHubInstallation>> {
+ return this.http.request("GET", "/github/installations");
}
}
diff --git a/sdks/typescript/src/agents/sessions.ts b/sdks/typescript/src/agents/sessions.ts
index e16b10e0..b5c599b0 100644
--- a/sdks/typescript/src/agents/sessions.ts
+++ b/sdks/typescript/src/agents/sessions.ts
@@ -45,7 +45,7 @@ export type SessionSource = RegisteredRepoSource | InlineRepoSource;
export interface RegisteredRepoSource {
/** A registered repo id (`repo_…`) or `owner/repo` slug. Auth comes from your GitHub
- * connection (the installed OpenComputer App) — no per-source credential. */
+ * App installation — no per-source credential. */
repo: string;
url?: never;
auth?: never;
@@ -64,7 +64,7 @@ export interface InlineRepoSource {
ref: string;
sha: string;
name?: string;
- /** Inline auth (registered repos use the connection instead — no per-source auth). */
+ /** Inline auth (registered repos use the GitHub App installation instead). */
auth: SourceAuth;
}
@@ -83,8 +83,8 @@ export type SourceStatus =
export type SourceErrorCode =
| "source.auth_required"
| "source.auth_ambiguous"
- | "source.connection_suspended"
- | "source.connection_revoked"
+ | "source.installation_suspended"
+ | "source.installation_revoked"
| "source.repo_not_selected"
| "source.permission_missing"
| "source.mint_failed"