@reduck-ai/sdk 0.1.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 +57 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @reduck-ai/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the reduck.ai automation platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @reduck-ai/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ReduckClient } from "@reduck-ai/sdk"
|
|
15
|
+
|
|
16
|
+
const client = new ReduckClient({
|
|
17
|
+
apiKey: "your-api-key",
|
|
18
|
+
deviceId: "your-device-id", // or set REDUCK_DEVICE_ID env var
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const run = client.run("Go to google and search for cats", {
|
|
22
|
+
startUrl: "https://google.com",
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
for await (const event of run) {
|
|
26
|
+
console.log(event)
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### `new ReduckClient(options)`
|
|
33
|
+
|
|
34
|
+
`apiKey` : Your reduck.ai API key
|
|
35
|
+
`deviceId` : The device ID to run automations on (or set `REDUCK_DEVICE_ID` env var)
|
|
36
|
+
|
|
37
|
+
### `client.run(prompt, options?)`
|
|
38
|
+
|
|
39
|
+
Returns a `Run` object that is an `AsyncIterable<RunEvent>`.
|
|
40
|
+
|
|
41
|
+
`startUrl` : URL to navigate to before running the automation
|
|
42
|
+
`mount` : Local file paths to make available to the automation
|
|
43
|
+
|
|
44
|
+
### `run.id`
|
|
45
|
+
|
|
46
|
+
`Promise<string>` — resolves to the run ID once created.
|
|
47
|
+
|
|
48
|
+
### `run.cancel()`
|
|
49
|
+
|
|
50
|
+
Cancels the run.
|
|
51
|
+
|
|
52
|
+
## Events
|
|
53
|
+
|
|
54
|
+
`progress` : Automation progress update |
|
|
55
|
+
`done` : Run completed successfully |
|
|
56
|
+
`failure` : Run failed, includes `error` field |
|
|
57
|
+
`cancel` : Run was cancelled |
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reduck-ai/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "pnpm exec tsc",
|
|
22
|
+
"dev": "pnpm exec tsc --watch"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"ws": "^8.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/ws": "^8.0.0",
|
|
29
|
+
"typescript": "^5.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|