computer-agents 2.0.0 → 2.2.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 CHANGED
@@ -1,15 +1,14 @@
1
1
  # Computer Agents SDK
2
2
 
3
- Official TypeScript/JavaScript SDK for the [Computer Agents Cloud API](https://api.computer-agents.com).
3
+ [![npm version](https://img.shields.io/npm/v/computer-agents.svg?color=success)](https://www.npmjs.com/package/computer-agents)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Official TypeScript/JavaScript SDK for the [Computer Agents Cloud API](https://computer-agents.com). Execute Claude-powered AI agents in isolated cloud containers.
4
7
 
5
8
  ## Installation
6
9
 
7
10
  ```bash
8
11
  npm install computer-agents
9
- # or
10
- pnpm add computer-agents
11
- # or
12
- yarn add computer-agents
13
12
  ```
14
13
 
15
14
  ## Quick Start
@@ -23,7 +22,6 @@ const client = new ComputerAgentsClient({
23
22
 
24
23
  // Execute a task
25
24
  const result = await client.run('Create a REST API with Flask', {
26
- environmentId: 'env_xxx',
27
25
  onEvent: (event) => console.log(event.type)
28
26
  });
29
27
 
@@ -32,54 +30,57 @@ console.log(result.content);
32
30
 
33
31
  ## Features
34
32
 
35
- - Full TypeScript support with complete type definitions
36
- - SSE streaming for real-time execution progress
37
- - Simple, intuitive API that mirrors the REST API structure
38
- - Zero dependencies - uses native `fetch`
33
+ - **Claude-powered** agents run on Claude Opus 4.6, Sonnet 4.5, or Haiku 4.5
34
+ - **Cloud execution** isolated containers with persistent workspaces
35
+ - **SSE streaming** real-time execution progress and tool calls
36
+ - **Session continuity** — multi-turn conversations via threads
37
+ - **MCP integration** — extend capabilities with Model Context Protocol servers
38
+ - **Skills** — web search, image generation, deep research
39
+ - **Zero dependencies** — uses native `fetch`
40
+ - **Full TypeScript support** — complete type definitions
41
+
42
+ ## Supported Models
43
+
44
+ | Model | ID | Use Case |
45
+ |-------|-----|----------|
46
+ | Claude 4.6 Opus | `claude-opus-4-6` | Most capable, complex tasks |
47
+ | Claude 4.5 Sonnet | `claude-sonnet-4-5` | Balanced (default) |
48
+ | Claude 4.5 Haiku | `claude-haiku-4-5` | Fast, efficient |
39
49
 
40
50
  ## API Reference
41
51
 
42
- ### Creating a Client
52
+ ### Client
43
53
 
44
54
  ```typescript
45
55
  const client = new ComputerAgentsClient({
46
- apiKey: 'tb_xxx', // Required
47
- baseUrl: 'https://api.computer-agents.com', // Optional (default)
48
- timeout: 60000, // Optional (default: 60s)
49
- debug: false // Optional
56
+ apiKey: 'your-api-key', // Required
57
+ baseUrl: 'https://api.computer-agents.com', // Optional (default)
58
+ timeout: 60000, // Optional (default: 60s)
59
+ debug: false // Optional
50
60
  });
51
61
  ```
52
62
 
53
63
  ### Running Tasks
54
64
 
55
- The simplest way to execute a task:
56
-
57
65
  ```typescript
58
66
  // One-shot execution
59
67
  const result = await client.run('Fix the TypeScript errors', {
60
68
  environmentId: 'env_xxx'
61
69
  });
62
70
 
63
- // With streaming progress
71
+ // With streaming
64
72
  const result = await client.run('Build a REST API', {
65
- environmentId: 'env_xxx',
66
73
  onEvent: (event) => {
67
74
  if (event.type === 'response.item.completed') {
68
- console.log(event.item);
75
+ console.log(event);
69
76
  }
70
77
  }
71
78
  });
72
-
73
- // Continue a conversation
74
- const followUp = await client.run('Add authentication', {
75
- environmentId: 'env_xxx',
76
- threadId: result.threadId
77
- });
78
79
  ```
79
80
 
80
81
  ### Threads
81
82
 
82
- For multi-turn conversations:
83
+ Multi-turn conversations with persistent context:
83
84
 
84
85
  ```typescript
85
86
  // Create a thread
@@ -87,154 +88,103 @@ const thread = await client.threads.create({
87
88
  environmentId: 'env_xxx'
88
89
  });
89
90
 
90
- // Send a message
91
- const result = await client.threads.sendMessage(thread.id, {
92
- content: 'Create a REST API',
91
+ // Send messages — the agent remembers the full context
92
+ await client.threads.sendMessage(thread.id, {
93
+ content: 'Create a Python web server',
93
94
  onEvent: (event) => console.log(event)
94
95
  });
95
96
 
96
- // List threads
97
- const threads = await client.threads.list();
98
-
99
- // Get a specific thread
100
- const thread = await client.threads.get('thread_xxx');
101
-
102
- // Delete a thread
103
- await client.threads.delete('thread_xxx');
104
- ```
105
-
106
- ### Environments
107
-
108
- Manage isolated execution environments:
109
-
110
- ```typescript
111
- // Create an environment with custom configuration
112
- const env = await client.environments.create({
113
- name: 'data-science',
114
- description: 'Environment for data processing',
115
- runtimes: { python: '3.12', nodejs: '20' },
116
- packages: {
117
- system: ['ffmpeg'],
118
- python: ['pandas', 'numpy'],
119
- node: ['typescript']
120
- },
121
- internetAccess: true
97
+ await client.threads.sendMessage(thread.id, {
98
+ content: 'Add authentication to it',
99
+ onEvent: (event) => console.log(event)
122
100
  });
123
101
 
124
- // List environments
125
- const environments = await client.environments.list();
126
-
127
- // Get an environment
128
- const env = await client.environments.get('env_xxx');
129
-
130
- // Get default environment (creates one if doesn't exist)
131
- const defaultEnv = await client.environments.getDefault();
132
-
133
- // Update an environment
134
- await client.environments.update('env_xxx', {
135
- description: 'Updated description'
102
+ // Copy a thread to fork the conversation
103
+ const copy = await client.threads.copy(thread.id, {
104
+ title: 'Experiment v2'
136
105
  });
137
106
 
138
- // Delete an environment
139
- await client.environments.delete('env_xxx');
140
- ```
141
-
142
- #### Runtime Management
143
-
144
- ```typescript
145
- // List all available runtimes and versions
146
- const available = await client.environments.listAvailableRuntimes();
147
- // { python: ['3.9', '3.10', '3.11', '3.12', '3.13'], nodejs: ['18', '20', '22'], ... }
148
-
149
- // Get current runtimes for an environment
150
- const runtimes = await client.environments.getRuntimes('env_xxx');
151
- // { python: '3.12', nodejs: '20' }
152
-
153
- // Set runtime versions (triggers rebuild)
154
- await client.environments.setRuntimes('env_xxx', {
155
- python: '3.12',
156
- nodejs: '20',
157
- go: '1.22'
107
+ // Search across threads
108
+ const results = await client.threads.search({
109
+ query: 'REST API',
110
+ limit: 10
158
111
  });
159
- ```
160
-
161
- #### Package Management
162
-
163
- ```typescript
164
- // List installed packages
165
- const packages = await client.environments.listPackages('env_xxx');
166
- // { system: ['ffmpeg'], python: ['pandas'], node: ['typescript'] }
167
112
 
168
- // Install packages (triggers rebuild)
169
- await client.environments.installPackages('env_xxx', 'python', ['requests', 'beautifulsoup4']);
170
- await client.environments.installPackages('env_xxx', 'system', ['imagemagick']);
171
- await client.environments.installPackages('env_xxx', 'node', ['tsx']);
113
+ // Get execution logs
114
+ const logs = await client.threads.getLogs(thread.id);
172
115
 
173
- // Uninstall a package (triggers rebuild)
174
- await client.environments.uninstallPackage('env_xxx', 'python', 'requests');
116
+ // List, get, update, delete
117
+ const threads = await client.threads.list();
118
+ const t = await client.threads.get('thread_xxx');
119
+ await client.threads.update('thread_xxx', { title: 'New title' });
120
+ await client.threads.delete('thread_xxx');
175
121
  ```
176
122
 
177
- #### Dockerfile Customization
178
-
179
- ```typescript
180
- // Get Dockerfile configuration
181
- const dockerfile = await client.environments.getDockerfile('env_xxx');
182
- // { baseImage: '...', dockerfileExtensions: '...', effectiveDockerfile: '...' }
183
-
184
- // Set Dockerfile extensions (triggers rebuild)
185
- await client.environments.setDockerfileExtensions('env_xxx',
186
- 'RUN pip install custom-package\nRUN apt-get install -y custom-tool'
187
- );
188
-
189
- // Validate Dockerfile syntax without building
190
- const validation = await client.environments.validateDockerfile('env_xxx',
191
- 'RUN pip install something'
192
- );
193
- // { valid: true, warnings: [], effectiveDockerfile: '...' }
194
- ```
123
+ ### Agents
195
124
 
196
- #### Build Management
125
+ Configure agent behavior with specific models and instructions:
197
126
 
198
127
  ```typescript
199
- // Trigger a build
200
- const build = await client.environments.triggerBuild('env_xxx');
201
- // { buildId: 'build_xxx', status: 'building', message: 'Build started' }
202
-
203
- // Force rebuild even if up to date
204
- await client.environments.triggerBuild('env_xxx', true);
205
-
206
- // Get build status
207
- const status = await client.environments.getBuildStatus('env_xxx');
208
- // { buildStatus: 'ready', buildHash: '...', imageTag: '...', lastBuildAt: '...' }
209
-
210
- // Get build logs
211
- const logs = await client.environments.getBuildLogs('env_xxx');
212
- // { logs: '...', buildStatus: 'ready' }
128
+ const agent = await client.agents.create({
129
+ name: 'Senior Developer',
130
+ model: 'claude-sonnet-4-5',
131
+ instructions: 'You are a senior developer. Write clean, tested code.',
132
+ reasoningEffort: 'high'
133
+ });
213
134
 
214
- // Test build (validates without caching)
215
- const test = await client.environments.testBuild('env_xxx');
216
- // { success: true, logs: '...', duration: 45000 }
135
+ // Use the agent in a thread
136
+ const thread = await client.threads.create({
137
+ environmentId: 'env_xxx',
138
+ agentId: agent.id
139
+ });
217
140
  ```
218
141
 
219
- ### Agents
142
+ ### Environments
220
143
 
221
- Configure agent behavior:
144
+ Isolated containers with custom runtimes, packages, and configuration:
222
145
 
223
146
  ```typescript
224
- // Create an agent
225
- const agent = await client.agents.create({
226
- name: 'Code Assistant',
227
- model: 'gpt-4o',
228
- instructions: 'You are a helpful coding assistant.'
147
+ // Create an environment
148
+ const env = await client.environments.create({
149
+ name: 'python-dev',
150
+ internetAccess: true
229
151
  });
230
152
 
231
- // List agents
232
- const agents = await client.agents.list();
153
+ // Configure runtimes
154
+ await client.environments.setRuntimes(env.id, {
155
+ python: '3.12',
156
+ nodejs: '20'
157
+ });
158
+
159
+ // Install packages
160
+ await client.environments.installPackages(env.id, {
161
+ packages: [
162
+ { type: 'python', name: 'flask' },
163
+ { type: 'python', name: 'pytest' },
164
+ { type: 'system', name: 'curl' }
165
+ ]
166
+ });
233
167
 
234
- // Update an agent
235
- await client.agents.update('agent_xxx', {
236
- instructions: 'Updated instructions'
168
+ // Add MCP servers
169
+ await client.environments.update(env.id, {
170
+ mcpServers: [
171
+ {
172
+ type: 'stdio',
173
+ name: 'filesystem',
174
+ command: 'npx',
175
+ args: ['-y', '@modelcontextprotocol/server-filesystem', '/workspace']
176
+ },
177
+ {
178
+ type: 'http',
179
+ name: 'notion',
180
+ url: 'https://mcp.notion.com/mcp',
181
+ bearerToken: process.env.NOTION_TOKEN
182
+ }
183
+ ]
237
184
  });
185
+
186
+ // Trigger a build
187
+ await client.environments.build(env.id);
238
188
  ```
239
189
 
240
190
  ### Files
@@ -242,89 +192,92 @@ await client.agents.update('agent_xxx', {
242
192
  Manage files in environment workspaces:
243
193
 
244
194
  ```typescript
245
- // List files in an environment
246
- const files = await client.files.listFiles('env_xxx');
247
-
248
195
  // Upload a file
249
196
  await client.files.uploadFile({
250
197
  environmentId: 'env_xxx',
251
- filename: 'app.py',
252
- path: 'src', // optional subdirectory
198
+ path: 'src/app.py',
253
199
  content: 'print("hello")'
254
200
  });
255
201
 
256
202
  // Download file content
257
203
  const content = await client.files.getFile('env_xxx', 'src/app.py');
258
204
 
259
- // Download as Buffer
260
- const buffer = await client.files.downloadFile('env_xxx', 'src/app.py');
261
-
262
- // Move/rename a file
263
- await client.files.moveFile({
264
- environmentId: 'env_xxx',
265
- sourcePath: 'old-name.py',
266
- destPath: 'new-name.py'
267
- });
205
+ // List files
206
+ const files = await client.files.listFiles('env_xxx');
268
207
 
269
208
  // Delete a file
270
209
  await client.files.deleteFile('env_xxx', 'src/app.py');
271
210
  ```
272
211
 
212
+ ### Git
213
+
214
+ Version control on workspaces:
215
+
216
+ ```typescript
217
+ // View uncommitted changes
218
+ const diff = await client.git.diff('env_xxx');
219
+
220
+ // Commit and push
221
+ await client.git.commit('env_xxx', { message: 'Add new feature' });
222
+ await client.git.push('env_xxx');
223
+ ```
224
+
273
225
  ### Schedules
274
226
 
275
- Automate task execution:
227
+ Automate recurring tasks:
276
228
 
277
229
  ```typescript
278
- // Create a schedule
279
230
  const schedule = await client.schedules.create({
280
- name: 'Daily Report',
281
- agentId: 'agent_xxx',
282
- agentName: 'Reporter',
283
- task: 'Generate daily report',
284
- scheduleType: 'recurring',
285
- cronExpression: '0 9 * * *'
231
+ name: 'Daily Code Review',
232
+ type: 'cron',
233
+ cronExpression: '0 9 * * *',
234
+ task: 'Review all uncommitted changes',
235
+ environmentId: 'env_xxx'
286
236
  });
287
237
 
288
- // List schedules
289
- const schedules = await client.schedules.list();
290
-
291
- // Trigger a schedule manually
292
- await client.schedules.trigger('schedule_xxx');
238
+ // Trigger manually
239
+ await client.schedules.trigger(schedule.id);
293
240
  ```
294
241
 
295
- ### Billing
242
+ ### Budget
296
243
 
297
- Track usage and manage budgets:
244
+ Monitor spending and control execution:
298
245
 
299
246
  ```typescript
300
- // Get budget status
301
247
  const status = await client.budget.getStatus();
248
+ console.log(`Balance: $${(status.balance / 100).toFixed(2)}`);
302
249
 
303
- // Check if can execute
304
250
  const canRun = await client.budget.canExecute();
305
-
306
- // Get billing records
307
- const records = await client.billing.listRecords({ limit: 10 });
308
-
309
- // Get usage stats
310
- const stats = await client.billing.getStats({ period: 'month' });
251
+ if (!canRun.canExecute) {
252
+ console.log('Budget exceeded:', canRun.reason);
253
+ }
311
254
  ```
312
255
 
313
- ### Git Operations
314
-
315
- Manage version control:
256
+ ## Streaming Events
316
257
 
317
258
  ```typescript
318
- // Get diff
319
- const diff = await client.git.diff('env_xxx');
320
-
321
- // Commit changes
322
- await client.git.commit('env_xxx', {
323
- message: 'Add new feature'
259
+ await client.threads.sendMessage(threadId, {
260
+ content: 'Build a REST API',
261
+ onEvent: (event) => {
262
+ switch (event.type) {
263
+ case 'response.started':
264
+ console.log('Execution started');
265
+ break;
266
+ case 'response.item.completed':
267
+ console.log('Item:', event);
268
+ break;
269
+ case 'response.completed':
270
+ console.log('Response finished');
271
+ break;
272
+ case 'stream.completed':
273
+ console.log('Done');
274
+ break;
275
+ case 'stream.error':
276
+ console.error('Error:', event);
277
+ break;
278
+ }
279
+ }
324
280
  });
325
-
326
- // Push to remote
327
- await client.git.push('env_xxx');
328
281
  ```
329
282
 
330
283
  ## Error Handling
@@ -333,7 +286,7 @@ await client.git.push('env_xxx');
333
286
  import { ComputerAgentsClient, ApiClientError } from 'computer-agents';
334
287
 
335
288
  try {
336
- await client.run('Task', { environmentId: 'env_xxx' });
289
+ await client.run('Task');
337
290
  } catch (error) {
338
291
  if (error instanceof ApiClientError) {
339
292
  console.error(`API Error: ${error.message}`);
@@ -343,11 +296,31 @@ try {
343
296
  }
344
297
  ```
345
298
 
346
- ## Environment Variables
299
+ ## Examples
300
+
301
+ See the [`examples/`](./examples) directory for complete, runnable examples:
347
302
 
348
- | Variable | Description |
349
- |----------|-------------|
350
- | `COMPUTER_AGENTS_API_KEY` | API key for authentication |
303
+ | Example | Description |
304
+ |---------|-------------|
305
+ | [Hello World](./examples/01-hello-world.ts) | Simplest possible usage |
306
+ | [Multi-turn Conversation](./examples/02-multi-turn-conversation.ts) | Thread-based conversations |
307
+ | [Streaming](./examples/03-streaming.ts) | Real-time SSE event handling |
308
+ | [Custom Agent](./examples/04-custom-agent.ts) | Agent configuration with models and instructions |
309
+ | [Environments](./examples/05-environments.ts) | Environment management |
310
+ | [File Operations](./examples/06-file-operations.ts) | Upload, download, and manage files |
311
+ | [Copy Thread](./examples/07-copy-thread.ts) | Fork conversations |
312
+ | [Search Threads](./examples/08-search-threads.ts) | Full-text search across threads |
313
+ | [MCP Servers](./examples/09-mcp-servers.ts) | Model Context Protocol integration |
314
+ | [Git Operations](./examples/10-git-operations.ts) | Diffs, commits, and pushes |
315
+ | [Budget Management](./examples/11-budget-management.ts) | Monitor spending |
316
+ | [Schedules](./examples/12-schedules.ts) | Automate recurring tasks |
317
+ | [Execution Logs](./examples/13-execution-logs.ts) | Logs and deep research sessions |
318
+
319
+ Run any example:
320
+
321
+ ```bash
322
+ COMPUTER_AGENTS_API_KEY=your-key npx tsx examples/01-hello-world.ts
323
+ ```
351
324
 
352
325
  ## TypeScript
353
326
 
@@ -355,25 +328,29 @@ Full type definitions are included:
355
328
 
356
329
  ```typescript
357
330
  import type {
358
- // Core types
359
331
  Thread,
360
332
  Environment,
361
333
  CloudAgent,
362
334
  Schedule,
363
- BudgetStatus,
335
+ Run,
336
+ AgentModel,
337
+ ReasoningEffort,
364
338
  MessageStreamEvent,
365
-
366
- // Environment configuration
367
- RuntimeConfig,
368
- PackagesConfig,
369
- AvailableRuntimes,
370
- PackageType,
371
- BuildStatus,
372
- BuildStatusResult,
373
- DockerfileResult,
339
+ McpServer,
340
+ BudgetStatus,
341
+ CopyThreadParams,
342
+ SearchThreadsResponse,
343
+ ThreadLogEntry,
344
+ ResearchSession,
374
345
  } from 'computer-agents';
375
346
  ```
376
347
 
377
348
  ## License
378
349
 
379
350
  MIT
351
+
352
+ ## Links
353
+
354
+ - [Website](https://computer-agents.com)
355
+ - [npm](https://www.npmjs.com/package/computer-agents)
356
+ - [GitHub](https://github.com/computer-agents/computer-agents-sdk)
@@ -76,7 +76,7 @@ export interface RunOptions {
76
76
  * Agent configuration override
77
77
  */
78
78
  agentConfig?: {
79
- model?: 'claude-opus-4-5' | 'claude-sonnet-4-5' | 'claude-haiku-4-5';
79
+ model?: 'claude-opus-4-6' | 'claude-sonnet-4-5' | 'claude-haiku-4-5';
80
80
  instructions?: string;
81
81
  reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high';
82
82
  };
@@ -157,11 +157,11 @@ export declare class EnvironmentsResource {
157
157
  */
158
158
  getStatus(environmentId: string): Promise<ContainerStatus>;
159
159
  /**
160
- * Get the Codex configuration for an environment
160
+ * Get the agent configuration for an environment
161
161
  */
162
162
  getConfig(environmentId: string): Promise<string>;
163
163
  /**
164
- * Update the Codex configuration for an environment
164
+ * Update the agent configuration for an environment
165
165
  */
166
166
  updateConfig(environmentId: string, config: string): Promise<void>;
167
167
  }
@@ -239,14 +239,14 @@ class EnvironmentsResource {
239
239
  // Configuration Management
240
240
  // =========================================================================
241
241
  /**
242
- * Get the Codex configuration for an environment
242
+ * Get the agent configuration for an environment
243
243
  */
244
244
  async getConfig(environmentId) {
245
245
  const response = await this.client.get(`/environments/${environmentId}/config`);
246
246
  return response.config;
247
247
  }
248
248
  /**
249
- * Update the Codex configuration for an environment
249
+ * Update the agent configuration for an environment
250
250
  */
251
251
  async updateConfig(environmentId, config) {
252
252
  await this.client.put(`/environments/${environmentId}/config`, { config });
@@ -8,7 +8,7 @@
8
8
  * simplified paths without /projects/:projectId prefix.
9
9
  */
10
10
  import type { ApiClient } from '../ApiClient';
11
- import type { Thread, CreateThreadParams, UpdateThreadParams, ListThreadsParams, SendMessageParams, ThreadMessage, MessageStreamEvent } from '../types';
11
+ import type { Thread, CreateThreadParams, UpdateThreadParams, ListThreadsParams, SendMessageParams, ThreadMessage, MessageStreamEvent, CopyThreadParams, SearchThreadsParams, SearchThreadsResponse, ThreadLogEntry, ResearchSession } from '../types';
12
12
  /**
13
13
  * Callback for handling streaming events
14
14
  */
@@ -113,6 +113,72 @@ export declare class ThreadsResource {
113
113
  * ```
114
114
  */
115
115
  sendMessage(threadId: string, options: SendMessageOptions): Promise<SendMessageResult>;
116
+ /**
117
+ * Copy a thread with all its conversation messages into a new thread
118
+ *
119
+ * Creates a new thread with the same environment and agent configuration,
120
+ * copies all conversation messages, and marks the new thread as completed.
121
+ *
122
+ * @param threadId - The source thread to copy
123
+ * @param params - Optional parameters (custom title)
124
+ * @returns The newly created thread
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * // Copy with auto-generated title ("[Original Title] Copy")
129
+ * const copy = await client.threads.copy('thread_abc');
130
+ *
131
+ * // Copy with custom title
132
+ * const copy = await client.threads.copy('thread_abc', {
133
+ * title: 'My experiment v2'
134
+ * });
135
+ *
136
+ * // Continue conversation on the copy
137
+ * await client.threads.sendMessage(copy.id, {
138
+ * content: 'Try a different approach...',
139
+ * onEvent: (event) => console.log(event)
140
+ * });
141
+ * ```
142
+ */
143
+ copy(threadId: string, params?: CopyThreadParams): Promise<Thread>;
144
+ /**
145
+ * Search threads by text query
146
+ *
147
+ * Full-text search across thread titles and messages.
148
+ * Requires PostgreSQL backend.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * const results = await client.threads.search({
153
+ * query: 'REST API',
154
+ * limit: 10
155
+ * });
156
+ *
157
+ * for (const result of results.results) {
158
+ * console.log(result.thread.title, result.score);
159
+ * }
160
+ * ```
161
+ */
162
+ search(params: SearchThreadsParams): Promise<SearchThreadsResponse>;
163
+ /**
164
+ * Get execution logs for a thread
165
+ *
166
+ * Returns logs with role separation (user, assistant, execution_log)
167
+ * and relative timestamps from thread start time.
168
+ */
169
+ getLogs(threadId: string): Promise<ThreadLogEntry[]>;
170
+ /**
171
+ * List deep research sessions for a thread
172
+ */
173
+ listResearch(threadId: string): Promise<ResearchSession[]>;
174
+ /**
175
+ * Get a specific deep research session
176
+ */
177
+ getResearch(threadId: string, sessionId: string): Promise<ResearchSession>;
178
+ /**
179
+ * Delete a deep research session
180
+ */
181
+ deleteResearch(threadId: string, sessionId: string): Promise<void>;
116
182
  /**
117
183
  * Cancel an in-progress message execution
118
184
  */
@@ -160,6 +160,89 @@ class ThreadsResource {
160
160
  events,
161
161
  };
162
162
  }
163
+ /**
164
+ * Copy a thread with all its conversation messages into a new thread
165
+ *
166
+ * Creates a new thread with the same environment and agent configuration,
167
+ * copies all conversation messages, and marks the new thread as completed.
168
+ *
169
+ * @param threadId - The source thread to copy
170
+ * @param params - Optional parameters (custom title)
171
+ * @returns The newly created thread
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * // Copy with auto-generated title ("[Original Title] Copy")
176
+ * const copy = await client.threads.copy('thread_abc');
177
+ *
178
+ * // Copy with custom title
179
+ * const copy = await client.threads.copy('thread_abc', {
180
+ * title: 'My experiment v2'
181
+ * });
182
+ *
183
+ * // Continue conversation on the copy
184
+ * await client.threads.sendMessage(copy.id, {
185
+ * content: 'Try a different approach...',
186
+ * onEvent: (event) => console.log(event)
187
+ * });
188
+ * ```
189
+ */
190
+ async copy(threadId, params) {
191
+ const response = await this.client.post(`/threads/${threadId}/copy`, params);
192
+ return response.thread;
193
+ }
194
+ /**
195
+ * Search threads by text query
196
+ *
197
+ * Full-text search across thread titles and messages.
198
+ * Requires PostgreSQL backend.
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const results = await client.threads.search({
203
+ * query: 'REST API',
204
+ * limit: 10
205
+ * });
206
+ *
207
+ * for (const result of results.results) {
208
+ * console.log(result.thread.title, result.score);
209
+ * }
210
+ * ```
211
+ */
212
+ async search(params) {
213
+ const response = await this.client.post(`/threads/search`, params);
214
+ return response;
215
+ }
216
+ /**
217
+ * Get execution logs for a thread
218
+ *
219
+ * Returns logs with role separation (user, assistant, execution_log)
220
+ * and relative timestamps from thread start time.
221
+ */
222
+ async getLogs(threadId) {
223
+ const response = await this.client.get(`/threads/${threadId}/logs`);
224
+ return response.logs;
225
+ }
226
+ /**
227
+ * List deep research sessions for a thread
228
+ */
229
+ async listResearch(threadId) {
230
+ const response = await this.client.get(`/threads/${threadId}/research`);
231
+ return response.sessions;
232
+ }
233
+ /**
234
+ * Get a specific deep research session
235
+ */
236
+ async getResearch(threadId, sessionId) {
237
+ const response = await this.client.get(`/threads/${threadId}/research/${sessionId}`);
238
+ return response.session;
239
+ }
240
+ /**
241
+ * Delete a deep research session
242
+ */
243
+ async deleteResearch(threadId, sessionId) {
244
+ await this.client.delete(`/threads/${threadId}/research/${sessionId}`);
245
+ }
163
246
  /**
164
247
  * Cancel an in-progress message execution
165
248
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadsResource.js","sourceRoot":"","sources":["../../../src/cloud/resources/ThreadsResource.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA6DH,MAAa,eAAe;IACG;IAA7B,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAAG,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAA0B;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,UAAU,EACV,MAAM,CACP,CAAC;QACF,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,SAA4B,EAAE;QAKvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAKnC,UAAU,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;YACn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M,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,YAAY,QAAQ,WAAW,CAChC,CAAC;QACF,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,QAAgB,EAChB,SAAiB;QAEjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,YAAY,QAAQ,aAAa,SAAS,EAAE,CAC7C,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB;QAEjB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACtB,YAAY,QAAQ,aAAa,SAAS,EAAE,CAC7C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,QAAQ,SAAS,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACrC,YAAY,QAAQ,SAAS,CAC9B,CAAC;QACF,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;CACF;AAtUD,0CAsUC"}
@@ -236,7 +236,7 @@ export interface StartContainerResult {
236
236
  imageTag: string;
237
237
  workspacePath: string;
238
238
  }
239
- export type ThreadStatus = 'active' | 'completed' | 'cancelled';
239
+ export type ThreadStatus = 'active' | 'running' | 'completed' | 'failed' | 'archived' | 'cancelled' | 'deleted';
240
240
  export interface ThreadMessage {
241
241
  role: 'user' | 'assistant' | 'system';
242
242
  content: string;
@@ -270,6 +270,62 @@ export interface ListThreadsParams extends PaginationParams {
270
270
  environmentId?: string;
271
271
  status?: ThreadStatus;
272
272
  }
273
+ export interface CopyThreadParams {
274
+ /**
275
+ * Custom title for the copied thread.
276
+ * If not provided, defaults to "[Original Title] Copy"
277
+ */
278
+ title?: string;
279
+ }
280
+ export interface SearchThreadsParams {
281
+ /** Search query (required) */
282
+ query: string;
283
+ /** Filter by environment */
284
+ environmentId?: string;
285
+ /** Filter by status */
286
+ status?: ThreadStatus | 'all';
287
+ /** Max results to return (default: 20, max: 100) */
288
+ limit?: number;
289
+ /** Offset for pagination */
290
+ offset?: number;
291
+ /** Include matching messages in results */
292
+ includeMessages?: boolean;
293
+ }
294
+ export interface SearchThreadResult {
295
+ thread: Thread & {
296
+ environmentName?: string;
297
+ agentName?: string | null;
298
+ };
299
+ score: number;
300
+ highlights: string[];
301
+ matchingMessages?: ThreadMessage[];
302
+ }
303
+ export interface SearchThreadsResponse {
304
+ results: SearchThreadResult[];
305
+ total: number;
306
+ hasMore: boolean;
307
+ searchMetadata: {
308
+ query: string;
309
+ queryType: string;
310
+ processingTimeMs: number;
311
+ };
312
+ }
313
+ export interface ThreadLogEntry {
314
+ role: 'user' | 'assistant' | 'execution_log';
315
+ content: string;
316
+ timestamp?: string;
317
+ relativeTime?: string;
318
+ }
319
+ export interface ResearchSession {
320
+ id: string;
321
+ threadId: string;
322
+ status: string;
323
+ progress?: number;
324
+ query?: string;
325
+ results?: unknown[];
326
+ createdAt: string;
327
+ updatedAt: string;
328
+ }
273
329
  export interface SendMessageParams {
274
330
  content: string;
275
331
  mcpServers?: McpServer[];
@@ -401,7 +457,7 @@ export interface RunDiff {
401
457
  * Supported Claude models for agent execution.
402
458
  * All agents run via Claude Code CLI in containers.
403
459
  */
404
- export type AgentModel = 'claude-opus-4-5' | 'claude-sonnet-4-5' | 'claude-haiku-4-5';
460
+ export type AgentModel = 'claude-opus-4-6' | 'claude-sonnet-4-5' | 'claude-haiku-4-5';
405
461
  /**
406
462
  * Reasoning effort level for extended thinking.
407
463
  */
package/dist/index.d.ts CHANGED
@@ -24,5 +24,5 @@ export { ComputerAgentsClient, CloudClient, TestbaseClient, ApiClientError, } fr
24
24
  export type { ComputerAgentsClientConfig, RunOptions, RunResult, ApiClientConfig, } from './ComputerAgentsClient';
25
25
  export { ProjectsResource, EnvironmentsResource, ThreadsResource, RunsResource, AgentsResource, BudgetResource, BillingResource, SchedulesResource, GitResource, } from './cloud/resources';
26
26
  export type { StreamEventCallback, SendMessageOptions, SendMessageResult, ListEnvironmentsParams, } from './cloud/resources';
27
- export type { PaginationParams, PaginatedResponse, ApiError, Project, CreateProjectParams, UpdateProjectParams, ProjectStats, ProjectType, ProjectSource, Environment, CreateEnvironmentParams, UpdateEnvironmentParams, EnvironmentStatus, EnvironmentVariable, McpServer, ContainerStatus, BuildResult, BuildStatus, BuildStatusResult, BuildLogsResult, TestBuildResult, DockerfileResult, ValidateDockerfileResult, RuntimeConfig, PackagesConfig, AvailableRuntimes, PackageType, InstallPackagesResult, StartContainerParams, StartContainerResult, Thread, CreateThreadParams, UpdateThreadParams, ListThreadsParams, SendMessageParams, ThreadMessage, ThreadStatus, AgentConfig, StreamEvent, MessageStreamEvent, ResponseStartedEvent, ResponseItemCompletedEvent, ResponseCompletedEvent, StreamCompletedEvent, StreamErrorEvent, Run, CreateRunParams, UpdateRunParams, ListRunsParams, RunStatus, RunLogEntry, RunDiff, TokenUsage, CloudAgent, CreateAgentParams, UpdateAgentParams, AgentModel, ReasoningEffort, DeepResearchModel, AgentBinary, BudgetStatus, CanExecuteResult, IncreaseBudgetParams, IncreaseBudgetResult, BillingRecord, ListBillingRecordsParams, BillingAccount, UsageStats, UsageStatsParams, FileEntry, ListFilesParams, UploadFileParams, CreateDirectoryParams, GitDiffFile, GitDiffResult, GitCommitParams, GitCommitResult, GitPushParams, GitPushResult, Schedule, CreateScheduleParams, UpdateScheduleParams, ScheduleType, HealthCheck, Metrics, } from './cloud/types';
27
+ export type { PaginationParams, PaginatedResponse, ApiError, Project, CreateProjectParams, UpdateProjectParams, ProjectStats, ProjectType, ProjectSource, Environment, CreateEnvironmentParams, UpdateEnvironmentParams, EnvironmentStatus, EnvironmentVariable, McpServer, ContainerStatus, BuildResult, BuildStatus, BuildStatusResult, BuildLogsResult, TestBuildResult, DockerfileResult, ValidateDockerfileResult, RuntimeConfig, PackagesConfig, AvailableRuntimes, PackageType, InstallPackagesResult, StartContainerParams, StartContainerResult, Thread, CreateThreadParams, UpdateThreadParams, ListThreadsParams, SendMessageParams, ThreadMessage, ThreadStatus, AgentConfig, CopyThreadParams, SearchThreadsParams, SearchThreadResult, SearchThreadsResponse, ThreadLogEntry, ResearchSession, StreamEvent, MessageStreamEvent, ResponseStartedEvent, ResponseItemCompletedEvent, ResponseCompletedEvent, StreamCompletedEvent, StreamErrorEvent, Run, CreateRunParams, UpdateRunParams, ListRunsParams, RunStatus, RunLogEntry, RunDiff, TokenUsage, CloudAgent, CreateAgentParams, UpdateAgentParams, AgentModel, ReasoningEffort, DeepResearchModel, AgentBinary, BudgetStatus, CanExecuteResult, IncreaseBudgetParams, IncreaseBudgetResult, BillingRecord, ListBillingRecordsParams, BillingAccount, UsageStats, UsageStatsParams, FileEntry, ListFilesParams, UploadFileParams, CreateDirectoryParams, GitDiffFile, GitDiffResult, GitCommitParams, GitCommitResult, GitPushParams, GitPushResult, Schedule, CreateScheduleParams, UpdateScheduleParams, ScheduleType, HealthCheck, Metrics, } from './cloud/types';
28
28
  export { ApiClient } from './cloud/ApiClient';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,+DAOgC;AAN9B,4HAAA,oBAAoB,OAAA;AACpB,kCAAkC;AAClC,mHAAA,WAAW,OAAA;AACX,sHAAA,cAAc,OAAA;AACd,cAAc;AACd,sHAAA,cAAc,OAAA;AAUhB,+EAA+E;AAC/E,yCAAyC;AACzC,+EAA+E;AAE/E,+CAU2B;AATzB,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AA6Hb,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAE/E,+CAA8C;AAArC,sGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,+DAOgC;AAN9B,4HAAA,oBAAoB,OAAA;AACpB,kCAAkC;AAClC,mHAAA,WAAW,OAAA;AACX,sHAAA,cAAc,OAAA;AACd,cAAc;AACd,sHAAA,cAAc,OAAA;AAUhB,+EAA+E;AAC/E,yCAAyC;AACzC,+EAA+E;AAE/E,+CAU2B;AATzB,6GAAA,gBAAgB,OAAA;AAChB,iHAAA,oBAAoB,OAAA;AACpB,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AAmIb,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAE/E,+CAA8C;AAArC,sGAAA,SAAS,OAAA"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "computer-agents",
3
- "repository": "https://github.com/TestBase-ai/computer-agents",
3
+ "repository": "https://github.com/computer-agents/computer-agents-sdk",
4
4
  "homepage": "https://computer-agents.com",
5
- "version": "2.0.0",
5
+ "version": "2.2.0",
6
6
  "description": "Official SDK for the Computer Agents Cloud API. Execute Claude-powered AI agents in isolated cloud containers.",
7
7
  "author": "Computer Agents",
8
8
  "main": "dist/index.js",