cmdop 3.1.0__tar.gz → 3.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.
- {cmdop-3.1.0 → cmdop-3.2.0}/PKG-INFO +4 -2
- {cmdop-3.1.0 → cmdop-3.2.0}/README.md +3 -1
- {cmdop-3.1.0 → cmdop-3.2.0}/pyproject.toml +5 -2
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/__init__.py +3 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/_async.py +9 -2
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/_client.py +9 -3
- cmdop-3.2.0/src/cmdop/generated/__init__.py +1 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/generated/args.py +1 -1
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/generated/call.py +1 -1
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/generated/models.py +1 -1
- cmdop-3.2.0/src/cmdop/generated/server.py +61 -0
- cmdop-3.2.0/src/cmdop/generated/server_args.py +69 -0
- cmdop-3.2.0/src/cmdop/generated/server_models.py +287 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/generated/tools.py +1 -1
- cmdop-3.1.0/src/cmdop/generated/__init__.py +0 -1
- {cmdop-3.1.0 → cmdop-3.2.0}/.gitignore +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/LICENSE +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/_errors.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/_screen.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/_sealing.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/carriers/__init__.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/carriers/_carrier.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/carriers/http.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/carriers/memory.py +0 -0
- {cmdop-3.1.0 → cmdop-3.2.0}/src/cmdop/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cmdop
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: Your machines' tools from a program: the same tools agents use through MCP, typed from Rust.
|
|
5
5
|
Project-URL: Homepage, https://cmdop.ai
|
|
6
6
|
Project-URL: Documentation, https://docs.cmdop.ai/reference/sdk/python
|
|
@@ -35,7 +35,9 @@ with cmdop.connect() as c: # CMDOP_TOKEN, CMDOP_URL
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Every tool is a typed method on a machine (`box.fs_read(path=...)`), also under its group (`box.fs.read(path=...)`);
|
|
38
|
-
`box.screenshot()` decodes the picture.
|
|
38
|
+
`box.screenshot()` decodes the picture. The tools the server answers itself are methods of the client, with no
|
|
39
|
+
machine: `c.machines_list()`, `c.tasks_list()`, `c.history_search(text=...)` and `c.showtime_guide(language=...)`,
|
|
40
|
+
the guide for a short live demo of what your machines can do. `cmdop.connect_async()` is the same, awaited. `src/cmdop/generated/` is generated by `make sdk-generate`; never edit it.
|
|
39
41
|
|
|
40
42
|
## The same tools over MCP
|
|
41
43
|
|
|
@@ -15,7 +15,9 @@ with cmdop.connect() as c: # CMDOP_TOKEN, CMDOP_URL
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Every tool is a typed method on a machine (`box.fs_read(path=...)`), also under its group (`box.fs.read(path=...)`);
|
|
18
|
-
`box.screenshot()` decodes the picture.
|
|
18
|
+
`box.screenshot()` decodes the picture. The tools the server answers itself are methods of the client, with no
|
|
19
|
+
machine: `c.machines_list()`, `c.tasks_list()`, `c.history_search(text=...)` and `c.showtime_guide(language=...)`,
|
|
20
|
+
the guide for a short live demo of what your machines can do. `cmdop.connect_async()` is the same, awaited. `src/cmdop/generated/` is generated by `make sdk-generate`; never edit it.
|
|
19
21
|
|
|
20
22
|
## The same tools over MCP
|
|
21
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cmdop"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.2.0"
|
|
4
4
|
description = "Your machines' tools from a program: the same tools agents use through MCP, typed from Rust."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -34,7 +34,10 @@ include = ["src", "tests"]
|
|
|
34
34
|
typeCheckingMode = "strict"
|
|
35
35
|
pythonVersion = "3.10"
|
|
36
36
|
# Generated models are checked by their own generator; the methods that use them are checked here.
|
|
37
|
-
exclude = [
|
|
37
|
+
exclude = [
|
|
38
|
+
"src/cmdop/generated/args.py", "src/cmdop/generated/models.py", "src/cmdop/generated/call.py",
|
|
39
|
+
"src/cmdop/generated/server_args.py", "src/cmdop/generated/server_models.py",
|
|
40
|
+
]
|
|
38
41
|
|
|
39
42
|
[tool.pytest.ini_options]
|
|
40
43
|
testpaths = ["tests"]
|
|
@@ -5,6 +5,7 @@ import cmdop
|
|
|
5
5
|
with cmdop.connect() as c: # CMDOP_TOKEN, CMDOP_URL
|
|
6
6
|
box = c.machine("box")
|
|
7
7
|
print(box.run("uptime").stdout)
|
|
8
|
+
print(c.showtime_guide(language="en")) # the server's own tools are client methods
|
|
8
9
|
```
|
|
9
10
|
"""
|
|
10
11
|
|
|
@@ -14,6 +15,7 @@ from ._errors import CarrierError, CmdopError
|
|
|
14
15
|
from ._screen import DecodedImage, Screenshot
|
|
15
16
|
from .carriers import AsyncMemoryCarrier, MemoryCarrier
|
|
16
17
|
from .generated.call import ENVELOPE_MAX_BYTES, ERROR_CODES, PIECE_MAX_BYTES
|
|
18
|
+
from .generated.server import SERVER_TOOLS
|
|
17
19
|
from .generated.tools import GROUPS, TOOLS
|
|
18
20
|
|
|
19
21
|
__all__ = [
|
|
@@ -21,6 +23,7 @@ __all__ = [
|
|
|
21
23
|
"ERROR_CODES",
|
|
22
24
|
"GROUPS",
|
|
23
25
|
"PIECE_MAX_BYTES",
|
|
26
|
+
"SERVER_TOOLS",
|
|
24
27
|
"TOOLS",
|
|
25
28
|
"AsyncClient",
|
|
26
29
|
"AsyncMachine",
|
|
@@ -6,13 +6,14 @@ import time
|
|
|
6
6
|
from collections.abc import AsyncIterator, Callable
|
|
7
7
|
from typing import Any, Generic, TypeVar
|
|
8
8
|
|
|
9
|
-
from pydantic import BaseModel
|
|
9
|
+
from pydantic import BaseModel, TypeAdapter
|
|
10
10
|
|
|
11
11
|
from ._client import Piece, carrier_name, piece, request, settle, token_of, url_of
|
|
12
12
|
from ._errors import CarrierError, CmdopError
|
|
13
13
|
from ._sealing import Sealing
|
|
14
14
|
from .carriers import AsyncCarrier, AsyncHttpCarrier, Json
|
|
15
15
|
from .carriers._carrier import is_answer
|
|
16
|
+
from .generated.server import AsyncServerTools
|
|
16
17
|
from .generated.tools import AsyncTools
|
|
17
18
|
|
|
18
19
|
T = TypeVar("T", bound=BaseModel)
|
|
@@ -77,7 +78,9 @@ class AsyncMachine(AsyncTools):
|
|
|
77
78
|
return self._client.stream(name, args, machine=self.name, deadline=deadline, out=out)
|
|
78
79
|
|
|
79
80
|
|
|
80
|
-
class AsyncClient:
|
|
81
|
+
class AsyncClient(AsyncServerTools):
|
|
82
|
+
"""`Client`, awaited. The server's own tools are its methods (`await cmdop.showtime_guide()`)."""
|
|
83
|
+
|
|
81
84
|
def __init__(self, carrier: AsyncCarrier, e2e: Sealing | None = None) -> None:
|
|
82
85
|
self.carrier_impl = carrier
|
|
83
86
|
self._sealer = e2e
|
|
@@ -100,6 +103,10 @@ class AsyncClient:
|
|
|
100
103
|
sealed, replies = self._sealer.seal(req, await self.machines(), time.time())
|
|
101
104
|
return settle(self._sealer.open_answer(await self.carrier_impl.call(sealed), replies))
|
|
102
105
|
|
|
106
|
+
async def _server(self, name: str, args: dict[str, Any], out: Any, deadline: float | None) -> Any:
|
|
107
|
+
# The server reads these arguments and answers from its own records: there is no machine to seal for.
|
|
108
|
+
return TypeAdapter(out).validate_python(settle(await self.carrier_impl.call(request(name, args, None, deadline))))
|
|
109
|
+
|
|
103
110
|
def stream(
|
|
104
111
|
self, tool: str, args: dict[str, Any], *, machine: str | None = None, deadline: float | None = None, out: type[T] | None = None
|
|
105
112
|
) -> AsyncRun[Any]:
|
|
@@ -12,13 +12,14 @@ import time
|
|
|
12
12
|
from collections.abc import Callable, Iterator
|
|
13
13
|
from typing import Any, Generic, TypeVar
|
|
14
14
|
|
|
15
|
-
from pydantic import BaseModel
|
|
15
|
+
from pydantic import BaseModel, TypeAdapter
|
|
16
16
|
|
|
17
17
|
from ._errors import CarrierError, CmdopError
|
|
18
18
|
from ._sealing import Sealing
|
|
19
19
|
from .carriers import Carrier, HttpCarrier, Json
|
|
20
20
|
from .carriers._carrier import is_answer
|
|
21
21
|
from .generated.call import OutputChunk
|
|
22
|
+
from .generated.server import ServerTools
|
|
22
23
|
from .generated.tools import Tools
|
|
23
24
|
|
|
24
25
|
T = TypeVar("T", bound=BaseModel)
|
|
@@ -160,8 +161,9 @@ class Machine(Tools):
|
|
|
160
161
|
return self._client.stream(name, args, machine=self.name, deadline=deadline, out=out)
|
|
161
162
|
|
|
162
163
|
|
|
163
|
-
class Client:
|
|
164
|
-
"""Your machines. Use `cmdop.connect()`; close it, or use it as a context manager.
|
|
164
|
+
class Client(ServerTools):
|
|
165
|
+
"""Your machines. Use `cmdop.connect()`; close it, or use it as a context manager. The tools the server answers
|
|
166
|
+
itself are its methods (`cmdop.showtime_guide()`, `cmdop.tasks_list()`), generated (`generated/server.py`)."""
|
|
165
167
|
|
|
166
168
|
def __init__(self, carrier: Carrier, e2e: Sealing | None = None) -> None:
|
|
167
169
|
self.carrier_impl = carrier
|
|
@@ -189,6 +191,10 @@ class Client:
|
|
|
189
191
|
sealed, replies = self._sealer.seal(req, self.machines(), time.time())
|
|
190
192
|
return settle(self._sealer.open_answer(self.carrier_impl.call(sealed), replies))
|
|
191
193
|
|
|
194
|
+
def _server(self, name: str, args: dict[str, Any], out: Any, deadline: float | None) -> Any:
|
|
195
|
+
# The server reads these arguments and answers from its own records: there is no machine to seal for.
|
|
196
|
+
return TypeAdapter(out).validate_python(settle(self.carrier_impl.call(request(name, args, None, deadline))))
|
|
197
|
+
|
|
192
198
|
def stream(
|
|
193
199
|
self, tool: str, args: dict[str, Any], *, machine: str | None = None, deadline: float | None = None, out: type[T] | None = None
|
|
194
200
|
) -> Run[Any]:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from cmdop/crates/tools/tools.schema.json (sha256
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
2
|
# Types by datamodel-code-generator==0.30.2.
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from cmdop/crates/tools/tools.schema.json (sha256
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
2
|
# Types by datamodel-code-generator==0.30.2.
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from cmdop/crates/tools/tools.schema.json (sha256
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
2
|
# Types by datamodel-code-generator==0.30.2.
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
|
+
"""The tools the server answers itself, as methods of `Client` and `AsyncClient`. No machine, never sealed."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from typing_extensions import Unpack
|
|
9
|
+
|
|
10
|
+
from . import server_args as sa
|
|
11
|
+
from . import server_models as sm
|
|
12
|
+
|
|
13
|
+
SERVER_TOOLS: dict[str, str] = {
|
|
14
|
+
"history_search": "Search history",
|
|
15
|
+
"machines_list": "List machines",
|
|
16
|
+
"showtime_guide": "Showtime guide",
|
|
17
|
+
"tasks_list": "List running work",
|
|
18
|
+
}
|
|
19
|
+
"""Every server tool and its title."""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ServerTools:
|
|
23
|
+
def _server(self, name: str, args: dict[str, Any], out: Any, deadline: float | None) -> Any:
|
|
24
|
+
raise NotImplementedError
|
|
25
|
+
|
|
26
|
+
def history_search(self, *, deadline: float | None = None, **args: Unpack[sa.HistorySearchArgs]) -> sm.HistorySearchOut:
|
|
27
|
+
"""Past tasks, tool calls and agent sessions by machine, author, task, time and text, newest first. Calls carry no arguments; journal_search on the machine has them."""
|
|
28
|
+
return self._server("history_search", dict(args), sm.HistorySearchOut, deadline)
|
|
29
|
+
|
|
30
|
+
def machines_list(self, *, deadline: float | None = None, **args: Unpack[sa.MachinesListArgs]) -> list[sm.MachineRow]:
|
|
31
|
+
"""The owner's machines: name, id, `state` (online; stale = linked, not answering; paused; offline), `last_seen`, `activity`, `tools`, build, `behind` (newer release out). Only online ones take calls."""
|
|
32
|
+
return self._server("machines_list", dict(args), list[sm.MachineRow], deadline)
|
|
33
|
+
|
|
34
|
+
def showtime_guide(self, *, deadline: float | None = None, **args: Unpack[sa.ShowtimeGuideArgs]) -> str:
|
|
35
|
+
"""Call when the user asks to see what CMDOP can do (a demo or a show): returns a guide for a short live demonstration on their machines."""
|
|
36
|
+
return self._server("showtime_guide", dict(args), str, deadline)
|
|
37
|
+
|
|
38
|
+
def tasks_list(self, *, deadline: float | None = None, **args: Unpack[sa.TasksListArgs]) -> sm.TasksListOut:
|
|
39
|
+
"""Everything running now, by author. `tasks`: started through cmdop. `outside`: other processes per machine, by agent:claude-code, agent:codex or user. Ended ones: history_search."""
|
|
40
|
+
return self._server("tasks_list", dict(args), sm.TasksListOut, deadline)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class AsyncServerTools:
|
|
44
|
+
async def _server(self, name: str, args: dict[str, Any], out: Any, deadline: float | None) -> Any:
|
|
45
|
+
raise NotImplementedError
|
|
46
|
+
|
|
47
|
+
async def history_search(self, *, deadline: float | None = None, **args: Unpack[sa.HistorySearchArgs]) -> sm.HistorySearchOut:
|
|
48
|
+
"""Past tasks, tool calls and agent sessions by machine, author, task, time and text, newest first. Calls carry no arguments; journal_search on the machine has them."""
|
|
49
|
+
return await self._server("history_search", dict(args), sm.HistorySearchOut, deadline)
|
|
50
|
+
|
|
51
|
+
async def machines_list(self, *, deadline: float | None = None, **args: Unpack[sa.MachinesListArgs]) -> list[sm.MachineRow]:
|
|
52
|
+
"""The owner's machines: name, id, `state` (online; stale = linked, not answering; paused; offline), `last_seen`, `activity`, `tools`, build, `behind` (newer release out). Only online ones take calls."""
|
|
53
|
+
return await self._server("machines_list", dict(args), list[sm.MachineRow], deadline)
|
|
54
|
+
|
|
55
|
+
async def showtime_guide(self, *, deadline: float | None = None, **args: Unpack[sa.ShowtimeGuideArgs]) -> str:
|
|
56
|
+
"""Call when the user asks to see what CMDOP can do (a demo or a show): returns a guide for a short live demonstration on their machines."""
|
|
57
|
+
return await self._server("showtime_guide", dict(args), str, deadline)
|
|
58
|
+
|
|
59
|
+
async def tasks_list(self, *, deadline: float | None = None, **args: Unpack[sa.TasksListArgs]) -> sm.TasksListOut:
|
|
60
|
+
"""Everything running now, by author. `tasks`: started through cmdop. `outside`: other processes per machine, by agent:claude-code, agent:codex or user. Ended ones: history_search."""
|
|
61
|
+
return await self._server("tasks_list", dict(args), sm.TasksListOut, deadline)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
|
+
# Types by datamodel-code-generator==0.30.2.
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Literal, TypedDict
|
|
7
|
+
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HistorySearchArgs(TypedDict):
|
|
12
|
+
author: NotRequired[str | None]
|
|
13
|
+
"""
|
|
14
|
+
Author or its start: `owner`, `agent:` (every agent), `agent:<name>`.
|
|
15
|
+
"""
|
|
16
|
+
kind: NotRequired[list[Literal["tasks", "sessions", "calls"]]]
|
|
17
|
+
"""
|
|
18
|
+
What to return. Default: tasks, sessions and calls.
|
|
19
|
+
"""
|
|
20
|
+
limit: NotRequired[int | None]
|
|
21
|
+
"""
|
|
22
|
+
At most this many of each kind, newest first (default 50, at most 200).
|
|
23
|
+
"""
|
|
24
|
+
machine: NotRequired[str | None]
|
|
25
|
+
"""
|
|
26
|
+
Only this machine (name or id).
|
|
27
|
+
"""
|
|
28
|
+
since: NotRequired[int | None]
|
|
29
|
+
"""
|
|
30
|
+
Started (sessions: last changed) at or after this time, unix seconds.
|
|
31
|
+
"""
|
|
32
|
+
task: NotRequired[int | None]
|
|
33
|
+
"""
|
|
34
|
+
Only this task (its row and the calls that started or named it; no sessions).
|
|
35
|
+
"""
|
|
36
|
+
text: NotRequired[str | None]
|
|
37
|
+
"""
|
|
38
|
+
Text, any case. Tasks: the command, the folder or the error (another author's only for an
|
|
39
|
+
agent granted exec). Sessions: path, id, folder. Calls: the tool name.
|
|
40
|
+
"""
|
|
41
|
+
until: NotRequired[int | None]
|
|
42
|
+
"""
|
|
43
|
+
Started (sessions: last changed) before this time, unix seconds.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class MachinesListArgs(TypedDict):
|
|
48
|
+
"""
|
|
49
|
+
No arguments.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ShowtimeGuideArgs(TypedDict):
|
|
54
|
+
language: NotRequired[str | None]
|
|
55
|
+
"""
|
|
56
|
+
The language to speak to the user in, e.g. "Russian" or "de". Default: the user's.
|
|
57
|
+
"""
|
|
58
|
+
os: NotRequired[Literal["macos", "linux"] | None]
|
|
59
|
+
"""
|
|
60
|
+
The stage machine's OS (`sys_info` `os`). Default: the notes for every OS.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class TasksListArgs(TypedDict):
|
|
65
|
+
machine: NotRequired[str | None]
|
|
66
|
+
"""
|
|
67
|
+
Only this machine (name or id). Default: all machines.
|
|
68
|
+
"""
|
|
69
|
+
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
|
+
# Types by datamodel-code-generator==0.30.2.
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
from pydantic import BaseModel, Field, RootModel
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CallView(BaseModel):
|
|
12
|
+
author: str
|
|
13
|
+
id: int
|
|
14
|
+
machine: str
|
|
15
|
+
machine_name: str
|
|
16
|
+
ms: int | None = Field(None, ge=0)
|
|
17
|
+
outcome: str | None = None
|
|
18
|
+
"""
|
|
19
|
+
`ok`, an error code, `cancelled` (the caller went away first) or `interrupted` (the
|
|
20
|
+
server stopped first); none while it runs.
|
|
21
|
+
"""
|
|
22
|
+
refused: bool
|
|
23
|
+
"""
|
|
24
|
+
The caller was refused (the grant, an OS permission or the app list said no), as opposed
|
|
25
|
+
to the tool failing.
|
|
26
|
+
"""
|
|
27
|
+
sealed: bool
|
|
28
|
+
"""
|
|
29
|
+
Sealed end to end: the server never saw its arguments or answer. False for MCP
|
|
30
|
+
and the page, whose calls pass through the server in clear.
|
|
31
|
+
"""
|
|
32
|
+
started: int = Field(..., ge=0)
|
|
33
|
+
task: int | None = None
|
|
34
|
+
"""
|
|
35
|
+
The task the call started (`task_start`) or named (a plain `task_output` / `task_stop`);
|
|
36
|
+
none for other tools and for a sealed call that names a task.
|
|
37
|
+
"""
|
|
38
|
+
token: int
|
|
39
|
+
"""
|
|
40
|
+
The token that made the call: an agent's id on `/api/agents`, or the owner's token.
|
|
41
|
+
"""
|
|
42
|
+
tool: str
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class DockRunView(BaseModel):
|
|
46
|
+
"""
|
|
47
|
+
A run of the owner's agent dock on that machine (persistent context S4), from the app's
|
|
48
|
+
`dock.log`: start, stop and exit only, never keystrokes or output.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
ended: int | None = Field(None, ge=0)
|
|
52
|
+
"""
|
|
53
|
+
Unix milliseconds; absent while it runs, or when the app quit first (`exit` is `lost`).
|
|
54
|
+
"""
|
|
55
|
+
exit: str | None = None
|
|
56
|
+
"""
|
|
57
|
+
The exit code, `signal`, or `lost`.
|
|
58
|
+
"""
|
|
59
|
+
started: int = Field(..., ge=0)
|
|
60
|
+
"""
|
|
61
|
+
Unix milliseconds.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class SessionView(BaseModel):
|
|
66
|
+
"""
|
|
67
|
+
A kept vendor session file, or a run of the agent dock (`dock` set), as history shows it.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
author: str
|
|
71
|
+
cwd: str | None = None
|
|
72
|
+
dock: DockRunView | None = None
|
|
73
|
+
"""
|
|
74
|
+
Set when this row is a dock run, not a vendor file.
|
|
75
|
+
"""
|
|
76
|
+
gone: bool
|
|
77
|
+
kept: bool
|
|
78
|
+
machine: str
|
|
79
|
+
machine_name: str
|
|
80
|
+
modified: int = Field(..., ge=0)
|
|
81
|
+
path: str
|
|
82
|
+
session: str
|
|
83
|
+
size: int = Field(..., ge=0)
|
|
84
|
+
vendor: str
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class Activity(BaseModel):
|
|
88
|
+
calls: int = Field(..., ge=0)
|
|
89
|
+
"""
|
|
90
|
+
Tool calls the server could read made to it since `since`; calls from a paired client,
|
|
91
|
+
encrypted end to end, are not counted.
|
|
92
|
+
"""
|
|
93
|
+
since: int = Field(..., ge=0)
|
|
94
|
+
"""
|
|
95
|
+
Unix seconds.
|
|
96
|
+
"""
|
|
97
|
+
tasks: int = Field(..., ge=0)
|
|
98
|
+
"""
|
|
99
|
+
Tasks started on the machine since `since`.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class ProcView(BaseModel):
|
|
104
|
+
"""
|
|
105
|
+
A process cmdop did not start, with who did.
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
argv: list[str]
|
|
109
|
+
author: str
|
|
110
|
+
cwd: str | None = None
|
|
111
|
+
machine: str
|
|
112
|
+
machine_name: str
|
|
113
|
+
pid: int = Field(..., ge=0)
|
|
114
|
+
started: int = Field(..., ge=0)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class ShownTask(BaseModel):
|
|
118
|
+
"""
|
|
119
|
+
A task as the caller may see it.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
argv: list[str] | None = None
|
|
123
|
+
author: str
|
|
124
|
+
code: int | None = None
|
|
125
|
+
created: int = Field(..., ge=0)
|
|
126
|
+
cwd: str | None = None
|
|
127
|
+
ended: int | None = Field(None, ge=0)
|
|
128
|
+
error: str | None = None
|
|
129
|
+
hidden: str | None = None
|
|
130
|
+
id: int
|
|
131
|
+
machine: str
|
|
132
|
+
machine_name: str
|
|
133
|
+
pid: int | None = None
|
|
134
|
+
sealed: bool
|
|
135
|
+
"""
|
|
136
|
+
Started by a call from a paired client, encrypted end to end: the server never saw the
|
|
137
|
+
command, so `argv` is empty.
|
|
138
|
+
"""
|
|
139
|
+
signal: int | None = None
|
|
140
|
+
state: Literal["running", "starting", "ended", "failed", "lost"] = Field(
|
|
141
|
+
..., title="TaskState"
|
|
142
|
+
)
|
|
143
|
+
"""
|
|
144
|
+
Where a task is in its life. The store keeps it as text (`cmdop-store` writes only these five).
|
|
145
|
+
`starting`: Recorded; the machine has not said it started.
|
|
146
|
+
`ended`: Exited: `code` or `signal` says how.
|
|
147
|
+
`failed`: Did not start: `error` says why.
|
|
148
|
+
`lost`: The machine went away while it ran; it may come back as `running`.
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class HistorySearchOut(BaseModel):
|
|
153
|
+
"""
|
|
154
|
+
What `history_search` returns: each kind asked for, and only those.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
calls: list[CallView] | None = None
|
|
158
|
+
"""
|
|
159
|
+
Only calls the server could read: calls from a paired client, encrypted end to end, are
|
|
160
|
+
left out.
|
|
161
|
+
"""
|
|
162
|
+
sessions: list[SessionView] | None = None
|
|
163
|
+
"""
|
|
164
|
+
Absent when `task` was given: a task has no sessions.
|
|
165
|
+
"""
|
|
166
|
+
tasks: list[ShownTask] | None = None
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class MachineRow(BaseModel):
|
|
170
|
+
"""
|
|
171
|
+
One row of `machines_list`: the machine as `/api/v1/machines` shows it, and its activity.
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
activity: Activity | None = None
|
|
175
|
+
"""
|
|
176
|
+
The last 7 days' counts; absent when the server's store could not count them.
|
|
177
|
+
"""
|
|
178
|
+
arch: str
|
|
179
|
+
behind: bool | None = None
|
|
180
|
+
"""
|
|
181
|
+
Whether a newer CMDOP release than `program` is published. Null when this server cannot
|
|
182
|
+
say (it does not follow releases, as a self-hosted server may not) or `program` is not a
|
|
183
|
+
release version.
|
|
184
|
+
"""
|
|
185
|
+
box_key: str | None = None
|
|
186
|
+
"""
|
|
187
|
+
The machine's key for sealed calls. A client trusts it only with `box_sig`, checked
|
|
188
|
+
against the machine id it pinned.
|
|
189
|
+
"""
|
|
190
|
+
box_sig: str | None = None
|
|
191
|
+
commit: str | None = None
|
|
192
|
+
"""
|
|
193
|
+
The commit its program was built from (12 hex digits), as it said on its current or last
|
|
194
|
+
link since the server started; null from an older program or before it dialled in.
|
|
195
|
+
"""
|
|
196
|
+
dirty: bool
|
|
197
|
+
"""
|
|
198
|
+
Its program had changes not in `commit` (a developer's build). Not required in the
|
|
199
|
+
document, so a client also reads a row from an older server, which sends none.
|
|
200
|
+
"""
|
|
201
|
+
epoch: int = Field(..., ge=0)
|
|
202
|
+
id: str
|
|
203
|
+
label: str | None = None
|
|
204
|
+
"""
|
|
205
|
+
The name its owner gave it on the page; null when none, and `name` is `own_name`.
|
|
206
|
+
"""
|
|
207
|
+
last_seen: int = Field(..., ge=0)
|
|
208
|
+
"""
|
|
209
|
+
Unix seconds of the last message from the machine.
|
|
210
|
+
"""
|
|
211
|
+
name: str
|
|
212
|
+
"""
|
|
213
|
+
What to call it: the name its owner gave it on the page, else the machine's own.
|
|
214
|
+
"""
|
|
215
|
+
newest_release: str | None = None
|
|
216
|
+
"""
|
|
217
|
+
The newest published CMDOP release this server knows, `0.1.10`; null when it knows none.
|
|
218
|
+
The same on every row.
|
|
219
|
+
"""
|
|
220
|
+
online: bool
|
|
221
|
+
"""
|
|
222
|
+
It has a live link (it may still be `stale` or `paused`; `state` says whether it can
|
|
223
|
+
take a call).
|
|
224
|
+
"""
|
|
225
|
+
os: str
|
|
226
|
+
own_name: str
|
|
227
|
+
"""
|
|
228
|
+
The name the machine gives itself (`machine.json` `name`), from its last `Hello`.
|
|
229
|
+
"""
|
|
230
|
+
paused: bool | None = None
|
|
231
|
+
"""
|
|
232
|
+
Whether its owner paused it (no tool runs there), as the machine reported on its live
|
|
233
|
+
link; null while it is offline, or when its program is too old to report.
|
|
234
|
+
"""
|
|
235
|
+
program: str
|
|
236
|
+
since: int = Field(..., ge=0)
|
|
237
|
+
"""
|
|
238
|
+
Unix seconds: when the current link came up, or when the machine was last seen.
|
|
239
|
+
"""
|
|
240
|
+
state: Literal["online", "stale", "offline", "paused"] = Field(
|
|
241
|
+
..., title="Presence"
|
|
242
|
+
)
|
|
243
|
+
"""
|
|
244
|
+
Whether it can take a call now: `online`, `stale`, `offline` or `paused`. Only `online`
|
|
245
|
+
takes calls; for any other, tell the user instead of retrying.
|
|
246
|
+
"""
|
|
247
|
+
tools: list[str]
|
|
248
|
+
"""
|
|
249
|
+
Tools the machine runs, as it announced them on its current or last link.
|
|
250
|
+
"""
|
|
251
|
+
unpaired_risks: list[str] | None = None
|
|
252
|
+
"""
|
|
253
|
+
Risk classes a call from the page or MCP may use on this machine: what its own ceiling
|
|
254
|
+
allows, which no agent's grant can exceed. As the machine reported on its live link; null
|
|
255
|
+
while it is offline, or when its program is too old to report.
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class Picture(BaseModel):
|
|
260
|
+
"""
|
|
261
|
+
One machine's picture, or why there is none.
|
|
262
|
+
"""
|
|
263
|
+
|
|
264
|
+
error: str | None = None
|
|
265
|
+
machine: str
|
|
266
|
+
machine_name: str
|
|
267
|
+
others: int = Field(..., ge=0)
|
|
268
|
+
"""
|
|
269
|
+
Processes of "the machine itself" (apps, daemons), only counted.
|
|
270
|
+
"""
|
|
271
|
+
procs: list[ProcView]
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class TasksListOut(BaseModel):
|
|
275
|
+
"""
|
|
276
|
+
What `tasks_list` returns.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
outside: list[Picture]
|
|
280
|
+
"""
|
|
281
|
+
Other processes on each online machine (`proc_list` there), by who started them.
|
|
282
|
+
"""
|
|
283
|
+
tasks: list[ShownTask]
|
|
284
|
+
"""
|
|
285
|
+
Tasks started through cmdop that still run.
|
|
286
|
+
"""
|
|
287
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from cmdop/crates/tools/tools.schema.json (sha256
|
|
1
|
+
# Generated from cmdop/crates/tools/tools.schema.json (sha256 d9aba5e354666f95, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
2
2
|
"""Every machine tool as a method, on `Machine` and `AsyncMachine`. The clients implement `_tool`."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Generated from cmdop/crates/tools/tools.schema.json (sha256 72ba780fabadfafb, cmdop 0.1.10) by exports/sdk/gen/gen.ts. Do not edit.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|