clawdock 0.2.2 → 0.2.4
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/dist/index.js +16 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -401,13 +401,16 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
|
|
|
401
401
|
if (resolvedModel) console.log(` Model: ${resolvedModel}`);
|
|
402
402
|
console.log();
|
|
403
403
|
if (runtimeName === "openclaw") {
|
|
404
|
+
let needsRegister = true;
|
|
404
405
|
try {
|
|
405
|
-
const list = execSync(
|
|
406
|
+
const list = execSync(`openclaw agents list --json ${devNull}`, { encoding: "utf-8", shell: isWindows ? "cmd.exe" : void 0 });
|
|
406
407
|
const agents = JSON.parse(list);
|
|
407
|
-
if (
|
|
408
|
-
|
|
408
|
+
if (agents.find((a) => a.name === agentName)) {
|
|
409
|
+
needsRegister = false;
|
|
409
410
|
}
|
|
410
411
|
} catch {
|
|
412
|
+
}
|
|
413
|
+
if (needsRegister) {
|
|
411
414
|
console.log(` Registering agent "${agentName}"...`);
|
|
412
415
|
try {
|
|
413
416
|
const modelFlag = resolvedModel ? ` --model ${resolvedModel}` : "";
|
|
@@ -416,8 +419,12 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
|
|
|
416
419
|
{ stdio: "inherit" }
|
|
417
420
|
);
|
|
418
421
|
} catch (err) {
|
|
419
|
-
|
|
420
|
-
|
|
422
|
+
if (err.message?.includes("already exists") || err.stderr?.includes("already exists")) {
|
|
423
|
+
console.log(` Agent "${agentName}" already registered.`);
|
|
424
|
+
} else {
|
|
425
|
+
console.error(`\u274C Failed to register agent: ${err.message}`);
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
421
428
|
}
|
|
422
429
|
}
|
|
423
430
|
if (provider && apiKey) {
|
|
@@ -433,7 +440,8 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
|
|
|
433
440
|
["agent", "--agent", agentName, "--prompt", "Hello! I just pulled you from ClawDock. Introduce yourself."],
|
|
434
441
|
{
|
|
435
442
|
stdio: "inherit",
|
|
436
|
-
env: { ...process.env }
|
|
443
|
+
env: { ...process.env },
|
|
444
|
+
shell: isWindows
|
|
437
445
|
}
|
|
438
446
|
);
|
|
439
447
|
child.on("error", (err) => {
|
|
@@ -467,7 +475,8 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
|
|
|
467
475
|
fs.writeFileSync(configPath, JSON.stringify(nullclawConfig, null, 2));
|
|
468
476
|
const child = spawn(runtimeBin, ["--config", configPath, "--workspace", workspaceDir], {
|
|
469
477
|
stdio: "inherit",
|
|
470
|
-
cwd: workspaceDir
|
|
478
|
+
cwd: workspaceDir,
|
|
479
|
+
shell: isWindows
|
|
471
480
|
});
|
|
472
481
|
child.on("error", (err) => {
|
|
473
482
|
console.error(`\u274C Failed to start NullClaw: ${err.message}`);
|