nextclaw 0.9.18 → 0.9.19
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/cli/index.js +68 -3
- package/package.json +4 -4
package/dist/cli/index.js
CHANGED
|
@@ -4290,6 +4290,13 @@ var ServiceCommands = class {
|
|
|
4290
4290
|
if (!child.pid) {
|
|
4291
4291
|
this.appendStartupStage(logPath, "spawn failed: child pid missing");
|
|
4292
4292
|
console.error("Error: Failed to start background service.");
|
|
4293
|
+
this.printStartupFailureDiagnostics({
|
|
4294
|
+
uiUrl,
|
|
4295
|
+
apiUrl,
|
|
4296
|
+
healthUrl: `${apiUrl}/health`,
|
|
4297
|
+
logPath,
|
|
4298
|
+
lastProbeError: null
|
|
4299
|
+
});
|
|
4293
4300
|
return;
|
|
4294
4301
|
}
|
|
4295
4302
|
const healthUrl = `${apiUrl}/health`;
|
|
@@ -4319,6 +4326,13 @@ var ServiceCommands = class {
|
|
|
4319
4326
|
const hint = readiness.lastProbeError ? ` Last probe error: ${readiness.lastProbeError}` : "";
|
|
4320
4327
|
this.appendStartupStage(logPath, `startup failed: process exited before ready.${hint}`);
|
|
4321
4328
|
console.error(`Error: Failed to start background service. Check logs: ${logPath}.${hint}`);
|
|
4329
|
+
this.printStartupFailureDiagnostics({
|
|
4330
|
+
uiUrl,
|
|
4331
|
+
apiUrl,
|
|
4332
|
+
healthUrl,
|
|
4333
|
+
logPath,
|
|
4334
|
+
lastProbeError: readiness.lastProbeError
|
|
4335
|
+
});
|
|
4322
4336
|
return;
|
|
4323
4337
|
}
|
|
4324
4338
|
this.appendStartupStage(
|
|
@@ -4424,8 +4438,45 @@ var ServiceCommands = class {
|
|
|
4424
4438
|
try {
|
|
4425
4439
|
appendFileSync(logPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [startup] ${message}
|
|
4426
4440
|
`, "utf-8");
|
|
4427
|
-
} catch {
|
|
4441
|
+
} catch (error) {
|
|
4442
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4443
|
+
console.error(`Warning: failed to write startup diagnostics log (${logPath}): ${detail}`);
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
printStartupFailureDiagnostics(params) {
|
|
4447
|
+
const statePath = resolveServiceStatePath();
|
|
4448
|
+
const lines = [
|
|
4449
|
+
"Startup diagnostics:",
|
|
4450
|
+
`- UI URL: ${params.uiUrl}`,
|
|
4451
|
+
`- API URL: ${params.apiUrl}`,
|
|
4452
|
+
`- Health probe: ${params.healthUrl}`,
|
|
4453
|
+
`- Service state path: ${statePath}`,
|
|
4454
|
+
`- Startup log path: ${params.logPath}`
|
|
4455
|
+
];
|
|
4456
|
+
if (params.lastProbeError) {
|
|
4457
|
+
lines.push(`- Last probe detail: ${params.lastProbeError}`);
|
|
4458
|
+
}
|
|
4459
|
+
console.error(lines.join("\n"));
|
|
4460
|
+
}
|
|
4461
|
+
getHeaderValue(headers, key) {
|
|
4462
|
+
const value = headers[key];
|
|
4463
|
+
if (typeof value === "string") {
|
|
4464
|
+
const normalized = value.trim();
|
|
4465
|
+
return normalized.length > 0 ? normalized : null;
|
|
4466
|
+
}
|
|
4467
|
+
if (Array.isArray(value)) {
|
|
4468
|
+
const joined = value.map((item) => item.trim()).filter(Boolean).join(", ");
|
|
4469
|
+
return joined.length > 0 ? joined : null;
|
|
4470
|
+
}
|
|
4471
|
+
return null;
|
|
4472
|
+
}
|
|
4473
|
+
formatProbeBodySnippet(raw, maxLength = 180) {
|
|
4474
|
+
const normalized = raw.replace(/\s+/g, " ").trim();
|
|
4475
|
+
if (!normalized) {
|
|
4476
|
+
return null;
|
|
4428
4477
|
}
|
|
4478
|
+
const clipped = normalized.length > maxLength ? `${normalized.slice(0, maxLength)}...` : normalized;
|
|
4479
|
+
return JSON.stringify(clipped);
|
|
4429
4480
|
}
|
|
4430
4481
|
async probeHealthEndpoint(healthUrl) {
|
|
4431
4482
|
let parsed;
|
|
@@ -4456,12 +4507,26 @@ var ServiceCommands = class {
|
|
|
4456
4507
|
chunks.push(chunk);
|
|
4457
4508
|
});
|
|
4458
4509
|
res.on("end", () => {
|
|
4510
|
+
const responseText = Buffer.concat(chunks).toString("utf-8");
|
|
4459
4511
|
if ((res.statusCode ?? 0) < 200 || (res.statusCode ?? 0) >= 300) {
|
|
4460
|
-
|
|
4512
|
+
const serverHeader = this.getHeaderValue(res.headers, "server");
|
|
4513
|
+
const contentType = this.getHeaderValue(res.headers, "content-type");
|
|
4514
|
+
const bodySnippet = this.formatProbeBodySnippet(responseText);
|
|
4515
|
+
const details = [`http ${res.statusCode ?? "unknown"}`];
|
|
4516
|
+
if (serverHeader) {
|
|
4517
|
+
details.push(`server=${serverHeader}`);
|
|
4518
|
+
}
|
|
4519
|
+
if (contentType) {
|
|
4520
|
+
details.push(`content-type=${contentType}`);
|
|
4521
|
+
}
|
|
4522
|
+
if (bodySnippet) {
|
|
4523
|
+
details.push(`body=${bodySnippet}`);
|
|
4524
|
+
}
|
|
4525
|
+
resolve10({ healthy: false, error: details.join("; ") });
|
|
4461
4526
|
return;
|
|
4462
4527
|
}
|
|
4463
4528
|
try {
|
|
4464
|
-
const payload = JSON.parse(
|
|
4529
|
+
const payload = JSON.parse(responseText);
|
|
4465
4530
|
const healthy = payload?.ok === true && payload?.data?.status === "ok";
|
|
4466
4531
|
if (!healthy) {
|
|
4467
4532
|
resolve10({ healthy: false, error: "health payload not ok" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.19",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"chokidar": "^3.6.0",
|
|
40
40
|
"commander": "^12.1.0",
|
|
41
|
-
"@nextclaw/
|
|
42
|
-
"@nextclaw/runtime": "^0.1.2",
|
|
41
|
+
"@nextclaw/runtime": "0.1.2",
|
|
43
42
|
"@nextclaw/server": "0.6.6",
|
|
44
|
-
"@nextclaw/openclaw-compat": "0.2.1"
|
|
43
|
+
"@nextclaw/openclaw-compat": "0.2.1",
|
|
44
|
+
"@nextclaw/core": "0.7.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20.17.6",
|