@nextclaw/server 0.5.2 → 0.5.3
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 +25 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -899,6 +899,29 @@ function collectMarketplaceInstalledView(options) {
|
|
|
899
899
|
records
|
|
900
900
|
};
|
|
901
901
|
}
|
|
902
|
+
function resolvePluginManageTargetId(options, rawTargetId) {
|
|
903
|
+
const targetId = rawTargetId.trim();
|
|
904
|
+
if (!targetId) {
|
|
905
|
+
return rawTargetId;
|
|
906
|
+
}
|
|
907
|
+
const normalizedTarget = normalizePluginNpmSpec(targetId).toLowerCase();
|
|
908
|
+
const installed = collectMarketplaceInstalledView(options);
|
|
909
|
+
const pluginRecords = installed.records.filter((record) => record.type === "plugin");
|
|
910
|
+
const lowerTargetId = targetId.toLowerCase();
|
|
911
|
+
for (const record of pluginRecords) {
|
|
912
|
+
const recordId = record.id?.trim();
|
|
913
|
+
if (recordId && recordId.toLowerCase() === lowerTargetId) {
|
|
914
|
+
return recordId;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
for (const record of pluginRecords) {
|
|
918
|
+
const normalizedSpec = normalizePluginNpmSpec(record.spec).toLowerCase();
|
|
919
|
+
if (normalizedSpec === normalizedTarget && record.id && record.id.trim().length > 0) {
|
|
920
|
+
return record.id;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return targetId;
|
|
924
|
+
}
|
|
902
925
|
function sanitizeMarketplaceItem(item) {
|
|
903
926
|
const next = { ...item };
|
|
904
927
|
delete next.metrics;
|
|
@@ -998,7 +1021,8 @@ async function installMarketplaceItem(params) {
|
|
|
998
1021
|
async function manageMarketplaceItem(params) {
|
|
999
1022
|
const type = params.body.type;
|
|
1000
1023
|
const action = params.body.action;
|
|
1001
|
-
const
|
|
1024
|
+
const requestedTargetId = typeof params.body.id === "string" && params.body.id.trim().length > 0 ? params.body.id.trim() : typeof params.body.spec === "string" && params.body.spec.trim().length > 0 ? params.body.spec.trim() : "";
|
|
1025
|
+
const targetId = type === "plugin" ? resolvePluginManageTargetId(params.options, requestedTargetId) : requestedTargetId;
|
|
1002
1026
|
if (type !== "plugin" && type !== "skill" || action !== "enable" && action !== "disable" && action !== "uninstall" || !targetId) {
|
|
1003
1027
|
throw new Error("INVALID_BODY:type, action and non-empty id/spec are required");
|
|
1004
1028
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/server",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nextclaw UI/API server.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@hono/node-server": "^1.13.3",
|
|
18
|
-
"@nextclaw/openclaw-compat": "^0.1.
|
|
18
|
+
"@nextclaw/openclaw-compat": "^0.1.21",
|
|
19
19
|
"hono": "^4.6.2",
|
|
20
20
|
"ws": "^8.18.0",
|
|
21
21
|
"@nextclaw/core": "^0.6.28"
|