traderclaw-cli 1.0.109 → 1.0.110

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.
@@ -1,8 +1,8 @@
1
1
  import { execFileSync, execSync, spawn } from "child_process";
2
2
  import { randomBytes } from "crypto";
3
- import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, statSync, writeFileSync } from "fs";
3
+ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } from "fs";
4
4
  import { homedir, tmpdir } from "os";
5
- import { dirname, join } from "path";
5
+ import { basename, dirname, join } from "path";
6
6
  import { resolvePluginPackageRoot } from "./resolve-plugin-root.mjs";
7
7
  import { choosePreferredProviderModel } from "./llm-model-preference.mjs";
8
8
  import { getLinuxGatewayPersistenceSnapshot } from "./gateway-persistence-linux.mjs";
@@ -1351,6 +1351,45 @@ export function deployWorkspaceHeartbeat(modeConfig) {
1351
1351
  return { deployed: true, skipped: false, source: src, dest };
1352
1352
  }
1353
1353
 
1354
+ /**
1355
+ * Copy all files from skills/solana-trader/workspace/ into ~/.openclaw/workspace/.
1356
+ * These are the bootstrap context files (AGENTS.md, SOUL.md, IDENTITY.md, TOOLS.md, etc.)
1357
+ * that OpenClaw injects into the agent's system prompt at startup.
1358
+ * Skips files that already exist and are non-empty so user customisations are preserved.
1359
+ */
1360
+ export function deployWorkspaceBootstrapFiles(modeConfig) {
1361
+ const npmRoot = getCommandOutput("npm root -g");
1362
+ if (!npmRoot) return { deployed: [], skipped: [], failed: [], reason: "npm_root_g_failed" };
1363
+
1364
+ const srcDir = join(npmRoot, modeConfig.pluginPackage, "skills", "solana-trader", "workspace");
1365
+ if (!existsSync(srcDir)) return { deployed: [], skipped: [], failed: [], reason: "source_dir_missing", srcDir };
1366
+
1367
+ const workspaceDir = resolveAgentWorkspaceDir(CONFIG_FILE);
1368
+ mkdirSync(workspaceDir, { recursive: true });
1369
+
1370
+ const deployed = [];
1371
+ const skipped = [];
1372
+ const failed = [];
1373
+
1374
+ for (const file of readdirSync(srcDir)) {
1375
+ const src = join(srcDir, file);
1376
+ const dest = join(workspaceDir, file);
1377
+ try {
1378
+ if (existsSync(dest)) {
1379
+ try {
1380
+ if (statSync(dest).size > 0) { skipped.push(dest); continue; }
1381
+ } catch {}
1382
+ }
1383
+ writeFileSync(dest, readFileSync(src, "utf-8"), "utf-8");
1384
+ deployed.push(dest);
1385
+ } catch (err) {
1386
+ failed.push({ dest, error: err.message });
1387
+ }
1388
+ }
1389
+
1390
+ return { deployed, skipped, failed, workspaceDir };
1391
+ }
1392
+
1354
1393
  function accessTokenEnvBase(agentId) {
1355
1394
  return `X_ACCESS_TOKEN_${agentId.toUpperCase().replace(/-/g, "_")}`;
1356
1395
  }
@@ -2655,6 +2694,29 @@ export class InstallerStepEngine {
2655
2694
  return result;
2656
2695
  });
2657
2696
 
2697
+ await this.runStep("workspace_bootstrap", "Installing workspace context files (AGENTS.md, SOUL.md, IDENTITY.md…)", async () => {
2698
+ const result = deployWorkspaceBootstrapFiles(this.modeConfig);
2699
+ if (result.reason) {
2700
+ this.emitLog("workspace_bootstrap", "warn", `Could not install workspace bootstrap files (${result.reason})${result.srcDir ? `. Expected dir: ${result.srcDir}` : ""}`);
2701
+ return result;
2702
+ }
2703
+ if (result.deployed.length) {
2704
+ this.emitLog("workspace_bootstrap", "info", `Deployed to ${result.workspaceDir}:`);
2705
+ for (const f of result.deployed) {
2706
+ this.emitLog("workspace_bootstrap", "info", ` + ${basename(f)}`);
2707
+ }
2708
+ }
2709
+ if (result.skipped.length) {
2710
+ this.emitLog("workspace_bootstrap", "info", `Skipped (already present, user-customised): ${result.skipped.map(f => basename(f)).join(", ")}`);
2711
+ }
2712
+ if (result.failed.length) {
2713
+ for (const { dest, error } of result.failed) {
2714
+ this.emitLog("workspace_bootstrap", "warn", `Failed to write ${dest}: ${error}`);
2715
+ }
2716
+ }
2717
+ return result;
2718
+ });
2719
+
2658
2720
  await this.runStep("setup_handoff", "Preparing secure setup handoff", async () => {
2659
2721
  const handoff = this.buildSetupHandoff();
2660
2722
  this.state.setupHandoff = handoff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.109",
3
+ "version": "1.0.110",
4
4
  "description": "Global TraderClaw CLI (install --wizard, setup, precheck). Installs solana-traderclaw as a dependency for OpenClaw plugin files.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "node": ">=22"
18
18
  },
19
19
  "dependencies": {
20
- "solana-traderclaw": "^1.0.109"
20
+ "solana-traderclaw": "^1.0.110"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",