nextclaw 0.17.8 → 0.17.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +81 -24
  2. package/package.json +6 -6
package/dist/cli/index.js CHANGED
@@ -6204,6 +6204,41 @@ function decodeMarketplaceFileContent(path, contentBase64) {
6204
6204
  return Buffer.from(normalized, "base64");
6205
6205
  }
6206
6206
  //#endregion
6207
+ //#region src/cli/update/self-update-report.utils.ts
6208
+ function reportSelfUpdateResult(params) {
6209
+ const { appName, currentVersion, result, readInstalledVersion } = params;
6210
+ const printSteps = () => {
6211
+ for (const step of result.steps) {
6212
+ console.log(`- ${step.cmd} ${step.args.join(" ")} (code ${step.code ?? "?"})`);
6213
+ if (step.stderr) console.log(` stderr: ${step.stderr}`);
6214
+ if (step.stdout) console.log(` stdout: ${step.stdout}`);
6215
+ }
6216
+ };
6217
+ if (!result.ok) {
6218
+ console.error(`Update failed: ${result.error ?? "unknown error"}`);
6219
+ if (result.steps.length > 0) printSteps();
6220
+ return {
6221
+ ok: false,
6222
+ shouldSuggestRestart: false
6223
+ };
6224
+ }
6225
+ if (result.strategy === "noop") {
6226
+ console.log(`✓ ${appName} is already up to date (${result.latestVersion ?? currentVersion})`);
6227
+ return {
6228
+ ok: true,
6229
+ shouldSuggestRestart: false
6230
+ };
6231
+ }
6232
+ const versionAfter = result.latestVersion ?? readInstalledVersion();
6233
+ console.log(`✓ Update complete (${result.strategy})`);
6234
+ if (versionAfter === currentVersion) console.log(`Version unchanged: ${currentVersion}`);
6235
+ else console.log(`Version updated: ${currentVersion} -> ${versionAfter}`);
6236
+ return {
6237
+ ok: true,
6238
+ shouldSuggestRestart: true
6239
+ };
6240
+ }
6241
+ //#endregion
6207
6242
  //#region src/cli/update/runner.ts
6208
6243
  const DEFAULT_TIMEOUT_MS = 20 * 6e4;
6209
6244
  function runSelfUpdate(options = {}) {
@@ -6211,6 +6246,7 @@ function runSelfUpdate(options = {}) {
6211
6246
  const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
6212
6247
  const updateCommand = options.updateCommand ?? process.env.NEXTCLAW_UPDATE_COMMAND?.trim();
6213
6248
  const packageName = options.packageName ?? "nextclaw";
6249
+ const currentVersion = options.currentVersion?.trim() || null;
6214
6250
  const resolveShellCommand = (command) => {
6215
6251
  if (process.platform === "win32") return {
6216
6252
  cmd: process.env.ComSpec || "cmd.exe",
@@ -6234,19 +6270,33 @@ function runSelfUpdate(options = {}) {
6234
6270
  timeout: timeoutMs,
6235
6271
  stdio: "pipe"
6236
6272
  });
6273
+ const stdout = (result.stdout ?? "").toString().slice(0, 4e3);
6274
+ const stderr = (result.stderr ?? "").toString().slice(0, 4e3);
6237
6275
  steps.push({
6238
6276
  cmd,
6239
6277
  args,
6240
6278
  cwd,
6241
6279
  code: result.status,
6242
- stdout: (result.stdout ?? "").toString().slice(0, 4e3),
6243
- stderr: (result.stderr ?? "").toString().slice(0, 4e3)
6280
+ stdout,
6281
+ stderr
6244
6282
  });
6245
6283
  return {
6246
6284
  ok: result.status === 0,
6247
- code: result.status
6285
+ code: result.status,
6286
+ stdout,
6287
+ stderr
6248
6288
  };
6249
6289
  };
6290
+ const parseLatestVersion = (raw) => {
6291
+ const trimmed = raw.trim();
6292
+ if (!trimmed) return null;
6293
+ try {
6294
+ const parsed = JSON.parse(trimmed);
6295
+ return typeof parsed === "string" && parsed.trim() ? parsed.trim() : null;
6296
+ } catch {
6297
+ return trimmed;
6298
+ }
6299
+ };
6250
6300
  if (updateCommand) {
6251
6301
  const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
6252
6302
  const shellCommand = resolveShellCommand(updateCommand);
@@ -6264,19 +6314,35 @@ function runSelfUpdate(options = {}) {
6264
6314
  }
6265
6315
  const npmExecutable = findExecutableOnPath("npm");
6266
6316
  if (npmExecutable) {
6317
+ const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
6318
+ const latestVersionStep = runStep(npmExecutable, [
6319
+ "view",
6320
+ packageName,
6321
+ "version",
6322
+ "--json"
6323
+ ], cwd);
6324
+ const latestVersion = latestVersionStep.ok ? parseLatestVersion(latestVersionStep.stdout) : null;
6325
+ if (latestVersion && currentVersion && latestVersion === currentVersion) return {
6326
+ ok: true,
6327
+ strategy: "noop",
6328
+ latestVersion,
6329
+ steps
6330
+ };
6267
6331
  if (!runStep(npmExecutable, [
6268
6332
  "i",
6269
6333
  "-g",
6270
6334
  packageName
6271
- ], process.cwd()).ok) return {
6335
+ ], cwd).ok) return {
6272
6336
  ok: false,
6273
6337
  error: `npm install -g ${packageName} failed`,
6274
6338
  strategy: "npm",
6339
+ latestVersion: latestVersion ?? void 0,
6275
6340
  steps
6276
6341
  };
6277
6342
  return {
6278
6343
  ok: true,
6279
6344
  strategy: "npm",
6345
+ latestVersion: latestVersion ?? void 0,
6280
6346
  steps
6281
6347
  };
6282
6348
  }
@@ -15842,28 +15908,19 @@ var CliRuntime = class {
15842
15908
  }
15843
15909
  const versionBefore = getPackageVersion$1();
15844
15910
  console.log(`Current version: ${versionBefore}`);
15845
- const result = runSelfUpdate({
15846
- timeoutMs,
15847
- cwd: process.cwd()
15911
+ const report = reportSelfUpdateResult({
15912
+ appName: APP_NAME,
15913
+ currentVersion: versionBefore,
15914
+ result: runSelfUpdate({
15915
+ timeoutMs,
15916
+ cwd: process.cwd(),
15917
+ currentVersion: versionBefore
15918
+ }),
15919
+ readInstalledVersion: getPackageVersion$1
15848
15920
  });
15849
- const printSteps = () => {
15850
- for (const step of result.steps) {
15851
- console.log(`- ${step.cmd} ${step.args.join(" ")} (code ${step.code ?? "?"})`);
15852
- if (step.stderr) console.log(` stderr: ${step.stderr}`);
15853
- if (step.stdout) console.log(` stdout: ${step.stdout}`);
15854
- }
15855
- };
15856
- if (!result.ok) {
15857
- console.error(`Update failed: ${result.error ?? "unknown error"}`);
15858
- if (result.steps.length > 0) printSteps();
15859
- process.exit(1);
15860
- }
15861
- const versionAfter = getPackageVersion$1();
15862
- console.log(`✓ Update complete (${result.strategy})`);
15863
- if (versionAfter === versionBefore) console.log(`Version unchanged: ${versionBefore}`);
15864
- else console.log(`Version updated: ${versionBefore} -> ${versionAfter}`);
15921
+ if (!report.ok) process.exit(1);
15865
15922
  const state = managedServiceStateStore.read();
15866
- if (state && isProcessRunning(state.pid)) console.log(`Tip: restart ${APP_NAME} to apply the update.`);
15923
+ if (report.shouldSuggestRestart && state && isProcessRunning(state.pid)) console.log(`Tip: restart ${APP_NAME} to apply the update.`);
15867
15924
  };
15868
15925
  agentsList = (opts = {}) => {
15869
15926
  this.agentCommands.agentsList(opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.17.8",
3
+ "version": "0.17.9",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -40,15 +40,15 @@
40
40
  "chokidar": "^3.6.0",
41
41
  "commander": "^12.1.0",
42
42
  "yaml": "^2.8.1",
43
- "@nextclaw/ncp-mcp": "0.1.71",
44
43
  "@nextclaw/ncp": "0.5.0",
44
+ "@nextclaw/ncp-agent-runtime": "0.3.9",
45
+ "@nextclaw/core": "0.12.4",
46
+ "@nextclaw/ncp-mcp": "0.1.71",
45
47
  "@nextclaw/ncp-toolkit": "0.5.4",
48
+ "@nextclaw/mcp": "0.1.69",
46
49
  "@nextclaw/openclaw-compat": "1.0.4",
47
- "@nextclaw/ncp-agent-runtime": "0.3.9",
48
- "@nextclaw/remote": "0.1.81",
49
50
  "@nextclaw/server": "0.12.4",
50
- "@nextclaw/mcp": "0.1.69",
51
- "@nextclaw/core": "0.12.4",
51
+ "@nextclaw/remote": "0.1.81",
52
52
  "@nextclaw/runtime": "0.2.36"
53
53
  },
54
54
  "devDependencies": {