@nextclaw/kernel 0.1.7 → 0.1.8
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 +1 -14
- package/dist/index.js +201 -135
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -140,11 +140,6 @@ declare class ExtensionManager {
|
|
|
140
140
|
getUiMetadata: () => PluginUiMetadata[];
|
|
141
141
|
toConfigView: (config: Config) => Config;
|
|
142
142
|
mergeConfigView: (current: Config, nextConfigView: Record<string, unknown>) => Config;
|
|
143
|
-
resolveMessageToolHints: (params: {
|
|
144
|
-
channel?: string | null;
|
|
145
|
-
config?: Config;
|
|
146
|
-
accountId?: string | null;
|
|
147
|
-
}) => string[];
|
|
148
143
|
}
|
|
149
144
|
//#endregion
|
|
150
145
|
//#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
|
|
@@ -895,20 +890,12 @@ declare class NextclawNcpToolRegistry implements NcpToolRegistry {
|
|
|
895
890
|
private isToolAvailable;
|
|
896
891
|
}
|
|
897
892
|
declare function resolveAgentHandoffDepth(metadata: Record<string, unknown>): number;
|
|
898
|
-
declare function readAccountIdForHints(metadata: Record<string, unknown>, sessionMetadata: Record<string, unknown>): string | undefined;
|
|
899
893
|
//#endregion
|
|
900
894
|
//#region src/features/native-runtime/services/nextclaw-ncp-context-builder.service.d.ts
|
|
901
|
-
type MessageToolHintsResolver = (params: {
|
|
902
|
-
sessionKey: string;
|
|
903
|
-
channel: string;
|
|
904
|
-
chatId: string;
|
|
905
|
-
accountId?: string | null;
|
|
906
|
-
}) => string[];
|
|
907
895
|
type NextclawNcpContextBuilderOptions = {
|
|
908
896
|
sessionManager: SessionManager;
|
|
909
897
|
toolRegistry: NextclawNcpToolRegistry;
|
|
910
898
|
getConfig: () => Config;
|
|
911
|
-
resolveMessageToolHints?: MessageToolHintsResolver;
|
|
912
899
|
assetStore?: LocalAssetStore | null;
|
|
913
900
|
};
|
|
914
901
|
declare class NextclawNcpContextBuilder implements NcpContextBuilder {
|
|
@@ -976,4 +963,4 @@ declare function createNcpSessionSummary(params: {
|
|
|
976
963
|
declare function toNcpMessages(sessionId: string, messages: SessionMessage[]): NcpMessage[];
|
|
977
964
|
declare function resolveLegacyEventType(message: SessionMessage): string;
|
|
978
965
|
//#endregion
|
|
979
|
-
export { AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE, AgentId, AgentManager, AgentRecord, AgentRuntimeContribution, AgentRuntimeEndpoint, AgentRuntimeEntry, type AgentRuntimeHandle, AgentRuntimeManager, AgentRuntimeManagerOptions, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionMessageRequest, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AutomationId, AutomationManager, AutomationManagerOptions, BuiltinNarpRuntimeRegistrationService, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ContextCompactionPendingWork, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextWindowOwner, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_LEARNING_LOOP_TOOL_CALL_THRESHOLD, DirectPromptDispatchParams, ExtensionContributions, ExtensionManager, GatewayInboundLoopRuntime, InstallationKind, LEARNING_LOOP_DISABLED_METADATA_KEY, LEARNING_LOOP_LAST_REQUESTED_AT_METADATA_KEY, LEARNING_LOOP_LAST_REVIEW_SESSION_ID_METADATA_KEY, LEARNING_LOOP_LAST_TOOL_CALL_COUNT_METADATA_KEY, LEARNING_LOOP_REQUESTED_SKILLS, LEARNING_LOOP_SOURCE_SESSION_ID_METADATA_KEY, LearningLoopManager, LearningLoopManagerOptions, LearningLoopRuntimeConfig, LearningLoopSessionRequester, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NativeAgentRuntimeFactory, NativeAgentRuntimeFactoryOptions, NativeRuntimeFactory, NcpRunnerAgent, NcpSessionApiService, NcpSessionApiServiceOptions, NextclawExtensionRegistry, NextclawKernel, NextclawKernelOptions, NextclawNcpContextBuilder, NextclawNcpToolRegistry, PluginRuntimeRegistrationController, ProviderManagerNcpLLMApi, RunPromptOverNcpParams, SessionId, SkillId, SkillManager, SkillRecord, StreamPromptOverNcpParams, TaskId, ToolId, ToolManager, ToolRecord, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, UpdateToolCallResult, buildLearningLoopTask, buildLlmUsageSummary, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeHandle, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, createNcpSessionSummary, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isReplyCapableChannel, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel,
|
|
966
|
+
export { AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE, AgentId, AgentManager, AgentRecord, AgentRuntimeContribution, AgentRuntimeEndpoint, AgentRuntimeEntry, type AgentRuntimeHandle, AgentRuntimeManager, AgentRuntimeManagerOptions, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionMessageRequest, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AutomationId, AutomationManager, AutomationManagerOptions, BuiltinNarpRuntimeRegistrationService, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ContextCompactionPendingWork, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextWindowOwner, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_LEARNING_LOOP_TOOL_CALL_THRESHOLD, DirectPromptDispatchParams, ExtensionContributions, ExtensionManager, GatewayInboundLoopRuntime, InstallationKind, LEARNING_LOOP_DISABLED_METADATA_KEY, LEARNING_LOOP_LAST_REQUESTED_AT_METADATA_KEY, LEARNING_LOOP_LAST_REVIEW_SESSION_ID_METADATA_KEY, LEARNING_LOOP_LAST_TOOL_CALL_COUNT_METADATA_KEY, LEARNING_LOOP_REQUESTED_SKILLS, LEARNING_LOOP_SOURCE_SESSION_ID_METADATA_KEY, LearningLoopManager, LearningLoopManagerOptions, LearningLoopRuntimeConfig, LearningLoopSessionRequester, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NativeAgentRuntimeFactory, NativeAgentRuntimeFactoryOptions, NativeRuntimeFactory, NcpRunnerAgent, NcpSessionApiService, NcpSessionApiServiceOptions, NextclawExtensionRegistry, NextclawKernel, NextclawKernelOptions, NextclawNcpContextBuilder, NextclawNcpToolRegistry, PluginRuntimeRegistrationController, ProviderManagerNcpLLMApi, RunPromptOverNcpParams, SessionId, SkillId, SkillManager, SkillRecord, StreamPromptOverNcpParams, TaskId, ToolId, ToolManager, ToolRecord, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, UpdateToolCallResult, buildLearningLoopTask, buildLlmUsageSummary, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeHandle, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, createNcpSessionSummary, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isReplyCapableChannel, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, readLearningLoopRuntimeConfig, resolveAgentHandoffDepth, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveLegacyEventType, runGatewayInboundLoop, runPromptOverNcp, sanitizeLlmUsage, serializeUnsignedUpdateManifest, streamPromptOverNcp, toNcpMessages, waitForAgentRuntimeSessionReply };
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { StdioRuntimeConfigResolver, StdioRuntimeNcpAgentRuntime, probeStdioRunt
|
|
|
13
13
|
import { buildHermesAcpBridgeLaunchEnv, isHermesAcpRuntimeConfig } from "@nextclaw/nextclaw-hermes-acp-bridge";
|
|
14
14
|
import { McpRegistryService, McpServerLifecycleManager } from "@nextclaw/mcp";
|
|
15
15
|
import { McpNcpToolRegistryAdapter } from "@nextclaw/ncp-mcp";
|
|
16
|
-
import { getPluginChannelBindings, getPluginUiMetadataFromRegistry, mergePluginConfigView,
|
|
16
|
+
import { getPluginChannelBindings, getPluginUiMetadataFromRegistry, mergePluginConfigView, toPluginConfigView } from "@nextclaw/openclaw-compat";
|
|
17
17
|
//#region src/managers/agent.manager.ts
|
|
18
18
|
var AgentManager = class {
|
|
19
19
|
listAgents = () => {
|
|
@@ -2662,9 +2662,6 @@ function resolveAgentHandoffDepth(metadata) {
|
|
|
2662
2662
|
if (!Number.isFinite(rawDepth) || rawDepth < 0) return 0;
|
|
2663
2663
|
return Math.trunc(rawDepth);
|
|
2664
2664
|
}
|
|
2665
|
-
function readAccountIdForHints(metadata, sessionMetadata) {
|
|
2666
|
-
return readMetadataAccountId(metadata, sessionMetadata);
|
|
2667
|
-
}
|
|
2668
2665
|
//#endregion
|
|
2669
2666
|
//#region src/features/native-runtime/services/nextclaw-ncp-context-builder.service.ts
|
|
2670
2667
|
const TIME_HINT_TRIGGER_PATTERNS = [/\b(now|right now|current time|what time|today|tonight|tomorrow|yesterday|this morning|this afternoon|this evening|date)\b/i, /(现在|此刻|当前时间|现在几点|几点了|今天|今晚|今早|今晨|明天|昨天|日期)/];
|
|
@@ -2824,7 +2821,6 @@ var NextclawNcpContextBuilder = class {
|
|
|
2824
2821
|
workspace: effectiveWorkspace
|
|
2825
2822
|
});
|
|
2826
2823
|
return {
|
|
2827
|
-
accountId: readAccountIdForHints(requestMetadata, session.metadata),
|
|
2828
2824
|
channel,
|
|
2829
2825
|
chatId,
|
|
2830
2826
|
config,
|
|
@@ -2841,13 +2837,7 @@ var NextclawNcpContextBuilder = class {
|
|
|
2841
2837
|
};
|
|
2842
2838
|
};
|
|
2843
2839
|
buildModelMessages = (input, _options, runContext) => {
|
|
2844
|
-
const {
|
|
2845
|
-
const messageToolHints = this.options.resolveMessageToolHints?.({
|
|
2846
|
-
sessionKey: input.sessionId,
|
|
2847
|
-
channel,
|
|
2848
|
-
chatId,
|
|
2849
|
-
accountId: accountId ?? null
|
|
2850
|
-
});
|
|
2840
|
+
const { channel, chatId, config, currentTurn, effectiveModel, effectiveWorkspace, profile, requestedSkills, runtimeThinking, session } = runContext;
|
|
2851
2841
|
const toolDefinitions = this.options.toolRegistry.getToolDefinitions();
|
|
2852
2842
|
const additionalSystemSections = [buildSessionOrchestrationSection(), buildMinimalSystemExecutionPrompt(effectiveModel)].filter(Boolean);
|
|
2853
2843
|
const contextBuilder = new ContextBuilder(effectiveWorkspace, config.agents.context, {
|
|
@@ -2869,7 +2859,6 @@ var NextclawNcpContextBuilder = class {
|
|
|
2869
2859
|
sessionKey: input.sessionId,
|
|
2870
2860
|
thinkingLevel: runtimeThinking,
|
|
2871
2861
|
skillNames: requestedSkills.selectors,
|
|
2872
|
-
messageToolHints,
|
|
2873
2862
|
availableTools: buildToolCatalogEntries(toolDefinitions),
|
|
2874
2863
|
additionalSystemSections
|
|
2875
2864
|
});
|
|
@@ -3038,11 +3027,6 @@ var NativeAgentRuntimeFactory = class {
|
|
|
3038
3027
|
sessionManager: this.options.sessions,
|
|
3039
3028
|
toolRegistry,
|
|
3040
3029
|
getConfig: this.options.configManager.loadConfig,
|
|
3041
|
-
resolveMessageToolHints: ({ channel, accountId }) => this.options.extensions.resolveMessageToolHints({
|
|
3042
|
-
channel,
|
|
3043
|
-
config: this.options.configManager.loadConfig(),
|
|
3044
|
-
accountId
|
|
3045
|
-
}),
|
|
3046
3030
|
assetStore: this.options.assetStore
|
|
3047
3031
|
}),
|
|
3048
3032
|
llmApi: new ProviderManagerNcpLLMApi(this.observedProviderManager),
|
|
@@ -3091,11 +3075,6 @@ var NativeAgentRuntimeFactory = class {
|
|
|
3091
3075
|
sessionManager: this.options.sessions,
|
|
3092
3076
|
toolRegistry: this.createToolRegistry(this.options.providerManager),
|
|
3093
3077
|
getConfig: this.options.configManager.loadConfig,
|
|
3094
|
-
resolveMessageToolHints: ({ channel, accountId }) => this.options.extensions.resolveMessageToolHints({
|
|
3095
|
-
channel,
|
|
3096
|
-
config: this.options.configManager.loadConfig(),
|
|
3097
|
-
accountId
|
|
3098
|
-
}),
|
|
3099
3078
|
assetStore: this.options.assetStore
|
|
3100
3079
|
}).prepare(input).tools;
|
|
3101
3080
|
};
|
|
@@ -3673,15 +3652,6 @@ var ExtensionManager = class {
|
|
|
3673
3652
|
getUiMetadata = () => this.uiMetadata;
|
|
3674
3653
|
toConfigView = (config) => toPluginConfigView(config, this.channelBindings);
|
|
3675
3654
|
mergeConfigView = (current, nextConfigView) => mergePluginConfigView(current, nextConfigView, this.channelBindings);
|
|
3676
|
-
resolveMessageToolHints = (params) => {
|
|
3677
|
-
if (!this.pluginRegistry) return [];
|
|
3678
|
-
return resolvePluginChannelMessageToolHints({
|
|
3679
|
-
registry: this.pluginRegistry,
|
|
3680
|
-
channel: params.channel,
|
|
3681
|
-
cfg: params.config,
|
|
3682
|
-
accountId: params.accountId
|
|
3683
|
-
});
|
|
3684
|
-
};
|
|
3685
3655
|
};
|
|
3686
3656
|
//#endregion
|
|
3687
3657
|
//#region src/configs/ncp-lifecycle-event.config.ts
|
|
@@ -4293,8 +4263,8 @@ var NcpSessionApiService = class {
|
|
|
4293
4263
|
if (normalizedSessionId && this.options.ncpAgentSessionStore) {
|
|
4294
4264
|
const existing = await this.options.ncpAgentSessionStore.getSession(normalizedSessionId);
|
|
4295
4265
|
if (existing) {
|
|
4296
|
-
await this.options.ncpAgentSessionStore.
|
|
4297
|
-
|
|
4266
|
+
await this.options.ncpAgentSessionStore.updateSessionMetadata({
|
|
4267
|
+
sessionId: normalizedSessionId,
|
|
4298
4268
|
metadata: buildUpdatedMetadata({
|
|
4299
4269
|
existingMetadata: existing.metadata,
|
|
4300
4270
|
patch
|
|
@@ -4369,7 +4339,16 @@ var NcpAgentLegacySessionStore = class {
|
|
|
4369
4339
|
metadata: structuredClone(record.metadata)
|
|
4370
4340
|
}));
|
|
4371
4341
|
saveSession = (sessionRecord) => this.persistSession(sessionRecord, true);
|
|
4372
|
-
|
|
4342
|
+
updateSessionMetadata = async (params) => {
|
|
4343
|
+
const { metadata, sessionId, updatedAt } = params;
|
|
4344
|
+
const session = this.sessionManager.getIfExists(sessionId);
|
|
4345
|
+
if (!session) return false;
|
|
4346
|
+
session.metadata = structuredClone(metadata);
|
|
4347
|
+
session.updatedAt = new Date(ensureIsoTimestamp(updatedAt, session.updatedAt.toISOString()));
|
|
4348
|
+
this.sessionManager.save(session);
|
|
4349
|
+
this.options.onSessionUpdated?.(sessionId);
|
|
4350
|
+
return true;
|
|
4351
|
+
};
|
|
4373
4352
|
deleteSession = (sessionId) => {
|
|
4374
4353
|
const existing = this.getSession(sessionId);
|
|
4375
4354
|
if (!existing) return null;
|
|
@@ -4415,7 +4394,7 @@ var NcpAgentSessionStoreAdapter = class {
|
|
|
4415
4394
|
const { event, session } = params;
|
|
4416
4395
|
if (!await journalStore.hasSession(session.sessionId)) {
|
|
4417
4396
|
const legacySession = this.legacyStore.getSession(session.sessionId);
|
|
4418
|
-
if (legacySession) await journalStore.
|
|
4397
|
+
if (legacySession) await journalStore.materializeSession(legacySession);
|
|
4419
4398
|
}
|
|
4420
4399
|
await journalStore.appendSessionEvent(params);
|
|
4421
4400
|
if (isSessionSummaryRefreshEvent(event)) this.options.onSessionUpdated?.(session.sessionId);
|
|
@@ -4448,20 +4427,20 @@ var NcpAgentSessionStoreAdapter = class {
|
|
|
4448
4427
|
saveSession = async (sessionRecord) => {
|
|
4449
4428
|
const journalStore = this.options.journalStore;
|
|
4450
4429
|
if (journalStore && await journalStore.hasSession(sessionRecord.sessionId)) {
|
|
4451
|
-
await journalStore.
|
|
4430
|
+
await journalStore.materializeSession(sessionRecord);
|
|
4452
4431
|
this.options.onSessionUpdated?.(sessionRecord.sessionId);
|
|
4453
4432
|
return;
|
|
4454
4433
|
}
|
|
4455
4434
|
await this.legacyStore.saveSession(sessionRecord);
|
|
4456
4435
|
};
|
|
4457
|
-
|
|
4436
|
+
updateSessionMetadata = async (params) => {
|
|
4458
4437
|
const journalStore = this.options.journalStore;
|
|
4459
|
-
if (journalStore && await journalStore.hasSession(
|
|
4460
|
-
await journalStore.
|
|
4461
|
-
this.options.onSessionUpdated?.(
|
|
4462
|
-
return;
|
|
4438
|
+
if (journalStore && await journalStore.hasSession(params.sessionId)) {
|
|
4439
|
+
const updated = await journalStore.updateSessionMetadata(params);
|
|
4440
|
+
if (updated) this.options.onSessionUpdated?.(params.sessionId);
|
|
4441
|
+
return updated;
|
|
4463
4442
|
}
|
|
4464
|
-
|
|
4443
|
+
return this.legacyStore.updateSessionMetadata(params);
|
|
4465
4444
|
};
|
|
4466
4445
|
deleteSession = async (sessionId) => {
|
|
4467
4446
|
const journalSession = await this.options.journalStore?.deleteSession(sessionId);
|
|
@@ -4485,6 +4464,7 @@ function isSessionSummaryRefreshEvent(event) {
|
|
|
4485
4464
|
}
|
|
4486
4465
|
const NCP_AGENT_SESSION_JOURNAL_INDEX_FILE = ".ncp-agent-session-index.json";
|
|
4487
4466
|
const AUTO_SESSION_LABEL_MAX_LENGTH = 64;
|
|
4467
|
+
const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
4488
4468
|
function normalizeNcpSessionId(sessionId) {
|
|
4489
4469
|
return sessionId.trim();
|
|
4490
4470
|
}
|
|
@@ -4492,15 +4472,13 @@ function safeNcpSessionFilename(value) {
|
|
|
4492
4472
|
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
4493
4473
|
}
|
|
4494
4474
|
function normalizeNcpAgentId(agentId) {
|
|
4495
|
-
|
|
4496
|
-
return normalized ? normalized : void 0;
|
|
4475
|
+
return agentId?.trim().toLowerCase() || void 0;
|
|
4497
4476
|
}
|
|
4498
4477
|
function isRecord$1(value) {
|
|
4499
4478
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4500
4479
|
}
|
|
4501
4480
|
function toIsoString(value, fallback) {
|
|
4502
|
-
|
|
4503
|
-
const parsed = Date.parse(value);
|
|
4481
|
+
const parsed = typeof value === "string" ? Date.parse(value) : NaN;
|
|
4504
4482
|
return Number.isFinite(parsed) ? new Date(parsed).toISOString() : fallback;
|
|
4505
4483
|
}
|
|
4506
4484
|
function createNcpAgentSessionSummary(record) {
|
|
@@ -4535,9 +4513,9 @@ function upsertNcpAgentSessionSummaryEvent(params) {
|
|
|
4535
4513
|
...current?.metadata ? structuredClone(current.metadata) : {},
|
|
4536
4514
|
...session.metadata ? structuredClone(session.metadata) : {}
|
|
4537
4515
|
};
|
|
4538
|
-
const label = readOptionalText(metadata.label) ?? readSummaryLabelFromEvent(event);
|
|
4539
|
-
if (label) metadata.label = truncateLabel(label);
|
|
4540
4516
|
const eventMessage = readMessageFromSummaryEvent(event);
|
|
4517
|
+
const label = readOptionalText(metadata.label) ?? (eventMessage?.role === "user" ? resolveAutoSessionLabel([eventMessage]) : null);
|
|
4518
|
+
if (label) metadata.label = truncateLabel(label);
|
|
4541
4519
|
const messageCount = current ? current.messageCount + (eventMessage ? 1 : 0) : eventMessage ? 1 : 0;
|
|
4542
4520
|
const lastMessageAt = readMessageTimestamp(eventMessage) ?? current?.lastMessageAt;
|
|
4543
4521
|
return {
|
|
@@ -4559,27 +4537,26 @@ async function replayNcpAgentSessionEvents(events) {
|
|
|
4559
4537
|
}
|
|
4560
4538
|
function createReplayEvent(event) {
|
|
4561
4539
|
const replayEvent = structuredClone(event);
|
|
4562
|
-
|
|
4540
|
+
const replayMessage = readMessageFromSummaryEvent(replayEvent);
|
|
4541
|
+
if (replayMessage?.role === "assistant" && (replayMessage.status === "pending" || replayMessage.status === "streaming")) replayMessage.status = "final";
|
|
4542
|
+
if (replayEvent.type === "session.snapshot.message" || replayEvent.type === NcpEventType.MessageCompleted) return {
|
|
4563
4543
|
type: NcpEventType.MessageSent,
|
|
4564
4544
|
payload: replayEvent.payload
|
|
4565
4545
|
};
|
|
4566
|
-
if (replayEvent.type === NcpEventType.MessageSent && replayEvent.payload.message.role === "assistant" && (replayEvent.payload.message.status === "pending" || replayEvent.payload.message.status === "streaming")) replayEvent.payload.message.status = "final";
|
|
4567
4546
|
return replayEvent;
|
|
4568
4547
|
}
|
|
4569
4548
|
function readNcpSessionSummaryActivityAt(summary) {
|
|
4570
4549
|
return summary.lastMessageAt ?? summary.createdAt ?? summary.updatedAt;
|
|
4571
4550
|
}
|
|
4572
4551
|
function readMessageTimestamp(message) {
|
|
4573
|
-
return
|
|
4552
|
+
return toIsoString(message?.timestamp, "") || void 0;
|
|
4574
4553
|
}
|
|
4575
4554
|
function truncateLabel(value) {
|
|
4576
4555
|
const chars = Array.from(value);
|
|
4577
4556
|
return chars.length <= AUTO_SESSION_LABEL_MAX_LENGTH ? value : `${chars.slice(0, AUTO_SESSION_LABEL_MAX_LENGTH).join("")}...`;
|
|
4578
4557
|
}
|
|
4579
4558
|
function readOptionalText(value) {
|
|
4580
|
-
|
|
4581
|
-
const trimmed = value.trim();
|
|
4582
|
-
return trimmed ? trimmed : null;
|
|
4559
|
+
return (typeof value === "string" ? value.trim() : "") || null;
|
|
4583
4560
|
}
|
|
4584
4561
|
function resolveAutoSessionLabel(messages) {
|
|
4585
4562
|
for (const message of messages) {
|
|
@@ -4595,14 +4572,121 @@ function readMessageFromSummaryEvent(event) {
|
|
|
4595
4572
|
switch (event.type) {
|
|
4596
4573
|
case NcpEventType.MessageSent: return event.payload.message;
|
|
4597
4574
|
case NcpEventType.MessageCompleted: return event.payload.message;
|
|
4575
|
+
case NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE: return event.payload.message;
|
|
4598
4576
|
default: return;
|
|
4599
4577
|
}
|
|
4600
4578
|
}
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4579
|
+
//#endregion
|
|
4580
|
+
//#region src/stores/ncp-agent-session-metadata.store.ts
|
|
4581
|
+
var NcpAgentSessionMetadataStore = class {
|
|
4582
|
+
constructor(journalDir) {
|
|
4583
|
+
this.journalDir = journalDir;
|
|
4584
|
+
}
|
|
4585
|
+
write = async (record) => {
|
|
4586
|
+
await mkdir(this.journalDir, { recursive: true });
|
|
4587
|
+
await writeFile(this.metadataPath(record.sessionId), `${this.serializeMetadata(record)}\n`, "utf-8");
|
|
4588
|
+
};
|
|
4589
|
+
read = async (sessionId, fallback) => {
|
|
4590
|
+
try {
|
|
4591
|
+
const parsed = JSON.parse(await readFile(this.metadataPath(sessionId), "utf-8"));
|
|
4592
|
+
if (!isRecord$1(parsed) || parsed._type !== "metadata") return fallback;
|
|
4593
|
+
const createdAt = toIsoString(parsed.created_at, fallback.createdAt);
|
|
4594
|
+
const agentId = normalizeNcpAgentId(typeof parsed.agent_id === "string" ? parsed.agent_id : void 0);
|
|
4595
|
+
return {
|
|
4596
|
+
metadata: isRecord$1(parsed.metadata) ? structuredClone(parsed.metadata) : {},
|
|
4597
|
+
...agentId ? { agentId } : {},
|
|
4598
|
+
createdAt,
|
|
4599
|
+
updatedAt: toIsoString(parsed.updated_at, createdAt)
|
|
4600
|
+
};
|
|
4601
|
+
} catch {
|
|
4602
|
+
return fallback;
|
|
4603
|
+
}
|
|
4604
|
+
};
|
|
4605
|
+
delete = async (sessionId) => {
|
|
4606
|
+
try {
|
|
4607
|
+
await unlink(this.metadataPath(sessionId));
|
|
4608
|
+
} catch {}
|
|
4609
|
+
};
|
|
4610
|
+
serializeMetadata = (record) => {
|
|
4611
|
+
const serialized = JSON.stringify(createNcpAgentSessionJournalMetadataEntry(record));
|
|
4612
|
+
if (!serialized) throw new Error("ncp agent session metadata serialization produced empty output");
|
|
4613
|
+
return serialized;
|
|
4614
|
+
};
|
|
4615
|
+
metadataPath = (sessionId) => {
|
|
4616
|
+
return join(this.journalDir, `${safeNcpSessionFilename(sessionId.replace(/:/g, "_"))}.metadata.json`);
|
|
4617
|
+
};
|
|
4618
|
+
};
|
|
4619
|
+
//#endregion
|
|
4620
|
+
//#region src/stores/ncp-agent-session-summary-index.store.ts
|
|
4621
|
+
var NcpAgentSessionSummaryIndexStore = class {
|
|
4622
|
+
summaryIndex = null;
|
|
4623
|
+
constructor(journalDir, loadSession) {
|
|
4624
|
+
this.journalDir = journalDir;
|
|
4625
|
+
this.loadSession = loadSession;
|
|
4626
|
+
}
|
|
4627
|
+
has = async (sessionId) => (await this.load()).has(sessionId);
|
|
4628
|
+
list = async () => {
|
|
4629
|
+
return [...(await this.load()).values()].map((summary) => structuredClone(summary)).sort((left, right) => readNcpSessionSummaryActivityAt(right).localeCompare(readNcpSessionSummaryActivityAt(left)));
|
|
4630
|
+
};
|
|
4631
|
+
upsert = async (summary) => {
|
|
4632
|
+
(await this.load()).set(summary.sessionId, structuredClone(summary));
|
|
4633
|
+
await this.persist();
|
|
4634
|
+
};
|
|
4635
|
+
upsertForEvent = async (params) => {
|
|
4636
|
+
const { event, session, updatedAt } = params;
|
|
4637
|
+
const index = await this.load();
|
|
4638
|
+
const summary = upsertNcpAgentSessionSummaryEvent({
|
|
4639
|
+
current: index.get(session.sessionId),
|
|
4640
|
+
session,
|
|
4641
|
+
event,
|
|
4642
|
+
updatedAt
|
|
4643
|
+
});
|
|
4644
|
+
index.set(summary.sessionId, summary);
|
|
4645
|
+
await this.persist();
|
|
4646
|
+
};
|
|
4647
|
+
remove = async (sessionId) => {
|
|
4648
|
+
(await this.load()).delete(sessionId);
|
|
4649
|
+
await this.persist();
|
|
4650
|
+
};
|
|
4651
|
+
load = async () => {
|
|
4652
|
+
if (this.summaryIndex) return this.summaryIndex;
|
|
4653
|
+
try {
|
|
4654
|
+
const parsed = JSON.parse(await readFile(this.indexPath(), "utf-8"));
|
|
4655
|
+
if (parsed.version === 1 && Array.isArray(parsed.records)) {
|
|
4656
|
+
this.summaryIndex = new Map(parsed.records.map((record) => [record.sessionId, structuredClone(record)]));
|
|
4657
|
+
return this.summaryIndex;
|
|
4658
|
+
}
|
|
4659
|
+
} catch {}
|
|
4660
|
+
this.summaryIndex = await this.rebuild();
|
|
4661
|
+
await this.persist();
|
|
4662
|
+
return this.summaryIndex;
|
|
4663
|
+
};
|
|
4664
|
+
rebuild = async () => {
|
|
4665
|
+
const records = /* @__PURE__ */ new Map();
|
|
4666
|
+
let entries = [];
|
|
4667
|
+
try {
|
|
4668
|
+
entries = await readdir(this.journalDir);
|
|
4669
|
+
} catch {
|
|
4670
|
+
return records;
|
|
4671
|
+
}
|
|
4672
|
+
for (const entry of entries) {
|
|
4673
|
+
if (!entry.endsWith(".jsonl")) continue;
|
|
4674
|
+
const sessionId = entry.replace(/\.jsonl$/, "").replace(/_/g, ":");
|
|
4675
|
+
const loaded = await this.loadSession(sessionId);
|
|
4676
|
+
if (loaded) records.set(sessionId, createNcpAgentSessionSummary(loaded.record));
|
|
4677
|
+
}
|
|
4678
|
+
return records;
|
|
4679
|
+
};
|
|
4680
|
+
persist = async () => {
|
|
4681
|
+
const records = [...this.summaryIndex?.values() ?? []].map((summary) => structuredClone(summary)).sort((left, right) => readNcpSessionSummaryActivityAt(right).localeCompare(readNcpSessionSummaryActivityAt(left)));
|
|
4682
|
+
await mkdir(this.journalDir, { recursive: true });
|
|
4683
|
+
await writeFile(this.indexPath(), `${JSON.stringify({
|
|
4684
|
+
version: 1,
|
|
4685
|
+
records
|
|
4686
|
+
})}\n`, "utf-8");
|
|
4687
|
+
};
|
|
4688
|
+
indexPath = () => resolve(this.journalDir, NCP_AGENT_SESSION_JOURNAL_INDEX_FILE);
|
|
4689
|
+
};
|
|
4606
4690
|
//#endregion
|
|
4607
4691
|
//#region src/stores/ncp-agent-session-journal.store.ts
|
|
4608
4692
|
function serializeJournalEntry(entry) {
|
|
@@ -4615,9 +4699,12 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4615
4699
|
sessions = /* @__PURE__ */ new Map();
|
|
4616
4700
|
nextSeqBySession = /* @__PURE__ */ new Map();
|
|
4617
4701
|
writeChains = /* @__PURE__ */ new Map();
|
|
4618
|
-
|
|
4702
|
+
metadataStore;
|
|
4703
|
+
summaryIndexStore;
|
|
4619
4704
|
constructor(journalDir) {
|
|
4620
4705
|
this.journalDir = journalDir;
|
|
4706
|
+
this.metadataStore = new NcpAgentSessionMetadataStore(journalDir);
|
|
4707
|
+
this.summaryIndexStore = new NcpAgentSessionSummaryIndexStore(journalDir, async (sessionId) => this.loadSession(sessionId));
|
|
4621
4708
|
}
|
|
4622
4709
|
appendSessionEvent = async (params) => {
|
|
4623
4710
|
const sessionId = normalizeNcpSessionId(params.session.sessionId);
|
|
@@ -4643,13 +4730,41 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4643
4730
|
return structuredClone(loaded.record);
|
|
4644
4731
|
};
|
|
4645
4732
|
listSessionSummaries = async () => {
|
|
4646
|
-
return
|
|
4733
|
+
return this.summaryIndexStore.list();
|
|
4647
4734
|
};
|
|
4648
4735
|
listSessionMessages = async (sessionId) => {
|
|
4649
4736
|
const session = await this.getSession(sessionId);
|
|
4650
4737
|
return session ? session.messages.map((message) => structuredClone(message)) : [];
|
|
4651
4738
|
};
|
|
4652
|
-
|
|
4739
|
+
updateSessionMetadata = async (params) => {
|
|
4740
|
+
const sessionId = normalizeNcpSessionId(params.sessionId);
|
|
4741
|
+
if (!sessionId) return false;
|
|
4742
|
+
const next = (this.writeChains.get(sessionId) ?? Promise.resolve()).then(() => this.updateSessionMetadataNow({
|
|
4743
|
+
...params,
|
|
4744
|
+
sessionId
|
|
4745
|
+
}));
|
|
4746
|
+
this.writeChains.set(sessionId, next.then(() => void 0, () => void 0));
|
|
4747
|
+
return await next;
|
|
4748
|
+
};
|
|
4749
|
+
updateSessionMetadataNow = async (params) => {
|
|
4750
|
+
const { metadata, sessionId, updatedAt } = params;
|
|
4751
|
+
const loaded = this.sessions.get(sessionId) ?? await this.loadSession(sessionId);
|
|
4752
|
+
if (!loaded) return false;
|
|
4753
|
+
const nextRecord = {
|
|
4754
|
+
...loaded.record,
|
|
4755
|
+
metadata: structuredClone(metadata),
|
|
4756
|
+
updatedAt
|
|
4757
|
+
};
|
|
4758
|
+
await this.metadataStore.write(nextRecord);
|
|
4759
|
+
this.sessions.set(sessionId, {
|
|
4760
|
+
record: nextRecord,
|
|
4761
|
+
nextSeq: loaded.nextSeq
|
|
4762
|
+
});
|
|
4763
|
+
this.nextSeqBySession.set(sessionId, loaded.nextSeq);
|
|
4764
|
+
await this.summaryIndexStore.upsert(createNcpAgentSessionSummary(nextRecord));
|
|
4765
|
+
return true;
|
|
4766
|
+
};
|
|
4767
|
+
materializeSession = async (record) => {
|
|
4653
4768
|
const sessionId = normalizeNcpSessionId(record.sessionId);
|
|
4654
4769
|
if (!sessionId) return;
|
|
4655
4770
|
await this.ensureJournalDir();
|
|
@@ -4657,27 +4772,28 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4657
4772
|
...record,
|
|
4658
4773
|
sessionId
|
|
4659
4774
|
});
|
|
4660
|
-
|
|
4775
|
+
await this.metadataStore.write(nextRecord);
|
|
4776
|
+
const entries = nextRecord.messages.map((message, index) => ({
|
|
4661
4777
|
_type: "event",
|
|
4662
4778
|
version: 1,
|
|
4663
4779
|
seq: index + 1,
|
|
4664
4780
|
timestamp: message.timestamp ?? nextRecord.updatedAt,
|
|
4665
4781
|
event: {
|
|
4666
|
-
type:
|
|
4782
|
+
type: NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE,
|
|
4667
4783
|
payload: {
|
|
4668
4784
|
sessionId,
|
|
4669
4785
|
message: structuredClone(message)
|
|
4670
4786
|
}
|
|
4671
4787
|
}
|
|
4672
|
-
}))
|
|
4673
|
-
await writeFile(this.sessionPath(sessionId), `${entries.map(serializeJournalEntry).join("\n")}\n
|
|
4788
|
+
}));
|
|
4789
|
+
await writeFile(this.sessionPath(sessionId), entries.length > 0 ? `${entries.map(serializeJournalEntry).join("\n")}\n` : "", "utf-8");
|
|
4674
4790
|
const nextSeq = nextRecord.messages.length + 1;
|
|
4675
4791
|
this.sessions.set(sessionId, {
|
|
4676
4792
|
record: nextRecord,
|
|
4677
4793
|
nextSeq
|
|
4678
4794
|
});
|
|
4679
4795
|
this.nextSeqBySession.set(sessionId, nextSeq);
|
|
4680
|
-
await this.
|
|
4796
|
+
await this.summaryIndexStore.upsert(createNcpAgentSessionSummary(nextRecord));
|
|
4681
4797
|
};
|
|
4682
4798
|
deleteSession = async (sessionId) => {
|
|
4683
4799
|
const normalizedSessionId = normalizeNcpSessionId(sessionId);
|
|
@@ -4688,23 +4804,31 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4688
4804
|
try {
|
|
4689
4805
|
await unlink(this.sessionPath(normalizedSessionId));
|
|
4690
4806
|
} catch {}
|
|
4691
|
-
await this.
|
|
4807
|
+
await this.metadataStore.delete(normalizedSessionId);
|
|
4808
|
+
await this.summaryIndexStore.remove(normalizedSessionId);
|
|
4692
4809
|
return existing;
|
|
4693
4810
|
};
|
|
4694
4811
|
hasSession = async (sessionId) => {
|
|
4695
4812
|
const normalizedSessionId = normalizeNcpSessionId(sessionId);
|
|
4696
4813
|
if (!normalizedSessionId) return false;
|
|
4697
|
-
return
|
|
4814
|
+
return this.summaryIndexStore.has(normalizedSessionId);
|
|
4698
4815
|
};
|
|
4699
4816
|
appendSessionEventNow = async (params) => {
|
|
4700
4817
|
const { event, session, updatedAt } = params;
|
|
4701
4818
|
const { sessionId } = session;
|
|
4702
4819
|
await this.ensureJournalDir();
|
|
4703
4820
|
const existing = this.sessions.get(sessionId) ?? (this.nextSeqBySession.has(sessionId) ? null : await this.loadSession(sessionId));
|
|
4704
|
-
const hasJournal = Boolean(existing) || this.nextSeqBySession.has(sessionId);
|
|
4705
4821
|
const nextSeq = this.nextSeqBySession.get(sessionId) ?? existing?.nextSeq ?? 1;
|
|
4706
4822
|
const path = this.sessionPath(sessionId);
|
|
4707
|
-
|
|
4823
|
+
await this.metadataStore.write({
|
|
4824
|
+
...session,
|
|
4825
|
+
...existing?.record.createdAt ? { createdAt: existing.record.createdAt } : {},
|
|
4826
|
+
updatedAt,
|
|
4827
|
+
metadata: {
|
|
4828
|
+
...existing?.record.metadata ? structuredClone(existing.record.metadata) : {},
|
|
4829
|
+
...session.metadata ? structuredClone(session.metadata) : {}
|
|
4830
|
+
}
|
|
4831
|
+
});
|
|
4708
4832
|
const entry = {
|
|
4709
4833
|
_type: "event",
|
|
4710
4834
|
version: 1,
|
|
@@ -4715,7 +4839,7 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4715
4839
|
await this.appendJournalEntry(path, entry);
|
|
4716
4840
|
this.nextSeqBySession.set(sessionId, nextSeq + 1);
|
|
4717
4841
|
this.sessions.delete(sessionId);
|
|
4718
|
-
await this.
|
|
4842
|
+
await this.summaryIndexStore.upsertForEvent({
|
|
4719
4843
|
session,
|
|
4720
4844
|
event,
|
|
4721
4845
|
updatedAt
|
|
@@ -4728,7 +4852,9 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4728
4852
|
} catch {
|
|
4729
4853
|
return null;
|
|
4730
4854
|
}
|
|
4731
|
-
const
|
|
4855
|
+
const parsedJournal = this.parseSessionJournal(raw);
|
|
4856
|
+
const { agentId, createdAt, updatedAt, metadata } = await this.metadataStore.read(sessionId, parsedJournal);
|
|
4857
|
+
const { events, nextSeq } = parsedJournal;
|
|
4732
4858
|
const messages = await replayNcpAgentSessionEvents(events);
|
|
4733
4859
|
const record = {
|
|
4734
4860
|
sessionId,
|
|
@@ -4787,72 +4913,12 @@ var NcpAgentSessionJournalStore = class {
|
|
|
4787
4913
|
appendJournalEntry = async (path, entry) => {
|
|
4788
4914
|
await appendFile(path, `${serializeJournalEntry(entry)}\n`, "utf-8");
|
|
4789
4915
|
};
|
|
4790
|
-
loadSummaryIndex = async () => {
|
|
4791
|
-
if (this.summaryIndex) return this.summaryIndex;
|
|
4792
|
-
try {
|
|
4793
|
-
const parsed = JSON.parse(await readFile(this.indexPath(), "utf-8"));
|
|
4794
|
-
if (parsed.version === 1 && Array.isArray(parsed.records)) {
|
|
4795
|
-
this.summaryIndex = new Map(parsed.records.map((record) => [record.sessionId, structuredClone(record)]));
|
|
4796
|
-
return this.summaryIndex;
|
|
4797
|
-
}
|
|
4798
|
-
} catch {}
|
|
4799
|
-
this.summaryIndex = await this.rebuildSummaryIndex();
|
|
4800
|
-
await this.persistSummaryIndex();
|
|
4801
|
-
return this.summaryIndex;
|
|
4802
|
-
};
|
|
4803
|
-
rebuildSummaryIndex = async () => {
|
|
4804
|
-
const records = /* @__PURE__ */ new Map();
|
|
4805
|
-
let entries = [];
|
|
4806
|
-
try {
|
|
4807
|
-
entries = await readdir(this.journalDir);
|
|
4808
|
-
} catch {
|
|
4809
|
-
return records;
|
|
4810
|
-
}
|
|
4811
|
-
for (const entry of entries) {
|
|
4812
|
-
if (!entry.endsWith(".jsonl")) continue;
|
|
4813
|
-
const sessionId = entry.replace(/\.jsonl$/, "").replace(/_/g, ":");
|
|
4814
|
-
const loaded = await this.loadSession(sessionId);
|
|
4815
|
-
if (!loaded) continue;
|
|
4816
|
-
this.sessions.set(sessionId, loaded);
|
|
4817
|
-
records.set(sessionId, createNcpAgentSessionSummary(loaded.record));
|
|
4818
|
-
}
|
|
4819
|
-
return records;
|
|
4820
|
-
};
|
|
4821
|
-
upsertSummaryIndex = async (summary) => {
|
|
4822
|
-
(await this.loadSummaryIndex()).set(summary.sessionId, structuredClone(summary));
|
|
4823
|
-
await this.persistSummaryIndex();
|
|
4824
|
-
};
|
|
4825
|
-
upsertSummaryIndexForEvent = async (params) => {
|
|
4826
|
-
const { event, session, updatedAt } = params;
|
|
4827
|
-
const index = await this.loadSummaryIndex();
|
|
4828
|
-
const summary = upsertNcpAgentSessionSummaryEvent({
|
|
4829
|
-
current: index.get(session.sessionId),
|
|
4830
|
-
session,
|
|
4831
|
-
event,
|
|
4832
|
-
updatedAt
|
|
4833
|
-
});
|
|
4834
|
-
index.set(summary.sessionId, summary);
|
|
4835
|
-
await this.persistSummaryIndex();
|
|
4836
|
-
};
|
|
4837
|
-
removeSummaryIndex = async (sessionId) => {
|
|
4838
|
-
(await this.loadSummaryIndex()).delete(sessionId);
|
|
4839
|
-
await this.persistSummaryIndex();
|
|
4840
|
-
};
|
|
4841
|
-
persistSummaryIndex = async () => {
|
|
4842
|
-
const records = [...this.summaryIndex?.values() ?? []].map((summary) => structuredClone(summary)).sort((left, right) => readNcpSessionSummaryActivityAt(right).localeCompare(readNcpSessionSummaryActivityAt(left)));
|
|
4843
|
-
await this.ensureJournalDir();
|
|
4844
|
-
await writeFile(this.indexPath(), `${JSON.stringify({
|
|
4845
|
-
version: 1,
|
|
4846
|
-
records
|
|
4847
|
-
})}\n`, "utf-8");
|
|
4848
|
-
};
|
|
4849
4916
|
ensureJournalDir = async () => {
|
|
4850
4917
|
await mkdir(this.journalDir, { recursive: true });
|
|
4851
4918
|
};
|
|
4852
4919
|
sessionPath = (sessionId) => {
|
|
4853
4920
|
return join(this.journalDir, `${safeNcpSessionFilename(sessionId.replace(/:/g, "_"))}.jsonl`);
|
|
4854
4921
|
};
|
|
4855
|
-
indexPath = () => resolve(this.journalDir, NCP_AGENT_SESSION_JOURNAL_INDEX_FILE);
|
|
4856
4922
|
};
|
|
4857
4923
|
//#endregion
|
|
4858
4924
|
//#region src/contributions/session-context-window/index.ts
|
|
@@ -5294,4 +5360,4 @@ var NextclawKernel = class {
|
|
|
5294
5360
|
};
|
|
5295
5361
|
};
|
|
5296
5362
|
//#endregion
|
|
5297
|
-
export { AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE, AgentManager, AgentRuntimeManager, AgentRuntimeRegistry, AutomationManager, BuiltinNarpRuntimeRegistrationService, ChannelManager, ConfigManager, ContextCompactionPreflightService, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_LEARNING_LOOP_TOOL_CALL_THRESHOLD, ExtensionManager, LEARNING_LOOP_DISABLED_METADATA_KEY, LEARNING_LOOP_LAST_REQUESTED_AT_METADATA_KEY, LEARNING_LOOP_LAST_REVIEW_SESSION_ID_METADATA_KEY, LEARNING_LOOP_LAST_TOOL_CALL_COUNT_METADATA_KEY, LEARNING_LOOP_REQUESTED_SKILLS, LEARNING_LOOP_SOURCE_SESSION_ID_METADATA_KEY, LearningLoopManager, LlmProviderManager, LlmUsageManager, LlmUsageStore, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NativeAgentRuntimeFactory, NcpSessionApiService, NextclawKernel, NextclawNcpContextBuilder, NextclawNcpToolRegistry, PluginRuntimeRegistrationController, ProviderManagerNcpLLMApi, SkillManager, ToolManager, UpdateManifestReader, buildLearningLoopTask, buildLlmUsageSummary, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeHandle, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, createNcpSessionSummary, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isReplyCapableChannel, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel,
|
|
5363
|
+
export { AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE, AgentManager, AgentRuntimeManager, AgentRuntimeRegistry, AutomationManager, BuiltinNarpRuntimeRegistrationService, ChannelManager, ConfigManager, ContextCompactionPreflightService, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_LEARNING_LOOP_TOOL_CALL_THRESHOLD, ExtensionManager, LEARNING_LOOP_DISABLED_METADATA_KEY, LEARNING_LOOP_LAST_REQUESTED_AT_METADATA_KEY, LEARNING_LOOP_LAST_REVIEW_SESSION_ID_METADATA_KEY, LEARNING_LOOP_LAST_TOOL_CALL_COUNT_METADATA_KEY, LEARNING_LOOP_REQUESTED_SKILLS, LEARNING_LOOP_SOURCE_SESSION_ID_METADATA_KEY, LearningLoopManager, LlmProviderManager, LlmUsageManager, LlmUsageStore, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NativeAgentRuntimeFactory, NcpSessionApiService, NextclawKernel, NextclawNcpContextBuilder, NextclawNcpToolRegistry, PluginRuntimeRegistrationController, ProviderManagerNcpLLMApi, SkillManager, ToolManager, UpdateManifestReader, buildLearningLoopTask, buildLlmUsageSummary, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeHandle, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, createNcpSessionSummary, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isReplyCapableChannel, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, readLearningLoopRuntimeConfig, resolveAgentHandoffDepth, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveLegacyEventType, runGatewayInboundLoop, runPromptOverNcp, sanitizeLlmUsage, serializeUnsignedUpdateManifest, streamPromptOverNcp, toNcpMessages, waitForAgentRuntimeSessionReply };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/kernel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw product kernel skeleton for agents, tasks, sessions, context, tools, skills, providers, automation, and channels.",
|
|
6
6
|
"type": "module",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@nextclaw/core": "0.12.
|
|
24
|
-
"@nextclaw/
|
|
25
|
-
"@nextclaw/
|
|
26
|
-
"@nextclaw/ncp-
|
|
27
|
-
"@nextclaw/ncp-
|
|
28
|
-
"@nextclaw/ncp-toolkit": "0.5.
|
|
29
|
-
"@nextclaw/nextclaw-
|
|
30
|
-
"@nextclaw/nextclaw-
|
|
31
|
-
"@nextclaw/
|
|
32
|
-
"@nextclaw/
|
|
33
|
-
"@nextclaw/
|
|
34
|
-
"@nextclaw/
|
|
35
|
-
"@nextclaw/
|
|
23
|
+
"@nextclaw/core": "0.12.19",
|
|
24
|
+
"@nextclaw/mcp": "0.1.84",
|
|
25
|
+
"@nextclaw/ncp-agent-runtime": "0.3.22",
|
|
26
|
+
"@nextclaw/ncp-mcp": "0.1.86",
|
|
27
|
+
"@nextclaw/ncp-http-agent-server": "0.3.24",
|
|
28
|
+
"@nextclaw/ncp-toolkit": "0.5.17",
|
|
29
|
+
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.11",
|
|
30
|
+
"@nextclaw/nextclaw-hermes-acp-bridge": "0.1.11",
|
|
31
|
+
"@nextclaw/shared": "0.1.6",
|
|
32
|
+
"@nextclaw/runtime": "0.2.51",
|
|
33
|
+
"@nextclaw/openclaw-compat": "1.0.19",
|
|
34
|
+
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.12",
|
|
35
|
+
"@nextclaw/ncp": "0.5.12"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.17.6",
|