Skip to content

An open-source, faster Devin alternative

TypeScript

SDK: the management client's subpath is @opencomputer/sdk/agents

Igor Zalutski46ae81454cb7
diff --git a/docs/agents/api.mdx b/docs/agents/api.mdx
index 05282426..2e7670c2 100644
--- a/docs/agents/api.mdx
+++ b/docs/agents/api.mdx
@@ -20,8 +20,8 @@ attaches through your own routes without seeing the key.
Request and response bodies are JSON. Paths below are relative to the base
URL; `<p>` is a project ID and `<r>` a memory resource ID. The
-[TypeScript client](/reference/typescript-sdk/managed-agents) on
-`@opencomputer/sdk/managed-agents` mirrors these routes one to one.
+[TypeScript client](/reference/typescript-sdk/agents) on
+`@opencomputer/sdk/agents` mirrors these routes one to one.
## Errors
@@ -316,7 +316,7 @@ curl -X PUT 'https://app.opencomputer.dev/api/managed-agents/projects/<project-i
```
`oc.sessions.startOnDocument` on the
-[TypeScript client](/reference/typescript-sdk/managed-agents) does this
+[TypeScript client](/reference/typescript-sdk/agents) does this
create and the session create in one call.
## Webhooks
diff --git a/docs/agents/document-memory.mdx b/docs/agents/document-memory.mdx
index c1024a41..14d5eadb 100644
--- a/docs/agents/document-memory.mdx
+++ b/docs/agents/document-memory.mdx
@@ -97,7 +97,7 @@ application still means "these notes, this session", so the SDK and the CLI
do the two steps in order and make the pair converge on retry.
```ts
-import { OpenComputer } from "@opencomputer/sdk/managed-agents";
+import { OpenComputer } from "@opencomputer/sdk/agents";
const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });
const { document, session } = await oc.sessions.startOnDocument({
@@ -138,7 +138,7 @@ as "exists" (then `GET` it; `404` means the id was deleted), and `POST
/api/managed-agents/sessions` with an `Idempotency-Key`; `201` created the
session, `200` returned the one that key had already created. The call's
parameters and errors are in the
-[Serverless Agents client reference](/reference/typescript-sdk/managed-agents#start-a-session-on-a-memory-document).
+[Serverless Agents client reference](/reference/typescript-sdk/agents#start-a-session-on-a-memory-document).
## Reading
diff --git a/docs/agents/memory.mdx b/docs/agents/memory.mdx
index a9072593..9875b0cc 100644
--- a/docs/agents/memory.mdx
+++ b/docs/agents/memory.mdx
@@ -86,7 +86,7 @@ credentials nor permission to select another document. A
browse documents with `memory_list` and `memory_read`.
The document must exist before the session binds it. `sessions.startOnDocument`
-on the [TypeScript client](/reference/typescript-sdk/managed-agents)
+on the [TypeScript client](/reference/typescript-sdk/agents)
creates it if needed and then the session, and the CLI's
`session create --memory notes=workshop --create-document` does the same.
diff --git a/docs/agents/react.mdx b/docs/agents/react.mdx
index a64cbf5e..d7d8cea0 100644
--- a/docs/agents/react.mdx
+++ b/docs/agents/react.mdx
@@ -29,13 +29,13 @@ session id.
Create the session where the API key lives. With memory, that is also where
the bindings are chosen; the browser can neither see the key nor change what
the session may read or write. `oc.sessions.startOnDocument` on the
-[management client](/reference/typescript-sdk/managed-agents) creates the
+[management client](/reference/typescript-sdk/agents) creates the
document if it does not exist yet, then the session bound to it, both
converging under one idempotency key
([details](/agents/document-memory#start-a-session-on-a-new-document)):
```ts
-import { OpenComputer } from "@opencomputer/sdk/managed-agents";
+import { OpenComputer } from "@opencomputer/sdk/agents";
const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });
const { session } = await oc.sessions.startOnDocument({
diff --git a/docs/agents/sessions.mdx b/docs/agents/sessions.mdx
index 8855503e..26d5c8e8 100644
--- a/docs/agents/sessions.mdx
+++ b/docs/agents/sessions.mdx
@@ -104,7 +104,7 @@ the command exits.
Applications create sessions with the [management API](/agents/api): `POST
/api/managed-agents/sessions` with an API key, then turns and the event log
under that session. The
-[TypeScript client](/reference/typescript-sdk/managed-agents) wraps those
+[TypeScript client](/reference/typescript-sdk/agents) wraps those
routes; its `sessions.startOnDocument` creates a memory document and a
session bound to it in one call. In the browser, the
[`useAgent`](/agents/react) hook attaches to a session your server created
diff --git a/docs/docs.json b/docs/docs.json
index cb0e7017..4b5c0e12 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -190,7 +190,7 @@
"reference/typescript-sdk/image",
"reference/typescript-sdk/snapshots",
"reference/typescript-sdk/secrets",
- "reference/typescript-sdk/managed-agents"
+ "reference/typescript-sdk/agents"
]
},
{
diff --git a/docs/reference/typescript-sdk.mdx b/docs/reference/typescript-sdk.mdx
index fa9685eb..0df115eb 100644
--- a/docs/reference/typescript-sdk.mdx
+++ b/docs/reference/typescript-sdk.mdx
@@ -881,7 +881,7 @@ const apiResult = await sandbox.commands.run(
## Serverless Agents client
The management API client for Serverless Agents is a separate, portable
-subpath of the same package, `@opencomputer/sdk/managed-agents`, with the
+subpath of the same package, `@opencomputer/sdk/agents`, with the
memory and event subscription types and `startSessionOnDocument`. It is
documented on its own page:
-[Serverless Agents client](/reference/typescript-sdk/managed-agents).
+[Serverless Agents client](/reference/typescript-sdk/agents).
diff --git a/docs/reference/typescript-sdk/managed-agents.mdx b/docs/reference/typescript-sdk/agents.mdx
similarity index 99%
rename from docs/reference/typescript-sdk/managed-agents.mdx
rename to docs/reference/typescript-sdk/agents.mdx
index 18a432a5..602f697a 100644
--- a/docs/reference/typescript-sdk/managed-agents.mdx
+++ b/docs/reference/typescript-sdk/agents.mdx
@@ -1,9 +1,9 @@
---
title: "Serverless Agents client"
-description: "The management API client on the portable @opencomputer/sdk/managed-agents subpath"
+description: "The management API client on the portable @opencomputer/sdk/agents subpath"
---
-`@opencomputer/sdk/managed-agents` is the TypeScript client for the
+`@opencomputer/sdk/agents` is the TypeScript client for the
[management API](/agents/api): create sessions, send turns, read the event
log, list and label sessions, and manage a project's memory, webhooks, event
subscriptions and GitHub repositories. It is the server-side leg of an
@@ -21,7 +21,7 @@ npm install @opencomputer/sdk
```
```typescript
-import { OpenComputer, OpenComputerError } from "@opencomputer/sdk/managed-agents";
+import { OpenComputer, OpenComputerError } from "@opencomputer/sdk/agents";
const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });
```
diff --git a/docs/reference/typescript-sdk/overview.mdx b/docs/reference/typescript-sdk/overview.mdx
index cc0b4adb..27c0f31c 100644
--- a/docs/reference/typescript-sdk/overview.mdx
+++ b/docs/reference/typescript-sdk/overview.mdx
@@ -54,7 +54,7 @@ import { Image, Snapshots } from "@opencomputer/sdk/node";
<Card title="Secret Stores" icon="key" href="/reference/typescript-sdk/secrets">
Manage secrets and egress control
</Card>
- <Card title="Serverless Agents client" icon="robot" href="/reference/typescript-sdk/managed-agents">
- The management API client on the portable `@opencomputer/sdk/managed-agents` subpath
+ <Card title="Serverless Agents client" icon="robot" href="/reference/typescript-sdk/agents">
+ The management API client on the portable `@opencomputer/sdk/agents` subpath
</Card>
</CardGroup>
diff --git a/sdks/typescript/CHANGELOG.md b/sdks/typescript/CHANGELOG.md
index 3154eba6..5391d0ca 100644
--- a/sdks/typescript/CHANGELOG.md
+++ b/sdks/typescript/CHANGELOG.md
@@ -8,7 +8,7 @@ sessions, credentials, repos, GitHub apps, hooks, watches, schedules and
destinations resources are removed. Customers of that API pin the last
published version that has it, `1.1.1`.
-- `@opencomputer/sdk/managed-agents` is a new subpath export: the
+- `@opencomputer/sdk/agents` is a new subpath export: the
`OpenComputer` client for the Serverless Agents management API at
`app.opencomputer.dev/api/managed-agents`, mirroring the documented routes
(`sessions`, `sessions.turns`, `sessions.events`, `projects`,
diff --git a/sdks/typescript/README.md b/sdks/typescript/README.md
index 5704c05b..9dcab67f 100644
--- a/sdks/typescript/README.md
+++ b/sdks/typescript/README.md
@@ -1,6 +1,6 @@
# @opencomputer/sdk
-The official TypeScript SDK for [OpenComputer](https://github.com/diggerhq/opencomputer): the **cloud sandbox** client at the package root, and the **Serverless Agents** management client on the portable `@opencomputer/sdk/managed-agents` subpath.
+The official TypeScript SDK for [OpenComputer](https://github.com/diggerhq/opencomputer): the **cloud sandbox** client at the package root, and the **Serverless Agents** management client on the portable `@opencomputer/sdk/agents` subpath.
> Versions before 2.0.0 also carried a client for the retired Durable Agent Sessions API; see [CHANGELOG](./CHANGELOG.md).
@@ -34,7 +34,7 @@ await sandbox.kill();
Serverless Agents (`opencomputer deploy`) are managed over the [management API](https://opencomputer.dev/agents/api). The client for it is a separate subpath export whose module graph has no Node dependency and runs nothing at import, so the same code serves a Cloudflare Worker without Node compatibility, Vercel, Deno and Node. Use it from trusted server code; the API key must not reach a browser.
```typescript
-import { OpenComputer, OpenComputerError } from "@opencomputer/sdk/managed-agents";
+import { OpenComputer, OpenComputerError } from "@opencomputer/sdk/agents";
const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });
@@ -109,7 +109,7 @@ if (delivery.type === "sandbox.stopped") {
| `apiUrl` | `OPENCOMPUTER_API_URL` | `https://app.opencomputer.dev` |
| `apiKey` | `OPENCOMPUTER_API_KEY` | (none) |
-**Serverless Agents** (`OpenComputer` from `@opencomputer/sdk/managed-agents`):
+**Serverless Agents** (`OpenComputer` from `@opencomputer/sdk/agents`):
| Option | Default |
|-----------|----------------------------------------------------|
diff --git a/sdks/typescript/package.json b/sdks/typescript/package.json
index edf56adc..b9e5cf55 100644
--- a/sdks/typescript/package.json
+++ b/sdks/typescript/package.json
@@ -10,9 +10,9 @@
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
- "./managed-agents": {
- "types": "./dist/managed-agents/index.d.ts",
- "import": "./dist/managed-agents/index.js"
+ "./agents": {
+ "types": "./dist/agents/index.d.ts",
+ "import": "./dist/agents/index.js"
},
"./node": {
"types": "./dist/node.d.ts",
diff --git a/sdks/typescript/src/managed-agents/client.test.ts b/sdks/typescript/src/agents/client.test.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/client.test.ts
rename to sdks/typescript/src/agents/client.test.ts
diff --git a/sdks/typescript/src/managed-agents/client.ts b/sdks/typescript/src/agents/client.ts
similarity index 99%
rename from sdks/typescript/src/managed-agents/client.ts
rename to sdks/typescript/src/agents/client.ts
index d9121f4b..f1f47cc6 100644
--- a/sdks/typescript/src/managed-agents/client.ts
+++ b/sdks/typescript/src/agents/client.ts
@@ -493,7 +493,7 @@ export class Deployments {
* The management API client.
*
* ```ts
- * import { OpenComputer } from "@opencomputer/sdk/managed-agents";
+ * import { OpenComputer } from "@opencomputer/sdk/agents";
* const oc = new OpenComputer({ apiKey: process.env.OPENCOMPUTER_API_KEY! });
* const { session } = await oc.sessions.create({ agentId: "worker@development" }, { idempotencyKey: taskId });
* await oc.sessions.turns.send(session.id, { input: "Plan the workshop.", idempotencyKey: `${taskId}/start` });
diff --git a/sdks/typescript/src/managed-agents/errors.ts b/sdks/typescript/src/agents/errors.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/errors.ts
rename to sdks/typescript/src/agents/errors.ts
diff --git a/sdks/typescript/src/managed-agents/event-subscriptions.test.ts b/sdks/typescript/src/agents/event-subscriptions.test.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/event-subscriptions.test.ts
rename to sdks/typescript/src/agents/event-subscriptions.test.ts
diff --git a/sdks/typescript/src/managed-agents/event-subscriptions.ts b/sdks/typescript/src/agents/event-subscriptions.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/event-subscriptions.ts
rename to sdks/typescript/src/agents/event-subscriptions.ts
diff --git a/sdks/typescript/src/managed-agents/http.ts b/sdks/typescript/src/agents/http.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/http.ts
rename to sdks/typescript/src/agents/http.ts
diff --git a/sdks/typescript/src/managed-agents/index.ts b/sdks/typescript/src/agents/index.ts
similarity index 95%
rename from sdks/typescript/src/managed-agents/index.ts
rename to sdks/typescript/src/agents/index.ts
index 60f726b7..329b51ec 100644
--- a/sdks/typescript/src/managed-agents/index.ts
+++ b/sdks/typescript/src/agents/index.ts
@@ -1,4 +1,4 @@
-// @opencomputer/sdk/managed-agents: the management API client and its types.
+// @opencomputer/sdk/agents: the management API client and its types.
//
// This module graph is portable: fetch, URL, Headers and Web Crypto only, no
// Node built-ins, nothing run at import. It loads the same in a Cloudflare
diff --git a/sdks/typescript/src/managed-agents/memory.ts b/sdks/typescript/src/agents/memory.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/memory.ts
rename to sdks/typescript/src/agents/memory.ts
diff --git a/sdks/typescript/src/managed-agents/portability.test.ts b/sdks/typescript/src/agents/portability.test.ts
similarity index 98%
rename from sdks/typescript/src/managed-agents/portability.test.ts
rename to sdks/typescript/src/agents/portability.test.ts
index c513e6f8..22fa698e 100644
--- a/sdks/typescript/src/managed-agents/portability.test.ts
+++ b/sdks/typescript/src/agents/portability.test.ts
@@ -30,7 +30,7 @@ function moduleGraph(entry: string): Map<string, string> {
return seen;
}
-describe("@opencomputer/sdk/managed-agents", () => {
+describe("@opencomputer/sdk/agents", () => {
const graph = moduleGraph(resolve(here, "index.ts"));
it("reaches only relative modules inside its own directory", () => {
diff --git a/sdks/typescript/src/managed-agents/redirect.test.ts b/sdks/typescript/src/agents/redirect.test.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/redirect.test.ts
rename to sdks/typescript/src/agents/redirect.test.ts
diff --git a/sdks/typescript/src/managed-agents/shapes.ts b/sdks/typescript/src/agents/shapes.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/shapes.ts
rename to sdks/typescript/src/agents/shapes.ts
diff --git a/sdks/typescript/src/managed-agents/start-on-document.test.ts b/sdks/typescript/src/agents/start-on-document.test.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/start-on-document.test.ts
rename to sdks/typescript/src/agents/start-on-document.test.ts
diff --git a/sdks/typescript/src/managed-agents/start-on-document.ts b/sdks/typescript/src/agents/start-on-document.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/start-on-document.ts
rename to sdks/typescript/src/agents/start-on-document.ts
diff --git a/sdks/typescript/src/managed-agents/types.ts b/sdks/typescript/src/agents/types.ts
similarity index 100%
rename from sdks/typescript/src/managed-agents/types.ts
rename to sdks/typescript/src/agents/types.ts
diff --git a/sdks/typescript/src/index.ts b/sdks/typescript/src/index.ts
index a658f5c5..372256ee 100644
--- a/sdks/typescript/src/index.ts
+++ b/sdks/typescript/src/index.ts
@@ -4,7 +4,7 @@
// request and warmed on the first `Sandbox.create`.
//
// The management API client for Serverless Agents lives on its own portable
-// subpath, `@opencomputer/sdk/managed-agents`, whose module graph has no Node
+// subpath, `@opencomputer/sdk/agents`, whose module graph has no Node
// dependency. It is not re-exported here so that importing it never drags
// this graph along.