mlclaw 0.2.3 → 0.3.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 +58 -19
- package/Dockerfile +46 -8
- package/README.md +75 -17
- 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 +8403 -5935
- package/dist/mlclaw.mjs +406 -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
package/dist/hf-tooling-seed.js
CHANGED
|
@@ -6,6 +6,8 @@ import fs from "node:fs/promises";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
var DEFAULT_HF_TOOLING_ASSET_ROOT = "/app/assets/hf-tooling";
|
|
8
8
|
var DEFAULT_OPENCLAW_LIVE_DIR = "/tmp/openclaw-live";
|
|
9
|
+
var OPENCLAW_BOOTSTRAP_FILENAME = "BOOTSTRAP.md";
|
|
10
|
+
var OPENCLAW_WORKSPACE_STATE_FILENAME = "openclaw-workspace-state.json";
|
|
9
11
|
var MLCLAW_CONTEXT_START = "<!-- MLCLAW:HUGGINGFACE_TOOLING:START -->";
|
|
10
12
|
var MLCLAW_CONTEXT_END = "<!-- MLCLAW:HUGGINGFACE_TOOLING:END -->";
|
|
11
13
|
async function seedHuggingFaceTooling(options = {}) {
|
|
@@ -43,6 +45,49 @@ async function seedHuggingFaceTooling(options = {}) {
|
|
|
43
45
|
wroteManifest
|
|
44
46
|
};
|
|
45
47
|
}
|
|
48
|
+
async function waitForBootstrapAndSeedHuggingFaceTooling(options = {}) {
|
|
49
|
+
const env = options.env ?? process.env;
|
|
50
|
+
const workspaceDir = options.workspaceDir ?? resolveWorkspaceDir(env);
|
|
51
|
+
const bootstrapPath = path.join(workspaceDir, OPENCLAW_BOOTSTRAP_FILENAME);
|
|
52
|
+
const statePath = path.join(workspaceDir, OPENCLAW_WORKSPACE_STATE_FILENAME);
|
|
53
|
+
const pollIntervalMs = options.pollIntervalMs ?? 1e3;
|
|
54
|
+
let observedPendingBootstrap = false;
|
|
55
|
+
while (!options.signal?.aborted) {
|
|
56
|
+
if (await pathExists(bootstrapPath)) {
|
|
57
|
+
observedPendingBootstrap = true;
|
|
58
|
+
} else if (!observedPendingBootstrap || await workspaceSetupIsComplete(statePath)) {
|
|
59
|
+
return await seedHuggingFaceTooling({ ...options, workspaceDir });
|
|
60
|
+
}
|
|
61
|
+
await waitForPoll(pollIntervalMs, options.signal);
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
async function workspaceSetupIsComplete(statePath) {
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse(await fs.readFile(statePath, "utf8"));
|
|
68
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const setupCompletedAt = parsed.setupCompletedAt;
|
|
72
|
+
return typeof setupCompletedAt === "string" && setupCompletedAt.trim().length > 0;
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function waitForPoll(delayMs, signal) {
|
|
78
|
+
if (signal?.aborted) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
await new Promise((resolve) => {
|
|
82
|
+
const finish = () => {
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
signal?.removeEventListener("abort", finish);
|
|
85
|
+
resolve();
|
|
86
|
+
};
|
|
87
|
+
const timer = setTimeout(finish, delayMs);
|
|
88
|
+
signal?.addEventListener("abort", finish, { once: true });
|
|
89
|
+
});
|
|
90
|
+
}
|
|
46
91
|
async function copyBaselineSkills(params) {
|
|
47
92
|
const copied = [];
|
|
48
93
|
const skipped = [];
|
|
@@ -243,18 +288,26 @@ function isMissingFileError(err) {
|
|
|
243
288
|
}
|
|
244
289
|
|
|
245
290
|
// src/hf-tooling/cli.ts
|
|
291
|
+
var waitForBootstrap = process.argv.includes("--wait-for-bootstrap");
|
|
292
|
+
var abort = new AbortController();
|
|
293
|
+
process.on("SIGTERM", () => abort.abort());
|
|
294
|
+
process.on("SIGINT", () => abort.abort());
|
|
246
295
|
try {
|
|
247
|
-
const result = await seedHuggingFaceTooling();
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
296
|
+
const result = waitForBootstrap ? await waitForBootstrapAndSeedHuggingFaceTooling({ signal: abort.signal }) : await seedHuggingFaceTooling();
|
|
297
|
+
if (!result) {
|
|
298
|
+
process.exitCode = 0;
|
|
299
|
+
} else {
|
|
300
|
+
const copied = result.copiedSkills.length;
|
|
301
|
+
const skipped = result.skippedSkills.length;
|
|
302
|
+
const workspaceCopied = result.copiedWorkspaceSkills.length;
|
|
303
|
+
const workspaceSkipped = result.skippedWorkspaceSkills.length;
|
|
304
|
+
const templates = result.copiedTemplateFiles.length;
|
|
305
|
+
const context = result.wroteContextFile ? "updated" : "current";
|
|
306
|
+
const manifest = result.wroteManifest ? "updated" : "current";
|
|
307
|
+
console.log(
|
|
308
|
+
`[hf-tooling] workspace=${result.workspaceDir} agentsSkills=copied:${copied},skipped:${skipped} workspaceSkills=copied:${workspaceCopied},skipped:${workspaceSkipped} templates:${templates} context:${context} manifest:${manifest}`
|
|
309
|
+
);
|
|
310
|
+
}
|
|
258
311
|
} catch (err) {
|
|
259
312
|
console.error(`[hf-tooling] ${err instanceof Error ? err.message : String(err)}`);
|
|
260
313
|
process.exitCode = 1;
|