dejima-sdk 0.5.2__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,13 @@
1
+ # Python
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ python/dist/
8
+ python/build/
9
+
10
+ # TypeScript / Node
11
+ node_modules/
12
+ ts/dist/
13
+ *.tsbuildinfo
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: dejima-sdk
3
+ Version: 0.5.2
4
+ Summary: Python client for the Dejima API — run a fleet of AI coding agents on hardware you own.
5
+ Project-URL: Homepage, https://dejima.tech/
6
+ Project-URL: Source, https://github.com/aoos/dejima
7
+ Project-URL: API, https://dejima.tech/api.html
8
+ Project-URL: Issues, https://github.com/aoos/dejima/issues
9
+ Author: Dejima
10
+ License: MIT
11
+ Keywords: ai-agents,claude-code,codex,dejima,sandbox,self-hosted
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: System :: Distributed Computing
19
+ Requires-Python: >=3.9
20
+ Requires-Dist: requests>=2.28
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7; extra == 'dev'
23
+ Requires-Dist: websocket-client>=1.6; extra == 'dev'
24
+ Provides-Extra: ws
25
+ Requires-Dist: websocket-client>=1.6; extra == 'ws'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # dejima — Python client
29
+
30
+ Thin Python client for the [Dejima](https://dejima.tech/) API: run a
31
+ fleet of AI coding agents on hardware you own.
32
+
33
+ > **Alpha (0.x).** The API is stable in shape (`v1/`-prefixed) but fields may
34
+ > change until `1.0`. This client is hand-written over the REST surface and
35
+ > mirrors [`openapi.yaml`](https://github.com/aoos/dejima/blob/master/openapi.yaml);
36
+ > the only non-generated piece is the PTY `Session` helper.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install dejima-sdk # REST client
42
+ pip install 'dejima[ws]' # + WebSocket PTY attach()
43
+ ```
44
+
45
+ ## Quickstart
46
+
47
+ ```python
48
+ from dejima import Client
49
+
50
+ # host/token from $DEJIMA_HOST and $DEJIMA_TOKEN, or pass explicitly:
51
+ dj = Client(host="100.84.12.7:7273")
52
+
53
+ isl = dj.create_island(repo="git@github.com:you/foo.git", agent="claude-code")
54
+ print(isl["name"], isl["state"])
55
+
56
+ # add a second agent on its own worktree
57
+ dj.add_agent(isl["name"], type="codex")
58
+
59
+ # one-shot command
60
+ out = dj.exec(isl["name"], ["git", "status", "--short"])
61
+ print(out["stdout"], "exit", out["exit_code"])
62
+
63
+ # fleet view
64
+ for i in dj.list_islands():
65
+ print(i["name"], i["state"], len(i.get("agents", [])), "agents")
66
+
67
+ print(dj.overview()) # daemon health, VM memory, rollup
68
+ ```
69
+
70
+ ## Interactive sessions
71
+
72
+ `attach()` opens the multi-attach PTY stream (needs the `ws` extra). The daemon
73
+ speaks a small JSON-envelope protocol over the WebSocket — `Session` hides that,
74
+ so you deal in raw `bytes`:
75
+
76
+ ```python
77
+ with dj.attach(isl["name"]) as s: # or agent="p2"
78
+ s.resize(40, 120)
79
+ s.send(b"ls -la\n")
80
+ print(s.recv()) # bytes of PTY output, or None when closed
81
+ ```
82
+
83
+ `dj.attach_terminal("t1")` does the same for an operator host terminal.
84
+
85
+ ## API coverage
86
+
87
+ The client covers the full v1 surface:
88
+
89
+ - **Islands** — list/create/get/update/delete, hibernate/wake/reset/upgrade,
90
+ clone, resources, workspace-ready, events.
91
+ - **Agents** — list/add/get/update/remove, configure (provider/model).
92
+ - **Exec & files** — exec, file read/write, logs.
93
+ - **Port broker** — scopes (list/grant/revoke), intake/export/write.
94
+ - **Capability broker** — grants (list/grant/revoke), execute.
95
+ - **MCP broker** — grants (list/grant/revoke), `mcp_call`.
96
+ - **Credentials** — Claude push/status, GitHub identities + repos, LLM providers.
97
+ - **Operator tokens** — create/list/revoke (owner-only; role + island scope).
98
+ - **Events** — webhook subscribe/list/unsubscribe.
99
+ - **Activity** — team activity feed (`activity`, filterable).
100
+ - **Daemon** — overview, agent-types, healthz, audit (filters + jsonl/csv export),
101
+ clients, sessions-revoke, panic, admin-update, image-build, SSH account keys.
102
+ - **Host terminals** — list/create/delete/relabel + `attach_terminal`.
103
+ - **Sessions** — `attach` / `attach_terminal` (PTY) and `session_url`.
104
+
105
+ Every non-2xx response raises `dejima.DejimaError` (`.status`, `.message`).
106
+
107
+ ## Auth
108
+
109
+ - **Operator** (unix socket / tailnet) needs no token.
110
+ - **Autonomy path** (an agent driving its own/child islands) uses a per-island
111
+ bearer token — set `DEJIMA_TOKEN` or pass `token=`.
112
+
113
+ ## Development
114
+
115
+ ```bash
116
+ pip install -e '.[dev]'
117
+ pytest
118
+ ```
119
+
120
+ Tests run against a stdlib `http.server` stub — no running daemon required.
@@ -0,0 +1,93 @@
1
+ # dejima — Python client
2
+
3
+ Thin Python client for the [Dejima](https://dejima.tech/) API: run a
4
+ fleet of AI coding agents on hardware you own.
5
+
6
+ > **Alpha (0.x).** The API is stable in shape (`v1/`-prefixed) but fields may
7
+ > change until `1.0`. This client is hand-written over the REST surface and
8
+ > mirrors [`openapi.yaml`](https://github.com/aoos/dejima/blob/master/openapi.yaml);
9
+ > the only non-generated piece is the PTY `Session` helper.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install dejima-sdk # REST client
15
+ pip install 'dejima[ws]' # + WebSocket PTY attach()
16
+ ```
17
+
18
+ ## Quickstart
19
+
20
+ ```python
21
+ from dejima import Client
22
+
23
+ # host/token from $DEJIMA_HOST and $DEJIMA_TOKEN, or pass explicitly:
24
+ dj = Client(host="100.84.12.7:7273")
25
+
26
+ isl = dj.create_island(repo="git@github.com:you/foo.git", agent="claude-code")
27
+ print(isl["name"], isl["state"])
28
+
29
+ # add a second agent on its own worktree
30
+ dj.add_agent(isl["name"], type="codex")
31
+
32
+ # one-shot command
33
+ out = dj.exec(isl["name"], ["git", "status", "--short"])
34
+ print(out["stdout"], "exit", out["exit_code"])
35
+
36
+ # fleet view
37
+ for i in dj.list_islands():
38
+ print(i["name"], i["state"], len(i.get("agents", [])), "agents")
39
+
40
+ print(dj.overview()) # daemon health, VM memory, rollup
41
+ ```
42
+
43
+ ## Interactive sessions
44
+
45
+ `attach()` opens the multi-attach PTY stream (needs the `ws` extra). The daemon
46
+ speaks a small JSON-envelope protocol over the WebSocket — `Session` hides that,
47
+ so you deal in raw `bytes`:
48
+
49
+ ```python
50
+ with dj.attach(isl["name"]) as s: # or agent="p2"
51
+ s.resize(40, 120)
52
+ s.send(b"ls -la\n")
53
+ print(s.recv()) # bytes of PTY output, or None when closed
54
+ ```
55
+
56
+ `dj.attach_terminal("t1")` does the same for an operator host terminal.
57
+
58
+ ## API coverage
59
+
60
+ The client covers the full v1 surface:
61
+
62
+ - **Islands** — list/create/get/update/delete, hibernate/wake/reset/upgrade,
63
+ clone, resources, workspace-ready, events.
64
+ - **Agents** — list/add/get/update/remove, configure (provider/model).
65
+ - **Exec & files** — exec, file read/write, logs.
66
+ - **Port broker** — scopes (list/grant/revoke), intake/export/write.
67
+ - **Capability broker** — grants (list/grant/revoke), execute.
68
+ - **MCP broker** — grants (list/grant/revoke), `mcp_call`.
69
+ - **Credentials** — Claude push/status, GitHub identities + repos, LLM providers.
70
+ - **Operator tokens** — create/list/revoke (owner-only; role + island scope).
71
+ - **Events** — webhook subscribe/list/unsubscribe.
72
+ - **Activity** — team activity feed (`activity`, filterable).
73
+ - **Daemon** — overview, agent-types, healthz, audit (filters + jsonl/csv export),
74
+ clients, sessions-revoke, panic, admin-update, image-build, SSH account keys.
75
+ - **Host terminals** — list/create/delete/relabel + `attach_terminal`.
76
+ - **Sessions** — `attach` / `attach_terminal` (PTY) and `session_url`.
77
+
78
+ Every non-2xx response raises `dejima.DejimaError` (`.status`, `.message`).
79
+
80
+ ## Auth
81
+
82
+ - **Operator** (unix socket / tailnet) needs no token.
83
+ - **Autonomy path** (an agent driving its own/child islands) uses a per-island
84
+ bearer token — set `DEJIMA_TOKEN` or pass `token=`.
85
+
86
+ ## Development
87
+
88
+ ```bash
89
+ pip install -e '.[dev]'
90
+ pytest
91
+ ```
92
+
93
+ Tests run against a stdlib `http.server` stub — no running daemon required.
@@ -0,0 +1,17 @@
1
+ """Dejima — Python client for the Dejima API.
2
+
3
+ from dejima import Client
4
+ dj = Client() # reads DEJIMA_HOST / DEJIMA_TOKEN
5
+ isl = dj.create_island(repo="git@github.com:you/foo.git", agent="claude-code")
6
+ print(dj.list_islands())
7
+
8
+ See https://aoos.github.io/dejima/api.html for the full API. Dejima is alpha
9
+ (0.x): fields may change until 1.0. This client is hand-written over the REST
10
+ surface; the WebSocket PTY session (``Client.attach`` → ``Session``) needs the
11
+ ``ws`` extra: ``pip install 'dejima[ws]'``.
12
+ """
13
+
14
+ from .client import Client, DejimaError, Session
15
+
16
+ __all__ = ["Client", "DejimaError", "Session", "__version__"]
17
+ __version__ = "0.5.2"