deepflow-openagent-cli 0.1.5__tar.gz → 0.1.7__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.
Files changed (18) hide show
  1. deepflow_openagent_cli-0.1.7/PKG-INFO +282 -0
  2. deepflow_openagent_cli-0.1.7/README.md +261 -0
  3. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/pyproject.toml +1 -1
  4. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli/__init__.py +1 -1
  5. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli/cli.py +593 -4
  6. deepflow_openagent_cli-0.1.7/src/deepflow_openagent_cli.egg-info/PKG-INFO +282 -0
  7. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli.egg-info/SOURCES.txt +2 -1
  8. deepflow_openagent_cli-0.1.7/tests/test_cloudpc_cli.py +336 -0
  9. deepflow_openagent_cli-0.1.5/PKG-INFO +0 -111
  10. deepflow_openagent_cli-0.1.5/README.md +0 -90
  11. deepflow_openagent_cli-0.1.5/src/deepflow_openagent_cli.egg-info/PKG-INFO +0 -111
  12. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/setup.cfg +0 -0
  13. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli/__main__.py +0 -0
  14. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli.egg-info/dependency_links.txt +0 -0
  15. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli.egg-info/entry_points.txt +0 -0
  16. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli.egg-info/requires.txt +0 -0
  17. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/src/deepflow_openagent_cli.egg-info/top_level.txt +0 -0
  18. {deepflow_openagent_cli-0.1.5 → deepflow_openagent_cli-0.1.7}/tests/test_cli.py +0 -0
@@ -0,0 +1,282 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepflow-openagent-cli
3
+ Version: 0.1.7
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
+ Binary uploads (including PDF) use the same sandbox upload writer as the workbench:
162
+
163
+ ```bash
164
+ deepflow_openagent_cli cloudpc files upload 123 --file ./report.pdf
165
+ # After retry exhaustion, reuse BOTH printed IDs and the same local file:
166
+ deepflow_openagent_cli cloudpc files upload 123 --file ./report.pdf \
167
+ --upload-id UPLOAD_ID --sandbox-id SANDBOX_ID
168
+ ```
169
+
170
+ Uploads accept 1 byte–50 MiB and create `/workspace/files/uploads` automatically.
171
+ The returned path is `/workspace/files/uploads/<upload_id>-<original_filename>`;
172
+ use that path in subsequent OCR or chat commands. The ID prefix prevents duplicate
173
+ files after a lost response. Reusing the same ID/name with different bytes is
174
+ rejected. The sandbox ID pins retries to the original development environment.
175
+ This admin/config API accepts binary content; channel visitor format restrictions
176
+ still apply only to visitor uploads. Uploading does not automatically start OCR.
177
+
178
+ Uploads and `dev exec` submission/status/stop retry connection failures and HTTP
179
+ 408/429/502/503/504 up to four times (1/2/4/8 second delays). Execution retries keep
180
+ the same execution ID and output cursor. Upload retries resend the whole binary
181
+ body; chunk resume is not implemented. Other mutating commands are not retried.
182
+ Requires updated CLI, API server and Cloud PC control plane; no VM image rebuild
183
+ is needed for the upload writer.
184
+
185
+ Additional operations:
186
+
187
+ ```bash
188
+ deepflow_openagent_cli cloudpc create --name "Assistant"
189
+ deepflow_openagent_cli cloudpc config update 123 --json-file ./config.json
190
+ deepflow_openagent_cli cloudpc dev pause 123
191
+ deepflow_openagent_cli cloudpc dev resume 123
192
+ deepflow_openagent_cli cloudpc files mkdir 123 --path skills/demo
193
+ deepflow_openagent_cli cloudpc files rename 123 --src old.md --dst new.md
194
+ deepflow_openagent_cli cloudpc files delete 123 --path old.md
195
+ deepflow_openagent_cli cloudpc dev destroy 123
196
+ deepflow_openagent_cli docs show cloudpc.files.write --json
197
+ ```
198
+
199
+ Config update replaces configuration: provide `model_name`, `thinking_enabled`
200
+ and the complete `env_vars` list; omitted thinking/env fields reset to defaults.
201
+ Config queries include environment variable values. File mutation and snapshot
202
+ operations share the per-agent management lock; direct writes by the sandbox's
203
+ Agent or terminal are outside that lock. Upload and execution requests have a
204
+ 120-second per-attempt timeout and the retries described above. Other Cloud PC
205
+ HTTP requests have a 900-second timeout and are not automatically retried. After a timeout, inspect sandbox or
206
+ version state before retrying a mutation. Conversation logs and chat-control
207
+ routes still require an administrator session.
208
+
209
+ ### Execute commands and talk to the development Agent
210
+
211
+ Both commands require **config** scope and an existing development sandbox.
212
+ `exec` requires it to be running; Agent chat can resume a paused sandbox.
213
+
214
+ ```bash
215
+ # Install and verify a library inside the development sandbox.
216
+ deepflow_openagent_cli cloudpc dev exec 123 \
217
+ --command "python3 -m pip install pandas" --timeout 600
218
+ deepflow_openagent_cli cloudpc dev exec 123 \
219
+ --command "python3 -c 'import pandas; print(pandas.__version__)'"
220
+
221
+ # Ask the same built-in Agent used by the web development workbench.
222
+ deepflow_openagent_cli cloudpc dev chat 123 \
223
+ --message "Install pandas, verify import, and update the dependency declaration"
224
+ deepflow_openagent_cli cloudpc dev chat 123 \
225
+ --conversation-id 456 --message "Also verify CSV parsing with a small example"
226
+ ```
227
+
228
+ Commands run through `/bin/bash -lc`, without a PTY or interactive stdin. `--cwd`
229
+ is relative to `/workspace/agent` (default `.`). Agent-configured environment
230
+ variables are passed to the command. `--timeout` defaults to 600 seconds and
231
+ accepts 1–7200. stdout/stderr are shown separately; the CLI returns the remote
232
+ exit code (130 for cancellation, 124 for timeout). Ctrl+C requests remote
233
+ cancellation, killing the command process group and its ordinary descendants.
234
+ Background daemons are not supported. The group leader also stops the command
235
+ if its owning bridge dies.
236
+
237
+ Each command prints `execution_id` to stderr **before submission**. Network
238
+ loss does not restart or cancel it. Use that ID to inspect, attach, or stop:
239
+
240
+ ```bash
241
+ deepflow_openagent_cli cloudpc dev exec-status 123 EXECUTION_ID
242
+ deepflow_openagent_cli cloudpc dev exec-attach 123 EXECUTION_ID --after 12
243
+ deepflow_openagent_cli cloudpc dev exec-stop 123 EXECUTION_ID
244
+ ```
245
+
246
+ `--after` is the last received output cursor (default 0 replays retained output).
247
+ Use `--execution-id` on `exec` to supply a stable ID: identical submissions return
248
+ the same retained execution; reusing an ID with different inputs is rejected.
249
+ The sandbox retains 32 recent executions and at most 1 MiB / 4096 output events
250
+ per execution. Runtime restart or eviction loses these records; attach reports
251
+ an error and never runs the command again. IDs refer to the current development
252
+ sandbox, not to a destroyed/replaced one.
253
+
254
+ Agent chat prints `client_message_id` and `conversation_id` to stderr. Reply text
255
+ goes to stdout, tool activity to stderr; `--json-events` emits structured NDJSON
256
+ with SSE event IDs. To reconnect to the original task without submitting it again:
257
+
258
+ ```bash
259
+ deepflow_openagent_cli cloudpc dev chat 123 \
260
+ --attach --client-message-id ROUND_ID --conversation-id 456 \
261
+ --last-event-id r1-e12
262
+ deepflow_openagent_cli cloudpc dev chat-stop 123 \
263
+ --client-message-id ROUND_ID --conversation-id 456
264
+ ```
265
+
266
+ `--last-event-id` is optional; omit it to replay available buffered events.
267
+ Ctrl+C sends `chat-stop`. A lost HTTP connection leaves the detached task running;
268
+ `--attach` only subscribes, and fails if its retained task is unavailable. Include
269
+ the conversation ID when stopping after an API-worker restart so the remote Pi
270
+ round can also be stopped. SSE errors, failed/cancelled tasks, and streams ending
271
+ without `done` return a nonzero CLI exit code.
272
+
273
+ A development Agent round, shell command, file mutation, snapshot, pause or destroy
274
+ cannot overlap conflicting development work. This includes browser workbench
275
+ rounds and remote work surviving an API-worker restart. Ordinary file reads remain
276
+ available. Generic chat/conversation creation also requires config permission
277
+ when targeting development; normal published API chat retains chat scope.
278
+
279
+ After installation or Agent edits, use `cloudpc versions save` and optionally
280
+ `versions publish` to preserve and publish the environment. Deploy the updated
281
+ OpenAgent backend, cloudpc VM service, and bridge bundle together; update the CLI
282
+ package as well. No database migration is required.
@@ -0,0 +1,261 @@
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
+ Binary uploads (including PDF) use the same sandbox upload writer as the workbench:
141
+
142
+ ```bash
143
+ deepflow_openagent_cli cloudpc files upload 123 --file ./report.pdf
144
+ # After retry exhaustion, reuse BOTH printed IDs and the same local file:
145
+ deepflow_openagent_cli cloudpc files upload 123 --file ./report.pdf \
146
+ --upload-id UPLOAD_ID --sandbox-id SANDBOX_ID
147
+ ```
148
+
149
+ Uploads accept 1 byte–50 MiB and create `/workspace/files/uploads` automatically.
150
+ The returned path is `/workspace/files/uploads/<upload_id>-<original_filename>`;
151
+ use that path in subsequent OCR or chat commands. The ID prefix prevents duplicate
152
+ files after a lost response. Reusing the same ID/name with different bytes is
153
+ rejected. The sandbox ID pins retries to the original development environment.
154
+ This admin/config API accepts binary content; channel visitor format restrictions
155
+ still apply only to visitor uploads. Uploading does not automatically start OCR.
156
+
157
+ Uploads and `dev exec` submission/status/stop retry connection failures and HTTP
158
+ 408/429/502/503/504 up to four times (1/2/4/8 second delays). Execution retries keep
159
+ the same execution ID and output cursor. Upload retries resend the whole binary
160
+ body; chunk resume is not implemented. Other mutating commands are not retried.
161
+ Requires updated CLI, API server and Cloud PC control plane; no VM image rebuild
162
+ is needed for the upload writer.
163
+
164
+ Additional operations:
165
+
166
+ ```bash
167
+ deepflow_openagent_cli cloudpc create --name "Assistant"
168
+ deepflow_openagent_cli cloudpc config update 123 --json-file ./config.json
169
+ deepflow_openagent_cli cloudpc dev pause 123
170
+ deepflow_openagent_cli cloudpc dev resume 123
171
+ deepflow_openagent_cli cloudpc files mkdir 123 --path skills/demo
172
+ deepflow_openagent_cli cloudpc files rename 123 --src old.md --dst new.md
173
+ deepflow_openagent_cli cloudpc files delete 123 --path old.md
174
+ deepflow_openagent_cli cloudpc dev destroy 123
175
+ deepflow_openagent_cli docs show cloudpc.files.write --json
176
+ ```
177
+
178
+ Config update replaces configuration: provide `model_name`, `thinking_enabled`
179
+ and the complete `env_vars` list; omitted thinking/env fields reset to defaults.
180
+ Config queries include environment variable values. File mutation and snapshot
181
+ operations share the per-agent management lock; direct writes by the sandbox's
182
+ Agent or terminal are outside that lock. Upload and execution requests have a
183
+ 120-second per-attempt timeout and the retries described above. Other Cloud PC
184
+ HTTP requests have a 900-second timeout and are not automatically retried. After a timeout, inspect sandbox or
185
+ version state before retrying a mutation. Conversation logs and chat-control
186
+ routes still require an administrator session.
187
+
188
+ ### Execute commands and talk to the development Agent
189
+
190
+ Both commands require **config** scope and an existing development sandbox.
191
+ `exec` requires it to be running; Agent chat can resume a paused sandbox.
192
+
193
+ ```bash
194
+ # Install and verify a library inside the development sandbox.
195
+ deepflow_openagent_cli cloudpc dev exec 123 \
196
+ --command "python3 -m pip install pandas" --timeout 600
197
+ deepflow_openagent_cli cloudpc dev exec 123 \
198
+ --command "python3 -c 'import pandas; print(pandas.__version__)'"
199
+
200
+ # Ask the same built-in Agent used by the web development workbench.
201
+ deepflow_openagent_cli cloudpc dev chat 123 \
202
+ --message "Install pandas, verify import, and update the dependency declaration"
203
+ deepflow_openagent_cli cloudpc dev chat 123 \
204
+ --conversation-id 456 --message "Also verify CSV parsing with a small example"
205
+ ```
206
+
207
+ Commands run through `/bin/bash -lc`, without a PTY or interactive stdin. `--cwd`
208
+ is relative to `/workspace/agent` (default `.`). Agent-configured environment
209
+ variables are passed to the command. `--timeout` defaults to 600 seconds and
210
+ accepts 1–7200. stdout/stderr are shown separately; the CLI returns the remote
211
+ exit code (130 for cancellation, 124 for timeout). Ctrl+C requests remote
212
+ cancellation, killing the command process group and its ordinary descendants.
213
+ Background daemons are not supported. The group leader also stops the command
214
+ if its owning bridge dies.
215
+
216
+ Each command prints `execution_id` to stderr **before submission**. Network
217
+ loss does not restart or cancel it. Use that ID to inspect, attach, or stop:
218
+
219
+ ```bash
220
+ deepflow_openagent_cli cloudpc dev exec-status 123 EXECUTION_ID
221
+ deepflow_openagent_cli cloudpc dev exec-attach 123 EXECUTION_ID --after 12
222
+ deepflow_openagent_cli cloudpc dev exec-stop 123 EXECUTION_ID
223
+ ```
224
+
225
+ `--after` is the last received output cursor (default 0 replays retained output).
226
+ Use `--execution-id` on `exec` to supply a stable ID: identical submissions return
227
+ the same retained execution; reusing an ID with different inputs is rejected.
228
+ The sandbox retains 32 recent executions and at most 1 MiB / 4096 output events
229
+ per execution. Runtime restart or eviction loses these records; attach reports
230
+ an error and never runs the command again. IDs refer to the current development
231
+ sandbox, not to a destroyed/replaced one.
232
+
233
+ Agent chat prints `client_message_id` and `conversation_id` to stderr. Reply text
234
+ goes to stdout, tool activity to stderr; `--json-events` emits structured NDJSON
235
+ with SSE event IDs. To reconnect to the original task without submitting it again:
236
+
237
+ ```bash
238
+ deepflow_openagent_cli cloudpc dev chat 123 \
239
+ --attach --client-message-id ROUND_ID --conversation-id 456 \
240
+ --last-event-id r1-e12
241
+ deepflow_openagent_cli cloudpc dev chat-stop 123 \
242
+ --client-message-id ROUND_ID --conversation-id 456
243
+ ```
244
+
245
+ `--last-event-id` is optional; omit it to replay available buffered events.
246
+ Ctrl+C sends `chat-stop`. A lost HTTP connection leaves the detached task running;
247
+ `--attach` only subscribes, and fails if its retained task is unavailable. Include
248
+ the conversation ID when stopping after an API-worker restart so the remote Pi
249
+ round can also be stopped. SSE errors, failed/cancelled tasks, and streams ending
250
+ without `done` return a nonzero CLI exit code.
251
+
252
+ A development Agent round, shell command, file mutation, snapshot, pause or destroy
253
+ cannot overlap conflicting development work. This includes browser workbench
254
+ rounds and remote work surviving an API-worker restart. Ordinary file reads remain
255
+ available. Generic chat/conversation creation also requires config permission
256
+ when targeting development; normal published API chat retains chat scope.
257
+
258
+ After installation or Agent edits, use `cloudpc versions save` and optionally
259
+ `versions publish` to preserve and publish the environment. Deploy the updated
260
+ OpenAgent backend, cloudpc VM service, and bridge bundle together; update the CLI
261
+ 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.5"
7
+ version = "0.1.7"
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"
@@ -1,3 +1,3 @@
1
1
  """DeepFlow OpenAgent CLI — published PyPI package."""
2
2
 
3
- __version__ = "0.1.5"
3
+ __version__ = "0.1.7"