arkclaw-webchat-cli 0.6.1__tar.gz → 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.
Files changed (31) hide show
  1. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/.gitignore +4 -0
  2. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/PKG-INFO +87 -15
  3. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/README.md +85 -14
  4. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/pyproject.toml +2 -1
  5. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/attachments.py +29 -6
  6. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/cli.py +278 -6
  7. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/config.py +11 -1
  8. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/control.py +4 -4
  9. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/core.py +2 -0
  10. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/doctor.py +4 -2
  11. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/errors.py +27 -0
  12. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/flows.py +551 -12
  13. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/oauth.py +5 -0
  14. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/sts.py +144 -8
  15. arkclaw_webchat_cli-0.9.0/src/ee_claw/terminal_io.py +432 -0
  16. arkclaw_webchat_cli-0.9.0/src/ee_claw/transport/claw_terminal.py +246 -0
  17. arkclaw_webchat_cli-0.9.0/src/ee_claw/transport/netdisk.py +305 -0
  18. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/transport/openclaw.py +87 -15
  19. arkclaw_webchat_cli-0.9.0/src/ee_claw/transport/silk.py +175 -0
  20. arkclaw_webchat_cli-0.9.0/src/ee_claw/transport/silk_fs.py +252 -0
  21. arkclaw_webchat_cli-0.9.0/src/ee_claw/transport/silk_rpc.py +187 -0
  22. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/__init__.py +0 -0
  23. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/identity.py +0 -0
  24. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/output.py +0 -0
  25. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/policy.py +0 -0
  26. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/providers.py +0 -0
  27. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/secrets_store.py +0 -0
  28. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/transport/__init__.py +0 -0
  29. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/transport/a2a.py +0 -0
  30. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/transport/base.py +0 -0
  31. {arkclaw_webchat_cli-0.6.1 → arkclaw_webchat_cli-0.9.0}/src/ee_claw/update.py +0 -0
@@ -5,3 +5,7 @@ dist/
5
5
  build/
6
6
  .pytest_cache/
7
7
  .ruff_cache/
8
+
9
+ # macOS / local agent state
10
+ .DS_Store
11
+ .agentkit/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arkclaw-webchat-cli
3
- Version: 0.6.1
3
+ Version: 0.9.0
4
4
  Summary: CLI to chat with an ArkClaw EE space's Claw over enterprise SSO — zero permanent AK/SK.
5
5
  Author: ArkClaw Team
6
6
  Keywords: arkclaw,cli,ee,openclaw,sso,sts
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Python: >=3.10
16
16
  Requires-Dist: keyring>=24.0
17
+ Requires-Dist: msgpack>=1.0
17
18
  Requires-Dist: typer>=0.12.0
18
19
  Requires-Dist: websockets>=12.0
19
20
  Provides-Extra: dev
@@ -31,7 +32,7 @@ at a prompt and for another agent/script (`--json` + exit codes).
31
32
  ```bash
32
33
  arkclaw init # one-time interactive setup (asks only what it can't auto-detect)
33
34
  arkclaw login # browser SSO
34
- arkclaw agents # list the claws you can chat
35
+ arkclaw agents # list the agents you can chat
35
36
  arkclaw chat ci-xxxxxxxx
36
37
  ```
37
38
 
@@ -40,10 +41,14 @@ arkclaw chat ci-xxxxxxxx
40
41
  ## What it can do
41
42
 
42
43
  - **Log in as you** — browser SSO (PKCE), short-lived token, auto-refresh. No AK/SK, no client secret, nothing permanent on disk but a token in your OS keychain.
43
- - **List your agents** — `arkclaw agents` shows the claws you've chatted with (kept locally; add one with `arkclaw chat ci-...`).
44
+ - **List your agents** — `arkclaw agents` shows the agents in your accessible claws (add a claw by chatting it once: `arkclaw chat ci-...`).
45
+ - **Manage agents** — `agents create` / `agents delete` add or remove named agents in a claw, right from the terminal.
44
46
  - **Chat** — interactive REPL or one-shot `-m`, streaming token-by-token, with a live "what's it doing" spinner and tool-event trace.
45
47
  - **Talk to a specific claw** — by id (`chat ci-...`) or by name (`chat 答疑助手`).
46
48
  - **Manage a claw's files** — read/write its managed workspace files (`AGENTS.md`, `SOUL.md`, `MEMORY.md`, …) with `ls` / `pull` / `push`.
49
+ - **Upload & download any file** — push arbitrary files into the claw's *real* workspace filesystem and pull results back (a whole directory comes as a `.tar`) with `upload` / `download` / `mkdir` / `ls <path>`, over the Silk file service (needs a Silk-enabled claw).
50
+ - **Large-product storage** — a separate IDS *netdisk* plane for big artifacts/videos: `netdisk create-space` / `ls` / `upload` / `download` / `mkdir` / `rm`.
51
+ - **Read past conversations** — list an agent's sessions, then pull a full transcript with `arkclaw history <会话ID>` (over the `chat.history` ws RPC; `--json` to export, `-o` to a file).
47
52
  - **Fan out** — send one message to many claws in parallel.
48
53
  - **Be scripted** — every command takes `--json` (one clean `{ok,data,error}` envelope on stdout) and returns a typed exit code.
49
54
 
@@ -64,6 +69,9 @@ git clone <repo> && cd ee-claw
64
69
  uv venv && uv pip install -e .
65
70
  ```
66
71
 
72
+ > **Contributing / hacking on the CLI?** Start with [`AGENTS.md`](./AGENTS.md) —
73
+ > dev setup, the three gates, code map, invariants, and how to add a command/provider/transport.
74
+
67
75
  ---
68
76
 
69
77
  ## Quick start
@@ -99,14 +107,21 @@ straight to `arkclaw login https://your-space...`. See **[Configuration](#config
99
107
  |---|---|
100
108
  | `arkclaw init [address]` | One-time interactive setup. Saves the address + (only what isn't auto-discovered) the CLI client and STS role to `~/.arkclaw/defaults.json`, so later commands need no env/flags. |
101
109
  | `arkclaw login [space-url]` | Browser SSO login. Uses `init` defaults if you omit the URL. `--transport a2a --endpoint <url>` for an agent endpoint. `--clawid ci-...` sets a default claw. Bare `arkclaw login` re-logs into the previous space. |
102
- | `arkclaw agents` | List the claws you've used from this machine (local history, newest first) + your default claw. Add a claw by chatting it once (`arkclaw chat ci-...`). Not a space-wide directory. |
110
+ | `arkclaw agents` | List the agents in your accessible claws (verified over the ws; inaccessible claws are pruned). Candidate claws = the ones you've used from this machine + your default add one by chatting it once (`arkclaw chat ci-...`). Not a space-wide directory. |
111
+ | `arkclaw agents create` | Create a named agent in a claw: `--name` `--role` `--soul` (+ optional `--description`, repeatable `--skill`). Then `chat <claw> --agent <agentId>`. |
112
+ | `arkclaw agents delete <agent>` | Delete a named agent by agentId (`a-...`) or display name. Asks for confirmation unless `--yes`; the `main` agent is protected. |
103
113
  | `arkclaw chat [TARGET] [MSG]` | Chat. `TARGET` = a claw id (`ci-...`), an agent name (from `agents`), or a profile. With `MSG` → one-shot; without → interactive REPL. `-f` attach files, `-o` write the reply, `--session NAME` name the conversation, `--approve-all` auto-approve tool runs. |
104
114
  | `arkclaw <name>` | Shortcut: `arkclaw 答疑助手` ≡ `arkclaw chat 答疑助手`. |
105
- | `arkclaw ls` | List the claw's managed workspace files. |
106
- | `arkclaw pull <name> [local]` | Download a managed file to local disk. |
107
- | `arkclaw push <local> [name]` | Write a local text file into a managed file. |
115
+ | `arkclaw ls [path]` | No `path` → the claw's managed brain files. With `path` → that workspace directory over Silk (the real filesystem). |
116
+ | `arkclaw pull <name> [local]` | Download a **managed** file to local disk. |
117
+ | `arkclaw push <local> [name]` | Write a local text file into a **managed** file. |
118
+ | `arkclaw upload <local> [remote]` | Upload **any** file into the claw's workspace filesystem (Silk). Defaults to the basename at the workspace root. |
119
+ | `arkclaw download <remote> [local]` | Download a workspace file from the claw (Silk); a directory comes as `<name>.tar`. |
120
+ | `arkclaw mkdir <path>` | Create a directory in the claw workspace (Silk; parent must exist). |
121
+ | `arkclaw netdisk <cmd>` | IDS netdisk (large products/videos), a separate storage plane: `create-space` / `ls` / `upload` / `download` / `mkdir` / `rm`. Configured via `IDS_*` env. |
108
122
  | `arkclaw fanout "<msg>" --clawid ci-a --clawid ci-b` | Same message to many claws in parallel. |
109
- | `arkclaw sessions` | Recent chat sessions on this machine. |
123
+ | `arkclaw sessions [claw]` | An agent's conversations from the server (`--agent` to pick one), newest first — resume with `chat --session <会话ID>`, read with `history <会话ID>`, fork with `--new`. Falls back to the local record when offline / a2a. |
124
+ | `arkclaw history <session>` | Print a past conversation's full transcript (ws `chat.history`). `<session>` = a 会话ID from `sessions`, a label, or a full `agent:…` key. Tool steps hidden unless `--show-tools`; `--json` dumps every message; `-o` writes a plain-text log. openclaw only. |
110
125
  | `arkclaw profile save/use/list` | Named snapshots of the session config (multi-space / multi-claw). |
111
126
  | `arkclaw doctor` | Self-check: login freshness, keychain, pool/STS/endpoint reachability. |
112
127
  | `arkclaw schema --json` | Machine-readable command surface (for agents/tooling). |
@@ -132,12 +147,21 @@ arkclaw chat ci-xxxx -f notes.md -m "review" -o out.md # attach context, save
132
147
 
133
148
  ---
134
149
 
135
- ## Files
150
+ ## Files & storage
151
+
152
+ The CLI moves files across **three distinct planes** — pick by what you're carrying:
153
+
154
+ | Plane | Commands | What lives there |
155
+ |---|---|---|
156
+ | **Managed brain** | `ls` · `pull` · `push` | The claw's own config files (`AGENTS.md`, `SOUL.md`, …). A fixed allow-list, not a general store. |
157
+ | **Workspace (Silk)** | `ls <path>` · `upload` · `download` · `mkdir` | The claw's *real* working filesystem — arbitrary files, uploads, agent outputs, subdirectories. |
158
+ | **Netdisk (IDS)** | `netdisk …` | A separate large-object store for big products/videos, on a dedicated storage account. |
136
159
 
137
- `ls` / `pull` / `push` operate on a claw's **managed workspace files** — its
138
- "brain": `AGENTS.md`, `SOUL.md`, `MEMORY.md`, `TOOLS.md`, `IDENTITY.md`,
139
- `USER.md`, `HEARTBEAT.md`. (This is not a general file store — arbitrary
140
- filenames are rejected.)
160
+ ### 1. Managed brain files — `ls` / `pull` / `push`
161
+
162
+ The claw's "brain": `AGENTS.md`, `SOUL.md`, `MEMORY.md`, `TOOLS.md`,
163
+ `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`. A fixed allow-list — arbitrary
164
+ filenames are rejected; `push` only writes text.
141
165
 
142
166
  ```bash
143
167
  arkclaw ls # list them (defaults to your default claw)
@@ -147,6 +171,51 @@ arkclaw push ./agents.md AGENTS.md # write a managed file
147
171
  arkclaw ls --clawid ci-other # a different claw
148
172
  ```
149
173
 
174
+ ### 2. Workspace filesystem — `upload` / `download` / `mkdir` / `ls <path>`
175
+
176
+ The claw's **real** working filesystem (`/root/.openclaw/workspace`), over the
177
+ Silk file service. Paths are workspace-relative. Use it to feed an agent input
178
+ files and to retrieve whatever it produces.
179
+
180
+ ```bash
181
+ arkclaw upload ./input.png # → workspace root (basename)
182
+ arkclaw upload ./data.csv runs/data.csv # → a subpath
183
+ arkclaw mkdir runs # parent must exist (non-recursive)
184
+ arkclaw ls runs # list a workspace directory
185
+ arkclaw download runs/output.mp4 ./out.mp4 # pull a result back
186
+ arkclaw download runs ./runs.tar # a directory downloads as a .tar
187
+ ```
188
+
189
+ - **Requires a Silk-enabled claw.** A claw you can chat but that isn't
190
+ provisioned into Silk is rejected with a clear "未启用文件服务(Silk)" error
191
+ (`ErrClawInstanceNotFound`); Silk runs the *same* per-user gate as chat.
192
+ - **Upload cap** is server-side (~25 MB per file); larger uploads return a clear
193
+ "文件超出上传上限" error.
194
+ - There is **no `rm`** here — workspace deletes aren't exposed as a command.
195
+
196
+ ### 3. Netdisk (IDS) — `netdisk …`
197
+
198
+ A separate storage plane for large products/videos, on a **dedicated IDS
199
+ account** (not your SSO identity). Configured entirely from `IDS_*` env vars
200
+ (provisioned by the storage team). Create a space once, then pass its `SpaceID`:
201
+
202
+ ```bash
203
+ arkclaw netdisk create-space my-space # → prints the SpaceID
204
+ arkclaw netdisk mkdir outputs --space spc-...
205
+ arkclaw netdisk upload ./final.mp4 outputs/final.mp4 --space spc-...
206
+ arkclaw netdisk ls outputs/ --space spc-...
207
+ arkclaw netdisk download outputs/final.mp4 ./final.mp4 --space spc-...
208
+ arkclaw netdisk rm outputs/final.mp4 --space spc-... # asks unless --yes
209
+ ```
210
+
211
+ `create-space` also takes `--description`; `ls` takes `--limit N` to cap entries.
212
+
213
+ | Env | Purpose |
214
+ |---|---|
215
+ | `IDS_BASE_URL` / `IDS_REGION` / `IDS_SERVICE` / `IDS_INSTANCE_ID` | Endpoint + routing for the IDS instance. |
216
+ | `IDS_AK` / `IDS_SK` (+ `IDS_ACCOUNT_ID`) | Static credentials for the storage account… |
217
+ | `IDS_ROLE_TRN` | …or assume a role via SSO instead of static AK/SK. |
218
+
150
219
  ---
151
220
 
152
221
  ## For agents / automation
@@ -183,15 +252,18 @@ values via env:
183
252
  | `ARKCLAW_CLIENT_ID` | The CLI's public OAuth client id for the pool. |
184
253
  | `ARKCLAW_ROLE_TRN` | STS role that mints the ChatToken (openclaw). |
185
254
  | `ARKCLAW_REGION` / `ARKCLAW_SPACE_ID` | Override region / space (usually auto). |
255
+ | `ARKCLAW_API_HOST` / `ARKCLAW_API_SERVICE` | **Advanced/testing.** Point the control-plane calls at a non-production plane (host + SigV4 service). See the note below. |
186
256
 
187
257
  Other config: `~/.arkclaw/defaults.json` (`init` answers, 0600), `~/.arkclaw/session.json` (routing, 0600), `~/.arkclaw/cmdpolicy.json` (tool-approval allow/deny), OS keychain (tokens).
188
258
 
189
259
  > **Escape hatch (admin/test):** `arkclaw login <url> --transport openclaw --static-creds` uses `VOLCENGINE_ACCESS_KEY`/`SECRET_KEY` from the env instead of SSO — convenient for CI, but it's account-level keys, not identity-through.
190
260
 
261
+ > **Control-plane override (advanced/testing):** by default every control-plane call (chat/terminal token mints, file/fleet actions, `doctor`) targets `arkclaw.<region>.volcengineapi.com` with SigV4 service `arkclaw`. Setting `ARKCLAW_API_HOST` + `ARKCLAW_API_SERVICE` retargets them — e.g. a non-production plane. The service is also the IAM action prefix, so a non-default service needs the matching role permissions. The host receives the **signed request including live temporary credentials**, so it must be a host you trust — only `*.volcengineapi.com` is accepted.
262
+
191
263
  ---
192
264
 
193
265
  ## Notes
194
266
 
195
- - `ls`/`pull`/`push` and a bare `chat` use your **default claw** (set at login, or the last one you opened in the browser); override with `--clawid` (or `chat ci-...`).
196
- - File commands cover the claw's **managed** files only; arbitrary file drop isn't exposed by the API.
267
+ - `ls`/`pull`/`push`, `upload`/`download`/`mkdir`, and a bare `chat` use your **default claw** (set at login, or the last one you opened in the browser); override with `--clawid` (or `chat ci-...`).
268
+ - `pull`/`push` reach the claw's **managed** files; `upload`/`download` reach its **workspace filesystem** (Silk, arbitrary files); `netdisk …` is a **separate** storage plane on its own account.
197
269
  - Nothing is hardcoded per space — the CLI reads what the space serves.
@@ -7,7 +7,7 @@ at a prompt and for another agent/script (`--json` + exit codes).
7
7
  ```bash
8
8
  arkclaw init # one-time interactive setup (asks only what it can't auto-detect)
9
9
  arkclaw login # browser SSO
10
- arkclaw agents # list the claws you can chat
10
+ arkclaw agents # list the agents you can chat
11
11
  arkclaw chat ci-xxxxxxxx
12
12
  ```
13
13
 
@@ -16,10 +16,14 @@ arkclaw chat ci-xxxxxxxx
16
16
  ## What it can do
17
17
 
18
18
  - **Log in as you** — browser SSO (PKCE), short-lived token, auto-refresh. No AK/SK, no client secret, nothing permanent on disk but a token in your OS keychain.
19
- - **List your agents** — `arkclaw agents` shows the claws you've chatted with (kept locally; add one with `arkclaw chat ci-...`).
19
+ - **List your agents** — `arkclaw agents` shows the agents in your accessible claws (add a claw by chatting it once: `arkclaw chat ci-...`).
20
+ - **Manage agents** — `agents create` / `agents delete` add or remove named agents in a claw, right from the terminal.
20
21
  - **Chat** — interactive REPL or one-shot `-m`, streaming token-by-token, with a live "what's it doing" spinner and tool-event trace.
21
22
  - **Talk to a specific claw** — by id (`chat ci-...`) or by name (`chat 答疑助手`).
22
23
  - **Manage a claw's files** — read/write its managed workspace files (`AGENTS.md`, `SOUL.md`, `MEMORY.md`, …) with `ls` / `pull` / `push`.
24
+ - **Upload & download any file** — push arbitrary files into the claw's *real* workspace filesystem and pull results back (a whole directory comes as a `.tar`) with `upload` / `download` / `mkdir` / `ls <path>`, over the Silk file service (needs a Silk-enabled claw).
25
+ - **Large-product storage** — a separate IDS *netdisk* plane for big artifacts/videos: `netdisk create-space` / `ls` / `upload` / `download` / `mkdir` / `rm`.
26
+ - **Read past conversations** — list an agent's sessions, then pull a full transcript with `arkclaw history <会话ID>` (over the `chat.history` ws RPC; `--json` to export, `-o` to a file).
23
27
  - **Fan out** — send one message to many claws in parallel.
24
28
  - **Be scripted** — every command takes `--json` (one clean `{ok,data,error}` envelope on stdout) and returns a typed exit code.
25
29
 
@@ -40,6 +44,9 @@ git clone <repo> && cd ee-claw
40
44
  uv venv && uv pip install -e .
41
45
  ```
42
46
 
47
+ > **Contributing / hacking on the CLI?** Start with [`AGENTS.md`](./AGENTS.md) —
48
+ > dev setup, the three gates, code map, invariants, and how to add a command/provider/transport.
49
+
43
50
  ---
44
51
 
45
52
  ## Quick start
@@ -75,14 +82,21 @@ straight to `arkclaw login https://your-space...`. See **[Configuration](#config
75
82
  |---|---|
76
83
  | `arkclaw init [address]` | One-time interactive setup. Saves the address + (only what isn't auto-discovered) the CLI client and STS role to `~/.arkclaw/defaults.json`, so later commands need no env/flags. |
77
84
  | `arkclaw login [space-url]` | Browser SSO login. Uses `init` defaults if you omit the URL. `--transport a2a --endpoint <url>` for an agent endpoint. `--clawid ci-...` sets a default claw. Bare `arkclaw login` re-logs into the previous space. |
78
- | `arkclaw agents` | List the claws you've used from this machine (local history, newest first) + your default claw. Add a claw by chatting it once (`arkclaw chat ci-...`). Not a space-wide directory. |
85
+ | `arkclaw agents` | List the agents in your accessible claws (verified over the ws; inaccessible claws are pruned). Candidate claws = the ones you've used from this machine + your default add one by chatting it once (`arkclaw chat ci-...`). Not a space-wide directory. |
86
+ | `arkclaw agents create` | Create a named agent in a claw: `--name` `--role` `--soul` (+ optional `--description`, repeatable `--skill`). Then `chat <claw> --agent <agentId>`. |
87
+ | `arkclaw agents delete <agent>` | Delete a named agent by agentId (`a-...`) or display name. Asks for confirmation unless `--yes`; the `main` agent is protected. |
79
88
  | `arkclaw chat [TARGET] [MSG]` | Chat. `TARGET` = a claw id (`ci-...`), an agent name (from `agents`), or a profile. With `MSG` → one-shot; without → interactive REPL. `-f` attach files, `-o` write the reply, `--session NAME` name the conversation, `--approve-all` auto-approve tool runs. |
80
89
  | `arkclaw <name>` | Shortcut: `arkclaw 答疑助手` ≡ `arkclaw chat 答疑助手`. |
81
- | `arkclaw ls` | List the claw's managed workspace files. |
82
- | `arkclaw pull <name> [local]` | Download a managed file to local disk. |
83
- | `arkclaw push <local> [name]` | Write a local text file into a managed file. |
90
+ | `arkclaw ls [path]` | No `path` → the claw's managed brain files. With `path` → that workspace directory over Silk (the real filesystem). |
91
+ | `arkclaw pull <name> [local]` | Download a **managed** file to local disk. |
92
+ | `arkclaw push <local> [name]` | Write a local text file into a **managed** file. |
93
+ | `arkclaw upload <local> [remote]` | Upload **any** file into the claw's workspace filesystem (Silk). Defaults to the basename at the workspace root. |
94
+ | `arkclaw download <remote> [local]` | Download a workspace file from the claw (Silk); a directory comes as `<name>.tar`. |
95
+ | `arkclaw mkdir <path>` | Create a directory in the claw workspace (Silk; parent must exist). |
96
+ | `arkclaw netdisk <cmd>` | IDS netdisk (large products/videos), a separate storage plane: `create-space` / `ls` / `upload` / `download` / `mkdir` / `rm`. Configured via `IDS_*` env. |
84
97
  | `arkclaw fanout "<msg>" --clawid ci-a --clawid ci-b` | Same message to many claws in parallel. |
85
- | `arkclaw sessions` | Recent chat sessions on this machine. |
98
+ | `arkclaw sessions [claw]` | An agent's conversations from the server (`--agent` to pick one), newest first — resume with `chat --session <会话ID>`, read with `history <会话ID>`, fork with `--new`. Falls back to the local record when offline / a2a. |
99
+ | `arkclaw history <session>` | Print a past conversation's full transcript (ws `chat.history`). `<session>` = a 会话ID from `sessions`, a label, or a full `agent:…` key. Tool steps hidden unless `--show-tools`; `--json` dumps every message; `-o` writes a plain-text log. openclaw only. |
86
100
  | `arkclaw profile save/use/list` | Named snapshots of the session config (multi-space / multi-claw). |
87
101
  | `arkclaw doctor` | Self-check: login freshness, keychain, pool/STS/endpoint reachability. |
88
102
  | `arkclaw schema --json` | Machine-readable command surface (for agents/tooling). |
@@ -108,12 +122,21 @@ arkclaw chat ci-xxxx -f notes.md -m "review" -o out.md # attach context, save
108
122
 
109
123
  ---
110
124
 
111
- ## Files
125
+ ## Files & storage
126
+
127
+ The CLI moves files across **three distinct planes** — pick by what you're carrying:
128
+
129
+ | Plane | Commands | What lives there |
130
+ |---|---|---|
131
+ | **Managed brain** | `ls` · `pull` · `push` | The claw's own config files (`AGENTS.md`, `SOUL.md`, …). A fixed allow-list, not a general store. |
132
+ | **Workspace (Silk)** | `ls <path>` · `upload` · `download` · `mkdir` | The claw's *real* working filesystem — arbitrary files, uploads, agent outputs, subdirectories. |
133
+ | **Netdisk (IDS)** | `netdisk …` | A separate large-object store for big products/videos, on a dedicated storage account. |
112
134
 
113
- `ls` / `pull` / `push` operate on a claw's **managed workspace files** — its
114
- "brain": `AGENTS.md`, `SOUL.md`, `MEMORY.md`, `TOOLS.md`, `IDENTITY.md`,
115
- `USER.md`, `HEARTBEAT.md`. (This is not a general file store — arbitrary
116
- filenames are rejected.)
135
+ ### 1. Managed brain files — `ls` / `pull` / `push`
136
+
137
+ The claw's "brain": `AGENTS.md`, `SOUL.md`, `MEMORY.md`, `TOOLS.md`,
138
+ `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`. A fixed allow-list — arbitrary
139
+ filenames are rejected; `push` only writes text.
117
140
 
118
141
  ```bash
119
142
  arkclaw ls # list them (defaults to your default claw)
@@ -123,6 +146,51 @@ arkclaw push ./agents.md AGENTS.md # write a managed file
123
146
  arkclaw ls --clawid ci-other # a different claw
124
147
  ```
125
148
 
149
+ ### 2. Workspace filesystem — `upload` / `download` / `mkdir` / `ls <path>`
150
+
151
+ The claw's **real** working filesystem (`/root/.openclaw/workspace`), over the
152
+ Silk file service. Paths are workspace-relative. Use it to feed an agent input
153
+ files and to retrieve whatever it produces.
154
+
155
+ ```bash
156
+ arkclaw upload ./input.png # → workspace root (basename)
157
+ arkclaw upload ./data.csv runs/data.csv # → a subpath
158
+ arkclaw mkdir runs # parent must exist (non-recursive)
159
+ arkclaw ls runs # list a workspace directory
160
+ arkclaw download runs/output.mp4 ./out.mp4 # pull a result back
161
+ arkclaw download runs ./runs.tar # a directory downloads as a .tar
162
+ ```
163
+
164
+ - **Requires a Silk-enabled claw.** A claw you can chat but that isn't
165
+ provisioned into Silk is rejected with a clear "未启用文件服务(Silk)" error
166
+ (`ErrClawInstanceNotFound`); Silk runs the *same* per-user gate as chat.
167
+ - **Upload cap** is server-side (~25 MB per file); larger uploads return a clear
168
+ "文件超出上传上限" error.
169
+ - There is **no `rm`** here — workspace deletes aren't exposed as a command.
170
+
171
+ ### 3. Netdisk (IDS) — `netdisk …`
172
+
173
+ A separate storage plane for large products/videos, on a **dedicated IDS
174
+ account** (not your SSO identity). Configured entirely from `IDS_*` env vars
175
+ (provisioned by the storage team). Create a space once, then pass its `SpaceID`:
176
+
177
+ ```bash
178
+ arkclaw netdisk create-space my-space # → prints the SpaceID
179
+ arkclaw netdisk mkdir outputs --space spc-...
180
+ arkclaw netdisk upload ./final.mp4 outputs/final.mp4 --space spc-...
181
+ arkclaw netdisk ls outputs/ --space spc-...
182
+ arkclaw netdisk download outputs/final.mp4 ./final.mp4 --space spc-...
183
+ arkclaw netdisk rm outputs/final.mp4 --space spc-... # asks unless --yes
184
+ ```
185
+
186
+ `create-space` also takes `--description`; `ls` takes `--limit N` to cap entries.
187
+
188
+ | Env | Purpose |
189
+ |---|---|
190
+ | `IDS_BASE_URL` / `IDS_REGION` / `IDS_SERVICE` / `IDS_INSTANCE_ID` | Endpoint + routing for the IDS instance. |
191
+ | `IDS_AK` / `IDS_SK` (+ `IDS_ACCOUNT_ID`) | Static credentials for the storage account… |
192
+ | `IDS_ROLE_TRN` | …or assume a role via SSO instead of static AK/SK. |
193
+
126
194
  ---
127
195
 
128
196
  ## For agents / automation
@@ -159,15 +227,18 @@ values via env:
159
227
  | `ARKCLAW_CLIENT_ID` | The CLI's public OAuth client id for the pool. |
160
228
  | `ARKCLAW_ROLE_TRN` | STS role that mints the ChatToken (openclaw). |
161
229
  | `ARKCLAW_REGION` / `ARKCLAW_SPACE_ID` | Override region / space (usually auto). |
230
+ | `ARKCLAW_API_HOST` / `ARKCLAW_API_SERVICE` | **Advanced/testing.** Point the control-plane calls at a non-production plane (host + SigV4 service). See the note below. |
162
231
 
163
232
  Other config: `~/.arkclaw/defaults.json` (`init` answers, 0600), `~/.arkclaw/session.json` (routing, 0600), `~/.arkclaw/cmdpolicy.json` (tool-approval allow/deny), OS keychain (tokens).
164
233
 
165
234
  > **Escape hatch (admin/test):** `arkclaw login <url> --transport openclaw --static-creds` uses `VOLCENGINE_ACCESS_KEY`/`SECRET_KEY` from the env instead of SSO — convenient for CI, but it's account-level keys, not identity-through.
166
235
 
236
+ > **Control-plane override (advanced/testing):** by default every control-plane call (chat/terminal token mints, file/fleet actions, `doctor`) targets `arkclaw.<region>.volcengineapi.com` with SigV4 service `arkclaw`. Setting `ARKCLAW_API_HOST` + `ARKCLAW_API_SERVICE` retargets them — e.g. a non-production plane. The service is also the IAM action prefix, so a non-default service needs the matching role permissions. The host receives the **signed request including live temporary credentials**, so it must be a host you trust — only `*.volcengineapi.com` is accepted.
237
+
167
238
  ---
168
239
 
169
240
  ## Notes
170
241
 
171
- - `ls`/`pull`/`push` and a bare `chat` use your **default claw** (set at login, or the last one you opened in the browser); override with `--clawid` (or `chat ci-...`).
172
- - File commands cover the claw's **managed** files only; arbitrary file drop isn't exposed by the API.
242
+ - `ls`/`pull`/`push`, `upload`/`download`/`mkdir`, and a bare `chat` use your **default claw** (set at login, or the last one you opened in the browser); override with `--clawid` (or `chat ci-...`).
243
+ - `pull`/`push` reach the claw's **managed** files; `upload`/`download` reach its **workspace filesystem** (Silk, arbitrary files); `netdisk …` is a **separate** storage plane on its own account.
173
244
  - Nothing is hardcoded per space — the CLI reads what the space serves.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "arkclaw-webchat-cli"
7
- version = "0.6.1"
7
+ version = "0.9.0"
8
8
  description = "CLI to chat with an ArkClaw EE space's Claw over enterprise SSO — zero permanent AK/SK."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -24,6 +24,7 @@ dependencies = [
24
24
  "typer>=0.12.0",
25
25
  "websockets>=12.0",
26
26
  "keyring>=24.0",
27
+ "msgpack>=1.0",
27
28
  ]
28
29
 
29
30
  [project.optional-dependencies]
@@ -11,11 +11,25 @@ import pathlib
11
11
  from ee_claw.errors import ValidationError
12
12
  from ee_claw.transport.base import Attachment
13
13
 
14
- MAX_FILE_BYTES = 64 * 1024
15
- MAX_TOTAL_BYTES = 256 * 1024
14
+ # Text attachments inline into the prompt, so they stay tight; binary ones
15
+ # (images, pdf, …) ride the native chat.send `attachments` field and only need
16
+ # to fit under the server's ws payload cap (~25MB; base64 inflates ×4/3).
17
+ MAX_FILE_BYTES = 64 * 1024 # per text file (inlined into the prompt)
18
+ MAX_BINARY_FILE_BYTES = 10 * 1024 * 1024 # per binary file (native attachment)
19
+ MAX_TOTAL_BYTES = 12 * 1024 * 1024 # across all attachments in one turn
16
20
  MAX_FILES = 32
17
21
 
18
22
 
23
+ def _is_text(content: bytes) -> bool:
24
+ """UTF-8-decodable → treat as text (inline-able); otherwise binary (rides
25
+ the native attachment field as raw bytes)."""
26
+ try:
27
+ content.decode("utf-8")
28
+ return True
29
+ except UnicodeDecodeError:
30
+ return False
31
+
32
+
19
33
  def collect_files(paths: list[str]) -> tuple[list[Attachment], list[str]]:
20
34
  """Read files (and directories, shallow-recursively) into attachments.
21
35
  Returns ``(attachments, notices)`` — notices describe everything that was
@@ -54,11 +68,20 @@ def collect_files(paths: list[str]) -> tuple[list[Attachment], list[str]]:
54
68
  except OSError as e:
55
69
  notices.append(f"读不了 {f}: {e.__class__.__name__}")
56
70
  continue
57
- if len(content) > MAX_FILE_BYTES:
58
- notices.append(f"{f.name} 截断到 {MAX_FILE_BYTES // 1024}KB(原 {len(content)} 字节)")
59
- content = content[:MAX_FILE_BYTES]
71
+ if _is_text(content):
72
+ # text inlines into the prompt — truncating just shortens context
73
+ if len(content) > MAX_FILE_BYTES:
74
+ notices.append(f"{f.name} 截断到 {MAX_FILE_BYTES // 1024}KB(原 {len(content)} 字节)")
75
+ content = content[:MAX_FILE_BYTES]
76
+ elif len(content) > MAX_BINARY_FILE_BYTES:
77
+ # NEVER truncate binary — half an image is corrupt; skip it, loudly
78
+ notices.append(
79
+ f"{f.name} 超出 {MAX_BINARY_FILE_BYTES // 1024 // 1024}MB 二进制上限,已跳过"
80
+ f"(原 {len(content)} 字节)"
81
+ )
82
+ continue
60
83
  if total + len(content) > MAX_TOTAL_BYTES:
61
- notices.append(f"总量超出 {MAX_TOTAL_BYTES // 1024}KB,从 {f.name} 起丢弃")
84
+ notices.append(f"总量超出 {MAX_TOTAL_BYTES // 1024 // 1024}MB,从 {f.name} 起丢弃")
62
85
  break
63
86
  total += len(content)
64
87
  mime = mimetypes.guess_type(f.name)[0] or "application/octet-stream"