@nextclaw/server 0.5.19 → 0.5.20
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 +12 -1
- package/dist/index.js +31 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -77,11 +77,19 @@ type SessionMessageView = {
|
|
|
77
77
|
tool_calls?: Array<Record<string, unknown>>;
|
|
78
78
|
reasoning_content?: string;
|
|
79
79
|
};
|
|
80
|
+
type SessionEventView = {
|
|
81
|
+
seq: number;
|
|
82
|
+
type: string;
|
|
83
|
+
timestamp: string;
|
|
84
|
+
message?: SessionMessageView;
|
|
85
|
+
};
|
|
80
86
|
type SessionHistoryView = {
|
|
81
87
|
key: string;
|
|
82
88
|
totalMessages: number;
|
|
89
|
+
totalEvents: number;
|
|
83
90
|
metadata: Record<string, unknown>;
|
|
84
91
|
messages: SessionMessageView[];
|
|
92
|
+
events: SessionEventView[];
|
|
85
93
|
};
|
|
86
94
|
type SessionPatchUpdate = {
|
|
87
95
|
label?: string | null;
|
|
@@ -209,6 +217,9 @@ type ChatTurnResult = {
|
|
|
209
217
|
type ChatTurnStreamEvent = {
|
|
210
218
|
type: "delta";
|
|
211
219
|
delta: string;
|
|
220
|
+
} | {
|
|
221
|
+
type: "session_event";
|
|
222
|
+
event: SessionEventView;
|
|
212
223
|
} | {
|
|
213
224
|
type: "final";
|
|
214
225
|
result: ChatTurnResult;
|
|
@@ -579,4 +590,4 @@ declare function deleteSession(configPath: string, key: string): boolean;
|
|
|
579
590
|
declare function updateRuntime(configPath: string, patch: RuntimeConfigUpdate): Pick<ConfigView, "agents" | "bindings" | "session">;
|
|
580
591
|
declare function updateSecrets(configPath: string, patch: SecretsConfigUpdate): SecretsView;
|
|
581
592
|
|
|
582
|
-
export { type AgentBindingView, type AgentProfileView, type ApiError, type ApiResponse, type BindingPeerView, type ChannelSpecView, type ChatTurnRequest, type ChatTurnResult, type ChatTurnStreamEvent, type ChatTurnView, 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, type MarketplaceApiConfig, type MarketplaceInstallKind, type MarketplaceInstallSkillParams, type MarketplaceInstallSpec, type MarketplaceInstalledRecord, type MarketplaceInstalledView, type MarketplaceInstaller, type MarketplaceItemSummary, type MarketplaceItemType, type MarketplaceItemView, type MarketplaceListView, type MarketplacePluginInstallRequest, type MarketplacePluginInstallResult, type MarketplacePluginManageAction, type MarketplacePluginManageRequest, type MarketplacePluginManageResult, type MarketplaceRecommendationView, type MarketplaceSkillInstallRequest, type MarketplaceSkillInstallResult, type MarketplaceSkillManageAction, type MarketplaceSkillManageRequest, type MarketplaceSkillManageResult, type MarketplaceSort, type ProviderConfigUpdate, type ProviderConfigView, type ProviderSpecView, type RuntimeConfigUpdate, type SecretProviderEnvView, type SecretProviderExecView, type SecretProviderFileView, type SecretProviderView, type SecretRefView, type SecretSourceView, type SecretsConfigUpdate, type SecretsView, type SessionConfigView, type SessionEntryView, type SessionHistoryView, type SessionMessageView, type SessionPatchUpdate, type SessionsListView, type UiChatRuntime, type UiServerEvent, type UiServerHandle, type UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createUiRouter, deleteSession, executeConfigAction, getSessionHistory, listSessions, loadConfigOrDefault, patchSession, startUiServer, updateChannel, updateModel, updateProvider, updateRuntime, updateSecrets };
|
|
593
|
+
export { type AgentBindingView, type AgentProfileView, type ApiError, type ApiResponse, type BindingPeerView, type ChannelSpecView, type ChatTurnRequest, type ChatTurnResult, type ChatTurnStreamEvent, type ChatTurnView, 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, type MarketplaceApiConfig, type MarketplaceInstallKind, type MarketplaceInstallSkillParams, type MarketplaceInstallSpec, type MarketplaceInstalledRecord, type MarketplaceInstalledView, type MarketplaceInstaller, type MarketplaceItemSummary, type MarketplaceItemType, type MarketplaceItemView, type MarketplaceListView, type MarketplacePluginInstallRequest, type MarketplacePluginInstallResult, type MarketplacePluginManageAction, type MarketplacePluginManageRequest, type MarketplacePluginManageResult, type MarketplaceRecommendationView, type MarketplaceSkillInstallRequest, type MarketplaceSkillInstallResult, type MarketplaceSkillManageAction, type MarketplaceSkillManageRequest, type MarketplaceSkillManageResult, type MarketplaceSort, type ProviderConfigUpdate, type ProviderConfigView, type ProviderSpecView, type RuntimeConfigUpdate, 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, type SessionsListView, type UiChatRuntime, type UiServerEvent, type UiServerHandle, type UiServerOptions, buildConfigMeta, buildConfigSchemaView, buildConfigView, createUiRouter, deleteSession, executeConfigAction, getSessionHistory, listSessions, loadConfigOrDefault, patchSession, startUiServer, updateChannel, updateModel, updateProvider, updateRuntime, updateSecrets };
|
package/dist/index.js
CHANGED
|
@@ -490,9 +490,13 @@ function getSessionHistory(configPath, key, limit) {
|
|
|
490
490
|
const safeLimit = typeof limit === "number" ? Math.min(500, Math.max(1, Math.trunc(limit))) : 200;
|
|
491
491
|
const allMessages = session.messages;
|
|
492
492
|
const messages = allMessages.length > safeLimit ? allMessages.slice(-safeLimit) : allMessages;
|
|
493
|
+
const safeEventLimit = Math.min(2e3, Math.max(50, safeLimit * 4));
|
|
494
|
+
const allEvents = session.events ?? [];
|
|
495
|
+
const events = allEvents.length > safeEventLimit ? allEvents.slice(-safeEventLimit) : allEvents;
|
|
493
496
|
return {
|
|
494
497
|
key: normalizedKey,
|
|
495
498
|
totalMessages: allMessages.length,
|
|
499
|
+
totalEvents: allEvents.length,
|
|
496
500
|
metadata: session.metadata,
|
|
497
501
|
messages: messages.map((message) => {
|
|
498
502
|
const entry = {
|
|
@@ -513,6 +517,29 @@ function getSessionHistory(configPath, key, limit) {
|
|
|
513
517
|
entry.reasoning_content = message.reasoning_content;
|
|
514
518
|
}
|
|
515
519
|
return entry;
|
|
520
|
+
}),
|
|
521
|
+
events: events.map((event) => {
|
|
522
|
+
const entry = {
|
|
523
|
+
seq: event.seq,
|
|
524
|
+
type: event.type,
|
|
525
|
+
timestamp: event.timestamp
|
|
526
|
+
};
|
|
527
|
+
const message = event.data?.message;
|
|
528
|
+
if (message && typeof message === "object" && !Array.isArray(message)) {
|
|
529
|
+
const typed = message;
|
|
530
|
+
if (typeof typed.role === "string" && typeof typed.timestamp === "string") {
|
|
531
|
+
entry.message = {
|
|
532
|
+
role: typed.role,
|
|
533
|
+
content: typed.content,
|
|
534
|
+
timestamp: typed.timestamp,
|
|
535
|
+
...typeof typed.name === "string" ? { name: typed.name } : {},
|
|
536
|
+
...typeof typed.tool_call_id === "string" ? { tool_call_id: typed.tool_call_id } : {},
|
|
537
|
+
...Array.isArray(typed.tool_calls) ? { tool_calls: typed.tool_calls } : {},
|
|
538
|
+
...typeof typed.reasoning_content === "string" ? { reasoning_content: typed.reasoning_content } : {}
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return entry;
|
|
516
543
|
})
|
|
517
544
|
};
|
|
518
545
|
}
|
|
@@ -1696,6 +1723,10 @@ function createUiRouter(options) {
|
|
|
1696
1723
|
}
|
|
1697
1724
|
continue;
|
|
1698
1725
|
}
|
|
1726
|
+
if (typed.type === "session_event") {
|
|
1727
|
+
push("session_event", typed.event);
|
|
1728
|
+
continue;
|
|
1729
|
+
}
|
|
1699
1730
|
if (typed.type === "final") {
|
|
1700
1731
|
const response = buildChatTurnView({
|
|
1701
1732
|
result: typed.result,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/server",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Nextclaw UI/API server.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@nextclaw/openclaw-compat": "^0.1.28",
|
|
19
19
|
"hono": "^4.6.2",
|
|
20
20
|
"ws": "^8.18.0",
|
|
21
|
-
"@nextclaw/core": "^0.6.
|
|
21
|
+
"@nextclaw/core": "^0.6.37"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^20.17.6",
|