@nextclaw/server 0.12.16 → 0.12.18

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
@@ -277,6 +277,15 @@ type MarketplaceRecommendationView = {
277
277
  total: number;
278
278
  items: MarketplaceItemSummary[];
279
279
  };
280
+ type MarketplaceSceneView = {
281
+ scene: string;
282
+ title: string;
283
+ description?: string;
284
+ count?: number;
285
+ };
286
+ type MarketplaceScenesView = {
287
+ scenes: MarketplaceSceneView[];
288
+ };
280
289
  type MarketplaceInstalledRecord = {
281
290
  type: MarketplaceItemType;
282
291
  id?: string;
@@ -669,6 +678,7 @@ type ProviderAuthImportResult = {
669
678
  type ChannelAuthStartRequest = {
670
679
  accountId?: string;
671
680
  baseUrl?: string;
681
+ domain?: string;
672
682
  };
673
683
  type ChannelAuthStartResult = {
674
684
  channel: string;
@@ -2487,4 +2497,4 @@ declare function updateChannel(configPath: string, channelName: string, patch: R
2487
2497
  declare function updateRuntime(configPath: string, patch: RuntimeConfigUpdate): Pick<ConfigView, "companion" | "agents" | "bindings" | "session">;
2488
2498
  declare function updateSecrets(configPath: string, patch: SecretsConfigUpdate): SecretsView;
2489
2499
  //#endregion
2490
- export { AgentBindingView, AgentCreateRequest, AgentDeleteResult, AgentProfileView, AgentUpdateRequest, ApiError, ApiResponse, AppMetaView, AuthEnabledUpdateRequest, AuthLoginRequest, AuthPasswordUpdateRequest, AuthSetupRequest, AuthStatusView, BindingPeerView, BochaFreshnessValue, BootstrapPhase, BootstrapRemoteState, BootstrapStageState, BootstrapStatusView, ChannelAuthPollRequest, ChannelAuthPollResult, ChannelAuthStartRequest, ChannelAuthStartResult, ChannelSpecView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, ConfigActionExecuteRequest, ConfigActionExecuteResult, ConfigActionManifest, ConfigActionType, ConfigMetaView, ConfigRoutesController, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, MarketplaceApiConfig, MarketplaceInstallKind, MarketplaceInstallRequest, MarketplaceInstallResult, MarketplaceInstallSkillParams, MarketplaceInstallSpec, MarketplaceInstalledRecord, MarketplaceInstalledView, MarketplaceInstaller, MarketplaceItemSummary, MarketplaceItemType, MarketplaceItemView, MarketplaceListView, MarketplaceLocalizedTextMap, MarketplaceManageAction, MarketplaceManageRequest, MarketplaceManageResult, MarketplaceMcpContentView, MarketplaceMcpDoctorResult, MarketplaceMcpInstallKind, MarketplaceMcpInstallRequest, MarketplaceMcpInstallResult, MarketplaceMcpInstallSpec, MarketplaceMcpManageAction, MarketplaceMcpManageRequest, MarketplaceMcpManageResult, MarketplaceMcpTemplateInput, MarketplacePluginContentView, MarketplacePluginInstallKind, MarketplacePluginInstallRequest, MarketplacePluginInstallResult, MarketplacePluginManageAction, MarketplacePluginManageRequest, MarketplacePluginManageResult, MarketplaceRecommendationView, MarketplaceSkillContentView, MarketplaceSkillInstallKind, MarketplaceSkillInstallRequest, MarketplaceSkillInstallResult, MarketplaceSkillManageAction, MarketplaceSkillManageRequest, MarketplaceSkillManageResult, MarketplaceSort, NcpAssetRoutesController, NcpSessionSkillsView, ProviderAuthImportResult, ProviderAuthPollRequest, ProviderAuthPollResult, ProviderAuthStartRequest, ProviderAuthStartResult, ProviderConfigUpdate, ProviderConfigView, ProviderConnectionTestRequest, ProviderConnectionTestResult, ProviderCreateRequest, ProviderCreateResult, ProviderDeleteResult, ProviderSpecView, RemoteAccessView, RemoteAccountProfileUpdateRequest, RemoteAccountView, RemoteBrowserAuthPollRequest, RemoteBrowserAuthPollResult, RemoteBrowserAuthStartRequest, RemoteBrowserAuthStartResult, RemoteDoctorCheckView, RemoteDoctorView, RemoteLoginRequest, RemoteRuntimeView, RemoteServiceAction, RemoteServiceActionResult, RemoteServiceView, RemoteSettingsUpdateRequest, RemoteSettingsView, RuntimeActionCapability, RuntimeActionImpact, RuntimeConfigUpdate, RuntimeControlAction, RuntimeControlActionResult, RuntimeControlEnvironment, RuntimeControlRoutesController, RuntimeControlView, RuntimeEntryView, RuntimeLifecycleState, RuntimePendingRestart, RuntimeServiceState, SearchConfigUpdate, SearchConfigView, SearchProviderConfigView, SearchProviderName, SearchProviderSpecView, SecretProviderEnvView, SecretProviderExecView, SecretProviderFileView, SecretProviderView, SecretRefView, SecretSourceView, SecretsConfigUpdate, SecretsView, ServerPathBreadcrumbView, ServerPathBrowseView, ServerPathEntryView, ServerPathReadView, SessionConfigView, SessionEntryView, SessionEventView, SessionHistoryView, SessionMessageView, SessionPatchUpdate, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRouterOptions, type UiRuntimeControlHost, type UiRuntimeUpdateHost, UiServerEvent, UiServerHandle, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, ensureUiBridgeSecret, executeConfigAction, getUiBridgeSecretPath, loadConfigOrDefault, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
2500
+ export { AgentBindingView, AgentCreateRequest, AgentDeleteResult, AgentProfileView, AgentUpdateRequest, ApiError, ApiResponse, AppMetaView, AuthEnabledUpdateRequest, AuthLoginRequest, AuthPasswordUpdateRequest, AuthSetupRequest, AuthStatusView, BindingPeerView, BochaFreshnessValue, BootstrapPhase, BootstrapRemoteState, BootstrapStageState, BootstrapStatusView, ChannelAuthPollRequest, ChannelAuthPollResult, ChannelAuthStartRequest, ChannelAuthStartResult, ChannelSpecView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, ConfigActionExecuteRequest, ConfigActionExecuteResult, ConfigActionManifest, ConfigActionType, ConfigMetaView, ConfigRoutesController, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, MarketplaceApiConfig, MarketplaceInstallKind, MarketplaceInstallRequest, MarketplaceInstallResult, MarketplaceInstallSkillParams, MarketplaceInstallSpec, MarketplaceInstalledRecord, MarketplaceInstalledView, MarketplaceInstaller, MarketplaceItemSummary, MarketplaceItemType, MarketplaceItemView, MarketplaceListView, MarketplaceLocalizedTextMap, MarketplaceManageAction, MarketplaceManageRequest, MarketplaceManageResult, MarketplaceMcpContentView, MarketplaceMcpDoctorResult, MarketplaceMcpInstallKind, MarketplaceMcpInstallRequest, MarketplaceMcpInstallResult, MarketplaceMcpInstallSpec, MarketplaceMcpManageAction, MarketplaceMcpManageRequest, MarketplaceMcpManageResult, MarketplaceMcpTemplateInput, MarketplacePluginContentView, MarketplacePluginInstallKind, MarketplacePluginInstallRequest, MarketplacePluginInstallResult, MarketplacePluginManageAction, MarketplacePluginManageRequest, MarketplacePluginManageResult, MarketplaceRecommendationView, MarketplaceSceneView, MarketplaceScenesView, MarketplaceSkillContentView, MarketplaceSkillInstallKind, MarketplaceSkillInstallRequest, MarketplaceSkillInstallResult, MarketplaceSkillManageAction, MarketplaceSkillManageRequest, MarketplaceSkillManageResult, MarketplaceSort, NcpAssetRoutesController, NcpSessionSkillsView, ProviderAuthImportResult, ProviderAuthPollRequest, ProviderAuthPollResult, ProviderAuthStartRequest, ProviderAuthStartResult, ProviderConfigUpdate, ProviderConfigView, ProviderConnectionTestRequest, ProviderConnectionTestResult, ProviderCreateRequest, ProviderCreateResult, ProviderDeleteResult, ProviderSpecView, RemoteAccessView, RemoteAccountProfileUpdateRequest, RemoteAccountView, RemoteBrowserAuthPollRequest, RemoteBrowserAuthPollResult, RemoteBrowserAuthStartRequest, RemoteBrowserAuthStartResult, RemoteDoctorCheckView, RemoteDoctorView, RemoteLoginRequest, RemoteRuntimeView, RemoteServiceAction, RemoteServiceActionResult, RemoteServiceView, RemoteSettingsUpdateRequest, RemoteSettingsView, RuntimeActionCapability, RuntimeActionImpact, RuntimeConfigUpdate, RuntimeControlAction, RuntimeControlActionResult, RuntimeControlEnvironment, RuntimeControlRoutesController, RuntimeControlView, RuntimeEntryView, RuntimeLifecycleState, RuntimePendingRestart, RuntimeServiceState, SearchConfigUpdate, SearchConfigView, SearchProviderConfigView, SearchProviderName, SearchProviderSpecView, SecretProviderEnvView, SecretProviderExecView, SecretProviderFileView, SecretProviderView, SecretRefView, SecretSourceView, SecretsConfigUpdate, SecretsView, ServerPathBreadcrumbView, ServerPathBrowseView, ServerPathEntryView, ServerPathReadView, SessionConfigView, SessionEntryView, SessionEventView, SessionHistoryView, SessionMessageView, SessionPatchUpdate, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRouterOptions, type UiRuntimeControlHost, type UiRuntimeUpdateHost, UiServerEvent, UiServerHandle, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, ensureUiBridgeSecret, executeConfigAction, getUiBridgeSecretPath, loadConfigOrDefault, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
package/dist/index.js CHANGED
@@ -793,7 +793,8 @@ async function startChannelAuth(params) {
793
793
  channelId: binding.channelId,
794
794
  pluginConfig: clonePluginConfig(configView.channels?.[binding.channelId]),
795
795
  accountId: request.accountId?.trim() || null,
796
- baseUrl: request.baseUrl?.trim() || null
796
+ baseUrl: request.baseUrl?.trim() || null,
797
+ domain: request.domain?.trim() || null
797
798
  });
798
799
  }
799
800
  async function pollChannelAuth(params) {
@@ -819,7 +820,7 @@ async function pollChannelAuth(params) {
819
820
  }
820
821
  //#endregion
821
822
  //#region src/features/config/utils/default-provider-config.utils.ts
822
- function createDefaultProviderConfig(defaultWireApi = "auto") {
823
+ function createDefaultProviderConfig(defaultWireApi = "auto", defaultModels = []) {
823
824
  return {
824
825
  enabled: true,
825
826
  displayName: "",
@@ -827,10 +828,13 @@ function createDefaultProviderConfig(defaultWireApi = "auto") {
827
828
  apiBase: null,
828
829
  extraHeaders: null,
829
830
  wireApi: defaultWireApi,
830
- models: [],
831
+ models: [...defaultModels],
831
832
  modelThinking: {}
832
833
  };
833
834
  }
835
+ function createDefaultProviderConfigFromSpec(spec) {
836
+ return createDefaultProviderConfig(spec?.defaultWireApi ?? "auto", spec?.defaultModels ?? []);
837
+ }
834
838
  //#endregion
835
839
  //#region src/features/config/providers/server-builtin-provider.provider.ts
836
840
  const SERVER_BUILTIN_PROVIDER_OVERRIDES = [{
@@ -1051,7 +1055,7 @@ function readFieldAsString(source, fieldName) {
1051
1055
  function setProviderApiKey({ configPath, provider, accessToken, defaultApiBase }) {
1052
1056
  const config = loadConfig(configPath);
1053
1057
  const providers = config.providers;
1054
- if (!providers[provider]) providers[provider] = createDefaultProviderConfig();
1058
+ if (!providers[provider]) providers[provider] = createDefaultProviderConfigFromSpec(findServerBuiltinProviderByName(provider));
1055
1059
  const target = providers[provider];
1056
1060
  target.apiKey = accessToken;
1057
1061
  if (!target.apiBase && defaultApiBase) target.apiBase = defaultApiBase;
@@ -1524,7 +1528,8 @@ var ConfigRoutesController = class {
1524
1528
  channelId: channel,
1525
1529
  request: {
1526
1530
  accountId: typeof payload.accountId === "string" ? payload.accountId : void 0,
1527
- baseUrl: typeof payload.baseUrl === "string" ? payload.baseUrl : void 0
1531
+ baseUrl: typeof payload.baseUrl === "string" ? payload.baseUrl : void 0,
1532
+ domain: typeof payload.domain === "string" ? payload.domain : void 0
1528
1533
  },
1529
1534
  bindings: this.options.plugins?.getChannelBindings() ?? []
1530
1535
  });
@@ -1873,7 +1878,7 @@ function ensureProviderConfig(config, providerName) {
1873
1878
  if (isCustomProviderName(providerName)) return null;
1874
1879
  const spec = findServerBuiltinProviderByName(providerName);
1875
1880
  if (!spec) return null;
1876
- const created = createDefaultProviderConfig(spec.defaultWireApi ?? "auto");
1881
+ const created = createDefaultProviderConfigFromSpec(spec);
1877
1882
  providers[providerName] = created;
1878
1883
  return created;
1879
1884
  }
@@ -2964,6 +2969,7 @@ async function runWithMarketplaceNetworkRetry(action) {
2964
2969
  }
2965
2970
  //#endregion
2966
2971
  //#region src/features/marketplace/utils/marketplace-catalog.utils.ts
2972
+ const MARKETPLACE_FETCH_TIMEOUT_MS = 12e3;
2967
2973
  function normalizeMarketplaceBaseUrl(options) {
2968
2974
  const configured = options.marketplace?.apiBaseUrl?.trim();
2969
2975
  if (!configured) return DEFAULT_MARKETPLACE_API_BASE;
@@ -2980,7 +2986,8 @@ async function fetchMarketplaceData(params) {
2980
2986
  try {
2981
2987
  response = await runWithMarketplaceNetworkRetry(() => fetch(endpoint, {
2982
2988
  method: "GET",
2983
- headers: { Accept: "application/json" }
2989
+ headers: { Accept: "application/json" },
2990
+ signal: AbortSignal.timeout(MARKETPLACE_FETCH_TIMEOUT_MS)
2984
2991
  }));
2985
2992
  } catch (error) {
2986
2993
  return {
@@ -3107,13 +3114,6 @@ async function fetchAllMarketplaceItems(params) {
3107
3114
  }
3108
3115
  };
3109
3116
  }
3110
- async function fetchAllSkillMarketplaceItems(params) {
3111
- return fetchAllMarketplaceItems({
3112
- baseUrl: params.baseUrl,
3113
- path: "/api/v1/skills/items",
3114
- query: params.query
3115
- });
3116
- }
3117
3117
  async function fetchAllMcpMarketplaceItems(params) {
3118
3118
  return fetchAllMarketplaceItems({
3119
3119
  baseUrl: params.baseUrl,
@@ -3887,37 +3887,56 @@ var SkillMarketplaceController = class {
3887
3887
  getInstalled = (c) => {
3888
3888
  return c.json(ok(collectSkillMarketplaceInstalledView(this.options)));
3889
3889
  };
3890
- listItems = async (c) => {
3891
- const query = c.req.query();
3892
- const result = await fetchAllSkillMarketplaceItems({
3893
- baseUrl: this.marketplaceBaseUrl,
3894
- query: {
3895
- q: query.q,
3896
- tag: query.tag,
3897
- sort: query.sort,
3898
- page: query.page,
3899
- pageSize: query.pageSize
3890
+ normalizeSupportedListData = (data) => {
3891
+ const normalizedItems = sanitizeMarketplaceListItems(data.items).map((item) => normalizeMarketplaceItemForUi(item));
3892
+ const unsupportedKind = findUnsupportedSkillInstallKind(normalizedItems);
3893
+ if (unsupportedKind) return {
3894
+ ok: false,
3895
+ code: "MARKETPLACE_CONTRACT_MISMATCH",
3896
+ status: 502,
3897
+ message: `unsupported skill install kind from marketplace api: ${unsupportedKind}`
3898
+ };
3899
+ const knownSkillNames = collectKnownSkillNames(this.options);
3900
+ return {
3901
+ ok: true,
3902
+ data: {
3903
+ ...data,
3904
+ items: normalizedItems.filter((item) => isSupportedMarketplaceSkillItem(item, knownSkillNames))
3900
3905
  }
3906
+ };
3907
+ };
3908
+ loadSupportedListPage = async (query) => {
3909
+ const result = await fetchMarketplaceData({
3910
+ baseUrl: this.marketplaceBaseUrl,
3911
+ path: "/api/v1/skills/items",
3912
+ query
3913
+ });
3914
+ if (!result.ok) return {
3915
+ ...result,
3916
+ code: "MARKETPLACE_UNAVAILABLE"
3917
+ };
3918
+ return this.normalizeSupportedListData(result.data);
3919
+ };
3920
+ listScenes = async (c) => {
3921
+ const result = await fetchMarketplaceData({
3922
+ baseUrl: this.marketplaceBaseUrl,
3923
+ path: "/api/v1/skills/scenes"
3901
3924
  });
3902
3925
  if (!result.ok) return c.json(err("MARKETPLACE_UNAVAILABLE", result.message), result.status);
3903
- const normalizedItems = sanitizeMarketplaceListItems(result.data.items).map((item) => normalizeMarketplaceItemForUi(item));
3904
- const unsupportedKind = findUnsupportedSkillInstallKind(normalizedItems);
3905
- if (unsupportedKind) return c.json(err("MARKETPLACE_CONTRACT_MISMATCH", `unsupported skill install kind from marketplace api: ${unsupportedKind}`), 502);
3906
- const knownSkillNames = collectKnownSkillNames(this.options);
3907
- const filteredItems = normalizedItems.filter((item) => isSupportedMarketplaceSkillItem(item, knownSkillNames));
3908
- const pageSize = Math.min(100, toPositiveInt(query.pageSize, 20));
3909
- const requestedPage = toPositiveInt(query.page, 1);
3910
- const totalPages = filteredItems.length === 0 ? 0 : Math.ceil(filteredItems.length / pageSize);
3911
- const currentPage = totalPages === 0 ? 1 : Math.min(requestedPage, totalPages);
3912
- return c.json(ok({
3913
- total: filteredItems.length,
3914
- page: currentPage,
3915
- pageSize,
3916
- totalPages,
3917
- sort: result.data.sort,
3918
- query: result.data.query,
3919
- items: filteredItems.slice((currentPage - 1) * pageSize, currentPage * pageSize)
3920
- }));
3926
+ return c.json(ok(result.data));
3927
+ };
3928
+ listItems = async (c) => {
3929
+ const query = c.req.query();
3930
+ const result = await this.loadSupportedListPage({
3931
+ q: query.q,
3932
+ scene: query.scene,
3933
+ tag: query.tag,
3934
+ sort: query.sort,
3935
+ page: query.page,
3936
+ pageSize: query.pageSize
3937
+ });
3938
+ if (!result.ok) return c.json(err(result.code, result.message), result.status);
3939
+ return c.json(ok(result.data));
3921
3940
  };
3922
3941
  getItem = async (c) => {
3923
3942
  const slug = encodeURIComponent(c.req.param("slug"));
@@ -4017,6 +4036,7 @@ function mountMarketplaceRoutes(app, controllers) {
4017
4036
  app.post("/api/marketplace/plugins/manage", controllers.plugin.manage);
4018
4037
  app.get("/api/marketplace/plugins/recommendations", controllers.plugin.getRecommendations);
4019
4038
  app.get("/api/marketplace/skills/installed", controllers.skill.getInstalled);
4039
+ app.get("/api/marketplace/skills/scenes", controllers.skill.listScenes);
4020
4040
  app.get("/api/marketplace/skills/items", controllers.skill.listItems);
4021
4041
  app.get("/api/marketplace/skills/items/:slug", controllers.skill.getItem);
4022
4042
  app.get("/api/marketplace/skills/items/:slug/content", controllers.skill.getItemContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.12.16",
3
+ "version": "0.12.18",
4
4
  "private": false,
5
5
  "description": "Nextclaw UI/API server.",
6
6
  "type": "module",
@@ -18,13 +18,13 @@
18
18
  "@hono/node-server": "^1.13.3",
19
19
  "hono": "^4.6.2",
20
20
  "ws": "^8.18.0",
21
- "@nextclaw/core": "0.12.16",
22
- "@nextclaw/kernel": "0.1.5",
23
- "@nextclaw/mcp": "0.1.81",
24
- "@nextclaw/ncp": "0.5.9",
25
- "@nextclaw/openclaw-compat": "1.0.16",
26
- "@nextclaw/runtime": "0.2.48",
27
- "@nextclaw/ncp-http-agent-server": "0.3.21"
21
+ "@nextclaw/core": "0.12.18",
22
+ "@nextclaw/kernel": "0.1.7",
23
+ "@nextclaw/ncp-http-agent-server": "0.3.23",
24
+ "@nextclaw/runtime": "0.2.50",
25
+ "@nextclaw/mcp": "0.1.83",
26
+ "@nextclaw/ncp": "0.5.11",
27
+ "@nextclaw/openclaw-compat": "1.0.18"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.17.6",