Skip to content

An open-source, faster Devin alternative

TypeScript

docs+sdk: align repos with backend contract (app_id pin, drop policy, checkout-only inline tokens)

Igor Zalutski92211767a0e2
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index 3623d4e6..90ef8704 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
-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 + policy. See the [Repos & GitHub guide](/agent-sessions/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-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.**
@@ -273,7 +273,7 @@ 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 policy `defaults`. |
+| `oc.repos.update(id, params)` | Update `name` / `appId`. |
</Tab>
@@ -283,19 +283,19 @@ 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 policy `defaults`. |
+| `PATCH /repos/:id` | Update `name` / `app_id`. |
</Tab>
</Tabs>
-Repo create body: `owner`, `repo`, `provider?` (`github`, default), `name?` (a handle), `app_id?`, `defaults?`. **No `auth`** — auth resolves through the GitHub App. **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), `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 = { id, provider, owner, repo, name?, app_id?, defaults?, created_at, updated_at }
+Repo = { id, provider, owner, repo, name?, app_id?, created_at, updated_at }
```
-Responses **never** contain a token or secret. (SDK camelCase: `branchNamespace`, `appId`.) 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: `appId`.) 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 4cda608c..3c856c32 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -22,7 +22,7 @@ sandbox.
| --- | --- | --- |
| 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, permission ceiling. | No tokens, private keys, or session refs. |
+| 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. |
| Git operations sandbox | Runs authenticated clone/fetch/publish work. | Separate from the agent; token lives only for one operation. |
@@ -84,7 +84,9 @@ Apps, because your backend owns that state.
### Inline short-lived token
The no-setup path is to pass a real short-lived token inline on the source, using the
-deliberately-named `risky_short_lived_token` auth:
+deliberately-named `risky_short_lived_token` auth. An inline token is **checkout-only**:
+it is used once to check the repo out and then purged, so it **cannot publish or open
+PRs**. Publishing requires a configured GitHub App (the OpenComputer App).
<CodeGroup>
@@ -117,10 +119,11 @@ sources: [{
</CodeGroup>
<Warning>
-The inline token **can't refresh** — once it expires the session can't fetch, push, or
-recover, so use it only for sessions that finish within the token's life. OpenComputer
-rejects a far-future or missing expiry and holds it encrypted only until the first
-checkout, then purges it. Use this only when a GitHub App is not configured.
+The inline token is **checkout-only** — it checks the repo out once and is then purged, so
+it **cannot publish or open PRs** (publishing requires a configured GitHub App). It also
+**can't refresh**, so use it only for sessions that finish within the token's life.
+OpenComputer rejects a far-future or missing expiry and holds the token encrypted only
+until the first checkout, then purges it. Use this only when a GitHub App is not configured.
</Warning>
## Register a repo
@@ -135,7 +138,6 @@ const repo = await oc.repos.create({
owner: "acme",
repo: "web",
// appId: "gha_...", // optional: org default, then OC App
- defaults: { allow: ["contents:read"] },
});
```
@@ -151,9 +153,6 @@ Authorization: Bearer $OPENCOMPUTER_API_KEY
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.
-Optional `defaults`:
-`{ branchNamespace, allow }` (`allow` is a GitHub permission ceiling; OpenComputer still
-requests the minimum token per operation).
## Use it in a session
diff --git a/sdks/typescript/package-lock.json b/sdks/typescript/package-lock.json
index c2cca828..42cbd54d 100644
--- a/sdks/typescript/package-lock.json
+++ b/sdks/typescript/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@opencomputer/sdk",
- "version": "0.8.0",
+ "version": "0.8.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@opencomputer/sdk",
- "version": "0.8.0",
+ "version": "0.8.1",
"license": "MIT",
"devDependencies": {
"@types/node": "^25.3.0",
diff --git a/sdks/typescript/package.json b/sdks/typescript/package.json
index 2ad6da60..bac1d998 100644
--- a/sdks/typescript/package.json
+++ b/sdks/typescript/package.json
@@ -1,6 +1,6 @@
{
"name": "@opencomputer/sdk",
- "version": "0.8.0",
+ "version": "0.8.1",
"description": "TypeScript SDK for OpenComputer - cloud sandbox platform",
"type": "module",
"main": "dist/index.js",
diff --git a/sdks/typescript/src/agents/index.ts b/sdks/typescript/src/agents/index.ts
index fc59213e..394c97a0 100644
--- a/sdks/typescript/src/agents/index.ts
+++ b/sdks/typescript/src/agents/index.ts
@@ -11,7 +11,7 @@ export { Agents } from "./agents.js";
export type { CreateAgentParams, UpdateAgentParams, Page } from "./agents.js";
export { Repos, GitHub, GitHubApps, GitHubInstallations } from "./repos.js";
export type {
- CreateRepoParams, UpdateRepoParams, Repo, RepoDefaults, GitHubPermission,
+ CreateRepoParams, UpdateRepoParams, Repo,
GitHubApp, GitHubAppMode, GitHubAppStatus, GitHubInstallation,
ListGitHubInstallationsParams,
} from "./repos.js";
diff --git a/sdks/typescript/src/agents/repos.ts b/sdks/typescript/src/agents/repos.ts
index 960c8f6e..81cbd50a 100644
--- a/sdks/typescript/src/agents/repos.ts
+++ b/sdks/typescript/src/agents/repos.ts
@@ -1,35 +1,19 @@
import type { Http, Query } from "./http.js";
-export type GitHubPermission =
- | "contents:read" | "contents:write"
- | "pull_requests:read" | "pull_requests:write"
- | "issues:read" | "issues:write"
- | "statuses:read" | "statuses:write"
- | "checks:read" | "checks:write"
- | (string & {});
-
-export interface RepoDefaults {
- /** Branch namespace for agent pushes; default `oc/{session}/`. No protected/base push. */
- branchNamespace?: string;
- /** GitHub permission ceiling (e.g. `contents:read`, `pull_requests:write`) this repo
- * may ever authorize — a ceiling; each operation still requests the minimum token. */
- allow?: GitHubPermission[];
-}
-
export interface CreateRepoParams {
provider?: "github"; // default: github
owner: string;
repo: string;
/** Optional handle for your own reference; identity is (provider, owner, repo). */
name?: string;
- /** Optional explicit GitHub App id. Defaults to your org's default app, then the OC App. */
+ /** 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;
- defaults?: RepoDefaults;
}
export interface UpdateRepoParams {
- defaults?: RepoDefaults;
name?: string;
+ /** The GitHub App this repo resolves to (↔ `app_id` on the wire). */
appId?: string;
}
@@ -39,9 +23,8 @@ export interface Repo {
owner: string;
repo: string;
name?: string;
- /** The GitHub App that authorizes this repo (auth lives there, not here). */
+ /** The GitHub App this repo resolves to (auth lives there, not here). */
appId?: string;
- defaults?: RepoDefaults;
createdAt?: string;
updatedAt?: string;
}
@@ -96,7 +79,7 @@ export interface ListGitHubInstallationsParams {
}
/**
- * Repos — provider-neutral repository identity + policy (the "where" a session works).
+ * Repos — provider-neutral repository identity (the "where" a session works).
* Auth for GitHub repos resolves through a GitHub App; 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
diff --git a/sdks/typescript/src/agents/sessions.ts b/sdks/typescript/src/agents/sessions.ts
index 0fa9e80e..4e5d6c43 100644
--- a/sdks/typescript/src/agents/sessions.ts
+++ b/sdks/typescript/src/agents/sessions.ts
@@ -69,10 +69,11 @@ export interface InlineRepoSource {
}
/**
- * Inline-source auth — the **no-setup workaround**. Pass a real short-lived token; it
- * works today but **can't refresh** (once it expires the session can't fetch/push/recover),
- * so it's only for sessions that finish within the token's life. Prefer connecting a
- * GitHub App (durable). Held encrypted, used once, then purged.
+ * Inline-source auth — the **no-setup workaround**, and **checkout-only**. Pass a real
+ * short-lived token; it is used once to check the repo out and then **purged immediately**,
+ * so it **cannot publish or open PRs** — publishing requires a configured GitHub App (the
+ * OpenComputer App). Prefer connecting a GitHub App (durable). Held encrypted, used once
+ * for checkout, then purged.
*/
export type SourceAuth =
| { type: "risky_short_lived_token"; token: string; expiresAt: string };