computer-agents 0.4.8 → 0.4.10
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 +94 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +2 -2
- package/dist/metadata.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -101,6 +101,67 @@ const result = await run(agent, "Build a REST API with Express");
|
|
|
101
101
|
// Executes in fresh cloud workspace, results stay in cloud
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Streaming Progress (Real-Time Visibility)
|
|
105
|
+
|
|
106
|
+
Track agent execution in real-time with `runStreamed()`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Agent, runStreamed, LocalRuntime } from 'computer-agents';
|
|
110
|
+
|
|
111
|
+
const agent = new Agent({
|
|
112
|
+
agentType: "computer",
|
|
113
|
+
runtime: new LocalRuntime(),
|
|
114
|
+
workspace: "./my-project",
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Stream events in real-time
|
|
118
|
+
for await (const event of runStreamed(agent, 'Create a Python web scraper')) {
|
|
119
|
+
switch (event.type) {
|
|
120
|
+
case 'thread.started':
|
|
121
|
+
console.log(`🔗 Thread: ${event.thread_id}`);
|
|
122
|
+
break;
|
|
123
|
+
case 'turn.started':
|
|
124
|
+
console.log('🎬 Turn started');
|
|
125
|
+
break;
|
|
126
|
+
case 'item.completed':
|
|
127
|
+
if (event.item.type === 'file_change') {
|
|
128
|
+
const files = event.item.changes.map(c => `${c.kind} ${c.path}`).join(', ');
|
|
129
|
+
console.log(`✅ Files: ${files}`);
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
case 'turn.completed':
|
|
133
|
+
console.log(`🎉 Completed (${event.usage.input_tokens + event.usage.output_tokens} tokens)`);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Event Types:**
|
|
140
|
+
- `thread.started` - Session initialized with thread ID
|
|
141
|
+
- `turn.started` - Agent begins processing
|
|
142
|
+
- `item.started` - Tool call or action begins
|
|
143
|
+
- `item.completed` - Tool call or action completes (includes file changes)
|
|
144
|
+
- `turn.completed` - Processing finished (includes token usage)
|
|
145
|
+
- `turn.failed` - Error occurred
|
|
146
|
+
|
|
147
|
+
**Use Cases:**
|
|
148
|
+
- Progress bars for long-running tasks
|
|
149
|
+
- Real-time logging and debugging
|
|
150
|
+
- Live UI updates in applications
|
|
151
|
+
- Better UX for multi-step operations
|
|
152
|
+
|
|
153
|
+
**API Consistency:** `runStreamed()` mirrors `run()` - same signature, just with streaming!
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Standard execution
|
|
157
|
+
const result = await run(agent, task);
|
|
158
|
+
|
|
159
|
+
// Streaming execution
|
|
160
|
+
for await (const event of runStreamed(agent, task)) {
|
|
161
|
+
// Real-time progress
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
104
165
|
### Parallel Execution (The Game Changer)
|
|
105
166
|
|
|
106
167
|
Run multiple agents simultaneously:
|
|
@@ -236,6 +297,9 @@ cd computer-agents
|
|
|
236
297
|
npm install
|
|
237
298
|
npm run build
|
|
238
299
|
|
|
300
|
+
# Streaming progress (real-time event visibility)
|
|
301
|
+
node examples/testbase/streaming-progress.cjs
|
|
302
|
+
|
|
239
303
|
# Workspace sync modes (default vs cloud-only)
|
|
240
304
|
node examples/testbase/workspace-sync-modes.mjs
|
|
241
305
|
|
|
@@ -415,6 +479,30 @@ function run(
|
|
|
415
479
|
): Promise<RunResult>;
|
|
416
480
|
```
|
|
417
481
|
|
|
482
|
+
### runStreamed()
|
|
483
|
+
|
|
484
|
+
```typescript
|
|
485
|
+
function runStreamed(
|
|
486
|
+
agent: Agent,
|
|
487
|
+
task: string,
|
|
488
|
+
options?: RunOptions
|
|
489
|
+
): AsyncGenerator<Event>;
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Stream real-time events during agent execution. Returns an async generator that yields:
|
|
493
|
+
- `thread.started` - Session initialized
|
|
494
|
+
- `turn.started` - Agent begins processing
|
|
495
|
+
- `item.started` / `item.completed` - Tool calls and file changes
|
|
496
|
+
- `turn.completed` - Processing finished with usage stats
|
|
497
|
+
- `turn.failed` - Error occurred
|
|
498
|
+
|
|
499
|
+
**Example:**
|
|
500
|
+
```typescript
|
|
501
|
+
for await (const event of runStreamed(agent, 'Create app.py')) {
|
|
502
|
+
console.log(event.type, event);
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
418
506
|
### LocalRuntime
|
|
419
507
|
|
|
420
508
|
```typescript
|
|
@@ -578,6 +666,12 @@ new CloudRuntime({ skipWorkspaceSync: true })
|
|
|
578
666
|
|
|
579
667
|
## What's New
|
|
580
668
|
|
|
669
|
+
### v0.4.9
|
|
670
|
+
- **Streaming Progress**: New `runStreamed()` function for real-time visibility
|
|
671
|
+
- Stream events: thread.started, turn.started, item.completed, turn.completed
|
|
672
|
+
- API consistency - mirrors `run()` signature for easy adoption
|
|
673
|
+
- Perfect for progress bars, real-time logging, and better UX
|
|
674
|
+
|
|
581
675
|
### v0.4.6
|
|
582
676
|
- **Cloud-Only Mode**: `skipWorkspaceSync` option for CloudRuntime
|
|
583
677
|
- Perfect for CI/CD and parallel experiments
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type * as CoreTypes from 'computer-agents-core';
|
|
2
|
+
import { LocalRuntime as CoreLocalRuntime, CloudRuntime as CoreCloudRuntime } from 'computer-agents-core';
|
|
2
3
|
export declare function run<TAgent extends CoreTypes.Agent<any, any>, TContext = undefined>(agent: TAgent, input: string | CoreTypes.AgentInputItem[] | CoreTypes.RunState<TContext, TAgent>, options?: CoreTypes.StreamRunOptions<TContext> | CoreTypes.NonStreamRunOptions<TContext>): Promise<CoreTypes.RunResult<TContext, TAgent> | CoreTypes.StreamedRunResult<TContext, TAgent>>;
|
|
3
4
|
export * from 'computer-agents-core';
|
|
5
|
+
export { CoreLocalRuntime as LocalRuntime, CoreCloudRuntime as CloudRuntime };
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CloudRuntime = exports.LocalRuntime = void 0;
|
|
17
18
|
exports.run = run;
|
|
18
19
|
const node_url_1 = require("node:url");
|
|
19
20
|
const node_path_1 = require("node:path");
|
|
21
|
+
// Import runtime classes directly for re-export
|
|
22
|
+
const computer_agents_core_1 = require("computer-agents-core");
|
|
23
|
+
Object.defineProperty(exports, "LocalRuntime", { enumerable: true, get: function () { return computer_agents_core_1.LocalRuntime; } });
|
|
24
|
+
Object.defineProperty(exports, "CloudRuntime", { enumerable: true, get: function () { return computer_agents_core_1.CloudRuntime; } });
|
|
20
25
|
const dynamicImport = new Function('specifier', 'return import(specifier);');
|
|
21
26
|
let coreModule;
|
|
22
27
|
function getCore() {
|
|
@@ -69,5 +74,6 @@ async function run(agent, input, options) {
|
|
|
69
74
|
await ensureProviderForAgent(agent);
|
|
70
75
|
return coreRun(agent, input, options);
|
|
71
76
|
}
|
|
77
|
+
// Re-export everything from core
|
|
72
78
|
__exportStar(require("computer-agents-core"), exports);
|
|
73
79
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2EA,kBAcC;AAzFD,uCAAyC;AACzC,yCAAoC;AA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AAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC;IAC3C,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,kBAAkB,GAAG,MAAM,kBAAkB,EAAE,CAAC;YACtD,WAAW,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IACD,qDAAqD;IACrD,wDAAwD;AAC1D,CAAC;AAED,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC;AAEvB,KAAK,UAAU,GAAG,CAIvB,KAAa,EACb,KAAiF,EACjF,OAE2C;IAI3C,MAAM,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAc,CAAC,CAAC;AAC/C,CAAC;AAED,iCAAiC;AACjC,uDAAqC"}
|
package/dist/metadata.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.METADATA = void 0;
|
|
5
5
|
exports.METADATA = {
|
|
6
6
|
"name": "computer-agents",
|
|
7
|
-
"version": "0.4.
|
|
7
|
+
"version": "0.4.10",
|
|
8
8
|
"versions": {
|
|
9
|
-
"computer-agents": "0.4.
|
|
9
|
+
"computer-agents": "0.4.10"
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
exports.default = exports.METADATA;
|
package/dist/metadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":";AACA,uCAAuC;;;AAE1B,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":";AACA,uCAAuC;;;AAE1B,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,QAAQ;IACnB,UAAU,EAAE;QACV,iBAAiB,EAAE,QAAQ;KAC5B;CACF,CAAC;AAEF,kBAAe,gBAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "computer-agents",
|
|
3
3
|
"repository": "https://github.com/TestBase-ai/computer-agents",
|
|
4
4
|
"homepage": "https://testbase.ai/computer-agents",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.10",
|
|
6
6
|
"description": "Build computer-use agents that write code, run tests, and deploy apps. Seamless local and cloud execution with automatic session continuity.",
|
|
7
7
|
"author": "Testbase",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"build-check": "tsc --noEmit -p ./tsconfig.test.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"computer-agents-core": "
|
|
24
|
-
"computer-agents-openai": "
|
|
23
|
+
"computer-agents-core": "workspace:*",
|
|
24
|
+
"computer-agents-openai": "workspace:*"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"computer-agents",
|