@blockrun/clawrouter 0.12.70 → 0.12.71

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,48 @@ 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 workspaceSkillsDir = join10(homedir7(), ".openclaw", "skills");
50741
+ mkdirSync3(workspaceSkillsDir, { recursive: true });
50742
+ const entries = readdirSync(bundledSkillsDir, { withFileTypes: true });
50743
+ let installed = 0;
50744
+ for (const entry of entries) {
50745
+ if (!entry.isDirectory()) continue;
50746
+ const skillName = entry.name;
50747
+ const srcSkillFile = join10(bundledSkillsDir, skillName, "SKILL.md");
50748
+ if (!existsSync3(srcSkillFile)) continue;
50749
+ const destDir = join10(workspaceSkillsDir, `blockrun-${skillName}`);
50750
+ const destSkillFile = join10(destDir, "SKILL.md");
50751
+ let needsUpdate = true;
50752
+ if (existsSync3(destSkillFile)) {
50753
+ try {
50754
+ const srcContent = readTextFileSync(srcSkillFile);
50755
+ const destContent = readTextFileSync(destSkillFile);
50756
+ if (srcContent === destContent) needsUpdate = false;
50757
+ } catch {
50758
+ }
50759
+ }
50760
+ if (needsUpdate) {
50761
+ mkdirSync3(destDir, { recursive: true });
50762
+ copyFileSync(srcSkillFile, destSkillFile);
50763
+ installed++;
50764
+ }
50765
+ }
50766
+ if (installed > 0) {
50767
+ logger.info(`Installed ${installed} skill(s) to ${workspaceSkillsDir}`);
50768
+ }
50769
+ } catch (err) {
50770
+ logger.warn(
50771
+ `Failed to install skills: ${err instanceof Error ? err.message : String(err)}`
50772
+ );
50773
+ }
50774
+ }
50732
50775
  function isCompletionMode() {
50733
50776
  const args = process.argv;
50734
50777
  return args.some((arg, i) => arg === "completion" && i >= 1 && i <= 3);
@@ -51415,6 +51458,7 @@ var plugin = {
51415
51458
  api.logger.info("ClawRouter disabled (CLAWROUTER_DISABLED=true). Using default routing.");
51416
51459
  return;
51417
51460
  }
51461
+ installSkillsToWorkspace(api.logger);
51418
51462
  if (isCompletionMode()) {
51419
51463
  api.registerProvider(blockrunProvider);
51420
51464
  return;