taskmaster-api 0.1.0 → 0.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 +12 -9
- package/dist/index.d.ts +90 -1
- package/dist/index.js +56 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
# taskmaster-api
|
|
2
2
|
|
|
3
|
-
Client for
|
|
3
|
+
Client for the [Taskmaster](https://github.com/narensen/Taskmaster) Computer agent running on your machine.
|
|
4
4
|
|
|
5
|
-
`tm serve .` listens on `http://127.0.0.1:8737`.
|
|
5
|
+
`tm serve .` listens on `http://127.0.0.1:8737`. Pair first. Computer stays off until `computerEnable(true)`.
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
import { Taskmaster } from "taskmaster-api";
|
|
9
9
|
|
|
10
10
|
const tm = new Taskmaster();
|
|
11
11
|
tm.setToken(await tm.pair("ABCD", { label: "laptop", kind: "agent" }));
|
|
12
|
+
await tm.computerEnable(true);
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const session = await tm.computerStart("Open Chrome and search for the weather");
|
|
15
|
+
await tm.computerResume(session.id, "Read the first forecast");
|
|
16
|
+
await tm.computerCancel(session.id);
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
`
|
|
19
|
+
`computerAct` sends one action on the 0–1000 screen grid. `computerMode("virtual")` aims the agent at the isolated desktop.
|
|
19
20
|
|
|
20
21
|
```js
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const acted = await tm.computerAct("click_text", { text: "Search" });
|
|
23
|
+
console.log(acted.result);
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
Requires Node 18 or newer (
|
|
26
|
+
Requires Node 18 or newer. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
|
|
27
|
+
|
|
28
|
+
The same client is published for Rust (`cargo add taskmaster-api`) and Python (`pip install taskmaster-api`).
|
|
26
29
|
|
|
27
30
|
MIT © 2026 Naren Sengodan
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/** Daemon address when `tm serve` is started with no bind flag. */
|
|
8
8
|
export declare const DEFAULT_BASE_URL = "http://127.0.0.1:8737";
|
|
9
9
|
/** Package version. Independent of the Taskmaster app version. */
|
|
10
|
-
export declare const VERSION = "0.
|
|
10
|
+
export declare const VERSION = "0.2.0";
|
|
11
11
|
/** The daemon refused the request, or the response was not usable JSON. `status` is `0` when no HTTP response arrived. */
|
|
12
12
|
export declare class TaskmasterError extends Error {
|
|
13
13
|
readonly status: number;
|
|
@@ -101,6 +101,67 @@ export interface StartRun {
|
|
|
101
101
|
goal_max_turns?: number;
|
|
102
102
|
computer_use?: boolean;
|
|
103
103
|
}
|
|
104
|
+
/** `GET /api/computer/status` and the toggle and mode replies. */
|
|
105
|
+
export interface ComputerStatus {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
/** `host` or `virtual`. */
|
|
108
|
+
mode?: string;
|
|
109
|
+
display?: string | null;
|
|
110
|
+
screenshot_backend?: string | null;
|
|
111
|
+
pointer_backend?: string | null;
|
|
112
|
+
keyboard_backend?: string | null;
|
|
113
|
+
install_hint?: string | null;
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
}
|
|
116
|
+
/** A screen frame. `data` is base64 PNG bytes. */
|
|
117
|
+
export interface ComputerScreen {
|
|
118
|
+
mime: string;
|
|
119
|
+
data?: string;
|
|
120
|
+
info?: string;
|
|
121
|
+
hash?: string;
|
|
122
|
+
unchanged?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/** One row from `GET /api/computer/sessions`. */
|
|
125
|
+
export interface ComputerSessionSummary {
|
|
126
|
+
id: string;
|
|
127
|
+
task: string;
|
|
128
|
+
status?: string;
|
|
129
|
+
harness?: string | null;
|
|
130
|
+
model?: string | null;
|
|
131
|
+
step_count?: number;
|
|
132
|
+
agent_count?: number;
|
|
133
|
+
error?: string | null;
|
|
134
|
+
[key: string]: unknown;
|
|
135
|
+
}
|
|
136
|
+
/** A Computer agent session. */
|
|
137
|
+
export interface ComputerSession {
|
|
138
|
+
id: string;
|
|
139
|
+
task: string;
|
|
140
|
+
status?: string;
|
|
141
|
+
harness?: string | null;
|
|
142
|
+
model?: string | null;
|
|
143
|
+
final_reply?: string;
|
|
144
|
+
stream_text?: string | null;
|
|
145
|
+
error?: string | null;
|
|
146
|
+
handoff?: unknown;
|
|
147
|
+
latest_screen?: ComputerScreen | null;
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
/** Body of `POST /api/computer/sessions`. */
|
|
151
|
+
export interface ComputerTask {
|
|
152
|
+
task: string;
|
|
153
|
+
bot_id?: string;
|
|
154
|
+
harness?: string;
|
|
155
|
+
model?: string;
|
|
156
|
+
parent_session_id?: string;
|
|
157
|
+
attachments?: string[];
|
|
158
|
+
}
|
|
159
|
+
/** `POST /api/computer/act`. */
|
|
160
|
+
export interface ComputerActResult {
|
|
161
|
+
ok: boolean;
|
|
162
|
+
result: string;
|
|
163
|
+
screen?: ComputerScreen;
|
|
164
|
+
}
|
|
104
165
|
/**
|
|
105
166
|
* HTTP client for one Taskmaster daemon.
|
|
106
167
|
* A token set here is sent on every request.
|
|
@@ -125,6 +186,34 @@ export declare class Taskmaster {
|
|
|
125
186
|
label?: string;
|
|
126
187
|
kind?: string;
|
|
127
188
|
}): Promise<string>;
|
|
189
|
+
/** `GET /api/computer/status`. */
|
|
190
|
+
computerStatus(): Promise<ComputerStatus>;
|
|
191
|
+
/** `POST /api/computer/toggle`. Turns Local computer use on or off. */
|
|
192
|
+
computerEnable(enabled: boolean): Promise<ComputerStatus>;
|
|
193
|
+
/** `POST /api/computer/mode`. `mode` is `host` or `virtual`. */
|
|
194
|
+
computerMode(mode: "host" | "virtual"): Promise<ComputerStatus>;
|
|
195
|
+
/** `GET /api/computer/sessions`. */
|
|
196
|
+
computerSessions(): Promise<ComputerSessionSummary[]>;
|
|
197
|
+
/** `POST /api/computer/sessions`. Starts the Computer agent. */
|
|
198
|
+
computerStart(task: ComputerTask | string): Promise<ComputerSession>;
|
|
199
|
+
/** `GET /api/computer/sessions/{id}`. */
|
|
200
|
+
computerSession(id: string): Promise<ComputerSession>;
|
|
201
|
+
/** `POST /api/computer/sessions/{id}/resume`. `note` is the next instruction. */
|
|
202
|
+
computerResume(id: string, note?: string): Promise<ComputerSession>;
|
|
203
|
+
/** `POST /api/computer/sessions/{id}/cancel`. Stops the agent. */
|
|
204
|
+
computerCancel(id: string): Promise<unknown>;
|
|
205
|
+
/** `POST /api/computer/screen`. */
|
|
206
|
+
computerScreen(): Promise<ComputerScreen>;
|
|
207
|
+
/**
|
|
208
|
+
* `POST /api/computer/act`.
|
|
209
|
+
* `action` is `click`, `click_text`, `type`, `press`, `open_url`, `open_app`, and the other names the daemon accepts.
|
|
210
|
+
* Coordinates are a 0–1000 grid.
|
|
211
|
+
*/
|
|
212
|
+
computerAct(action: string, args?: Record<string, unknown>): Promise<ComputerActResult>;
|
|
213
|
+
/** `GET /api/computer/routines`. */
|
|
214
|
+
computerRoutines(): Promise<unknown>;
|
|
215
|
+
/** `POST /api/computer/routines/{id}/run`. */
|
|
216
|
+
computerRunRoutine(id: string): Promise<unknown>;
|
|
128
217
|
/** `GET /api/runs`. */
|
|
129
218
|
runs(): Promise<RunList>;
|
|
130
219
|
/** `GET /api/runs?since=`. `since` is a previous {@link RunList.seq}. */
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/** Daemon address when `tm serve` is started with no bind flag. */
|
|
8
8
|
export const DEFAULT_BASE_URL = "http://127.0.0.1:8737";
|
|
9
9
|
/** Package version. Independent of the Taskmaster app version. */
|
|
10
|
-
export const VERSION = "0.
|
|
10
|
+
export const VERSION = "0.2.0";
|
|
11
11
|
/** The daemon refused the request, or the response was not usable JSON. `status` is `0` when no HTTP response arrived. */
|
|
12
12
|
export class TaskmasterError extends Error {
|
|
13
13
|
status;
|
|
@@ -67,6 +67,61 @@ export class Taskmaster {
|
|
|
67
67
|
}
|
|
68
68
|
return parsed.token;
|
|
69
69
|
}
|
|
70
|
+
/** `GET /api/computer/status`. */
|
|
71
|
+
computerStatus() {
|
|
72
|
+
return this.call("GET", "/api/computer/status");
|
|
73
|
+
}
|
|
74
|
+
/** `POST /api/computer/toggle`. Turns Local computer use on or off. */
|
|
75
|
+
computerEnable(enabled) {
|
|
76
|
+
return this.call("POST", "/api/computer/toggle", { enabled });
|
|
77
|
+
}
|
|
78
|
+
/** `POST /api/computer/mode`. `mode` is `host` or `virtual`. */
|
|
79
|
+
computerMode(mode) {
|
|
80
|
+
return this.call("POST", "/api/computer/mode", { mode });
|
|
81
|
+
}
|
|
82
|
+
/** `GET /api/computer/sessions`. */
|
|
83
|
+
async computerSessions() {
|
|
84
|
+
const listed = (await this.call("GET", "/api/computer/sessions"));
|
|
85
|
+
return listed.sessions ?? [];
|
|
86
|
+
}
|
|
87
|
+
/** `POST /api/computer/sessions`. Starts the Computer agent. */
|
|
88
|
+
computerStart(task) {
|
|
89
|
+
const body = typeof task === "string" ? { task } : task;
|
|
90
|
+
return this.call("POST", "/api/computer/sessions", body);
|
|
91
|
+
}
|
|
92
|
+
/** `GET /api/computer/sessions/{id}`. */
|
|
93
|
+
computerSession(id) {
|
|
94
|
+
return this.call("GET", `/api/computer/sessions/${encodeURIComponent(id)}`);
|
|
95
|
+
}
|
|
96
|
+
/** `POST /api/computer/sessions/{id}/resume`. `note` is the next instruction. */
|
|
97
|
+
computerResume(id, note) {
|
|
98
|
+
const body = note ? { note } : {};
|
|
99
|
+
return this.call("POST", `/api/computer/sessions/${encodeURIComponent(id)}/resume`, body);
|
|
100
|
+
}
|
|
101
|
+
/** `POST /api/computer/sessions/{id}/cancel`. Stops the agent. */
|
|
102
|
+
computerCancel(id) {
|
|
103
|
+
return this.call("POST", `/api/computer/sessions/${encodeURIComponent(id)}/cancel`, {});
|
|
104
|
+
}
|
|
105
|
+
/** `POST /api/computer/screen`. */
|
|
106
|
+
computerScreen() {
|
|
107
|
+
return this.call("POST", "/api/computer/screen", {});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `POST /api/computer/act`.
|
|
111
|
+
* `action` is `click`, `click_text`, `type`, `press`, `open_url`, `open_app`, and the other names the daemon accepts.
|
|
112
|
+
* Coordinates are a 0–1000 grid.
|
|
113
|
+
*/
|
|
114
|
+
computerAct(action, args = {}) {
|
|
115
|
+
return this.call("POST", "/api/computer/act", { ...args, action });
|
|
116
|
+
}
|
|
117
|
+
/** `GET /api/computer/routines`. */
|
|
118
|
+
computerRoutines() {
|
|
119
|
+
return this.call("GET", "/api/computer/routines");
|
|
120
|
+
}
|
|
121
|
+
/** `POST /api/computer/routines/{id}/run`. */
|
|
122
|
+
computerRunRoutine(id) {
|
|
123
|
+
return this.call("POST", `/api/computer/routines/${encodeURIComponent(id)}/run`, {});
|
|
124
|
+
}
|
|
70
125
|
/** `GET /api/runs`. */
|
|
71
126
|
runs() {
|
|
72
127
|
return this.call("GET", "/api/runs");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskmaster-api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Client for the Taskmaster
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Client for the Taskmaster Computer agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|