@nextclaw/server 0.11.1 → 0.11.3

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
@@ -1,7 +1,7 @@
1
1
  import * as NextclawCore from '@nextclaw/core';
2
2
  import { ThinkingLevel, CronService, Config, ConfigActionExecuteRequest as ConfigActionExecuteRequest$1, ConfigActionExecuteResult as ConfigActionExecuteResult$1 } from '@nextclaw/core';
3
3
  import { PluginChannelBinding, PluginUiMetadata } from '@nextclaw/openclaw-compat';
4
- import { NcpAgentClientEndpoint, NcpSessionApi, NcpSessionSummary, NcpMessage } from '@nextclaw/ncp';
4
+ import { NcpAgentClientEndpoint, NcpSessionSummary, NcpMessage, NcpSessionApi } from '@nextclaw/ncp';
5
5
  import { NcpHttpAgentStreamProvider } from '@nextclaw/ncp-http-agent-server';
6
6
  import { IncomingMessage } from 'node:http';
7
7
  import { Hono } from 'hono';
@@ -354,8 +354,10 @@ type UiRouterOptions = {
354
354
  marketplace?: MarketplaceApiConfig;
355
355
  cronService?: InstanceType<typeof NextclawCore.CronService>;
356
356
  ncpAgent?: UiNcpAgent;
357
+ ncpSessionService?: UiNcpSessionService;
357
358
  authService?: UiAuthService;
358
359
  remoteAccess?: UiRemoteAccessHost;
360
+ getBootstrapStatus?: () => BootstrapStatusView;
359
361
  getPluginChannelBindings?: () => PluginChannelBinding[];
360
362
  getPluginUiMetadata?: () => PluginUiMetadata[];
361
363
  };
@@ -406,6 +408,31 @@ type AppMetaView = {
406
408
  name: string;
407
409
  productVersion: string;
408
410
  };
411
+ type BootstrapPhase = "kernel-starting" | "shell-ready" | "hydrating-capabilities" | "ready" | "error";
412
+ type BootstrapStageState = "pending" | "running" | "ready" | "error";
413
+ type BootstrapRemoteState = "pending" | "ready" | "conflict" | "disabled" | "error";
414
+ type BootstrapStatusView = {
415
+ phase: BootstrapPhase;
416
+ shellReadyAt?: string;
417
+ pluginHydration: {
418
+ state: BootstrapStageState;
419
+ loadedPluginCount: number;
420
+ totalPluginCount: number;
421
+ startedAt?: string;
422
+ completedAt?: string;
423
+ error?: string;
424
+ };
425
+ channels: {
426
+ state: BootstrapStageState;
427
+ enabled: string[];
428
+ error?: string;
429
+ };
430
+ remote: {
431
+ state: BootstrapRemoteState;
432
+ message?: string;
433
+ };
434
+ lastError?: string;
435
+ };
409
436
  type ProviderConfigView = {
410
437
  enabled: boolean;
411
438
  displayName?: string;
@@ -851,10 +878,10 @@ type UiNcpSessionMessagesView = {
851
878
  type SessionTypeDescribeParams = {
852
879
  describeMode?: "observation" | "probe";
853
880
  };
881
+ type UiNcpSessionService = NcpSessionApi;
854
882
  type UiNcpAgent = {
855
883
  agentClientEndpoint: NcpAgentClientEndpoint;
856
884
  streamProvider?: NcpHttpAgentStreamProvider;
857
- sessionApi?: NcpSessionApi;
858
885
  listSessionTypes?: (params?: SessionTypeDescribeParams) => Promise<ChatSessionTypesView> | ChatSessionTypesView;
859
886
  assetApi?: {
860
887
  put: (input: {
@@ -1066,7 +1093,9 @@ type UiServerOptions = {
1066
1093
  marketplace?: MarketplaceApiConfig;
1067
1094
  cronService?: CronService;
1068
1095
  ncpAgent?: UiNcpAgent;
1096
+ ncpSessionService?: UiNcpSessionService;
1069
1097
  remoteAccess?: UiRemoteAccessHost;
1098
+ getBootstrapStatus?: () => BootstrapStatusView;
1070
1099
  getPluginChannelBindings?: () => PluginChannelBinding[];
1071
1100
  getPluginUiMetadata?: () => PluginUiMetadata[];
1072
1101
  };
@@ -1138,4 +1167,4 @@ declare function getUiBridgeSecretPath(): string;
1138
1167
  declare function readUiBridgeSecret(): string | null;
1139
1168
  declare function ensureUiBridgeSecret(): string;
1140
1169
 
1141
- 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 ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, 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 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 };
1170
+ 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 BootstrapPhase, type BootstrapRemoteState, type BootstrapStageState, type BootstrapStatusView, type ChannelAuthPollRequest, type ChannelAuthPollResult, type ChannelAuthStartRequest, type ChannelAuthStartResult, type ChannelSpecView, type ChatSessionTypeCtaView, type ChatSessionTypeOptionView, type ChatSessionTypesView, 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 UiNcpAgent, type UiNcpAssetPutView, type UiNcpAssetView, type UiNcpSessionListView, type UiNcpSessionMessagesView, type UiNcpSessionService, 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
@@ -388,6 +388,23 @@ function buildAppMetaView(options) {
388
388
  productVersion: productVersion && productVersion.length > 0 ? productVersion : "0.0.0"
389
389
  };
390
390
  }
391
+ function buildFallbackBootstrapStatus() {
392
+ return {
393
+ phase: "kernel-starting",
394
+ pluginHydration: {
395
+ state: "pending",
396
+ loadedPluginCount: 0,
397
+ totalPluginCount: 0
398
+ },
399
+ channels: {
400
+ state: "pending",
401
+ enabled: []
402
+ },
403
+ remote: {
404
+ state: "pending"
405
+ }
406
+ };
407
+ }
391
408
  var AppRoutesController = class {
392
409
  constructor(options) {
393
410
  this.options = options;
@@ -402,6 +419,7 @@ var AppRoutesController = class {
402
419
  })
403
420
  );
404
421
  appMeta = (c) => c.json(ok(buildAppMetaView(this.options)));
422
+ bootstrapStatus = (c) => c.json(ok(this.options.getBootstrapStatus?.() ?? buildFallbackBootstrapStatus()));
405
423
  };
406
424
 
407
425
  // src/ui/auth-bridge.ts
@@ -3133,7 +3151,7 @@ var NcpSessionRoutesController = class {
3133
3151
  return c.json(ok(payload));
3134
3152
  };
3135
3153
  listSessions = async (c) => {
3136
- const sessionApi = this.options.ncpAgent?.sessionApi;
3154
+ const sessionApi = this.options.ncpSessionService;
3137
3155
  if (!sessionApi) {
3138
3156
  return c.json(err("NOT_AVAILABLE", "ncp session api unavailable"), 503);
3139
3157
  }
@@ -3147,7 +3165,7 @@ var NcpSessionRoutesController = class {
3147
3165
  return c.json(ok(payload));
3148
3166
  };
3149
3167
  getSession = async (c) => {
3150
- const sessionApi = this.options.ncpAgent?.sessionApi;
3168
+ const sessionApi = this.options.ncpSessionService;
3151
3169
  if (!sessionApi) {
3152
3170
  return c.json(err("NOT_AVAILABLE", "ncp session api unavailable"), 503);
3153
3171
  }
@@ -3159,7 +3177,7 @@ var NcpSessionRoutesController = class {
3159
3177
  return c.json(ok(session));
3160
3178
  };
3161
3179
  listSessionMessages = async (c) => {
3162
- const sessionApi = this.options.ncpAgent?.sessionApi;
3180
+ const sessionApi = this.options.ncpSessionService;
3163
3181
  if (!sessionApi) {
3164
3182
  return c.json(err("NOT_AVAILABLE", "ncp session api unavailable"), 503);
3165
3183
  }
@@ -3179,7 +3197,7 @@ var NcpSessionRoutesController = class {
3179
3197
  return c.json(ok(payload));
3180
3198
  };
3181
3199
  patchSession = async (c) => {
3182
- const sessionApi = this.options.ncpAgent?.sessionApi;
3200
+ const sessionApi = this.options.ncpSessionService;
3183
3201
  if (!sessionApi) {
3184
3202
  return c.json(err("NOT_AVAILABLE", "ncp session api unavailable"), 503);
3185
3203
  }
@@ -3228,7 +3246,7 @@ var NcpSessionRoutesController = class {
3228
3246
  return c.json(ok(updated));
3229
3247
  };
3230
3248
  deleteSession = async (c) => {
3231
- const sessionApi = this.options.ncpAgent?.sessionApi;
3249
+ const sessionApi = this.options.ncpSessionService;
3232
3250
  if (!sessionApi) {
3233
3251
  return c.json(err("NOT_AVAILABLE", "ncp session api unavailable"), 503);
3234
3252
  }
@@ -4799,7 +4817,15 @@ function registerConfigRoutes(app, configController) {
4799
4817
  app.put("/api/config/runtime", configController.updateRuntime);
4800
4818
  app.post("/api/config/actions/:actionId/execute", configController.executeAction);
4801
4819
  }
4802
- function registerNcpRoutes(app, options, ncpSessionController, ncpAssetController) {
4820
+ function registerNcpSessionRoutes(app, ncpSessionController) {
4821
+ app.get("/api/ncp/session-types", ncpSessionController.getSessionTypes);
4822
+ app.get("/api/ncp/sessions", ncpSessionController.listSessions);
4823
+ app.get("/api/ncp/sessions/:sessionId", ncpSessionController.getSession);
4824
+ app.put("/api/ncp/sessions/:sessionId", ncpSessionController.patchSession);
4825
+ app.get("/api/ncp/sessions/:sessionId/messages", ncpSessionController.listSessionMessages);
4826
+ app.delete("/api/ncp/sessions/:sessionId", ncpSessionController.deleteSession);
4827
+ }
4828
+ function registerNcpRuntimeRoutes(app, options, ncpAssetController) {
4803
4829
  if (!options.ncpAgent) {
4804
4830
  return;
4805
4831
  }
@@ -4808,12 +4834,6 @@ function registerNcpRoutes(app, options, ncpSessionController, ncpAssetControlle
4808
4834
  agentClientEndpoint: options.ncpAgent.agentClientEndpoint,
4809
4835
  streamProvider: options.ncpAgent.streamProvider
4810
4836
  });
4811
- app.get("/api/ncp/session-types", ncpSessionController.getSessionTypes);
4812
- app.get("/api/ncp/sessions", ncpSessionController.listSessions);
4813
- app.get("/api/ncp/sessions/:sessionId", ncpSessionController.getSession);
4814
- app.put("/api/ncp/sessions/:sessionId", ncpSessionController.patchSession);
4815
- app.get("/api/ncp/sessions/:sessionId/messages", ncpSessionController.listSessionMessages);
4816
- app.delete("/api/ncp/sessions/:sessionId", ncpSessionController.deleteSession);
4817
4837
  app.post("/api/ncp/assets", ncpAssetController.putAssets);
4818
4838
  app.get("/api/ncp/assets/content", ncpAssetController.getAssetContent);
4819
4839
  }
@@ -4853,7 +4873,7 @@ function createUiRouter(options) {
4853
4873
  app.notFound((c) => c.json(err("NOT_FOUND", "endpoint not found"), 404));
4854
4874
  app.use("/api/*", async (c, next) => {
4855
4875
  const path = c.req.path;
4856
- if (path === "/api/health" || path.startsWith("/api/auth/")) {
4876
+ if (path === "/api/health" || path === "/api/runtime/bootstrap-status" || path.startsWith("/api/auth/")) {
4857
4877
  await next();
4858
4878
  return;
4859
4879
  }
@@ -4866,9 +4886,11 @@ function createUiRouter(options) {
4866
4886
  });
4867
4887
  app.get("/api/health", appController.health);
4868
4888
  app.get("/api/app/meta", appController.appMeta);
4889
+ app.get("/api/runtime/bootstrap-status", appController.bootstrapStatus);
4869
4890
  registerAuthRoutes(app, authController);
4870
4891
  registerConfigRoutes(app, configController);
4871
- registerNcpRoutes(app, options, ncpSessionController, ncpAssetController);
4892
+ registerNcpSessionRoutes(app, ncpSessionController);
4893
+ registerNcpRuntimeRoutes(app, options, ncpAssetController);
4872
4894
  registerCronRoutes(app, cronController);
4873
4895
  registerRemoteRoutes(app, remoteController);
4874
4896
  mountMarketplaceRoutes(app, {
@@ -4978,8 +5000,10 @@ function startUiServer(options) {
4978
5000
  marketplace: options.marketplace,
4979
5001
  cronService: options.cronService,
4980
5002
  ncpAgent: options.ncpAgent,
5003
+ ncpSessionService: options.ncpSessionService,
4981
5004
  authService,
4982
5005
  remoteAccess: options.remoteAccess,
5006
+ getBootstrapStatus: options.getBootstrapStatus,
4983
5007
  getPluginChannelBindings: options.getPluginChannelBindings,
4984
5008
  getPluginUiMetadata: options.getPluginUiMetadata
4985
5009
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
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.51",
21
+ "@nextclaw/mcp": "0.1.53",
22
+ "@nextclaw/runtime": "0.2.18",
23
+ "@nextclaw/core": "0.11.4",
22
24
  "@nextclaw/ncp": "0.4.0",
23
- "@nextclaw/openclaw-compat": "0.3.35",
24
- "@nextclaw/ncp-http-agent-server": "0.3.4",
25
- "@nextclaw/runtime": "0.2.16",
26
- "@nextclaw/core": "0.11.2"
25
+ "@nextclaw/openclaw-compat": "0.3.37",
26
+ "@nextclaw/ncp-http-agent-server": "0.3.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^20.17.6",