@nextclaw/kernel 0.1.11 → 0.1.13

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,11 +1,12 @@
1
1
  import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateSnapshot, f as UpdateStatus, i as UpdateManifestReader, l as UpdatePreferences, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateProgress } from "./update-manifest.types-DLWDvs_v.js";
2
- import { BaseChannel, ChannelManager, ChannelManager as ChannelManager$1, Config, ContextCompactionPlan, ContextWindowSnapshot, CronService, Disposable, ExtensionRegistry, ExtensionToolContext, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, SearchConfig, Session, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestManager, SessionRequestRecord, SessionSearchManager, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, ThinkingLevel, Tool, buildCompressingCompactionCheckpoint } from "@nextclaw/core";
3
2
  import { EventBus, Ingress, Unsubscribe } from "@nextclaw/shared";
4
3
  import * as _$_nextclaw_ncp0 from "@nextclaw/ncp";
5
- import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpAgentRunInput, NcpAgentRunSendOptions, NcpAgentRunStreamOptions, NcpAgentRuntime, NcpContextBuilder, NcpContextPrepareOptions, NcpEndpointEvent, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessagePart, NcpRequestEnvelope, NcpSessionApi, NcpSessionPatch, NcpSessionStatus, NcpSessionSummary, NcpStreamRequestPayload, NcpTool, NcpToolRegistry, OpenAIChatChunk } from "@nextclaw/ncp";
6
- import { PluginChannelBinding, PluginRegistry, PluginUiMetadata } from "@nextclaw/openclaw-compat";
7
- import { AgentSessionStore, ChatTarget, EventPublisher, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
4
+ import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpAgentRunInput, NcpAgentRunSendOptions, NcpAgentRunStreamOptions, NcpAgentRuntime, NcpContextBuilder, NcpContextPrepareOptions, NcpEndpointEvent, NcpEventType, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessagePart, NcpRequestEnvelope, NcpSessionApi, NcpSessionPatch, NcpSessionSummary, NcpStreamRequestPayload, NcpTool, NcpToolRegistry, OpenAIChatChunk } from "@nextclaw/ncp";
8
5
  import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
6
+ import { BaseChannel, ChannelManager, ChannelManager as ChannelManager$1, Config, ContextWindowSnapshot, CreateSessionInput, CreatedSession, CronService, Disposable, ExtensionRegistry, ExtensionToolContext, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, RequestSessionParams, SearchConfig, Session, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchManager, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, Tool } from "@nextclaw/core";
7
+ import { PluginChannelBinding, PluginRegistry, PluginUiMetadata } from "@nextclaw/openclaw-compat";
8
+ import * as _$_nextclaw_ncp_toolkit0 from "@nextclaw/ncp-toolkit";
9
+ import { AgentSessionRecord, ChatTarget, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
9
10
 
10
11
  //#region src/types/entity-ids.types.d.ts
11
12
  type AgentId = string;
@@ -97,11 +98,8 @@ type MaterializedAgentRunRequest = NcpRequestEnvelope & {
97
98
  type LiveSession = {
98
99
  sessionId: string;
99
100
  agentId?: string;
100
- createdAt: string;
101
101
  stateManager: NcpAgentConversationStateManager;
102
- metadata: Record<string, unknown>;
103
102
  runtime: NcpAgentRuntime;
104
- publisher: EventPublisher;
105
103
  activeExecution: LiveSessionExecution | null;
106
104
  };
107
105
  type PublishSessionEventOptions = {
@@ -193,7 +191,9 @@ declare class AgentRuntimeRegistry {
193
191
  entries: AgentRuntimeEntry[];
194
192
  defaultEntryId?: string;
195
193
  }) => void;
194
+ resolveSessionMetadata: (sessionMetadata: Record<string, unknown>) => Record<string, unknown>;
196
195
  createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
196
+ private resolveRuntimeEntry;
197
197
  listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
198
198
  defaultType: string;
199
199
  options: AgentRuntimeSessionTypeOption[];
@@ -215,6 +215,7 @@ declare class AgentRuntimeManager {
215
215
  constructor(params: AgentRuntimeManagerOptions);
216
216
  registerRuntimeProvider: (registration: AgentRuntimeProviderRegistration) => Disposable;
217
217
  createRuntime: (runtimeParams: RuntimeFactoryParams) => _$_nextclaw_ncp0.NcpAgentRuntime;
218
+ resolveSessionMetadata: (sessionMetadata: Record<string, unknown>) => Record<string, unknown>;
218
219
  listSessionTypes: (describeParams?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
219
220
  defaultType: string;
220
221
  options: AgentRuntimeSessionTypeOption[];
@@ -223,74 +224,63 @@ declare class AgentRuntimeManager {
223
224
  private readonly assertNotDisposed;
224
225
  }
225
226
  //#endregion
226
- //#region src/managers/session-run.manager.d.ts
227
- declare class SessionRunManager {
228
- private readonly agentRuntimeManager;
229
- private readonly ncpAgentSessionStore;
230
- private readonly eventBus;
231
- private readonly onSessionUpdated;
232
- private readonly liveSessions;
233
- private readonly publisher;
234
- private disposed;
235
- constructor(options: {
236
- agentRuntimeManager: AgentRuntimeManager;
237
- ncpAgentSessionStore: AgentSessionStore;
238
- eventBus: EventBus;
239
- onSessionUpdated: (sessionKey: string) => void;
240
- });
241
- dispose: () => Promise<void>;
242
- isRunning: (sessionId: string) => boolean;
243
- getOrCreateLiveSession: (sessionId: string, initialMetadata?: Record<string, unknown>) => Promise<LiveSession>;
244
- getActiveSessionRun: (sessionId: string) => LiveSessionExecution | null;
245
- setActiveSessionRun: (sessionId: string, activeRun: LiveSessionExecution) => void;
246
- deleteActiveSessionRun: (sessionId: string, runId: string) => void;
247
- streamSessionEvents: (payload: NcpStreamRequestPayload, options?: NcpAgentRunStreamOptions) => AsyncIterable<NcpEndpointEvent>;
248
- updateToolCallResult: UpdateToolCallResult;
249
- patchSessionMetadata: (sessionId: string, patcher: (metadata: Record<string, unknown>) => Record<string, unknown> | null) => Promise<boolean>;
250
- appendSessionEvent: (sessionId: string, event: NcpEndpointEvent, options?: PublishSessionEventOptions) => Promise<void>;
251
- private readonly ensureLiveSession;
252
- private readonly requireLiveSession;
253
- private readonly publishSessionEvent;
254
- private readonly persistLiveSessionEvent;
255
- private readonly persistSessionMetadata;
256
- private readonly assertNotDisposed;
257
- private publishSessionRunStatus;
258
- }
227
+ //#region src/utils/ncp-agent-session-journal.utils.d.ts
228
+ declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
229
+ declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
230
+ declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
231
+ declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
232
+ type NcpAgentSessionSnapshotMessageEvent = {
233
+ type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
234
+ payload: Extract<NcpEndpointEvent, {
235
+ type: NcpEventType.MessageSent;
236
+ }>["payload"];
237
+ };
238
+ type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
239
+ type NcpSessionRequestJournalEvent = {
240
+ type: NcpSessionRequestJournalEventType;
241
+ payload: {
242
+ sessionId: string;
243
+ request: unknown;
244
+ };
245
+ };
246
+ type NcpAgentSessionJournalReplayEvent = NcpEndpointEvent | NcpAgentSessionSnapshotMessageEvent | NcpSessionRequestJournalEvent;
259
247
  //#endregion
260
- //#region src/managers/agent-run-request.manager.d.ts
261
- declare class AgentRunRequestManager {
262
- private readonly cleanups;
248
+ //#region src/stores/ncp-agent-session-journal.store.d.ts
249
+ declare class NcpAgentSessionJournalStore {
250
+ private readonly journalDir;
263
251
  private readonly sessions;
264
- private readonly ingress;
265
- private readonly sessionRunManager;
266
- private readonly onSessionUpdated;
267
- private disposed;
268
- private started;
269
- constructor(options: {
270
- sessions: SessionManager;
271
- ingress: Ingress;
272
- sessionRunManager: SessionRunManager;
273
- onSessionUpdated: (sessionKey: string) => void;
274
- });
275
- start: () => void;
276
- dispose: () => Promise<void>;
277
- run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
278
- private readonly handleSendRequest;
279
- private readonly handleAbortRequest;
280
- private readonly iterateRun;
281
- private readonly materializeSendEnvelope;
282
- private readonly toNcpSendEnvelope;
283
- private readonly materializeRunEnvelope;
284
- private readonly handleSessionMessageRequest;
285
- private readonly assertNotDisposed;
286
- }
287
- //#endregion
288
- //#region src/managers/automation.manager.d.ts
289
- type AutomationManagerOptions = {
290
- storePath: string;
291
- };
292
- declare class AutomationManager extends CronService {
293
- constructor(options: AutomationManagerOptions);
252
+ private readonly nextSeqBySession;
253
+ private readonly writeChains;
254
+ private readonly metadataStore;
255
+ private readonly summaryIndexStore;
256
+ constructor(journalDir: string);
257
+ appendSessionEvent: (params: {
258
+ sessionId: string;
259
+ event: NcpAgentSessionJournalReplayEvent;
260
+ }) => Promise<void>;
261
+ getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
262
+ listSessionSummaries: () => Promise<NcpSessionSummary[]>;
263
+ listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
264
+ setSessionMetadata: (params: {
265
+ sessionId: string;
266
+ metadata: Record<string, unknown>;
267
+ }) => Promise<boolean>;
268
+ updateSessionMetadata: (params: {
269
+ sessionId: string;
270
+ metadata: Record<string, unknown>;
271
+ }) => Promise<boolean>;
272
+ private setSessionMetadataNow;
273
+ private updateSessionMetadataNow;
274
+ importSessionSnapshot: (record: AgentSessionRecord) => Promise<void>;
275
+ deleteSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
276
+ hasSession: (sessionId: string) => Promise<boolean>;
277
+ private appendSessionEventNow;
278
+ private withMetadata;
279
+ private loadSession;
280
+ private parseSessionJournal;
281
+ private appendJournalEntry;
282
+ private ensureJournalDir;
283
+ private sessionPath;
294
284
  }
295
285
  //#endregion
296
286
  //#region src/managers/llm-provider.manager.d.ts
@@ -420,6 +410,178 @@ declare class ConfigManager {
420
410
  private createConfigMutationResult;
421
411
  }
422
412
  //#endregion
413
+ //#region src/managers/ncp-session.manager.d.ts
414
+ type NcpSessionManagerOptions = {
415
+ configManager: ConfigManager;
416
+ eventBus: EventBus;
417
+ journalStore: NcpAgentSessionJournalStore;
418
+ sessionSearch: SessionSearchManager;
419
+ };
420
+ declare class NcpSessionManager implements NcpSessionApi {
421
+ private readonly options;
422
+ private readonly contextWindowPreview;
423
+ private readonly runningSessionIds;
424
+ private readonly unsubscribeSessionRunStatus;
425
+ constructor(options: NcpSessionManagerOptions);
426
+ dispose: () => void;
427
+ createSession: (params: CreateSessionInput) => Promise<CreatedSession>;
428
+ appendSessionEvent: (params: {
429
+ sessionId: string;
430
+ event: NcpAgentSessionJournalReplayEvent;
431
+ }) => Promise<void>;
432
+ setSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
433
+ updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
434
+ updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
435
+ deleteSession: (sessionId: string) => Promise<void>;
436
+ getSessionRecord: (sessionId: string) => Promise<AgentSessionRecord | null>;
437
+ listSessions: (options?: ListSessionsOptions) => Promise<NcpSessionSummary[]>;
438
+ listSessionMessages: (sessionId: string, options?: ListMessagesOptions) => Promise<NcpMessage[]>;
439
+ getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
440
+ getContextWindow: (sessionId: string, liveRecord?: AgentSessionRecord | null) => Promise<Record<string, unknown> | null>;
441
+ publishSessionChange: (sessionKey: string) => Promise<void>;
442
+ private createSummaryFromRecord;
443
+ private withLiveSessionStatus;
444
+ private handleSessionRunStatus;
445
+ private publishSessionMetadataChanged;
446
+ }
447
+ //#endregion
448
+ //#region src/managers/session-run.manager.d.ts
449
+ declare class SessionRunManager {
450
+ private readonly agentRuntimeManager;
451
+ private readonly ncpSessionManager;
452
+ private readonly eventBus;
453
+ private readonly liveSessions;
454
+ private readonly cleanups;
455
+ private disposed;
456
+ constructor(options: {
457
+ agentRuntimeManager: AgentRuntimeManager;
458
+ eventBus: EventBus;
459
+ ncpSessionManager: NcpSessionManager;
460
+ });
461
+ dispose: () => Promise<void>;
462
+ isRunning: (sessionId: string) => boolean;
463
+ getOrCreateLiveSession: (sessionId: string, initialMetadata?: Record<string, unknown>) => Promise<LiveSession>;
464
+ getActiveSessionRun: (sessionId: string) => LiveSessionExecution | null;
465
+ getLiveSessionRecord: (sessionId: string) => _$_nextclaw_ncp_toolkit0.AgentSessionRecord | null;
466
+ setActiveSessionRun: (sessionId: string, activeRun: LiveSessionExecution) => void;
467
+ deleteActiveSessionRun: (sessionId: string, runId: string) => void;
468
+ streamSessionEvents: (payload: NcpStreamRequestPayload, options?: NcpAgentRunStreamOptions) => AsyncIterable<NcpEndpointEvent>;
469
+ updateToolCallResult: UpdateToolCallResult;
470
+ updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
471
+ appendSessionEvent: (sessionId: string, event: NcpEndpointEvent, options?: PublishSessionEventOptions) => Promise<void>;
472
+ private readonly ensureLiveSession;
473
+ private readonly requireLiveSession;
474
+ private readonly publishSessionEvent;
475
+ private readonly persistLiveSessionEvent;
476
+ private readonly assertNotDisposed;
477
+ private publishSessionRunStatus;
478
+ }
479
+ //#endregion
480
+ //#region src/features/context-compaction/managers/context-compaction.manager.d.ts
481
+ declare class ContextWindowPreviewManager {
482
+ private readonly options;
483
+ private readonly contextWindowBudgetService;
484
+ constructor(options: {
485
+ configManager: ConfigManager;
486
+ });
487
+ preview: (params: {
488
+ requestMetadata: Record<string, unknown>;
489
+ sessionId: string;
490
+ sessionMessages: readonly NcpMessage[];
491
+ storedAgentId?: string;
492
+ storedMetadata: Record<string, unknown>;
493
+ }) => ContextWindowSnapshot | null;
494
+ }
495
+ declare class ContextCompactionManager {
496
+ private readonly options;
497
+ private readonly compactionService;
498
+ private readonly contextWindowBudgetService;
499
+ constructor(options: {
500
+ configManager: ConfigManager;
501
+ providerManager?: LlmProviderRuntime;
502
+ sessionRunManager: SessionRunManager;
503
+ });
504
+ runLivePreflight: (this: ContextCompactionManager, params: {
505
+ input: NcpAgentRunInput;
506
+ session: LiveSession;
507
+ }) => AsyncIterable<NcpEndpointEvent>;
508
+ private begin;
509
+ private finish;
510
+ private generateSummary;
511
+ private applyLivePreflightResult;
512
+ }
513
+ //#endregion
514
+ //#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
515
+ declare function projectNcpMessagesWithContextCompaction(params: {
516
+ sessionId: string;
517
+ sessionMessages: readonly NcpMessage[];
518
+ }): NcpMessage[];
519
+ //#endregion
520
+ //#region src/features/context-compaction/utils/context-compaction-timeline-message.utils.d.ts
521
+ declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
522
+ declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
523
+ type ContextCompactionTimelineCheckpoint = {
524
+ version: 1;
525
+ id: string;
526
+ status: "compressing" | "compressed";
527
+ summary: string;
528
+ coveredMessageCount: number;
529
+ coveredSessionMessageCount: number;
530
+ originalEstimatedTokens: number;
531
+ projectedEstimatedTokens: number;
532
+ createdAt: string;
533
+ updatedAt: string;
534
+ };
535
+ declare function buildContextCompactionTimelineNcpMessage(params: {
536
+ sessionId: string;
537
+ checkpoint: ContextCompactionTimelineCheckpoint;
538
+ }): NcpMessage;
539
+ declare function upsertContextCompactionTimelineMessage(params: {
540
+ session: Session;
541
+ checkpoint: ContextCompactionTimelineCheckpoint;
542
+ insertBeforeMessageIds?: readonly string[];
543
+ }): void;
544
+ declare function isContextCompactionTimelineMessage(message: {
545
+ metadata?: Record<string, unknown> | undefined;
546
+ } | null | undefined): boolean;
547
+ //#endregion
548
+ //#region src/managers/agent-run-request.manager.d.ts
549
+ declare class AgentRunRequestManager {
550
+ private readonly contextCompactionManager;
551
+ private readonly cleanups;
552
+ private readonly ingress;
553
+ private readonly ncpSessionManager;
554
+ private readonly sessionRunManager;
555
+ private disposed;
556
+ private started;
557
+ constructor(options: {
558
+ contextCompactionManager: ContextCompactionManager;
559
+ ingress: Ingress;
560
+ ncpSessionManager: NcpSessionManager;
561
+ sessionRunManager: SessionRunManager;
562
+ });
563
+ start: () => void;
564
+ dispose: () => Promise<void>;
565
+ run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
566
+ private readonly handleSendRequest;
567
+ private readonly handleAbortRequest;
568
+ private readonly iterateRun;
569
+ private readonly materializeSendEnvelope;
570
+ private readonly toNcpSendEnvelope;
571
+ private readonly materializeRunEnvelope;
572
+ private readonly prepareRunSessionMetadata;
573
+ private readonly handleSessionMessageRequest;
574
+ private readonly assertNotDisposed;
575
+ }
576
+ //#endregion
577
+ //#region src/managers/automation.manager.d.ts
578
+ type AutomationManagerOptions = {
579
+ storePath: string;
580
+ };
581
+ declare class AutomationManager extends CronService {
582
+ constructor(options: AutomationManagerOptions);
583
+ }
584
+ //#endregion
423
585
  //#region src/services/extension-plugin-registry.service.d.ts
424
586
  type ExtensionPluginLoadProgress = {
425
587
  loadedPluginCount: number;
@@ -667,35 +829,46 @@ declare class SkillManager {
667
829
  private normalizeOptionalString;
668
830
  }
669
831
  //#endregion
670
- //#region src/services/ncp-session-api.service.d.ts
671
- type NcpAgentSessionReadableStore = AgentSessionStore & {
672
- listSessionSummaries?: () => Promise<NcpSessionSummary[]>;
673
- listSessionMessages?: (sessionId: string) => Promise<NcpMessage[]>;
832
+ //#region src/features/session-request/managers/session-request.manager.d.ts
833
+ type SessionRequestManagerOptions = {
834
+ dispatcher: SessionRequestDispatcher;
835
+ ncpSessionManager: NcpSessionManager;
674
836
  };
675
- type NcpSessionApiServiceOptions = {
676
- eventBus: EventBus;
677
- getConfig: () => Config;
678
- isLiveSessionRunning?: (sessionId: string) => boolean;
679
- ncpAgentSessionStore: NcpAgentSessionReadableStore;
680
- sessionManager: SessionManager;
681
- };
682
- declare class NcpSessionApiService implements NcpSessionApi {
837
+ declare class SessionRequestManager {
683
838
  private readonly options;
684
- private unsubscribeSessionUpdated;
685
- private readonly contextWindowPreview;
686
- constructor(options: NcpSessionApiServiceOptions);
687
- start: () => void;
688
- dispose: () => void;
689
- publishSessionChange: (sessionKey: string) => Promise<void>;
690
- listSessions: (options?: ListSessionsOptions) => Promise<NcpSessionSummary[]>;
691
- listSessionMessages: (sessionId: string, options?: ListMessagesOptions) => Promise<NcpMessage[]>;
692
- getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
693
- updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
694
- deleteSession: (sessionId: string) => Promise<void>;
695
- private createSummaryFromRecord;
696
- private withLiveSessionStatus;
839
+ constructor(options: SessionRequestManagerOptions);
840
+ spawnSessionAndRequest: (params: SpawnSessionAndRequestParams) => Promise<SessionRequestToolResult>;
841
+ requestSession: (params: RequestSessionParams) => Promise<SessionRequestToolResult>;
842
+ private dispatchRequest;
843
+ private toSessionRequestPayload;
844
+ private buildToolResult;
845
+ private appendRequestEvents;
846
+ private runRequest;
847
+ private runRequestAndUpdateToolCallResult;
848
+ private appendAcceptedRequestEvent;
849
+ private appendRequestEvent;
697
850
  }
698
851
  //#endregion
852
+ //#region src/features/session-request/utils/agent-runtime-session-request-dispatcher.utils.d.ts
853
+ type AgentRuntimeSessionRequestDispatcherOptions = {
854
+ eventBus: EventBus;
855
+ ingress: Ingress;
856
+ };
857
+ declare function waitForAgentRuntimeSessionReply(input: {
858
+ eventBus: EventBus;
859
+ onAccepted: (messageId: string) => void;
860
+ requestId: string;
861
+ }): {
862
+ dispose: Unsubscribe;
863
+ promise: Promise<NcpMessage>;
864
+ };
865
+ declare function dispatchAgentRuntimeSessionRequest(input: {
866
+ ingress: Ingress;
867
+ request: SessionRequestRecord;
868
+ task: string;
869
+ }): Promise<void>;
870
+ declare function createAgentRuntimeSessionRequestDispatcher(options: AgentRuntimeSessionRequestDispatcherOptions): SessionRequestDispatcher;
871
+ //#endregion
699
872
  //#region src/app/nextclaw-kernel.d.ts
700
873
  type NextclawKernelOptions = {
701
874
  homeDir?: string;
@@ -732,12 +905,11 @@ declare class NextclawKernel {
732
905
  readonly sessionSearch: SessionSearchManager;
733
906
  readonly assetStore: LocalAssetStore;
734
907
  readonly mcpManager: McpManager;
735
- readonly ncpSessionApi: NcpSessionApiService;
908
+ readonly ncpSessionManager: NcpSessionManager;
736
909
  readonly extensions: ExtensionManager;
737
910
  readonly agentRunRequestManager: AgentRunRequestManager;
738
911
  readonly sessionRunManager: SessionRunManager;
739
912
  readonly agentRuntimeManager: AgentRuntimeManager;
740
- private readonly ncpAgentSessionStore;
741
913
  private readonly ncpAgentSessionJournalStore;
742
914
  private readonly contributions;
743
915
  private gatewayController;
@@ -746,7 +918,6 @@ declare class NextclawKernel {
746
918
  getGatewayController: () => GatewayController | undefined;
747
919
  start: () => Promise<void>;
748
920
  dispose: () => Promise<void>;
749
- publishSessionUpdated: (sessionKey: string) => void;
750
921
  }
751
922
  //#endregion
752
923
  //#region src/contributions/learning-loop/config.d.ts
@@ -760,8 +931,8 @@ declare function readLearningLoopRuntimeConfig(config: Config): LearningLoopRunt
760
931
  declare const NARP_HTTP_RUNTIME_KIND = "narp-http";
761
932
  declare const NARP_STDIO_RUNTIME_KIND = "narp-stdio";
762
933
  declare class BuiltinNarpRuntimeProviderService {
763
- private readonly getConfig;
764
- constructor(getConfig: () => Config);
934
+ private readonly configManager;
935
+ constructor(configManager: Pick<ConfigManager, "loadConfig">);
765
936
  createProviders: () => AgentRuntimeProviderRegistration[];
766
937
  private createUnavailableRuntime;
767
938
  private createHttpRuntime;
@@ -869,7 +1040,6 @@ declare function dispatchChannelReplyRoute(params: ChannelReplyRouterDispatchPar
869
1040
  //#region src/features/ncp-dispatch/utils/nextclaw-ncp-dispatch.utils.d.ts
870
1041
  type DirectPromptDispatchParams = {
871
1042
  config: Config;
872
- sessionManager: SessionManager;
873
1043
  agentRunRequests: NcpRunnerAgent;
874
1044
  content: string;
875
1045
  sessionKey?: string;
@@ -883,104 +1053,12 @@ type DirectPromptDispatchParams = {
883
1053
  };
884
1054
  declare function dispatchPromptOverNcp(params: DirectPromptDispatchParams): Promise<string>;
885
1055
  //#endregion
886
- //#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
887
- type ContextWindowOwner = "nextclaw" | "runtime";
888
- type ContextCompactionPreflightResult = {
889
- contextWindow: ContextWindowSnapshot;
890
- metadata: Record<string, unknown>;
891
- sessionMessages: NcpMessage[];
892
- timelineMessage: NcpMessage | null;
893
- };
894
- type ContextCompactionPreflightBeginResult = ContextCompactionPreflightResult & {
895
- pendingCompaction: ContextCompactionPendingWork | null;
896
- };
897
- type ContextCompactionPendingWork = {
898
- checkpoint: ReturnType<typeof buildCompressingCompactionCheckpoint>;
899
- contextTokens: number;
900
- inputMessageIds: string[];
901
- model: string;
902
- plan: ContextCompactionPlan;
903
- reservedContextTokens: number;
904
- sessionId: string;
905
- };
906
- declare class ContextCompactionPreflightService {
907
- private readonly options;
908
- private readonly compactionService;
909
- private readonly contextWindowBudgetService;
910
- constructor(options: {
911
- getConfig: () => Config;
912
- providerManager?: LlmProviderRuntime;
913
- sessionManager: SessionManager;
914
- });
915
- run: (params: {
916
- contextWindowOwner: ContextWindowOwner;
917
- inputMessages: readonly NcpMessage[];
918
- requestMetadata: Record<string, unknown>;
919
- sessionId: string;
920
- sessionMessages: readonly NcpMessage[];
921
- }) => Promise<ContextCompactionPreflightResult | null>;
922
- preview: (params: {
923
- contextWindowOwner: ContextWindowOwner;
924
- requestMetadata: Record<string, unknown>;
925
- sessionId: string;
926
- sessionMessages: readonly NcpMessage[];
927
- }) => ContextWindowSnapshot | null;
928
- begin: (params: {
929
- contextWindowOwner: ContextWindowOwner;
930
- inputMessages: readonly NcpMessage[];
931
- requestMetadata: Record<string, unknown>;
932
- sessionId: string;
933
- sessionMessages: readonly NcpMessage[];
934
- }) => ContextCompactionPreflightBeginResult | null;
935
- private buildContextWindowSnapshotForMessages;
936
- finish: (pending: ContextCompactionPendingWork) => Promise<ContextCompactionPreflightResult>;
937
- private generateSummary;
938
- }
939
- //#endregion
940
- //#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
941
- declare function projectNcpMessagesWithContextCompaction(params: {
942
- sessionId: string;
943
- sessionMessages: readonly NcpMessage[];
944
- }): NcpMessage[];
945
- //#endregion
946
- //#region src/features/context-compaction/utils/context-compaction-timeline-message.utils.d.ts
947
- declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
948
- declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
949
- type ContextCompactionTimelineCheckpoint = {
950
- version: 1;
951
- id: string;
952
- status: "compressing" | "compressed";
953
- summary: string;
954
- coveredMessageCount: number;
955
- coveredSessionMessageCount: number;
956
- originalEstimatedTokens: number;
957
- projectedEstimatedTokens: number;
958
- createdAt: string;
959
- updatedAt: string;
960
- };
961
- declare function buildContextCompactionTimelineNcpMessage(params: {
962
- sessionId: string;
963
- checkpoint: ContextCompactionTimelineCheckpoint;
964
- }): NcpMessage;
965
- declare function upsertContextCompactionTimelineMessage(params: {
966
- session: Session;
967
- checkpoint: ContextCompactionTimelineCheckpoint;
968
- insertBeforeMessageIds?: readonly string[];
969
- }): void;
970
- declare function isContextCompactionTimelineMessage(message: {
971
- metadata?: Record<string, unknown> | undefined;
972
- } | null | undefined): boolean;
973
- //#endregion
974
1056
  //#region src/features/native-runtime/services/native-agent-runtime-factory.service.d.ts
975
1057
  type NativeRuntimeFactory = (runtimeParams: RuntimeFactoryParams) => NcpAgentRuntime;
976
1058
  type NativeAgentRuntimeFactoryOptions = {
977
1059
  providerManager: LlmProviderRuntime;
978
- sessions: SessionManager;
979
- configManager: {
980
- loadConfig: () => Config;
981
- };
1060
+ configManager: ConfigManager;
982
1061
  llmUsage: LlmUsageManager;
983
- onSessionUpdated: (sessionKey: string) => void;
984
1062
  assetStore: LocalAssetStore;
985
1063
  updateToolCallResult: UpdateToolCallResult;
986
1064
  toolManager: ToolManager;
@@ -995,9 +1073,9 @@ declare class NativeAgentRuntimeFactory {
995
1073
  //#endregion
996
1074
  //#region src/features/native-runtime/services/nextclaw-ncp-context-builder.service.d.ts
997
1075
  type NextclawNcpContextBuilderOptions = {
998
- sessionManager: SessionManager;
1076
+ agentId?: string;
999
1077
  toolRegistry: ToolRuntimeRegistry;
1000
- getConfig: () => Config;
1078
+ configManager: ConfigManager;
1001
1079
  assetStore?: LocalAssetStore | null;
1002
1080
  };
1003
1081
  declare class NextclawNcpContextBuilder implements NcpContextBuilder {
@@ -1023,25 +1101,30 @@ declare function createAssetTools(params: {
1023
1101
  contentBasePath?: string;
1024
1102
  }): NcpTool[];
1025
1103
  //#endregion
1026
- //#region src/features/session-request/utils/agent-runtime-session-request-dispatcher.utils.d.ts
1027
- type AgentRuntimeSessionRequestDispatcherOptions = {
1028
- eventBus: EventBus;
1029
- ingress: Ingress;
1104
+ //#region src/features/native-runtime/utils/nextclaw-ncp-session-preferences.utils.d.ts
1105
+ declare function normalizeOptionalString(value: unknown): string | undefined;
1106
+ declare function readMetadataModel(metadata: Record<string, unknown>): string | null;
1107
+ declare function readMetadataThinking(metadata: Record<string, unknown>): ThinkingLevel | "__clear__" | null;
1108
+ declare function resolveEffectiveModel(params: {
1109
+ sessionMetadata: Record<string, unknown>;
1110
+ requestMetadata: Record<string, unknown>;
1111
+ fallbackModel: string;
1112
+ }): {
1113
+ metadata: Record<string, unknown>;
1114
+ model: string;
1030
1115
  };
1031
- declare function waitForAgentRuntimeSessionReply(input: {
1032
- eventBus: EventBus;
1033
- onAccepted: (messageId: string) => void;
1034
- requestId: string;
1116
+ declare function syncSessionThinkingPreference(params: {
1117
+ sessionMetadata: Record<string, unknown>;
1118
+ requestMetadata: Record<string, unknown>;
1119
+ }): Record<string, unknown>;
1120
+ declare function resolveSessionChannelContext(params: {
1121
+ sessionMetadata: Record<string, unknown>;
1122
+ requestMetadata: Record<string, unknown>;
1035
1123
  }): {
1036
- dispose: Unsubscribe;
1037
- promise: Promise<NcpMessage>;
1124
+ channel: string;
1125
+ chatId: string;
1126
+ metadata: Record<string, unknown>;
1038
1127
  };
1039
- declare function dispatchAgentRuntimeSessionRequest(input: {
1040
- ingress: Ingress;
1041
- request: SessionRequestRecord;
1042
- task: string;
1043
- }): Promise<void>;
1044
- declare function createAgentRuntimeSessionRequestDispatcher(options: AgentRuntimeSessionRequestDispatcherOptions): SessionRequestDispatcher;
1045
1128
  //#endregion
1046
1129
  //#region src/features/extension-runtime/utils/extension-channel-catalog.utils.d.ts
1047
1130
  declare function listExtensionChannelIds(params: {
@@ -1049,18 +1132,6 @@ declare function listExtensionChannelIds(params: {
1049
1132
  workspace: string;
1050
1133
  }): string[];
1051
1134
  //#endregion
1052
- //#region src/utils/ncp-session-summary.utils.d.ts
1053
- declare function createNcpSessionSummary(params: {
1054
- sessionId: string;
1055
- agentId?: string;
1056
- messages: readonly NcpMessage[];
1057
- createdAt: string;
1058
- updatedAt: string;
1059
- status: NcpSessionStatus;
1060
- metadata?: Record<string, unknown>;
1061
- contextWindow?: Record<string, unknown> | null;
1062
- }): NcpSessionSummary;
1063
- //#endregion
1064
1135
  //#region src/utils/ncp-session-message-adapter.utils.d.ts
1065
1136
  declare function toNcpMessages(sessionId: string, messages: SessionMessage[]): NcpMessage[];
1066
1137
  declare function resolveLegacyEventType(message: SessionMessage): string;
@@ -1085,4 +1156,5 @@ type SkillRecord = {
1085
1156
  metadata: Record<string, unknown>;
1086
1157
  };
1087
1158
  //#endregion
1088
- export { AgentId, AgentManager, AgentRecord, AgentRunRequestManager, AgentRuntimeEntry, AgentRuntimeManager, AgentRuntimeManagerOptions, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AutomationId, AutomationManager, AutomationManagerOptions, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionPendingWork, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextCompactionTimelineCheckpoint, ContextWindowOwner, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DirectPromptDispatchParams, ExtensionLoadProgress, ExtensionLoadResult, ExtensionManager, ExtensionPluginLoadProgress, ExtensionPluginRegistryService, GatewayInboundLoopRuntime, GatewayInboundProcessor, InstallationKind, InstalledSkillDetail, InstalledSkillSummary, InstalledSkillsList, type LearningLoopRuntimeConfig, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStats, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, LocalizedTextMap, McpManager, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NativeAgentRuntimeFactory, NativeAgentRuntimeFactoryOptions, NativeRuntimeFactory, NcpRunnerAgent, NcpSessionApiService, NcpSessionApiServiceOptions, NextclawKernel, NextclawKernelOptions, NextclawNcpContextBuilder, ProviderManagerNcpLLMApi, RunPromptOverNcpParams, SessionId, SessionRunManager, SkillFrontmatter, SkillId, type SkillInfo, SkillManager, SkillRecord, type SkillScope, StreamPromptOverNcpParams, TaskId, ToolId, ToolManager, ToolProvider, ToolRecord, ToolRegistrationContext, ToolRunContext, ToolRuntimeRegistry, ToolRuntimeRegistryOptions, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, UpdateToolCallResult, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, createNcpSessionSummary, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isContextCompactionTimelineMessage, isReplyCapableChannel, listExtensionChannelIds, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, parseSkillFrontmatter, projectNcpMessagesWithContextCompaction, readLearningLoopRuntimeConfig, resolveAgentHandoffDepth, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveLegacyEventType, runGatewayInboundLoop, runPromptOverNcp, sanitizeLlmUsage, serializeUnsignedUpdateManifest, streamPromptOverNcp, stripSkillFrontmatter, toNcpMessages, upsertContextCompactionTimelineMessage, waitForAgentRuntimeSessionReply };
1159
+ export { AgentId, AgentManager, AgentRecord, AgentRunRequestManager, AgentRuntimeEntry, AgentRuntimeManager, AgentRuntimeManagerOptions, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AutomationId, AutomationManager, AutomationManagerOptions, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionManager, ContextCompactionTimelineCheckpoint, ContextWindowPreviewManager, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DirectPromptDispatchParams, ExtensionLoadProgress, ExtensionLoadResult, ExtensionManager, ExtensionPluginLoadProgress, ExtensionPluginRegistryService, GatewayInboundLoopRuntime, GatewayInboundProcessor, InstallationKind, InstalledSkillDetail, InstalledSkillSummary, InstalledSkillsList, type LearningLoopRuntimeConfig, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStats, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, LocalizedTextMap, McpManager, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NativeAgentRuntimeFactory, NativeAgentRuntimeFactoryOptions, NativeRuntimeFactory, NcpAgentSessionJournalStore, NcpRunnerAgent, NcpSessionManager, NcpSessionManagerOptions, NextclawKernel, NextclawKernelOptions, NextclawNcpContextBuilder, ProviderManagerNcpLLMApi, RunPromptOverNcpParams, SessionId, SessionRequestManager, SessionRequestManagerOptions, SessionRunManager, SkillFrontmatter, SkillId, type SkillInfo, SkillManager, SkillRecord, type SkillScope, StreamPromptOverNcpParams, TaskId, ToolId, ToolManager, ToolProvider, ToolRecord, ToolRegistrationContext, ToolRunContext, ToolRuntimeRegistry, ToolRuntimeRegistryOptions, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, UpdateToolCallResult, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildNcpUserMessage, buildUserMessageParts, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createLlmUsageRecord, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isContextCompactionTimelineMessage, isReplyCapableChannel, listExtensionChannelIds, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, normalizeOptionalString, parseSkillFrontmatter, projectNcpMessagesWithContextCompaction, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, resolveAgentHandoffDepth, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolveSessionChannelContext, runGatewayInboundLoop, runPromptOverNcp, sanitizeLlmUsage, serializeUnsignedUpdateManifest, streamPromptOverNcp, stripSkillFrontmatter, syncSessionThinkingPreference, toNcpMessages, upsertContextCompactionTimelineMessage, waitForAgentRuntimeSessionReply };
1160
+ //# sourceMappingURL=index.d.ts.map