nextclaw 0.9.17 → 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.
Files changed (2) hide show
  1. package/dist/cli/index.js +80 -4
  2. package/package.json +5 -5
package/dist/cli/index.js CHANGED
@@ -2907,6 +2907,8 @@ var MissingProvider = class extends LLMProvider {
2907
2907
  import {
2908
2908
  NativeAgentEngine,
2909
2909
  CommandRegistry,
2910
+ createAssistantStreamDeltaControlMessage,
2911
+ createAssistantStreamResetControlMessage,
2910
2912
  AgentRouteResolver,
2911
2913
  getWorkspacePath as getWorkspacePath4,
2912
2914
  parseAgentScopedSessionKey
@@ -3091,10 +3093,19 @@ var GatewayAgentRuntimePool = class {
3091
3093
  sessionKeyOverride: explicitSessionKey
3092
3094
  });
3093
3095
  const runtime2 = this.resolveRuntime(route.agentId);
3096
+ if (message.channel !== "system") {
3097
+ await this.options.bus.publishOutbound(createAssistantStreamResetControlMessage(message));
3098
+ }
3094
3099
  await runtime2.engine.handleInbound({
3095
3100
  message,
3096
3101
  sessionKey: route.sessionKey,
3097
- publishResponse: true
3102
+ publishResponse: true,
3103
+ onAssistantDelta: message.channel !== "system" ? (delta) => {
3104
+ if (!delta) {
3105
+ return;
3106
+ }
3107
+ void this.options.bus.publishOutbound(createAssistantStreamDeltaControlMessage(message, delta));
3108
+ } : void 0
3098
3109
  });
3099
3110
  if (message.channel === "system") {
3100
3111
  this.onSystemSessionUpdated?.({
@@ -4279,6 +4290,13 @@ var ServiceCommands = class {
4279
4290
  if (!child.pid) {
4280
4291
  this.appendStartupStage(logPath, "spawn failed: child pid missing");
4281
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
+ });
4282
4300
  return;
4283
4301
  }
4284
4302
  const healthUrl = `${apiUrl}/health`;
@@ -4308,6 +4326,13 @@ var ServiceCommands = class {
4308
4326
  const hint = readiness.lastProbeError ? ` Last probe error: ${readiness.lastProbeError}` : "";
4309
4327
  this.appendStartupStage(logPath, `startup failed: process exited before ready.${hint}`);
4310
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
+ });
4311
4336
  return;
4312
4337
  }
4313
4338
  this.appendStartupStage(
@@ -4413,8 +4438,45 @@ var ServiceCommands = class {
4413
4438
  try {
4414
4439
  appendFileSync(logPath, `[${(/* @__PURE__ */ new Date()).toISOString()}] [startup] ${message}
4415
4440
  `, "utf-8");
4416
- } 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}`);
4417
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;
4477
+ }
4478
+ const clipped = normalized.length > maxLength ? `${normalized.slice(0, maxLength)}...` : normalized;
4479
+ return JSON.stringify(clipped);
4418
4480
  }
4419
4481
  async probeHealthEndpoint(healthUrl) {
4420
4482
  let parsed;
@@ -4445,12 +4507,26 @@ var ServiceCommands = class {
4445
4507
  chunks.push(chunk);
4446
4508
  });
4447
4509
  res.on("end", () => {
4510
+ const responseText = Buffer.concat(chunks).toString("utf-8");
4448
4511
  if ((res.statusCode ?? 0) < 200 || (res.statusCode ?? 0) >= 300) {
4449
- resolve10({ healthy: false, error: `http ${res.statusCode ?? "unknown"}` });
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("; ") });
4450
4526
  return;
4451
4527
  }
4452
4528
  try {
4453
- const payload = JSON.parse(Buffer.concat(chunks).toString("utf-8"));
4529
+ const payload = JSON.parse(responseText);
4454
4530
  const healthy = payload?.ok === true && payload?.data?.status === "ok";
4455
4531
  if (!healthy) {
4456
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.17",
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/core": "^0.7.2",
42
- "@nextclaw/runtime": "^0.1.1",
43
- "@nextclaw/server": "^0.6.5",
44
- "@nextclaw/openclaw-compat": "^0.2.0"
41
+ "@nextclaw/runtime": "0.1.2",
42
+ "@nextclaw/server": "0.6.6",
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",