@nextclaw/server 0.11.7 → 0.11.9
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 +10 -0
- package/dist/index.js +51 -8
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1070,6 +1070,16 @@ type UiServerEvent = {
|
|
|
1070
1070
|
payload: {
|
|
1071
1071
|
sessionKey: string;
|
|
1072
1072
|
};
|
|
1073
|
+
} | {
|
|
1074
|
+
type: "session.summary.upsert";
|
|
1075
|
+
payload: {
|
|
1076
|
+
summary: NcpSessionSummary;
|
|
1077
|
+
};
|
|
1078
|
+
} | {
|
|
1079
|
+
type: "session.summary.delete";
|
|
1080
|
+
payload: {
|
|
1081
|
+
sessionKey: string;
|
|
1082
|
+
};
|
|
1073
1083
|
} | {
|
|
1074
1084
|
type: "config.reload.started";
|
|
1075
1085
|
payload?: Record<string, unknown>;
|
package/dist/index.js
CHANGED
|
@@ -3242,7 +3242,6 @@ var NcpSessionRoutesController = class {
|
|
|
3242
3242
|
if (!updated) {
|
|
3243
3243
|
return c.json(err("NOT_FOUND", `ncp session not found: ${sessionId}`), 404);
|
|
3244
3244
|
}
|
|
3245
|
-
this.options.publish({ type: "config.updated", payload: { path: "session" } });
|
|
3246
3245
|
return c.json(ok(updated));
|
|
3247
3246
|
};
|
|
3248
3247
|
deleteSession = async (c) => {
|
|
@@ -3256,7 +3255,6 @@ var NcpSessionRoutesController = class {
|
|
|
3256
3255
|
return c.json(err("NOT_FOUND", `ncp session not found: ${sessionId}`), 404);
|
|
3257
3256
|
}
|
|
3258
3257
|
await sessionApi.deleteSession(sessionId);
|
|
3259
|
-
this.options.publish({ type: "config.updated", payload: { path: "session" } });
|
|
3260
3258
|
return c.json(ok({ deleted: true, sessionId }));
|
|
3261
3259
|
};
|
|
3262
3260
|
};
|
|
@@ -3342,6 +3340,49 @@ var MARKETPLACE_ZH_COPY_BY_SLUG = {
|
|
|
3342
3340
|
}
|
|
3343
3341
|
};
|
|
3344
3342
|
|
|
3343
|
+
// src/ui/router/marketplace/marketplace-network-retry.ts
|
|
3344
|
+
var MARKETPLACE_NETWORK_RETRY_ATTEMPTS = 5;
|
|
3345
|
+
var MARKETPLACE_NETWORK_RETRY_BASE_MS = 350;
|
|
3346
|
+
function sleepMs(ms) {
|
|
3347
|
+
return new Promise((resolve2) => {
|
|
3348
|
+
setTimeout(resolve2, ms);
|
|
3349
|
+
});
|
|
3350
|
+
}
|
|
3351
|
+
function isRetryableMarketplaceNetworkError(error) {
|
|
3352
|
+
if (!(error instanceof Error)) {
|
|
3353
|
+
return false;
|
|
3354
|
+
}
|
|
3355
|
+
if (error.name === "AbortError") {
|
|
3356
|
+
return false;
|
|
3357
|
+
}
|
|
3358
|
+
const cause = error.cause;
|
|
3359
|
+
if (cause && typeof cause === "object" && cause !== null && "code" in cause) {
|
|
3360
|
+
const code = cause.code;
|
|
3361
|
+
if (code === "ECONNRESET" || code === "ECONNREFUSED" || code === "ETIMEDOUT" || code === "EPIPE" || code === "ENOTFOUND" || code === "EAI_AGAIN") {
|
|
3362
|
+
return true;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
if (error instanceof TypeError && error.message === "fetch failed") {
|
|
3366
|
+
return true;
|
|
3367
|
+
}
|
|
3368
|
+
return false;
|
|
3369
|
+
}
|
|
3370
|
+
async function runWithMarketplaceNetworkRetry(action) {
|
|
3371
|
+
let lastError;
|
|
3372
|
+
for (let attempt = 1; attempt <= MARKETPLACE_NETWORK_RETRY_ATTEMPTS; attempt += 1) {
|
|
3373
|
+
try {
|
|
3374
|
+
return await action();
|
|
3375
|
+
} catch (error) {
|
|
3376
|
+
lastError = error;
|
|
3377
|
+
if (attempt === MARKETPLACE_NETWORK_RETRY_ATTEMPTS || !isRetryableMarketplaceNetworkError(error)) {
|
|
3378
|
+
throw error;
|
|
3379
|
+
}
|
|
3380
|
+
await sleepMs(MARKETPLACE_NETWORK_RETRY_BASE_MS * 2 ** (attempt - 1));
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
throw lastError;
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3345
3386
|
// src/ui/router/marketplace/catalog.ts
|
|
3346
3387
|
function normalizeMarketplaceBaseUrl(options) {
|
|
3347
3388
|
const configured = options.marketplace?.apiBaseUrl?.trim();
|
|
@@ -3363,12 +3404,14 @@ async function fetchMarketplaceData(params) {
|
|
|
3363
3404
|
const endpoint = toMarketplaceUrl(params.baseUrl, params.path, params.query);
|
|
3364
3405
|
let response;
|
|
3365
3406
|
try {
|
|
3366
|
-
response = await
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3407
|
+
response = await runWithMarketplaceNetworkRetry(
|
|
3408
|
+
() => fetch(endpoint, {
|
|
3409
|
+
method: "GET",
|
|
3410
|
+
headers: {
|
|
3411
|
+
Accept: "application/json"
|
|
3412
|
+
}
|
|
3413
|
+
})
|
|
3414
|
+
);
|
|
3372
3415
|
} catch (error) {
|
|
3373
3416
|
return {
|
|
3374
3417
|
ok: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/server",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nextclaw UI/API server.",
|
|
6
6
|
"type": "module",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"hono": "^4.6.2",
|
|
20
20
|
"ws": "^8.18.0",
|
|
21
21
|
"@nextclaw/ncp": "0.4.0",
|
|
22
|
-
"@nextclaw/
|
|
23
|
-
"@nextclaw/core": "0.11.
|
|
24
|
-
"@nextclaw/runtime": "0.2.
|
|
25
|
-
"@nextclaw/
|
|
22
|
+
"@nextclaw/mcp": "0.1.53",
|
|
23
|
+
"@nextclaw/core": "0.11.6",
|
|
24
|
+
"@nextclaw/runtime": "0.2.20",
|
|
25
|
+
"@nextclaw/openclaw-compat": "0.3.43",
|
|
26
26
|
"@nextclaw/ncp-http-agent-server": "0.3.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|