computer-agents 2.4.0 → 2.5.0
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.
- package/README.md +61 -18
- package/dist/ComputerAgentsClient.d.ts +42 -17
- package/dist/ComputerAgentsClient.js +39 -22
- package/dist/ComputerAgentsClient.js.map +1 -1
- package/dist/cloud/resources/AgentsResource.d.ts +12 -1
- package/dist/cloud/resources/AgentsResource.js +16 -0
- package/dist/cloud/resources/AgentsResource.js.map +1 -1
- package/dist/cloud/resources/DatabasesResource.d.ts +36 -0
- package/dist/cloud/resources/DatabasesResource.js +68 -0
- package/dist/cloud/resources/DatabasesResource.js.map +1 -0
- package/dist/cloud/resources/EnvironmentsResource.d.ts +110 -0
- package/dist/cloud/resources/EnvironmentsResource.js +75 -0
- package/dist/cloud/resources/EnvironmentsResource.js.map +1 -1
- package/dist/cloud/resources/GitResource.d.ts +60 -2
- package/dist/cloud/resources/GitResource.js +86 -10
- package/dist/cloud/resources/GitResource.js.map +1 -1
- package/dist/cloud/resources/ResourcesResource.d.ts +92 -0
- package/dist/cloud/resources/ResourcesResource.js +151 -0
- package/dist/cloud/resources/ResourcesResource.js.map +1 -0
- package/dist/cloud/resources/SkillsResource.d.ts +17 -0
- package/dist/cloud/resources/SkillsResource.js +36 -0
- package/dist/cloud/resources/SkillsResource.js.map +1 -0
- package/dist/cloud/resources/ThreadsResource.d.ts +78 -0
- package/dist/cloud/resources/ThreadsResource.js +64 -0
- package/dist/cloud/resources/ThreadsResource.js.map +1 -1
- package/dist/cloud/resources/index.d.ts +7 -1
- package/dist/cloud/resources/index.js +9 -3
- package/dist/cloud/resources/index.js.map +1 -1
- package/dist/cloud/types.d.ts +185 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/computer-agents)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Official TypeScript/JavaScript SDK for the [Computer Agents Cloud API](https://computer-agents.com).
|
|
6
|
+
Official TypeScript/JavaScript SDK for the [Computer Agents Cloud API](https://computer-agents.com). Build against the Agentic Compute Platform with threads, computers, resources, databases, skills, and agents.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -30,12 +30,12 @@ console.log(result.content);
|
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
33
|
+
- **Managed and external models** — use built-in Claude and Gemini models or connect external models on Team and Enterprise plans
|
|
34
|
+
- **Persistent computers** — isolated execution environments with stateful workspaces
|
|
35
35
|
- **SSE streaming** — real-time execution progress and tool calls
|
|
36
36
|
- **Session continuity** — multi-turn conversations via threads
|
|
37
37
|
- **MCP integration** — extend capabilities with Model Context Protocol servers
|
|
38
|
-
- **Skills** —
|
|
38
|
+
- **Skills and resources** — connect system skills, custom skills, and published resources
|
|
39
39
|
- **Zero dependencies** — uses native `fetch`
|
|
40
40
|
- **Full TypeScript support** — complete type definitions
|
|
41
41
|
|
|
@@ -44,8 +44,12 @@ console.log(result.content);
|
|
|
44
44
|
| Model | ID | Use Case |
|
|
45
45
|
|-------|-----|----------|
|
|
46
46
|
| Claude 4.6 Opus | `claude-opus-4-6` | Most capable, complex tasks |
|
|
47
|
-
| Claude 4.5 Sonnet | `claude-sonnet-4-5` | Balanced
|
|
47
|
+
| Claude 4.5 Sonnet | `claude-sonnet-4-5` | Balanced default |
|
|
48
48
|
| Claude 4.5 Haiku | `claude-haiku-4-5` | Fast, efficient |
|
|
49
|
+
| Gemini 3 Flash | `gemini-3-flash` | Low-latency general workflows |
|
|
50
|
+
| Gemini 3.1 Pro | `gemini-3-1-pro` | Broader reasoning and research tasks |
|
|
51
|
+
|
|
52
|
+
Team and Enterprise plans can also connect external models with IDs in the form `external:{provider}:{model}`.
|
|
49
53
|
|
|
50
54
|
## API Reference
|
|
51
55
|
|
|
@@ -65,7 +69,7 @@ const client = new ComputerAgentsClient({
|
|
|
65
69
|
```typescript
|
|
66
70
|
// One-shot execution
|
|
67
71
|
const result = await client.run('Fix the TypeScript errors', {
|
|
68
|
-
|
|
72
|
+
computerId: 'env_xxx'
|
|
69
73
|
});
|
|
70
74
|
|
|
71
75
|
// With streaming
|
|
@@ -85,7 +89,7 @@ Multi-turn conversations with persistent context:
|
|
|
85
89
|
```typescript
|
|
86
90
|
// Create a thread
|
|
87
91
|
const thread = await client.threads.create({
|
|
88
|
-
|
|
92
|
+
computerId: 'env_xxx'
|
|
89
93
|
});
|
|
90
94
|
|
|
91
95
|
// Send messages — the agent remembers the full context
|
|
@@ -134,30 +138,30 @@ const agent = await client.agents.create({
|
|
|
134
138
|
|
|
135
139
|
// Use the agent in a thread
|
|
136
140
|
const thread = await client.threads.create({
|
|
137
|
-
|
|
141
|
+
computerId: 'env_xxx',
|
|
138
142
|
agentId: agent.id
|
|
139
143
|
});
|
|
140
144
|
```
|
|
141
145
|
|
|
142
|
-
###
|
|
146
|
+
### Computers
|
|
143
147
|
|
|
144
|
-
|
|
148
|
+
Persistent execution environments with custom runtimes, packages, secrets, and MCP setup:
|
|
145
149
|
|
|
146
150
|
```typescript
|
|
147
|
-
// Create
|
|
148
|
-
const
|
|
151
|
+
// Create a computer (same manager is also available as client.environments)
|
|
152
|
+
const computer = await client.computers.create({
|
|
149
153
|
name: 'python-dev',
|
|
150
154
|
internetAccess: true
|
|
151
155
|
});
|
|
152
156
|
|
|
153
157
|
// Configure runtimes
|
|
154
|
-
await client.
|
|
158
|
+
await client.computers.setRuntimes(computer.id, {
|
|
155
159
|
python: '3.12',
|
|
156
160
|
nodejs: '20'
|
|
157
161
|
});
|
|
158
162
|
|
|
159
163
|
// Install packages
|
|
160
|
-
await client.
|
|
164
|
+
await client.computers.installPackages(computer.id, {
|
|
161
165
|
packages: [
|
|
162
166
|
{ type: 'python', name: 'flask' },
|
|
163
167
|
{ type: 'python', name: 'pytest' },
|
|
@@ -166,7 +170,7 @@ await client.environments.installPackages(env.id, {
|
|
|
166
170
|
});
|
|
167
171
|
|
|
168
172
|
// Add MCP servers
|
|
169
|
-
await client.
|
|
173
|
+
await client.computers.update(computer.id, {
|
|
170
174
|
mcpServers: [
|
|
171
175
|
{
|
|
172
176
|
type: 'stdio',
|
|
@@ -184,12 +188,12 @@ await client.environments.update(env.id, {
|
|
|
184
188
|
});
|
|
185
189
|
|
|
186
190
|
// Trigger a build
|
|
187
|
-
await client.
|
|
191
|
+
await client.computers.build(computer.id);
|
|
188
192
|
```
|
|
189
193
|
|
|
190
194
|
### Files
|
|
191
195
|
|
|
192
|
-
Manage files in
|
|
196
|
+
Manage files in computer workspaces:
|
|
193
197
|
|
|
194
198
|
```typescript
|
|
195
199
|
// Upload a file
|
|
@@ -209,9 +213,48 @@ const files = await client.files.listFiles('env_xxx');
|
|
|
209
213
|
await client.files.deleteFile('env_xxx', 'src/app.py');
|
|
210
214
|
```
|
|
211
215
|
|
|
216
|
+
### Resources
|
|
217
|
+
|
|
218
|
+
Publish web apps, functions, auth modules, and agent runtimes:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const resource = await client.resources.create({
|
|
222
|
+
name: 'crm-web',
|
|
223
|
+
kind: 'web_app',
|
|
224
|
+
authMode: 'public',
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
await client.resources.deploy(resource.id);
|
|
228
|
+
const analytics = await client.resources.getAnalytics(resource.id);
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Databases
|
|
232
|
+
|
|
233
|
+
Create Firestore-backed data surfaces and work with collections/documents:
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const database = await client.databases.create({
|
|
237
|
+
name: 'crm-data',
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
await client.databases.createCollection(database.id, { name: 'leads' });
|
|
241
|
+
await client.databases.createDocument(database.id, 'leads', {
|
|
242
|
+
data: { company: 'Acme', stage: 'new' },
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Skills
|
|
247
|
+
|
|
248
|
+
Manage custom ACP skills:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
const skills = await client.skills.list();
|
|
252
|
+
console.log(skills.map((skill) => skill.name));
|
|
253
|
+
```
|
|
254
|
+
|
|
212
255
|
### Git
|
|
213
256
|
|
|
214
|
-
Version control on workspaces:
|
|
257
|
+
Version control on computer workspaces:
|
|
215
258
|
|
|
216
259
|
```typescript
|
|
217
260
|
// View uncommitted changes
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { ApiClientError } from './cloud/ApiClient';
|
|
29
29
|
import type { ApiClientConfig } from './cloud/ApiClient';
|
|
30
|
-
import { EnvironmentsResource, ThreadsResource, AgentsResource, BudgetResource, BillingResource, SchedulesResource, TriggersResource, OrchestrationsResource, GitResource, FilesResource } from './cloud/resources';
|
|
31
|
-
import type { HealthCheck, Metrics, Project, Environment, MessageStreamEvent } from './cloud/types';
|
|
30
|
+
import { EnvironmentsResource, ThreadsResource, AgentsResource, ResourcesResource, DatabasesResource, SkillsResource, BudgetResource, BillingResource, SchedulesResource, TriggersResource, OrchestrationsResource, GitResource, FilesResource } from './cloud/resources';
|
|
31
|
+
import type { HealthCheck, Metrics, Project, Environment, MessageStreamEvent, AgentModel } from './cloud/types';
|
|
32
32
|
export { ApiClientError };
|
|
33
33
|
export type { ApiClientConfig };
|
|
34
34
|
/**
|
|
@@ -61,10 +61,14 @@ export interface ComputerAgentsClientConfig {
|
|
|
61
61
|
*/
|
|
62
62
|
export interface RunOptions {
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Computer ID to execute in.
|
|
65
|
+
* The raw API route still uses `environmentId`.
|
|
66
66
|
*/
|
|
67
67
|
environmentId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Product-level alias for `environmentId`.
|
|
70
|
+
*/
|
|
71
|
+
computerId?: string;
|
|
68
72
|
/**
|
|
69
73
|
* Thread ID to continue (optional - creates new thread if not provided)
|
|
70
74
|
*/
|
|
@@ -73,7 +77,7 @@ export interface RunOptions {
|
|
|
73
77
|
* Agent configuration override
|
|
74
78
|
*/
|
|
75
79
|
agentConfig?: {
|
|
76
|
-
model?:
|
|
80
|
+
model?: AgentModel;
|
|
77
81
|
instructions?: string;
|
|
78
82
|
reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high';
|
|
79
83
|
};
|
|
@@ -118,12 +122,15 @@ export interface RunResult {
|
|
|
118
122
|
* resources through typed methods:
|
|
119
123
|
*
|
|
120
124
|
* - `threads` - Conversation management with SSE streaming
|
|
121
|
-
* - `environments` -
|
|
125
|
+
* - `environments` / `computers` - Computer configuration and lifecycle
|
|
126
|
+
* - `resources` - Deployable apps, functions, auth modules, and runtimes
|
|
127
|
+
* - `databases` - Managed database surfaces
|
|
128
|
+
* - `skills` - Custom ACP skills
|
|
122
129
|
* - `agents` - Agent configuration
|
|
123
|
-
* - `files` - File management
|
|
130
|
+
* - `files` - File management in computer workspaces
|
|
124
131
|
* - `schedules` - Scheduled task management
|
|
125
132
|
* - `billing` - Budget and usage tracking
|
|
126
|
-
* - `git` - Git operations on
|
|
133
|
+
* - `git` - Git operations on computers (compatibility helper)
|
|
127
134
|
*
|
|
128
135
|
* For simple use cases, use the `run()` method which handles thread
|
|
129
136
|
* creation and streaming automatically.
|
|
@@ -163,11 +170,15 @@ export declare class ComputerAgentsClient {
|
|
|
163
170
|
* ```
|
|
164
171
|
*/
|
|
165
172
|
readonly environments: EnvironmentsResource;
|
|
173
|
+
/**
|
|
174
|
+
* Product-level alias for `environments`.
|
|
175
|
+
*/
|
|
176
|
+
readonly computers: EnvironmentsResource;
|
|
166
177
|
/**
|
|
167
178
|
* Agent configuration
|
|
168
179
|
*
|
|
169
|
-
* Create and manage agent configurations with
|
|
170
|
-
*
|
|
180
|
+
* Create and manage agent configurations with built-in or external models,
|
|
181
|
+
* instructions, and enabled skills.
|
|
171
182
|
*
|
|
172
183
|
* @example
|
|
173
184
|
* ```typescript
|
|
@@ -179,6 +190,18 @@ export declare class ComputerAgentsClient {
|
|
|
179
190
|
* ```
|
|
180
191
|
*/
|
|
181
192
|
readonly agents: AgentsResource;
|
|
193
|
+
/**
|
|
194
|
+
* Managed resource surfaces such as web apps, functions, auth modules, and agent runtimes.
|
|
195
|
+
*/
|
|
196
|
+
readonly resources: ResourcesResource;
|
|
197
|
+
/**
|
|
198
|
+
* Managed database surfaces and document operations.
|
|
199
|
+
*/
|
|
200
|
+
readonly databases: DatabasesResource;
|
|
201
|
+
/**
|
|
202
|
+
* Custom skill management.
|
|
203
|
+
*/
|
|
204
|
+
readonly skills: SkillsResource;
|
|
182
205
|
/**
|
|
183
206
|
* File operations
|
|
184
207
|
*
|
|
@@ -313,7 +336,7 @@ export declare class ComputerAgentsClient {
|
|
|
313
336
|
* Execute a task with automatic thread management
|
|
314
337
|
*
|
|
315
338
|
* This is the simplest way to run an agent task. It handles:
|
|
316
|
-
* - Auto-creating a default
|
|
339
|
+
* - Auto-creating a default computer (if no computer/environment ID is provided)
|
|
317
340
|
* - Creating a thread (if threadId not provided)
|
|
318
341
|
* - Sending the message with SSE streaming
|
|
319
342
|
* - Returning the result with thread ID for follow-ups
|
|
@@ -342,25 +365,25 @@ export declare class ComputerAgentsClient {
|
|
|
342
365
|
* threadId: result.threadId
|
|
343
366
|
* });
|
|
344
367
|
*
|
|
345
|
-
* // Explicit
|
|
368
|
+
* // Explicit computer
|
|
346
369
|
* const result = await client.run('Deploy', {
|
|
347
|
-
*
|
|
370
|
+
* computerId: 'env_xxx'
|
|
348
371
|
* });
|
|
349
372
|
* ```
|
|
350
373
|
*/
|
|
351
374
|
run(task: string, options?: RunOptions): Promise<RunResult>;
|
|
352
375
|
/**
|
|
353
|
-
* Quick setup with default
|
|
376
|
+
* Quick setup with default computer
|
|
354
377
|
*
|
|
355
|
-
* Creates a default
|
|
356
|
-
* the project and
|
|
378
|
+
* Creates a default computer if none exists, returning both
|
|
379
|
+
* the project and computer ready for execution.
|
|
357
380
|
*
|
|
358
381
|
* Note: You usually don't need to call this directly. `run()` auto-creates
|
|
359
382
|
* a default environment when `environmentId` is omitted.
|
|
360
383
|
*
|
|
361
384
|
* @example
|
|
362
385
|
* ```typescript
|
|
363
|
-
* const { project,
|
|
386
|
+
* const { project, computer } = await client.quickSetup({
|
|
364
387
|
* internetAccess: true
|
|
365
388
|
* });
|
|
366
389
|
* ```
|
|
@@ -368,9 +391,11 @@ export declare class ComputerAgentsClient {
|
|
|
368
391
|
quickSetup(options?: {
|
|
369
392
|
internetAccess?: boolean;
|
|
370
393
|
environmentName?: string;
|
|
394
|
+
computerName?: string;
|
|
371
395
|
}): Promise<{
|
|
372
396
|
project: Project;
|
|
373
397
|
environment: Environment;
|
|
398
|
+
computer: Environment;
|
|
374
399
|
}>;
|
|
375
400
|
/**
|
|
376
401
|
* Check API health status
|
|
@@ -38,12 +38,15 @@ const resources_1 = require("./cloud/resources");
|
|
|
38
38
|
* resources through typed methods:
|
|
39
39
|
*
|
|
40
40
|
* - `threads` - Conversation management with SSE streaming
|
|
41
|
-
* - `environments` -
|
|
41
|
+
* - `environments` / `computers` - Computer configuration and lifecycle
|
|
42
|
+
* - `resources` - Deployable apps, functions, auth modules, and runtimes
|
|
43
|
+
* - `databases` - Managed database surfaces
|
|
44
|
+
* - `skills` - Custom ACP skills
|
|
42
45
|
* - `agents` - Agent configuration
|
|
43
|
-
* - `files` - File management
|
|
46
|
+
* - `files` - File management in computer workspaces
|
|
44
47
|
* - `schedules` - Scheduled task management
|
|
45
48
|
* - `billing` - Budget and usage tracking
|
|
46
|
-
* - `git` - Git operations on
|
|
49
|
+
* - `git` - Git operations on computers (compatibility helper)
|
|
47
50
|
*
|
|
48
51
|
* For simple use cases, use the `run()` method which handles thread
|
|
49
52
|
* creation and streaming automatically.
|
|
@@ -88,11 +91,15 @@ class ComputerAgentsClient {
|
|
|
88
91
|
* ```
|
|
89
92
|
*/
|
|
90
93
|
environments;
|
|
94
|
+
/**
|
|
95
|
+
* Product-level alias for `environments`.
|
|
96
|
+
*/
|
|
97
|
+
computers;
|
|
91
98
|
/**
|
|
92
99
|
* Agent configuration
|
|
93
100
|
*
|
|
94
|
-
* Create and manage agent configurations with
|
|
95
|
-
*
|
|
101
|
+
* Create and manage agent configurations with built-in or external models,
|
|
102
|
+
* instructions, and enabled skills.
|
|
96
103
|
*
|
|
97
104
|
* @example
|
|
98
105
|
* ```typescript
|
|
@@ -104,6 +111,18 @@ class ComputerAgentsClient {
|
|
|
104
111
|
* ```
|
|
105
112
|
*/
|
|
106
113
|
agents;
|
|
114
|
+
/**
|
|
115
|
+
* Managed resource surfaces such as web apps, functions, auth modules, and agent runtimes.
|
|
116
|
+
*/
|
|
117
|
+
resources;
|
|
118
|
+
/**
|
|
119
|
+
* Managed database surfaces and document operations.
|
|
120
|
+
*/
|
|
121
|
+
databases;
|
|
122
|
+
/**
|
|
123
|
+
* Custom skill management.
|
|
124
|
+
*/
|
|
125
|
+
skills;
|
|
107
126
|
/**
|
|
108
127
|
* File operations
|
|
109
128
|
*
|
|
@@ -234,12 +253,7 @@ class ComputerAgentsClient {
|
|
|
234
253
|
*/
|
|
235
254
|
git;
|
|
236
255
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @internal
|
|
239
|
-
*/
|
|
240
|
-
runs;
|
|
241
|
-
/**
|
|
242
|
-
* Project access (internal - use files for file operations)
|
|
256
|
+
* Project access (internal - use files/resources/databases for data operations)
|
|
243
257
|
* @internal
|
|
244
258
|
*/
|
|
245
259
|
projects;
|
|
@@ -268,7 +282,11 @@ class ComputerAgentsClient {
|
|
|
268
282
|
// Initialize all resource managers
|
|
269
283
|
this.threads = new resources_1.ThreadsResource(this.api);
|
|
270
284
|
this.environments = new resources_1.EnvironmentsResource(this.api);
|
|
285
|
+
this.computers = this.environments;
|
|
271
286
|
this.agents = new resources_1.AgentsResource(this.api);
|
|
287
|
+
this.resources = new resources_1.ResourcesResource(this.api);
|
|
288
|
+
this.databases = new resources_1.DatabasesResource(this.api);
|
|
289
|
+
this.skills = new resources_1.SkillsResource(this.api);
|
|
272
290
|
this.files = new resources_1.FilesResource(this.api);
|
|
273
291
|
this.schedules = new resources_1.SchedulesResource(this.api);
|
|
274
292
|
this.triggers = new resources_1.TriggersResource(this.api);
|
|
@@ -276,7 +294,6 @@ class ComputerAgentsClient {
|
|
|
276
294
|
this.budget = new resources_1.BudgetResource(this.api);
|
|
277
295
|
this.billing = new resources_1.BillingResource(this.api);
|
|
278
296
|
this.git = new resources_1.GitResource(this.api);
|
|
279
|
-
this.runs = new resources_1.RunsResource(this.api);
|
|
280
297
|
this.projects = new resources_1.ProjectsResource(this.api);
|
|
281
298
|
}
|
|
282
299
|
// =========================================================================
|
|
@@ -286,7 +303,7 @@ class ComputerAgentsClient {
|
|
|
286
303
|
* Execute a task with automatic thread management
|
|
287
304
|
*
|
|
288
305
|
* This is the simplest way to run an agent task. It handles:
|
|
289
|
-
* - Auto-creating a default
|
|
306
|
+
* - Auto-creating a default computer (if no computer/environment ID is provided)
|
|
290
307
|
* - Creating a thread (if threadId not provided)
|
|
291
308
|
* - Sending the message with SSE streaming
|
|
292
309
|
* - Returning the result with thread ID for follow-ups
|
|
@@ -315,15 +332,15 @@ class ComputerAgentsClient {
|
|
|
315
332
|
* threadId: result.threadId
|
|
316
333
|
* });
|
|
317
334
|
*
|
|
318
|
-
* // Explicit
|
|
335
|
+
* // Explicit computer
|
|
319
336
|
* const result = await client.run('Deploy', {
|
|
320
|
-
*
|
|
337
|
+
* computerId: 'env_xxx'
|
|
321
338
|
* });
|
|
322
339
|
* ```
|
|
323
340
|
*/
|
|
324
341
|
async run(task, options = {}) {
|
|
325
342
|
// Auto-resolve environment if not provided
|
|
326
|
-
const environmentId = options.environmentId || await this._ensureDefaultEnvironment();
|
|
343
|
+
const environmentId = options.computerId || options.environmentId || await this._ensureDefaultEnvironment();
|
|
327
344
|
// Create or reuse thread
|
|
328
345
|
let threadId = options.threadId;
|
|
329
346
|
if (!threadId) {
|
|
@@ -366,17 +383,17 @@ class ComputerAgentsClient {
|
|
|
366
383
|
return this._defaultEnvironmentId;
|
|
367
384
|
}
|
|
368
385
|
/**
|
|
369
|
-
* Quick setup with default
|
|
386
|
+
* Quick setup with default computer
|
|
370
387
|
*
|
|
371
|
-
* Creates a default
|
|
372
|
-
* the project and
|
|
388
|
+
* Creates a default computer if none exists, returning both
|
|
389
|
+
* the project and computer ready for execution.
|
|
373
390
|
*
|
|
374
391
|
* Note: You usually don't need to call this directly. `run()` auto-creates
|
|
375
392
|
* a default environment when `environmentId` is omitted.
|
|
376
393
|
*
|
|
377
394
|
* @example
|
|
378
395
|
* ```typescript
|
|
379
|
-
* const { project,
|
|
396
|
+
* const { project, computer } = await client.quickSetup({
|
|
380
397
|
* internetAccess: true
|
|
381
398
|
* });
|
|
382
399
|
* ```
|
|
@@ -390,12 +407,12 @@ class ComputerAgentsClient {
|
|
|
390
407
|
// Create default environment if none exists
|
|
391
408
|
if (!environment) {
|
|
392
409
|
environment = await this.environments.create({
|
|
393
|
-
name: options.environmentName || 'default',
|
|
410
|
+
name: options.computerName || options.environmentName || 'default',
|
|
394
411
|
internetAccess: options.internetAccess ?? true,
|
|
395
412
|
isDefault: true,
|
|
396
413
|
});
|
|
397
414
|
}
|
|
398
|
-
return { project, environment };
|
|
415
|
+
return { project, environment, computer: environment };
|
|
399
416
|
}
|
|
400
417
|
// =========================================================================
|
|
401
418
|
// Health & Monitoring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComputerAgentsClient.js","sourceRoot":"","sources":["../src/ComputerAgentsClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAEH,iDAA8D;
|
|
1
|
+
{"version":3,"file":"ComputerAgentsClient.js","sourceRoot":"","sources":["../src/ComputerAgentsClient.ts"],"names":[],"mappings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C,MAAM;QACV,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAc,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAU,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;CACF;AA/aD,oDA+aC;AASgC,2CAAW;AAKX,8CAAc"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* simplified paths without /projects/:projectId prefix.
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiClient } from '../ApiClient';
|
|
11
|
-
import type { CloudAgent, CreateAgentParams, UpdateAgentParams } from '../types';
|
|
11
|
+
import type { AgentAnalyticsResponse, AgentModelCatalogEntry, CloudAgent, CreateAgentParams, UpdateAgentParams } from '../types';
|
|
12
12
|
export declare class AgentsResource {
|
|
13
13
|
private readonly client;
|
|
14
14
|
constructor(client: ApiClient);
|
|
@@ -24,6 +24,13 @@ export declare class AgentsResource {
|
|
|
24
24
|
* Project is determined automatically from the API key.
|
|
25
25
|
*/
|
|
26
26
|
list(): Promise<CloudAgent[]>;
|
|
27
|
+
/**
|
|
28
|
+
* List managed and external model entries available in the current workspace.
|
|
29
|
+
*/
|
|
30
|
+
listModels(): Promise<{
|
|
31
|
+
tier?: string;
|
|
32
|
+
models: AgentModelCatalogEntry[];
|
|
33
|
+
}>;
|
|
27
34
|
/**
|
|
28
35
|
* Get an agent by ID
|
|
29
36
|
*/
|
|
@@ -32,6 +39,10 @@ export declare class AgentsResource {
|
|
|
32
39
|
* Update an agent
|
|
33
40
|
*/
|
|
34
41
|
update(agentId: string, params: UpdateAgentParams): Promise<CloudAgent>;
|
|
42
|
+
/**
|
|
43
|
+
* Summarize recent activity for an agent or team.
|
|
44
|
+
*/
|
|
45
|
+
getAnalytics(agentId: string): Promise<AgentAnalyticsResponse>;
|
|
35
46
|
/**
|
|
36
47
|
* Delete an agent
|
|
37
48
|
*/
|
|
@@ -33,6 +33,16 @@ class AgentsResource {
|
|
|
33
33
|
const response = await this.client.get(`/agents`);
|
|
34
34
|
return response.data;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* List managed and external model entries available in the current workspace.
|
|
38
|
+
*/
|
|
39
|
+
async listModels() {
|
|
40
|
+
const response = await this.client.get(`/agents/models`);
|
|
41
|
+
return {
|
|
42
|
+
tier: response.tier,
|
|
43
|
+
models: response.models,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
36
46
|
/**
|
|
37
47
|
* Get an agent by ID
|
|
38
48
|
*/
|
|
@@ -47,6 +57,12 @@ class AgentsResource {
|
|
|
47
57
|
const response = await this.client.patch(`/agents/${agentId}`, params);
|
|
48
58
|
return response.agent;
|
|
49
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Summarize recent activity for an agent or team.
|
|
62
|
+
*/
|
|
63
|
+
async getAnalytics(agentId) {
|
|
64
|
+
return this.client.get(`/agents/${agentId}/analytics`);
|
|
65
|
+
}
|
|
50
66
|
/**
|
|
51
67
|
* Delete an agent
|
|
52
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/AgentsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;
|
|
1
|
+
{"version":3,"file":"AgentsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/AgentsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAWH,MAAa,cAAc;IACI;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAAyB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,SAAS,EACT,MAAM,CACP,CAA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C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ApiClient } from '../ApiClient';
|
|
2
|
+
import type { CreateDatabaseParams, Database, DatabaseCollection, DatabaseDocument, UpdateDatabaseParams } from '../types';
|
|
3
|
+
export interface ListDatabasesParams {
|
|
4
|
+
projectId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CreateDatabaseCollectionParams {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateDatabaseDocumentParams {
|
|
11
|
+
id?: string;
|
|
12
|
+
data: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface UpdateDatabaseDocumentParams {
|
|
15
|
+
data: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export declare class DatabasesResource {
|
|
18
|
+
private readonly client;
|
|
19
|
+
constructor(client: ApiClient);
|
|
20
|
+
create(params: CreateDatabaseParams): Promise<Database>;
|
|
21
|
+
list(params?: ListDatabasesParams): Promise<Database[]>;
|
|
22
|
+
get(databaseId: string): Promise<Database>;
|
|
23
|
+
update(databaseId: string, params: UpdateDatabaseParams): Promise<Database>;
|
|
24
|
+
delete(databaseId: string): Promise<boolean>;
|
|
25
|
+
getAnalytics(databaseId: string): Promise<Record<string, unknown>>;
|
|
26
|
+
listCollections(databaseId: string): Promise<DatabaseCollection[]>;
|
|
27
|
+
createCollection(databaseId: string, params: CreateDatabaseCollectionParams): Promise<DatabaseCollection>;
|
|
28
|
+
deleteCollection(databaseId: string, collectionId: string): Promise<boolean>;
|
|
29
|
+
listDocuments(databaseId: string, collectionId: string, params?: {
|
|
30
|
+
limit?: number;
|
|
31
|
+
}): Promise<DatabaseDocument[]>;
|
|
32
|
+
createDocument(databaseId: string, collectionId: string, params: CreateDatabaseDocumentParams): Promise<DatabaseDocument>;
|
|
33
|
+
getDocument(databaseId: string, collectionId: string, documentId: string): Promise<DatabaseDocument>;
|
|
34
|
+
updateDocument(databaseId: string, collectionId: string, documentId: string, params: UpdateDatabaseDocumentParams): Promise<DatabaseDocument>;
|
|
35
|
+
deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<boolean>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatabasesResource = void 0;
|
|
4
|
+
class DatabasesResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async create(params) {
|
|
10
|
+
const response = await this.client.post(`/databases`, params);
|
|
11
|
+
return response.database;
|
|
12
|
+
}
|
|
13
|
+
async list(params = {}) {
|
|
14
|
+
const response = await this.client.get(`/databases`, {
|
|
15
|
+
projectId: params.projectId,
|
|
16
|
+
});
|
|
17
|
+
return response.databases;
|
|
18
|
+
}
|
|
19
|
+
async get(databaseId) {
|
|
20
|
+
const response = await this.client.get(`/databases/${databaseId}`);
|
|
21
|
+
return response.database;
|
|
22
|
+
}
|
|
23
|
+
async update(databaseId, params) {
|
|
24
|
+
const response = await this.client.patch(`/databases/${databaseId}`, params);
|
|
25
|
+
return response.database;
|
|
26
|
+
}
|
|
27
|
+
async delete(databaseId) {
|
|
28
|
+
const response = await this.client.delete(`/databases/${databaseId}`);
|
|
29
|
+
return !!(response.success ?? response.deleted);
|
|
30
|
+
}
|
|
31
|
+
async getAnalytics(databaseId) {
|
|
32
|
+
return this.client.get(`/databases/${databaseId}/analytics`);
|
|
33
|
+
}
|
|
34
|
+
async listCollections(databaseId) {
|
|
35
|
+
const response = await this.client.get(`/databases/${databaseId}/collections`);
|
|
36
|
+
return response.collections;
|
|
37
|
+
}
|
|
38
|
+
async createCollection(databaseId, params) {
|
|
39
|
+
const response = await this.client.post(`/databases/${databaseId}/collections`, params);
|
|
40
|
+
return response.collection;
|
|
41
|
+
}
|
|
42
|
+
async deleteCollection(databaseId, collectionId) {
|
|
43
|
+
const response = await this.client.delete(`/databases/${databaseId}/collections/${collectionId}`);
|
|
44
|
+
return !!(response.success ?? response.deleted);
|
|
45
|
+
}
|
|
46
|
+
async listDocuments(databaseId, collectionId, params = {}) {
|
|
47
|
+
const response = await this.client.get(`/databases/${databaseId}/collections/${collectionId}/documents`, params);
|
|
48
|
+
return response.documents;
|
|
49
|
+
}
|
|
50
|
+
async createDocument(databaseId, collectionId, params) {
|
|
51
|
+
const response = await this.client.post(`/databases/${databaseId}/collections/${collectionId}/documents`, params);
|
|
52
|
+
return response.document;
|
|
53
|
+
}
|
|
54
|
+
async getDocument(databaseId, collectionId, documentId) {
|
|
55
|
+
const response = await this.client.get(`/databases/${databaseId}/collections/${collectionId}/documents/${documentId}`);
|
|
56
|
+
return response.document;
|
|
57
|
+
}
|
|
58
|
+
async updateDocument(databaseId, collectionId, documentId, params) {
|
|
59
|
+
const response = await this.client.put(`/databases/${databaseId}/collections/${collectionId}/documents/${documentId}`, params);
|
|
60
|
+
return response.document;
|
|
61
|
+
}
|
|
62
|
+
async deleteDocument(databaseId, collectionId, documentId) {
|
|
63
|
+
const response = await this.client.delete(`/databases/${databaseId}/collections/${collectionId}/documents/${documentId}`);
|
|
64
|
+
return !!(response.success ?? response.deleted);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.DatabasesResource = DatabasesResource;
|
|
68
|
+
//# sourceMappingURL=DatabasesResource.js.map
|