@celestoai/sdk 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +130 -254
  3. package/dist/{chunk-52TE4RZV.js → chunk-3HEUI5UL.js} +341 -306
  4. package/dist/chunk-3HEUI5UL.js.map +1 -0
  5. package/dist/computers/index.cjs +211 -347
  6. package/dist/computers/index.cjs.map +1 -1
  7. package/dist/computers/index.d.cts +1 -239
  8. package/dist/computers/index.d.ts +1 -239
  9. package/dist/computers/index.js +1 -2
  10. package/dist/index-59d7VJXL.d.cts +303 -0
  11. package/dist/index-59d7VJXL.d.ts +303 -0
  12. package/dist/index.cjs +252 -1573
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +22 -4
  15. package/dist/index.d.ts +22 -4
  16. package/dist/index.js +5 -61
  17. package/package.json +25 -22
  18. package/dist/agents/index.cjs +0 -1226
  19. package/dist/agents/index.cjs.map +0 -1
  20. package/dist/agents/index.d.cts +0 -2
  21. package/dist/agents/index.d.ts +0 -2
  22. package/dist/agents/index.js +0 -60
  23. package/dist/agents/index.js.map +0 -1
  24. package/dist/chunk-52TE4RZV.js.map +0 -1
  25. package/dist/chunk-6Y2YZCPU.js +0 -1007
  26. package/dist/chunk-6Y2YZCPU.js.map +0 -1
  27. package/dist/chunk-P7F52CSQ.js +0 -177
  28. package/dist/chunk-P7F52CSQ.js.map +0 -1
  29. package/dist/chunk-THPVQCTE.js +0 -183
  30. package/dist/chunk-THPVQCTE.js.map +0 -1
  31. package/dist/config-dDPvsH-K.d.cts +0 -42
  32. package/dist/config-dDPvsH-K.d.ts +0 -42
  33. package/dist/gatekeeper/index.cjs +0 -348
  34. package/dist/gatekeeper/index.cjs.map +0 -1
  35. package/dist/gatekeeper/index.d.cts +0 -104
  36. package/dist/gatekeeper/index.d.ts +0 -104
  37. package/dist/gatekeeper/index.js +0 -8
  38. package/dist/gatekeeper/index.js.map +0 -1
  39. package/dist/index-Cii1_OFg.d.ts +0 -696
  40. package/dist/index-CsEA7qMF.d.cts +0 -696
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Cloud TypeScript SDK changelog
2
+
3
+ ## 0.1.7
4
+
5
+ - Moved the Cloud TypeScript SDK into the Celesto repository. The npm package
6
+ name and the import paths for computers are unchanged. Imported from
7
+ [`CelestoAI/sdk` at `1ab90c7`](https://github.com/CelestoAI/sdk/tree/1ab90c7fa0d845800c5e93a5a43ef163661e3f5b/ts).
8
+ - Removed `GatekeeperClient` and `@celestoai/sdk/gatekeeper`. The Cloud API no
9
+ longer offers Gatekeeper or its delegated Google Drive access.
10
+ - Removed `ManagedAgentsClient` and `@celestoai/sdk/agents`. The Cloud API no
11
+ longer serves managed agents, runs, sessions, or their settings.
12
+ - `Computer.create()` now sends the required `Idempotency-Key`. Pass
13
+ `idempotencyKey` to reuse a key on retry.
14
+ - Use `sizeId` instead of CPU, memory, or disk overrides, which are now
15
+ rejected before the request. The SDK also rejects unknown create options.
16
+ - `runStream()` and `execStream()` yield buffered output and an exit event
17
+ after `/exec` completes. They no longer call the unavailable `/exec/stream`
18
+ endpoint. Aborting stops the HTTP request, not necessarily the remote command.
19
+ - The computer SDK reads logins saved by `celesto auth login` and keeps each
20
+ saved key on its original API URL.
21
+ - Requests honor their configured deadline even when a caller also supplies
22
+ an abort signal.
23
+ - Published separate TypeScript declarations for ESM and CommonJS consumers.
24
+ - Added `lost` to the computer status type and list filter.
package/README.md CHANGED
@@ -11,11 +11,9 @@ Use this package when you want to:
11
11
  - Run an AI agent or harness in a clean computer.
12
12
  - Run shell commands from JavaScript or TypeScript.
13
13
  - Keep agent work separate from your laptop, server, or production system.
14
- - Run an agent for each of your own users, with a spending limit per user.
15
- - Ask a user to approve access to Google Drive through Gatekeeper.
16
14
 
17
- Gatekeeper is Celesto's access helper. It lets a user approve which external
18
- files or folders your app can use.
15
+ This is the Cloud SDK. To run computers on your own machine, use the separate
16
+ [@celestoai/celesto](https://github.com/CelestoAI/celesto/tree/main/ts) package.
19
17
 
20
18
  ## Requirements
21
19
 
@@ -29,6 +27,8 @@ files or folders your app can use.
29
27
  npm install @celestoai/sdk
30
28
  ```
31
29
 
30
+ The computer examples below require `@celestoai/sdk` 0.1.7 or newer.
31
+
32
32
  Sign in once with the Celesto CLI:
33
33
 
34
34
  ```bash
@@ -36,7 +36,10 @@ pip install celesto
36
36
  celesto auth login
37
37
  ```
38
38
 
39
- The `Computer` API checks an explicitly passed `token` or `apiKey` first, then `CELESTO_API_KEY` in the shell, the current project's `.env`, and credentials saved by `celesto auth login`. You can use a local `.env` instead of the CLI:
39
+ The `Computer` API checks an explicitly passed `token` or `apiKey` first, then
40
+ `CELESTO_API_KEY` in the shell, the current project's `.env`, and credentials
41
+ saved by `celesto auth login`. A saved login is used only with the API URL it
42
+ was saved for. You can use a local `.env` instead of the CLI:
40
43
 
41
44
  ```bash .env
42
45
  CELESTO_API_KEY="your-api-key"
@@ -46,225 +49,76 @@ Add `.env` to `.gitignore`.
46
49
 
47
50
  ## Quickstart
48
51
 
49
- Create a file named `quickstart.mjs`:
52
+ Create a file named `quickstart.mjs`. `Computer.create()` can return before
53
+ the computer is ready, so check its status before running commands.
50
54
 
51
55
  ```js
56
+ import { setTimeout as delay } from "node:timers/promises";
52
57
  import { Computer } from "@celestoai/sdk";
53
58
 
54
59
  const computer = await Computer.create();
60
+ console.log(`Computer ID: ${computer.id}`);
55
61
  try {
56
- console.log(`Computer ready: ${computer.name}`);
62
+ const deadline = Date.now() + 60_000;
63
+ while (computer.status === "creating" && Date.now() < deadline) {
64
+ await delay(500);
65
+ await computer.refresh();
66
+ }
67
+ if (computer.status !== "running") {
68
+ throw new Error(`Computer ${computer.id} is ${computer.status}. Check it in the Cloud dashboard.`);
69
+ }
57
70
 
58
71
  const result = await computer.run("uname -a");
59
72
  console.log(result.stdout);
60
73
  } finally {
61
- await computer.delete();
74
+ if (computer.status !== "creating") await computer.delete();
62
75
  }
63
76
  ```
64
77
 
78
+ If it is still `creating` when the example stops waiting, check the printed
79
+ ID in the dashboard and delete it once creation finishes.
80
+
65
81
  Run it:
66
82
 
67
83
  ```bash
68
84
  node quickstart.mjs
69
85
  ```
70
86
 
71
- ## Run Agents for Your Users
72
-
73
- If you are building a product on top of an AI agent, every run happens for one
74
- of *your* users. Celesto keeps them apart: each run is recorded against the user
75
- it acted for, so you can see what that person's agent did and what it cost, and
76
- stop it from spending more than you allow.
77
-
78
- You identify each of your users with a string you already have — a database ID,
79
- an email, anything. Celesto stores it as you send it. There is no Celesto user
80
- ID to look up and no mapping table to keep.
81
-
82
- This example creates an agent, runs it for one user, prints the answer as it
83
- arrives, and then reads that user's spending.
84
-
85
- ```ts
86
- import { ManagedAgentsClient } from "@celestoai/sdk";
87
-
88
- const celesto = new ManagedAgentsClient({ apiKey: process.env.CELESTO_API_KEY });
89
-
90
- const agent = await celesto.agents.create({
91
- name: "support-bot",
92
- model: "openai/gpt-5.4-mini",
93
- instructions: "Answer order questions in one short paragraph.",
94
- });
95
-
96
- for await (const event of celesto.runs.stream(agent.id, {
97
- input: "Where is my order?",
98
- endUserId: "usr_8837",
99
- })) {
100
- if (event.name === "message.delta") process.stdout.write(event.data.text ?? "");
101
- }
102
-
103
- const { budget } = await celesto.endUsers.get("usr_8837");
104
- console.log(`\nSpent ${budget.spentUsd} of ${budget.capUsd}`);
105
- ```
106
-
107
- Switching on `event.name` narrows the event, so `event.data` is typed for that
108
- event and nothing else.
109
-
110
- ### Wait Instead of Streaming
111
-
112
- `stream()` gives you the answer as it is written. `create()` waits and gives you
113
- the finished run:
114
-
115
- ```ts
116
- import { ManagedAgentsClient } from "@celestoai/sdk";
117
-
118
- const celesto = new ManagedAgentsClient({ apiKey: process.env.CELESTO_API_KEY });
119
- const agentId = "agt_your_agent_id";
120
-
121
- const run = await celesto.runs.create(agentId, {
122
- input: "Where is my order?",
123
- endUserId: "usr_8837",
124
- });
125
- console.log(run.output, run.usage.costUsd);
126
- ```
127
-
128
- ### Money Is a String
129
-
130
- Every amount — `costUsd`, `spentUsd`, `capUsd` — is a decimal string such as
131
- `"0.000450"`, never a `number`. A single answer can cost a few millionths of a
132
- dollar, which a JavaScript number cannot hold exactly. Display and compare the
133
- string; if you need arithmetic, use a decimal library rather than `parseFloat`.
134
-
135
- Writes are strings too. `budgetCapUsd` is typed `string`, so a number fails to
136
- compile, and passing one anyway throws rather than sending it — `0.1 + 0.2`
137
- stringifies to `"0.30000000000000004"`, and the only place that can still be
138
- fixed is before it leaves your program.
139
-
140
- ### Set a Spending Limit
141
-
142
- Give one user a cap, or set the default for everyone:
143
-
144
- ```ts
145
- import { ManagedAgentsClient } from "@celestoai/sdk";
146
-
147
- const celesto = new ManagedAgentsClient({ apiKey: process.env.CELESTO_API_KEY });
148
-
149
- await celesto.endUsers.update("usr_8837", { budgetCapUsd: "5.00" });
150
- await celesto.settings.update({ defaultEndUserBudgetUsd: "0.50" });
151
- ```
152
-
153
- The cap covers a 30-day window that starts the first time that user runs
154
- anything. When it runs out, the next run throws `BudgetExceededError`, and a run
155
- already in flight stops at its next step with a `run.failed` event.
156
-
157
- ### Retry Safely
158
-
159
- Pass `idempotencyKey` to make a retry safe: sending the same key again returns
160
- the run that already happened instead of running the agent — and charging your
161
- user — twice.
162
-
163
- ```ts
164
- import { ManagedAgentsClient } from "@celestoai/sdk";
165
-
166
- const celesto = new ManagedAgentsClient({ apiKey: process.env.CELESTO_API_KEY });
167
- const agentId = "agt_your_agent_id";
168
-
169
- const run = await celesto.runs.create(agentId, {
170
- input: "Where is my order?",
171
- endUserId: "usr_8837",
172
- idempotencyKey: "order-status-42",
173
- });
174
- ```
175
-
176
- One conversation runs one agent at a time. If a second run arrives while the
177
- first is still going, Celesto throws `SessionBusyError`. Pass `maxRetries: 2` to
178
- wait and try again; the SDK creates an idempotency key for you when you do.
179
-
180
- ### Keep the Conversation Going
181
-
182
- Every run belongs to a session, which is that user's transcript. Leave
183
- `sessionId` out and Celesto starts one; pass it back to continue:
184
-
185
- ```ts
186
- import { ManagedAgentsClient } from "@celestoai/sdk";
187
-
188
- const celesto = new ManagedAgentsClient({ apiKey: process.env.CELESTO_API_KEY });
189
- const agentId = "agt_your_agent_id";
190
-
191
- const first = await celesto.runs.create(agentId, {
192
- input: "Hello",
193
- endUserId: "usr_8837",
194
- });
195
- const followUp = await celesto.runs.create(agentId, {
196
- input: "And the one before that?",
197
- endUserId: "usr_8837",
198
- sessionId: first.sessionId,
199
- });
200
- ```
201
-
202
- ### Change an Agent
203
-
204
- Updating an agent saves a new version and leaves the old ones readable. Runs
205
- remember the version they used, so a change never rewrites what already
206
- happened. `celesto.agents.activateVersion(agent.id, 1)` goes back.
207
-
208
87
  ## Computers
209
88
 
210
89
  A computer is a disposable cloud machine for your app or agent. By default,
211
90
  Celesto creates a `scratch` computer, which is a minimal Ubuntu computer.
212
91
 
213
- ### Create with Custom Resources
214
-
215
- Create a file named `create-computer.mjs`:
92
+ ### Choose a Size
216
93
 
217
94
  ```js
218
- import { Computer } from "@celestoai/sdk";
219
-
220
- const computer = await Computer.create({
221
- cpus: 2,
222
- memory: 2048,
223
- disk: "15gb",
224
- });
225
-
226
- try {
227
- console.log(computer.name, computer["name"]);
228
- } finally {
229
- await computer.delete();
230
- }
95
+ const computer = await Computer.create({ sizeId: "micro" });
231
96
  ```
232
97
 
233
- Omit CPU, memory, or disk fields to use the default size. `disk` accepts MB as
234
- an integer or strings such as `"2gb"`.
98
+ Use the same readiness and cleanup steps as in the quickstart. Omit `sizeId`
99
+ to use your account's default. The SDK sends `sizeId` as `size_id`; the current
100
+ catalog (`GET /v1/billing/sizes`) lists the exact CPU, memory, and disk values.
101
+ Cloud computers do not accept CPU, memory, or disk overrides. The SDK also
102
+ rejects unknown options, including `name`, `labels`, and `size`.
235
103
 
236
- Computers are ephemeral by default. To keep `/home/ohm` across stop and restore,
237
- enable a persistent home when you create the computer:
238
-
239
- ```js
240
- import { Computer } from "@celestoai/sdk";
241
-
242
- const computer = await Computer.create({ persistentHome: true });
243
- ```
244
-
245
- This setting cannot be changed later.
104
+ The SDK generates an `Idempotency-Key` for each call. If your app needs to
105
+ retry the same creation request after a lost response, pass an
106
+ `idempotencyKey` you saved before the first attempt, and reuse that key and
107
+ the same options on retry. The SDK does not retry automatically.
246
108
 
247
109
  ### Control Internet Access
248
110
 
249
- Internet is on by default. Disable outbound connections when you create a
250
- computer:
111
+ Internet is on by default. To disable outbound connections, replace the
112
+ `Computer.create()` line in the [quickstart](#quickstart):
251
113
 
252
114
  ```js
253
- import { Computer } from "@celestoai/sdk";
254
-
255
115
  const computer = await Computer.create({ networkPolicy: { mode: "off" } });
256
- try {
257
- console.log((await computer.run("uname -a")).stdout);
258
- } finally {
259
- await computer.delete();
260
- }
261
116
  ```
262
117
 
263
- Commands and terminal sessions still work without internet access. The policy
264
- survives stop/start and snapshot restore, and it cannot be changed after
265
- creation. A persistent home uses an external volume, so do not combine
266
- `networkPolicy: { mode: "off" }` with `persistentHome: true`. Domain and IP
267
- allowlists are not supported.
118
+ Keep the quickstart's readiness check and cleanup. Commands and terminal
119
+ sessions still work without internet access. The policy cannot be changed
120
+ after creation. Pool computers do not support
121
+ `persistentHome: true`. Domain and IP allowlists are not supported.
268
122
 
269
123
  ### Templates
270
124
 
@@ -284,41 +138,33 @@ for (const template of templates) {
284
138
  }
285
139
  ```
286
140
 
287
- Create a computer from a template:
141
+ To create a computer from a template, change the create call in the
142
+ [quickstart](#quickstart):
288
143
 
289
144
  ```js
290
- import { Computer } from "@celestoai/sdk";
291
-
292
145
  const computer = await Computer.create({ templateId: "coding-agent" });
293
- try {
294
- console.log(computer.name);
295
- } finally {
296
- await computer.delete();
297
- }
298
146
  ```
299
147
 
300
148
  ### Run a Command
301
149
 
302
- Create a file named `run-command.mjs`:
150
+ Use the name or ID of a running computer:
303
151
 
304
152
  ```js
305
153
  import { Computer } from "@celestoai/sdk";
306
154
 
307
- const computer = await Computer.create();
308
- try {
309
- const result = await computer.run("ls -la", {
310
- timeout: 60,
311
- });
312
-
313
- console.log(result.exitCode);
314
- console.log(result.stdout);
315
- console.error(result.stderr);
316
- } finally {
317
- await computer.delete();
318
- }
155
+ const computer = await Computer.get("curie");
156
+ const result = await computer.run("ls -la", { timeout: 60 });
157
+ console.log(result.exitCode, result.stdout);
158
+ console.error(result.stderr);
319
159
  ```
320
160
 
321
- Stream output while the command is running:
161
+ Commands allow up to 10,000 characters and a timeout of 1–300 seconds. Do not
162
+ put secrets in command text. Encoding them in base64 does not protect them.
163
+
164
+ Use `runStream()` or its alias `execStream()` to consume the result as events.
165
+ Cloud waits for the command to finish before yielding any events. It yields
166
+ non-empty stdout first, then non-empty stderr, then an exit event. It does not
167
+ yield a `started` event or preserve the original order of stdout and stderr.
322
168
 
323
169
  ```js
324
170
  import { Computer } from "@celestoai/sdk";
@@ -336,25 +182,38 @@ for await (const event of computer.runStream("npm test", {
336
182
  }
337
183
  ```
338
184
 
339
- Call `controller.abort()` to stop the stream and the remote command.
185
+ Call `controller.abort()` to stop waiting for the response. This does not
186
+ guarantee the remote command stopped. For interactive live output, use
187
+ [`createTerminalSession()`](#terminal-connections).
340
188
 
341
189
  ### Manage Computers
342
190
 
343
191
  `computerId` can be `computer.id` from `Computer.create()` or a computer name
344
- shown by the Celesto command-line tool: `celesto computer list`.
192
+ shown by the Celesto command-line tool: `celesto computer list --cloud`.
345
193
 
346
194
  | Method | What it does |
347
195
  | --- | --- |
348
196
  | `Computer.list()` | List computers in your account |
349
197
  | `Computer.get(computerId)` | Get one computer by name or ID |
350
198
  | `computer.listCommandHistory()` | List recent commands and their status |
199
+ | `computer.createTerminalSession()` | Create a short-lived fast terminal connection |
200
+ | `computer.createBrowserConnection()` | Create a short-lived CDP connection to browser-agent Chromium |
201
+ | `computer.createDisplayConnection({ mode: "read_only" })` | Create a short-lived RFB display connection |
351
202
  | `computer.stop()` | Stop a running computer |
352
203
  | `computer.start()` | Start a stopped computer |
353
204
  | `computer.delete()` | Delete a computer |
354
205
 
206
+ Save `computer.id` with the job that owns it so you can clean it up later.
207
+ If `delete()` returns HTTP 409 while the computer is `creating`, refresh its
208
+ status and retry deletion by the same ID once creation finishes. After
209
+ `stop()` and `start()`, check that your services are running again. Do not
210
+ assume processes survived.
211
+
355
212
  ### Publish Ports
356
213
 
357
- Publish a port when a service inside the computer needs a public URL:
214
+ Publish a port when a service inside the computer needs a public URL. Celesto
215
+ does not add authentication to the URL. Add authentication to the service
216
+ before publishing it if access should be restricted.
358
217
 
359
218
  ```js
360
219
  import { Computer } from "@celestoai/sdk";
@@ -404,34 +263,63 @@ ws.on("open", () => ws.send("pwd\n"));
404
263
  `connection.url` contains a short-lived terminal token. Treat it as a secret and
405
264
  create a new terminal session after `connection.expiresAt`.
406
265
 
407
- ## Gatekeeper
266
+ ### Browser Automation Connections
408
267
 
409
- Use Gatekeeper when your app needs user-approved access to an external resource,
410
- such as Google Drive.
268
+ Use the `browser-agent` template when your application needs an existing
269
+ Chromium browser. `createBrowserConnection()` returns a short-lived Chrome
270
+ DevTools Protocol (CDP) WebSocket URL that Playwright can attach to.
411
271
 
412
- Create a file named `gatekeeper-connect.mjs`:
272
+ Install Playwright Core in the application that runs this code:
413
273
 
414
- ```js
415
- import { GatekeeperClient } from "@celestoai/sdk/gatekeeper";
274
+ ```bash
275
+ npm install playwright-core
276
+ ```
416
277
 
417
- const client = new GatekeeperClient({ token: process.env.CELESTO_API_KEY });
278
+ Create a computer with the `browser-agent` template and wait until it is
279
+ running, as in the [quickstart](#quickstart). Replace `curie` with its name or
280
+ ID to connect without creating another computer:
418
281
 
419
- const connect = await client.connect({
420
- subject: "customer_123",
421
- provider: "google_drive",
422
- projectName: "Default",
423
- });
282
+ ```js
283
+ import { Computer } from "@celestoai/sdk";
284
+ import { chromium } from "playwright-core";
285
+
286
+ const computer = await Computer.get("curie");
287
+ const connection = await computer.createBrowserConnection();
288
+ const browser = await chromium.connectOverCDP(connection.url);
289
+ try {
290
+ const context = browser.contexts()[0];
291
+ if (!context) throw new Error("Celesto browser did not provide a context");
292
+ const pages = context.pages();
293
+ const page = pages[0] ?? await context.newPage();
424
294
 
425
- if (connect.status === "redirect") {
426
- console.log(connect.oauthUrl);
427
- } else {
428
- console.log(connect.status);
295
+ await page.goto("https://example.com");
296
+ console.log(await page.title());
297
+ } finally {
298
+ await browser.close();
429
299
  }
430
300
  ```
431
301
 
432
- If the response prints a URL, open it so the user can approve access.
302
+ Delete the computer separately when you no longer need it.
303
+
304
+ ### Display Connections
433
305
 
434
- Full Gatekeeper docs: https://docs.celesto.ai/celesto-sdk/gatekeeper
306
+ Use `createDisplayConnection()` when a Remote Framebuffer (RFB) client, such as
307
+ the browser-based noVNC viewer, needs to watch the graphical desktop.
308
+ Connections are read-only by default. Pass
309
+ `{ mode: "read_write" }` when the viewer also needs pointer and keyboard control:
310
+
311
+ ```js
312
+ import { Computer } from "@celestoai/sdk";
313
+
314
+ const computer = await Computer.get("curie");
315
+ const display = await computer.createDisplayConnection({ mode: "read_only" });
316
+ console.log(display.mode, display.expiresAt);
317
+ ```
318
+
319
+ Pass `display.url` to the RFB client before it expires. Browser and display URLs
320
+ contain short-lived secret tokens, so do not log, persist, or share them. Create
321
+ a new connection after a disconnect or expiry. Browser automation and
322
+ read-write display connections require write access to the computer.
435
323
 
436
324
  ## Configuration
437
325
 
@@ -441,11 +329,12 @@ Full Gatekeeper docs: https://docs.celesto.ai/celesto-sdk/gatekeeper
441
329
  | `apiKey` | Alias for `token` |
442
330
  | `baseUrl` | Custom Celesto API URL |
443
331
  | `organizationId` | Sends the `X-Current-Organization` header |
444
- | `timeoutMs` | Request timeout in milliseconds |
332
+ | `timeoutMs` | Deadline in milliseconds for each request, including reading the response body |
445
333
  | `headers` | Extra headers to send with every request |
446
334
 
447
335
  Pass these options as the second argument to `Computer.create()` or
448
- `Computer.get()`. An explicit `token` or `apiKey` takes precedence over local credential discovery. Gatekeeper clients accept the same options in their constructor and require an explicit token.
336
+ `Computer.get()`. An explicit `token` or `apiKey` takes precedence over local
337
+ credential discovery.
449
338
 
450
339
  JWT is a signed login token. Most users should use a Celesto API key.
451
340
 
@@ -457,36 +346,23 @@ The SDK exports these error classes:
457
346
  | --- | --- |
458
347
  | `CelestoApiError` | The API returns an error status |
459
348
  | `CelestoNetworkError` | The network request fails |
460
- | `CelestoError` | Base class for all SDK errors |
461
-
462
- Managed agents add an error class per reason an operation can be refused, so you
463
- can react to the specific one. Each extends `ManagedAgentError`, which extends
464
- `CelestoApiError`.
465
-
466
- | Error | When it is used |
467
- | --- | --- |
468
- | `BudgetExceededError` | This user has spent their budget for the window |
469
- | `SessionBusyError` | Another run holds the conversation. Retryable; check `retryAfter` |
470
- | `IdempotencyConflictError` | This key was already used with a different request |
471
- | `AgentArchivedError` | The agent no longer takes runs |
472
- | `ProviderNotConnectedError` | No credential is connected for the agent's model |
473
- | `SessionAgentMismatchError` | That conversation belongs to a different agent |
474
- | `SessionEndUserMismatchError` | That conversation belongs to a different user |
475
- | `ModelRequiresOwnKeyError` | This model runs only on your own provider key |
476
- | `ConfigKeyNotAllowedError` | The agent config carried an unsupported setting. Thrown by `agents.create()`/`agents.update()` before any request is sent, not by a run |
349
+ | `CelestoError` | Base class for API and network errors |
350
+ | `TypeError` | The SDK rejects unsupported create options or invalid command arguments before sending a request |
477
351
 
478
352
  ## Develop Locally
479
353
 
480
354
  If you are contributing and have `npm` installed, run these commands from the
481
- repository's `ts` directory:
355
+ repository's `ts-cloud` directory:
482
356
 
483
357
  ```bash
484
- npm install
485
- npm test
486
- npm run lint
487
- npm run build
358
+ npm ci
359
+ npm run check
488
360
  ```
489
361
 
362
+ The package test installs the built npm archive and checks it against a local
363
+ HTTP fixture. No Cloud API key is needed. The tested archive and request
364
+ transcript are saved to `artifacts/cloud-sdk/` at the repository root.
365
+
490
366
  ## License
491
367
 
492
368
  Apache-2.0. The SDK is open source. Use of the Celesto platform is governed by