@nextclaw/server 0.10.57 → 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";
@@ -966,14 +966,14 @@ type UiNcpAgent = {
966
966
  streamProvider?: NcpHttpAgentStreamProvider;
967
967
  sessionApi?: NcpSessionApi;
968
968
  listSessionTypes?: (params?: SessionTypeDescribeParams) => Promise<ChatSessionTypesView> | ChatSessionTypesView;
969
- attachmentApi?: {
970
- saveAttachment: (input: {
969
+ assetApi?: {
970
+ put: (input: {
971
971
  fileName: string;
972
972
  mimeType?: string | null;
973
973
  bytes: Uint8Array;
974
974
  createdAt?: Date;
975
- }) => Promise<UiNcpStoredAttachmentRecord>;
976
- statAttachment: (uri: string) => Promise<UiNcpStoredAttachmentRecord | null> | UiNcpStoredAttachmentRecord | null;
975
+ }) => Promise<UiNcpStoredAssetRecord>;
976
+ stat: (uri: string) => Promise<UiNcpStoredAssetRecord | null> | UiNcpStoredAssetRecord | null;
977
977
  resolveContentPath: (uri: string) => string | null;
978
978
  };
979
979
  basePath?: string;
@@ -1254,4 +1254,4 @@ declare function getUiBridgeSecretPath(): string;
1254
1254
  declare function readUiBridgeSecret(): string | null;
1255
1255
  declare function ensureUiBridgeSecret(): string;
1256
1256
 
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 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
@@ -3623,32 +3623,32 @@ var CronRoutesController = class {
3623
3623
 
3624
3624
  // src/ui/router/ncp-attachment.controller.ts
3625
3625
  import { readFile as readFile2 } from "fs/promises";
3626
- var ATTACHMENT_CONTENT_BASE_PATH = "/api/ncp/attachments/content";
3627
- function buildAttachmentContentUrl(attachmentUri) {
3628
- const query = new URLSearchParams({ uri: attachmentUri });
3629
- 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()}`;
3630
3630
  }
3631
3631
  function encodeContentDispositionFileName(fileName) {
3632
3632
  return encodeURIComponent(fileName).replace(/\*/g, "%2A");
3633
3633
  }
3634
- function toAttachmentView(record) {
3634
+ function toAssetView(record) {
3635
3635
  return {
3636
3636
  id: record.id,
3637
- name: record.originalName,
3637
+ name: record.fileName,
3638
3638
  mimeType: record.mimeType,
3639
3639
  sizeBytes: record.sizeBytes,
3640
- attachmentUri: record.uri,
3641
- url: buildAttachmentContentUrl(record.uri)
3640
+ assetUri: record.uri,
3641
+ url: buildAssetContentUrl(record.uri)
3642
3642
  };
3643
3643
  }
3644
- var NcpAttachmentRoutesController = class {
3644
+ var NcpAssetRoutesController = class {
3645
3645
  constructor(options) {
3646
3646
  this.options = options;
3647
3647
  }
3648
- uploadAttachments = async (c) => {
3649
- const attachmentApi = this.options.ncpAgent?.attachmentApi;
3650
- if (!attachmentApi) {
3651
- 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);
3652
3652
  }
3653
3653
  let formData;
3654
3654
  try {
@@ -3665,38 +3665,38 @@ var NcpAttachmentRoutesController = class {
3665
3665
  if (files.length === 0) {
3666
3666
  return c.json(err("INVALID_BODY", "no files provided"), 400);
3667
3667
  }
3668
- const attachments = [];
3668
+ const assets = [];
3669
3669
  for (const file of files) {
3670
- const record = await attachmentApi.saveAttachment({
3670
+ const record = await assetApi.put({
3671
3671
  fileName: file.name,
3672
3672
  mimeType: file.type || null,
3673
3673
  bytes: new Uint8Array(await file.arrayBuffer())
3674
3674
  });
3675
- attachments.push(toAttachmentView(record));
3675
+ assets.push(toAssetView(record));
3676
3676
  }
3677
- const payload = { attachments };
3677
+ const payload = { assets };
3678
3678
  return c.json(ok(payload));
3679
3679
  };
3680
- getAttachmentContent = async (c) => {
3681
- const attachmentApi = this.options.ncpAgent?.attachmentApi;
3682
- if (!attachmentApi) {
3683
- 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);
3684
3684
  }
3685
3685
  const uri = c.req.query("uri")?.trim();
3686
3686
  if (!uri) {
3687
- return c.json(err("INVALID_URI", "attachment uri is required"), 400);
3687
+ return c.json(err("INVALID_URI", "asset uri is required"), 400);
3688
3688
  }
3689
- const record = await attachmentApi.statAttachment(uri);
3690
- const contentPath = attachmentApi.resolveContentPath(uri);
3689
+ const record = await assetApi.stat(uri);
3690
+ const contentPath = assetApi.resolveContentPath(uri);
3691
3691
  if (!record || !contentPath) {
3692
- return c.json(err("NOT_FOUND", `attachment not found: ${uri}`), 404);
3692
+ return c.json(err("NOT_FOUND", `asset not found: ${uri}`), 404);
3693
3693
  }
3694
3694
  const body = await readFile2(contentPath);
3695
3695
  return new Response(body, {
3696
3696
  headers: {
3697
3697
  "content-length": String(body.byteLength),
3698
3698
  "content-type": record.mimeType || "application/octet-stream",
3699
- "content-disposition": `inline; filename*=UTF-8''${encodeContentDispositionFileName(record.originalName)}`
3699
+ "content-disposition": `inline; filename*=UTF-8''${encodeContentDispositionFileName(record.fileName)}`
3700
3700
  }
3701
3701
  });
3702
3702
  };
@@ -5478,7 +5478,7 @@ function registerSessionRoutes(app, sessionController) {
5478
5478
  app.put("/api/sessions/:key", sessionController.patchSession);
5479
5479
  app.delete("/api/sessions/:key", sessionController.deleteSession);
5480
5480
  }
5481
- function registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentController) {
5481
+ function registerNcpRoutes(app, options, ncpSessionController, ncpAssetController) {
5482
5482
  if (!options.ncpAgent) {
5483
5483
  return;
5484
5484
  }
@@ -5493,8 +5493,8 @@ function registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentCont
5493
5493
  app.put("/api/ncp/sessions/:sessionId", ncpSessionController.patchSession);
5494
5494
  app.get("/api/ncp/sessions/:sessionId/messages", ncpSessionController.listSessionMessages);
5495
5495
  app.delete("/api/ncp/sessions/:sessionId", ncpSessionController.deleteSession);
5496
- app.post("/api/ncp/attachments", ncpAttachmentController.uploadAttachments);
5497
- 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);
5498
5498
  }
5499
5499
  function registerCronRoutes(app, cronController) {
5500
5500
  app.get("/api/cron", cronController.listJobs);
@@ -5526,7 +5526,7 @@ function createUiRouter(options) {
5526
5526
  const sessionController = new SessionRoutesController(options);
5527
5527
  const cronController = new CronRoutesController(options);
5528
5528
  const ncpSessionController = new NcpSessionRoutesController(options);
5529
- const ncpAttachmentController = new NcpAttachmentRoutesController(options);
5529
+ const ncpAssetController = new NcpAssetRoutesController(options);
5530
5530
  const remoteController = options.remoteAccess ? new RemoteRoutesController(options.remoteAccess) : null;
5531
5531
  const pluginMarketplaceController = new PluginMarketplaceController(options, marketplaceBaseUrl);
5532
5532
  const skillMarketplaceController = new SkillMarketplaceController(options, marketplaceBaseUrl);
@@ -5551,7 +5551,7 @@ function createUiRouter(options) {
5551
5551
  registerConfigRoutes(app, configController);
5552
5552
  registerChatRoutes(app, chatController);
5553
5553
  registerSessionRoutes(app, sessionController);
5554
- registerNcpRoutes(app, options, ncpSessionController, ncpAttachmentController);
5554
+ registerNcpRoutes(app, options, ncpSessionController, ncpAssetController);
5555
5555
  registerCronRoutes(app, cronController);
5556
5556
  registerRemoteRoutes(app, remoteController);
5557
5557
  mountMarketplaceRoutes(app, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.10.57",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -19,11 +19,11 @@
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
21
  "@nextclaw/mcp": "0.1.51",
22
- "@nextclaw/ncp-http-agent-server": "0.3.3",
23
- "@nextclaw/ncp": "0.3.3",
22
+ "@nextclaw/ncp-http-agent-server": "0.3.4",
24
23
  "@nextclaw/runtime": "0.2.16",
24
+ "@nextclaw/openclaw-compat": "0.3.34",
25
25
  "@nextclaw/core": "0.11.2",
26
- "@nextclaw/openclaw-compat": "0.3.33"
26
+ "@nextclaw/ncp": "0.4.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.17.6",