@nextclaw/server 0.5.11 → 0.5.13
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.d.ts +5 -0
- package/dist/index.js +28 -27
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -299,6 +299,7 @@ type MarketplaceListView = {
|
|
|
299
299
|
items: MarketplaceItemSummary[];
|
|
300
300
|
};
|
|
301
301
|
type MarketplaceRecommendationView = {
|
|
302
|
+
type: MarketplaceItemType;
|
|
302
303
|
sceneId: string;
|
|
303
304
|
title: string;
|
|
304
305
|
description?: string;
|
|
@@ -327,6 +328,8 @@ type MarketplaceInstallRequest = {
|
|
|
327
328
|
type: MarketplaceItemType;
|
|
328
329
|
spec: string;
|
|
329
330
|
kind?: MarketplaceInstallKind;
|
|
331
|
+
skill?: string;
|
|
332
|
+
installPath?: string;
|
|
330
333
|
version?: string;
|
|
331
334
|
registry?: string;
|
|
332
335
|
force?: boolean;
|
|
@@ -340,6 +343,8 @@ type MarketplaceInstallResult = {
|
|
|
340
343
|
type MarketplaceInstallSkillParams = {
|
|
341
344
|
slug: string;
|
|
342
345
|
kind?: MarketplaceInstallKind;
|
|
346
|
+
skill?: string;
|
|
347
|
+
installPath?: string;
|
|
343
348
|
version?: string;
|
|
344
349
|
registry?: string;
|
|
345
350
|
force?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -997,6 +997,9 @@ function isSupportedMarketplaceItem(item, knownSkillNames) {
|
|
|
997
997
|
if (item.type === "plugin") {
|
|
998
998
|
return item.install.kind === "npm" && isSupportedMarketplacePluginSpec(item.install.spec);
|
|
999
999
|
}
|
|
1000
|
+
if (item.install.kind === "git") {
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1000
1003
|
return item.install.kind === "builtin" && knownSkillNames.has(item.install.spec);
|
|
1001
1004
|
}
|
|
1002
1005
|
async function fetchAllMarketplaceItems(params) {
|
|
@@ -1008,10 +1011,9 @@ async function fetchAllMarketplaceItems(params) {
|
|
|
1008
1011
|
while (remotePage <= remoteTotalPages && remotePage <= MARKETPLACE_REMOTE_MAX_PAGES) {
|
|
1009
1012
|
const result = await fetchMarketplaceData({
|
|
1010
1013
|
baseUrl: params.baseUrl,
|
|
1011
|
-
path:
|
|
1014
|
+
path: `/api/v1/${params.segment}/items`,
|
|
1012
1015
|
query: {
|
|
1013
1016
|
...params.query,
|
|
1014
|
-
type: params.type,
|
|
1015
1017
|
page: String(remotePage),
|
|
1016
1018
|
pageSize: String(MARKETPLACE_REMOTE_PAGE_SIZE)
|
|
1017
1019
|
}
|
|
@@ -1057,6 +1059,8 @@ async function installMarketplaceItem(params) {
|
|
|
1057
1059
|
result = await installer.installSkill({
|
|
1058
1060
|
slug: spec,
|
|
1059
1061
|
kind: params.body.kind,
|
|
1062
|
+
skill: params.body.skill,
|
|
1063
|
+
installPath: params.body.installPath,
|
|
1060
1064
|
version: params.body.version,
|
|
1061
1065
|
registry: params.body.registry,
|
|
1062
1066
|
force: params.body.force
|
|
@@ -1132,7 +1136,7 @@ function registerMarketplaceRoutes(app, options, marketplaceBaseUrl) {
|
|
|
1132
1136
|
const query = c.req.query();
|
|
1133
1137
|
const result = await fetchAllMarketplaceItems({
|
|
1134
1138
|
baseUrl: marketplaceBaseUrl,
|
|
1135
|
-
|
|
1139
|
+
segment: route.segment,
|
|
1136
1140
|
query: {
|
|
1137
1141
|
q: query.q,
|
|
1138
1142
|
tag: query.tag,
|
|
@@ -1164,10 +1168,7 @@ function registerMarketplaceRoutes(app, options, marketplaceBaseUrl) {
|
|
|
1164
1168
|
const slug = encodeURIComponent(c.req.param("slug"));
|
|
1165
1169
|
const result = await fetchMarketplaceData({
|
|
1166
1170
|
baseUrl: marketplaceBaseUrl,
|
|
1167
|
-
path: `/api/v1/items/${slug}
|
|
1168
|
-
query: {
|
|
1169
|
-
type: route.type
|
|
1170
|
-
}
|
|
1171
|
+
path: `/api/v1/${route.segment}/items/${slug}`
|
|
1171
1172
|
});
|
|
1172
1173
|
if (!result.ok) {
|
|
1173
1174
|
return c.json(err("MARKETPLACE_UNAVAILABLE", result.message), result.status);
|
|
@@ -1235,28 +1236,28 @@ function registerMarketplaceRoutes(app, options, marketplaceBaseUrl) {
|
|
|
1235
1236
|
return c.json(err("MANAGE_FAILED", message), 400);
|
|
1236
1237
|
}
|
|
1237
1238
|
});
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1239
|
+
app.get(`/api/marketplace/${route.segment}/recommendations`, async (c) => {
|
|
1240
|
+
const query = c.req.query();
|
|
1241
|
+
const result = await fetchMarketplaceData({
|
|
1242
|
+
baseUrl: marketplaceBaseUrl,
|
|
1243
|
+
path: `/api/v1/${route.segment}/recommendations`,
|
|
1244
|
+
query: {
|
|
1245
|
+
scene: query.scene,
|
|
1246
|
+
limit: query.limit
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
if (!result.ok) {
|
|
1250
|
+
return c.json(err("MARKETPLACE_UNAVAILABLE", result.message), result.status);
|
|
1247
1251
|
}
|
|
1252
|
+
const knownSkillNames = collectKnownSkillNames(options);
|
|
1253
|
+
const filteredItems = result.data.items.map((item) => sanitizeMarketplaceItem(item)).filter((item) => isSupportedMarketplaceItem(item, knownSkillNames));
|
|
1254
|
+
return c.json(ok({
|
|
1255
|
+
...result.data,
|
|
1256
|
+
total: filteredItems.length,
|
|
1257
|
+
items: filteredItems
|
|
1258
|
+
}));
|
|
1248
1259
|
});
|
|
1249
|
-
|
|
1250
|
-
return c.json(err("MARKETPLACE_UNAVAILABLE", result.message), result.status);
|
|
1251
|
-
}
|
|
1252
|
-
const knownSkillNames = collectKnownSkillNames(options);
|
|
1253
|
-
const filteredItems = result.data.items.map((item) => sanitizeMarketplaceItem(item)).filter((item) => isSupportedMarketplaceItem(item, knownSkillNames));
|
|
1254
|
-
return c.json(ok({
|
|
1255
|
-
...result.data,
|
|
1256
|
-
total: filteredItems.length,
|
|
1257
|
-
items: filteredItems
|
|
1258
|
-
}));
|
|
1259
|
-
});
|
|
1260
|
+
}
|
|
1260
1261
|
}
|
|
1261
1262
|
function createUiRouter(options) {
|
|
1262
1263
|
const app = new Hono();
|