mlclaw 0.3.8 → 0.4.1
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 +23 -3
- package/Dockerfile +2 -2
- package/README.md +109 -19
- package/dist/hf-state-sync.js +4 -3
- package/dist/mlclaw-space-runtime.js +261 -62
- package/dist/mlclaw.mjs +7737 -544
- package/entrypoint.sh +5 -5
- package/openclaw.default.json +5 -3
- package/package.json +4 -4
- package/src/hf-state-sync/cli.ts +4 -3
- package/tsconfig.json +1 -0
|
@@ -59,8 +59,9 @@ Collect or confirm:
|
|
|
59
59
|
|
|
60
60
|
- Hugging Face token access: `HF_TOKEN`, `HF_TOKEN_PATH`, `$HF_HOME/token`, or
|
|
61
61
|
`hf auth login`.
|
|
62
|
-
-
|
|
63
|
-
`MLCLAW_BROKER_HF_TOKEN`;
|
|
62
|
+
- A separate fine-grained Hugging Face token is installed as the broker-owned
|
|
63
|
+
`MLCLAW_BROKER_HF_TOKEN`; the active CLI login is used only to provision
|
|
64
|
+
resources. Legacy dedicated Router tokens remain supported for inference.
|
|
64
65
|
- Agent name, unless a Telegram bot token is supplied and the user wants the
|
|
65
66
|
name derived from the bot username.
|
|
66
67
|
- Gateway mode:
|
|
@@ -162,6 +163,25 @@ Use local gateway mode when the user wants the gateway on their machine:
|
|
|
162
163
|
npx mlclaw@latest bootstrap --gateway local --name mlclaw
|
|
163
164
|
```
|
|
164
165
|
|
|
166
|
+
After the first setup, `mlclaw bootstrap` and `mlclaw configure` automatically
|
|
167
|
+
select the only local deployment. Use the same command to reconfigure or resume
|
|
168
|
+
it. If local configuration is missing, interactive bootstrap can recover a
|
|
169
|
+
validated deployment marker from an owned Storage Bucket; credentials and
|
|
170
|
+
machine-specific container bindings must be supplied again.
|
|
171
|
+
|
|
172
|
+
Tailnet access is explicit:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npx mlclaw@latest bootstrap --gateway local --tailscale=direct
|
|
176
|
+
npx mlclaw@latest bootstrap --gateway local --tailscale=serve
|
|
177
|
+
npx mlclaw@latest bootstrap --gateway local --tailscale=off
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Direct mode binds loopback and the exact Tailscale IPv4 address. Serve mode
|
|
181
|
+
keeps the gateway on loopback and creates one HTTPS Serve mapping. A Serve
|
|
182
|
+
administrator approval prompt is resumable: approve the printed URL, then run
|
|
183
|
+
bootstrap again.
|
|
184
|
+
|
|
165
185
|
If the user has multiple Docker engines, pin the intended context:
|
|
166
186
|
|
|
167
187
|
```bash
|
|
@@ -185,7 +205,7 @@ Default/recommended:
|
|
|
185
205
|
```bash
|
|
186
206
|
npx mlclaw@latest bootstrap \
|
|
187
207
|
--name mlclaw \
|
|
188
|
-
--model huggingface/
|
|
208
|
+
--model huggingface/zai-org/GLM-5.2:fireworks-ai
|
|
189
209
|
```
|
|
190
210
|
|
|
191
211
|
Known useful router-compatible choices:
|
package/Dockerfile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ARG OPENCLAW_VERSION=2026.7.1
|
|
2
2
|
ARG OPENCLAW_BASE_IMAGE=ghcr.io/openclaw/openclaw:${OPENCLAW_VERSION}
|
|
3
3
|
ARG BROKERKIT_PLUGIN_VERSION=0.2.1
|
|
4
|
-
ARG BROKERKIT_VERSION=hf-broker/v0.
|
|
5
|
-
ARG MLCLAW_RUNTIME_IMAGE=ghcr.io/osolmaz/mlclaw:0.
|
|
4
|
+
ARG BROKERKIT_VERSION=hf-broker/v0.2.0
|
|
5
|
+
ARG MLCLAW_RUNTIME_IMAGE=ghcr.io/osolmaz/mlclaw:0.4.1-openclaw-2026.7.1
|
|
6
6
|
|
|
7
7
|
FROM golang:1.26.5-bookworm AS hf-broker-build
|
|
8
8
|
ARG BROKERKIT_VERSION
|
package/README.md
CHANGED
|
@@ -47,12 +47,23 @@ flow, and resumes after sign-in. Non-interactive runs never install software and
|
|
|
47
47
|
still require a token up front. You never paste that token into someone else's
|
|
48
48
|
app; the bootstrapper runs locally.
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
credential
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
The `hf` CLI login is a provisioning credential: ML Claw uses it to create and
|
|
51
|
+
configure resources owned by your account. HF Broker uses a separate, durable
|
|
52
|
+
fine-grained credential whose required permissions are versioned by BrokerKit.
|
|
53
|
+
Interactive bootstrap opens Hugging Face's token form with those fields
|
|
54
|
+
preselected, then accepts the new token through a hidden local prompt. Creating
|
|
55
|
+
or replacing this credential never changes the active `hf` CLI login. For
|
|
56
|
+
automation, pass a `0600` file through `--broker-hf-token-file`; ML Claw does
|
|
57
|
+
not accept the token as a command-line value.
|
|
58
|
+
|
|
59
|
+
The broker owns the selected credential; OpenClaw receives only a separate
|
|
60
|
+
agent credential that can call the broker's typed, policy-checked routes. It
|
|
61
|
+
cannot read the token or use the admin-only operator API. Rerunning bootstrap
|
|
62
|
+
reuses a healthy saved broker credential without reopening the form. A missing,
|
|
63
|
+
invalid, wrong-account, or under-scoped credential must be repaired before ML
|
|
64
|
+
Claw continues; it never silently substitutes the active CLI login. Existing
|
|
65
|
+
dedicated inference tokens remain supported through `MLCLAW_ROUTER_TOKEN`,
|
|
66
|
+
`HF_ROUTER_TOKEN`, or `--router-token-file` during migration.
|
|
56
67
|
|
|
57
68
|
## Default Flow
|
|
58
69
|
|
|
@@ -62,10 +73,9 @@ npx mlclaw@latest bootstrap --name mlclaw
|
|
|
62
73
|
|
|
63
74
|
This creates:
|
|
64
75
|
|
|
65
|
-
- a private
|
|
66
|
-
- a private
|
|
67
|
-
- no explicit Space hardware request
|
|
68
|
-
hardware unless you pass `--hardware`;
|
|
76
|
+
- a private Docker Space for the browser gateway when the account can host it;
|
|
77
|
+
- a private Storage Bucket for OpenClaw state after the Space is accepted;
|
|
78
|
+
- no explicit Space hardware request unless you pass `--hardware`;
|
|
69
79
|
- a Docker Space that starts from the prebuilt `ghcr.io/osolmaz/mlclaw` image;
|
|
70
80
|
- Hugging Face OAuth metadata for browser auth, Hugging Face MCP, and Research
|
|
71
81
|
Agent access in the Space README;
|
|
@@ -75,6 +85,19 @@ This creates:
|
|
|
75
85
|
Broker process;
|
|
76
86
|
- a local deployment manifest under `~/.config/mlclaw`.
|
|
77
87
|
|
|
88
|
+
Hugging Face currently requires PRO for Docker Space hosting. When creation is
|
|
89
|
+
rejected for that reason, interactive bootstrap checks for a usable local
|
|
90
|
+
Docker or rootless Podman engine and offers to run the same gateway locally.
|
|
91
|
+
No bucket is created before hosted eligibility is known. Bootstrap does not
|
|
92
|
+
install a container engine or change daemon permissions.
|
|
93
|
+
|
|
94
|
+
Automation fails instead of changing execution location implicitly. Opt in to
|
|
95
|
+
the same fallback with:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx mlclaw@latest bootstrap --yes --allow-local-fallback
|
|
99
|
+
```
|
|
100
|
+
|
|
78
101
|
Open the Space, sign in with your Hugging Face account, and use the OpenClaw
|
|
79
102
|
browser gateway directly. The gateway includes a small ML Claw control link
|
|
80
103
|
for settings, status, credentials, and sign out.
|
|
@@ -139,9 +162,60 @@ You can run the gateway locally instead of inside a Space:
|
|
|
139
162
|
npx mlclaw@latest bootstrap --gateway local --name mlclaw
|
|
140
163
|
```
|
|
141
164
|
|
|
142
|
-
Local mode uses
|
|
143
|
-
|
|
144
|
-
|
|
165
|
+
Local mode uses a ready Docker-compatible engine or rootless Podman on your
|
|
166
|
+
machine and the same private Storage Bucket. Runtime selection is deterministic:
|
|
167
|
+
the existing manifest binding wins, an explicit choice comes next, and
|
|
168
|
+
`auto` probes Docker before Podman. Select one explicitly when needed:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npx mlclaw@latest bootstrap --gateway local --container-runtime docker
|
|
172
|
+
npx mlclaw@latest bootstrap --gateway local --container-runtime podman
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Bootstrap is also the reconfiguration command. With one known deployment,
|
|
176
|
+
rerun `mlclaw bootstrap` or `mlclaw configure` without `--name`; ML Claw selects
|
|
177
|
+
it, shows only configuration changes, and verifies no-op runs without restarting
|
|
178
|
+
a healthy gateway. If the local cache is missing, interactive bootstrap can
|
|
179
|
+
recover a deployment from its validated marker in an owned Storage Bucket.
|
|
180
|
+
Recovery never invents a replacement encryption key: restore the deployment's
|
|
181
|
+
existing `MLCLAW_CREDENTIAL_KEY` in the environment for the recovery run. ML
|
|
182
|
+
Claw verifies its stored SHA-256 fingerprint before changing the runtime.
|
|
183
|
+
|
|
184
|
+
Cross-host reconciliation uses a generated private Hugging Face model repository
|
|
185
|
+
per deployment as its control lock. Parent-commit compare-and-swap prevents two
|
|
186
|
+
controllers from acquiring the same deployment lease concurrently.
|
|
187
|
+
|
|
188
|
+
The local control plane is published only on loopback. The default URL is
|
|
189
|
+
`http://127.0.0.1:7860`; choose another unprivileged port with `--local-port`
|
|
190
|
+
when needed. On a remote host, use the SSH forwarding command printed by the
|
|
191
|
+
CLI, then open the same loopback URL in your local browser. The CLI prints a
|
|
192
|
+
private fragment-based access link that is exchanged for an HTTP-only browser
|
|
193
|
+
session; rerun `mlclaw gateway status <agent>` to retrieve it.
|
|
194
|
+
|
|
195
|
+
To reach the gateway from other devices on your private tailnet, choose direct
|
|
196
|
+
HTTP over Tailscale or an HTTPS Tailscale Serve mapping:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx mlclaw@latest bootstrap --gateway local --tailscale=direct
|
|
200
|
+
npx mlclaw@latest bootstrap --gateway local --tailscale=serve
|
|
201
|
+
mlclaw gateway start mlclaw --tailscale=off
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Interactive bootstrap offers this option when Tailscale is installed, signed
|
|
205
|
+
in, and online; it remains off by default. Direct mode publishes only loopback
|
|
206
|
+
and the node's exact Tailscale IPv4 address. Traffic is HTTP in the browser but
|
|
207
|
+
encrypted between tailnet peers by Tailscale. Serve mode keeps the container on
|
|
208
|
+
loopback and owns one scoped HTTPS handler. ML Claw keeps its own browser
|
|
209
|
+
session authentication in front of OpenClaw in both modes, never enables
|
|
210
|
+
Funnel, and never resets unrelated Serve handlers. Use `--tailscale-port
|
|
211
|
+
<port>` for a non-default port. If Serve needs tailnet administrator approval,
|
|
212
|
+
the loopback gateway remains running; approve the printed URL and rerun
|
|
213
|
+
`mlclaw bootstrap` to resume.
|
|
214
|
+
|
|
215
|
+
Docker Desktop, OrbStack, Colima, Rancher Desktop, and other Docker-compatible
|
|
216
|
+
engines are used through Docker contexts. On Windows, Podman machine
|
|
217
|
+
connections are supported through the Podman CLI. Local mode avoids Hugging
|
|
218
|
+
Face messaging egress limits because Telegram traffic comes from your network.
|
|
145
219
|
|
|
146
220
|
Move between local and Space without losing state:
|
|
147
221
|
|
|
@@ -163,9 +237,9 @@ mlclaw gateway stop mlclaw
|
|
|
163
237
|
mlclaw gateway start mlclaw
|
|
164
238
|
```
|
|
165
239
|
|
|
166
|
-
Local
|
|
167
|
-
|
|
168
|
-
or another Docker engine:
|
|
240
|
+
Local deployments are pinned to their selected engine and connection. Rebind
|
|
241
|
+
Docker deployments explicitly if you move between Docker Desktop, OrbStack,
|
|
242
|
+
Colima, or another Docker engine:
|
|
169
243
|
|
|
170
244
|
```bash
|
|
171
245
|
mlclaw gateway rebind mlclaw --docker-context desktop-linux
|
|
@@ -191,9 +265,25 @@ It never reads secret values and never modifies bucket contents.
|
|
|
191
265
|
|
|
192
266
|
`mlclaw update` also refreshes the generated Space Dockerfile and runtime
|
|
193
267
|
metadata, so older Spaces can move to the current implementation without
|
|
194
|
-
recreating their bucket.
|
|
195
|
-
|
|
196
|
-
|
|
268
|
+
recreating their bucket. It does not promote the active Hugging Face CLI login
|
|
269
|
+
into a runtime secret. Recover or repair the dedicated broker credential first
|
|
270
|
+
when updating a deployment that predates this boundary.
|
|
271
|
+
|
|
272
|
+
Inspect or replace the dedicated credential with:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
mlclaw credentials status mlclaw
|
|
276
|
+
mlclaw credentials repair mlclaw
|
|
277
|
+
mlclaw credentials repair mlclaw --broker-hf-token-file ~/secrets/mlclaw-broker.env
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`status` performs a read-only verification and prints the account, BrokerKit
|
|
281
|
+
profile, verification time, and a short SHA-256 fingerprint, never the token.
|
|
282
|
+
`repair` validates the replacement before changing anything. Local running
|
|
283
|
+
gateways are replaced transactionally and rolled back on failure; stopped local
|
|
284
|
+
gateways stay stopped. Space repair uses the active CLI login only to install
|
|
285
|
+
the already-validated secret and restart the Space, restoring the previous
|
|
286
|
+
secret and local metadata if the operation fails.
|
|
197
287
|
|
|
198
288
|
## Browser Settings
|
|
199
289
|
|
package/dist/hf-state-sync.js
CHANGED
|
@@ -9814,15 +9814,16 @@ async function main(argv) {
|
|
|
9814
9814
|
return runStageWorker(liveDir);
|
|
9815
9815
|
}
|
|
9816
9816
|
const config = resolveSyncConfig();
|
|
9817
|
+
if (argv[0] === "prepare-restore") {
|
|
9818
|
+
await prepareRestore(config);
|
|
9819
|
+
return 0;
|
|
9820
|
+
}
|
|
9817
9821
|
const hub = makeHub(config);
|
|
9818
9822
|
if (!hub) {
|
|
9819
9823
|
logError("OPENCLAW_HF_STATE_BUCKET is not set; state will NOT survive restarts");
|
|
9820
9824
|
}
|
|
9821
9825
|
const mode = argv[0];
|
|
9822
9826
|
switch (mode) {
|
|
9823
|
-
case "prepare-restore":
|
|
9824
|
-
await prepareRestore(config);
|
|
9825
|
-
return 0;
|
|
9826
9827
|
case "restore": {
|
|
9827
9828
|
if (!hub) {
|
|
9828
9829
|
return 0;
|