@nextclaw/server 0.12.13-beta.2 → 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";
@@ -1264,52 +1265,7 @@ type ConfigActionExecuteResult = {
1264
1265
  patch?: Record<string, unknown>;
1265
1266
  nextActions?: string[];
1266
1267
  };
1267
- type UiServerEvent = {
1268
- type: "config.updated";
1269
- payload: {
1270
- path: string;
1271
- };
1272
- } | {
1273
- type: "channel.config.apply-status";
1274
- payload: {
1275
- channel: string;
1276
- status: "started" | "succeeded" | "failed";
1277
- message?: string;
1278
- };
1279
- } | {
1280
- type: "session.updated";
1281
- payload: {
1282
- sessionKey: string;
1283
- };
1284
- } | {
1285
- type: "session.run-status";
1286
- payload: {
1287
- sessionKey: string;
1288
- status: "running" | "idle";
1289
- };
1290
- } | {
1291
- type: "session.summary.upsert";
1292
- payload: {
1293
- summary: NcpSessionSummary;
1294
- };
1295
- } | {
1296
- type: "session.summary.delete";
1297
- payload: {
1298
- sessionKey: string;
1299
- };
1300
- } | {
1301
- type: "config.reload.started";
1302
- payload?: Record<string, unknown>;
1303
- } | {
1304
- type: "config.reload.finished";
1305
- payload?: Record<string, unknown>;
1306
- } | {
1307
- type: "error";
1308
- payload: {
1309
- message: string;
1310
- code?: string;
1311
- };
1312
- };
1268
+ type UiServerEvent = AppEvent;
1313
1269
  type UiServerOptions = {
1314
1270
  host: string;
1315
1271
  port: number;
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.2",
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.1",
22
- "@nextclaw/kernel": "0.1.2-beta.2",
23
- "@nextclaw/mcp": "0.1.78-beta.1",
24
- "@nextclaw/ncp": "0.5.6-beta.0",
25
- "@nextclaw/ncp-http-agent-server": "0.3.18-beta.1",
26
- "@nextclaw/openclaw-compat": "1.0.13-beta.2",
27
- "@nextclaw/runtime": "0.2.45-beta.0"
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",