taskmaster-api 0.1.0__py3-none-any.whl → 0.3.0__py3-none-any.whl
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.
- taskmaster_api/client.py +199 -1
- taskmaster_api-0.3.0.dist-info/METADATA +57 -0
- taskmaster_api-0.3.0.dist-info/RECORD +8 -0
- taskmaster_api-0.1.0.dist-info/METADATA +0 -44
- taskmaster_api-0.1.0.dist-info/RECORD +0 -8
- {taskmaster_api-0.1.0.dist-info → taskmaster_api-0.3.0.dist-info}/WHEEL +0 -0
- {taskmaster_api-0.1.0.dist-info → taskmaster_api-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {taskmaster_api-0.1.0.dist-info → taskmaster_api-0.3.0.dist-info}/top_level.txt +0 -0
taskmaster_api/client.py
CHANGED
|
@@ -12,7 +12,7 @@ import urllib.request
|
|
|
12
12
|
from typing import Any, Mapping, Optional
|
|
13
13
|
|
|
14
14
|
DEFAULT_BASE_URL = "http://127.0.0.1:8737"
|
|
15
|
-
VERSION = "0.
|
|
15
|
+
VERSION = "0.3.0"
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class TaskmasterError(Exception):
|
|
@@ -65,6 +65,197 @@ class Taskmaster:
|
|
|
65
65
|
raise TaskmasterError(0, "pair response had no token")
|
|
66
66
|
return token
|
|
67
67
|
|
|
68
|
+
def computer_status(self) -> dict[str, Any]:
|
|
69
|
+
"""``GET /api/computer/status``."""
|
|
70
|
+
return self._object(self.call("GET", "/api/computer/status"))
|
|
71
|
+
|
|
72
|
+
def computer_enable(self, enabled: bool) -> dict[str, Any]:
|
|
73
|
+
"""``POST /api/computer/toggle``. Turns Local computer use on or off."""
|
|
74
|
+
return self._object(self.call("POST", "/api/computer/toggle", {"enabled": enabled}))
|
|
75
|
+
|
|
76
|
+
def computer_mode(self, mode: str) -> dict[str, Any]:
|
|
77
|
+
"""``POST /api/computer/mode``. ``mode`` is ``host`` or ``virtual``."""
|
|
78
|
+
return self._object(self.call("POST", "/api/computer/mode", {"mode": mode}))
|
|
79
|
+
|
|
80
|
+
def computer_sessions(self) -> list[Any]:
|
|
81
|
+
"""``GET /api/computer/sessions``."""
|
|
82
|
+
listed = self._object(self.call("GET", "/api/computer/sessions"))
|
|
83
|
+
sessions = listed.get("sessions")
|
|
84
|
+
if not isinstance(sessions, list):
|
|
85
|
+
raise TaskmasterError(0, "sessions response had no list")
|
|
86
|
+
return sessions
|
|
87
|
+
|
|
88
|
+
def computer_start(
|
|
89
|
+
self,
|
|
90
|
+
task: str,
|
|
91
|
+
*,
|
|
92
|
+
bot_id: Optional[str] = None,
|
|
93
|
+
harness: Optional[str] = None,
|
|
94
|
+
model: Optional[str] = None,
|
|
95
|
+
parent_session_id: Optional[str] = None,
|
|
96
|
+
attachments: Optional[list[str]] = None,
|
|
97
|
+
) -> dict[str, Any]:
|
|
98
|
+
"""``POST /api/computer/sessions``. Starts the Computer agent on ``task``."""
|
|
99
|
+
body: dict[str, Any] = {"task": task}
|
|
100
|
+
if bot_id is not None:
|
|
101
|
+
body["bot_id"] = bot_id
|
|
102
|
+
if harness is not None:
|
|
103
|
+
body["harness"] = harness
|
|
104
|
+
if model is not None:
|
|
105
|
+
body["model"] = model
|
|
106
|
+
if parent_session_id is not None:
|
|
107
|
+
body["parent_session_id"] = parent_session_id
|
|
108
|
+
if attachments:
|
|
109
|
+
body["attachments"] = attachments
|
|
110
|
+
return self._object(self.call("POST", "/api/computer/sessions", body))
|
|
111
|
+
|
|
112
|
+
def computer_session(self, session_id: str) -> dict[str, Any]:
|
|
113
|
+
"""``GET /api/computer/sessions/{id}``."""
|
|
114
|
+
return self._object(self.call("GET", f"/api/computer/sessions/{_segment(session_id)}"))
|
|
115
|
+
|
|
116
|
+
def computer_resume(self, session_id: str, note: Optional[str] = None) -> dict[str, Any]:
|
|
117
|
+
"""``POST /api/computer/sessions/{id}/resume``. ``note`` is the next instruction."""
|
|
118
|
+
body: dict[str, Any] = {"note": note} if note else {}
|
|
119
|
+
return self._object(self.call("POST", f"/api/computer/sessions/{_segment(session_id)}/resume", body))
|
|
120
|
+
|
|
121
|
+
def computer_cancel(self, session_id: str) -> Any:
|
|
122
|
+
"""``POST /api/computer/sessions/{id}/cancel``. Stops the agent."""
|
|
123
|
+
return self.call("POST", f"/api/computer/sessions/{_segment(session_id)}/cancel", {})
|
|
124
|
+
|
|
125
|
+
def computer_screen(self) -> dict[str, Any]:
|
|
126
|
+
"""``POST /api/computer/screen``. ``data`` is base64 PNG bytes."""
|
|
127
|
+
return self._object(self.call("POST", "/api/computer/screen", {}))
|
|
128
|
+
|
|
129
|
+
def computer_act(self, action: str, **args: Any) -> dict[str, Any]:
|
|
130
|
+
"""``POST /api/computer/act``.
|
|
131
|
+
|
|
132
|
+
``action`` is ``click``, ``click_text``, ``type``, ``press``, ``open_url``,
|
|
133
|
+
``open_app``, and the other names the daemon accepts. Coordinates are a
|
|
134
|
+
0–1000 grid.
|
|
135
|
+
"""
|
|
136
|
+
return self._object(self.call("POST", "/api/computer/act", {"action": action, **args}))
|
|
137
|
+
|
|
138
|
+
def computer_routines(self) -> Any:
|
|
139
|
+
"""``GET /api/computer/routines``."""
|
|
140
|
+
return self.call("GET", "/api/computer/routines")
|
|
141
|
+
|
|
142
|
+
def computer_run_routine(self, routine_id: str) -> Any:
|
|
143
|
+
"""``POST /api/computer/routines/{id}/run``."""
|
|
144
|
+
return self.call("POST", f"/api/computer/routines/{_segment(routine_id)}/run", {})
|
|
145
|
+
|
|
146
|
+
def builtin_mcp_url(self) -> str:
|
|
147
|
+
"""URL of the daemon's own MCP endpoint.
|
|
148
|
+
|
|
149
|
+
Agents already get this server. It carries the dictionary, Computer,
|
|
150
|
+
and the document tools. ``connect_mcp`` adds another server.
|
|
151
|
+
"""
|
|
152
|
+
return f"{self.base_url}/mcp"
|
|
153
|
+
|
|
154
|
+
def mcp_servers(self) -> list[Any]:
|
|
155
|
+
"""``GET /api/mcp``. User MCP servers saved for this project."""
|
|
156
|
+
listed = self._object(self.call("GET", "/api/mcp"))
|
|
157
|
+
servers = listed.get("servers")
|
|
158
|
+
if not isinstance(servers, list):
|
|
159
|
+
raise TaskmasterError(0, "mcp response had no list")
|
|
160
|
+
return servers
|
|
161
|
+
|
|
162
|
+
def connect_mcp(
|
|
163
|
+
self,
|
|
164
|
+
name: str,
|
|
165
|
+
command: str,
|
|
166
|
+
*,
|
|
167
|
+
args: Optional[list[str]] = None,
|
|
168
|
+
env: Optional[Mapping[str, str]] = None,
|
|
169
|
+
secret_env: Optional[Mapping[str, str]] = None,
|
|
170
|
+
roles: Optional[list[str]] = None,
|
|
171
|
+
enabled: Optional[bool] = None,
|
|
172
|
+
require_approval: Optional[bool] = None,
|
|
173
|
+
) -> dict[str, Any]:
|
|
174
|
+
"""``POST /api/mcp``. Adds or replaces a user MCP server.
|
|
175
|
+
|
|
176
|
+
``secret_env`` values go to the OS keychain. The daemon does not echo them.
|
|
177
|
+
"""
|
|
178
|
+
body: dict[str, Any] = {"name": name, "command": command}
|
|
179
|
+
if args:
|
|
180
|
+
body["args"] = args
|
|
181
|
+
if env:
|
|
182
|
+
body["env"] = dict(env)
|
|
183
|
+
if secret_env:
|
|
184
|
+
body["secret_env"] = dict(secret_env)
|
|
185
|
+
if roles:
|
|
186
|
+
body["roles"] = roles
|
|
187
|
+
if enabled is not None:
|
|
188
|
+
body["enabled"] = enabled
|
|
189
|
+
if require_approval is not None:
|
|
190
|
+
body["require_approval"] = require_approval
|
|
191
|
+
saved = self._object(self.call("POST", "/api/mcp", body))
|
|
192
|
+
server = saved.get("server")
|
|
193
|
+
if not isinstance(server, dict):
|
|
194
|
+
raise TaskmasterError(0, "mcp response had no server")
|
|
195
|
+
return server
|
|
196
|
+
|
|
197
|
+
def disconnect_mcp(self, name: str) -> Any:
|
|
198
|
+
"""``POST /api/mcp/{name}/remove``."""
|
|
199
|
+
return self.call("POST", f"/api/mcp/{_segment(name)}/remove", {})
|
|
200
|
+
|
|
201
|
+
def docs(self) -> list[Any]:
|
|
202
|
+
"""``GET /api/computer/docs``."""
|
|
203
|
+
listed = self._object(self.call("GET", "/api/computer/docs"))
|
|
204
|
+
docs = listed.get("docs")
|
|
205
|
+
if not isinstance(docs, list):
|
|
206
|
+
raise TaskmasterError(0, "docs response had no list")
|
|
207
|
+
return docs
|
|
208
|
+
|
|
209
|
+
def doc(self, doc_id: str) -> dict[str, Any]:
|
|
210
|
+
"""``GET /api/computer/docs/{id}``."""
|
|
211
|
+
return self._object(self.call("GET", f"/api/computer/docs/{_segment(doc_id)}"))
|
|
212
|
+
|
|
213
|
+
def upload_doc(self, name: str, data_base64: str) -> dict[str, Any]:
|
|
214
|
+
"""``POST /api/computer/files``. ``data_base64`` is the file bytes."""
|
|
215
|
+
return self._object(self.call("POST", "/api/computer/files", {"name": name, "data_base64": data_base64}))
|
|
216
|
+
|
|
217
|
+
def open_doc(self, doc_id: str) -> Any:
|
|
218
|
+
"""``POST /api/computer/docs/{id}/open``. Opens the file in the host's default app."""
|
|
219
|
+
return self.call("POST", f"/api/computer/docs/{_segment(doc_id)}/open", {})
|
|
220
|
+
|
|
221
|
+
def make_pptx(self, title: str, brief: Optional[str] = None) -> dict[str, Any]:
|
|
222
|
+
"""Start a Computer session that builds a PowerPoint with ``doc_create_pptx``."""
|
|
223
|
+
return self.computer_start(_document_task("PowerPoint", "doc_create_pptx", title, brief))
|
|
224
|
+
|
|
225
|
+
def make_docx(self, title: str, brief: Optional[str] = None) -> dict[str, Any]:
|
|
226
|
+
"""Start a Computer session that builds a Word document with ``doc_create_docx``."""
|
|
227
|
+
return self.computer_start(_document_task("Word document", "doc_create_docx", title, brief))
|
|
228
|
+
|
|
229
|
+
def setup(self) -> dict[str, Any]:
|
|
230
|
+
"""``GET /api/setup``. Each provider's install and sign-in state, plus runtimes and jobs."""
|
|
231
|
+
return self._object(self.call("GET", "/api/setup"))
|
|
232
|
+
|
|
233
|
+
def connect_provider(self, provider_id: str, api_key: Optional[str] = None) -> Any:
|
|
234
|
+
"""Connect a provider in one call.
|
|
235
|
+
|
|
236
|
+
An ``api_key`` is saved for a provider that uses one (``openrouter``).
|
|
237
|
+
Otherwise this installs the CLI when it is missing, or starts its sign-in
|
|
238
|
+
when it is already installed. A provider that is installed and signed in
|
|
239
|
+
returns ``{"ok": true, "connected": true}``.
|
|
240
|
+
"""
|
|
241
|
+
segment = _segment(provider_id)
|
|
242
|
+
if api_key is not None:
|
|
243
|
+
return self.call("POST", f"/api/setup/providers/{segment}/key", {"api_key": api_key})
|
|
244
|
+
setup = self.setup()
|
|
245
|
+
providers = setup.get("providers")
|
|
246
|
+
match = None
|
|
247
|
+
if isinstance(providers, list):
|
|
248
|
+
for item in providers:
|
|
249
|
+
if isinstance(item, dict) and item.get("id") == provider_id:
|
|
250
|
+
match = item
|
|
251
|
+
break
|
|
252
|
+
installed = bool(match and match.get("installed") is True)
|
|
253
|
+
signed_in = bool(match and match.get("signed_in") is True)
|
|
254
|
+
if installed and signed_in:
|
|
255
|
+
return {"ok": True, "connected": True, "id": provider_id}
|
|
256
|
+
action = "login" if installed else "install"
|
|
257
|
+
return self.call("POST", f"/api/setup/providers/{segment}/{action}", {})
|
|
258
|
+
|
|
68
259
|
def runs(self) -> dict[str, Any]:
|
|
69
260
|
"""``GET /api/runs``. The body is ``{"runs": [...], "seq": n}``."""
|
|
70
261
|
return self._object(self.call("GET", "/api/runs"))
|
|
@@ -209,6 +400,13 @@ class Taskmaster:
|
|
|
209
400
|
return value
|
|
210
401
|
|
|
211
402
|
|
|
403
|
+
def _document_task(kind: str, tool: str, title: str, brief: Optional[str]) -> str:
|
|
404
|
+
task = f"Make a {kind} with {tool}. Title: {title}. Use one cohesive theme on every page."
|
|
405
|
+
if brief:
|
|
406
|
+
task = f"{task} {brief}"
|
|
407
|
+
return task
|
|
408
|
+
|
|
409
|
+
|
|
212
410
|
def _segment(run_id: str) -> str:
|
|
213
411
|
from urllib.parse import quote
|
|
214
412
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: taskmaster-api
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Client for the Taskmaster Computer agent
|
|
5
|
+
Author: Naren Sengodan
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/narensen/taskmaster-api
|
|
8
|
+
Project-URL: Repository, https://github.com/narensen/taskmaster-api
|
|
9
|
+
Keywords: taskmaster,api,client,daemon
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# taskmaster-api
|
|
19
|
+
|
|
20
|
+
Client for the [Taskmaster](https://github.com/narensen/Taskmaster) Computer agent running on your machine.
|
|
21
|
+
|
|
22
|
+
`tm serve .` listens on `http://127.0.0.1:8737`. Pair first. Computer stays off until `computer_enable(True)`.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from taskmaster_api import Taskmaster
|
|
26
|
+
|
|
27
|
+
tm = Taskmaster()
|
|
28
|
+
tm.set_token(tm.pair("ABCD", label="laptop", kind="agent"))
|
|
29
|
+
tm.computer_enable(True)
|
|
30
|
+
|
|
31
|
+
session = tm.computer_start("Open Chrome and search for the weather")
|
|
32
|
+
tm.computer_resume(session["id"], "Read the first forecast")
|
|
33
|
+
tm.computer_cancel(session["id"])
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`computer_act` sends one action on the 0–1000 screen grid. `computer_mode("virtual")` aims the agent at the isolated desktop.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
acted = tm.computer_act("open_url", url="https://example.com", capture_after=True)
|
|
40
|
+
print(acted["result"])
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Connect a provider, save an MCP server, or start a deck. `builtin_mcp_url()` is the daemon's own `/mcp`, which already has Computer and the document tools.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
tm.connect_provider("grok")
|
|
47
|
+
tm.connect_provider("openrouter", api_key="sk-...")
|
|
48
|
+
tm.connect_mcp("linear", "npx", args=["-y", "mcp-remote"], secret_env={"LINEAR_API_KEY": "..."})
|
|
49
|
+
session = tm.make_pptx("Q4 plan", "Three slides: goal, plan, ask")
|
|
50
|
+
print(tm.docs())
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
|
|
54
|
+
|
|
55
|
+
The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
|
|
56
|
+
|
|
57
|
+
MIT © 2026 Naren Sengodan
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
taskmaster_api/__init__.py,sha256=hBTAlTQhG9qByXoDJILAlfmJeNdMoWrwG2fsXuvEM1M,236
|
|
2
|
+
taskmaster_api/client.py,sha256=o3fZNIERYGQR71MQmVzgsiI-6bGOMq-wg4Ej2MlVuj4,17680
|
|
3
|
+
taskmaster_api/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
taskmaster_api-0.3.0.dist-info/licenses/LICENSE,sha256=dMTuPSKtnP69xjRoU09WxOfzuCXMfZ_e8GPCjZEY830,1071
|
|
5
|
+
taskmaster_api-0.3.0.dist-info/METADATA,sha256=oyOfLgJA-05F80b-BtxbQqwQDkS8XpuJFn4a4cr_OUw,2100
|
|
6
|
+
taskmaster_api-0.3.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
+
taskmaster_api-0.3.0.dist-info/top_level.txt,sha256=bN4d_q-hbPNkU7dCogKdyXzJg8JZyhtdlAnmcsH_RE4,15
|
|
8
|
+
taskmaster_api-0.3.0.dist-info/RECORD,,
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: taskmaster-api
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Client for the Taskmaster local daemon HTTP API
|
|
5
|
-
Author: Naren Sengodan
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/narensen/taskmaster-api
|
|
8
|
-
Project-URL: Repository, https://github.com/narensen/taskmaster-api
|
|
9
|
-
Keywords: taskmaster,api,client,daemon
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Typing :: Typed
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Dynamic: license-file
|
|
17
|
-
|
|
18
|
-
# taskmaster-api
|
|
19
|
-
|
|
20
|
-
Client for a [Taskmaster](https://github.com/narensen/Taskmaster) daemon running on your machine.
|
|
21
|
-
|
|
22
|
-
`tm serve .` listens on `http://127.0.0.1:8737`. `GET /api/health` and `POST /api/pair` need no token. Every other `/api` route needs `Authorization: Bearer <token>`.
|
|
23
|
-
|
|
24
|
-
```python
|
|
25
|
-
from taskmaster_api import Taskmaster
|
|
26
|
-
|
|
27
|
-
tm = Taskmaster()
|
|
28
|
-
tm.set_token(tm.pair("ABCD", label="laptop", kind="agent"))
|
|
29
|
-
|
|
30
|
-
accepted = tm.start("Add a command palette", yes=True)
|
|
31
|
-
page = tm.events(accepted["id"])
|
|
32
|
-
print(page["next"])
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
`0.1.0` covers health, pairing, projects, providers, doctor, and the run lifecycle: list, get, start, approve, reject, resume, cancel, undo, and events. `call(method, path, body)` sends any other route and returns the JSON value.
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
doctor = tm.doctor()
|
|
39
|
-
dictionary = tm.call("GET", "/api/dictionary?q=button")
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
The standard library is the only dependency. The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
|
|
43
|
-
|
|
44
|
-
MIT © 2026 Naren Sengodan
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
taskmaster_api/__init__.py,sha256=hBTAlTQhG9qByXoDJILAlfmJeNdMoWrwG2fsXuvEM1M,236
|
|
2
|
-
taskmaster_api/client.py,sha256=42WuW9Izgl1RJXTp2-l6KmFPJP_rSt0rnpmhNmrpyqo,8745
|
|
3
|
-
taskmaster_api/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
-
taskmaster_api-0.1.0.dist-info/licenses/LICENSE,sha256=dMTuPSKtnP69xjRoU09WxOfzuCXMfZ_e8GPCjZEY830,1071
|
|
5
|
-
taskmaster_api-0.1.0.dist-info/METADATA,sha256=l2Aq4XN3opc8uCjCJNZVZsXH_JL77Tf4Ia_x7aasJxA,1602
|
|
6
|
-
taskmaster_api-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
-
taskmaster_api-0.1.0.dist-info/top_level.txt,sha256=bN4d_q-hbPNkU7dCogKdyXzJg8JZyhtdlAnmcsH_RE4,15
|
|
8
|
-
taskmaster_api-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|