nextclaw 0.6.35 → 0.7.0

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 CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  import { existsSync as existsSync8, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
29
29
  import { join as join6, resolve as resolve9 } from "path";
30
30
  import { createInterface as createInterface2 } from "readline";
31
- import { fileURLToPath as fileURLToPath3 } from "url";
31
+ import { fileURLToPath as fileURLToPath4 } from "url";
32
32
  import { spawn as spawn3 } from "child_process";
33
33
 
34
34
  // src/cli/restart-coordinator.ts
@@ -1865,6 +1865,7 @@ import { startUiServer } from "@nextclaw/server";
1865
1865
  import { closeSync, mkdirSync as mkdirSync3, openSync } from "fs";
1866
1866
  import { join as join4, resolve as resolve7 } from "path";
1867
1867
  import { spawn as spawn2 } from "child_process";
1868
+ import { fileURLToPath as fileURLToPath2 } from "url";
1868
1869
  import chokidar from "chokidar";
1869
1870
 
1870
1871
  // src/cli/gateway/controller.ts
@@ -3050,7 +3051,14 @@ var ServiceCommands = class {
3050
3051
  host: uiConfig.host,
3051
3052
  port: uiConfig.port,
3052
3053
  configPath: getConfigPath2(),
3053
- staticDir: uiStaticDir ?? void 0
3054
+ staticDir: uiStaticDir ?? void 0,
3055
+ marketplace: {
3056
+ apiBaseUrl: process.env.NEXTCLAW_MARKETPLACE_API_BASE,
3057
+ installer: {
3058
+ installPlugin: (spec) => this.installMarketplacePlugin(spec),
3059
+ installSkill: (params) => this.installMarketplaceSkill(params)
3060
+ }
3061
+ }
3054
3062
  });
3055
3063
  const uiUrl = `http://${uiServer.host}:${uiServer.port}`;
3056
3064
  console.log(`\u2713 UI API: ${uiUrl}/api`);
@@ -3062,13 +3070,75 @@ var ServiceCommands = class {
3062
3070
  openBrowser(uiUrl);
3063
3071
  }
3064
3072
  }
3073
+ async installMarketplacePlugin(spec) {
3074
+ const output = await this.runCliSubcommand(["plugins", "install", spec]);
3075
+ const summary = this.pickLastOutputLine(output) ?? `Installed plugin: ${spec}`;
3076
+ return { message: summary, output };
3077
+ }
3078
+ async installMarketplaceSkill(params) {
3079
+ const args = ["skills", "install", params.slug];
3080
+ if (params.version) {
3081
+ args.push("--version", params.version);
3082
+ }
3083
+ if (params.registry) {
3084
+ args.push("--registry", params.registry);
3085
+ }
3086
+ if (params.force) {
3087
+ args.push("--force");
3088
+ }
3089
+ const output = await this.runCliSubcommand(args);
3090
+ const summary = this.pickLastOutputLine(output) ?? `Installed skill: ${params.slug}`;
3091
+ return { message: summary, output };
3092
+ }
3093
+ runCliSubcommand(args, timeoutMs = 18e4) {
3094
+ const cliEntry = fileURLToPath2(new URL("../index.js", import.meta.url));
3095
+ return new Promise((resolvePromise, rejectPromise) => {
3096
+ const child = spawn2(process.execPath, [...process.execArgv, cliEntry, ...args], {
3097
+ cwd: process.cwd(),
3098
+ env: process.env,
3099
+ stdio: ["ignore", "pipe", "pipe"]
3100
+ });
3101
+ let stdout = "";
3102
+ let stderr = "";
3103
+ child.stdout?.setEncoding("utf-8");
3104
+ child.stderr?.setEncoding("utf-8");
3105
+ child.stdout?.on("data", (chunk) => {
3106
+ stdout += chunk;
3107
+ });
3108
+ child.stderr?.on("data", (chunk) => {
3109
+ stderr += chunk;
3110
+ });
3111
+ const timer = setTimeout(() => {
3112
+ child.kill("SIGTERM");
3113
+ rejectPromise(new Error(`CLI command timed out after ${timeoutMs}ms`));
3114
+ }, timeoutMs);
3115
+ child.on("error", (error) => {
3116
+ clearTimeout(timer);
3117
+ rejectPromise(new Error(`failed to start CLI command: ${String(error)}`));
3118
+ });
3119
+ child.on("close", (code) => {
3120
+ clearTimeout(timer);
3121
+ const output = `${stdout}
3122
+ ${stderr}`.trim();
3123
+ if (code === 0) {
3124
+ resolvePromise(output);
3125
+ return;
3126
+ }
3127
+ rejectPromise(new Error(output || `CLI command failed with code ${code ?? 1}`));
3128
+ });
3129
+ });
3130
+ }
3131
+ pickLastOutputLine(output) {
3132
+ const lines = output.split("\n").map((line) => line.trim()).filter(Boolean);
3133
+ return lines.length > 0 ? lines[lines.length - 1] : null;
3134
+ }
3065
3135
  };
3066
3136
 
3067
3137
  // src/cli/workspace.ts
3068
3138
  import { cpSync, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5, readdirSync, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "fs";
3069
3139
  import { createRequire } from "module";
3070
3140
  import { dirname, join as join5, resolve as resolve8 } from "path";
3071
- import { fileURLToPath as fileURLToPath2 } from "url";
3141
+ import { fileURLToPath as fileURLToPath3 } from "url";
3072
3142
  import { APP_NAME as APP_NAME3, getDataDir as getDataDir6 } from "@nextclaw/core";
3073
3143
  import { spawnSync as spawnSync4 } from "child_process";
3074
3144
  var WorkspaceManager = class {
@@ -3175,7 +3245,7 @@ var WorkspaceManager = class {
3175
3245
  if (override) {
3176
3246
  return override;
3177
3247
  }
3178
- const cliDir = resolve8(fileURLToPath2(new URL(".", import.meta.url)));
3248
+ const cliDir = resolve8(fileURLToPath3(new URL(".", import.meta.url)));
3179
3249
  const pkgRoot = resolve8(cliDir, "..", "..");
3180
3250
  const candidates = [join5(pkgRoot, "templates")];
3181
3251
  for (const candidate of candidates) {
@@ -3194,7 +3264,7 @@ var WorkspaceManager = class {
3194
3264
  console.error("npm not found. Please install Node.js >= 18.");
3195
3265
  process.exit(1);
3196
3266
  }
3197
- const cliDir = resolve8(fileURLToPath2(new URL(".", import.meta.url)));
3267
+ const cliDir = resolve8(fileURLToPath3(new URL(".", import.meta.url)));
3198
3268
  const pkgRoot = resolve8(cliDir, "..", "..");
3199
3269
  const pkgBridge = join5(pkgRoot, "bridge");
3200
3270
  const srcBridge = join5(pkgRoot, "..", "..", "bridge");
@@ -3333,7 +3403,7 @@ var CliRuntime = class {
3333
3403
  }
3334
3404
  const uiPort = typeof state.uiPort === "number" && Number.isFinite(state.uiPort) ? state.uiPort : 18791;
3335
3405
  const delayMs = typeof params.delayMs === "number" && Number.isFinite(params.delayMs) ? Math.max(0, Math.floor(params.delayMs)) : 100;
3336
- const cliPath = process.env.NEXTCLAW_SELF_RELAUNCH_CLI?.trim() || fileURLToPath3(new URL("./index.js", import.meta.url));
3406
+ const cliPath = process.env.NEXTCLAW_SELF_RELAUNCH_CLI?.trim() || fileURLToPath4(new URL("./index.js", import.meta.url));
3337
3407
  const startArgs = [cliPath, "start", "--ui-port", String(uiPort)];
3338
3408
  const serviceStatePath = resolve9(getDataDir7(), "run", "service.json");
3339
3409
  const helperScript = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.6.35",
3
+ "version": "0.7.0",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "chokidar": "^3.6.0",
40
40
  "commander": "^12.1.0",
41
41
  "@nextclaw/core": "^0.6.27",
42
- "@nextclaw/server": "^0.4.16",
42
+ "@nextclaw/server": "^0.5.0",
43
43
  "@nextclaw/openclaw-compat": "^0.1.20"
44
44
  },
45
45
  "devDependencies": {