nextclaw 0.18.2 → 0.18.3

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.
@@ -5220,11 +5220,31 @@ async function waitForExit(pid, timeoutMs) {
5220
5220
  }
5221
5221
  return !isProcessRunning(pid);
5222
5222
  }
5223
- function resolveUiStaticDir() {
5223
+ function findNearestPackageManifest(startDir, expectedName) {
5224
+ let current = resolve(startDir);
5225
+ while (current.length > 0) {
5226
+ const pkgPath = join(current, "package.json");
5227
+ if (existsSync(pkgPath)) try {
5228
+ const raw = readFileSync(pkgPath, "utf-8");
5229
+ const parsed = JSON.parse(raw);
5230
+ if (!expectedName || parsed.name === expectedName) return {
5231
+ rootDir: current,
5232
+ version: typeof parsed.version === "string" ? parsed.version : void 0
5233
+ };
5234
+ } catch {}
5235
+ const parent = resolve(current, "..");
5236
+ if (parent === current) break;
5237
+ current = parent;
5238
+ }
5239
+ return null;
5240
+ }
5241
+ function resolveUiStaticDir(importMetaUrl = import.meta.url) {
5224
5242
  if (process.env.NEXTCLAW_DISABLE_STATIC_UI === "1") return null;
5225
5243
  const envDir = process.env.NEXTCLAW_UI_STATIC_DIR;
5226
5244
  if (envDir) return existsSync(join(envDir, "index.html")) ? envDir : null;
5227
- const bundledDir = join(resolve(resolve(fileURLToPath(new URL(".", import.meta.url))), "..", "..", "..", ".."), "ui-dist");
5245
+ const pkgRoot = findNearestPackageManifest(resolve(fileURLToPath(new URL(".", importMetaUrl))), "nextclaw")?.rootDir;
5246
+ if (!pkgRoot) return null;
5247
+ const bundledDir = join(pkgRoot, "ui-dist");
5228
5248
  return existsSync(join(bundledDir, "index.html")) ? bundledDir : null;
5229
5249
  }
5230
5250
  function openBrowser(url) {
@@ -5246,7 +5266,7 @@ function openBrowser(url) {
5246
5266
  command = "xdg-open";
5247
5267
  args = [url];
5248
5268
  }
5249
- if (!which(command)) return false;
5269
+ if (!findExecutableOnPath(command)) return false;
5250
5270
  try {
5251
5271
  spawn(command, args, {
5252
5272
  stdio: "ignore",
@@ -5260,7 +5280,7 @@ function openBrowser(url) {
5260
5280
  }
5261
5281
  function normalizePathEntries(rawPath, platform) {
5262
5282
  const delimiter = platform === "win32" ? ";" : ":";
5263
- return rawPath.split(delimiter).map((entry) => entry.trim().replace(/^"+|"+$/g, "")).filter((entry) => entry.length > 0);
5283
+ return rawPath.split(delimiter).map((entry) => entry.trim().replace(/^"+|"+$/g, "")).filter(Boolean);
5264
5284
  }
5265
5285
  function normalizeWindowsPathExt(rawPathExt) {
5266
5286
  const source = rawPathExt && rawPathExt.trim().length > 0 ? rawPathExt : ".COM;.EXE;.BAT;.CMD";
@@ -5274,8 +5294,7 @@ function normalizeWindowsPathExt(rawPathExt) {
5274
5294
  return [...unique];
5275
5295
  }
5276
5296
  function hasFileExtension(binary) {
5277
- const lastSlash = Math.max(binary.lastIndexOf("/"), binary.lastIndexOf("\\"));
5278
- return binary.lastIndexOf(".") > lastSlash;
5297
+ return binary.lastIndexOf(".") > Math.max(binary.lastIndexOf("/"), binary.lastIndexOf("\\"));
5279
5298
  }
5280
5299
  function findExecutableOnPath(binary, env = process.env, platform = process.platform) {
5281
5300
  const target = binary.trim();
@@ -5285,41 +5304,20 @@ function findExecutableOnPath(binary, env = process.env, platform = process.plat
5285
5304
  if (!rawPath.trim()) return null;
5286
5305
  const entries = normalizePathEntries(rawPath, platform);
5287
5306
  if (entries.length === 0) return null;
5288
- const checkCandidates = (candidate) => existsSync(candidate) ? candidate : null;
5289
5307
  for (const dir of entries) {
5290
- const direct = checkCandidates(join(dir, target));
5291
- if (direct) return direct;
5308
+ const direct = join(dir, target);
5309
+ if (existsSync(direct)) return direct;
5292
5310
  if (platform !== "win32" || hasFileExtension(target)) continue;
5293
5311
  for (const ext of normalizeWindowsPathExt(env.PATHEXT)) {
5294
- const withExt = checkCandidates(join(dir, `${target}${ext}`));
5295
- if (withExt) return withExt;
5312
+ const withExt = join(dir, `${target}${ext}`);
5313
+ if (existsSync(withExt)) return withExt;
5296
5314
  }
5297
5315
  }
5298
5316
  return null;
5299
5317
  }
5300
- function which(binary) {
5301
- return findExecutableOnPath(binary) !== null;
5302
- }
5303
- function resolveVersionFromPackageTree(startDir, expectedName) {
5304
- let current = resolve(startDir);
5305
- while (current.length > 0) {
5306
- const pkgPath = join(current, "package.json");
5307
- if (existsSync(pkgPath)) try {
5308
- const raw = readFileSync(pkgPath, "utf-8");
5309
- const parsed = JSON.parse(raw);
5310
- const version = typeof parsed.version === "string" ? parsed.version : null;
5311
- const matchesExpectedName = !expectedName || parsed.name === expectedName;
5312
- if (version && matchesExpectedName) return version;
5313
- } catch {}
5314
- const parent = resolve(current, "..");
5315
- if (parent === current) break;
5316
- current = parent;
5317
- }
5318
- return null;
5319
- }
5320
5318
  function getPackageVersion$1() {
5321
5319
  const cliDir = resolve(fileURLToPath(new URL(".", import.meta.url)));
5322
- return resolveVersionFromPackageTree(cliDir, "nextclaw") ?? resolveVersionFromPackageTree(cliDir) ?? getPackageVersion();
5320
+ return findNearestPackageManifest(cliDir, "nextclaw")?.version ?? findNearestPackageManifest(cliDir)?.version ?? getPackageVersion();
5323
5321
  }
5324
5322
  function printAgentResponse(response) {
5325
5323
  console.log("\n" + response + "\n");
@@ -18216,7 +18214,7 @@ var WorkspaceManager = class {
18216
18214
  return this.exitWithError(`Bridge source not found. Try reinstalling ${APP_NAME}.`);
18217
18215
  };
18218
18216
  assertCommandAvailable = (command) => {
18219
- if (which(command)) return;
18217
+ if (findExecutableOnPath(command)) return;
18220
18218
  this.exitWithError(`${command} not found. Please install Node.js >= 18.`);
18221
18219
  };
18222
18220
  runBridgeCommand = (cwd, args, step) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -42,16 +42,16 @@
42
42
  "yaml": "^2.8.1",
43
43
  "@nextclaw/core": "0.12.10",
44
44
  "@nextclaw/mcp": "0.1.75",
45
- "@nextclaw/ncp": "0.5.4",
46
45
  "@nextclaw/ncp-agent-runtime": "0.3.14",
46
+ "@nextclaw/ncp": "0.5.4",
47
47
  "@nextclaw/ncp-mcp": "0.1.77",
48
- "@nextclaw/ncp-toolkit": "0.5.9",
49
48
  "@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.3",
50
- "@nextclaw/nextclaw-hermes-acp-bridge": "0.1.3",
51
- "@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.4",
49
+ "@nextclaw/openclaw-compat": "1.0.10",
52
50
  "@nextclaw/server": "0.12.10",
51
+ "@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.4",
52
+ "@nextclaw/nextclaw-hermes-acp-bridge": "0.1.3",
53
53
  "@nextclaw/runtime": "0.2.42",
54
- "@nextclaw/openclaw-compat": "1.0.10",
54
+ "@nextclaw/ncp-toolkit": "0.5.9",
55
55
  "@nextclaw/remote": "0.1.87"
56
56
  },
57
57
  "devDependencies": {