taskmaster-api 0.2.0__tar.gz → 0.3.1__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.
- {taskmaster_api-0.2.0/src/taskmaster_api.egg-info → taskmaster_api-0.3.1}/PKG-INFO +12 -1
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/README.md +11 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/pyproject.toml +1 -1
- taskmaster_api-0.3.1/src/taskmaster_api/__init__.py +6 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api/client.py +153 -1
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1/src/taskmaster_api.egg-info}/PKG-INFO +12 -1
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/tests/test_client.py +108 -2
- taskmaster_api-0.2.0/src/taskmaster_api/__init__.py +0 -6
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/LICENSE +0 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/setup.cfg +0 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api/py.typed +0 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api.egg-info/SOURCES.txt +0 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api.egg-info/dependency_links.txt +0 -0
- {taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taskmaster-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Client for the Taskmaster Computer agent
|
|
5
5
|
Author: Naren Sengodan
|
|
6
6
|
License-Expression: MIT
|
|
@@ -40,6 +40,17 @@ acted = tm.computer_act("open_url", url="https://example.com", capture_after=Tru
|
|
|
40
40
|
print(acted["result"])
|
|
41
41
|
```
|
|
42
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
|
+
for provider in ("claude", "agy", "grok", "codex", "opencode"):
|
|
47
|
+
tm.connect_provider(provider)
|
|
48
|
+
tm.connect_provider("openrouter", api_key="sk-...")
|
|
49
|
+
tm.connect_mcp("linear", "npx", args=["-y", "mcp-remote"], secret_env={"LINEAR_API_KEY": "..."})
|
|
50
|
+
session = tm.make_pptx("Q4 plan", "Three slides: goal, plan, ask")
|
|
51
|
+
print(tm.docs())
|
|
52
|
+
```
|
|
53
|
+
|
|
43
54
|
The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
|
|
44
55
|
|
|
45
56
|
The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
|
|
@@ -23,6 +23,17 @@ acted = tm.computer_act("open_url", url="https://example.com", capture_after=Tru
|
|
|
23
23
|
print(acted["result"])
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
for provider in ("claude", "agy", "grok", "codex", "opencode"):
|
|
30
|
+
tm.connect_provider(provider)
|
|
31
|
+
tm.connect_provider("openrouter", api_key="sk-...")
|
|
32
|
+
tm.connect_mcp("linear", "npx", args=["-y", "mcp-remote"], secret_env={"LINEAR_API_KEY": "..."})
|
|
33
|
+
session = tm.make_pptx("Q4 plan", "Three slides: goal, plan, ask")
|
|
34
|
+
print(tm.docs())
|
|
35
|
+
```
|
|
36
|
+
|
|
26
37
|
The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
|
|
27
38
|
|
|
28
39
|
The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""Client for a Taskmaster daemon running on this machine."""
|
|
2
|
+
|
|
3
|
+
from .client import DEFAULT_BASE_URL, PROVIDER_INFO, PROVIDERS, VERSION, Taskmaster, TaskmasterError
|
|
4
|
+
|
|
5
|
+
__all__ = ["DEFAULT_BASE_URL", "PROVIDER_INFO", "PROVIDERS", "VERSION", "Taskmaster", "TaskmasterError"]
|
|
6
|
+
__version__ = VERSION
|
|
@@ -12,7 +12,19 @@ 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.1"
|
|
16
|
+
|
|
17
|
+
# Provider ids Taskmaster installs and signs in, in the app's order.
|
|
18
|
+
# The five CLIs install and sign in. OpenRouter connects with an API key.
|
|
19
|
+
PROVIDERS = ("claude", "agy", "grok", "codex", "opencode", "openrouter")
|
|
20
|
+
PROVIDER_INFO = (
|
|
21
|
+
{"id": "claude", "name": "Claude Code", "api_key": False},
|
|
22
|
+
{"id": "agy", "name": "Antigravity", "api_key": False},
|
|
23
|
+
{"id": "grok", "name": "Grok Build", "api_key": False},
|
|
24
|
+
{"id": "codex", "name": "Codex", "api_key": False},
|
|
25
|
+
{"id": "opencode", "name": "OpenCode", "api_key": False},
|
|
26
|
+
{"id": "openrouter", "name": "OpenRouter", "api_key": True},
|
|
27
|
+
)
|
|
16
28
|
|
|
17
29
|
|
|
18
30
|
class TaskmasterError(Exception):
|
|
@@ -143,6 +155,122 @@ class Taskmaster:
|
|
|
143
155
|
"""``POST /api/computer/routines/{id}/run``."""
|
|
144
156
|
return self.call("POST", f"/api/computer/routines/{_segment(routine_id)}/run", {})
|
|
145
157
|
|
|
158
|
+
def builtin_mcp_url(self) -> str:
|
|
159
|
+
"""URL of the daemon's own MCP endpoint.
|
|
160
|
+
|
|
161
|
+
Agents already get this server. It carries the dictionary, Computer,
|
|
162
|
+
and the document tools. ``connect_mcp`` adds another server.
|
|
163
|
+
"""
|
|
164
|
+
return f"{self.base_url}/mcp"
|
|
165
|
+
|
|
166
|
+
def mcp_servers(self) -> list[Any]:
|
|
167
|
+
"""``GET /api/mcp``. User MCP servers saved for this project."""
|
|
168
|
+
listed = self._object(self.call("GET", "/api/mcp"))
|
|
169
|
+
servers = listed.get("servers")
|
|
170
|
+
if not isinstance(servers, list):
|
|
171
|
+
raise TaskmasterError(0, "mcp response had no list")
|
|
172
|
+
return servers
|
|
173
|
+
|
|
174
|
+
def connect_mcp(
|
|
175
|
+
self,
|
|
176
|
+
name: str,
|
|
177
|
+
command: str,
|
|
178
|
+
*,
|
|
179
|
+
args: Optional[list[str]] = None,
|
|
180
|
+
env: Optional[Mapping[str, str]] = None,
|
|
181
|
+
secret_env: Optional[Mapping[str, str]] = None,
|
|
182
|
+
roles: Optional[list[str]] = None,
|
|
183
|
+
enabled: Optional[bool] = None,
|
|
184
|
+
require_approval: Optional[bool] = None,
|
|
185
|
+
) -> dict[str, Any]:
|
|
186
|
+
"""``POST /api/mcp``. Adds or replaces a user MCP server.
|
|
187
|
+
|
|
188
|
+
``secret_env`` values go to the OS keychain. The daemon does not echo them.
|
|
189
|
+
"""
|
|
190
|
+
body: dict[str, Any] = {"name": name, "command": command}
|
|
191
|
+
if args:
|
|
192
|
+
body["args"] = args
|
|
193
|
+
if env:
|
|
194
|
+
body["env"] = dict(env)
|
|
195
|
+
if secret_env:
|
|
196
|
+
body["secret_env"] = dict(secret_env)
|
|
197
|
+
if roles:
|
|
198
|
+
body["roles"] = roles
|
|
199
|
+
if enabled is not None:
|
|
200
|
+
body["enabled"] = enabled
|
|
201
|
+
if require_approval is not None:
|
|
202
|
+
body["require_approval"] = require_approval
|
|
203
|
+
saved = self._object(self.call("POST", "/api/mcp", body))
|
|
204
|
+
server = saved.get("server")
|
|
205
|
+
if not isinstance(server, dict):
|
|
206
|
+
raise TaskmasterError(0, "mcp response had no server")
|
|
207
|
+
return server
|
|
208
|
+
|
|
209
|
+
def disconnect_mcp(self, name: str) -> Any:
|
|
210
|
+
"""``POST /api/mcp/{name}/remove``."""
|
|
211
|
+
return self.call("POST", f"/api/mcp/{_segment(name)}/remove", {})
|
|
212
|
+
|
|
213
|
+
def docs(self) -> list[Any]:
|
|
214
|
+
"""``GET /api/computer/docs``."""
|
|
215
|
+
listed = self._object(self.call("GET", "/api/computer/docs"))
|
|
216
|
+
docs = listed.get("docs")
|
|
217
|
+
if not isinstance(docs, list):
|
|
218
|
+
raise TaskmasterError(0, "docs response had no list")
|
|
219
|
+
return docs
|
|
220
|
+
|
|
221
|
+
def doc(self, doc_id: str) -> dict[str, Any]:
|
|
222
|
+
"""``GET /api/computer/docs/{id}``."""
|
|
223
|
+
return self._object(self.call("GET", f"/api/computer/docs/{_segment(doc_id)}"))
|
|
224
|
+
|
|
225
|
+
def upload_doc(self, name: str, data_base64: str) -> dict[str, Any]:
|
|
226
|
+
"""``POST /api/computer/files``. ``data_base64`` is the file bytes."""
|
|
227
|
+
return self._object(self.call("POST", "/api/computer/files", {"name": name, "data_base64": data_base64}))
|
|
228
|
+
|
|
229
|
+
def open_doc(self, doc_id: str) -> Any:
|
|
230
|
+
"""``POST /api/computer/docs/{id}/open``. Opens the file in the host's default app."""
|
|
231
|
+
return self.call("POST", f"/api/computer/docs/{_segment(doc_id)}/open", {})
|
|
232
|
+
|
|
233
|
+
def make_pptx(self, title: str, brief: Optional[str] = None) -> dict[str, Any]:
|
|
234
|
+
"""Start a Computer session that builds a PowerPoint with ``doc_create_pptx``."""
|
|
235
|
+
return self.computer_start(_document_task("PowerPoint", "doc_create_pptx", title, brief))
|
|
236
|
+
|
|
237
|
+
def make_docx(self, title: str, brief: Optional[str] = None) -> dict[str, Any]:
|
|
238
|
+
"""Start a Computer session that builds a Word document with ``doc_create_docx``."""
|
|
239
|
+
return self.computer_start(_document_task("Word document", "doc_create_docx", title, brief))
|
|
240
|
+
|
|
241
|
+
def setup(self) -> dict[str, Any]:
|
|
242
|
+
"""``GET /api/setup``. Each provider's install and sign-in state, plus runtimes and jobs."""
|
|
243
|
+
return self._object(self.call("GET", "/api/setup"))
|
|
244
|
+
|
|
245
|
+
def connect_provider(self, provider_id: str, api_key: Optional[str] = None) -> Any:
|
|
246
|
+
"""Connect any Taskmaster provider in one call.
|
|
247
|
+
|
|
248
|
+
The ids are ``PROVIDERS``: ``claude``, ``agy``, ``grok``, ``codex``,
|
|
249
|
+
``opencode``, and ``openrouter``. Any other id the daemon knows is
|
|
250
|
+
accepted the same way.
|
|
251
|
+
|
|
252
|
+
A CLI is installed when it is missing, or signed in when it is already
|
|
253
|
+
installed. One that is installed and signed in returns
|
|
254
|
+
``{"ok": true, "connected": true}``. ``openrouter``, and any provider
|
|
255
|
+
whose setup row has ``version`` ``api``, saves ``api_key`` instead.
|
|
256
|
+
"""
|
|
257
|
+
segment = _segment(provider_id)
|
|
258
|
+
setup = self.setup()
|
|
259
|
+
match = _setup_provider(setup, provider_id)
|
|
260
|
+
if _provider_uses_api_key(provider_id, match):
|
|
261
|
+
if api_key is not None:
|
|
262
|
+
return self.call("POST", f"/api/setup/providers/{segment}/key", {"api_key": api_key})
|
|
263
|
+
if match is not None and match.get("signed_in") is True:
|
|
264
|
+
return {"ok": True, "connected": True, "id": provider_id}
|
|
265
|
+
raise TaskmasterError(0, f"{provider_id} connects with an API key. Pass the key to connect_provider.")
|
|
266
|
+
if api_key is not None:
|
|
267
|
+
raise TaskmasterError(0, f"{provider_id} signs in through its own CLI. Omit the API key to install or sign in.")
|
|
268
|
+
installed = bool(match and match.get("installed") is True)
|
|
269
|
+
if installed and match is not None and match.get("signed_in") is True:
|
|
270
|
+
return {"ok": True, "connected": True, "id": provider_id}
|
|
271
|
+
action = "login" if installed else "install"
|
|
272
|
+
return self.call("POST", f"/api/setup/providers/{segment}/{action}", {})
|
|
273
|
+
|
|
146
274
|
def runs(self) -> dict[str, Any]:
|
|
147
275
|
"""``GET /api/runs``. The body is ``{"runs": [...], "seq": n}``."""
|
|
148
276
|
return self._object(self.call("GET", "/api/runs"))
|
|
@@ -287,6 +415,30 @@ class Taskmaster:
|
|
|
287
415
|
return value
|
|
288
416
|
|
|
289
417
|
|
|
418
|
+
def _setup_provider(setup: Mapping[str, Any], provider_id: str) -> Optional[dict[str, Any]]:
|
|
419
|
+
providers = setup.get("providers")
|
|
420
|
+
if not isinstance(providers, list):
|
|
421
|
+
return None
|
|
422
|
+
for item in providers:
|
|
423
|
+
if isinstance(item, dict) and item.get("id") == provider_id:
|
|
424
|
+
return item
|
|
425
|
+
return None
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def _provider_uses_api_key(provider_id: str, provider: Optional[Mapping[str, Any]]) -> bool:
|
|
429
|
+
for info in PROVIDER_INFO:
|
|
430
|
+
if info["id"] == provider_id:
|
|
431
|
+
return bool(info["api_key"])
|
|
432
|
+
return provider is not None and provider.get("version") == "api"
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
def _document_task(kind: str, tool: str, title: str, brief: Optional[str]) -> str:
|
|
436
|
+
task = f"Make a {kind} with {tool}. Title: {title}. Use one cohesive theme on every page."
|
|
437
|
+
if brief:
|
|
438
|
+
task = f"{task} {brief}"
|
|
439
|
+
return task
|
|
440
|
+
|
|
441
|
+
|
|
290
442
|
def _segment(run_id: str) -> str:
|
|
291
443
|
from urllib.parse import quote
|
|
292
444
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taskmaster-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Client for the Taskmaster Computer agent
|
|
5
5
|
Author: Naren Sengodan
|
|
6
6
|
License-Expression: MIT
|
|
@@ -40,6 +40,17 @@ acted = tm.computer_act("open_url", url="https://example.com", capture_after=Tru
|
|
|
40
40
|
print(acted["result"])
|
|
41
41
|
```
|
|
42
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
|
+
for provider in ("claude", "agy", "grok", "codex", "opencode"):
|
|
47
|
+
tm.connect_provider(provider)
|
|
48
|
+
tm.connect_provider("openrouter", api_key="sk-...")
|
|
49
|
+
tm.connect_mcp("linear", "npx", args=["-y", "mcp-remote"], secret_env={"LINEAR_API_KEY": "..."})
|
|
50
|
+
session = tm.make_pptx("Q4 plan", "Three slides: goal, plan, ask")
|
|
51
|
+
print(tm.docs())
|
|
52
|
+
```
|
|
53
|
+
|
|
43
54
|
The standard library is the only dependency. Coding-run methods (`start`, `approve`, `events`) remain. `call(method, path, body)` sends any other route.
|
|
44
55
|
|
|
45
56
|
The same client is published for Rust (`cargo add taskmaster-api`) and JavaScript (`npm install taskmaster-api`).
|
|
@@ -5,7 +5,7 @@ import threading
|
|
|
5
5
|
import unittest
|
|
6
6
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
7
7
|
|
|
8
|
-
from taskmaster_api import Taskmaster, TaskmasterError
|
|
8
|
+
from taskmaster_api import PROVIDERS, Taskmaster, TaskmasterError
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Handler(BaseHTTPRequestHandler):
|
|
@@ -32,7 +32,13 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
32
32
|
else:
|
|
33
33
|
self._send(401, {"error": "that code was refused"})
|
|
34
34
|
return
|
|
35
|
-
if not authed and (
|
|
35
|
+
if not authed and (
|
|
36
|
+
path.startswith("/api/runs")
|
|
37
|
+
or path == "/api/doctor"
|
|
38
|
+
or path.startswith("/api/computer")
|
|
39
|
+
or path.startswith("/api/mcp")
|
|
40
|
+
or path.startswith("/api/setup")
|
|
41
|
+
):
|
|
36
42
|
self._send(401, {"error": "a token is required"})
|
|
37
43
|
return
|
|
38
44
|
if method == "GET" and path == "/api/runs":
|
|
@@ -62,6 +68,12 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
62
68
|
if method == "POST" and path == "/api/computer/sessions" and "weather" in body:
|
|
63
69
|
self._send(200, {"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "running", "harness": "grok", "final_reply": ""})
|
|
64
70
|
return
|
|
71
|
+
if method == "POST" and path == "/api/computer/sessions" and "doc_create_pptx" in body:
|
|
72
|
+
self._send(200, {"id": "cs-doc", "task": "Make a PowerPoint with doc_create_pptx. Title: Q4 plan.", "status": "running", "final_reply": ""})
|
|
73
|
+
return
|
|
74
|
+
if method == "POST" and path == "/api/computer/sessions" and "doc_create_docx" in body:
|
|
75
|
+
self._send(200, {"id": "cs-docx", "task": "Make a Word document with doc_create_docx. Title: Notes.", "status": "running", "final_reply": ""})
|
|
76
|
+
return
|
|
65
77
|
if method == "GET" and path == "/api/computer/sessions":
|
|
66
78
|
self._send(200, {"sessions": [{"id": "cs-1", "task": "Open Chrome and search for the weather", "status": "running", "step_count": 1, "agent_count": 1}]})
|
|
67
79
|
return
|
|
@@ -77,6 +89,65 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
77
89
|
if method == "POST" and path == "/api/computer/act" and "click_text" in body and "Search" in body:
|
|
78
90
|
self._send(200, {"ok": True, "result": "clicked Search"})
|
|
79
91
|
return
|
|
92
|
+
if method == "GET" and path == "/api/mcp":
|
|
93
|
+
self._send(200, {"servers": [{"name": "linear", "command": "npx", "enabled": True}]})
|
|
94
|
+
return
|
|
95
|
+
if method == "POST" and path == "/api/mcp" and "linear" in body and "npx" in body:
|
|
96
|
+
self._send(200, {"server": {"name": "linear", "command": "npx", "enabled": True}})
|
|
97
|
+
return
|
|
98
|
+
if method == "POST" and path == "/api/mcp/linear/remove":
|
|
99
|
+
self._send(200, {"removed": True})
|
|
100
|
+
return
|
|
101
|
+
if method == "GET" and path == "/api/computer/docs":
|
|
102
|
+
self._send(200, {"docs": [{"id": "doc-1", "filename": "Deck.pptx", "kind": "pptx", "title": "Deck"}]})
|
|
103
|
+
return
|
|
104
|
+
if method == "GET" and path == "/api/computer/docs/doc-1":
|
|
105
|
+
self._send(200, {"id": "doc-1", "filename": "Deck.pptx", "kind": "pptx", "title": "Deck"})
|
|
106
|
+
return
|
|
107
|
+
if method == "POST" and path == "/api/computer/files" and "Deck.pptx" in body:
|
|
108
|
+
self._send(200, {"id": "doc-1", "filename": "Deck.pptx", "kind": "pptx", "title": "Deck"})
|
|
109
|
+
return
|
|
110
|
+
if method == "POST" and path == "/api/computer/docs/doc-1/open":
|
|
111
|
+
self._send(200, {"ok": True, "path": "/tmp/Deck.pptx"})
|
|
112
|
+
return
|
|
113
|
+
if method == "GET" and path == "/api/setup":
|
|
114
|
+
self._send(
|
|
115
|
+
200,
|
|
116
|
+
{
|
|
117
|
+
"providers": [
|
|
118
|
+
{"id": "claude", "installed": False, "signed_in": False},
|
|
119
|
+
{"id": "agy", "installed": True, "signed_in": True},
|
|
120
|
+
{"id": "grok", "installed": True, "signed_in": False},
|
|
121
|
+
{"id": "codex", "installed": True, "signed_in": False},
|
|
122
|
+
{"id": "opencode", "installed": False, "signed_in": False},
|
|
123
|
+
{"id": "openrouter", "installed": True, "signed_in": False, "version": "api"},
|
|
124
|
+
{"id": "customcli", "installed": False, "signed_in": False},
|
|
125
|
+
{"id": "futureapi", "installed": True, "signed_in": False, "version": "api"},
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
)
|
|
129
|
+
return
|
|
130
|
+
if method == "POST" and path == "/api/setup/providers/claude/install":
|
|
131
|
+
self._send(202, {"id": "job-claude", "state": "running", "action": "install"})
|
|
132
|
+
return
|
|
133
|
+
if method == "POST" and path == "/api/setup/providers/opencode/install":
|
|
134
|
+
self._send(202, {"id": "job-opencode", "state": "running", "action": "install"})
|
|
135
|
+
return
|
|
136
|
+
if method == "POST" and path == "/api/setup/providers/customcli/install":
|
|
137
|
+
self._send(202, {"id": "job-custom", "state": "running", "action": "install"})
|
|
138
|
+
return
|
|
139
|
+
if method == "POST" and path == "/api/setup/providers/grok/login":
|
|
140
|
+
self._send(202, {"id": "job-1", "state": "running", "action": "login"})
|
|
141
|
+
return
|
|
142
|
+
if method == "POST" and path == "/api/setup/providers/codex/login":
|
|
143
|
+
self._send(202, {"id": "job-codex", "state": "running", "action": "login"})
|
|
144
|
+
return
|
|
145
|
+
if method == "POST" and path == "/api/setup/providers/openrouter/key" and "api_key" in body:
|
|
146
|
+
self._send(200, {"ok": True, "configured": True})
|
|
147
|
+
return
|
|
148
|
+
if method == "POST" and path == "/api/setup/providers/futureapi/key" and "api_key" in body:
|
|
149
|
+
self._send(200, {"ok": True, "configured": True})
|
|
150
|
+
return
|
|
80
151
|
self._send(404, {"error": "no such route"})
|
|
81
152
|
|
|
82
153
|
def _send(self, status: int, payload: object) -> None:
|
|
@@ -140,6 +211,41 @@ class ClientTest(unittest.TestCase):
|
|
|
140
211
|
self.assertTrue(acted["ok"])
|
|
141
212
|
self.assertEqual(acted["result"], "clicked Search")
|
|
142
213
|
|
|
214
|
+
self.assertTrue(tm.builtin_mcp_url().endswith("/mcp"))
|
|
215
|
+
servers = tm.mcp_servers()
|
|
216
|
+
self.assertEqual(servers[0]["name"], "linear")
|
|
217
|
+
self.assertTrue(servers[0]["enabled"])
|
|
218
|
+
saved = tm.connect_mcp("linear", "npx", args=["-y", "mcp-remote"])
|
|
219
|
+
self.assertEqual(saved["command"], "npx")
|
|
220
|
+
self.assertEqual(tm.disconnect_mcp("linear"), {"removed": True})
|
|
221
|
+
docs = tm.docs()
|
|
222
|
+
self.assertEqual(docs[0]["id"], "doc-1")
|
|
223
|
+
self.assertEqual(docs[0]["kind"], "pptx")
|
|
224
|
+
self.assertEqual(tm.doc("doc-1")["filename"], "Deck.pptx")
|
|
225
|
+
self.assertEqual(tm.upload_doc("Deck.pptx", "QQ==")["id"], "doc-1")
|
|
226
|
+
self.assertEqual(tm.open_doc("doc-1"), {"ok": True, "path": "/tmp/Deck.pptx"})
|
|
227
|
+
deck = tm.make_pptx("Q4 plan", "Three slides: goal, plan, ask")
|
|
228
|
+
self.assertEqual(deck["id"], "cs-doc")
|
|
229
|
+
self.assertIn("doc_create_pptx", deck["task"])
|
|
230
|
+
self.assertEqual(tm.make_docx("Notes")["id"], "cs-docx")
|
|
231
|
+
self.assertEqual(PROVIDERS, ("claude", "agy", "grok", "codex", "opencode", "openrouter"))
|
|
232
|
+
job = tm.connect_provider("grok")
|
|
233
|
+
self.assertEqual(job["id"], "job-1")
|
|
234
|
+
self.assertEqual(job["action"], "login")
|
|
235
|
+
self.assertEqual(tm.connect_provider("claude")["action"], "install")
|
|
236
|
+
self.assertEqual(tm.connect_provider("opencode")["action"], "install")
|
|
237
|
+
self.assertEqual(tm.connect_provider("codex")["action"], "login")
|
|
238
|
+
self.assertEqual(tm.connect_provider("agy"), {"ok": True, "connected": True, "id": "agy"})
|
|
239
|
+
self.assertEqual(tm.connect_provider("customcli")["action"], "install")
|
|
240
|
+
self.assertTrue(tm.connect_provider("openrouter", api_key="sk-test")["configured"])
|
|
241
|
+
self.assertTrue(tm.connect_provider("futureapi", api_key="sk-test")["configured"])
|
|
242
|
+
with self.assertRaises(TaskmasterError) as cli_key:
|
|
243
|
+
tm.connect_provider("grok", api_key="sk-test")
|
|
244
|
+
self.assertIn("CLI", cli_key.exception.message)
|
|
245
|
+
with self.assertRaises(TaskmasterError) as needs_key:
|
|
246
|
+
tm.connect_provider("openrouter")
|
|
247
|
+
self.assertIn("API key", needs_key.exception.message)
|
|
248
|
+
|
|
143
249
|
tm.clear_token()
|
|
144
250
|
with self.assertRaises(TaskmasterError) as missing:
|
|
145
251
|
tm.runs()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{taskmaster_api-0.2.0 → taskmaster_api-0.3.1}/src/taskmaster_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|