taskmaster-api 0.1.0__tar.gz → 0.2.0__tar.gz

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.
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: taskmaster-api
3
+ Version: 0.2.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
+ The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
44
+
45
+ The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
46
+
47
+ MIT © 2026 Naren Sengodan
@@ -0,0 +1,30 @@
1
+ # taskmaster-api
2
+
3
+ Client for the [Taskmaster](https://github.com/narensen/Taskmaster) Computer agent running on your machine.
4
+
5
+ `tm serve .` listens on `http://127.0.0.1:8737`. Pair first. Computer stays off until `computer_enable(True)`.
6
+
7
+ ```python
8
+ from taskmaster_api import Taskmaster
9
+
10
+ tm = Taskmaster()
11
+ tm.set_token(tm.pair("ABCD", label="laptop", kind="agent"))
12
+ tm.computer_enable(True)
13
+
14
+ session = tm.computer_start("Open Chrome and search for the weather")
15
+ tm.computer_resume(session["id"], "Read the first forecast")
16
+ tm.computer_cancel(session["id"])
17
+ ```
18
+
19
+ `computer_act` sends one action on the 0–1000 screen grid. `computer_mode("virtual")` aims the agent at the isolated desktop.
20
+
21
+ ```python
22
+ acted = tm.computer_act("open_url", url="https://example.com", capture_after=True)
23
+ print(acted["result"])
24
+ ```
25
+
26
+ The standard library is the only dependency. 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 JavaScript (`npm install taskmaster-api`).
29
+
30
+ MIT © 2026 Naren Sengodan
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "taskmaster-api"
7
- version = "0.1.0"
8
- description = "Client for the Taskmaster local daemon HTTP API"
7
+ version = "0.2.0"
8
+ description = "Client for the Taskmaster Computer agent"
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  requires-python = ">=3.9"
@@ -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.1.0"
15
+ VERSION = "0.2.0"
16
16
 
17
17
 
18
18
  class TaskmasterError(Exception):
@@ -65,6 +65,84 @@ 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
+
68
146
  def runs(self) -> dict[str, Any]:
69
147
  """``GET /api/runs``. The body is ``{"runs": [...], "seq": n}``."""
70
148
  return self._object(self.call("GET", "/api/runs"))
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: taskmaster-api
3
+ Version: 0.2.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
+ The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
44
+
45
+ The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
46
+
47
+ MIT © 2026 Naren Sengodan
@@ -32,7 +32,7 @@ class Handler(BaseHTTPRequestHandler):
32
32
  else:
33
33
  self._send(401, {"error": "that code was refused"})
34
34
  return
35
- if not authed and (path.startswith("/api/runs") or path == "/api/doctor"):
35
+ if not authed and (path.startswith("/api/runs") or path == "/api/doctor" or path.startswith("/api/computer")):
36
36
  self._send(401, {"error": "a token is required"})
37
37
  return
38
38
  if method == "GET" and path == "/api/runs":
@@ -53,6 +53,30 @@ class Handler(BaseHTTPRequestHandler):
53
53
  if method == "GET" and path == "/api/doctor":
54
54
  self._send(200, {"ok": True})
55
55
  return
56
+ if method == "GET" and path == "/api/computer/status":
57
+ self._send(200, {"enabled": False, "mode": "host", "install_hint": "turn it on"})
58
+ return
59
+ if method == "POST" and path == "/api/computer/toggle" and '"enabled": true' in body:
60
+ self._send(200, {"enabled": True, "mode": "host"})
61
+ return
62
+ if method == "POST" and path == "/api/computer/sessions" and "weather" in body:
63
+ self._send(200, {"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "running", "harness": "grok", "final_reply": ""})
64
+ return
65
+ if method == "GET" and path == "/api/computer/sessions":
66
+ self._send(200, {"sessions": [{"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "running", "step_count": 1, "agent_count": 1}]})
67
+ return
68
+ if method == "GET" and path == "/api/computer/sessions/cs-1":
69
+ self._send(200, {"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "done", "final_reply": "It is 72 F.", "latest_screen": None})
70
+ return
71
+ if method == "POST" and path == "/api/computer/sessions/cs-1/resume" and "forecast" in body:
72
+ self._send(200, {"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "running", "final_reply": ""})
73
+ return
74
+ if method == "POST" and path == "/api/computer/sessions/cs-1/cancel":
75
+ self._send(200, {"ok": True})
76
+ return
77
+ if method == "POST" and path == "/api/computer/act" and "click_text" in body and "Search" in body:
78
+ self._send(200, {"ok": True, "result": "clicked Search"})
79
+ return
56
80
  self._send(404, {"error": "no such route"})
57
81
 
58
82
  def _send(self, status: int, payload: object) -> None:
@@ -101,6 +125,21 @@ class ClientTest(unittest.TestCase):
101
125
  self.assertEqual(len(page["events"]), 1)
102
126
  self.assertEqual(tm.doctor(), {"ok": True})
103
127
 
128
+ status = tm.computer_status()
129
+ self.assertFalse(status["enabled"])
130
+ self.assertEqual(status["mode"], "host")
131
+ self.assertTrue(tm.computer_enable(True)["enabled"])
132
+ started = tm.computer_start("Open Chrome and search for the weather")
133
+ self.assertEqual(started["id"], "cs-1")
134
+ self.assertEqual(started["status"], "running")
135
+ self.assertEqual(tm.computer_sessions()[0]["step_count"], 1)
136
+ self.assertEqual(tm.computer_session("cs-1")["final_reply"], "It is 72 F.")
137
+ self.assertEqual(tm.computer_resume("cs-1", "Read the forecast")["status"], "running")
138
+ self.assertEqual(tm.computer_cancel("cs-1"), {"ok": True})
139
+ acted = tm.computer_act("click_text", text="Search")
140
+ self.assertTrue(acted["ok"])
141
+ self.assertEqual(acted["result"], "clicked Search")
142
+
104
143
  tm.clear_token()
105
144
  with self.assertRaises(TaskmasterError) as missing:
106
145
  tm.runs()
@@ -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,27 +0,0 @@
1
- # taskmaster-api
2
-
3
- Client for a [Taskmaster](https://github.com/narensen/Taskmaster) daemon running on your machine.
4
-
5
- `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>`.
6
-
7
- ```python
8
- from taskmaster_api import Taskmaster
9
-
10
- tm = Taskmaster()
11
- tm.set_token(tm.pair("ABCD", label="laptop", kind="agent"))
12
-
13
- accepted = tm.start("Add a command palette", yes=True)
14
- page = tm.events(accepted["id"])
15
- print(page["next"])
16
- ```
17
-
18
- `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.
19
-
20
- ```python
21
- doctor = tm.doctor()
22
- dictionary = tm.call("GET", "/api/dictionary?q=button")
23
- ```
24
-
25
- The standard library is the only dependency. The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
26
-
27
- MIT © 2026 Naren Sengodan
@@ -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
File without changes
File without changes