@nextclaw/server 0.10.56 → 0.11.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/index.d.ts CHANGED
@@ -6,27 +6,27 @@ import { NcpHttpAgentStreamProvider } from '@nextclaw/ncp-http-agent-server';
6
6
  import { IncomingMessage } from 'node:http';
7
7
  import { Hono } from 'hono';
8
8
 
9
- type UiNcpStoredAttachmentRecord = {
9
+ type UiNcpStoredAssetRecord = {
10
10
  id: string;
11
11
  uri: string;
12
12
  storageKey: string;
13
- originalName: string;
13
+ fileName: string;
14
14
  storedName: string;
15
15
  mimeType: string;
16
16
  sizeBytes: number;
17
17
  createdAt: string;
18
18
  sha256: string;
19
19
  };
20
- type UiNcpAttachmentView = {
20
+ type UiNcpAssetView = {
21
21
  id: string;
22
22
  name: string;
23
23
  mimeType: string;
24
24
  sizeBytes: number;
25
- attachmentUri: string;
25
+ assetUri: string;
26
26
  url: string;
27
27
  };
28
- type UiNcpAttachmentUploadView = {
29
- attachments: UiNcpAttachmentView[];
28
+ type UiNcpAssetPutView = {
29
+ assets: UiNcpAssetView[];
30
30
  };
31
31
 
32
32
  type MarketplaceItemType = "plugin" | "skill" | "mcp";
@@ -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;
@@ -965,14 +966,14 @@ type UiNcpAgent = {
965
966
  streamProvider?: NcpHttpAgentStreamProvider;
966
967
  sessionApi?: NcpSessionApi;
967
968
  listSessionTypes?: (params?: SessionTypeDescribeParams) => Promise<ChatSessionTypesView> | ChatSessionTypesView;
968
- attachmentApi?: {
969
- saveAttachment: (input: {
969
+ assetApi?: {
970
+ put: (input: {
970
971
  fileName: string;
971
972
  mimeType?: string | null;
972
973
  bytes: Uint8Array;
973
974
  createdAt?: Date;
974
- }) => Promise<UiNcpStoredAttachmentRecord>;
975
- statAttachment: (uri: string) => Promise<UiNcpStoredAttachmentRecord | null> | UiNcpStoredAttachmentRecord | null;
975
+ }) => Promise<UiNcpStoredAssetRecord>;
976
+ stat: (uri: string) => Promise<UiNcpStoredAssetRecord | null> | UiNcpStoredAssetRecord | null;
976
977
  resolveContentPath: (uri: string) => string | null;
977
978
  };
978
979
  basePath?: string;
@@ -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
 
@@ -1250,4 +1254,4 @@ declare function getUiBridgeSecretPath(): string;
1250
1254
  declare function readUiBridgeSecret(): string | null;
1251
1255
  declare function ensureUiBridgeSecret(): string;
1252
1256
 
1253
- export { type AgentBindingView, type AgentProfileView, type ApiError, type ApiResponse, type AppMetaView, type AuthEnabledUpdateRequest, type AuthLoginRequest, type AuthPasswordUpdateRequest, type AuthSetupRequest, type AuthStatusView, type BindingPeerView, type BochaFreshnessValue, type ChannelAuthPollRequest, type ChannelAuthPollResult, type ChannelAuthStartRequest, type ChannelAuthStartResult, type ChannelSpecView, type ChatCapabilitiesView, type ChatCommandOptionView, type ChatCommandView, type ChatCommandsView, type ChatRunListView, type ChatRunState, type ChatRunView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, type ChatTurnRequest, type ChatTurnResult, type ChatTurnStopRequest, type ChatTurnStopResult, type ChatTurnStreamEvent, type ChatTurnView, type ConfigActionExecuteRequest, type ConfigActionExecuteResult, type ConfigActionManifest, type ConfigActionType, type ConfigMetaView, type ConfigSchemaResponse, type ConfigUiHint, type ConfigUiHints, type ConfigView, type CronActionResult, type CronEnableRequest, type CronJobStateView, type CronJobView, type CronListView, type CronPayloadView, type CronRunRequest, type CronScheduleView, DEFAULT_SESSION_TYPE, type MarketplaceApiConfig, type MarketplaceInstallKind, type MarketplaceInstallSkillParams, type MarketplaceInstallSpec, type MarketplaceInstalledRecord, type MarketplaceInstalledView, type MarketplaceInstaller, type MarketplaceItemSummary, type MarketplaceItemType, type MarketplaceItemView, type MarketplaceListView, type MarketplaceLocalizedTextMap, type MarketplaceMcpContentView, type MarketplaceMcpDoctorResult, type MarketplaceMcpInstallKind, type MarketplaceMcpInstallRequest, type MarketplaceMcpInstallResult, type MarketplaceMcpInstallSpec, type MarketplaceMcpManageAction, type MarketplaceMcpManageRequest, type MarketplaceMcpManageResult, type MarketplaceMcpTemplateInput, type MarketplacePluginContentView, type MarketplacePluginInstallKind, type MarketplacePluginInstallRequest, type MarketplacePluginInstallResult, type MarketplacePluginManageAction, type MarketplacePluginManageRequest, type MarketplacePluginManageResult, type MarketplaceRecommendationView, type MarketplaceSkillContentView, type MarketplaceSkillInstallKind, type MarketplaceSkillInstallRequest, type MarketplaceSkillInstallResult, type MarketplaceSkillManageAction, type MarketplaceSkillManageRequest, type MarketplaceSkillManageResult, type MarketplaceSort, type ProviderAuthImportResult, type ProviderAuthPollRequest, type ProviderAuthPollResult, type ProviderAuthStartRequest, type ProviderAuthStartResult, type ProviderConfigUpdate, type ProviderConfigView, type ProviderConnectionTestRequest, type ProviderConnectionTestResult, type ProviderCreateRequest, type ProviderCreateResult, type ProviderDeleteResult, type ProviderSpecView, type RemoteAccessView, type RemoteAccountView, type RemoteBrowserAuthPollRequest, type RemoteBrowserAuthPollResult, type RemoteBrowserAuthStartRequest, type RemoteBrowserAuthStartResult, type RemoteDoctorCheckView, type RemoteDoctorView, type RemoteLoginRequest, type RemoteRuntimeView, type RemoteServiceAction, type RemoteServiceActionResult, type RemoteServiceView, type RemoteSettingsUpdateRequest, type RemoteSettingsView, type RuntimeConfigUpdate, type SearchConfigUpdate, type SearchConfigView, type SearchProviderConfigView, type SearchProviderName, type SearchProviderSpecView, type SecretProviderEnvView, type SecretProviderExecView, type SecretProviderFileView, type SecretProviderView, type SecretRefView, type SecretSourceView, type SecretsConfigUpdate, type SecretsView, type SessionConfigView, type SessionEntryView, type SessionEventView, type SessionHistoryView, type SessionMessageView, type SessionPatchUpdate, SessionPatchValidationError, type SessionTypeDescribeParams, type SessionsListView, type UiChatRuntime, type UiNcpAgent, type UiNcpAttachmentUploadView, type UiNcpAttachmentView, type UiNcpSessionListView, type UiNcpSessionMessagesView, type UiNcpStoredAttachmentRecord, type UiRemoteAccessHost, type UiServerEvent, type UiServerHandle, type UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, deleteSession, ensureUiBridgeSecret, executeConfigAction, getSessionHistory, getUiBridgeSecretPath, listSessions, loadConfigOrDefault, patchSession, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
1257
+ export { type AgentBindingView, type AgentProfileView, type ApiError, type ApiResponse, type AppMetaView, type AuthEnabledUpdateRequest, type AuthLoginRequest, type AuthPasswordUpdateRequest, type AuthSetupRequest, type AuthStatusView, type BindingPeerView, type BochaFreshnessValue, type ChannelAuthPollRequest, type ChannelAuthPollResult, type ChannelAuthStartRequest, type ChannelAuthStartResult, type ChannelSpecView, type ChatCapabilitiesView, type ChatCommandOptionView, type ChatCommandView, type ChatCommandsView, type ChatRunListView, type ChatRunState, type ChatRunView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, type ChatTurnRequest, type ChatTurnResult, type ChatTurnStopRequest, type ChatTurnStopResult, type ChatTurnStreamEvent, type ChatTurnView, type ConfigActionExecuteRequest, type ConfigActionExecuteResult, type ConfigActionManifest, type ConfigActionType, type ConfigMetaView, type ConfigSchemaResponse, type ConfigUiHint, type ConfigUiHints, type ConfigView, type CronActionResult, type CronEnableRequest, type CronJobStateView, type CronJobView, type CronListView, type CronPayloadView, type CronRunRequest, type CronScheduleView, DEFAULT_SESSION_TYPE, type MarketplaceApiConfig, type MarketplaceInstallKind, type MarketplaceInstallSkillParams, type MarketplaceInstallSpec, type MarketplaceInstalledRecord, type MarketplaceInstalledView, type MarketplaceInstaller, type MarketplaceItemSummary, type MarketplaceItemType, type MarketplaceItemView, type MarketplaceListView, type MarketplaceLocalizedTextMap, type MarketplaceMcpContentView, type MarketplaceMcpDoctorResult, type MarketplaceMcpInstallKind, type MarketplaceMcpInstallRequest, type MarketplaceMcpInstallResult, type MarketplaceMcpInstallSpec, type MarketplaceMcpManageAction, type MarketplaceMcpManageRequest, type MarketplaceMcpManageResult, type MarketplaceMcpTemplateInput, type MarketplacePluginContentView, type MarketplacePluginInstallKind, type MarketplacePluginInstallRequest, type MarketplacePluginInstallResult, type MarketplacePluginManageAction, type MarketplacePluginManageRequest, type MarketplacePluginManageResult, type MarketplaceRecommendationView, type MarketplaceSkillContentView, type MarketplaceSkillInstallKind, type MarketplaceSkillInstallRequest, type MarketplaceSkillInstallResult, type MarketplaceSkillManageAction, type MarketplaceSkillManageRequest, type MarketplaceSkillManageResult, type MarketplaceSort, type ProviderAuthImportResult, type ProviderAuthPollRequest, type ProviderAuthPollResult, type ProviderAuthStartRequest, type ProviderAuthStartResult, type ProviderConfigUpdate, type ProviderConfigView, type ProviderConnectionTestRequest, type ProviderConnectionTestResult, type ProviderCreateRequest, type ProviderCreateResult, type ProviderDeleteResult, type ProviderSpecView, type RemoteAccessView, type RemoteAccountView, type RemoteBrowserAuthPollRequest, type RemoteBrowserAuthPollResult, type RemoteBrowserAuthStartRequest, type RemoteBrowserAuthStartResult, type RemoteDoctorCheckView, type RemoteDoctorView, type RemoteLoginRequest, type RemoteRuntimeView, type RemoteServiceAction, type RemoteServiceActionResult, type RemoteServiceView, type RemoteSettingsUpdateRequest, type RemoteSettingsView, type RuntimeConfigUpdate, type SearchConfigUpdate, type SearchConfigView, type SearchProviderConfigView, type SearchProviderName, type SearchProviderSpecView, type SecretProviderEnvView, type SecretProviderExecView, type SecretProviderFileView, type SecretProviderView, type SecretRefView, type SecretSourceView, type SecretsConfigUpdate, type SecretsView, type SessionConfigView, type SessionEntryView, type SessionEventView, type SessionHistoryView, type SessionMessageView, type SessionPatchUpdate, SessionPatchValidationError, type SessionTypeDescribeParams, type SessionsListView, type UiChatRuntime, type UiNcpAgent, type UiNcpAssetPutView, type UiNcpAssetView, type UiNcpSessionListView, type UiNcpSessionMessagesView, type UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiServerEvent, type UiServerHandle, type UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, deleteSession, ensureUiBridgeSecret, executeConfigAction, getSessionHistory, getUiBridgeSecretPath, listSessions, loadConfigOrDefault, patchSession, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
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) => {
@@ -3615,32 +3623,32 @@ var CronRoutesController = class {
3615
3623
 
3616
3624
  // src/ui/router/ncp-attachment.controller.ts
3617
3625
  import { readFile as readFile2 } from "fs/promises";
3618
- var ATTACHMENT_CONTENT_BASE_PATH = "/api/ncp/attachments/content";
3619
- function buildAttachmentContentUrl(attachmentUri) {
3620
- const query = new URLSearchParams({ uri: attachmentUri });
3621
- return `${ATTACHMENT_CONTENT_BASE_PATH}?${query.toString()}`;
3626
+ var ASSET_CONTENT_BASE_PATH = "/api/ncp/assets/content";
3627
+ function buildAssetContentUrl(assetUri) {
3628
+ const query = new URLSearchParams({ uri: assetUri });
3629
+ return `${ASSET_CONTENT_BASE_PATH}?${query.toString()}`;
3622
3630
  }
3623
3631
  function encodeContentDispositionFileName(fileName) {
3624
3632
  return encodeURIComponent(fileName).replace(/\*/g, "%2A");
3625
3633
  }
3626
- function toAttachmentView(record) {
3634
+ function toAssetView(record) {
3627
3635
  return {
3628
3636
  id: record.id,
3629
- name: record.originalName,
3637
+ name: record.fileName,
3630
3638
  mimeType: record.mimeType,
3631
3639
  sizeBytes: record.sizeBytes,
3632
- attachmentUri: record.uri,
3633
- url: buildAttachmentContentUrl(record.uri)
3640
+ assetUri: record.uri,
3641
+ url: buildAssetContentUrl(record.uri)
3634
3642
  };
3635
3643
  }
3636
- var NcpAttachmentRoutesController = class {
3644
+ var NcpAssetRoutesController = class {
3637
3645
  constructor(options) {
3638
3646
  this.options = options;
3639
3647
  }
3640
- uploadAttachments = async (c) => {
3641
- const attachmentApi = this.options.ncpAgent?.attachmentApi;
3642
- if (!attachmentApi) {
3643
- return c.json(err("NOT_AVAILABLE", "ncp attachment api unavailable"), 503);
3648
+ putAssets = async (c) => {
3649
+ const assetApi = this.options.ncpAgent?.assetApi;
3650
+ if (!assetApi) {
3651
+ return c.json(err("NOT_AVAILABLE", "ncp asset api unavailable"), 503);
3644
3652
  }
3645
3653
  let formData;
3646
3654
  try {
@@ -3657,38 +3665,38 @@ var NcpAttachmentRoutesController = class {
3657
3665
  if (files.length === 0) {
3658
3666
  return c.json(err("INVALID_BODY", "no files provided"), 400);
3659
3667
  }
3660
- const attachments = [];
3668
+ const assets = [];
3661
3669
  for (const file of files) {
3662
- const record = await attachmentApi.saveAttachment({
3670
+ const record = await assetApi.put({
3663
3671
  fileName: file.name,
3664
3672
  mimeType: file.type || null,
3665
3673
  bytes: new Uint8Array(await file.arrayBuffer())
3666
3674
  });
3667
- attachments.push(toAttachmentView(record));
3675
+ assets.push(toAssetView(record));
3668
3676
  }
3669
- const payload = { attachments };
3677
+ const payload = { assets };
3670
3678
  return c.json(ok(payload));
3671
3679
  };
3672
- getAttachmentContent = async (c) => {
3673
- const attachmentApi = this.options.ncpAgent?.attachmentApi;
3674
- if (!attachmentApi) {
3675
- return c.json(err("NOT_AVAILABLE", "ncp attachment api unavailable"), 503);
3680
+ getAssetContent = async (c) => {
3681
+ const assetApi = this.options.ncpAgent?.assetApi;
3682
+ if (!assetApi) {
3683
+ return c.json(err("NOT_AVAILABLE", "ncp asset api unavailable"), 503);
3676
3684
  }
3677
3685
  const uri = c.req.query("uri")?.trim();
3678
3686
  if (!uri) {
3679
- return c.json(err("INVALID_URI", "attachment uri is required"), 400);
3687
+ return c.json(err("INVALID_URI", "asset uri is required"), 400);
3680
3688
  }
3681
- const record = await attachmentApi.statAttachment(uri);
3682
- const contentPath = attachmentApi.resolveContentPath(uri);
3689
+ const record = await assetApi.stat(uri);
3690
+ const contentPath = assetApi.resolveContentPath(uri);
3683
3691
  if (!record || !contentPath) {
3684
- return c.json(err("NOT_FOUND", `attachment not found: ${uri}`), 404);
3692
+ return c.json(err("NOT_FOUND", `asset not found: ${uri}`), 404);
3685
3693
  }
3686
3694
  const body = await readFile2(contentPath);
3687
3695
  return new Response(body, {
3688
3696
  headers: {
3689
3697
  "content-length": String(body.byteLength),
3690
3698
  "content-type": record.mimeType || "application/octet-stream",
3691
- "content-disposition": `inline; filename*=UTF-8''${encodeContentDispositionFileName(record.originalName)}`
3699
+ "content-disposition": `inline; filename*=UTF-8''${encodeContentDispositionFileName(record.fileName)}`
3692
3700
  }
3693
3701
  });
3694
3702
  };
@@ -5470,7 +5478,7 @@ function registerSessionRoutes(app, sessionController) {
5470
5478
  app.put("/api/sessions/:key", sessionController.patchSession);
5471
5479
  app.delete("/api/sessions/:key", sessionController.deleteSession);
5472
5480
  }
5473
- function registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentController) {
5481
+ function registerNcpRoutes(app, options, ncpSessionController, ncpAssetController) {
5474
5482
  if (!options.ncpAgent) {
5475
5483
  return;
5476
5484
  }
@@ -5485,8 +5493,8 @@ function registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentCont
5485
5493
  app.put("/api/ncp/sessions/:sessionId", ncpSessionController.patchSession);
5486
5494
  app.get("/api/ncp/sessions/:sessionId/messages", ncpSessionController.listSessionMessages);
5487
5495
  app.delete("/api/ncp/sessions/:sessionId", ncpSessionController.deleteSession);
5488
- app.post("/api/ncp/attachments", ncpAttachmentController.uploadAttachments);
5489
- app.get("/api/ncp/attachments/content", ncpAttachmentController.getAttachmentContent);
5496
+ app.post("/api/ncp/assets", ncpAssetController.putAssets);
5497
+ app.get("/api/ncp/assets/content", ncpAssetController.getAssetContent);
5490
5498
  }
5491
5499
  function registerCronRoutes(app, cronController) {
5492
5500
  app.get("/api/cron", cronController.listJobs);
@@ -5518,7 +5526,7 @@ function createUiRouter(options) {
5518
5526
  const sessionController = new SessionRoutesController(options);
5519
5527
  const cronController = new CronRoutesController(options);
5520
5528
  const ncpSessionController = new NcpSessionRoutesController(options);
5521
- const ncpAttachmentController = new NcpAttachmentRoutesController(options);
5529
+ const ncpAssetController = new NcpAssetRoutesController(options);
5522
5530
  const remoteController = options.remoteAccess ? new RemoteRoutesController(options.remoteAccess) : null;
5523
5531
  const pluginMarketplaceController = new PluginMarketplaceController(options, marketplaceBaseUrl);
5524
5532
  const skillMarketplaceController = new SkillMarketplaceController(options, marketplaceBaseUrl);
@@ -5543,7 +5551,7 @@ function createUiRouter(options) {
5543
5551
  registerConfigRoutes(app, configController);
5544
5552
  registerChatRoutes(app, chatController);
5545
5553
  registerSessionRoutes(app, sessionController);
5546
- registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentController);
5554
+ registerNcpRoutes(app, options, ncpSessionController, ncpAssetController);
5547
5555
  registerCronRoutes(app, cronController);
5548
5556
  registerRemoteRoutes(app, remoteController);
5549
5557
  mountMarketplaceRoutes(app, {
@@ -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.11.0",
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.4",
23
+ "@nextclaw/runtime": "0.2.16",
24
+ "@nextclaw/openclaw-compat": "0.3.34",
25
+ "@nextclaw/core": "0.11.2",
26
+ "@nextclaw/ncp": "0.4.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.17.6",