@nextclaw/server 0.10.56 → 0.10.57

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/index.d.ts CHANGED
@@ -350,6 +350,7 @@ type UiRouterOptions = {
350
350
  configPath: string;
351
351
  productVersion?: string;
352
352
  publish: (event: UiServerEvent) => void;
353
+ applyLiveConfigReload?: () => Promise<void>;
353
354
  marketplace?: MarketplaceApiConfig;
354
355
  cronService?: InstanceType<typeof NextclawCore.CronService>;
355
356
  chatRuntime?: UiChatRuntime;
@@ -1192,7 +1193,10 @@ type UiServerHandle = {
1192
1193
  publish: (event: UiServerEvent) => void;
1193
1194
  };
1194
1195
 
1195
- declare function startUiServer(options: UiServerOptions): UiServerHandle;
1196
+ type UiServerStartOptions = UiServerOptions & {
1197
+ applyLiveConfigReload?: () => Promise<void>;
1198
+ };
1199
+ declare function startUiServer(options: UiServerStartOptions): UiServerHandle;
1196
1200
 
1197
1201
  declare function createUiRouter(options: UiRouterOptions): Hono;
1198
1202
 
package/dist/index.js CHANGED
@@ -3241,6 +3241,12 @@ var ConfigRoutesController = class {
3241
3241
  pluginUiMetadata: this.options.getPluginUiMetadata?.() ?? []
3242
3242
  };
3243
3243
  }
3244
+ async publishConfigUpdates(paths) {
3245
+ for (const path of paths) {
3246
+ this.options.publish({ type: "config.updated", payload: { path } });
3247
+ }
3248
+ await this.options.applyLiveConfigReload?.();
3249
+ }
3244
3250
  getConfig = (c) => {
3245
3251
  const config = loadConfigOrDefault(this.options.configPath);
3246
3252
  return c.json(ok(buildConfigView(config, this.getPluginConfigOptions())));
@@ -3266,12 +3272,14 @@ var ConfigRoutesController = class {
3266
3272
  model: body.data.model,
3267
3273
  workspace: body.data.workspace
3268
3274
  });
3275
+ const changedPaths = [];
3269
3276
  if (hasModel) {
3270
- this.options.publish({ type: "config.updated", payload: { path: "agents.defaults.model" } });
3277
+ changedPaths.push("agents.defaults.model");
3271
3278
  }
3272
3279
  if (typeof body.data.workspace === "string") {
3273
- this.options.publish({ type: "config.updated", payload: { path: "agents.defaults.workspace" } });
3280
+ changedPaths.push("agents.defaults.workspace");
3274
3281
  }
3282
+ await this.publishConfigUpdates(changedPaths);
3275
3283
  return c.json(ok({
3276
3284
  model: view.agents.defaults.model,
3277
3285
  workspace: view.agents.defaults.workspace
@@ -3283,7 +3291,7 @@ var ConfigRoutesController = class {
3283
3291
  return c.json(err("INVALID_BODY", "invalid json body"), 400);
3284
3292
  }
3285
3293
  const result = updateSearch(this.options.configPath, body.data);
3286
- this.options.publish({ type: "config.updated", payload: { path: "search" } });
3294
+ await this.publishConfigUpdates(["search"]);
3287
3295
  return c.json(ok(result));
3288
3296
  };
3289
3297
  updateProvider = async (c) => {
@@ -3296,7 +3304,7 @@ var ConfigRoutesController = class {
3296
3304
  if (!result) {
3297
3305
  return c.json(err("NOT_FOUND", `unknown provider: ${provider}`), 404);
3298
3306
  }
3299
- this.options.publish({ type: "config.updated", payload: { path: `providers.${provider}` } });
3307
+ await this.publishConfigUpdates([`providers.${provider}`]);
3300
3308
  return c.json(ok(result));
3301
3309
  };
3302
3310
  createProvider = async (c) => {
@@ -3308,7 +3316,7 @@ var ConfigRoutesController = class {
3308
3316
  this.options.configPath,
3309
3317
  body.data
3310
3318
  );
3311
- this.options.publish({ type: "config.updated", payload: { path: `providers.${result.name}` } });
3319
+ await this.publishConfigUpdates([`providers.${result.name}`]);
3312
3320
  return c.json(ok({
3313
3321
  name: result.name,
3314
3322
  provider: result.provider
@@ -3320,7 +3328,7 @@ var ConfigRoutesController = class {
3320
3328
  if (result === null) {
3321
3329
  return c.json(err("NOT_FOUND", `custom provider not found: ${provider}`), 404);
3322
3330
  }
3323
- this.options.publish({ type: "config.updated", payload: { path: `providers.${provider}` } });
3331
+ await this.publishConfigUpdates([`providers.${provider}`]);
3324
3332
  return c.json(ok({
3325
3333
  deleted: true,
3326
3334
  provider
@@ -3386,7 +3394,7 @@ var ConfigRoutesController = class {
3386
3394
  return c.json(err("NOT_FOUND", "provider auth session not found"), 404);
3387
3395
  }
3388
3396
  if (result.status === "authorized") {
3389
- this.options.publish({ type: "config.updated", payload: { path: `providers.${provider}` } });
3397
+ await this.publishConfigUpdates([`providers.${provider}`]);
3390
3398
  }
3391
3399
  return c.json(ok(result));
3392
3400
  };
@@ -3397,7 +3405,7 @@ var ConfigRoutesController = class {
3397
3405
  if (!result) {
3398
3406
  return c.json(err("NOT_SUPPORTED", `provider cli auth import is not supported: ${provider}`), 404);
3399
3407
  }
3400
- this.options.publish({ type: "config.updated", payload: { path: `providers.${provider}` } });
3408
+ await this.publishConfigUpdates([`providers.${provider}`]);
3401
3409
  return c.json(ok(result));
3402
3410
  } catch (error) {
3403
3411
  const message = error instanceof Error ? error.message : String(error);
@@ -3414,7 +3422,7 @@ var ConfigRoutesController = class {
3414
3422
  if (!result) {
3415
3423
  return c.json(err("NOT_FOUND", `unknown channel: ${channel}`), 404);
3416
3424
  }
3417
- this.options.publish({ type: "config.updated", payload: { path: `channels.${channel}` } });
3425
+ await this.publishConfigUpdates([`channels.${channel}`]);
3418
3426
  return c.json(ok(result));
3419
3427
  };
3420
3428
  startChannelAuth = async (c) => {
@@ -3467,7 +3475,7 @@ var ConfigRoutesController = class {
3467
3475
  return c.json(err("NOT_FOUND", "channel auth session not found"), 404);
3468
3476
  }
3469
3477
  if (result.status === "authorized") {
3470
- this.options.publish({ type: "config.updated", payload: { path: `channels.${channel}` } });
3478
+ await this.publishConfigUpdates([`channels.${channel}`]);
3471
3479
  }
3472
3480
  return c.json(ok(result));
3473
3481
  };
@@ -3477,7 +3485,7 @@ var ConfigRoutesController = class {
3477
3485
  return c.json(err("INVALID_BODY", "invalid json body"), 400);
3478
3486
  }
3479
3487
  const result = updateSecrets(this.options.configPath, body.data);
3480
- this.options.publish({ type: "config.updated", payload: { path: "secrets" } });
3488
+ await this.publishConfigUpdates(["secrets"]);
3481
3489
  return c.json(ok(result));
3482
3490
  };
3483
3491
  updateRuntime = async (c) => {
@@ -3486,18 +3494,18 @@ var ConfigRoutesController = class {
3486
3494
  return c.json(err("INVALID_BODY", "invalid json body"), 400);
3487
3495
  }
3488
3496
  const result = updateRuntime(this.options.configPath, body.data);
3497
+ const changedPaths = [];
3489
3498
  if (body.data.agents?.defaults && Object.prototype.hasOwnProperty.call(body.data.agents.defaults, "contextTokens")) {
3490
- this.options.publish({ type: "config.updated", payload: { path: "agents.defaults.contextTokens" } });
3499
+ changedPaths.push("agents.defaults.contextTokens");
3491
3500
  }
3492
3501
  if (body.data.agents?.defaults && Object.prototype.hasOwnProperty.call(body.data.agents.defaults, "engine")) {
3493
- this.options.publish({ type: "config.updated", payload: { path: "agents.defaults.engine" } });
3502
+ changedPaths.push("agents.defaults.engine");
3494
3503
  }
3495
3504
  if (body.data.agents?.defaults && Object.prototype.hasOwnProperty.call(body.data.agents.defaults, "engineConfig")) {
3496
- this.options.publish({ type: "config.updated", payload: { path: "agents.defaults.engineConfig" } });
3505
+ changedPaths.push("agents.defaults.engineConfig");
3497
3506
  }
3498
- this.options.publish({ type: "config.updated", payload: { path: "agents.list" } });
3499
- this.options.publish({ type: "config.updated", payload: { path: "bindings" } });
3500
- this.options.publish({ type: "config.updated", payload: { path: "session" } });
3507
+ changedPaths.push("agents.list", "bindings", "session");
3508
+ await this.publishConfigUpdates(changedPaths);
3501
3509
  return c.json(ok(result));
3502
3510
  };
3503
3511
  executeAction = async (c) => {
@@ -5649,6 +5657,7 @@ function startUiServer(options) {
5649
5657
  configPath: options.configPath,
5650
5658
  productVersion: options.productVersion,
5651
5659
  publish,
5660
+ applyLiveConfigReload: options.applyLiveConfigReload,
5652
5661
  marketplace: options.marketplace,
5653
5662
  cronService: options.cronService,
5654
5663
  chatRuntime: options.chatRuntime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.10.56",
3
+ "version": "0.10.57",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -18,12 +18,12 @@
18
18
  "@hono/node-server": "^1.13.3",
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
- "@nextclaw/mcp": "0.1.50",
22
- "@nextclaw/ncp-http-agent-server": "0.3.2",
23
- "@nextclaw/ncp": "0.3.2",
24
- "@nextclaw/openclaw-compat": "0.3.32",
25
- "@nextclaw/core": "0.11.1",
26
- "@nextclaw/runtime": "0.2.15"
21
+ "@nextclaw/mcp": "0.1.51",
22
+ "@nextclaw/ncp-http-agent-server": "0.3.3",
23
+ "@nextclaw/ncp": "0.3.3",
24
+ "@nextclaw/runtime": "0.2.16",
25
+ "@nextclaw/core": "0.11.2",
26
+ "@nextclaw/openclaw-compat": "0.3.33"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.17.6",