@operator-labs/sdk 0.1.6 → 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.
- package/README.md +26 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# @operator-labs/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for [Operator.io](https://operator.io).
|
|
3
|
+
TypeScript SDK for [Operator.io](https://operator.io).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Operator.io](https://operator.io) is the API for building, managing, and hosting [OpenClaw](https://openclaw.ai) agents using AI.
|
|
6
|
+
|
|
7
|
+
Use `op.chat` when you want [Operator.io](https://operator.io) to create agents, update files and skills, inspect instances, run web searches, or handle multi-step work.
|
|
8
|
+
|
|
9
|
+
Use the typed methods for direct control over instances, config, automations, and webhooks.
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
@@ -21,12 +25,17 @@ const op = new Operator({ apiKey: "ck_live_..." });
|
|
|
21
25
|
const status = await op.health();
|
|
22
26
|
console.log(status.planName, status.email);
|
|
23
27
|
|
|
24
|
-
//
|
|
25
|
-
const { chatId, text } = await op.chat.send(
|
|
28
|
+
// Ask Operator.io to build and manage agents for you
|
|
29
|
+
const { chatId, text } = await op.chat.send(
|
|
30
|
+
"Create a new OpenClaw agent for outbound sales research and install the skills it needs."
|
|
31
|
+
);
|
|
26
32
|
console.log(text);
|
|
27
33
|
|
|
28
34
|
// Continue the conversation
|
|
29
|
-
const followUp = await op.chat.send(
|
|
35
|
+
const followUp = await op.chat.send(
|
|
36
|
+
"Now update its state files so it posts a daily summary at 9am Bangkok time.",
|
|
37
|
+
{ chatId }
|
|
38
|
+
);
|
|
30
39
|
console.log(followUp.text);
|
|
31
40
|
```
|
|
32
41
|
|
|
@@ -34,13 +43,13 @@ console.log(followUp.text);
|
|
|
34
43
|
|
|
35
44
|
```ts
|
|
36
45
|
const op = new Operator({
|
|
37
|
-
apiKey: "ck_live_...",
|
|
46
|
+
apiKey: "ck_live_...", // Required: Chat API key from the dashboard
|
|
38
47
|
});
|
|
39
48
|
```
|
|
40
49
|
|
|
41
50
|
## Getting an API Key
|
|
42
51
|
|
|
43
|
-
1. Go to **Settings > API Keys** in the Operator dashboard
|
|
52
|
+
1. Go to **Settings > API Keys** in the [Operator.io](https://operator.io) dashboard
|
|
44
53
|
2. Click **Create Key**
|
|
45
54
|
3. Copy the key (starts with `ck_live_` or `ck_dev_`)
|
|
46
55
|
|
|
@@ -55,6 +64,8 @@ const status = await op.health();
|
|
|
55
64
|
|
|
56
65
|
### Chat
|
|
57
66
|
|
|
67
|
+
`op.chat` is the main agent surface. Use it when you want [Operator.io](https://operator.io) to create agents, inspect an instance, read or mutate files, install or author skills, change agent behavior, run web research, or coordinate multi-step work. Use the typed resources below when you want direct control over common API objects.
|
|
68
|
+
|
|
58
69
|
```ts
|
|
59
70
|
// List all chats
|
|
60
71
|
const chats = await op.chat.list();
|
|
@@ -66,6 +77,12 @@ const detail = await op.chat.get("chat-uuid");
|
|
|
66
77
|
const { chatId, text } = await op.chat.send("Create a new instance called my-agent");
|
|
67
78
|
console.log(text);
|
|
68
79
|
|
|
80
|
+
// Update agent files and skills through the agent
|
|
81
|
+
const edit = await op.chat.send(
|
|
82
|
+
"Open the my-agent instance, update its core files for a stricter review style, install any missing skills, and summarize what changed."
|
|
83
|
+
);
|
|
84
|
+
console.log(edit.text);
|
|
85
|
+
|
|
69
86
|
// Continue a conversation
|
|
70
87
|
const followUp = await op.chat.send("Now check its logs", { chatId });
|
|
71
88
|
console.log(followUp.text);
|
|
@@ -77,6 +94,8 @@ await op.chat.delete("chat-uuid");
|
|
|
77
94
|
|
|
78
95
|
### Instances
|
|
79
96
|
|
|
97
|
+
Use `op.instances` for direct lifecycle and config management. If you want [Operator.io](https://operator.io) to inspect or evolve an instance filesystem or state, use `op.chat.send(...)`.
|
|
98
|
+
|
|
80
99
|
```ts
|
|
81
100
|
// List instances
|
|
82
101
|
const instances = await op.instances.list();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operator-labs/sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "TypeScript SDK for
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "TypeScript SDK for Operator.io platform: manage agents, chat, instances, automations, and webhooks programmatically.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|