deepflow-openagent-cli 0.1.4__tar.gz → 0.1.6__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.
- deepflow_openagent_cli-0.1.6/PKG-INFO +257 -0
- deepflow_openagent_cli-0.1.6/README.md +236 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/pyproject.toml +1 -1
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli/__init__.py +1 -1
- deepflow_openagent_cli-0.1.6/src/deepflow_openagent_cli/cli.py +2455 -0
- deepflow_openagent_cli-0.1.6/src/deepflow_openagent_cli.egg-info/PKG-INFO +257 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli.egg-info/SOURCES.txt +2 -1
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/tests/test_cli.py +129 -0
- deepflow_openagent_cli-0.1.6/tests/test_cloudpc_cli.py +256 -0
- deepflow_openagent_cli-0.1.4/PKG-INFO +0 -96
- deepflow_openagent_cli-0.1.4/README.md +0 -75
- deepflow_openagent_cli-0.1.4/src/deepflow_openagent_cli/cli.py +0 -1197
- deepflow_openagent_cli-0.1.4/src/deepflow_openagent_cli.egg-info/PKG-INFO +0 -96
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/setup.cfg +0 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli/__main__.py +0 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli.egg-info/dependency_links.txt +0 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli.egg-info/entry_points.txt +0 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli.egg-info/requires.txt +0 -0
- {deepflow_openagent_cli-0.1.4 → deepflow_openagent_cli-0.1.6}/src/deepflow_openagent_cli.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepflow-openagent-cli
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Command-line client for OpenAgent OpenAPI (agents, conversations, SSE chat, tools, channels, knowledge bases).
|
|
5
|
+
Author: DeepFlow AI
|
|
6
|
+
Project-URL: Repository, https://github.com/DeepFlowAI/OpenAgent
|
|
7
|
+
Keywords: deepflow,openagent,newagent,openapi,cli,sse,chat
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
20
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
21
|
+
|
|
22
|
+
# deepflow-openagent-cli
|
|
23
|
+
|
|
24
|
+
Python command-line client for the OpenAgent OpenAPI: agents, conversations, SSE chat, tools, channels, documents, and knowledge bases.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install deepflow-openagent-cli
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export OPENAGENT_HOST="https://your-api-host"
|
|
36
|
+
export OPENAGENT_API_KEY="sk-..."
|
|
37
|
+
deepflow_openagent_cli docs list
|
|
38
|
+
deepflow_openagent_cli agents list
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Equivalent module invocation:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python -m deepflow_openagent_cli docs list
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configure API host and key
|
|
48
|
+
|
|
49
|
+
| Method | Variable / flag |
|
|
50
|
+
|--------|------------------|
|
|
51
|
+
| Host | `OPENAGENT_HOST` or `--host` |
|
|
52
|
+
| API key | `OPENAGENT_API_KEY` or `--api-key` |
|
|
53
|
+
|
|
54
|
+
Legacy `NEWAGENT_HOST` and `NEWAGENT_API_KEY` are still read as fallbacks.
|
|
55
|
+
|
|
56
|
+
When using flags, put global flags before the command:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
deepflow_openagent_cli --host http://localhost:5001 --api-key sk-... agents list
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Common commands
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
deepflow_openagent_cli docs show chat.stream --json
|
|
66
|
+
deepflow_openagent_cli knowledge list --page 1 --per-page 10
|
|
67
|
+
deepflow_openagent_cli knowledge documents 1
|
|
68
|
+
deepflow_openagent_cli knowledge query-document 6670 --slice-id 512208 --line 1720
|
|
69
|
+
|
|
70
|
+
# Knowledge-base file library (requires config scope)
|
|
71
|
+
deepflow_openagent_cli knowledge directories create 1 --name "Policies"
|
|
72
|
+
deepflow_openagent_cli knowledge files create 1 \
|
|
73
|
+
--directory-id 2 --name "Product Manual" --custom-version v1 \
|
|
74
|
+
--original ./manual.pdf --markdown ./manual.md
|
|
75
|
+
deepflow_openagent_cli knowledge files list 1 --markdown-filter has-missing
|
|
76
|
+
deepflow_openagent_cli knowledge versions upload 1 3 \
|
|
77
|
+
--custom-version v2 --original ./manual-v2.pdf
|
|
78
|
+
deepflow_openagent_cli knowledge versions attach-markdown 1 3 4 \
|
|
79
|
+
--markdown ./manual-v2.md
|
|
80
|
+
deepflow_openagent_cli knowledge versions set-current 1 3 4
|
|
81
|
+
deepflow_openagent_cli knowledge versions original 1 3 4 --output ./manual-v2.pdf
|
|
82
|
+
deepflow_openagent_cli knowledge versions markdown 1 3 4 --output ./manual-v2.md
|
|
83
|
+
|
|
84
|
+
deepflow_openagent_cli chat 1 --message "Hello"
|
|
85
|
+
deepflow_openagent_cli steps 1 42
|
|
86
|
+
deepflow_openagent_cli steps get 1 42 100
|
|
87
|
+
deepflow_openagent_cli steps feedback 1 42 100 --rating like --comment "Helpful answer"
|
|
88
|
+
|
|
89
|
+
# Python code tool (create → update config → debug execute)
|
|
90
|
+
deepflow_openagent_cli tools create 1 --name order_query --tool-type python_code
|
|
91
|
+
deepflow_openagent_cli tools update 1 2 --json '{"config":{"code":"import openagent\nopenagent.set_output(openagent.args)","parameters_json":"{\"type\":\"object\",\"properties\":{\"order_id\":{\"type\":\"string\"}},\"required\":[\"order_id\"]}"}}'
|
|
92
|
+
deepflow_openagent_cli tools execute 1 2 --json '{"brief":"查订单","order_id":"A1"}'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development (build wheel/sdist locally)
|
|
96
|
+
|
|
97
|
+
From this directory:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install -e ".[dev]"
|
|
101
|
+
pytest
|
|
102
|
+
python -m build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Upload to PyPI (use a **new** API token; never commit tokens):
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
python -m twine upload dist/*
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
When prompted, username is `__token__` and password is the token value.
|
|
112
|
+
|
|
113
|
+
## Cloud PC management
|
|
114
|
+
|
|
115
|
+
Requires a tenant API key with **config** scope and Cloud PC enabled. Global
|
|
116
|
+
options (`--host`, `--api-key`, `--raw`, `--no-pretty`) go before the command.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
deepflow_openagent_cli cloudpc capability
|
|
120
|
+
deepflow_openagent_cli agents list --kind cloudpc
|
|
121
|
+
deepflow_openagent_cli agents get 123
|
|
122
|
+
deepflow_openagent_cli cloudpc config get 123
|
|
123
|
+
deepflow_openagent_cli cloudpc versions list 123
|
|
124
|
+
|
|
125
|
+
# Create from the newest saved snapshot (not necessarily the published version).
|
|
126
|
+
# Other explicit sources: published, base, or a numeric version ID.
|
|
127
|
+
deepflow_openagent_cli cloudpc dev create 123 --from latest
|
|
128
|
+
deepflow_openagent_cli cloudpc dev get 123
|
|
129
|
+
deepflow_openagent_cli cloudpc files tree 123
|
|
130
|
+
deepflow_openagent_cli cloudpc files read 123 \
|
|
131
|
+
--path .agents/skills/demo/SKILL.md --output ./SKILL.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`files read --output` saves exact UTF-8 content and prints metadata including
|
|
135
|
+
`sha256`. After editing the local file, pass that **original remote hash** to
|
|
136
|
+
reject an intervening change:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
deepflow_openagent_cli cloudpc files write 123 \
|
|
140
|
+
--path .agents/skills/demo/SKILL.md --file ./SKILL.md \
|
|
141
|
+
--if-match <SHA256_FROM_READ>
|
|
142
|
+
deepflow_openagent_cli cloudpc versions save 123 \
|
|
143
|
+
--version 1.0.2 --remark "Update skill"
|
|
144
|
+
deepflow_openagent_cli cloudpc versions publish 123 <SAVED_VERSION_ID>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Replace the angle-bracket placeholders with actual values before executing.
|
|
148
|
+
Omitting `--if-match` performs an unconditional write; `--file -` reads UTF-8
|
|
149
|
+
from stdin. `--raw cloudpc files read ...` prints only file content, with no
|
|
150
|
+
added newline. Text reads default to a 1 MiB limit; binary/oversized files
|
|
151
|
+
produce a nonzero exit code instead of writing an empty local file.
|
|
152
|
+
|
|
153
|
+
Files always belong to the **running development sandbox**, under
|
|
154
|
+
`/workspace/agent`. They can differ from both saved and published versions.
|
|
155
|
+
An existing development sandbox is never automatically replaced. Save needed
|
|
156
|
+
changes before explicitly destroying it. `latest` / `published` fail if the
|
|
157
|
+
selected version does not exist; use `--from base` for a fresh environment.
|
|
158
|
+
Version ID is different from the `x.y.z` version label. First save automatically
|
|
159
|
+
publishes; later saves require a separate `versions publish` command.
|
|
160
|
+
|
|
161
|
+
Additional operations:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
deepflow_openagent_cli cloudpc create --name "Assistant"
|
|
165
|
+
deepflow_openagent_cli cloudpc config update 123 --json-file ./config.json
|
|
166
|
+
deepflow_openagent_cli cloudpc dev pause 123
|
|
167
|
+
deepflow_openagent_cli cloudpc dev resume 123
|
|
168
|
+
deepflow_openagent_cli cloudpc files mkdir 123 --path skills/demo
|
|
169
|
+
deepflow_openagent_cli cloudpc files rename 123 --src old.md --dst new.md
|
|
170
|
+
deepflow_openagent_cli cloudpc files delete 123 --path old.md
|
|
171
|
+
deepflow_openagent_cli cloudpc dev destroy 123
|
|
172
|
+
deepflow_openagent_cli docs show cloudpc.files.write --json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Config update replaces configuration: provide `model_name`, `thinking_enabled`
|
|
176
|
+
and the complete `env_vars` list; omitted thinking/env fields reset to defaults.
|
|
177
|
+
Config queries include environment variable values. File mutation and snapshot
|
|
178
|
+
operations share the per-agent management lock; direct writes by the sandbox's
|
|
179
|
+
Agent or terminal are outside that lock. Cloud PC HTTP requests have a 900-second
|
|
180
|
+
timeout and are not automatically retried. After a timeout, inspect sandbox or
|
|
181
|
+
version state before retrying a mutation. Conversation logs and chat-control
|
|
182
|
+
routes still require an administrator session.
|
|
183
|
+
|
|
184
|
+
### Execute commands and talk to the development Agent
|
|
185
|
+
|
|
186
|
+
Both commands require **config** scope and an existing development sandbox.
|
|
187
|
+
`exec` requires it to be running; Agent chat can resume a paused sandbox.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Install and verify a library inside the development sandbox.
|
|
191
|
+
deepflow_openagent_cli cloudpc dev exec 123 \
|
|
192
|
+
--command "python3 -m pip install pandas" --timeout 600
|
|
193
|
+
deepflow_openagent_cli cloudpc dev exec 123 \
|
|
194
|
+
--command "python3 -c 'import pandas; print(pandas.__version__)'"
|
|
195
|
+
|
|
196
|
+
# Ask the same built-in Agent used by the web development workbench.
|
|
197
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
198
|
+
--message "Install pandas, verify import, and update the dependency declaration"
|
|
199
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
200
|
+
--conversation-id 456 --message "Also verify CSV parsing with a small example"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Commands run through `/bin/bash -lc`, without a PTY or interactive stdin. `--cwd`
|
|
204
|
+
is relative to `/workspace/agent` (default `.`). Agent-configured environment
|
|
205
|
+
variables are passed to the command. `--timeout` defaults to 600 seconds and
|
|
206
|
+
accepts 1–7200. stdout/stderr are shown separately; the CLI returns the remote
|
|
207
|
+
exit code (130 for cancellation, 124 for timeout). Ctrl+C requests remote
|
|
208
|
+
cancellation, killing the command process group and its ordinary descendants.
|
|
209
|
+
Background daemons are not supported. The group leader also stops the command
|
|
210
|
+
if its owning bridge dies.
|
|
211
|
+
|
|
212
|
+
Each command prints `execution_id` to stderr **before submission**. Network
|
|
213
|
+
loss does not restart or cancel it. Use that ID to inspect, attach, or stop:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
deepflow_openagent_cli cloudpc dev exec-status 123 EXECUTION_ID
|
|
217
|
+
deepflow_openagent_cli cloudpc dev exec-attach 123 EXECUTION_ID --after 12
|
|
218
|
+
deepflow_openagent_cli cloudpc dev exec-stop 123 EXECUTION_ID
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
`--after` is the last received output cursor (default 0 replays retained output).
|
|
222
|
+
Use `--execution-id` on `exec` to supply a stable ID: identical submissions return
|
|
223
|
+
the same retained execution; reusing an ID with different inputs is rejected.
|
|
224
|
+
The sandbox retains 32 recent executions and at most 1 MiB / 4096 output events
|
|
225
|
+
per execution. Runtime restart or eviction loses these records; attach reports
|
|
226
|
+
an error and never runs the command again. IDs refer to the current development
|
|
227
|
+
sandbox, not to a destroyed/replaced one.
|
|
228
|
+
|
|
229
|
+
Agent chat prints `client_message_id` and `conversation_id` to stderr. Reply text
|
|
230
|
+
goes to stdout, tool activity to stderr; `--json-events` emits structured NDJSON
|
|
231
|
+
with SSE event IDs. To reconnect to the original task without submitting it again:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
235
|
+
--attach --client-message-id ROUND_ID --conversation-id 456 \
|
|
236
|
+
--last-event-id r1-e12
|
|
237
|
+
deepflow_openagent_cli cloudpc dev chat-stop 123 \
|
|
238
|
+
--client-message-id ROUND_ID --conversation-id 456
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`--last-event-id` is optional; omit it to replay available buffered events.
|
|
242
|
+
Ctrl+C sends `chat-stop`. A lost HTTP connection leaves the detached task running;
|
|
243
|
+
`--attach` only subscribes, and fails if its retained task is unavailable. Include
|
|
244
|
+
the conversation ID when stopping after an API-worker restart so the remote Pi
|
|
245
|
+
round can also be stopped. SSE errors, failed/cancelled tasks, and streams ending
|
|
246
|
+
without `done` return a nonzero CLI exit code.
|
|
247
|
+
|
|
248
|
+
A development Agent round, shell command, file mutation, snapshot, pause or destroy
|
|
249
|
+
cannot overlap conflicting development work. This includes browser workbench
|
|
250
|
+
rounds and remote work surviving an API-worker restart. Ordinary file reads remain
|
|
251
|
+
available. Generic chat/conversation creation also requires config permission
|
|
252
|
+
when targeting development; normal published API chat retains chat scope.
|
|
253
|
+
|
|
254
|
+
After installation or Agent edits, use `cloudpc versions save` and optionally
|
|
255
|
+
`versions publish` to preserve and publish the environment. Deploy the updated
|
|
256
|
+
OpenAgent backend, cloudpc VM service, and bridge bundle together; update the CLI
|
|
257
|
+
package as well. No database migration is required.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# deepflow-openagent-cli
|
|
2
|
+
|
|
3
|
+
Python command-line client for the OpenAgent OpenAPI: agents, conversations, SSE chat, tools, channels, documents, and knowledge bases.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install deepflow-openagent-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
export OPENAGENT_HOST="https://your-api-host"
|
|
15
|
+
export OPENAGENT_API_KEY="sk-..."
|
|
16
|
+
deepflow_openagent_cli docs list
|
|
17
|
+
deepflow_openagent_cli agents list
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Equivalent module invocation:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -m deepflow_openagent_cli docs list
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configure API host and key
|
|
27
|
+
|
|
28
|
+
| Method | Variable / flag |
|
|
29
|
+
|--------|------------------|
|
|
30
|
+
| Host | `OPENAGENT_HOST` or `--host` |
|
|
31
|
+
| API key | `OPENAGENT_API_KEY` or `--api-key` |
|
|
32
|
+
|
|
33
|
+
Legacy `NEWAGENT_HOST` and `NEWAGENT_API_KEY` are still read as fallbacks.
|
|
34
|
+
|
|
35
|
+
When using flags, put global flags before the command:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
deepflow_openagent_cli --host http://localhost:5001 --api-key sk-... agents list
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Common commands
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
deepflow_openagent_cli docs show chat.stream --json
|
|
45
|
+
deepflow_openagent_cli knowledge list --page 1 --per-page 10
|
|
46
|
+
deepflow_openagent_cli knowledge documents 1
|
|
47
|
+
deepflow_openagent_cli knowledge query-document 6670 --slice-id 512208 --line 1720
|
|
48
|
+
|
|
49
|
+
# Knowledge-base file library (requires config scope)
|
|
50
|
+
deepflow_openagent_cli knowledge directories create 1 --name "Policies"
|
|
51
|
+
deepflow_openagent_cli knowledge files create 1 \
|
|
52
|
+
--directory-id 2 --name "Product Manual" --custom-version v1 \
|
|
53
|
+
--original ./manual.pdf --markdown ./manual.md
|
|
54
|
+
deepflow_openagent_cli knowledge files list 1 --markdown-filter has-missing
|
|
55
|
+
deepflow_openagent_cli knowledge versions upload 1 3 \
|
|
56
|
+
--custom-version v2 --original ./manual-v2.pdf
|
|
57
|
+
deepflow_openagent_cli knowledge versions attach-markdown 1 3 4 \
|
|
58
|
+
--markdown ./manual-v2.md
|
|
59
|
+
deepflow_openagent_cli knowledge versions set-current 1 3 4
|
|
60
|
+
deepflow_openagent_cli knowledge versions original 1 3 4 --output ./manual-v2.pdf
|
|
61
|
+
deepflow_openagent_cli knowledge versions markdown 1 3 4 --output ./manual-v2.md
|
|
62
|
+
|
|
63
|
+
deepflow_openagent_cli chat 1 --message "Hello"
|
|
64
|
+
deepflow_openagent_cli steps 1 42
|
|
65
|
+
deepflow_openagent_cli steps get 1 42 100
|
|
66
|
+
deepflow_openagent_cli steps feedback 1 42 100 --rating like --comment "Helpful answer"
|
|
67
|
+
|
|
68
|
+
# Python code tool (create → update config → debug execute)
|
|
69
|
+
deepflow_openagent_cli tools create 1 --name order_query --tool-type python_code
|
|
70
|
+
deepflow_openagent_cli tools update 1 2 --json '{"config":{"code":"import openagent\nopenagent.set_output(openagent.args)","parameters_json":"{\"type\":\"object\",\"properties\":{\"order_id\":{\"type\":\"string\"}},\"required\":[\"order_id\"]}"}}'
|
|
71
|
+
deepflow_openagent_cli tools execute 1 2 --json '{"brief":"查订单","order_id":"A1"}'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Development (build wheel/sdist locally)
|
|
75
|
+
|
|
76
|
+
From this directory:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install -e ".[dev]"
|
|
80
|
+
pytest
|
|
81
|
+
python -m build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Upload to PyPI (use a **new** API token; never commit tokens):
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python -m twine upload dist/*
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
When prompted, username is `__token__` and password is the token value.
|
|
91
|
+
|
|
92
|
+
## Cloud PC management
|
|
93
|
+
|
|
94
|
+
Requires a tenant API key with **config** scope and Cloud PC enabled. Global
|
|
95
|
+
options (`--host`, `--api-key`, `--raw`, `--no-pretty`) go before the command.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
deepflow_openagent_cli cloudpc capability
|
|
99
|
+
deepflow_openagent_cli agents list --kind cloudpc
|
|
100
|
+
deepflow_openagent_cli agents get 123
|
|
101
|
+
deepflow_openagent_cli cloudpc config get 123
|
|
102
|
+
deepflow_openagent_cli cloudpc versions list 123
|
|
103
|
+
|
|
104
|
+
# Create from the newest saved snapshot (not necessarily the published version).
|
|
105
|
+
# Other explicit sources: published, base, or a numeric version ID.
|
|
106
|
+
deepflow_openagent_cli cloudpc dev create 123 --from latest
|
|
107
|
+
deepflow_openagent_cli cloudpc dev get 123
|
|
108
|
+
deepflow_openagent_cli cloudpc files tree 123
|
|
109
|
+
deepflow_openagent_cli cloudpc files read 123 \
|
|
110
|
+
--path .agents/skills/demo/SKILL.md --output ./SKILL.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`files read --output` saves exact UTF-8 content and prints metadata including
|
|
114
|
+
`sha256`. After editing the local file, pass that **original remote hash** to
|
|
115
|
+
reject an intervening change:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
deepflow_openagent_cli cloudpc files write 123 \
|
|
119
|
+
--path .agents/skills/demo/SKILL.md --file ./SKILL.md \
|
|
120
|
+
--if-match <SHA256_FROM_READ>
|
|
121
|
+
deepflow_openagent_cli cloudpc versions save 123 \
|
|
122
|
+
--version 1.0.2 --remark "Update skill"
|
|
123
|
+
deepflow_openagent_cli cloudpc versions publish 123 <SAVED_VERSION_ID>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Replace the angle-bracket placeholders with actual values before executing.
|
|
127
|
+
Omitting `--if-match` performs an unconditional write; `--file -` reads UTF-8
|
|
128
|
+
from stdin. `--raw cloudpc files read ...` prints only file content, with no
|
|
129
|
+
added newline. Text reads default to a 1 MiB limit; binary/oversized files
|
|
130
|
+
produce a nonzero exit code instead of writing an empty local file.
|
|
131
|
+
|
|
132
|
+
Files always belong to the **running development sandbox**, under
|
|
133
|
+
`/workspace/agent`. They can differ from both saved and published versions.
|
|
134
|
+
An existing development sandbox is never automatically replaced. Save needed
|
|
135
|
+
changes before explicitly destroying it. `latest` / `published` fail if the
|
|
136
|
+
selected version does not exist; use `--from base` for a fresh environment.
|
|
137
|
+
Version ID is different from the `x.y.z` version label. First save automatically
|
|
138
|
+
publishes; later saves require a separate `versions publish` command.
|
|
139
|
+
|
|
140
|
+
Additional operations:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
deepflow_openagent_cli cloudpc create --name "Assistant"
|
|
144
|
+
deepflow_openagent_cli cloudpc config update 123 --json-file ./config.json
|
|
145
|
+
deepflow_openagent_cli cloudpc dev pause 123
|
|
146
|
+
deepflow_openagent_cli cloudpc dev resume 123
|
|
147
|
+
deepflow_openagent_cli cloudpc files mkdir 123 --path skills/demo
|
|
148
|
+
deepflow_openagent_cli cloudpc files rename 123 --src old.md --dst new.md
|
|
149
|
+
deepflow_openagent_cli cloudpc files delete 123 --path old.md
|
|
150
|
+
deepflow_openagent_cli cloudpc dev destroy 123
|
|
151
|
+
deepflow_openagent_cli docs show cloudpc.files.write --json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Config update replaces configuration: provide `model_name`, `thinking_enabled`
|
|
155
|
+
and the complete `env_vars` list; omitted thinking/env fields reset to defaults.
|
|
156
|
+
Config queries include environment variable values. File mutation and snapshot
|
|
157
|
+
operations share the per-agent management lock; direct writes by the sandbox's
|
|
158
|
+
Agent or terminal are outside that lock. Cloud PC HTTP requests have a 900-second
|
|
159
|
+
timeout and are not automatically retried. After a timeout, inspect sandbox or
|
|
160
|
+
version state before retrying a mutation. Conversation logs and chat-control
|
|
161
|
+
routes still require an administrator session.
|
|
162
|
+
|
|
163
|
+
### Execute commands and talk to the development Agent
|
|
164
|
+
|
|
165
|
+
Both commands require **config** scope and an existing development sandbox.
|
|
166
|
+
`exec` requires it to be running; Agent chat can resume a paused sandbox.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Install and verify a library inside the development sandbox.
|
|
170
|
+
deepflow_openagent_cli cloudpc dev exec 123 \
|
|
171
|
+
--command "python3 -m pip install pandas" --timeout 600
|
|
172
|
+
deepflow_openagent_cli cloudpc dev exec 123 \
|
|
173
|
+
--command "python3 -c 'import pandas; print(pandas.__version__)'"
|
|
174
|
+
|
|
175
|
+
# Ask the same built-in Agent used by the web development workbench.
|
|
176
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
177
|
+
--message "Install pandas, verify import, and update the dependency declaration"
|
|
178
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
179
|
+
--conversation-id 456 --message "Also verify CSV parsing with a small example"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Commands run through `/bin/bash -lc`, without a PTY or interactive stdin. `--cwd`
|
|
183
|
+
is relative to `/workspace/agent` (default `.`). Agent-configured environment
|
|
184
|
+
variables are passed to the command. `--timeout` defaults to 600 seconds and
|
|
185
|
+
accepts 1–7200. stdout/stderr are shown separately; the CLI returns the remote
|
|
186
|
+
exit code (130 for cancellation, 124 for timeout). Ctrl+C requests remote
|
|
187
|
+
cancellation, killing the command process group and its ordinary descendants.
|
|
188
|
+
Background daemons are not supported. The group leader also stops the command
|
|
189
|
+
if its owning bridge dies.
|
|
190
|
+
|
|
191
|
+
Each command prints `execution_id` to stderr **before submission**. Network
|
|
192
|
+
loss does not restart or cancel it. Use that ID to inspect, attach, or stop:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
deepflow_openagent_cli cloudpc dev exec-status 123 EXECUTION_ID
|
|
196
|
+
deepflow_openagent_cli cloudpc dev exec-attach 123 EXECUTION_ID --after 12
|
|
197
|
+
deepflow_openagent_cli cloudpc dev exec-stop 123 EXECUTION_ID
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`--after` is the last received output cursor (default 0 replays retained output).
|
|
201
|
+
Use `--execution-id` on `exec` to supply a stable ID: identical submissions return
|
|
202
|
+
the same retained execution; reusing an ID with different inputs is rejected.
|
|
203
|
+
The sandbox retains 32 recent executions and at most 1 MiB / 4096 output events
|
|
204
|
+
per execution. Runtime restart or eviction loses these records; attach reports
|
|
205
|
+
an error and never runs the command again. IDs refer to the current development
|
|
206
|
+
sandbox, not to a destroyed/replaced one.
|
|
207
|
+
|
|
208
|
+
Agent chat prints `client_message_id` and `conversation_id` to stderr. Reply text
|
|
209
|
+
goes to stdout, tool activity to stderr; `--json-events` emits structured NDJSON
|
|
210
|
+
with SSE event IDs. To reconnect to the original task without submitting it again:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
deepflow_openagent_cli cloudpc dev chat 123 \
|
|
214
|
+
--attach --client-message-id ROUND_ID --conversation-id 456 \
|
|
215
|
+
--last-event-id r1-e12
|
|
216
|
+
deepflow_openagent_cli cloudpc dev chat-stop 123 \
|
|
217
|
+
--client-message-id ROUND_ID --conversation-id 456
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`--last-event-id` is optional; omit it to replay available buffered events.
|
|
221
|
+
Ctrl+C sends `chat-stop`. A lost HTTP connection leaves the detached task running;
|
|
222
|
+
`--attach` only subscribes, and fails if its retained task is unavailable. Include
|
|
223
|
+
the conversation ID when stopping after an API-worker restart so the remote Pi
|
|
224
|
+
round can also be stopped. SSE errors, failed/cancelled tasks, and streams ending
|
|
225
|
+
without `done` return a nonzero CLI exit code.
|
|
226
|
+
|
|
227
|
+
A development Agent round, shell command, file mutation, snapshot, pause or destroy
|
|
228
|
+
cannot overlap conflicting development work. This includes browser workbench
|
|
229
|
+
rounds and remote work surviving an API-worker restart. Ordinary file reads remain
|
|
230
|
+
available. Generic chat/conversation creation also requires config permission
|
|
231
|
+
when targeting development; normal published API chat retains chat scope.
|
|
232
|
+
|
|
233
|
+
After installation or Agent edits, use `cloudpc versions save` and optionally
|
|
234
|
+
`versions publish` to preserve and publish the environment. Deploy the updated
|
|
235
|
+
OpenAgent backend, cloudpc VM service, and bridge bundle together; update the CLI
|
|
236
|
+
package as well. No database migration is required.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deepflow-openagent-cli"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.6"
|
|
8
8
|
description = "Command-line client for OpenAgent OpenAPI (agents, conversations, SSE chat, tools, channels, knowledge bases)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|