@nextclaw/server 0.12.13-beta.3 → 0.12.13-beta.4

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,4 +1,5 @@
1
1
  import { Hono } from "hono";
2
+ import { AppEvent } from "@nextclaw/kernel";
2
3
  import * as NextclawCore from "@nextclaw/core";
3
4
  import { Config, ConfigActionExecuteRequest as ConfigActionExecuteRequest$1, ConfigActionExecuteResult as ConfigActionExecuteResult$1, CronService, ThinkingLevel } from "@nextclaw/core";
4
5
  import { NcpHttpAgentStreamProvider } from "@nextclaw/ncp-http-agent-server";
@@ -6,7 +7,6 @@ import { PluginChannelBinding, PluginUiMetadata } from "@nextclaw/openclaw-compa
6
7
  import { NcpAgentClientEndpoint, NcpMessage, NcpSessionApi, NcpSessionStatus, NcpSessionSummary } from "@nextclaw/ncp";
7
8
  import { UpdatePreferences, UpdateSnapshot } from "@nextclaw/kernel/update-contract";
8
9
  import { IncomingMessage } from "node:http";
9
- import { AppEvent as UiServerEvent$1 } from "@nextclaw/kernel";
10
10
 
11
11
  //#region src/ui/ncp-attachment.types.d.ts
12
12
  type UiNcpStoredAssetRecord = {
@@ -398,7 +398,7 @@ type RuntimeControlActionResult = {
398
398
  type UiRouterOptions = {
399
399
  configPath: string;
400
400
  productVersion?: string;
401
- publish: (event: UiServerEvent$1) => void;
401
+ publish: (event: UiServerEvent) => void;
402
402
  applyLiveConfigReload?: () => Promise<void>;
403
403
  initializeAgentHomeDirectory?: (homeDirectory: string) => void;
404
404
  marketplace?: MarketplaceApiConfig;
@@ -1265,6 +1265,7 @@ type ConfigActionExecuteResult = {
1265
1265
  patch?: Record<string, unknown>;
1266
1266
  nextActions?: string[];
1267
1267
  };
1268
+ type UiServerEvent = AppEvent;
1268
1269
  type UiServerOptions = {
1269
1270
  host: string;
1270
1271
  port: number;
@@ -1359,4 +1360,4 @@ declare function getUiBridgeSecretPath(): string;
1359
1360
  declare function readUiBridgeSecret(): string | null;
1360
1361
  declare function ensureUiBridgeSecret(): string;
1361
1362
  //#endregion
1362
- 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, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, DEFAULT_SESSION_TYPE, 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, 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, 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, SessionPatchValidationError, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRuntimeControlHost, type UiRuntimeUpdateHost, type UiServerEvent$1 as UiServerEvent, UiServerHandle, UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createCustomProvider, createUiRouter, deleteCustomProvider, deleteSession, ensureUiBridgeSecret, executeConfigAction, getSessionHistory, getUiBridgeSecretPath, listSessions, loadConfigOrDefault, patchSession, readUiBridgeSecret, startUiServer, testProviderConnection, updateChannel, updateModel, updateProvider, updateRuntime, updateSearch, updateSecrets };
1363
+ 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, ConfigSchemaResponse, ConfigUiHint, ConfigUiHints, ConfigView, CronActionResult, CronCreateRequest, CronCreateResult, CronEnableRequest, CronJobStateView, CronJobView, CronListView, CronPayloadView, CronRunRequest, CronScheduleView, DEFAULT_SESSION_TYPE, 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, 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, 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, SessionPatchValidationError, SessionSkillEntryView, SessionTypeDescribeParams, SessionsListView, TavilySearchDepthValue, UiNcpAgent, UiNcpAssetPutView, UiNcpAssetView, UiNcpSessionListView, UiNcpSessionMessagesView, UiNcpSessionService, UiNcpStoredAssetRecord, type UiRemoteAccessHost, type UiRuntimeControlHost, type UiRuntimeUpdateHost, UiServerEvent, UiServerHandle, 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
@@ -1,6 +1,7 @@
1
1
  import { Hono } from "hono";
2
2
  import { compress } from "hono/compress";
3
3
  import { serve } from "@hono/node-server";
4
+ import { nextclaw } from "@nextclaw/kernel";
4
5
  import { WebSocket, WebSocketServer } from "ws";
5
6
  import fs, { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
7
  import { open, readFile, readdir, realpath, stat } from "node:fs/promises";
@@ -5034,6 +5035,13 @@ function applyCorsHeaders(params) {
5034
5035
  appendVaryHeader(params.headers, "Origin");
5035
5036
  appendVaryHeader(params.headers, "Access-Control-Request-Headers");
5036
5037
  }
5038
+ function publishUiServerEvent(event) {
5039
+ nextclaw.eventBus.emitEnvelope({
5040
+ ...event,
5041
+ emittedAt: event.emittedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
5042
+ source: event.source ?? "backend"
5043
+ });
5044
+ }
5037
5045
  function createUiEventPublisher(clients) {
5038
5046
  return (event) => {
5039
5047
  const payload = JSON.stringify(event);
@@ -5120,7 +5128,9 @@ async function startUiServer(options) {
5120
5128
  });
5121
5129
  });
5122
5130
  const clients = /* @__PURE__ */ new Set();
5123
- const publish = createUiEventPublisher(clients);
5131
+ const publish = publishUiServerEvent;
5132
+ const publishToClients = createUiEventPublisher(clients);
5133
+ const unsubscribeEventBus = nextclaw.eventBus.subscribeAll(publishToClients);
5124
5134
  app.route("/", createUiRouter({
5125
5135
  configPath,
5126
5136
  productVersion,
@@ -5154,6 +5164,7 @@ async function startUiServer(options) {
5154
5164
  port,
5155
5165
  publish,
5156
5166
  close: () => new Promise((resolve) => {
5167
+ unsubscribeEventBus();
5157
5168
  wss.close(() => {
5158
5169
  server.close(() => {
5159
5170
  Promise.resolve(ncpAgent?.agentClientEndpoint.stop()).catch(() => void 0).finally(() => resolve());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/server",
3
- "version": "0.12.13-beta.3",
3
+ "version": "0.12.13-beta.4",
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.13-beta.2",
22
- "@nextclaw/kernel": "0.1.2-beta.3",
23
- "@nextclaw/mcp": "0.1.78-beta.2",
24
- "@nextclaw/ncp-http-agent-server": "0.3.18-beta.2",
25
- "@nextclaw/ncp": "0.5.6-beta.1",
26
- "@nextclaw/openclaw-compat": "1.0.13-beta.3",
27
- "@nextclaw/runtime": "0.2.45-beta.1"
21
+ "@nextclaw/kernel": "0.1.2-beta.4",
22
+ "@nextclaw/mcp": "0.1.78-beta.3",
23
+ "@nextclaw/core": "0.12.13-beta.3",
24
+ "@nextclaw/openclaw-compat": "1.0.13-beta.4",
25
+ "@nextclaw/ncp-http-agent-server": "0.3.18-beta.3",
26
+ "@nextclaw/ncp": "0.5.6-beta.2",
27
+ "@nextclaw/runtime": "0.2.45-beta.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.17.6",