mlclaw 0.2.2 → 0.3.0
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.
- package/.agents/skills/mlclaw/SKILL.md +74 -33
- package/Dockerfile +47 -8
- package/README.md +89 -29
- package/assets/assistant-avatar.svg +5 -0
- package/assets/mlclaw-control-ui/assets/index-92PjW54g.js +9 -0
- package/assets/mlclaw-control-ui/assets/index-D1bHaYpf.css +1 -0
- package/assets/mlclaw-control-ui/index.html +2 -2
- package/dist/hf-state-sync.js +438 -76
- package/dist/hf-tooling-seed.js +64 -11
- package/dist/mlclaw-space-runtime.js +8435 -5949
- package/dist/mlclaw.mjs +408 -42
- package/entrypoint.sh +167 -17
- package/hf-broker.scope.json +38 -0
- package/package.json +26 -2
- package/space/README.md +14 -4
- package/src/hf-state-sync/archive.ts +15 -8
- package/src/hf-state-sync/cli.ts +33 -6
- package/src/hf-state-sync/hub.ts +82 -1
- package/src/hf-state-sync/paths.ts +23 -4
- package/src/hf-state-sync/prepare.ts +79 -0
- package/src/hf-state-sync/snapshot.ts +31 -9
- package/src/hf-state-sync/stage-worker.ts +165 -0
- package/src/hf-state-sync/supervise.ts +29 -10
- package/src/vendor/hfjs-xet/utils/ChunkCache.ts +1 -1
- package/src/vendor/hfjs-xet/utils/XetBlob.ts +2 -2
- package/src/vendor/hfjs-xet/utils/createXorbs.ts +2 -2
- package/assets/mlclaw-control-ui/assets/index-D2TFes32.js +0 -9
- package/assets/mlclaw-control-ui/assets/index-DP72PFuv.css +0 -1
|
@@ -9,7 +9,9 @@ description: Use when setting up, operating, migrating, repairing, or explaining
|
|
|
9
9
|
|
|
10
10
|
Use the `mlclaw` CLI as the source of truth. Do not hand-create Hugging Face
|
|
11
11
|
Spaces, buckets, secrets, or Docker containers unless debugging a failed
|
|
12
|
-
`mlclaw` operation. Keep credentials local to the user's machine.
|
|
12
|
+
`mlclaw` operation. Keep bootstrap credentials local to the user's machine.
|
|
13
|
+
Space OAuth credentials may be stored only through ML Claw's encrypted,
|
|
14
|
+
process-isolated integration store.
|
|
13
15
|
|
|
14
16
|
Default to the browser Space gateway unless the user explicitly asks for local
|
|
15
17
|
gateway mode.
|
|
@@ -20,24 +22,36 @@ An ML Claw deployment has:
|
|
|
20
22
|
|
|
21
23
|
- a private Hugging Face Storage Bucket for durable OpenClaw state snapshots;
|
|
22
24
|
- a private Hugging Face Docker Space for the default browser gateway;
|
|
25
|
+
- no explicit Space hardware request by default; Hugging Face assigns the
|
|
26
|
+
default free CPU hardware unless `--hardware` or a feature requiring paid
|
|
27
|
+
hardware is used;
|
|
23
28
|
- a prebuilt `ghcr.io/osolmaz/mlclaw` runtime image by default;
|
|
24
29
|
- Hugging Face OAuth enabled on the Space;
|
|
30
|
+
- automatic Hugging Face MCP and Research Agent integrations authorized by an
|
|
31
|
+
admin-only OAuth step after ordinary Hugging Face sign-in;
|
|
25
32
|
- a local deployment manifest under `~/.config/mlclaw/deployments/`;
|
|
26
33
|
- local secrets under `~/.config/mlclaw/secrets/`;
|
|
34
|
+
- app Spaces mount the private Storage Bucket read-write at
|
|
35
|
+
`/data/mlclaw-state` for snapshot storage without storing the user's broad
|
|
36
|
+
Hub token in the Space;
|
|
27
37
|
- preinstalled Hugging Face tooling in the OpenClaw workspace, including
|
|
28
38
|
`hf`, `hf-discover`, `uv`, HF Python libraries, and baseline Hugging Face
|
|
29
39
|
Agent Skills mirrored into both `.agents/skills` and `skills`;
|
|
30
40
|
- optional local Docker gateway mode for users who want the gateway on their
|
|
31
41
|
own machine;
|
|
32
|
-
- Hugging Face Router model configuration
|
|
42
|
+
- Hugging Face Router model configuration through an isolated HF Broker.
|
|
33
43
|
|
|
34
44
|
The bucket is the durable state source. The live gateway is disposable. Do not
|
|
35
|
-
mount a bucket as the live OpenClaw database filesystem.
|
|
45
|
+
mount a bucket as the live OpenClaw database filesystem. Space gateway mode
|
|
46
|
+
uses the mounted bucket only for verified snapshots; live SQLite and workspace
|
|
47
|
+
state stay on local container disk under
|
|
48
|
+
`/home/node/.local/share/mlclaw/live`.
|
|
36
49
|
|
|
37
|
-
ML Claw
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
session
|
|
50
|
+
ML Claw waits for OpenClaw's native first-run identity bootstrap to finish,
|
|
51
|
+
then seeds a managed Hugging Face tooling note into workspace `AGENTS.md` so
|
|
52
|
+
new sessions see the available Hugging Face skills directly in context. If a
|
|
53
|
+
long-running session predates the seed, start a new OpenClaw session so its
|
|
54
|
+
skill snapshot is rebuilt.
|
|
41
55
|
|
|
42
56
|
## Required Inputs
|
|
43
57
|
|
|
@@ -45,6 +59,8 @@ Collect or confirm:
|
|
|
45
59
|
|
|
46
60
|
- Hugging Face token access: `HF_TOKEN`, `HF_TOKEN_PATH`, `$HF_HOME/token`, or
|
|
47
61
|
`hf auth login`.
|
|
62
|
+
- The active Hugging Face token is installed as the broker-owned
|
|
63
|
+
`MLCLAW_BROKER_HF_TOKEN`; legacy dedicated Router tokens remain supported.
|
|
48
64
|
- Agent name, unless a Telegram bot token is supplied and the user wants the
|
|
49
65
|
name derived from the bot username.
|
|
50
66
|
- Gateway mode:
|
|
@@ -64,7 +80,7 @@ Space names from that.
|
|
|
64
80
|
With Node.js:
|
|
65
81
|
|
|
66
82
|
```bash
|
|
67
|
-
npx mlclaw bootstrap --name mlclaw
|
|
83
|
+
npx mlclaw@latest bootstrap --name mlclaw
|
|
68
84
|
```
|
|
69
85
|
|
|
70
86
|
Without Node.js on macOS/Linux:
|
|
@@ -92,13 +108,13 @@ node dist/mlclaw.mjs --help
|
|
|
92
108
|
Interactive:
|
|
93
109
|
|
|
94
110
|
```bash
|
|
95
|
-
npx mlclaw bootstrap --name mlclaw
|
|
111
|
+
npx mlclaw@latest bootstrap --name mlclaw
|
|
96
112
|
```
|
|
97
113
|
|
|
98
114
|
Automation:
|
|
99
115
|
|
|
100
116
|
```bash
|
|
101
|
-
npx mlclaw bootstrap \
|
|
117
|
+
npx mlclaw@latest bootstrap \
|
|
102
118
|
--name mlclaw \
|
|
103
119
|
--model huggingface/google/gemma-4-26B-A4B-it:deepinfra \
|
|
104
120
|
--yes
|
|
@@ -118,7 +134,7 @@ Create a public Space only when the user explicitly asks for a public demo or
|
|
|
118
134
|
template-style deployment:
|
|
119
135
|
|
|
120
136
|
```bash
|
|
121
|
-
npx mlclaw bootstrap --name mlclaw --public-space
|
|
137
|
+
npx mlclaw@latest bootstrap --name mlclaw --public-space
|
|
122
138
|
```
|
|
123
139
|
|
|
124
140
|
## Optional Telegram
|
|
@@ -126,7 +142,7 @@ npx mlclaw bootstrap --name mlclaw --public-space
|
|
|
126
142
|
Telegram is optional and should not be required for the default setup.
|
|
127
143
|
|
|
128
144
|
```bash
|
|
129
|
-
npx mlclaw bootstrap \
|
|
145
|
+
npx mlclaw@latest bootstrap \
|
|
130
146
|
--telegram-token-file ~/secrets/mlclaw_bot.env \
|
|
131
147
|
--telegram-user-id 1234567890 \
|
|
132
148
|
--hardware cpu-upgrade \
|
|
@@ -143,13 +159,13 @@ restriction because messaging traffic originates from the user's machine.
|
|
|
143
159
|
Use local gateway mode when the user wants the gateway on their machine:
|
|
144
160
|
|
|
145
161
|
```bash
|
|
146
|
-
npx mlclaw bootstrap --gateway local --name mlclaw
|
|
162
|
+
npx mlclaw@latest bootstrap --gateway local --name mlclaw
|
|
147
163
|
```
|
|
148
164
|
|
|
149
165
|
If the user has multiple Docker engines, pin the intended context:
|
|
150
166
|
|
|
151
167
|
```bash
|
|
152
|
-
npx mlclaw bootstrap \
|
|
168
|
+
npx mlclaw@latest bootstrap \
|
|
153
169
|
--gateway local \
|
|
154
170
|
--name mlclaw \
|
|
155
171
|
--docker-context desktop-linux
|
|
@@ -167,7 +183,7 @@ models, use the `huggingface/` prefix.
|
|
|
167
183
|
Default/recommended:
|
|
168
184
|
|
|
169
185
|
```bash
|
|
170
|
-
npx mlclaw bootstrap \
|
|
186
|
+
npx mlclaw@latest bootstrap \
|
|
171
187
|
--name mlclaw \
|
|
172
188
|
--model huggingface/google/gemma-4-26B-A4B-it:deepinfra
|
|
173
189
|
```
|
|
@@ -175,6 +191,7 @@ npx mlclaw bootstrap \
|
|
|
175
191
|
Known useful router-compatible choices:
|
|
176
192
|
|
|
177
193
|
- `huggingface/google/gemma-4-26B-A4B-it:deepinfra`: default quality target.
|
|
194
|
+
- `huggingface/Qwen/Qwen3.6-35B-A3B:deepinfra`: strong Qwen 3.6 option with tool and structured-output support.
|
|
178
195
|
- `huggingface/Qwen/Qwen3.6-27B:deepinfra`: live Qwen 3.6 option with tool and structured-output support.
|
|
179
196
|
- `huggingface/zai-org/GLM-5.2:deepinfra`: long-context GLM option with tool and structured-output support.
|
|
180
197
|
- `huggingface/moonshotai/Kimi-K2.7-Code:deepinfra`: coding-focused Kimi option with tool and structured-output support.
|
|
@@ -183,7 +200,11 @@ Known useful router-compatible choices:
|
|
|
183
200
|
- `huggingface/deepseek-ai/DeepSeek-V4-Flash:deepinfra`: low-cost long-context DeepSeek V4 option.
|
|
184
201
|
- `huggingface/deepseek-ai/DeepSeek-V4-Pro:deepinfra`: higher-quality long-context DeepSeek V4 option.
|
|
185
202
|
- `huggingface/MiniMaxAI/MiniMax-M3:together`: long-context MiniMax option with tool and structured-output support.
|
|
186
|
-
|
|
203
|
+
|
|
204
|
+
Fireworks alternatives using the `:fireworks-ai` suffix are curated for GLM
|
|
205
|
+
5.2, Kimi K2.7 Code, GPT-OSS 120B and 20B, DeepSeek V4 Flash and Pro, and
|
|
206
|
+
MiniMax M3. The Router catalog does not currently expose the Gemma 4 or Qwen
|
|
207
|
+
3.6 presets through Fireworks.
|
|
187
208
|
|
|
188
209
|
Do not assume every Hub model is a Router chat model. If exact current model
|
|
189
210
|
availability matters, check the Hugging Face Router catalog or run a direct
|
|
@@ -224,22 +245,39 @@ mlclaw gateway start <agent>
|
|
|
224
245
|
|
|
225
246
|
After signing into the Space, use the ML Claw control UI:
|
|
226
247
|
|
|
227
|
-
- `/mlclaw/settings` chooses Router model/provider rows
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- `/mlclaw/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
248
|
+
- `/mlclaw/settings` chooses Router model/provider rows. App Spaces without a
|
|
249
|
+
Hub token save the selection into snapshotted runtime state and restart only
|
|
250
|
+
OpenClaw; the CLI remains responsible for privileged Space variable changes.
|
|
251
|
+
- `/mlclaw/status` shows runtime, bucket, model, OAuth, and integration status.
|
|
252
|
+
- `/mlclaw/credentials` connects or disconnects Hugging Face MCP and Research
|
|
253
|
+
Agent access, and stores an OpenAI API key.
|
|
254
|
+
|
|
255
|
+
The trusted ML Claw wrapper stores Hugging Face OAuth tokens encrypted on the
|
|
256
|
+
mounted private state volume. OpenClaw runs as a separate unprivileged Unix
|
|
257
|
+
user and receives only local MCP server URLs plus an internal capability
|
|
258
|
+
header; never place the OAuth token in OpenClaw config or environment.
|
|
259
|
+
|
|
260
|
+
After migrating to a local gateway, the MCP proxy uses the local deployment's
|
|
261
|
+
Hugging Face token inside the trusted wrapper instead of requiring the Space's
|
|
262
|
+
OAuth client. Migrating back resumes the encrypted OAuth credential retained
|
|
263
|
+
in the private bucket. OpenClaw receives only a generated HF Broker agent
|
|
264
|
+
credential; it never receives the broader local Hub token or the broker
|
|
265
|
+
operator credential.
|
|
266
|
+
|
|
267
|
+
The OpenAI key is stored as a 0600 runtime file for immediate use. For
|
|
268
|
+
restart-durable OpenAI credentials, use the local `mlclaw` CLI or Space
|
|
269
|
+
settings to set a Space Secret; do not put the user's broad Hub token into the
|
|
270
|
+
Space just so the browser app can mutate secrets. The key must never be logged
|
|
271
|
+
or returned to the browser.
|
|
235
272
|
|
|
236
273
|
## Branding
|
|
237
274
|
|
|
238
275
|
ML Claw white-labels the browser gateway at the proxy layer. App Spaces default
|
|
239
|
-
the browser title, PWA manifest,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
276
|
+
the browser title, PWA manifest, login heading, and ML Claw control link to the
|
|
277
|
+
agent name. The ML Claw logo is reserved for the control UI brand mark. The
|
|
278
|
+
gateway shortcut, login logo, and default browser icons use the Hugging Face
|
|
279
|
+
logo. The OpenClaw assistant fallback avatar defaults to a neutral assistant
|
|
280
|
+
icon.
|
|
243
281
|
|
|
244
282
|
Use Space variables for explicit branding:
|
|
245
283
|
|
|
@@ -251,7 +289,8 @@ MLCLAW_BRAND_LOGO="mlclaw.svg"
|
|
|
251
289
|
MLCLAW_BRAND_FAVICON="hf-logo.svg"
|
|
252
290
|
MLCLAW_BRAND_FAVICON_32="hf-logo.svg"
|
|
253
291
|
MLCLAW_BRAND_FAVICON_ICO="hf-logo.svg"
|
|
254
|
-
MLCLAW_BRAND_APPLE_TOUCH_ICON="
|
|
292
|
+
MLCLAW_BRAND_APPLE_TOUCH_ICON="assistant-avatar.svg"
|
|
293
|
+
MLCLAW_BRAND_ASSISTANT_AVATAR="assistant-avatar.svg"
|
|
255
294
|
```
|
|
256
295
|
|
|
257
296
|
Brand asset paths are relative to the Space `assets/` directory. ML Claw serves
|
|
@@ -260,7 +299,9 @@ them through `/assets/brand/logo`, `/favicon.svg`, `/favicon-32.png`,
|
|
|
260
299
|
|
|
261
300
|
## State Safety
|
|
262
301
|
|
|
263
|
-
OpenClaw uses local disk.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
302
|
+
OpenClaw uses local disk. In Space gateway mode, the private bucket is mounted
|
|
303
|
+
at `/data/mlclaw-state`, but it stores verified snapshots only. On boot, the
|
|
304
|
+
runtime restores the newest valid snapshot into
|
|
305
|
+
`/home/node/.local/share/mlclaw/live`. During runtime and shutdown,
|
|
306
|
+
`hf-state-sync` writes new snapshots back to the mounted bucket. Secrets are
|
|
307
|
+
kept outside the snapshot path.
|
package/Dockerfile
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
ARG OPENCLAW_VERSION=2026.7.1-beta.
|
|
1
|
+
ARG OPENCLAW_VERSION=2026.7.1-beta.5
|
|
2
2
|
ARG OPENCLAW_BASE_IMAGE=ghcr.io/openclaw/openclaw:${OPENCLAW_VERSION}
|
|
3
|
-
ARG
|
|
3
|
+
ARG BROKERKIT_PLUGIN_VERSION=0.1.0
|
|
4
|
+
ARG BROKERKIT_VERSION=fcfc5f2304436d952b18e7c9583bb378d1952776
|
|
5
|
+
ARG MLCLAW_RUNTIME_IMAGE=ghcr.io/osolmaz/mlclaw:0.3.0-openclaw-2026.7.1-beta.5
|
|
6
|
+
ARG HF_BROKER_VERSION=bb65192b4dca845289427e63e1d5fa72f64914d8
|
|
7
|
+
|
|
8
|
+
FROM golang:1.26.5-bookworm AS hf-broker-build
|
|
9
|
+
ARG HF_BROKER_VERSION
|
|
10
|
+
RUN git init /src \
|
|
11
|
+
&& git -C /src fetch --depth=1 https://github.com/osolmaz/hf-broker.git "$HF_BROKER_VERSION" \
|
|
12
|
+
&& git -C /src checkout --detach FETCH_HEAD \
|
|
13
|
+
&& test "$(git -C /src rev-parse HEAD)" = "$HF_BROKER_VERSION" \
|
|
14
|
+
&& cd /src \
|
|
15
|
+
&& GOWORK=off go build -trimpath -o /out/hf-broker ./cmd/hf-broker
|
|
16
|
+
|
|
17
|
+
FROM node:24-bookworm-slim AS brokerkit-plugin-build
|
|
18
|
+
ARG BROKERKIT_VERSION
|
|
19
|
+
RUN apt-get update \
|
|
20
|
+
&& apt-get install -y --no-install-recommends ca-certificates git \
|
|
21
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
22
|
+
&& git init /src \
|
|
23
|
+
&& git -C /src fetch --depth=1 https://github.com/osolmaz/brokerkit.git "$BROKERKIT_VERSION" \
|
|
24
|
+
&& git -C /src checkout --detach FETCH_HEAD \
|
|
25
|
+
&& test "$(git -C /src rev-parse HEAD)" = "$BROKERKIT_VERSION"
|
|
26
|
+
WORKDIR /src
|
|
27
|
+
RUN corepack enable \
|
|
28
|
+
&& pnpm install --frozen-lockfile \
|
|
29
|
+
&& pnpm --filter openclaw-brokerkit build \
|
|
30
|
+
&& pnpm --filter openclaw-brokerkit pack --pack-destination /out
|
|
4
31
|
|
|
5
32
|
# Stage 1: build the state-sync bundle so the runtime image needs no dev deps.
|
|
6
33
|
FROM node:24-bookworm-slim AS sync-build
|
|
@@ -17,7 +44,8 @@ LABEL org.opencontainers.image.description="ML Claw runtime for OpenClaw on Hugg
|
|
|
17
44
|
USER root
|
|
18
45
|
# zstd: snapshot archives. gosu: drop privileges after preparing mounted volumes.
|
|
19
46
|
RUN apt-get update \
|
|
20
|
-
&& apt-get install -y --no-install-recommends gosu python3 python3-pip python3-venv zstd \
|
|
47
|
+
&& apt-get install -y --no-install-recommends ca-certificates gosu python3 python3-pip python3-venv zstd \
|
|
48
|
+
&& useradd --system --home-dir /var/lib/hf-broker --create-home --shell /usr/sbin/nologin hf-broker \
|
|
21
49
|
&& rm -rf /var/lib/apt/lists/*
|
|
22
50
|
RUN python3 -m pip install --break-system-packages --no-cache-dir \
|
|
23
51
|
"huggingface_hub==1.19.0" \
|
|
@@ -31,10 +59,18 @@ RUN python3 -m pip install --break-system-packages --no-cache-dir \
|
|
|
31
59
|
"uvicorn==0.49.0" \
|
|
32
60
|
"uv==0.11.28" \
|
|
33
61
|
"hf-discover==1.3.7"
|
|
62
|
+
ARG BROKERKIT_PLUGIN_VERSION
|
|
63
|
+
COPY --from=brokerkit-plugin-build /out/openclaw-brokerkit-${BROKERKIT_PLUGIN_VERSION}.tgz /tmp/openclaw-brokerkit.tgz
|
|
64
|
+
RUN npm install --omit=dev --omit=peer --no-audit --no-fund --prefix /opt/openclaw-plugins \
|
|
65
|
+
/tmp/openclaw-brokerkit.tgz \
|
|
66
|
+
&& rm /tmp/openclaw-brokerkit.tgz \
|
|
67
|
+
&& test -f /opt/openclaw-plugins/node_modules/openclaw-brokerkit/openclaw.plugin.json
|
|
34
68
|
|
|
35
69
|
COPY --from=sync-build /build/dist/hf-state-sync.js /app/hf-state-sync.js
|
|
36
70
|
COPY --from=sync-build /build/dist/hf-tooling-seed.js /app/hf-tooling-seed.js
|
|
37
71
|
COPY --from=sync-build /build/dist/mlclaw-space-runtime.js /app/mlclaw-space-runtime.js
|
|
72
|
+
COPY --from=hf-broker-build /out/hf-broker /usr/local/bin/hf-broker
|
|
73
|
+
COPY hf-broker.scope.json /app/hf-broker.scope.json
|
|
38
74
|
COPY --chown=node:node openclaw.default.json /app/openclaw.default.json
|
|
39
75
|
COPY --chown=node:node entrypoint.sh /app/entrypoint.sh
|
|
40
76
|
COPY --chown=node:node assets/ /app/assets/
|
|
@@ -43,15 +79,18 @@ RUN chmod +x /app/entrypoint.sh
|
|
|
43
79
|
|
|
44
80
|
USER root
|
|
45
81
|
|
|
46
|
-
# Live state on local disk;
|
|
82
|
+
# Live state stays on local disk; Space bucket volumes are mounted separately for snapshots.
|
|
47
83
|
ENV PORT=7860
|
|
48
84
|
ENV MLCLAW_OPENCLAW_PORT=7861
|
|
85
|
+
ENV MLCLAW_OPENCLAW_UID=1000
|
|
86
|
+
ENV MLCLAW_OPENCLAW_GID=1000
|
|
49
87
|
ENV OPENCLAW_GATEWAY_PORT=7861
|
|
50
|
-
ENV OPENCLAW_LIVE_DIR=/
|
|
51
|
-
ENV OPENCLAW_STATE_DIR=/
|
|
52
|
-
ENV OPENCLAW_WORKSPACE_DIR=/
|
|
53
|
-
ENV OPENCLAW_CONFIG_PATH=/
|
|
88
|
+
ENV OPENCLAW_LIVE_DIR=/home/node/.local/share/mlclaw/live
|
|
89
|
+
ENV OPENCLAW_STATE_DIR=/home/node/.local/share/mlclaw/live/.openclaw
|
|
90
|
+
ENV OPENCLAW_WORKSPACE_DIR=/home/node/.local/share/mlclaw/live/workspace
|
|
91
|
+
ENV OPENCLAW_CONFIG_PATH=/home/node/.local/share/mlclaw/live/.openclaw/openclaw.json
|
|
54
92
|
ENV OPENCLAW_DISABLE_BONJOUR=1
|
|
93
|
+
ENV MLCLAW_BROKERKIT_PLUGIN_PATH=/opt/openclaw-plugins/node_modules/openclaw-brokerkit
|
|
55
94
|
ARG MLCLAW_RUNTIME_IMAGE
|
|
56
95
|
ENV MLCLAW_RUNTIME_IMAGE=$MLCLAW_RUNTIME_IMAGE
|
|
57
96
|
|
package/README.md
CHANGED
|
@@ -12,12 +12,18 @@ The browser never receives an OpenClaw gateway token. ML Claw authenticates the
|
|
|
12
12
|
signed-in Hugging Face user, then proxies HTTP and WebSocket traffic to
|
|
13
13
|
OpenClaw on loopback using OpenClaw trusted-proxy auth.
|
|
14
14
|
|
|
15
|
+
After signing in, an administrator can authorize the hosted Hugging Face MCP
|
|
16
|
+
server and Research Agent with the same Hugging Face account. Ordinary users
|
|
17
|
+
grant only identity scopes. Integration credentials stay in the trusted ML
|
|
18
|
+
Claw wrapper; the unprivileged OpenClaw process receives only loopback MCP
|
|
19
|
+
access.
|
|
20
|
+
|
|
15
21
|
## Install
|
|
16
22
|
|
|
17
23
|
With Node.js:
|
|
18
24
|
|
|
19
25
|
```bash
|
|
20
|
-
npx mlclaw bootstrap
|
|
26
|
+
npx mlclaw@latest bootstrap
|
|
21
27
|
```
|
|
22
28
|
|
|
23
29
|
Without Node.js, the launcher fetches a pinned Node runtime into your user
|
|
@@ -37,19 +43,32 @@ You need a Hugging Face account and a token available through `HF_TOKEN`,
|
|
|
37
43
|
`HF_TOKEN_PATH`, `$HF_HOME/token`, or `hf auth login`. You never paste that
|
|
38
44
|
token into someone else's app; the bootstrapper runs locally.
|
|
39
45
|
|
|
46
|
+
ML Claw places the active Hugging Face token behind an in-container HF Broker.
|
|
47
|
+
The broker owns the real token; OpenClaw receives only a separate agent
|
|
48
|
+
credential that can call the broker's typed, policy-checked routes. It cannot
|
|
49
|
+
read the token or use the admin-only operator API. Existing dedicated inference
|
|
50
|
+
tokens remain supported through `MLCLAW_ROUTER_TOKEN`, `HF_ROUTER_TOKEN`, or
|
|
51
|
+
`--router-token-file` during migration.
|
|
52
|
+
|
|
40
53
|
## Default Flow
|
|
41
54
|
|
|
42
55
|
```bash
|
|
43
|
-
npx mlclaw bootstrap --name mlclaw
|
|
56
|
+
npx mlclaw@latest bootstrap --name mlclaw
|
|
44
57
|
```
|
|
45
58
|
|
|
46
59
|
This creates:
|
|
47
60
|
|
|
48
61
|
- a private Storage Bucket for OpenClaw state;
|
|
49
62
|
- a private Docker Space for the browser gateway;
|
|
63
|
+
- no explicit Space hardware request; Hugging Face uses the default free CPU
|
|
64
|
+
hardware unless you pass `--hardware`;
|
|
50
65
|
- a Docker Space that starts from the prebuilt `ghcr.io/osolmaz/mlclaw` image;
|
|
51
|
-
- Hugging Face OAuth metadata
|
|
52
|
-
|
|
66
|
+
- Hugging Face OAuth metadata for browser auth, Hugging Face MCP, and Research
|
|
67
|
+
Agent access in the Space README;
|
|
68
|
+
- Space variables, a bucket volume mount for state sync, and separate
|
|
69
|
+
write-only secrets for session signing and OAuth credential encryption;
|
|
70
|
+
- an `MLCLAW_BROKER_HF_TOKEN` Space secret consumed only by the isolated HF
|
|
71
|
+
Broker process;
|
|
53
72
|
- a local deployment manifest under `~/.config/mlclaw`.
|
|
54
73
|
|
|
55
74
|
Open the Space, sign in with your Hugging Face account, and use the OpenClaw
|
|
@@ -59,13 +78,13 @@ for settings, status, credentials, and sign out.
|
|
|
59
78
|
Create a public Space only when you explicitly want a public demo or template:
|
|
60
79
|
|
|
61
80
|
```bash
|
|
62
|
-
npx mlclaw bootstrap --name mlclaw --public-space
|
|
81
|
+
npx mlclaw@latest bootstrap --name mlclaw --public-space
|
|
63
82
|
```
|
|
64
83
|
|
|
65
84
|
Choose a Hugging Face Router model with `--model`:
|
|
66
85
|
|
|
67
86
|
```bash
|
|
68
|
-
npx mlclaw bootstrap \
|
|
87
|
+
npx mlclaw@latest bootstrap \
|
|
69
88
|
--name mlclaw \
|
|
70
89
|
--model huggingface/google/gemma-4-26B-A4B-it:deepinfra
|
|
71
90
|
```
|
|
@@ -73,6 +92,7 @@ npx mlclaw bootstrap \
|
|
|
73
92
|
Recommended router-compatible options:
|
|
74
93
|
|
|
75
94
|
- `huggingface/google/gemma-4-26B-A4B-it:deepinfra`: default quality target.
|
|
95
|
+
- `huggingface/Qwen/Qwen3.6-35B-A3B:deepinfra`: strong Qwen 3.6 option with tool and structured-output support.
|
|
76
96
|
- `huggingface/Qwen/Qwen3.6-27B:deepinfra`: live Qwen 3.6 option with tool and structured-output support.
|
|
77
97
|
- `huggingface/zai-org/GLM-5.2:deepinfra`: long-context GLM option with tool and structured-output support.
|
|
78
98
|
- `huggingface/moonshotai/Kimi-K2.7-Code:deepinfra`: coding-focused Kimi option with tool and structured-output support.
|
|
@@ -81,7 +101,11 @@ Recommended router-compatible options:
|
|
|
81
101
|
- `huggingface/deepseek-ai/DeepSeek-V4-Flash:deepinfra`: low-cost long-context DeepSeek V4 option.
|
|
82
102
|
- `huggingface/deepseek-ai/DeepSeek-V4-Pro:deepinfra`: higher-quality long-context DeepSeek V4 option.
|
|
83
103
|
- `huggingface/MiniMaxAI/MiniMax-M3:together`: long-context MiniMax option with tool and structured-output support.
|
|
84
|
-
|
|
104
|
+
|
|
105
|
+
Fireworks alternatives are also included for GLM 5.2, Kimi K2.7 Code,
|
|
106
|
+
GPT-OSS 120B and 20B, DeepSeek V4 Flash and Pro, and MiniMax M3. Use the
|
|
107
|
+
provider suffix `:fireworks-ai`. The current Router catalog does not expose the
|
|
108
|
+
Gemma 4 or Qwen 3.6 presets through Fireworks.
|
|
85
109
|
|
|
86
110
|
## Optional Telegram
|
|
87
111
|
|
|
@@ -90,7 +114,7 @@ Telegram `getMe`, removes a trailing `_bot` from the username, and can derive
|
|
|
90
114
|
the Space and bucket names from the bot username.
|
|
91
115
|
|
|
92
116
|
```bash
|
|
93
|
-
npx mlclaw bootstrap \
|
|
117
|
+
npx mlclaw@latest bootstrap \
|
|
94
118
|
--telegram-token-file ~/secrets/mlclaw_bot.env \
|
|
95
119
|
--telegram-user-id 1234567890 \
|
|
96
120
|
--hardware cpu-upgrade \
|
|
@@ -107,7 +131,7 @@ only for automation.
|
|
|
107
131
|
You can run the gateway locally instead of inside a Space:
|
|
108
132
|
|
|
109
133
|
```bash
|
|
110
|
-
npx mlclaw bootstrap --gateway local --name mlclaw
|
|
134
|
+
npx mlclaw@latest bootstrap --gateway local --name mlclaw
|
|
111
135
|
```
|
|
112
136
|
|
|
113
137
|
Local mode uses Docker on your machine and the same private Storage Bucket.
|
|
@@ -121,6 +145,10 @@ mlclaw gateway migrate mlclaw --to local
|
|
|
121
145
|
mlclaw gateway migrate mlclaw --to space
|
|
122
146
|
```
|
|
123
147
|
|
|
148
|
+
The local MCP proxy uses the Hugging Face token kept in the local deployment
|
|
149
|
+
environment. The trusted wrapper does not need the Space OAuth client, and the
|
|
150
|
+
encrypted Space OAuth credential remains in the bucket for migration back.
|
|
151
|
+
|
|
124
152
|
Useful operations:
|
|
125
153
|
|
|
126
154
|
```bash
|
|
@@ -158,7 +186,9 @@ It never reads secret values and never modifies bucket contents.
|
|
|
158
186
|
|
|
159
187
|
`mlclaw update` also refreshes the generated Space Dockerfile and runtime
|
|
160
188
|
metadata, so older Spaces can move to the current implementation without
|
|
161
|
-
recreating their bucket.
|
|
189
|
+
recreating their bucket. For legacy deployments, ML Claw installs the active
|
|
190
|
+
local Hugging Face credential as `MLCLAW_BROKER_HF_TOKEN`, removes stale direct
|
|
191
|
+
token secrets, and restarts the Space with the broker boundary enabled.
|
|
162
192
|
|
|
163
193
|
## Browser Settings
|
|
164
194
|
|
|
@@ -172,8 +202,21 @@ Use the browser control UI for:
|
|
|
172
202
|
|
|
173
203
|
- `/mlclaw/settings`: choose Router model/provider rows, update `OPENCLAW_MODEL`
|
|
174
204
|
and `MLCLAW_MODEL_CHOICES`, and request a Space restart.
|
|
175
|
-
- `/mlclaw/status`: inspect runtime, bucket, model, and
|
|
176
|
-
|
|
205
|
+
- `/mlclaw/status`: inspect runtime, bucket, model, OAuth, and integration status.
|
|
206
|
+
|
|
207
|
+
OpenClaw's BrokerKit plugin adds an **Approvals** tab to the gateway. The tab
|
|
208
|
+
merges every BrokerKit-compatible backend configured in
|
|
209
|
+
`MLCLAW_OPERATOR_BROKERS_FILE` and lets administrators inspect, approve, deny,
|
|
210
|
+
cancel, or revoke requests. The plugin registers the Gateway tab, while ML Claw
|
|
211
|
+
serves the immutable packaged UI from its trusted HTTP boundary and gives it a
|
|
212
|
+
small launcher inside the Gateway. Decisions open in an unframeable protected
|
|
213
|
+
document with a renewable, short-lived, admin-bound browser token. Broker
|
|
214
|
+
operator tokens remain in backend-only files and are never sent to the browser
|
|
215
|
+
or OpenClaw. See
|
|
216
|
+
[Operator Broker Configuration](docs/operator-brokers-config.md).
|
|
217
|
+
|
|
218
|
+
- `/mlclaw/credentials`: connect or disconnect Hugging Face MCP and Research
|
|
219
|
+
Agent access, or submit an OpenAI API key.
|
|
177
220
|
- `/mlclaw/logout`: clear the ML Claw session cookie.
|
|
178
221
|
|
|
179
222
|
The same control UI is linked from the OpenClaw gateway. Settings changes
|
|
@@ -182,10 +225,11 @@ mutate only the current Space, inferred from `SPACE_ID`.
|
|
|
182
225
|
## Branding
|
|
183
226
|
|
|
184
227
|
ML Claw white-labels the browser-facing gateway by default. App Spaces use the
|
|
185
|
-
agent name as the browser title, PWA name, login heading,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
228
|
+
agent name as the browser title, PWA name, login heading, and ML Claw control
|
|
229
|
+
link label. The ML Claw logo is reserved for the control UI brand mark. The
|
|
230
|
+
gateway shortcut, login logo, and default browser icons use the Hugging Face
|
|
231
|
+
logo. The OpenClaw assistant fallback avatar defaults to a neutral assistant
|
|
232
|
+
icon.
|
|
189
233
|
|
|
190
234
|
Override branding with Space variables:
|
|
191
235
|
|
|
@@ -197,7 +241,8 @@ MLCLAW_BRAND_LOGO=mlclaw.svg
|
|
|
197
241
|
MLCLAW_BRAND_FAVICON=hf-logo.svg
|
|
198
242
|
MLCLAW_BRAND_FAVICON_32=hf-logo.svg
|
|
199
243
|
MLCLAW_BRAND_FAVICON_ICO=hf-logo.svg
|
|
200
|
-
MLCLAW_BRAND_APPLE_TOUCH_ICON=
|
|
244
|
+
MLCLAW_BRAND_APPLE_TOUCH_ICON=assistant-avatar.svg
|
|
245
|
+
MLCLAW_BRAND_ASSISTANT_AVATAR=assistant-avatar.svg
|
|
201
246
|
```
|
|
202
247
|
|
|
203
248
|
Brand asset paths are relative to the Space `assets/` directory. ML Claw serves
|
|
@@ -213,21 +258,36 @@ After signing into the Space, open:
|
|
|
213
258
|
```
|
|
214
259
|
|
|
215
260
|
Submit an OpenAI API key there if you want OpenClaw to use OpenAI-compatible
|
|
216
|
-
models. ML Claw
|
|
217
|
-
|
|
218
|
-
OpenClaw gateway with `OPENAI_API_KEY` set.
|
|
219
|
-
|
|
261
|
+
models. ML Claw writes a `0600` runtime file for immediate use and an encrypted
|
|
262
|
+
durable credential protected by `MLCLAW_CREDENTIAL_KEY`, then restarts the
|
|
263
|
+
internal OpenClaw gateway with `OPENAI_API_KEY` set. When trusted Hub authority
|
|
264
|
+
is available, it also stores the key as a write-only Space secret. The key is
|
|
265
|
+
never returned to the browser, exposed to the agent except as its intended
|
|
266
|
+
OpenAI credential, or stored as plaintext in the state bucket. App Spaces do
|
|
267
|
+
not keep broad Hugging Face authority in the web control process.
|
|
220
268
|
|
|
221
269
|
## How State Works
|
|
222
270
|
|
|
223
|
-
OpenClaw runs against local disk inside the active runtime.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
migration.
|
|
271
|
+
OpenClaw runs against local disk inside the active runtime. In Space gateway
|
|
272
|
+
mode, ML Claw mounts the private Storage Bucket at `/data/mlclaw-state` and
|
|
273
|
+
uses that mounted directory only for verified snapshots. The live OpenClaw
|
|
274
|
+
state stays on local container disk at
|
|
275
|
+
`/home/node/.local/share/mlclaw/live`.
|
|
276
|
+
|
|
277
|
+
That keeps SQLite off bucket-backed storage while preserving the agent's memory
|
|
278
|
+
across Space rebuilds, local container replacement, and gateway migration. The
|
|
279
|
+
Space does not use `HF_TOKEN` or `HUGGINGFACE_HUB_TOKEN` secrets. Its broad
|
|
280
|
+
credential is stored as `MLCLAW_BROKER_HF_TOKEN`, written to a broker-owned
|
|
281
|
+
`0600` file during startup, and removed from child-process environments.
|
|
282
|
+
OpenClaw uses only the generated broker agent credential. Broker grant and
|
|
283
|
+
event state and encrypted control credentials live under the root-owned
|
|
284
|
+
`/var/lib/mlclaw-protected` tree. They are included in the durable snapshot
|
|
285
|
+
through a root-only `.mlclaw-protected` staging step, then restored outside the
|
|
286
|
+
agent-owned live directory before OpenClaw starts. Rebuildable Git mirrors, the
|
|
287
|
+
broad token, and operator credentials are never included in snapshots.
|
|
288
|
+
Local gateways pass the broad credential only to the trusted state-sync
|
|
289
|
+
supervisor for bucket I/O and to the trusted MCP integration proxy through a
|
|
290
|
+
protected token file. Neither path passes it to OpenClaw.
|
|
231
291
|
|
|
232
292
|
## Costs
|
|
233
293
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" role="img" aria-label="Assistant">
|
|
2
|
+
<rect width="256" height="256" rx="64" fill="#111827"/>
|
|
3
|
+
<path fill="#f9fafb" d="M128 52 146 107h58l-47 34 18 55-47-34-47 34 18-55-47-34h58z"/>
|
|
4
|
+
<circle cx="128" cy="128" r="92" fill="none" stroke="#f9fafb" stroke-width="10" opacity=".22"/>
|
|
5
|
+
</svg>
|