@blockrun/clawrouter 0.12.70 → 0.12.72

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 CHANGED
@@ -50308,7 +50308,8 @@ import {
50308
50308
  renameSync
50309
50309
  } from "fs";
50310
50310
  import { homedir as homedir7 } from "os";
50311
- import { join as join10 } from "path";
50311
+ import { join as join10, dirname as dirname3 } from "path";
50312
+ import { fileURLToPath as fileURLToPath2 } from "url";
50312
50313
  init_accounts();
50313
50314
 
50314
50315
  // src/partners/registry.ts
@@ -50729,6 +50730,50 @@ async function waitForProxyHealth(port, timeoutMs = 3e3) {
50729
50730
  }
50730
50731
  return false;
50731
50732
  }
50733
+ function installSkillsToWorkspace(logger) {
50734
+ try {
50735
+ const packageRoot = join10(dirname3(fileURLToPath2(import.meta.url)), "..");
50736
+ const bundledSkillsDir = join10(packageRoot, "skills");
50737
+ if (!existsSync3(bundledSkillsDir)) {
50738
+ return;
50739
+ }
50740
+ const profile = (process["env"].OPENCLAW_PROFILE ?? "").trim().toLowerCase();
50741
+ const workspaceDirName = profile && profile !== "default" ? `workspace-${profile}` : "workspace";
50742
+ const workspaceSkillsDir = join10(homedir7(), ".openclaw", workspaceDirName, "skills");
50743
+ mkdirSync3(workspaceSkillsDir, { recursive: true });
50744
+ const entries = readdirSync(bundledSkillsDir, { withFileTypes: true });
50745
+ let installed = 0;
50746
+ for (const entry of entries) {
50747
+ if (!entry.isDirectory()) continue;
50748
+ const skillName = entry.name;
50749
+ const srcSkillFile = join10(bundledSkillsDir, skillName, "SKILL.md");
50750
+ if (!existsSync3(srcSkillFile)) continue;
50751
+ const destDir = join10(workspaceSkillsDir, skillName);
50752
+ const destSkillFile = join10(destDir, "SKILL.md");
50753
+ let needsUpdate = true;
50754
+ if (existsSync3(destSkillFile)) {
50755
+ try {
50756
+ const srcContent = readTextFileSync(srcSkillFile);
50757
+ const destContent = readTextFileSync(destSkillFile);
50758
+ if (srcContent === destContent) needsUpdate = false;
50759
+ } catch {
50760
+ }
50761
+ }
50762
+ if (needsUpdate) {
50763
+ mkdirSync3(destDir, { recursive: true });
50764
+ copyFileSync(srcSkillFile, destSkillFile);
50765
+ installed++;
50766
+ }
50767
+ }
50768
+ if (installed > 0) {
50769
+ logger.info(`Installed ${installed} skill(s) to ${workspaceSkillsDir}`);
50770
+ }
50771
+ } catch (err) {
50772
+ logger.warn(
50773
+ `Failed to install skills: ${err instanceof Error ? err.message : String(err)}`
50774
+ );
50775
+ }
50776
+ }
50732
50777
  function isCompletionMode() {
50733
50778
  const args = process.argv;
50734
50779
  return args.some((arg, i) => arg === "completion" && i >= 1 && i <= 3);
@@ -51415,6 +51460,7 @@ var plugin = {
51415
51460
  api.logger.info("ClawRouter disabled (CLAWROUTER_DISABLED=true). Using default routing.");
51416
51461
  return;
51417
51462
  }
51463
+ installSkillsToWorkspace(api.logger);
51418
51464
  if (isCompletionMode()) {
51419
51465
  api.registerProvider(blockrunProvider);
51420
51466
  return;