@nextclaw/server 0.5.1 → 0.5.2

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { join } from "path";
9
9
 
10
10
  // src/ui/router.ts
11
11
  import { Hono } from "hono";
12
- import { SkillsLoader, getWorkspacePathFromConfig as getWorkspacePathFromConfig2 } from "@nextclaw/core";
12
+ import * as NextclawCore from "@nextclaw/core";
13
13
  import { buildPluginStatusReport } from "@nextclaw/openclaw-compat";
14
14
 
15
15
  // src/ui/config.ts
@@ -572,12 +572,21 @@ function updateRuntime(configPath, patch) {
572
572
  // src/ui/router.ts
573
573
  var DEFAULT_MARKETPLACE_API_BASE = "https://marketplace-api.nextclaw.io";
574
574
  var NEXTCLAW_PLUGIN_NPM_PREFIX = "@nextclaw/channel-plugin-";
575
+ var CLAWBAY_CHANNEL_PLUGIN_NPM_SPEC = "@clawbay/clawbay-channel";
575
576
  var BUILTIN_CHANNEL_PLUGIN_ID_PREFIX = "builtin-channel-";
576
577
  var MARKETPLACE_REMOTE_PAGE_SIZE = 100;
577
578
  var MARKETPLACE_REMOTE_MAX_PAGES = 20;
578
- function normalizeChannelPluginNpmSpec(rawSpec) {
579
+ var getWorkspacePathFromConfig3 = NextclawCore.getWorkspacePathFromConfig;
580
+ function createSkillsLoader(workspace) {
581
+ const ctor = NextclawCore.SkillsLoader;
582
+ if (!ctor) {
583
+ return null;
584
+ }
585
+ return new ctor(workspace);
586
+ }
587
+ function normalizePluginNpmSpec(rawSpec) {
579
588
  const spec = rawSpec.trim();
580
- if (!spec.startsWith(NEXTCLAW_PLUGIN_NPM_PREFIX)) {
589
+ if (!spec.startsWith("@")) {
581
590
  return spec;
582
591
  }
583
592
  const versionDelimiterIndex = spec.lastIndexOf("@");
@@ -585,12 +594,19 @@ function normalizeChannelPluginNpmSpec(rawSpec) {
585
594
  return spec;
586
595
  }
587
596
  const packageName = spec.slice(0, versionDelimiterIndex).trim();
588
- return packageName.startsWith(NEXTCLAW_PLUGIN_NPM_PREFIX) ? packageName : spec;
597
+ if (!packageName.includes("/")) {
598
+ return spec;
599
+ }
600
+ return packageName;
601
+ }
602
+ function isSupportedMarketplacePluginSpec(rawSpec) {
603
+ const spec = normalizePluginNpmSpec(rawSpec);
604
+ return spec.startsWith(NEXTCLAW_PLUGIN_NPM_PREFIX) || spec === CLAWBAY_CHANNEL_PLUGIN_NPM_SPEC;
589
605
  }
590
606
  function resolvePluginCanonicalSpec(params) {
591
607
  const rawInstallSpec = typeof params.installSpec === "string" ? params.installSpec.trim() : "";
592
608
  if (rawInstallSpec.length > 0) {
593
- return normalizeChannelPluginNpmSpec(rawInstallSpec);
609
+ return normalizePluginNpmSpec(rawInstallSpec);
594
610
  }
595
611
  if (params.pluginId.startsWith(BUILTIN_CHANNEL_PLUGIN_ID_PREFIX)) {
596
612
  const channelSlug = params.pluginId.slice(BUILTIN_CHANNEL_PLUGIN_ID_PREFIX.length).trim();
@@ -648,7 +664,7 @@ function mergeInstalledPluginRecords(primary, secondary) {
648
664
  function dedupeInstalledPluginRecordsByCanonicalSpec(records) {
649
665
  const deduped = /* @__PURE__ */ new Map();
650
666
  for (const record of records) {
651
- const canonicalSpec = normalizeChannelPluginNpmSpec(record.spec).trim();
667
+ const canonicalSpec = normalizePluginNpmSpec(record.spec).trim();
652
668
  if (!canonicalSpec) {
653
669
  continue;
654
670
  }
@@ -762,7 +778,7 @@ function collectMarketplaceInstalledView(options) {
762
778
  try {
763
779
  const pluginReport = buildPluginStatusReport({
764
780
  config,
765
- workspaceDir: getWorkspacePathFromConfig2(config)
781
+ workspaceDir: getWorkspacePathFromConfig3(config)
766
782
  });
767
783
  discoveredPlugins = pluginReport.plugins;
768
784
  } catch {
@@ -852,10 +868,10 @@ function collectMarketplaceInstalledView(options) {
852
868
  }
853
869
  const dedupedPluginRecords = dedupeInstalledPluginRecordsByCanonicalSpec(pluginRecords);
854
870
  const pluginSpecSet = new Set(dedupedPluginRecords.map((record) => record.spec));
855
- const workspacePath = getWorkspacePathFromConfig2(config);
856
- const skillsLoader = new SkillsLoader(workspacePath);
857
- const availableSkillSet = new Set(skillsLoader.listSkills(true).map((skill) => skill.name));
858
- const listedSkills = skillsLoader.listSkills(false);
871
+ const workspacePath = getWorkspacePathFromConfig3(config);
872
+ const skillsLoader = createSkillsLoader(workspacePath);
873
+ const availableSkillSet = new Set((skillsLoader?.listSkills(true) ?? []).map((skill) => skill.name));
874
+ const listedSkills = skillsLoader?.listSkills(false) ?? [];
859
875
  const skillSpecSet = /* @__PURE__ */ new Set();
860
876
  const skillRecords = listedSkills.map((skill) => {
861
877
  const enabled = availableSkillSet.has(skill.name);
@@ -900,12 +916,12 @@ function toPositiveInt(raw, fallback) {
900
916
  }
901
917
  function collectKnownSkillNames(options) {
902
918
  const config = loadConfigOrDefault(options.configPath);
903
- const loader = new SkillsLoader(getWorkspacePathFromConfig2(config));
904
- return new Set(loader.listSkills(false).map((skill) => skill.name));
919
+ const loader = createSkillsLoader(getWorkspacePathFromConfig3(config));
920
+ return new Set((loader?.listSkills(false) ?? []).map((skill) => skill.name));
905
921
  }
906
922
  function isSupportedMarketplaceItem(item, knownSkillNames) {
907
923
  if (item.type === "plugin") {
908
- return item.install.kind === "npm" && item.install.spec.startsWith(NEXTCLAW_PLUGIN_NPM_PREFIX);
924
+ return item.install.kind === "npm" && isSupportedMarketplacePluginSpec(item.install.spec);
909
925
  }
910
926
  return item.install.kind === "builtin" && knownSkillNames.has(item.install.spec);
911
927
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  "@nextclaw/openclaw-compat": "^0.1.20",
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
- "@nextclaw/core": "^0.6.27"
21
+ "@nextclaw/core": "^0.6.28"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.17.6",