nextclaw 0.16.14 → 0.16.15

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.
Files changed (32) hide show
  1. package/dist/cli/index.js +200 -100
  2. package/package.json +10 -10
  3. package/ui-dist/assets/{ChannelsList-XGMfinnc.js → ChannelsList-C63gOoYI.js} +3 -3
  4. package/ui-dist/assets/ChatPage-Ci3Gz0qh.js +37 -0
  5. package/ui-dist/assets/{DocBrowser-DTRCNsSM.js → DocBrowser-CI4jOzJY.js} +1 -1
  6. package/ui-dist/assets/{LogoBadge-CPMOwWdA.js → LogoBadge-DImV63-L.js} +1 -1
  7. package/ui-dist/assets/{MarketplacePage-De2qZ9C0.js → MarketplacePage-B360oSAV.js} +1 -1
  8. package/ui-dist/assets/{McpMarketplacePage-cjVKSQ2f.js → McpMarketplacePage-KIQgx_7h.js} +2 -2
  9. package/ui-dist/assets/{ModelConfig-CMn3-VZk.js → ModelConfig-Ben3tQoX.js} +1 -1
  10. package/ui-dist/assets/{ProvidersList-CArDOswN.js → ProvidersList-DE-S9mq0.js} +1 -1
  11. package/ui-dist/assets/RemoteAccessPage-DxUia6R-.js +1 -0
  12. package/ui-dist/assets/RuntimeConfig-CQcGfNZT.js +1 -0
  13. package/ui-dist/assets/{SearchConfig-a38m8Ynx.js → SearchConfig-DeOa-M6j.js} +1 -1
  14. package/ui-dist/assets/{SecretsConfig-B6mf4JY9.js → SecretsConfig-Ci8pJmzd.js} +2 -2
  15. package/ui-dist/assets/{SessionsConfig-B_WQ1lVd.js → SessionsConfig-B6zq55yu.js} +2 -2
  16. package/ui-dist/assets/chat-session-display--oo5yuIw.js +1 -0
  17. package/ui-dist/assets/{index-D-wEIgPn.js → index-LhlkB00c.js} +4 -4
  18. package/ui-dist/assets/{label-usOOP7mv.js → label-3TKt0PoZ.js} +1 -1
  19. package/ui-dist/assets/{page-layout-CuIf20mx.js → page-layout-CopkIM3Q.js} +1 -1
  20. package/ui-dist/assets/{popover-CTtTCP5d.js → popover-CUx8uRJw.js} +1 -1
  21. package/ui-dist/assets/security-config-BL29kTzz.js +1 -0
  22. package/ui-dist/assets/{skeleton-BNUaFYE7.js → skeleton-Bs4zvcql.js} +1 -1
  23. package/ui-dist/assets/{status-dot-BeHTBy9k.js → status-dot-D6vJMwD7.js} +1 -1
  24. package/ui-dist/assets/{switch-CtNnWZpa.js → switch-A3-ClT1P.js} +1 -1
  25. package/ui-dist/assets/{tabs-custom-Dz_4tV62.js → tabs-custom-BVSd5urq.js} +1 -1
  26. package/ui-dist/assets/{useConfirmDialog-C_n_JIEq.js → useConfirmDialog-ChPriea6.js} +1 -1
  27. package/ui-dist/index.html +1 -1
  28. package/ui-dist/assets/ChatPage-DYTcCRPp.js +0 -37
  29. package/ui-dist/assets/RemoteAccessPage-C0I4tHey.js +0 -1
  30. package/ui-dist/assets/RuntimeConfig-B4o6uJq9.js +0 -1
  31. package/ui-dist/assets/ncp-session-adapter-DSacECph.js +0 -1
  32. package/ui-dist/assets/security-config-Bxrrv8Ac.js +0 -1
package/dist/cli/index.js CHANGED
@@ -6586,6 +6586,7 @@ function createUiNcpAgentHandle(params) {
6586
6586
  basePath: "/api/ncp/agent",
6587
6587
  agentClientEndpoint: createAgentClientFromServer(params.backend),
6588
6588
  streamProvider: params.backend,
6589
+ sessionApi: params.backend,
6589
6590
  listSessionTypes: (describeParams) => {
6590
6591
  params.refreshPluginRuntimeRegistrations();
6591
6592
  return params.runtimeRegistry.listSessionTypes(describeParams);
@@ -6645,95 +6646,6 @@ async function createUiNcpAgent(params) {
6645
6646
  });
6646
6647
  }
6647
6648
 
6648
- // src/cli/commands/ncp/ui-session-service.ts
6649
- function applyLimit(items, limit) {
6650
- if (!Number.isFinite(limit) || typeof limit !== "number" || limit <= 0) {
6651
- return items;
6652
- }
6653
- return items.slice(0, Math.trunc(limit));
6654
- }
6655
- function now() {
6656
- return (/* @__PURE__ */ new Date()).toISOString();
6657
- }
6658
- function toSessionSummary(params) {
6659
- return {
6660
- sessionId: params.sessionId,
6661
- messageCount: params.messages.length,
6662
- updatedAt: params.updatedAt,
6663
- status: "idle",
6664
- ...params.metadata ? { metadata: structuredClone(params.metadata) } : {}
6665
- };
6666
- }
6667
- function buildUpdatedMetadata(params) {
6668
- if (params.patch.metadata === null) {
6669
- return {};
6670
- }
6671
- if (params.patch.metadata) {
6672
- return structuredClone(params.patch.metadata);
6673
- }
6674
- return structuredClone(params.existingMetadata ?? {});
6675
- }
6676
- var UiSessionService = class {
6677
- sessionStore;
6678
- constructor(sessionManager, options = {}) {
6679
- this.sessionStore = new NextclawAgentSessionStore(sessionManager, {
6680
- onSessionUpdated: options.onSessionUpdated
6681
- });
6682
- }
6683
- async listSessions(options) {
6684
- const sessions = await this.sessionStore.listSessions();
6685
- return applyLimit(
6686
- sessions.map(
6687
- (session) => toSessionSummary({
6688
- sessionId: session.sessionId,
6689
- messages: session.messages,
6690
- updatedAt: session.updatedAt,
6691
- metadata: session.metadata
6692
- })
6693
- ),
6694
- options?.limit
6695
- );
6696
- }
6697
- async listSessionMessages(sessionId, options) {
6698
- const session = await this.sessionStore.getSession(sessionId);
6699
- if (!session) {
6700
- return [];
6701
- }
6702
- return applyLimit(session.messages.map((message) => structuredClone(message)), options?.limit);
6703
- }
6704
- async getSession(sessionId) {
6705
- const session = await this.sessionStore.getSession(sessionId);
6706
- if (!session) {
6707
- return null;
6708
- }
6709
- return toSessionSummary({
6710
- sessionId,
6711
- messages: session.messages,
6712
- updatedAt: session.updatedAt,
6713
- metadata: session.metadata
6714
- });
6715
- }
6716
- async updateSession(sessionId, patch) {
6717
- const session = await this.sessionStore.getSession(sessionId);
6718
- if (!session) {
6719
- return null;
6720
- }
6721
- await this.sessionStore.saveSession({
6722
- sessionId,
6723
- messages: session.messages.map((message) => structuredClone(message)),
6724
- updatedAt: now(),
6725
- metadata: buildUpdatedMetadata({
6726
- existingMetadata: session.metadata,
6727
- patch
6728
- })
6729
- });
6730
- return await this.getSession(sessionId);
6731
- }
6732
- async deleteSession(sessionId) {
6733
- await this.sessionStore.deleteSession(sessionId);
6734
- }
6735
- };
6736
-
6737
6649
  // src/cli/commands/service-gateway-context.ts
6738
6650
  import * as NextclawCore from "@nextclaw/core";
6739
6651
  import { getPluginChannelBindings as getPluginChannelBindings3, resolvePluginChannelMessageToolHints } from "@nextclaw/openclaw-compat";
@@ -8070,10 +7982,11 @@ async function startDeferredGatewayStartup(params) {
8070
7982
  gatewayController: params.gatewayController,
8071
7983
  getConfig: params.getConfig,
8072
7984
  getExtensionRegistry: params.getExtensionRegistry,
8073
- onSessionUpdated: (sessionKey) => params.uiStartup?.publish({ type: "session.updated", payload: { sessionKey } }),
7985
+ onSessionUpdated: params.publishSessionChange,
8074
7986
  resolveMessageToolHints: ({ channel, accountId }) => params.resolveMessageToolHints({ channel, accountId })
8075
7987
  })
8076
7988
  );
7989
+ params.deferredNcpSessionService.activate(ncpAgent.sessionApi);
8077
7990
  params.onNcpAgentReady(ncpAgent);
8078
7991
  params.uiStartup.deferredNcpAgent.activate(ncpAgent);
8079
7992
  console.log("\u2713 UI NCP agent: ready");
@@ -8105,6 +8018,194 @@ async function runGatewayRuntimeLoop(params) {
8105
8018
  }
8106
8019
  }
8107
8020
 
8021
+ // src/cli/commands/ncp/ncp-session-realtime-change.ts
8022
+ function toNcpSessionRealtimeEvent(change) {
8023
+ if (change.kind === "upsert") {
8024
+ return {
8025
+ type: "session.summary.upsert",
8026
+ payload: {
8027
+ summary: change.summary
8028
+ }
8029
+ };
8030
+ }
8031
+ return {
8032
+ type: "session.summary.delete",
8033
+ payload: {
8034
+ sessionKey: change.sessionKey
8035
+ }
8036
+ };
8037
+ }
8038
+ function createNcpSessionRealtimeChangePublisher(params) {
8039
+ return {
8040
+ publishSessionChange: async (sessionKey) => {
8041
+ const normalizedSessionKey = sessionKey.trim();
8042
+ if (!normalizedSessionKey) {
8043
+ return;
8044
+ }
8045
+ const summary = await params.sessionApi.getSession(normalizedSessionKey);
8046
+ params.publishUiEvent?.(
8047
+ toNcpSessionRealtimeEvent(
8048
+ summary ? {
8049
+ kind: "upsert",
8050
+ summary
8051
+ } : {
8052
+ kind: "delete",
8053
+ sessionKey: normalizedSessionKey
8054
+ }
8055
+ )
8056
+ );
8057
+ }
8058
+ };
8059
+ }
8060
+
8061
+ // src/cli/commands/ncp/ncp-session-summary.ts
8062
+ function createNcpSessionSummary(params) {
8063
+ return {
8064
+ sessionId: params.sessionId,
8065
+ messageCount: params.messages.length,
8066
+ updatedAt: params.updatedAt,
8067
+ status: params.status,
8068
+ ...params.metadata ? { metadata: structuredClone(params.metadata) } : {}
8069
+ };
8070
+ }
8071
+
8072
+ // src/cli/commands/ncp/ui-session-service.ts
8073
+ function applyLimit(items, limit) {
8074
+ if (!Number.isFinite(limit) || typeof limit !== "number" || limit <= 0) {
8075
+ return items;
8076
+ }
8077
+ return items.slice(0, Math.trunc(limit));
8078
+ }
8079
+ function now() {
8080
+ return (/* @__PURE__ */ new Date()).toISOString();
8081
+ }
8082
+ function buildUpdatedMetadata(params) {
8083
+ if (params.patch.metadata === null) {
8084
+ return {};
8085
+ }
8086
+ if (params.patch.metadata) {
8087
+ return structuredClone(params.patch.metadata);
8088
+ }
8089
+ return structuredClone(params.existingMetadata ?? {});
8090
+ }
8091
+ var UiSessionService = class {
8092
+ sessionStore;
8093
+ constructor(sessionManager, options = {}) {
8094
+ this.sessionStore = new NextclawAgentSessionStore(sessionManager, {
8095
+ onSessionUpdated: options.onSessionUpdated
8096
+ });
8097
+ }
8098
+ async listSessions(options) {
8099
+ const sessions = await this.sessionStore.listSessions();
8100
+ return applyLimit(
8101
+ sessions.map(
8102
+ (session) => createNcpSessionSummary({
8103
+ sessionId: session.sessionId,
8104
+ messages: session.messages,
8105
+ updatedAt: session.updatedAt,
8106
+ status: "idle",
8107
+ metadata: session.metadata
8108
+ })
8109
+ ),
8110
+ options?.limit
8111
+ );
8112
+ }
8113
+ async listSessionMessages(sessionId, options) {
8114
+ const session = await this.sessionStore.getSession(sessionId);
8115
+ if (!session) {
8116
+ return [];
8117
+ }
8118
+ return applyLimit(session.messages.map((message) => structuredClone(message)), options?.limit);
8119
+ }
8120
+ async getSession(sessionId) {
8121
+ const session = await this.sessionStore.getSession(sessionId);
8122
+ if (!session) {
8123
+ return null;
8124
+ }
8125
+ return createNcpSessionSummary({
8126
+ sessionId,
8127
+ messages: session.messages,
8128
+ updatedAt: session.updatedAt,
8129
+ status: "idle",
8130
+ metadata: session.metadata
8131
+ });
8132
+ }
8133
+ async updateSession(sessionId, patch) {
8134
+ const session = await this.sessionStore.getSession(sessionId);
8135
+ if (!session) {
8136
+ return null;
8137
+ }
8138
+ await this.sessionStore.saveSession({
8139
+ sessionId,
8140
+ messages: session.messages.map((message) => structuredClone(message)),
8141
+ updatedAt: now(),
8142
+ metadata: buildUpdatedMetadata({
8143
+ existingMetadata: session.metadata,
8144
+ patch
8145
+ })
8146
+ });
8147
+ return await this.getSession(sessionId);
8148
+ }
8149
+ async deleteSession(sessionId) {
8150
+ await this.sessionStore.deleteSession(sessionId);
8151
+ }
8152
+ };
8153
+
8154
+ // src/cli/commands/service-deferred-ncp-session-service.ts
8155
+ function createDeferredUiNcpSessionService(fallbackService) {
8156
+ let activeService = null;
8157
+ const resolveService = () => activeService ?? fallbackService;
8158
+ const service = {
8159
+ listSessions: (options) => resolveService().listSessions(options),
8160
+ listSessionMessages: (sessionId, options) => resolveService().listSessionMessages(sessionId, options),
8161
+ getSession: (sessionId) => resolveService().getSession(sessionId),
8162
+ updateSession: (sessionId, patch) => resolveService().updateSession(sessionId, patch),
8163
+ deleteSession: (sessionId) => resolveService().deleteSession(sessionId)
8164
+ };
8165
+ return {
8166
+ service,
8167
+ activate(nextService) {
8168
+ activeService = nextService;
8169
+ },
8170
+ clear() {
8171
+ activeService = null;
8172
+ },
8173
+ isReady() {
8174
+ return activeService !== null;
8175
+ }
8176
+ };
8177
+ }
8178
+
8179
+ // src/cli/commands/service-ncp-session-realtime-bridge.ts
8180
+ function createServiceNcpSessionRealtimeBridge(params) {
8181
+ let publishUiEvent = params.publishUiEvent;
8182
+ let publishSessionChange = async (_sessionKey) => {
8183
+ };
8184
+ const persistedSessionService = new UiSessionService(params.sessionManager, {
8185
+ onSessionUpdated: (sessionKey) => {
8186
+ void publishSessionChange(sessionKey);
8187
+ }
8188
+ });
8189
+ const deferredSessionService = createDeferredUiNcpSessionService(persistedSessionService);
8190
+ publishSessionChange = async (sessionKey) => {
8191
+ await createNcpSessionRealtimeChangePublisher({
8192
+ sessionApi: deferredSessionService.service,
8193
+ publishUiEvent
8194
+ }).publishSessionChange(sessionKey);
8195
+ };
8196
+ return {
8197
+ sessionService: deferredSessionService.service,
8198
+ deferredSessionService,
8199
+ publishSessionChange,
8200
+ setUiEventPublisher(nextPublishUiEvent) {
8201
+ publishUiEvent = nextPublishUiEvent;
8202
+ },
8203
+ clear() {
8204
+ deferredSessionService.clear();
8205
+ }
8206
+ };
8207
+ }
8208
+
8108
8209
  // src/cli/commands/plugin-registry-loader.ts
8109
8210
  import {
8110
8211
  discoverPluginStatusReport,
@@ -8727,7 +8828,7 @@ var ServiceCommands = class {
8727
8828
  };
8728
8829
  let runtimeState = null;
8729
8830
  const bootstrapStatus = createBootstrapStatus(shellContext.config.remote.enabled);
8730
- const ncpSessionService = new UiSessionService(shellContext.sessionManager, { onSessionUpdated: (sessionKey) => uiStartup?.publish({ type: "session.updated", payload: { sessionKey } }) });
8831
+ const ncpSessionRealtimeBridge = createServiceNcpSessionRealtimeBridge({ sessionManager: shellContext.sessionManager });
8731
8832
  const marketplaceInstaller = new ServiceMarketplaceInstaller({ applyLiveConfigReload, runCliSubcommand: (args) => this.runCliSubcommand(args), installBuiltinSkill: (slug, force) => this.installBuiltinMarketplaceSkill(slug, force) }).createInstaller();
8732
8833
  const remoteAccess = createRemoteAccessHost({ serviceCommands: this, requestRestart: this.deps.requestRestart, uiConfig: shellContext.uiConfig, remoteModule: shellContext.remoteModule });
8733
8834
  const uiStartup = await measureStartupAsync(
@@ -8746,9 +8847,10 @@ var ServiceCommands = class {
8746
8847
  getBootstrapStatus: () => bootstrapStatus.getStatus(),
8747
8848
  openBrowserWindow: shellContext.uiConfig.open,
8748
8849
  applyLiveConfigReload,
8749
- ncpSessionService
8850
+ ncpSessionService: ncpSessionRealtimeBridge.sessionService
8750
8851
  })
8751
8852
  );
8853
+ ncpSessionRealtimeBridge.setUiEventPublisher(uiStartup?.publish);
8752
8854
  bootstrapStatus.markShellReady();
8753
8855
  await waitForNextTick();
8754
8856
  const gateway = measureStartupSync(
@@ -8770,10 +8872,7 @@ var ServiceCommands = class {
8770
8872
  uiStartup?.publish({ type: "config.updated", payload: { path: "channels" } });
8771
8873
  uiStartup?.publish({ type: "config.updated", payload: { path: "plugins" } });
8772
8874
  configureGatewayPluginRuntime({ gateway, state: gatewayRuntimeState, getLiveUiNcpAgent: () => this.liveUiNcpAgent });
8773
- wireSystemSessionUpdatedPublisher({
8774
- runtimePool: gateway.runtimePool,
8775
- publishUiEvent: uiStartup?.publish
8776
- });
8875
+ wireSystemSessionUpdatedPublisher({ runtimePool: gateway.runtimePool, publishUiEvent: uiStartup?.publish });
8777
8876
  console.log("\u2713 Capability hydration: scheduled in background");
8778
8877
  await measureStartupAsync(
8779
8878
  "service.start_gateway_support_services",
@@ -8794,15 +8893,14 @@ var ServiceCommands = class {
8794
8893
  setLiveUiNcpAgent: (ncpAgent) => {
8795
8894
  this.liveUiNcpAgent = ncpAgent;
8796
8895
  },
8797
- wakeFromRestartSentinel: async () => {
8798
- await this.wakeFromRestartSentinel({ bus: gateway.bus, sessionManager: gateway.sessionManager });
8799
- }
8896
+ wakeFromRestartSentinel: async () => await this.wakeFromRestartSentinel({ bus: gateway.bus, sessionManager: gateway.sessionManager })
8800
8897
  });
8801
8898
  logStartupTrace("service.start_gateway.runtime_loop_begin");
8802
8899
  await runGatewayRuntimeLoop({
8803
8900
  runtimePool: gateway.runtimePool,
8804
8901
  startDeferredStartup: () => startDeferredGatewayStartup({
8805
8902
  uiStartup,
8903
+ deferredNcpSessionService: ncpSessionRealtimeBridge.deferredSessionService,
8806
8904
  bus: gateway.bus,
8807
8905
  sessionManager: gateway.sessionManager,
8808
8906
  providerManager: gateway.providerManager,
@@ -8820,7 +8918,8 @@ var ServiceCommands = class {
8820
8918
  startPluginGateways: deferredGatewayStartupHooks.startPluginGateways,
8821
8919
  startChannels: deferredGatewayStartupHooks.startChannels,
8822
8920
  wakeFromRestartSentinel: deferredGatewayStartupHooks.wakeFromRestartSentinel,
8823
- onNcpAgentReady: deferredGatewayStartupHooks.onNcpAgentReady
8921
+ onNcpAgentReady: deferredGatewayStartupHooks.onNcpAgentReady,
8922
+ publishSessionChange: ncpSessionRealtimeBridge.publishSessionChange
8824
8923
  }),
8825
8924
  onDeferredStartupError: (error) => {
8826
8925
  const message = error instanceof Error ? error.message : String(error);
@@ -8833,6 +8932,7 @@ var ServiceCommands = class {
8833
8932
  cleanup: async () => {
8834
8933
  this.applyLiveConfigReload = null;
8835
8934
  this.liveUiNcpAgent = null;
8935
+ ncpSessionRealtimeBridge.clear();
8836
8936
  await uiStartup?.deferredNcpAgent.close();
8837
8937
  await gateway.remoteModule?.stop();
8838
8938
  await stopPluginChannelGateways2(runtimeState?.pluginGatewayHandles ?? []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.16.14",
3
+ "version": "0.16.15",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -39,16 +39,16 @@
39
39
  "chokidar": "^3.6.0",
40
40
  "commander": "^12.1.0",
41
41
  "yaml": "^2.8.1",
42
+ "@nextclaw/core": "0.11.6",
43
+ "@nextclaw/ncp-toolkit": "0.4.6",
44
+ "@nextclaw/mcp": "0.1.53",
45
+ "@nextclaw/remote": "0.1.61",
42
46
  "@nextclaw/ncp-agent-runtime": "0.3.0",
47
+ "@nextclaw/ncp-mcp": "0.1.53",
48
+ "@nextclaw/server": "0.11.9",
49
+ "@nextclaw/openclaw-compat": "0.3.43",
43
50
  "@nextclaw/ncp": "0.4.0",
44
- "@nextclaw/core": "0.11.5",
45
- "@nextclaw/ncp-mcp": "0.1.52",
46
- "@nextclaw/remote": "0.1.60",
47
- "@nextclaw/ncp-toolkit": "0.4.5",
48
- "@nextclaw/mcp": "0.1.52",
49
- "@nextclaw/runtime": "0.2.19",
50
- "@nextclaw/server": "0.11.8",
51
- "@nextclaw/openclaw-compat": "0.3.42"
51
+ "@nextclaw/runtime": "0.2.20"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^20.17.6",
@@ -57,7 +57,7 @@
57
57
  "tsx": "^4.19.2",
58
58
  "typescript": "^5.6.3",
59
59
  "vitest": "^2.1.2",
60
- "@nextclaw/ui": "0.11.9"
60
+ "@nextclaw/ui": "0.11.10"
61
61
  },
62
62
  "scripts": {
63
63
  "dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",