nextclaw 0.13.20 → 0.13.22

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 +159 -154
  2. package/package.json +9 -9
package/dist/cli/index.js CHANGED
@@ -7,11 +7,10 @@ import { registerRemoteCommands } from "@nextclaw/remote";
7
7
 
8
8
  // src/cli/runtime.ts
9
9
  import {
10
- loadConfig as loadConfig17,
10
+ loadConfig as loadConfig18,
11
11
  saveConfig as saveConfig11,
12
- getConfigPath as getConfigPath9,
12
+ getConfigPath as getConfigPath10,
13
13
  getDataDir as getDataDir9,
14
- ConfigSchema as ConfigSchema2,
15
14
  getWorkspacePath as getWorkspacePath10,
16
15
  expandHome as expandHome2,
17
16
  MessageBus as MessageBus2,
@@ -28,7 +27,7 @@ import {
28
27
  resolvePluginChannelMessageToolHints as resolvePluginChannelMessageToolHints2,
29
28
  setPluginRuntimeBridge as setPluginRuntimeBridge3
30
29
  } from "@nextclaw/openclaw-compat";
31
- import { existsSync as existsSync12, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
30
+ import { existsSync as existsSync13, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
32
31
  import { join as join8, resolve as resolve12 } from "path";
33
32
  import { createInterface as createInterface3 } from "readline";
34
33
  import { fileURLToPath as fileURLToPath5 } from "url";
@@ -91,8 +90,19 @@ var RestartCoordinator = class {
91
90
  }
92
91
  };
93
92
 
93
+ // src/cli/runtime-config-init.ts
94
+ import { existsSync } from "fs";
95
+ import { getConfigPath, loadConfig } from "@nextclaw/core";
96
+ function initializeConfigIfMissing(configPath = getConfigPath()) {
97
+ if (existsSync(configPath)) {
98
+ return false;
99
+ }
100
+ loadConfig(configPath);
101
+ return true;
102
+ }
103
+
94
104
  // src/cli/restart-sentinel.ts
95
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
105
+ import { existsSync as existsSync2, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
96
106
  import { resolve } from "path";
97
107
  import { getDataDir } from "@nextclaw/core";
98
108
  var RESTART_SENTINEL_FILENAME = "restart-sentinel.json";
@@ -129,7 +139,7 @@ async function writeRestartSentinel(payload) {
129
139
  }
130
140
  async function consumeRestartSentinel() {
131
141
  const path2 = resolveRestartSentinelPath();
132
- if (!existsSync(path2)) {
142
+ if (!existsSync2(path2)) {
133
143
  return null;
134
144
  }
135
145
  try {
@@ -188,12 +198,12 @@ function parseSessionKey(sessionKey) {
188
198
  }
189
199
 
190
200
  // src/cli/skills/marketplace.ts
191
- import { cpSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync3, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
201
+ import { cpSync, existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync3, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
192
202
  import { basename, dirname, isAbsolute, join, relative, resolve as resolve3 } from "path";
193
203
  import { SkillsLoader } from "@nextclaw/core";
194
204
 
195
205
  // src/cli/skills/marketplace.metadata.ts
196
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
206
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
197
207
  import { resolve as resolve2 } from "path";
198
208
  import { parse as parseYaml } from "yaml";
199
209
  var DEFAULT_MARKETPLACE_META_FILENAME = "marketplace.json";
@@ -266,7 +276,7 @@ function readMarketplaceMetadataFile(skillDir, explicitMetaFile) {
266
276
  }
267
277
  function resolveMarketplaceMetadataPath(skillDir, explicitMetaFile) {
268
278
  const resolved = explicitMetaFile?.trim() ? resolve2(explicitMetaFile) : resolve2(skillDir, DEFAULT_MARKETPLACE_META_FILENAME);
269
- return existsSync2(resolved) ? resolved : void 0;
279
+ return existsSync3(resolved) ? resolved : void 0;
270
280
  }
271
281
  function mergeLocalizedTextMap(...maps) {
272
282
  const localized = {};
@@ -407,7 +417,7 @@ var DEFAULT_MARKETPLACE_API_BASE = "https://marketplace-api.nextclaw.io";
407
417
  async function installMarketplaceSkill(options) {
408
418
  const slug = validateSkillSlug(options.slug.trim(), "slug");
409
419
  const workdir = resolve3(options.workdir);
410
- if (!existsSync3(workdir)) {
420
+ if (!existsSync4(workdir)) {
411
421
  throw new Error(`Workdir does not exist: ${workdir}`);
412
422
  }
413
423
  const dirName = options.dir?.trim() || "skills";
@@ -416,8 +426,8 @@ async function installMarketplaceSkill(options) {
416
426
  const apiBase = resolveMarketplaceApiBase(options.apiBaseUrl);
417
427
  const item = await fetchMarketplaceSkillItem(apiBase, slug);
418
428
  if (item.install.kind === "builtin") {
419
- if (!options.force && existsSync3(destinationDir)) {
420
- if (existsSync3(skillFile)) {
429
+ if (!options.force && existsSync4(destinationDir)) {
430
+ if (existsSync4(skillFile)) {
421
431
  return {
422
432
  slug,
423
433
  destinationDir,
@@ -427,7 +437,7 @@ async function installMarketplaceSkill(options) {
427
437
  }
428
438
  throw new Error(`Skill directory already exists: ${destinationDir} (use --force)`);
429
439
  }
430
- if (existsSync3(destinationDir) && options.force) {
440
+ if (existsSync4(destinationDir) && options.force) {
431
441
  rmSync2(destinationDir, { recursive: true, force: true });
432
442
  }
433
443
  installBuiltinSkill(workdir, destinationDir, slug);
@@ -438,7 +448,7 @@ async function installMarketplaceSkill(options) {
438
448
  };
439
449
  }
440
450
  const filesPayload = await fetchMarketplaceSkillFiles(apiBase, slug);
441
- if (!options.force && existsSync3(destinationDir)) {
451
+ if (!options.force && existsSync4(destinationDir)) {
442
452
  const existingDirState = inspectMarketplaceSkillDirectory(destinationDir, filesPayload.files);
443
453
  if (existingDirState === "installed") {
444
454
  return {
@@ -454,7 +464,7 @@ async function installMarketplaceSkill(options) {
454
464
  throw new Error(`Skill directory already exists: ${destinationDir} (use --force)`);
455
465
  }
456
466
  }
457
- if (existsSync3(destinationDir) && options.force) {
467
+ if (existsSync4(destinationDir) && options.force) {
458
468
  rmSync2(destinationDir, { recursive: true, force: true });
459
469
  }
460
470
  mkdirSync2(destinationDir, { recursive: true });
@@ -468,7 +478,7 @@ async function installMarketplaceSkill(options) {
468
478
  const bytes = file.contentBase64 ? decodeMarketplaceFileContent(file.path, file.contentBase64) : await fetchMarketplaceSkillFileBlob(apiBase, slug, file);
469
479
  writeFileSync2(targetPath, bytes);
470
480
  }
471
- if (!existsSync3(join(destinationDir, "SKILL.md"))) {
481
+ if (!existsSync4(join(destinationDir, "SKILL.md"))) {
472
482
  throw new Error(`Marketplace skill ${slug} does not include SKILL.md`);
473
483
  }
474
484
  return {
@@ -478,7 +488,7 @@ async function installMarketplaceSkill(options) {
478
488
  };
479
489
  }
480
490
  function inspectMarketplaceSkillDirectory(destinationDir, files) {
481
- if (existsSync3(join(destinationDir, "SKILL.md"))) {
491
+ if (existsSync4(join(destinationDir, "SKILL.md"))) {
482
492
  return "installed";
483
493
  }
484
494
  const discoveredFiles = collectRelativeFiles(destinationDir);
@@ -522,7 +532,7 @@ function isIgnorableMarketplaceResidue(path2) {
522
532
  }
523
533
  async function publishMarketplaceSkill(options) {
524
534
  const skillDir = resolve3(options.skillDir);
525
- if (!existsSync3(skillDir)) {
535
+ if (!existsSync4(skillDir)) {
526
536
  throw new Error(`Skill directory not found: ${skillDir}`);
527
537
  }
528
538
  const files = collectFiles(skillDir);
@@ -754,7 +764,7 @@ import { spawnSync } from "child_process";
754
764
  import { resolve as resolve5 } from "path";
755
765
 
756
766
  // src/cli/utils.ts
757
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3, rmSync as rmSync3 } from "fs";
767
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3, rmSync as rmSync3 } from "fs";
758
768
  import { join as join2, resolve as resolve4 } from "path";
759
769
  import { spawn } from "child_process";
760
770
  import { isIP } from "net";
@@ -809,7 +819,7 @@ function buildServeArgs(options) {
809
819
  }
810
820
  function readServiceState() {
811
821
  const path2 = resolveServiceStatePath();
812
- if (!existsSync4(path2)) {
822
+ if (!existsSync5(path2)) {
813
823
  return null;
814
824
  }
815
825
  try {
@@ -835,7 +845,7 @@ function updateServiceState(updater) {
835
845
  }
836
846
  function clearServiceState() {
837
847
  const path2 = resolveServiceStatePath();
838
- if (existsSync4(path2)) {
848
+ if (existsSync5(path2)) {
839
849
  rmSync3(path2, { force: true });
840
850
  }
841
851
  }
@@ -866,12 +876,12 @@ async function waitForExit(pid, timeoutMs) {
866
876
  function resolveUiStaticDir() {
867
877
  const envDir = process.env.NEXTCLAW_UI_STATIC_DIR;
868
878
  if (envDir) {
869
- return existsSync4(join2(envDir, "index.html")) ? envDir : null;
879
+ return existsSync5(join2(envDir, "index.html")) ? envDir : null;
870
880
  }
871
881
  const cliDir = resolve4(fileURLToPath(new URL(".", import.meta.url)));
872
882
  const pkgRoot = resolve4(cliDir, "..", "..");
873
883
  const bundledDir = join2(pkgRoot, "ui-dist");
874
- return existsSync4(join2(bundledDir, "index.html")) ? bundledDir : null;
884
+ return existsSync5(join2(bundledDir, "index.html")) ? bundledDir : null;
875
885
  }
876
886
  function openBrowser(url) {
877
887
  const platform = process.platform;
@@ -918,7 +928,7 @@ function findExecutableOnPath(binary, env = process.env, platform = process.plat
918
928
  return null;
919
929
  }
920
930
  if (target.includes("/") || target.includes("\\")) {
921
- return existsSync4(target) ? target : null;
931
+ return existsSync5(target) ? target : null;
922
932
  }
923
933
  const rawPath = env.PATH ?? env.Path ?? env.path ?? "";
924
934
  if (!rawPath.trim()) {
@@ -928,7 +938,7 @@ function findExecutableOnPath(binary, env = process.env, platform = process.plat
928
938
  if (entries.length === 0) {
929
939
  return null;
930
940
  }
931
- const checkCandidates = (candidate) => existsSync4(candidate) ? candidate : null;
941
+ const checkCandidates = (candidate) => existsSync5(candidate) ? candidate : null;
932
942
  for (const dir of entries) {
933
943
  const direct = checkCandidates(join2(dir, target));
934
944
  if (direct) {
@@ -953,7 +963,7 @@ function resolveVersionFromPackageTree(startDir, expectedName) {
953
963
  let current = resolve4(startDir);
954
964
  while (current.length > 0) {
955
965
  const pkgPath = join2(current, "package.json");
956
- if (existsSync4(pkgPath)) {
966
+ if (existsSync5(pkgPath)) {
957
967
  try {
958
968
  const raw = readFileSync4(pkgPath, "utf-8");
959
969
  const parsed = JSON.parse(raw);
@@ -1247,7 +1257,7 @@ var applyDevFirstPartyPluginLoadPaths = (config2, workspaceExtensionsDir) => {
1247
1257
 
1248
1258
  // src/cli/commands/plugins.ts
1249
1259
  import {
1250
- loadConfig as loadConfig2,
1260
+ loadConfig as loadConfig3,
1251
1261
  getWorkspacePath as getWorkspacePath2
1252
1262
  } from "@nextclaw/core";
1253
1263
  import { createInterface } from "readline";
@@ -1264,9 +1274,9 @@ import {
1264
1274
  recordPluginInstall,
1265
1275
  uninstallPlugin
1266
1276
  } from "@nextclaw/openclaw-compat";
1267
- import { existsSync as existsSync5 } from "fs";
1277
+ import { existsSync as existsSync6 } from "fs";
1268
1278
  import { resolve as resolve6 } from "path";
1269
- import { expandHome, getWorkspacePath, loadConfig, saveConfig } from "@nextclaw/core";
1279
+ import { expandHome, getWorkspacePath, loadConfig as loadConfig2, saveConfig } from "@nextclaw/core";
1270
1280
  function resolveFileNpmSpecToLocalPath(raw) {
1271
1281
  const trimmed = raw.trim();
1272
1282
  if (!trimmed.toLowerCase().startsWith("file:")) {
@@ -1298,7 +1308,7 @@ function isArchivePath(filePath) {
1298
1308
  return lower.endsWith(".zip") || lower.endsWith(".tgz") || lower.endsWith(".tar.gz") || lower.endsWith(".tar");
1299
1309
  }
1300
1310
  async function enablePluginMutation(id) {
1301
- const config2 = loadConfig();
1311
+ const config2 = loadConfig2();
1302
1312
  const next = enablePluginInConfig(config2, id);
1303
1313
  saveConfig(next);
1304
1314
  return {
@@ -1306,7 +1316,7 @@ async function enablePluginMutation(id) {
1306
1316
  };
1307
1317
  }
1308
1318
  async function disablePluginMutation(id) {
1309
- const config2 = loadConfig();
1319
+ const config2 = loadConfig2();
1310
1320
  const next = disablePluginInConfig(config2, id);
1311
1321
  saveConfig(next);
1312
1322
  return {
@@ -1314,7 +1324,7 @@ async function disablePluginMutation(id) {
1314
1324
  };
1315
1325
  }
1316
1326
  async function uninstallPluginMutation(id, opts = {}) {
1317
- const config2 = loadConfig();
1327
+ const config2 = loadConfig2();
1318
1328
  const workspaceDir = getWorkspacePath(config2.agents.defaults.workspace);
1319
1329
  const report = buildPluginStatusReport({
1320
1330
  config: config2,
@@ -1371,8 +1381,8 @@ async function installPluginMutation(pathOrSpec, opts = {}) {
1371
1381
  }
1372
1382
  const normalized = fileSpec && fileSpec.ok ? fileSpec.path : pathOrSpec;
1373
1383
  const resolved = resolve6(expandHome(normalized));
1374
- const config2 = loadConfig();
1375
- if (existsSync5(resolved)) {
1384
+ const config2 = loadConfig2();
1385
+ if (existsSync6(resolved)) {
1376
1386
  if (opts.link) {
1377
1387
  const probe = await installPluginFromPath({ path: resolved, dryRun: true });
1378
1388
  if (!probe.ok) {
@@ -1567,7 +1577,7 @@ var PluginCommands = class {
1567
1577
  return await installPluginMutation(pathOrSpec, opts);
1568
1578
  }
1569
1579
  pluginsList(opts = {}) {
1570
- const config2 = loadConfig2();
1580
+ const config2 = loadConfig3();
1571
1581
  const workspaceDir = getWorkspacePath2(config2.agents.defaults.workspace);
1572
1582
  const report = buildPluginStatusReport2({
1573
1583
  config: config2,
@@ -1619,7 +1629,7 @@ var PluginCommands = class {
1619
1629
  }
1620
1630
  }
1621
1631
  pluginsInfo(id, opts = {}) {
1622
- const config2 = loadConfig2();
1632
+ const config2 = loadConfig3();
1623
1633
  const workspaceDir = getWorkspacePath2(config2.agents.defaults.workspace);
1624
1634
  const report = buildPluginStatusReport2({
1625
1635
  config: config2,
@@ -1700,7 +1710,7 @@ var PluginCommands = class {
1700
1710
  if (opts.keepConfig) {
1701
1711
  console.log("`--keep-config` is deprecated, use `--keep-files`.");
1702
1712
  }
1703
- const config2 = loadConfig2();
1713
+ const config2 = loadConfig3();
1704
1714
  const workspaceDir = getWorkspacePath2(config2.agents.defaults.workspace);
1705
1715
  const report = buildPluginStatusReport2({
1706
1716
  config: config2,
@@ -1784,7 +1794,7 @@ var PluginCommands = class {
1784
1794
  console.log("If gateway is running, plugin changes are hot-applied automatically.");
1785
1795
  }
1786
1796
  pluginsDoctor() {
1787
- const config2 = loadConfig2();
1797
+ const config2 = loadConfig3();
1788
1798
  const workspaceDir = getWorkspacePath2(config2.agents.defaults.workspace);
1789
1799
  const report = buildPluginStatusReport2({
1790
1800
  config: config2,
@@ -1829,7 +1839,7 @@ var PluginCommands = class {
1829
1839
  };
1830
1840
 
1831
1841
  // src/cli/commands/config.ts
1832
- import { buildReloadPlan, diffConfigPaths, loadConfig as loadConfig3, saveConfig as saveConfig2 } from "@nextclaw/core";
1842
+ import { buildReloadPlan, diffConfigPaths, loadConfig as loadConfig4, saveConfig as saveConfig2 } from "@nextclaw/core";
1833
1843
 
1834
1844
  // src/cli/config-path.ts
1835
1845
  function isIndexSegment(raw) {
@@ -2024,7 +2034,7 @@ var ConfigCommands = class {
2024
2034
  this.deps = deps;
2025
2035
  }
2026
2036
  configGet(pathExpr, opts = {}) {
2027
- const config2 = loadConfig3();
2037
+ const config2 = loadConfig4();
2028
2038
  let parsedPath;
2029
2039
  try {
2030
2040
  parsedPath = parseRequiredConfigPath(pathExpr);
@@ -2066,7 +2076,7 @@ var ConfigCommands = class {
2066
2076
  process.exit(1);
2067
2077
  return;
2068
2078
  }
2069
- const prevConfig = loadConfig3();
2079
+ const prevConfig = loadConfig4();
2070
2080
  const nextConfig = structuredClone(prevConfig);
2071
2081
  try {
2072
2082
  setAtConfigPath(nextConfig, parsedPath, parsedValue);
@@ -2092,7 +2102,7 @@ var ConfigCommands = class {
2092
2102
  process.exit(1);
2093
2103
  return;
2094
2104
  }
2095
- const prevConfig = loadConfig3();
2105
+ const prevConfig = loadConfig4();
2096
2106
  const nextConfig = structuredClone(prevConfig);
2097
2107
  const removed = unsetAtConfigPath(nextConfig, parsedPath);
2098
2108
  if (!removed) {
@@ -2125,7 +2135,7 @@ var ConfigCommands = class {
2125
2135
  };
2126
2136
 
2127
2137
  // src/cli/commands/mcp.ts
2128
- import { loadConfig as loadConfig4, saveConfig as saveConfig3 } from "@nextclaw/core";
2138
+ import { loadConfig as loadConfig5, saveConfig as saveConfig3 } from "@nextclaw/core";
2129
2139
  import {
2130
2140
  McpDoctorFacade,
2131
2141
  McpMutationService,
@@ -2255,7 +2265,7 @@ function buildMcpServerDefinition(command, opts) {
2255
2265
  var McpCommands = class {
2256
2266
  mcpList(opts = {}) {
2257
2267
  const registry = new McpRegistryService({
2258
- getConfig: () => loadConfig4()
2268
+ getConfig: () => loadConfig5()
2259
2269
  });
2260
2270
  const servers = registry.listServers().map((server) => ({
2261
2271
  name: server.name,
@@ -2278,7 +2288,7 @@ var McpCommands = class {
2278
2288
  }
2279
2289
  async mcpAdd(name, command, opts) {
2280
2290
  const mutation = new McpMutationService({
2281
- getConfig: () => loadConfig4(),
2291
+ getConfig: () => loadConfig5(),
2282
2292
  saveConfig: (config2) => saveConfig3(config2)
2283
2293
  });
2284
2294
  const result = mutation.addServer(name, buildMcpServerDefinition(command, opts));
@@ -2290,7 +2300,7 @@ var McpCommands = class {
2290
2300
  }
2291
2301
  async mcpRemove(name) {
2292
2302
  const mutation = new McpMutationService({
2293
- getConfig: () => loadConfig4(),
2303
+ getConfig: () => loadConfig5(),
2294
2304
  saveConfig: (config2) => saveConfig3(config2)
2295
2305
  });
2296
2306
  const result = mutation.removeServer(name);
@@ -2308,10 +2318,10 @@ var McpCommands = class {
2308
2318
  }
2309
2319
  async mcpDoctor(name, opts = {}) {
2310
2320
  const registry = new McpRegistryService({
2311
- getConfig: () => loadConfig4()
2321
+ getConfig: () => loadConfig5()
2312
2322
  });
2313
2323
  const doctor = new McpDoctorFacade({
2314
- getConfig: () => loadConfig4(),
2324
+ getConfig: () => loadConfig5(),
2315
2325
  registryService: registry
2316
2326
  });
2317
2327
  try {
@@ -2337,7 +2347,7 @@ var McpCommands = class {
2337
2347
  }
2338
2348
  async toggleEnabled(name, enabled) {
2339
2349
  const mutation = new McpMutationService({
2340
- getConfig: () => loadConfig4(),
2350
+ getConfig: () => loadConfig5(),
2341
2351
  saveConfig: (config2) => saveConfig3(config2)
2342
2352
  });
2343
2353
  const result = mutation.toggleEnabled(name, enabled);
@@ -2358,8 +2368,8 @@ import { readFileSync as readFileSync5 } from "fs";
2358
2368
  import {
2359
2369
  buildReloadPlan as buildReloadPlan2,
2360
2370
  diffConfigPaths as diffConfigPaths2,
2361
- getConfigPath,
2362
- loadConfig as loadConfig5,
2371
+ getConfigPath as getConfigPath2,
2372
+ loadConfig as loadConfig6,
2363
2373
  resolveConfigSecrets,
2364
2374
  saveConfig as saveConfig4
2365
2375
  } from "@nextclaw/core";
@@ -2455,8 +2465,8 @@ var SecretsCommands = class {
2455
2465
  this.deps = deps;
2456
2466
  }
2457
2467
  secretsAudit(opts = {}) {
2458
- const config2 = loadConfig5();
2459
- const configPath = getConfigPath();
2468
+ const config2 = loadConfig6();
2469
+ const configPath = getConfigPath2();
2460
2470
  const refs = config2.secrets.refs;
2461
2471
  const items = [];
2462
2472
  for (const [path2, ref] of Object.entries(refs)) {
@@ -2523,7 +2533,7 @@ var SecretsCommands = class {
2523
2533
  if (!alias) {
2524
2534
  throw new Error("provider alias is required");
2525
2535
  }
2526
- const prevConfig = loadConfig5();
2536
+ const prevConfig = loadConfig6();
2527
2537
  const nextConfig = structuredClone(prevConfig);
2528
2538
  const remove = Boolean(opts.remove);
2529
2539
  if (remove) {
@@ -2570,7 +2580,7 @@ var SecretsCommands = class {
2570
2580
  nextConfig.secrets.defaults[source] = alias;
2571
2581
  }
2572
2582
  }
2573
- resolveConfigSecrets(nextConfig, { configPath: getConfigPath() });
2583
+ resolveConfigSecrets(nextConfig, { configPath: getConfigPath2() });
2574
2584
  saveConfig4(nextConfig);
2575
2585
  await this.requestRestartForConfigDiff({
2576
2586
  prevConfig,
@@ -2585,7 +2595,7 @@ var SecretsCommands = class {
2585
2595
  console.log(`Secrets provider ${remove ? "removed" : "configured"}: ${alias}`);
2586
2596
  }
2587
2597
  async secretsApply(opts) {
2588
- const prevConfig = loadConfig5();
2598
+ const prevConfig = loadConfig6();
2589
2599
  const nextConfig = structuredClone(prevConfig);
2590
2600
  if (opts.enable && opts.disable) {
2591
2601
  throw new Error("cannot set --enable and --disable at the same time");
@@ -2635,7 +2645,7 @@ var SecretsCommands = class {
2635
2645
  } else if (opts.remove && !opts.file) {
2636
2646
  throw new Error("--remove requires --path");
2637
2647
  }
2638
- resolveConfigSecrets(nextConfig, { configPath: getConfigPath() });
2648
+ resolveConfigSecrets(nextConfig, { configPath: getConfigPath2() });
2639
2649
  saveConfig4(nextConfig);
2640
2650
  await this.requestRestartForConfigDiff({
2641
2651
  prevConfig,
@@ -2650,8 +2660,8 @@ var SecretsCommands = class {
2650
2660
  console.log("Secrets applied.");
2651
2661
  }
2652
2662
  async secretsReload(opts = {}) {
2653
- const config2 = loadConfig5();
2654
- const configPath = getConfigPath();
2663
+ const config2 = loadConfig6();
2664
+ const configPath = getConfigPath2();
2655
2665
  resolveConfigSecrets(config2, { configPath });
2656
2666
  saveConfig4(config2);
2657
2667
  if (opts.json) {
@@ -2678,7 +2688,7 @@ var SecretsCommands = class {
2678
2688
 
2679
2689
  // src/cli/commands/channels.ts
2680
2690
  import { spawnSync as spawnSync2 } from "child_process";
2681
- import { getWorkspacePath as getWorkspacePath3, loadConfig as loadConfig6, saveConfig as saveConfig5 } from "@nextclaw/core";
2691
+ import { getWorkspacePath as getWorkspacePath3, loadConfig as loadConfig7, saveConfig as saveConfig5 } from "@nextclaw/core";
2682
2692
  import { BUILTIN_CHANNEL_PLUGIN_IDS, builtinProviderIds as builtinProviderIds2 } from "@nextclaw/runtime";
2683
2693
  import { buildPluginStatusReport as buildPluginStatusReport3, enablePluginInConfig as enablePluginInConfig2, getPluginChannelBindings } from "@nextclaw/openclaw-compat";
2684
2694
  var CHANNEL_LABELS = {
@@ -2699,7 +2709,7 @@ var ChannelCommands = class {
2699
2709
  this.deps = deps;
2700
2710
  }
2701
2711
  channelsStatus() {
2702
- const config2 = loadConfig6();
2712
+ const config2 = loadConfig7();
2703
2713
  console.log("Channel Status");
2704
2714
  const channelConfig = config2.channels;
2705
2715
  for (const channelId of BUILTIN_CHANNEL_PLUGIN_IDS) {
@@ -2738,7 +2748,7 @@ var ChannelCommands = class {
2738
2748
  console.error("--channel is required");
2739
2749
  process.exit(1);
2740
2750
  }
2741
- const config2 = loadConfig6();
2751
+ const config2 = loadConfig7();
2742
2752
  const workspaceDir = getWorkspacePath3(config2.agents.defaults.workspace);
2743
2753
  const pluginRegistry = loadPluginRegistry(config2, workspaceDir);
2744
2754
  const bindings = getPluginChannelBindings(pluginRegistry);
@@ -2867,7 +2877,7 @@ var CronCommands = class {
2867
2877
  };
2868
2878
 
2869
2879
  // src/cli/commands/platform-auth.ts
2870
- import { getConfigPath as getConfigPath2, loadConfig as loadConfig7, saveConfig as saveConfig6 } from "@nextclaw/core";
2880
+ import { getConfigPath as getConfigPath3, loadConfig as loadConfig8, saveConfig as saveConfig6 } from "@nextclaw/core";
2871
2881
  import { createInterface as createInterface2 } from "readline";
2872
2882
 
2873
2883
  // src/cli/commands/platform-api-base.ts
@@ -2920,8 +2930,8 @@ function buildPlatformApiBaseErrorMessage(inputApiBase, rawMessage) {
2920
2930
 
2921
2931
  // src/cli/commands/platform-auth.ts
2922
2932
  function resolveProviderConfig(opts) {
2923
- const configPath = getConfigPath2();
2924
- const config2 = loadConfig7(configPath);
2933
+ const configPath = getConfigPath3();
2934
+ const config2 = loadConfig8(configPath);
2925
2935
  const providers = config2.providers;
2926
2936
  const nextclawProvider = providers.nextclaw ?? {
2927
2937
  displayName: "",
@@ -3170,12 +3180,12 @@ var PlatformAuthCommands = class {
3170
3180
  };
3171
3181
 
3172
3182
  // src/cli/commands/remote.ts
3173
- import { getConfigPath as getConfigPath4, loadConfig as loadConfig9, saveConfig as saveConfig7 } from "@nextclaw/core";
3183
+ import { getConfigPath as getConfigPath5, loadConfig as loadConfig10, saveConfig as saveConfig7 } from "@nextclaw/core";
3174
3184
  import "@nextclaw/remote";
3175
3185
  import { hostname } from "os";
3176
3186
 
3177
3187
  // src/cli/commands/remote-runtime-support.ts
3178
- import { getConfigPath as getConfigPath3, getDataDir as getDataDir4, loadConfig as loadConfig8 } from "@nextclaw/core";
3188
+ import { getConfigPath as getConfigPath4, getDataDir as getDataDir4, loadConfig as loadConfig9 } from "@nextclaw/core";
3179
3189
  import {
3180
3190
  RemoteConnector,
3181
3191
  RemotePlatformClient,
@@ -3190,7 +3200,7 @@ function hasRunningNextclawManagedService() {
3190
3200
  }
3191
3201
  function createNextclawRemotePlatformClient() {
3192
3202
  return new RemotePlatformClient({
3193
- loadConfig: () => loadConfig8(getConfigPath3()),
3203
+ loadConfig: () => loadConfig9(getConfigPath4()),
3194
3204
  getDataDir: getDataDir4,
3195
3205
  getPackageVersion,
3196
3206
  resolvePlatformBase: (rawApiBase) => resolvePlatformApiBase({
@@ -3282,7 +3292,7 @@ var RemoteCommands = class {
3282
3292
  this.deps = deps;
3283
3293
  }
3284
3294
  updateConfig(params = {}) {
3285
- const config2 = loadConfig9(getConfigPath4());
3295
+ const config2 = loadConfig10(getConfigPath5());
3286
3296
  const nextEnabled = typeof params.enabled === "boolean" ? params.enabled : config2.remote.enabled;
3287
3297
  const nextPlatformApiBase = typeof params.apiBase === "string" ? params.apiBase.trim() : config2.remote.platformApiBase;
3288
3298
  const nextDeviceName = typeof params.name === "string" ? params.name.trim() : config2.remote.deviceName;
@@ -3319,7 +3329,7 @@ var RemoteCommands = class {
3319
3329
  });
3320
3330
  }
3321
3331
  getStatusView() {
3322
- const config2 = loadConfig9(getConfigPath4());
3332
+ const config2 = loadConfig10(getConfigPath5());
3323
3333
  const snapshot = resolveNextclawRemoteStatusSnapshot(config2);
3324
3334
  const resolvedLocalOrigin = snapshot.runtime?.localOrigin ?? this.deps.currentLocalOrigin ?? resolveConfiguredLocalOrigin(config2);
3325
3335
  return {
@@ -3355,7 +3365,7 @@ var RemoteCommands = class {
3355
3365
  }
3356
3366
  }
3357
3367
  async getDoctorView() {
3358
- const config2 = loadConfig9(getConfigPath4());
3368
+ const config2 = loadConfig10(getConfigPath5());
3359
3369
  const snapshot = resolveNextclawRemoteStatusSnapshot(config2);
3360
3370
  const localOrigin = snapshot.runtime?.localOrigin ?? this.deps.currentLocalOrigin ?? resolveConfiguredLocalOrigin(config2);
3361
3371
  const localUi = await probeLocalUi(localOrigin);
@@ -3409,15 +3419,15 @@ var RemoteCommands = class {
3409
3419
 
3410
3420
  // src/cli/commands/diagnostics.ts
3411
3421
  import { createServer as createNetServer } from "net";
3412
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
3422
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
3413
3423
  import { resolve as resolve8 } from "path";
3414
3424
  import {
3415
3425
  APP_NAME as APP_NAME2,
3416
- getConfigPath as getConfigPath5,
3426
+ getConfigPath as getConfigPath6,
3417
3427
  getDataDir as getDataDir5,
3418
3428
  getWorkspacePath as getWorkspacePath4,
3419
3429
  hasSecretRef,
3420
- loadConfig as loadConfig10
3430
+ loadConfig as loadConfig11
3421
3431
  } from "@nextclaw/core";
3422
3432
  import { listBuiltinProviders } from "@nextclaw/runtime";
3423
3433
 
@@ -3602,8 +3612,8 @@ var DiagnosticsCommands = class {
3602
3612
  process.exitCode = exitCode;
3603
3613
  }
3604
3614
  async collectRuntimeStatus(params) {
3605
- const configPath = getConfigPath5();
3606
- const config2 = loadConfig10();
3615
+ const configPath = getConfigPath6();
3616
+ const config2 = loadConfig11();
3607
3617
  const workspacePath = getWorkspacePath4(config2.agents.defaults.workspace);
3608
3618
  const serviceStatePath = resolve8(getDataDir5(), "run", "service.json");
3609
3619
  const fixActions = [];
@@ -3646,13 +3656,13 @@ var DiagnosticsCommands = class {
3646
3656
  return {
3647
3657
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3648
3658
  configPath,
3649
- configExists: existsSync6(configPath),
3659
+ configExists: existsSync7(configPath),
3650
3660
  workspacePath,
3651
- workspaceExists: existsSync6(workspacePath),
3661
+ workspaceExists: existsSync7(workspacePath),
3652
3662
  model: config2.agents.defaults.model,
3653
3663
  providers,
3654
3664
  serviceStatePath,
3655
- serviceStateExists: existsSync6(serviceStatePath),
3665
+ serviceStateExists: existsSync7(serviceStatePath),
3656
3666
  fixActions,
3657
3667
  process: {
3658
3668
  managedByState,
@@ -3727,11 +3737,11 @@ var DiagnosticsCommands = class {
3727
3737
  });
3728
3738
  }
3729
3739
  collectRuntimeIssues(params) {
3730
- if (!existsSync6(params.configPath)) {
3740
+ if (!existsSync7(params.configPath)) {
3731
3741
  params.issues.push("Config file is missing.");
3732
3742
  params.recommendations.push(`Run ${APP_NAME2} init to create config files.`);
3733
3743
  }
3734
- if (!existsSync6(params.workspacePath)) {
3744
+ if (!existsSync7(params.workspacePath)) {
3735
3745
  params.issues.push("Workspace directory does not exist.");
3736
3746
  params.recommendations.push(`Run ${APP_NAME2} init to create workspace templates.`);
3737
3747
  }
@@ -3760,7 +3770,7 @@ var DiagnosticsCommands = class {
3760
3770
  }
3761
3771
  }
3762
3772
  readLogTail(path2, maxLines = 25) {
3763
- if (!existsSync6(path2)) {
3773
+ if (!existsSync7(path2)) {
3764
3774
  return [];
3765
3775
  }
3766
3776
  try {
@@ -3804,7 +3814,7 @@ import {
3804
3814
  stopPluginChannelGateways as stopPluginChannelGateways2
3805
3815
  } from "@nextclaw/openclaw-compat";
3806
3816
  import { startUiServer } from "@nextclaw/server";
3807
- import { appendFileSync, closeSync, cpSync as cpSync2, existsSync as existsSync10, mkdirSync as mkdirSync5, openSync } from "fs";
3817
+ import { appendFileSync, closeSync, cpSync as cpSync2, existsSync as existsSync11, mkdirSync as mkdirSync5, openSync } from "fs";
3808
3818
  import { dirname as dirname2, join as join6, resolve as resolve10 } from "path";
3809
3819
  import { spawn as spawn3 } from "child_process";
3810
3820
  import { request as httpRequest } from "http";
@@ -3814,7 +3824,7 @@ import chokidar from "chokidar";
3814
3824
 
3815
3825
  // src/cli/gateway/controller.ts
3816
3826
  import { createHash } from "crypto";
3817
- import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
3827
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
3818
3828
  import {
3819
3829
  buildConfigSchema,
3820
3830
  ConfigSchema,
@@ -3822,11 +3832,11 @@ import {
3822
3832
  redactConfigObject
3823
3833
  } from "@nextclaw/core";
3824
3834
  var hashRaw = (raw) => createHash("sha256").update(raw).digest("hex");
3825
- var readConfigSnapshot = (getConfigPath10) => {
3826
- const path2 = getConfigPath10();
3835
+ var readConfigSnapshot = (getConfigPath11) => {
3836
+ const path2 = getConfigPath11();
3827
3837
  let raw = "";
3828
3838
  let parsed = {};
3829
- if (existsSync7(path2)) {
3839
+ if (existsSync8(path2)) {
3830
3840
  raw = readFileSync7(path2, "utf-8");
3831
3841
  try {
3832
3842
  parsed = JSON.parse(raw);
@@ -4284,8 +4294,8 @@ var MissingProvider = class extends LLMProvider {
4284
4294
  };
4285
4295
 
4286
4296
  // src/cli/commands/service-marketplace-installer.ts
4287
- import { getWorkspacePath as getWorkspacePath5, loadConfig as loadConfig12 } from "@nextclaw/core";
4288
- import { existsSync as existsSync8, rmSync as rmSync4 } from "fs";
4297
+ import { getWorkspacePath as getWorkspacePath5, loadConfig as loadConfig13 } from "@nextclaw/core";
4298
+ import { existsSync as existsSync9, rmSync as rmSync4 } from "fs";
4289
4299
  import { join as join4 } from "path";
4290
4300
 
4291
4301
  // src/cli/commands/service-marketplace-helpers.ts
@@ -4334,7 +4344,7 @@ var buildMarketplaceSkillInstallArgs = (params) => {
4334
4344
  };
4335
4345
 
4336
4346
  // src/cli/commands/service-mcp-marketplace-ops.ts
4337
- import { loadConfig as loadConfig11, saveConfig as saveConfig8 } from "@nextclaw/core";
4347
+ import { loadConfig as loadConfig12, saveConfig as saveConfig8 } from "@nextclaw/core";
4338
4348
  import { McpDoctorFacade as McpDoctorFacade2, McpMutationService as McpMutationService2 } from "@nextclaw/mcp";
4339
4349
  var ServiceMcpMarketplaceOps = class {
4340
4350
  constructor(options) {
@@ -4402,13 +4412,13 @@ var ServiceMcpMarketplaceOps = class {
4402
4412
  }
4403
4413
  createMutationService() {
4404
4414
  return new McpMutationService2({
4405
- getConfig: () => loadConfig11(),
4415
+ getConfig: () => loadConfig12(),
4406
4416
  saveConfig: (config2) => saveConfig8(config2)
4407
4417
  });
4408
4418
  }
4409
4419
  createDoctorFacade() {
4410
4420
  return new McpDoctorFacade2({
4411
- getConfig: () => loadConfig11()
4421
+ getConfig: () => loadConfig12()
4412
4422
  });
4413
4423
  }
4414
4424
  };
@@ -4449,7 +4459,7 @@ var ServiceMarketplaceInstaller = class {
4449
4459
  if (params.kind && params.kind !== "marketplace") {
4450
4460
  throw new Error(`Unsupported marketplace skill kind: ${params.kind}`);
4451
4461
  }
4452
- const workspace = getWorkspacePath5(loadConfig12().agents.defaults.workspace);
4462
+ const workspace = getWorkspacePath5(loadConfig13().agents.defaults.workspace);
4453
4463
  const args = buildMarketplaceSkillInstallArgs({
4454
4464
  slug: params.slug,
4455
4465
  workspace,
@@ -4488,9 +4498,9 @@ var ServiceMarketplaceInstaller = class {
4488
4498
  return { message: result.message };
4489
4499
  }
4490
4500
  async uninstallSkill(slug) {
4491
- const workspace = getWorkspacePath5(loadConfig12().agents.defaults.workspace);
4501
+ const workspace = getWorkspacePath5(loadConfig13().agents.defaults.workspace);
4492
4502
  const targetDir = join4(workspace, "skills", slug);
4493
- if (!existsSync8(targetDir)) {
4503
+ if (!existsSync9(targetDir)) {
4494
4504
  throw new Error(`Skill not installed in workspace: ${slug}`);
4495
4505
  }
4496
4506
  rmSync4(targetDir, { recursive: true, force: true });
@@ -4518,17 +4528,17 @@ var ServiceMarketplaceInstaller = class {
4518
4528
  };
4519
4529
 
4520
4530
  // src/cli/commands/service-plugin-runtime-bridge.ts
4521
- import { loadConfig as loadConfig13, resolveConfigSecrets as resolveConfigSecrets2, saveConfig as saveConfig9 } from "@nextclaw/core";
4531
+ import { loadConfig as loadConfig14, resolveConfigSecrets as resolveConfigSecrets2, saveConfig as saveConfig9 } from "@nextclaw/core";
4522
4532
  import { setPluginRuntimeBridge } from "@nextclaw/openclaw-compat";
4523
4533
  function installPluginRuntimeBridge(params) {
4524
4534
  const { runtimePool, runtimeConfigPath, pluginChannelBindings } = params;
4525
4535
  setPluginRuntimeBridge({
4526
- loadConfig: () => toPluginConfigView(resolveConfigSecrets2(loadConfig13(), { configPath: runtimeConfigPath }), pluginChannelBindings),
4536
+ loadConfig: () => toPluginConfigView(resolveConfigSecrets2(loadConfig14(), { configPath: runtimeConfigPath }), pluginChannelBindings),
4527
4537
  writeConfigFile: async (nextConfigView) => {
4528
4538
  if (!nextConfigView || typeof nextConfigView !== "object" || Array.isArray(nextConfigView)) {
4529
4539
  throw new Error("plugin runtime writeConfigFile expects an object config");
4530
4540
  }
4531
- const current = loadConfig13();
4541
+ const current = loadConfig14();
4532
4542
  const next = mergePluginConfigView(current, nextConfigView, pluginChannelBindings);
4533
4543
  saveConfig9(next);
4534
4544
  },
@@ -6609,10 +6619,10 @@ function writeReadyManagedServiceState(params) {
6609
6619
  }
6610
6620
 
6611
6621
  // src/cli/commands/remote-access-host.ts
6612
- import { getConfigPath as getConfigPath7, loadConfig as loadConfig15 } from "@nextclaw/core";
6622
+ import { getConfigPath as getConfigPath8, loadConfig as loadConfig16 } from "@nextclaw/core";
6613
6623
 
6614
6624
  // src/cli/commands/remote-access-service-control.ts
6615
- import { getConfigPath as getConfigPath6, loadConfig as loadConfig14 } from "@nextclaw/core";
6625
+ import { getConfigPath as getConfigPath7, loadConfig as loadConfig15 } from "@nextclaw/core";
6616
6626
  import { spawn as spawn2 } from "child_process";
6617
6627
  var FORCED_PUBLIC_UI_HOST = "0.0.0.0";
6618
6628
  function resolveRemoteServiceView(currentUi) {
@@ -6701,7 +6711,7 @@ async function controlManagedService(action, deps) {
6701
6711
  return { accepted: true, action, message: "Managed service restarted." };
6702
6712
  }
6703
6713
  function resolveManagedUiOverrides() {
6704
- const config2 = loadConfig14(getConfigPath6());
6714
+ const config2 = loadConfig15(getConfigPath7());
6705
6715
  const resolved = resolveUiConfig(config2, {
6706
6716
  enabled: true,
6707
6717
  host: FORCED_PUBLIC_UI_HOST,
@@ -6817,7 +6827,7 @@ var RemoteAccessHost = class {
6817
6827
  this.deps = deps;
6818
6828
  }
6819
6829
  getStatus() {
6820
- const config2 = loadConfig15(getConfigPath7());
6830
+ const config2 = loadConfig16(getConfigPath8());
6821
6831
  const status = this.deps.remoteCommands.getStatusView();
6822
6832
  const account = this.readAccountView({
6823
6833
  token: normalizeOptionalString5(config2.providers.nextclaw?.apiKey),
@@ -6854,7 +6864,7 @@ var RemoteAccessHost = class {
6854
6864
  };
6855
6865
  }
6856
6866
  async pollBrowserAuth(input) {
6857
- const config2 = loadConfig15(getConfigPath7());
6867
+ const config2 = loadConfig16(getConfigPath8());
6858
6868
  const result = await this.deps.platformAuthCommands.pollBrowserAuth({
6859
6869
  apiBase: normalizeOptionalString5(input.apiBase) ?? normalizeOptionalString5(config2.remote.platformApiBase) ?? normalizeOptionalString5(config2.providers.nextclaw?.apiBase) ?? void 0,
6860
6870
  sessionId: input.sessionId
@@ -6951,7 +6961,7 @@ function createRemoteAccessHost(params) {
6951
6961
  }
6952
6962
 
6953
6963
  // src/cli/commands/ui-chat-run-coordinator.ts
6954
- import { existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
6964
+ import { existsSync as existsSync10, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
6955
6965
  import { join as join5 } from "path";
6956
6966
  import {
6957
6967
  getDataDir as getDataDir6,
@@ -7506,7 +7516,7 @@ var UiChatRunCoordinator = class {
7506
7516
  `);
7507
7517
  }
7508
7518
  loadPersistedRuns() {
7509
- if (!existsSync9(RUNS_DIR)) {
7519
+ if (!existsSync10(RUNS_DIR)) {
7510
7520
  return;
7511
7521
  }
7512
7522
  for (const entry of readdirSync2(RUNS_DIR, { withFileTypes: true })) {
@@ -7574,14 +7584,14 @@ var {
7574
7584
  ChannelManager: ChannelManager2,
7575
7585
  CronService: CronService2,
7576
7586
  getApiBase,
7577
- getConfigPath: getConfigPath8,
7587
+ getConfigPath: getConfigPath9,
7578
7588
  getDataDir: getDataDir7,
7579
7589
  getProvider,
7580
7590
  getProviderName,
7581
7591
  getWorkspacePath: getWorkspacePath9,
7582
7592
  HeartbeatService,
7583
7593
  LiteLLMProvider,
7584
- loadConfig: loadConfig16,
7594
+ loadConfig: loadConfig17,
7585
7595
  MessageBus,
7586
7596
  ProviderManager,
7587
7597
  resolveConfigSecrets: resolveConfigSecrets3,
@@ -7605,8 +7615,8 @@ var ServiceCommands = class {
7605
7615
  async startGateway(options = {}) {
7606
7616
  this.applyLiveConfigReload = null;
7607
7617
  this.liveUiNcpAgent = null;
7608
- const runtimeConfigPath = getConfigPath8();
7609
- const config2 = resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath });
7618
+ const runtimeConfigPath = getConfigPath9();
7619
+ const config2 = resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath });
7610
7620
  const workspace = getWorkspacePath9(config2.agents.defaults.workspace);
7611
7621
  let pluginRegistry = loadPluginRegistry(config2, workspace);
7612
7622
  let extensionRegistry = toExtensionRegistry(pluginRegistry);
@@ -7624,7 +7634,7 @@ var ServiceCommands = class {
7624
7634
  const uiConfig = resolveUiConfig(config2, options.uiOverrides);
7625
7635
  const uiStaticDir = options.uiStaticDir === void 0 ? resolveUiStaticDir() : options.uiStaticDir;
7626
7636
  const remoteModule = createManagedRemoteModuleForUi({
7627
- loadConfig: () => resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }),
7637
+ loadConfig: () => resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }),
7628
7638
  uiConfig
7629
7639
  });
7630
7640
  if (!provider) {
@@ -7638,7 +7648,7 @@ var ServiceCommands = class {
7638
7648
  sessionManager,
7639
7649
  providerManager,
7640
7650
  makeProvider: (nextConfig) => this.makeProvider(nextConfig, { allowMissing: true }) ?? this.makeMissingProvider(nextConfig),
7641
- loadConfig: () => resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }),
7651
+ loadConfig: () => resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }),
7642
7652
  getExtensionChannels: () => extensionRegistry.channels,
7643
7653
  onRestartRequired: (paths) => {
7644
7654
  void this.deps.requestRestart({
@@ -7649,13 +7659,13 @@ var ServiceCommands = class {
7649
7659
  }
7650
7660
  });
7651
7661
  this.applyLiveConfigReload = async () => {
7652
- await reloader.applyReloadPlan(resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }));
7662
+ await reloader.applyReloadPlan(resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }));
7653
7663
  };
7654
7664
  const gatewayController = new GatewayControllerImpl({
7655
7665
  reloader,
7656
7666
  cron: cron2,
7657
7667
  sessionManager,
7658
- getConfigPath: getConfigPath8,
7668
+ getConfigPath: getConfigPath9,
7659
7669
  saveConfig: saveConfig10,
7660
7670
  requestRestart: async (options2) => {
7661
7671
  await this.deps.requestRestart({
@@ -7682,7 +7692,7 @@ var ServiceCommands = class {
7682
7692
  resolveMessageToolHints: ({ channel, accountId }) => resolvePluginChannelMessageToolHints({
7683
7693
  registry: pluginRegistry,
7684
7694
  channel,
7685
- cfg: resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }),
7695
+ cfg: resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }),
7686
7696
  accountId
7687
7697
  })
7688
7698
  });
@@ -7758,12 +7768,12 @@ var ServiceCommands = class {
7758
7768
  providerManager,
7759
7769
  bus,
7760
7770
  gatewayController,
7761
- () => resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }),
7771
+ () => resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }),
7762
7772
  () => extensionRegistry,
7763
7773
  ({ channel, accountId }) => resolvePluginChannelMessageToolHints({
7764
7774
  registry: pluginRegistry,
7765
7775
  channel,
7766
- cfg: resolveConfigSecrets3(loadConfig16(), { configPath: runtimeConfigPath }),
7776
+ cfg: resolveConfigSecrets3(loadConfig17(), { configPath: runtimeConfigPath }),
7767
7777
  accountId
7768
7778
  }),
7769
7779
  remoteModule
@@ -7801,7 +7811,7 @@ var ServiceCommands = class {
7801
7811
  return trimmed || void 0;
7802
7812
  }
7803
7813
  watchConfigFile(reloader) {
7804
- const configPath = resolve10(getConfigPath8());
7814
+ const configPath = resolve10(getConfigPath9());
7805
7815
  const watcher = chokidar.watch(configPath, {
7806
7816
  ignoreInitial: true,
7807
7817
  awaitWriteFinish: { stabilityThreshold: 200, pollInterval: 50 }
@@ -7922,7 +7932,7 @@ var ServiceCommands = class {
7922
7932
  });
7923
7933
  }
7924
7934
  async runForeground(options) {
7925
- const config2 = loadConfig16();
7935
+ const config2 = loadConfig17();
7926
7936
  const uiConfig = resolveUiConfig(config2, options.uiOverrides);
7927
7937
  const uiUrl = resolveUiApiBase(uiConfig.host, uiConfig.port);
7928
7938
  if (options.open) {
@@ -7935,7 +7945,7 @@ var ServiceCommands = class {
7935
7945
  });
7936
7946
  }
7937
7947
  async startService(options) {
7938
- const config2 = loadConfig16();
7948
+ const config2 = loadConfig17();
7939
7949
  const uiConfig = resolveUiConfig(config2, options.uiOverrides);
7940
7950
  const uiUrl = resolveUiApiBase(uiConfig.host, uiConfig.port);
7941
7951
  const apiUrl = `${uiUrl}/api`;
@@ -8343,7 +8353,7 @@ var ServiceCommands = class {
8343
8353
  return null;
8344
8354
  }
8345
8355
  console.error("Error: No API key configured.");
8346
- console.error(`Set one in ${getConfigPath8()} under providers section`);
8356
+ console.error(`Set one in ${getConfigPath9()} under providers section`);
8347
8357
  process.exit(1);
8348
8358
  }
8349
8359
  return new LiteLLMProvider({
@@ -8473,7 +8483,7 @@ var ServiceCommands = class {
8473
8483
  const uiServer = startUiServer({
8474
8484
  host: uiConfig.host,
8475
8485
  port: uiConfig.port,
8476
- configPath: getConfigPath8(),
8486
+ configPath: getConfigPath9(),
8477
8487
  productVersion: getPackageVersion(),
8478
8488
  staticDir: uiStaticDir ?? void 0,
8479
8489
  cronService,
@@ -8562,10 +8572,10 @@ var ServiceCommands = class {
8562
8572
  }
8563
8573
  }
8564
8574
  installBuiltinMarketplaceSkill(slug, force) {
8565
- const workspace = getWorkspacePath9(loadConfig16().agents.defaults.workspace);
8575
+ const workspace = getWorkspacePath9(loadConfig17().agents.defaults.workspace);
8566
8576
  const destination = join6(workspace, "skills", slug);
8567
8577
  const destinationSkillFile = join6(destination, "SKILL.md");
8568
- if (existsSync10(destinationSkillFile) && !force) {
8578
+ if (existsSync11(destinationSkillFile) && !force) {
8569
8579
  return {
8570
8580
  message: `${slug} is already installed`
8571
8581
  };
@@ -8573,7 +8583,7 @@ var ServiceCommands = class {
8573
8583
  const loader = createSkillsLoader(workspace);
8574
8584
  const builtin = (loader?.listSkills(false) ?? []).find((skill) => skill.name === slug && skill.source === "builtin");
8575
8585
  if (!builtin) {
8576
- if (existsSync10(destinationSkillFile)) {
8586
+ if (existsSync11(destinationSkillFile)) {
8577
8587
  return {
8578
8588
  message: `${slug} is already installed`
8579
8589
  };
@@ -8640,7 +8650,7 @@ ${stderr}`.trim();
8640
8650
  };
8641
8651
 
8642
8652
  // src/cli/workspace.ts
8643
- import { cpSync as cpSync3, existsSync as existsSync11, mkdirSync as mkdirSync6, readFileSync as readFileSync9, readdirSync as readdirSync3, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
8653
+ import { cpSync as cpSync3, existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as readFileSync9, readdirSync as readdirSync3, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
8644
8654
  import { createRequire as createRequire2 } from "module";
8645
8655
  import { dirname as dirname3, join as join7, resolve as resolve11 } from "path";
8646
8656
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -8673,11 +8683,11 @@ var WorkspaceManager = class {
8673
8683
  ];
8674
8684
  for (const entry of templateFiles) {
8675
8685
  const filePath = join7(workspace, entry.target);
8676
- if (!force && existsSync11(filePath)) {
8686
+ if (!force && existsSync12(filePath)) {
8677
8687
  continue;
8678
8688
  }
8679
8689
  const templatePath = join7(templateDir, entry.source);
8680
- if (!existsSync11(templatePath)) {
8690
+ if (!existsSync12(templatePath)) {
8681
8691
  console.warn(`Warning: Template file missing: ${templatePath}`);
8682
8692
  continue;
8683
8693
  }
@@ -8688,12 +8698,12 @@ var WorkspaceManager = class {
8688
8698
  created.push(entry.target);
8689
8699
  }
8690
8700
  const memoryDir = join7(workspace, "memory");
8691
- if (!existsSync11(memoryDir)) {
8701
+ if (!existsSync12(memoryDir)) {
8692
8702
  mkdirSync6(memoryDir, { recursive: true });
8693
8703
  created.push(join7("memory", ""));
8694
8704
  }
8695
8705
  const skillsDir = join7(workspace, "skills");
8696
- if (!existsSync11(skillsDir)) {
8706
+ if (!existsSync12(skillsDir)) {
8697
8707
  mkdirSync6(skillsDir, { recursive: true });
8698
8708
  created.push(join7("skills", ""));
8699
8709
  }
@@ -8715,11 +8725,11 @@ var WorkspaceManager = class {
8715
8725
  continue;
8716
8726
  }
8717
8727
  const src = join7(sourceDir, entry.name);
8718
- if (!existsSync11(join7(src, "SKILL.md"))) {
8728
+ if (!existsSync12(join7(src, "SKILL.md"))) {
8719
8729
  continue;
8720
8730
  }
8721
8731
  const dest = join7(targetDir, entry.name);
8722
- if (!force && existsSync11(dest)) {
8732
+ if (!force && existsSync12(dest)) {
8723
8733
  continue;
8724
8734
  }
8725
8735
  try {
@@ -8738,11 +8748,11 @@ var WorkspaceManager = class {
8738
8748
  const entry = require3.resolve("@nextclaw/core");
8739
8749
  const pkgRoot = resolve11(dirname3(entry), "..");
8740
8750
  const distSkills = join7(pkgRoot, "dist", "skills");
8741
- if (existsSync11(distSkills)) {
8751
+ if (existsSync12(distSkills)) {
8742
8752
  return distSkills;
8743
8753
  }
8744
8754
  const srcSkills = join7(pkgRoot, "src", "agent", "skills");
8745
- if (existsSync11(srcSkills)) {
8755
+ if (existsSync12(srcSkills)) {
8746
8756
  return srcSkills;
8747
8757
  }
8748
8758
  return null;
@@ -8759,7 +8769,7 @@ var WorkspaceManager = class {
8759
8769
  const pkgRoot = resolve11(cliDir, "..", "..");
8760
8770
  const candidates = [join7(pkgRoot, "templates")];
8761
8771
  for (const candidate of candidates) {
8762
- if (existsSync11(candidate)) {
8772
+ if (existsSync12(candidate)) {
8763
8773
  return candidate;
8764
8774
  }
8765
8775
  }
@@ -8767,7 +8777,7 @@ var WorkspaceManager = class {
8767
8777
  }
8768
8778
  getBridgeDir() {
8769
8779
  const userBridge = join7(getDataDir8(), "bridge");
8770
- if (existsSync11(join7(userBridge, "dist", "index.js"))) {
8780
+ if (existsSync12(join7(userBridge, "dist", "index.js"))) {
8771
8781
  return userBridge;
8772
8782
  }
8773
8783
  if (!which("npm")) {
@@ -8779,9 +8789,9 @@ var WorkspaceManager = class {
8779
8789
  const pkgBridge = join7(pkgRoot, "bridge");
8780
8790
  const srcBridge = join7(pkgRoot, "..", "..", "bridge");
8781
8791
  let source = null;
8782
- if (existsSync11(join7(pkgBridge, "package.json"))) {
8792
+ if (existsSync12(join7(pkgBridge, "package.json"))) {
8783
8793
  source = pkgBridge;
8784
- } else if (existsSync11(join7(srcBridge, "package.json"))) {
8794
+ } else if (existsSync12(join7(srcBridge, "package.json"))) {
8785
8795
  source = srcBridge;
8786
8796
  }
8787
8797
  if (!source) {
@@ -8790,7 +8800,7 @@ var WorkspaceManager = class {
8790
8800
  }
8791
8801
  console.log(`${this.logo} Setting up bridge...`);
8792
8802
  mkdirSync6(resolve11(userBridge, ".."), { recursive: true });
8793
- if (existsSync11(userBridge)) {
8803
+ if (existsSync12(userBridge)) {
8794
8804
  rmSync5(userBridge, { recursive: true, force: true });
8795
8805
  }
8796
8806
  cpSync3(source, userBridge, {
@@ -9067,17 +9077,12 @@ var CliRuntime = class {
9067
9077
  const source = options.source ?? "init";
9068
9078
  const prefix = options.auto ? "Auto init" : "Init";
9069
9079
  const force = Boolean(options.force);
9070
- const configPath = getConfigPath9();
9071
- let createdConfig = false;
9072
- if (!existsSync12(configPath)) {
9073
- const config3 = ConfigSchema2.parse({});
9074
- saveConfig11(config3);
9075
- createdConfig = true;
9076
- }
9077
- const config2 = loadConfig17();
9080
+ const configPath = getConfigPath10();
9081
+ const createdConfig = initializeConfigIfMissing(configPath);
9082
+ const config2 = loadConfig18();
9078
9083
  const workspaceSetting = config2.agents.defaults.workspace;
9079
9084
  const workspacePath = !workspaceSetting || workspaceSetting === DEFAULT_WORKSPACE_PATH ? join8(getDataDir9(), DEFAULT_WORKSPACE_DIR) : expandHome2(workspaceSetting);
9080
- const workspaceExisted = existsSync12(workspacePath);
9085
+ const workspaceExisted = existsSync13(workspacePath);
9081
9086
  mkdirSync7(workspacePath, { recursive: true });
9082
9087
  const templateResult = this.workspaceManager.createWorkspaceTemplates(
9083
9088
  workspacePath,
@@ -9200,8 +9205,8 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9200
9205
  await this.serviceCommands.stopService();
9201
9206
  }
9202
9207
  async agent(opts) {
9203
- const configPath = getConfigPath9();
9204
- const config2 = resolveConfigSecrets4(loadConfig17(), { configPath });
9208
+ const configPath = getConfigPath10();
9209
+ const config2 = resolveConfigSecrets4(loadConfig18(), { configPath });
9205
9210
  const workspace = getWorkspacePath10(config2.agents.defaults.workspace);
9206
9211
  const pluginRegistry = loadPluginRegistry(config2, workspace);
9207
9212
  const extensionRegistry = toExtensionRegistry(pluginRegistry);
@@ -9209,7 +9214,7 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9209
9214
  const pluginChannelBindings = getPluginChannelBindings4(pluginRegistry);
9210
9215
  setPluginRuntimeBridge3({
9211
9216
  loadConfig: () => toPluginConfigView(
9212
- resolveConfigSecrets4(loadConfig17(), { configPath }),
9217
+ resolveConfigSecrets4(loadConfig18(), { configPath }),
9213
9218
  pluginChannelBindings
9214
9219
  ),
9215
9220
  writeConfigFile: async (nextConfigView) => {
@@ -9218,7 +9223,7 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9218
9223
  "plugin runtime writeConfigFile expects an object config"
9219
9224
  );
9220
9225
  }
9221
- const current = loadConfig17();
9226
+ const current = loadConfig18();
9222
9227
  const next = mergePluginConfigView(
9223
9228
  current,
9224
9229
  nextConfigView,
@@ -9250,7 +9255,7 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9250
9255
  resolveMessageToolHints: ({ channel, accountId }) => resolvePluginChannelMessageToolHints2({
9251
9256
  registry: pluginRegistry,
9252
9257
  channel,
9253
- cfg: resolveConfigSecrets4(loadConfig17(), { configPath }),
9258
+ cfg: resolveConfigSecrets4(loadConfig18(), { configPath }),
9254
9259
  accountId
9255
9260
  })
9256
9261
  });
@@ -9272,7 +9277,7 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9272
9277
  const historyFile = join8(getDataDir9(), "history", "cli_history");
9273
9278
  const historyDir = resolve12(historyFile, "..");
9274
9279
  mkdirSync7(historyDir, { recursive: true });
9275
- const history = existsSync12(historyFile) ? readFileSync10(historyFile, "utf-8").split("\n").filter(Boolean) : [];
9280
+ const history = existsSync13(historyFile) ? readFileSync10(historyFile, "utf-8").split("\n").filter(Boolean) : [];
9276
9281
  const rl = createInterface3({
9277
9282
  input: process.stdin,
9278
9283
  output: process.stdout
@@ -9445,7 +9450,7 @@ ${this.logo} ${APP_NAME5} is ready! (${source})`);
9445
9450
  await this.diagnosticsCommands.doctor(opts);
9446
9451
  }
9447
9452
  async skillsInstall(options) {
9448
- const config2 = loadConfig17();
9453
+ const config2 = loadConfig18();
9449
9454
  const workdir = resolveSkillsInstallWorkdir({
9450
9455
  explicitWorkdir: options.workdir,
9451
9456
  configuredWorkspace: config2.agents.defaults.workspace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.13.20",
3
+ "version": "0.13.22",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -39,15 +39,15 @@
39
39
  "chokidar": "^3.6.0",
40
40
  "commander": "^12.1.0",
41
41
  "yaml": "^2.8.1",
42
- "@nextclaw/core": "0.9.6",
43
- "@nextclaw/mcp": "0.1.16",
44
- "@nextclaw/ncp-toolkit": "0.4.1",
42
+ "@nextclaw/core": "0.9.7",
43
+ "@nextclaw/mcp": "0.1.18",
45
44
  "@nextclaw/ncp": "0.3.1",
46
- "@nextclaw/ncp-mcp": "0.1.16",
47
- "@nextclaw/runtime": "0.2.6",
48
- "@nextclaw/remote": "0.1.12",
49
- "@nextclaw/server": "0.10.16",
50
- "@nextclaw/openclaw-compat": "0.3.9",
45
+ "@nextclaw/ncp-mcp": "0.1.18",
46
+ "@nextclaw/ncp-toolkit": "0.4.1",
47
+ "@nextclaw/remote": "0.1.14",
48
+ "@nextclaw/runtime": "0.2.7",
49
+ "@nextclaw/server": "0.10.18",
50
+ "@nextclaw/openclaw-compat": "0.3.10",
51
51
  "@nextclaw/ncp-agent-runtime": "0.2.1"
52
52
  },
53
53
  "devDependencies": {