msdev 0.9.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.
- msdev-0.9.0/PKG-INFO +295 -0
- msdev-0.9.0/README.md +286 -0
- msdev-0.9.0/pyproject.toml +28 -0
- msdev-0.9.0/setup.cfg +4 -0
- msdev-0.9.0/src/msdev/__init__.py +3 -0
- msdev-0.9.0/src/msdev/cli.py +1460 -0
- msdev-0.9.0/src/msdev/core/__init__.py +1 -0
- msdev-0.9.0/src/msdev/core/config.py +193 -0
- msdev-0.9.0/src/msdev/core/guides.py +100 -0
- msdev-0.9.0/src/msdev/core/inventory.py +1390 -0
- msdev-0.9.0/src/msdev/core/limits.py +44 -0
- msdev-0.9.0/src/msdev/core/resources.py +300 -0
- msdev-0.9.0/src/msdev/core/services/__init__.py +111 -0
- msdev-0.9.0/src/msdev/core/services/context.py +61 -0
- msdev-0.9.0/src/msdev/core/services/environment.py +84 -0
- msdev-0.9.0/src/msdev/core/services/execution.py +136 -0
- msdev-0.9.0/src/msdev/core/services/model.py +1085 -0
- msdev-0.9.0/src/msdev/core/services/node.py +210 -0
- msdev-0.9.0/src/msdev/core/services/npu.py +116 -0
- msdev-0.9.0/src/msdev/core/services/workspace.py +567 -0
- msdev-0.9.0/src/msdev/core/transport.py +1225 -0
- msdev-0.9.0/src/msdev/core/workspace/__init__.py +36 -0
- msdev-0.9.0/src/msdev/core/workspace/access.py +1216 -0
- msdev-0.9.0/src/msdev/core/workspace/client.py +274 -0
- msdev-0.9.0/src/msdev/core/workspace/paths.py +45 -0
- msdev-0.9.0/src/msdev/core/workspace/registry.py +151 -0
- msdev-0.9.0/src/msdev/daemon.py +1322 -0
- msdev-0.9.0/src/msdev/session/__init__.py +13 -0
- msdev-0.9.0/src/msdev/session/export.py +190 -0
- msdev-0.9.0/src/msdev/session/log.py +269 -0
- msdev-0.9.0/src/msdev.egg-info/PKG-INFO +295 -0
- msdev-0.9.0/src/msdev.egg-info/SOURCES.txt +50 -0
- msdev-0.9.0/src/msdev.egg-info/dependency_links.txt +1 -0
- msdev-0.9.0/src/msdev.egg-info/entry_points.txt +3 -0
- msdev-0.9.0/src/msdev.egg-info/top_level.txt +1 -0
- msdev-0.9.0/tests/test_cli.py +875 -0
- msdev-0.9.0/tests/test_cli_only_architecture.py +93 -0
- msdev-0.9.0/tests/test_cli_session.py +202 -0
- msdev-0.9.0/tests/test_config.py +218 -0
- msdev-0.9.0/tests/test_daemon.py +993 -0
- msdev-0.9.0/tests/test_inventory.py +559 -0
- msdev-0.9.0/tests/test_model_cli.py +364 -0
- msdev-0.9.0/tests/test_model_services.py +1357 -0
- msdev-0.9.0/tests/test_msdev_cli_skill.py +117 -0
- msdev-0.9.0/tests/test_node_env_config.py +134 -0
- msdev-0.9.0/tests/test_node_env_services.py +63 -0
- msdev-0.9.0/tests/test_node_execution_services.py +451 -0
- msdev-0.9.0/tests/test_resource_guides.py +66 -0
- msdev-0.9.0/tests/test_transport.py +1070 -0
- msdev-0.9.0/tests/test_workspace.py +837 -0
- msdev-0.9.0/tests/test_workspace_client.py +335 -0
- msdev-0.9.0/tests/test_workspace_services.py +414 -0
msdev-0.9.0/PKG-INFO
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: msdev
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Portable nodes and execution environments for msModelSlim development
|
|
5
|
+
Author: msModelSlim Agent Contributors
|
|
6
|
+
License: MulanPSL-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# msdev
|
|
11
|
+
|
|
12
|
+
`msdev` manages connection Nodes and execution Envs. A Node owns SSH and its
|
|
13
|
+
per-user `msdevd`; an Env references a Node and adds a host/Docker runtime plus
|
|
14
|
+
optional conda/venv/uv layers.
|
|
15
|
+
|
|
16
|
+
The CLI is intentionally stateless:
|
|
17
|
+
|
|
18
|
+
- Node-scoped NPU/model operations name `--node` or use `--all`;
|
|
19
|
+
- execution names `--env`;
|
|
20
|
+
- every workspace operation names the registered workspace;
|
|
21
|
+
- no harness conversation binding or implicit current Env exists;
|
|
22
|
+
- MCP is not part of the architecture.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python3 -m pip install -e tools/msdev
|
|
28
|
+
msdev --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The package installs `msdev` and `msdevd`.
|
|
32
|
+
|
|
33
|
+
## Nodes and execution environments
|
|
34
|
+
|
|
35
|
+
Register a host from `~/.ssh/config`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
msdev node add dev-122 --ssh-host dev-122
|
|
39
|
+
msdev node list
|
|
40
|
+
msdev node status dev-122
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Adding a Node atomically creates a same-named host Env. Bootstrap or refresh
|
|
44
|
+
the remote user daemon:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
msdev node bootstrap dev-122
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Configure persistent variables inherited by host-side child processes,
|
|
51
|
+
including `exec`, `env shell`, NPU queries, and workspace Git commands:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
msdev node env dev-122 --set LD_LIBRARY_PATH=/opt/driver/lib
|
|
55
|
+
msdev node env dev-122
|
|
56
|
+
msdev node env dev-122 --unset LD_LIBRARY_PATH
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Node variables apply only to the host runtime; Docker Envs do not inherit host
|
|
60
|
+
paths. Per-command `exec --env-var` values take precedence. Variable names and
|
|
61
|
+
values are stored in the private local resource registry, so use a dedicated
|
|
62
|
+
secret mechanism rather than this feature for credentials.
|
|
63
|
+
|
|
64
|
+
Persistent OpenSSH masters are optional:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
msdev node connect dev-122
|
|
68
|
+
msdev node disconnect dev-122
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For a server available only through a browser terminal, see
|
|
72
|
+
[Rootless web terminal access](docs/rootless-web-terminal-access.md). It covers
|
|
73
|
+
a rootless SSH daemon, a domestic reverse tunnel, WSL Fake-IP routing, host-key
|
|
74
|
+
verification, and the errors found during a real setup. Direct SSH in that
|
|
75
|
+
guide is a human connectivity bootstrap step; agent operations must still use
|
|
76
|
+
explicit `msdev` resources and must not bypass the CLI with SSH or SCP.
|
|
77
|
+
|
|
78
|
+
Nodes and Envs have separate private Markdown guides:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
msdev node guide dev-122
|
|
82
|
+
msdev node guide dev-122 --write ./dev-122-guide.md
|
|
83
|
+
msdev env guide dev-122
|
|
84
|
+
msdev env guide dev-122 --write ./host-env-guide.md
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Guides are stored under `~/.config/msdev/guides/nodes/` and
|
|
88
|
+
`~/.config/msdev/guides/environments/`, with private permissions and a 256 KiB
|
|
89
|
+
limit. Agents read the applicable guides once before first use in a session.
|
|
90
|
+
|
|
91
|
+
Open a human-operated interactive shell in an Env:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
msdev env shell dev-122
|
|
95
|
+
msdev env shell dev-122 --cwd /srv/project
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The command allocates an OpenSSH PTY and enters the Env's Docker runtime and
|
|
99
|
+
conda/venv/uv layers. Exiting returns
|
|
100
|
+
to the local shell. Only the shell session start and final status are visible
|
|
101
|
+
to msdev; commands typed inside it are not individually logged. Agent
|
|
102
|
+
automation should continue using `msdev exec`.
|
|
103
|
+
|
|
104
|
+
Create another Env on the same Node for Docker and Python layers:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
msdev env add dev-122-vllm \
|
|
108
|
+
--node dev-122 \
|
|
109
|
+
--docker-container vllm-ascend \
|
|
110
|
+
--layer conda:base \
|
|
111
|
+
--layer venv:/srv/project/.venv
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## NPU inventory
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
msdev npu list --node dev-122 --json
|
|
118
|
+
msdev npu list --all --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Command execution
|
|
122
|
+
|
|
123
|
+
Commands execute synchronously and stream stdout and stderr to the terminal as
|
|
124
|
+
they are produced. Cursor or Claude Code should use their native background
|
|
125
|
+
terminal support for long jobs. Long jobs may also write a persistent progress
|
|
126
|
+
log when later inspection is required.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
msdev exec \
|
|
130
|
+
--env dev-122 \
|
|
131
|
+
--cwd /srv/project \
|
|
132
|
+
--timeout-seconds 1800 \
|
|
133
|
+
--env-var MODE=test \
|
|
134
|
+
-- python3 run.py
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`--timeout-seconds` defaults to 300, accepts any positive finite duration, and
|
|
138
|
+
uses `-1` for no deadline. A positive timeout kills the complete command
|
|
139
|
+
process group and returns exit code 124. Cancelling the local CLI closes the RPC
|
|
140
|
+
connection, causing `msdevd` to kill and reap the remote process group. Finite
|
|
141
|
+
SSH/Unix RPC deadlines include a short completion grace for output drain and
|
|
142
|
+
serialization.
|
|
143
|
+
|
|
144
|
+
`--result-json` selects captured, non-streaming execution and prints one
|
|
145
|
+
structured JSON result containing stdout and stderr.
|
|
146
|
+
|
|
147
|
+
## Remote workspaces
|
|
148
|
+
|
|
149
|
+
A workspace gives a stable name to an Env and filesystem root:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
msdev workspace add project \
|
|
153
|
+
--env dev-122 \
|
|
154
|
+
--root /srv/project
|
|
155
|
+
|
|
156
|
+
msdev workspace list
|
|
157
|
+
msdev workspace inspect project
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Workspace operations are file- and Git-oriented. There is no
|
|
161
|
+
`msdev workspace exec`; use `msdev exec --env ... --cwd ...` for commands.
|
|
162
|
+
|
|
163
|
+
### Read and inspect
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
msdev workspace stat project README.md
|
|
167
|
+
msdev workspace read project README.md
|
|
168
|
+
msdev workspace read project weights.bin --output /tmp/weights.bin
|
|
169
|
+
msdev workspace list project src --json
|
|
170
|
+
msdev workspace glob project '**/*.py' --json
|
|
171
|
+
msdev workspace search project 'TODO' src tests --json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Write safely
|
|
175
|
+
|
|
176
|
+
For non-trivial content, use stdin or `--file` rather than shell-escaped
|
|
177
|
+
`--content`:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
msdev workspace write project docs/note.md < /tmp/note.md
|
|
181
|
+
msdev workspace write project docs/note.md --file /tmp/note.md
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Compare-and-swap replacement prevents overwriting a changed remote file:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
msdev workspace apply-patch project docs/note.md \
|
|
188
|
+
--file /tmp/note.md \
|
|
189
|
+
--expected-sha256 <digest>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Delete an explicit remote file:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
msdev workspace delete project docs/obsolete.md
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Git
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
msdev workspace git-status project --result-json
|
|
202
|
+
msdev workspace git-diff --result-json project -- --stat
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Git diff rejects options that can write files or invoke external diff helpers.
|
|
206
|
+
|
|
207
|
+
## Model inventory
|
|
208
|
+
|
|
209
|
+
Examples:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
msdev model discover --node dev-122 --root /data/models
|
|
213
|
+
msdev model list --node dev-122 --json
|
|
214
|
+
msdev model list --all --json
|
|
215
|
+
msdev model inspect model://qwen/Qwen3-32B@main --node dev-122
|
|
216
|
+
msdev model validate model://qwen/Qwen3-32B@main --node dev-122
|
|
217
|
+
msdev model audit --node dev-122
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Use `msdev model --help` and the individual subcommand help for register,
|
|
221
|
+
update, replicas, refresh, verify, export, import, and rebind.
|
|
222
|
+
|
|
223
|
+
## Explicit CLI sessions and runbooks
|
|
224
|
+
|
|
225
|
+
Create a session before a reproducible workflow:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
msdev session begin --name qwen3-quant --json
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Pass the returned ID explicitly or set it in a persistent terminal:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
export MSDEV_SESSION_ID=<session-id>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Intent metadata is global and must appear before the subcommand:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
msdev \
|
|
241
|
+
--session-id <session-id> \
|
|
242
|
+
--intent-kind execution \
|
|
243
|
+
--intent-summary 'Run Qwen3 quantization' \
|
|
244
|
+
--intent-phase quantization \
|
|
245
|
+
--intent-step-id quant-1 \
|
|
246
|
+
exec --env dev-122 --timeout-seconds 1800 -- python3 quant.py
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Intent kinds:
|
|
250
|
+
|
|
251
|
+
- `execution`: core reproduction step;
|
|
252
|
+
- `verification`: optional confirmation;
|
|
253
|
+
- `diagnostic`: troubleshooting, excluded from core steps;
|
|
254
|
+
- `exploration`: discovery, excluded from core steps.
|
|
255
|
+
|
|
256
|
+
Each invocation receives a unique `operation_id`. `session_id` groups CLI
|
|
257
|
+
operations only; it never supplies a Node, Env, or workspace default.
|
|
258
|
+
|
|
259
|
+
Logs are private JSONL files under:
|
|
260
|
+
|
|
261
|
+
```text
|
|
262
|
+
${XDG_STATE_HOME:-~/.local/state}/msdev/sessions/
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
They retain sanitized logical arguments, preview, explicit resource, intent,
|
|
266
|
+
exit code, and elapsed time. Command stdout/stderr and environment values are
|
|
267
|
+
not duplicated into logs.
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
msdev session list
|
|
271
|
+
msdev session export --session-id <session-id> --output runbook.md
|
|
272
|
+
msdev session export --latest --detail normal --output runbook.md
|
|
273
|
+
msdev session export --input /path/to/session.jsonl --detail full
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Architecture
|
|
277
|
+
|
|
278
|
+
```text
|
|
279
|
+
msdev CLI
|
|
280
|
+
-> typed core service
|
|
281
|
+
-> UnixRpcTransport or SshRpcTransport
|
|
282
|
+
-> per-user msdevd
|
|
283
|
+
-> host/container command, workspace filesystem, NPU, or inventory
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Remote RPC responses and command output are bounded. Workspace paths are
|
|
287
|
+
normalized under the registered root. Writes are atomic and support SHA-256
|
|
288
|
+
compare-and-swap. Node/Env and workspace registries use locked atomic updates.
|
|
289
|
+
|
|
290
|
+
## Testing
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
cd tools/msdev
|
|
294
|
+
python3 -m unittest discover -s tests -v
|
|
295
|
+
```
|
msdev-0.9.0/README.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# msdev
|
|
2
|
+
|
|
3
|
+
`msdev` manages connection Nodes and execution Envs. A Node owns SSH and its
|
|
4
|
+
per-user `msdevd`; an Env references a Node and adds a host/Docker runtime plus
|
|
5
|
+
optional conda/venv/uv layers.
|
|
6
|
+
|
|
7
|
+
The CLI is intentionally stateless:
|
|
8
|
+
|
|
9
|
+
- Node-scoped NPU/model operations name `--node` or use `--all`;
|
|
10
|
+
- execution names `--env`;
|
|
11
|
+
- every workspace operation names the registered workspace;
|
|
12
|
+
- no harness conversation binding or implicit current Env exists;
|
|
13
|
+
- MCP is not part of the architecture.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 -m pip install -e tools/msdev
|
|
19
|
+
msdev --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The package installs `msdev` and `msdevd`.
|
|
23
|
+
|
|
24
|
+
## Nodes and execution environments
|
|
25
|
+
|
|
26
|
+
Register a host from `~/.ssh/config`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
msdev node add dev-122 --ssh-host dev-122
|
|
30
|
+
msdev node list
|
|
31
|
+
msdev node status dev-122
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Adding a Node atomically creates a same-named host Env. Bootstrap or refresh
|
|
35
|
+
the remote user daemon:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
msdev node bootstrap dev-122
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Configure persistent variables inherited by host-side child processes,
|
|
42
|
+
including `exec`, `env shell`, NPU queries, and workspace Git commands:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
msdev node env dev-122 --set LD_LIBRARY_PATH=/opt/driver/lib
|
|
46
|
+
msdev node env dev-122
|
|
47
|
+
msdev node env dev-122 --unset LD_LIBRARY_PATH
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Node variables apply only to the host runtime; Docker Envs do not inherit host
|
|
51
|
+
paths. Per-command `exec --env-var` values take precedence. Variable names and
|
|
52
|
+
values are stored in the private local resource registry, so use a dedicated
|
|
53
|
+
secret mechanism rather than this feature for credentials.
|
|
54
|
+
|
|
55
|
+
Persistent OpenSSH masters are optional:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
msdev node connect dev-122
|
|
59
|
+
msdev node disconnect dev-122
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For a server available only through a browser terminal, see
|
|
63
|
+
[Rootless web terminal access](docs/rootless-web-terminal-access.md). It covers
|
|
64
|
+
a rootless SSH daemon, a domestic reverse tunnel, WSL Fake-IP routing, host-key
|
|
65
|
+
verification, and the errors found during a real setup. Direct SSH in that
|
|
66
|
+
guide is a human connectivity bootstrap step; agent operations must still use
|
|
67
|
+
explicit `msdev` resources and must not bypass the CLI with SSH or SCP.
|
|
68
|
+
|
|
69
|
+
Nodes and Envs have separate private Markdown guides:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
msdev node guide dev-122
|
|
73
|
+
msdev node guide dev-122 --write ./dev-122-guide.md
|
|
74
|
+
msdev env guide dev-122
|
|
75
|
+
msdev env guide dev-122 --write ./host-env-guide.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Guides are stored under `~/.config/msdev/guides/nodes/` and
|
|
79
|
+
`~/.config/msdev/guides/environments/`, with private permissions and a 256 KiB
|
|
80
|
+
limit. Agents read the applicable guides once before first use in a session.
|
|
81
|
+
|
|
82
|
+
Open a human-operated interactive shell in an Env:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
msdev env shell dev-122
|
|
86
|
+
msdev env shell dev-122 --cwd /srv/project
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The command allocates an OpenSSH PTY and enters the Env's Docker runtime and
|
|
90
|
+
conda/venv/uv layers. Exiting returns
|
|
91
|
+
to the local shell. Only the shell session start and final status are visible
|
|
92
|
+
to msdev; commands typed inside it are not individually logged. Agent
|
|
93
|
+
automation should continue using `msdev exec`.
|
|
94
|
+
|
|
95
|
+
Create another Env on the same Node for Docker and Python layers:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
msdev env add dev-122-vllm \
|
|
99
|
+
--node dev-122 \
|
|
100
|
+
--docker-container vllm-ascend \
|
|
101
|
+
--layer conda:base \
|
|
102
|
+
--layer venv:/srv/project/.venv
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## NPU inventory
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
msdev npu list --node dev-122 --json
|
|
109
|
+
msdev npu list --all --json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Command execution
|
|
113
|
+
|
|
114
|
+
Commands execute synchronously and stream stdout and stderr to the terminal as
|
|
115
|
+
they are produced. Cursor or Claude Code should use their native background
|
|
116
|
+
terminal support for long jobs. Long jobs may also write a persistent progress
|
|
117
|
+
log when later inspection is required.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
msdev exec \
|
|
121
|
+
--env dev-122 \
|
|
122
|
+
--cwd /srv/project \
|
|
123
|
+
--timeout-seconds 1800 \
|
|
124
|
+
--env-var MODE=test \
|
|
125
|
+
-- python3 run.py
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`--timeout-seconds` defaults to 300, accepts any positive finite duration, and
|
|
129
|
+
uses `-1` for no deadline. A positive timeout kills the complete command
|
|
130
|
+
process group and returns exit code 124. Cancelling the local CLI closes the RPC
|
|
131
|
+
connection, causing `msdevd` to kill and reap the remote process group. Finite
|
|
132
|
+
SSH/Unix RPC deadlines include a short completion grace for output drain and
|
|
133
|
+
serialization.
|
|
134
|
+
|
|
135
|
+
`--result-json` selects captured, non-streaming execution and prints one
|
|
136
|
+
structured JSON result containing stdout and stderr.
|
|
137
|
+
|
|
138
|
+
## Remote workspaces
|
|
139
|
+
|
|
140
|
+
A workspace gives a stable name to an Env and filesystem root:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
msdev workspace add project \
|
|
144
|
+
--env dev-122 \
|
|
145
|
+
--root /srv/project
|
|
146
|
+
|
|
147
|
+
msdev workspace list
|
|
148
|
+
msdev workspace inspect project
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Workspace operations are file- and Git-oriented. There is no
|
|
152
|
+
`msdev workspace exec`; use `msdev exec --env ... --cwd ...` for commands.
|
|
153
|
+
|
|
154
|
+
### Read and inspect
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
msdev workspace stat project README.md
|
|
158
|
+
msdev workspace read project README.md
|
|
159
|
+
msdev workspace read project weights.bin --output /tmp/weights.bin
|
|
160
|
+
msdev workspace list project src --json
|
|
161
|
+
msdev workspace glob project '**/*.py' --json
|
|
162
|
+
msdev workspace search project 'TODO' src tests --json
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Write safely
|
|
166
|
+
|
|
167
|
+
For non-trivial content, use stdin or `--file` rather than shell-escaped
|
|
168
|
+
`--content`:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
msdev workspace write project docs/note.md < /tmp/note.md
|
|
172
|
+
msdev workspace write project docs/note.md --file /tmp/note.md
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Compare-and-swap replacement prevents overwriting a changed remote file:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
msdev workspace apply-patch project docs/note.md \
|
|
179
|
+
--file /tmp/note.md \
|
|
180
|
+
--expected-sha256 <digest>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Delete an explicit remote file:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
msdev workspace delete project docs/obsolete.md
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Git
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
msdev workspace git-status project --result-json
|
|
193
|
+
msdev workspace git-diff --result-json project -- --stat
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Git diff rejects options that can write files or invoke external diff helpers.
|
|
197
|
+
|
|
198
|
+
## Model inventory
|
|
199
|
+
|
|
200
|
+
Examples:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
msdev model discover --node dev-122 --root /data/models
|
|
204
|
+
msdev model list --node dev-122 --json
|
|
205
|
+
msdev model list --all --json
|
|
206
|
+
msdev model inspect model://qwen/Qwen3-32B@main --node dev-122
|
|
207
|
+
msdev model validate model://qwen/Qwen3-32B@main --node dev-122
|
|
208
|
+
msdev model audit --node dev-122
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use `msdev model --help` and the individual subcommand help for register,
|
|
212
|
+
update, replicas, refresh, verify, export, import, and rebind.
|
|
213
|
+
|
|
214
|
+
## Explicit CLI sessions and runbooks
|
|
215
|
+
|
|
216
|
+
Create a session before a reproducible workflow:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
msdev session begin --name qwen3-quant --json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Pass the returned ID explicitly or set it in a persistent terminal:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
export MSDEV_SESSION_ID=<session-id>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Intent metadata is global and must appear before the subcommand:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
msdev \
|
|
232
|
+
--session-id <session-id> \
|
|
233
|
+
--intent-kind execution \
|
|
234
|
+
--intent-summary 'Run Qwen3 quantization' \
|
|
235
|
+
--intent-phase quantization \
|
|
236
|
+
--intent-step-id quant-1 \
|
|
237
|
+
exec --env dev-122 --timeout-seconds 1800 -- python3 quant.py
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Intent kinds:
|
|
241
|
+
|
|
242
|
+
- `execution`: core reproduction step;
|
|
243
|
+
- `verification`: optional confirmation;
|
|
244
|
+
- `diagnostic`: troubleshooting, excluded from core steps;
|
|
245
|
+
- `exploration`: discovery, excluded from core steps.
|
|
246
|
+
|
|
247
|
+
Each invocation receives a unique `operation_id`. `session_id` groups CLI
|
|
248
|
+
operations only; it never supplies a Node, Env, or workspace default.
|
|
249
|
+
|
|
250
|
+
Logs are private JSONL files under:
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
${XDG_STATE_HOME:-~/.local/state}/msdev/sessions/
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
They retain sanitized logical arguments, preview, explicit resource, intent,
|
|
257
|
+
exit code, and elapsed time. Command stdout/stderr and environment values are
|
|
258
|
+
not duplicated into logs.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
msdev session list
|
|
262
|
+
msdev session export --session-id <session-id> --output runbook.md
|
|
263
|
+
msdev session export --latest --detail normal --output runbook.md
|
|
264
|
+
msdev session export --input /path/to/session.jsonl --detail full
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Architecture
|
|
268
|
+
|
|
269
|
+
```text
|
|
270
|
+
msdev CLI
|
|
271
|
+
-> typed core service
|
|
272
|
+
-> UnixRpcTransport or SshRpcTransport
|
|
273
|
+
-> per-user msdevd
|
|
274
|
+
-> host/container command, workspace filesystem, NPU, or inventory
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Remote RPC responses and command output are bounded. Workspace paths are
|
|
278
|
+
normalized under the registered root. Writes are atomic and support SHA-256
|
|
279
|
+
compare-and-swap. Node/Env and workspace registries use locked atomic updates.
|
|
280
|
+
|
|
281
|
+
## Testing
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
cd tools/msdev
|
|
285
|
+
python3 -m unittest discover -s tests -v
|
|
286
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "msdev"
|
|
7
|
+
version = "0.9.0"
|
|
8
|
+
description = "Portable nodes and execution environments for msModelSlim development"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MulanPSL-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "msModelSlim Agent Contributors" },
|
|
14
|
+
]
|
|
15
|
+
dependencies = []
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
msdev = "msdev.cli:main"
|
|
19
|
+
msdevd = "msdev.daemon:main"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools]
|
|
22
|
+
package-dir = { "" = "src" }
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["src"]
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
testpaths = ["tests"]
|
msdev-0.9.0/setup.cfg
ADDED