@nextclaw/kernel 0.1.14 → 0.1.15-beta.1

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,13 +1,104 @@
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 { EventBus, Ingress, Unsubscribe } from "@nextclaw/shared";
2
+ import { AgentRunSendIngressPayload, EventBus, Ingress, Unsubscribe } from "@nextclaw/shared";
3
3
  import * as _$_nextclaw_ncp0 from "@nextclaw/ncp";
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";
4
+ import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpAgentRunInput, NcpAgentRunSendOptions, NcpAgentRuntime, NcpContextBuilder, NcpContextPrepareOptions, NcpEndpointEvent, NcpEventType, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessagePart, NcpRequestEnvelope, NcpRunHandle, NcpSessionApi, NcpSessionPatch, NcpSessionSummary, NcpTool, NcpToolRegistry, OpenAIChatChunk } from "@nextclaw/ncp";
5
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";
6
+ import { BaseChannel, ChannelManager, ChannelManager as ChannelManager$1, Config, ContextCompactionPlan, ContextWindowSnapshot, CreateSessionInput, CreatedSession, CronService, Disposable, ExtensionChannelBinding, ExtensionDiagnostic, ExtensionRegistry, ExtensionToolContext, ExtensionUiMetadata, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, RequestSessionParams, RequestedSkillsMetadataReader, SearchConfig, Session, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchManager, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, Tool, buildCompressingCompactionCheckpoint, resolveThinkingLevel } from "@nextclaw/core";
8
7
  import * as _$_nextclaw_ncp_toolkit0 from "@nextclaw/ncp-toolkit";
9
8
  import { AgentSessionRecord, ChatTarget, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
10
9
 
10
+ //#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
11
+ type AgentRuntimeSessionTypeIcon = {
12
+ kind: "image";
13
+ src: string;
14
+ alt?: string | null;
15
+ };
16
+ type AgentRuntimeSessionTypeOption = {
17
+ value: string;
18
+ label: string;
19
+ icon?: AgentRuntimeSessionTypeIcon | null;
20
+ ready?: boolean;
21
+ reason?: string | null;
22
+ reasonMessage?: string | null;
23
+ supportedModels?: string[];
24
+ recommendedModel?: string | null;
25
+ cta?: {
26
+ kind: string;
27
+ label?: string;
28
+ href?: string;
29
+ } | null;
30
+ };
31
+ type AgentRuntimeSessionTypeDescribeParams = {
32
+ describeMode?: "observation" | "probe";
33
+ };
34
+ type AgentRuntimeEntry = {
35
+ id: string;
36
+ label: string;
37
+ icon?: AgentRuntimeSessionTypeIcon | null;
38
+ type: string;
39
+ enabled?: boolean;
40
+ config?: Record<string, unknown>;
41
+ };
42
+ type AgentRuntimeProviderRegistration = {
43
+ kind: string;
44
+ label: string;
45
+ createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
46
+ createRuntimeForEntry?: (params: {
47
+ entry: AgentRuntimeEntry;
48
+ runtimeParams: RuntimeFactoryParams;
49
+ }) => NcpAgentRuntime;
50
+ describeSessionType?: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined> | Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined;
51
+ describeSessionTypeForEntry?: (params: {
52
+ entry: AgentRuntimeEntry;
53
+ describeParams?: AgentRuntimeSessionTypeDescribeParams;
54
+ }) => Promise<Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined> | Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined;
55
+ };
56
+ declare function normalizeAgentRuntimeSessionTypeIcon(value: unknown): AgentRuntimeSessionTypeIcon | null;
57
+ type ConfigRuntimeEntry = {
58
+ enabled?: boolean;
59
+ label?: string;
60
+ icon?: unknown;
61
+ type?: string;
62
+ config?: Record<string, unknown>;
63
+ };
64
+ type AgentRuntimeResolverConfig = {
65
+ ui?: {
66
+ ncp?: {
67
+ runtimes?: {
68
+ native?: unknown;
69
+ };
70
+ };
71
+ };
72
+ agents: {
73
+ runtimes: {
74
+ entries?: Record<string, ConfigRuntimeEntry>;
75
+ };
76
+ };
77
+ };
78
+ declare function resolveAgentRuntimeEntries(params: {
79
+ config: AgentRuntimeResolverConfig;
80
+ }): {
81
+ defaultEntryId: string;
82
+ entries: AgentRuntimeEntry[];
83
+ };
84
+ declare class AgentRuntimeRegistry {
85
+ private readonly providers;
86
+ private entries;
87
+ private defaultEntryId;
88
+ register: (registration: AgentRuntimeProviderRegistration) => Disposable;
89
+ applyEntries: (params: {
90
+ entries: AgentRuntimeEntry[];
91
+ defaultEntryId?: string;
92
+ }) => void;
93
+ resolveSessionMetadata: (sessionMetadata: Record<string, unknown>) => Record<string, unknown>;
94
+ createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
95
+ private resolveRuntimeEntry;
96
+ listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
97
+ defaultType: string;
98
+ options: AgentRuntimeSessionTypeOption[];
99
+ }>;
100
+ }
101
+ //#endregion
11
102
  //#region src/types/entity-ids.types.d.ts
12
103
  type AgentId = string;
13
104
  type TaskId = string;
@@ -107,99 +198,6 @@ type PublishSessionEventOptions = {
107
198
  persistSession?: boolean;
108
199
  };
109
200
  //#endregion
110
- //#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
111
- declare const DEFAULT_AGENT_RUNTIME_ENTRY_ID = "native";
112
- type AgentRuntimeSessionTypeIcon = {
113
- kind: "image";
114
- src: string;
115
- alt?: string | null;
116
- };
117
- type AgentRuntimeSessionTypeOption = {
118
- value: string;
119
- label: string;
120
- icon?: AgentRuntimeSessionTypeIcon | null;
121
- ready?: boolean;
122
- reason?: string | null;
123
- reasonMessage?: string | null;
124
- supportedModels?: string[];
125
- recommendedModel?: string | null;
126
- cta?: {
127
- kind: string;
128
- label?: string;
129
- href?: string;
130
- } | null;
131
- };
132
- type AgentRuntimeSessionTypeDescribeParams = {
133
- describeMode?: "observation" | "probe";
134
- };
135
- type AgentRuntimeEntry = {
136
- id: string;
137
- label: string;
138
- icon?: AgentRuntimeSessionTypeIcon | null;
139
- type: string;
140
- enabled?: boolean;
141
- config?: Record<string, unknown>;
142
- };
143
- type AgentRuntimeProviderRegistration = {
144
- kind: string;
145
- label: string;
146
- createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
147
- createRuntimeForEntry?: (params: {
148
- entry: AgentRuntimeEntry;
149
- runtimeParams: RuntimeFactoryParams;
150
- }) => NcpAgentRuntime;
151
- describeSessionType?: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined> | Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined;
152
- describeSessionTypeForEntry?: (params: {
153
- entry: AgentRuntimeEntry;
154
- describeParams?: AgentRuntimeSessionTypeDescribeParams;
155
- }) => Promise<Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined> | Omit<AgentRuntimeSessionTypeOption, "value" | "label"> | null | undefined;
156
- };
157
- declare function normalizeAgentRuntimeSessionTypeIcon(value: unknown): AgentRuntimeSessionTypeIcon | null;
158
- type ConfigRuntimeEntry = {
159
- enabled?: boolean;
160
- label?: string;
161
- icon?: unknown;
162
- type?: string;
163
- config?: Record<string, unknown>;
164
- };
165
- type AgentRuntimeResolverConfig = {
166
- ui?: {
167
- ncp?: {
168
- runtimes?: {
169
- native?: unknown;
170
- };
171
- };
172
- };
173
- agents: {
174
- runtimes: {
175
- entries?: Record<string, ConfigRuntimeEntry>;
176
- };
177
- };
178
- };
179
- declare function resolveAgentRuntimeEntries(params: {
180
- config: AgentRuntimeResolverConfig;
181
- }): {
182
- defaultEntryId: string;
183
- entries: AgentRuntimeEntry[];
184
- };
185
- declare class AgentRuntimeRegistry {
186
- private readonly providers;
187
- private entries;
188
- private defaultEntryId;
189
- register: (registration: AgentRuntimeProviderRegistration) => Disposable;
190
- applyEntries: (params: {
191
- entries: AgentRuntimeEntry[];
192
- defaultEntryId?: string;
193
- }) => void;
194
- resolveSessionMetadata: (sessionMetadata: Record<string, unknown>) => Record<string, unknown>;
195
- createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
196
- private resolveRuntimeEntry;
197
- listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
198
- defaultType: string;
199
- options: AgentRuntimeSessionTypeOption[];
200
- }>;
201
- }
202
- //#endregion
203
201
  //#region src/managers/agent-runtime.manager.d.ts
204
202
  type AgentRuntimeManagerOptions = {
205
203
  configManager: {
@@ -324,6 +322,7 @@ declare class LlmProviderManager {
324
322
  private matchPrefixedProvider;
325
323
  private getOrCreateProvider;
326
324
  private createProvider;
325
+ private prepareMessagesForProvider;
327
326
  private buildCacheKey;
328
327
  }
329
328
  //#endregion
@@ -340,14 +339,6 @@ type ConfigManagerRuntimeHooks = {
340
339
  config: Config;
341
340
  changedPaths: string[];
342
341
  }) => Promise<void> | void;
343
- reloadPlugins?: (params: {
344
- config: Config;
345
- changedPaths: string[];
346
- }) => Promise<{
347
- restartChannels?: boolean;
348
- } | void> | {
349
- restartChannels?: boolean;
350
- } | void;
351
342
  onRestartRequired?: (paths: string[]) => void;
352
343
  };
353
344
  type ConfigManagerOptions = {
@@ -378,6 +369,8 @@ declare class ConfigManager {
378
369
  constructor(options: ConfigManagerOptions);
379
370
  get config(): Config;
380
371
  loadConfig: () => Config;
372
+ getDefaultModel: () => string;
373
+ getModelMaxTokens: (model: string) => number | undefined;
381
374
  installRuntimeHooks: (hooks: ConfigManagerRuntimeHooks) => void;
382
375
  applyLiveConfigReload: () => Promise<void>;
383
376
  applyReloadPlan: (nextConfig: Config) => Promise<void>;
@@ -398,7 +391,6 @@ declare class ConfigManager {
398
391
  private resolveChannelConfig;
399
392
  private resolveExtensionChannels;
400
393
  private reloadProvider;
401
- private reloadPlugins;
402
394
  private reloadMcp;
403
395
  private reloadCompanion;
404
396
  private readConfigSnapshot;
@@ -411,6 +403,9 @@ declare class ConfigManager {
411
403
  }
412
404
  //#endregion
413
405
  //#region src/managers/ncp-session.manager.d.ts
406
+ type CreateNcpSessionInput = CreateSessionInput & {
407
+ sessionId?: string;
408
+ };
414
409
  type NcpSessionManagerOptions = {
415
410
  configManager: ConfigManager;
416
411
  eventBus: EventBus;
@@ -424,7 +419,7 @@ declare class NcpSessionManager implements NcpSessionApi {
424
419
  private readonly unsubscribeSessionRunStatus;
425
420
  constructor(options: NcpSessionManagerOptions);
426
421
  dispose: () => void;
427
- createSession: (params: CreateSessionInput) => Promise<CreatedSession>;
422
+ createSession: (params: CreateNcpSessionInput) => Promise<CreatedSession>;
428
423
  appendSessionEvent: (params: {
429
424
  sessionId: string;
430
425
  event: NcpAgentSessionJournalReplayEvent;
@@ -465,7 +460,6 @@ declare class SessionRunManager {
465
460
  getLiveSessionRecord: (sessionId: string) => _$_nextclaw_ncp_toolkit0.AgentSessionRecord | null;
466
461
  setActiveSessionRun: (sessionId: string, activeRun: LiveSessionExecution) => void;
467
462
  deleteActiveSessionRun: (sessionId: string, runId: string) => void;
468
- streamSessionEvents: (payload: NcpStreamRequestPayload, options?: NcpAgentRunStreamOptions) => AsyncIterable<NcpEndpointEvent>;
469
463
  updateToolCallResult: UpdateToolCallResult;
470
464
  updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
471
465
  appendSessionEvent: (sessionId: string, event: NcpEndpointEvent, options?: PublishSessionEventOptions) => Promise<void>;
@@ -480,7 +474,7 @@ declare class SessionRunManager {
480
474
  //#region src/features/context-compaction/managers/context-compaction.manager.d.ts
481
475
  declare class ContextWindowPreviewManager {
482
476
  private readonly options;
483
- private readonly contextWindowBudgetService;
477
+ private readonly preflightService;
484
478
  constructor(options: {
485
479
  configManager: ConfigManager;
486
480
  });
@@ -494,8 +488,7 @@ declare class ContextWindowPreviewManager {
494
488
  }
495
489
  declare class ContextCompactionManager {
496
490
  private readonly options;
497
- private readonly compactionService;
498
- private readonly contextWindowBudgetService;
491
+ private readonly preflightService;
499
492
  constructor(options: {
500
493
  configManager: ConfigManager;
501
494
  providerManager?: LlmProviderRuntime;
@@ -505,12 +498,62 @@ declare class ContextCompactionManager {
505
498
  input: NcpAgentRunInput;
506
499
  session: LiveSession;
507
500
  }) => AsyncIterable<NcpEndpointEvent>;
508
- private begin;
509
- private finish;
510
- private generateSummary;
511
501
  private applyLivePreflightResult;
512
502
  }
513
503
  //#endregion
504
+ //#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
505
+ type ContextCompactionPreflightResult = {
506
+ contextWindow: ContextWindowSnapshot;
507
+ metadataPatch: Record<string, unknown>;
508
+ sessionMessages: NcpMessage[];
509
+ timelineMessage: NcpMessage | null;
510
+ };
511
+ type ContextCompactionPreflightBeginResult = ContextCompactionPreflightResult & {
512
+ pendingCompaction: ContextCompactionPendingWork | null;
513
+ };
514
+ type ContextCompactionPendingWork = {
515
+ checkpoint: ReturnType<typeof buildCompressingCompactionCheckpoint>;
516
+ contextTokens: number;
517
+ model: string;
518
+ plan: ContextCompactionPlan;
519
+ reservedContextTokens: number;
520
+ sessionId: string;
521
+ sessionMessages: NcpMessage[];
522
+ };
523
+ declare class ContextCompactionPreflightService {
524
+ private readonly options;
525
+ private readonly compactionService;
526
+ private readonly contextWindowBudgetService;
527
+ constructor(options: {
528
+ configManager: ConfigManager;
529
+ providerManager?: LlmProviderRuntime;
530
+ });
531
+ preview: (params: {
532
+ requestMetadata: Record<string, unknown>;
533
+ sessionId: string;
534
+ sessionMessages: readonly NcpMessage[];
535
+ storedAgentId?: string;
536
+ storedMetadata: Record<string, unknown>;
537
+ }) => ContextWindowSnapshot | null;
538
+ begin: (params: {
539
+ inputMessages: readonly NcpMessage[];
540
+ requestMetadata: Record<string, unknown>;
541
+ sessionId: string;
542
+ sessionMessages: readonly NcpMessage[];
543
+ storedAgentId?: string;
544
+ storedMetadata: Record<string, unknown>;
545
+ }) => ContextCompactionPreflightBeginResult;
546
+ finish: (pending: ContextCompactionPendingWork) => Promise<ContextCompactionPreflightResult>;
547
+ private generateSummary;
548
+ }
549
+ //#endregion
550
+ //#region src/features/context-compaction/utils/context-window-event.utils.d.ts
551
+ declare function readContextWindowEventSessionId(event: NcpEndpointEvent): string | null;
552
+ declare function isContextWindowSnapshot(value: unknown): value is Record<string, unknown>;
553
+ declare function createContextWindowSignature(value: Record<string, unknown>): string;
554
+ declare function shouldRefreshContextWindowDuringStream(event: NcpEndpointEvent): boolean;
555
+ declare function shouldRefreshContextWindowImmediately(event: NcpEndpointEvent): boolean;
556
+ //#endregion
514
557
  //#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
515
558
  declare function projectNcpMessagesWithContextCompaction(params: {
516
559
  sessionId: string;
@@ -582,34 +625,16 @@ declare class AutomationManager extends CronService {
582
625
  constructor(options: AutomationManagerOptions);
583
626
  }
584
627
  //#endregion
585
- //#region src/services/extension-plugin-registry.service.d.ts
586
- type ExtensionPluginLoadProgress = {
587
- loadedPluginCount: number;
588
- pluginId?: string;
589
- };
590
- declare class ExtensionPluginRegistryService {
591
- discoverEnabledPluginCount: (params: {
592
- config: Config;
593
- workspace: string;
594
- }) => number;
595
- load: (params: {
596
- config: Config;
597
- workspace: string;
598
- }) => PluginRegistry;
599
- loadProgressively: (params: {
600
- config: Config;
601
- workspace: string;
602
- onPluginProcessed?: (params: ExtensionPluginLoadProgress) => void;
603
- }) => Promise<PluginRegistry>;
604
- private resolveLoadingContext;
605
- }
606
- //#endregion
607
628
  //#region src/managers/extension.manager.d.ts
608
- type ExtensionLoadProgress = ExtensionPluginLoadProgress;
629
+ type ExtensionLoadProgress = {
630
+ extensionId: string;
631
+ loadedExtensionCount: number;
632
+ totalExtensionCount: number;
633
+ };
609
634
  type ExtensionLoadResult = {
610
- diagnostics: PluginRegistry["diagnostics"];
611
- totalPluginCount: number;
612
- loadedPluginCount: number;
635
+ diagnostics: ExtensionDiagnostic[];
636
+ totalExtensionCount: number;
637
+ loadedExtensionCount: number;
613
638
  shouldRestartChannels: boolean;
614
639
  };
615
640
  type ExtensionManagerOptions = {
@@ -617,22 +642,22 @@ type ExtensionManagerOptions = {
617
642
  eventBus: Pick<EventBus, "emitEnvelope">;
618
643
  ingress: Pick<Ingress, "addHandler">;
619
644
  messageBus: Pick<MessageBus, "publishInbound">;
645
+ sessionManager: SessionManager;
620
646
  };
621
647
  type ExtensionLoadParams = {
622
648
  config?: Config;
623
649
  changedPaths?: readonly string[];
624
650
  onLoadStart?: (params: {
625
- totalPluginCount: number;
651
+ totalExtensionCount: number;
626
652
  }) => void;
627
- onPluginProcessed?: (params: ExtensionLoadProgress) => void;
653
+ onExtensionProcessed?: (params: ExtensionLoadProgress) => void;
628
654
  };
629
655
  declare class ExtensionManager {
630
656
  private readonly options;
631
657
  private snapshot;
632
658
  private readonly runtime;
633
- private readonly pluginRegistry;
634
659
  constructor(options: ExtensionManagerOptions);
635
- load: (params: ExtensionLoadParams) => Promise<ExtensionLoadResult>;
660
+ load: (params?: ExtensionLoadParams) => Promise<ExtensionLoadResult>;
636
661
  reloadForConfigChange: (params: ExtensionLoadParams & {
637
662
  changedPaths: readonly string[];
638
663
  }) => Promise<ExtensionLoadResult>;
@@ -642,8 +667,8 @@ declare class ExtensionManager {
642
667
  }) => Promise<void>;
643
668
  stop: () => Promise<void>;
644
669
  getExtensionRegistry: () => ExtensionRegistry;
645
- getChannelBindings: () => PluginChannelBinding[];
646
- getUiMetadata: () => PluginUiMetadata[];
670
+ getChannelBindings: () => ExtensionChannelBinding[];
671
+ getUiMetadata: () => ExtensionUiMetadata[];
647
672
  toConfigView: (config: Config) => Config;
648
673
  mergeConfigView: (current: Config, nextConfigView: Record<string, unknown>) => Config;
649
674
  private readonly getWorkspace;
@@ -911,9 +936,14 @@ declare class NextclawKernel {
911
936
  readonly sessionRunManager: SessionRunManager;
912
937
  readonly agentRuntimeManager: AgentRuntimeManager;
913
938
  private readonly ncpAgentSessionJournalStore;
939
+ private readonly agentRunContribution;
914
940
  private readonly contributions;
915
941
  private gatewayController;
916
942
  constructor(options?: NextclawKernelOptions);
943
+ listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
944
+ defaultType: string;
945
+ options: AgentRuntimeSessionTypeOption[];
946
+ }>;
917
947
  provideGatewayController: (gatewayController: GatewayController) => void;
918
948
  getGatewayController: () => GatewayController | undefined;
919
949
  start: () => Promise<void>;
@@ -927,6 +957,9 @@ type LearningLoopRuntimeConfig = {
927
957
  };
928
958
  declare function readLearningLoopRuntimeConfig(config: Config): LearningLoopRuntimeConfig;
929
959
  //#endregion
960
+ //#region src/configs/agent-runtime.config.d.ts
961
+ declare const DEFAULT_AGENT_RUNTIME_ENTRY_ID = "native";
962
+ //#endregion
930
963
  //#region src/features/narp-runtime/services/builtin-narp-runtime-provider.service.d.ts
931
964
  declare const NARP_HTTP_RUNTIME_KIND = "narp-http";
932
965
  declare const NARP_STDIO_RUNTIME_KIND = "narp-stdio";
@@ -941,7 +974,7 @@ declare class BuiltinNarpRuntimeProviderService {
941
974
  //#endregion
942
975
  //#region src/features/ncp-dispatch/utils/nextclaw-ncp-runner.utils.d.ts
943
976
  type AssetApi = {
944
- put: (input: {
977
+ putBytes: (input: {
945
978
  fileName: string;
946
979
  mimeType?: string | null;
947
980
  bytes: Uint8Array;
@@ -951,48 +984,57 @@ type AssetApi = {
951
984
  }>;
952
985
  resolveContentPath?: (uri: string) => string | null;
953
986
  };
954
- type NcpRunnerAgent = {
955
- run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
956
- assetApi?: AssetApi;
957
- };
958
- type RunPromptOverNcpParams = {
959
- agent: NcpRunnerAgent;
987
+ type BuildAgentRunSendPayloadParams = {
960
988
  sessionId: string;
961
989
  content: string;
962
990
  attachments?: InboundAttachment[];
963
991
  metadata?: Record<string, unknown>;
992
+ assetApi?: AssetApi;
993
+ };
994
+ type AgentRunReplyOptions = {
964
995
  abortSignal?: AbortSignal;
965
996
  onAssistantDelta?: (delta: string) => void;
966
997
  onEvent?: (event: NcpEndpointEvent) => void;
967
998
  missingCompletedMessageError?: string;
968
999
  runErrorMessage?: string;
969
1000
  };
970
- type StreamPromptOverNcpParams = Omit<RunPromptOverNcpParams, "onAssistantDelta" | "missingCompletedMessageError" | "runErrorMessage">;
1001
+ type AgentRunStreamOptions = {
1002
+ abortSignal?: AbortSignal;
1003
+ onEvent?: (event: NcpEndpointEvent) => void;
1004
+ };
1005
+ type AgentRunReply = {
1006
+ handle: NcpRunHandle;
1007
+ text: string;
1008
+ completedMessage: NcpMessage;
1009
+ };
971
1010
  declare function buildUserMessageParts(params: {
972
1011
  content: string;
973
1012
  attachments?: InboundAttachment[];
974
1013
  assetApi?: AssetApi;
975
1014
  }): Promise<NcpMessagePart[]>;
976
- declare function buildNcpUserMessage(params: {
977
- sessionId: string;
978
- content: string;
979
- attachments?: InboundAttachment[];
980
- metadata?: Record<string, unknown>;
981
- assetApi?: AssetApi;
982
- }): Promise<NcpMessage>;
983
- declare function streamPromptOverNcp(params: StreamPromptOverNcpParams): AsyncGenerator<NcpEndpointEvent>;
984
- declare function runPromptOverNcp(params: RunPromptOverNcpParams): Promise<{
985
- text: string;
986
- completedMessage: NcpMessage;
987
- }>;
1015
+ declare function buildAgentRunSendPayload(params: BuildAgentRunSendPayloadParams): Promise<AgentRunSendIngressPayload>;
1016
+ declare class AgentRunClient {
1017
+ private readonly options;
1018
+ constructor(options: {
1019
+ eventBus: Pick<EventBus, "on">;
1020
+ ingress: Pick<Ingress, "handle">;
1021
+ });
1022
+ send: (input: AgentRunSendIngressPayload) => Promise<NcpRunHandle>;
1023
+ sendAndWaitForReply: (input: AgentRunSendIngressPayload, options?: AgentRunReplyOptions) => Promise<AgentRunReply>;
1024
+ sendAndStreamEvents: (this: AgentRunClient, input: AgentRunSendIngressPayload, options?: AgentRunStreamOptions) => AsyncGenerator<NcpEndpointEvent>;
1025
+ private prepareObserver;
1026
+ private sendWithCorrelation;
1027
+ }
988
1028
  //#endregion
989
1029
  //#region src/features/ncp-dispatch/services/gateway-inbound-processor.service.d.ts
990
1030
  type GatewayInboundLoopRuntime = {
991
1031
  kernel: {
992
1032
  channels: ChannelManager$1;
993
- agentRunRequestManager: NcpRunnerAgent;
1033
+ assetStore: AssetApi;
994
1034
  };
1035
+ agentRunClient: AgentRunClient;
995
1036
  messageBus: MessageBus;
1037
+ sessionManager: SessionManager;
996
1038
  configManager: {
997
1039
  loadConfig: () => Config;
998
1040
  };
@@ -1003,6 +1045,7 @@ declare class GatewayInboundProcessor {
1003
1045
  constructor(runtime: GatewayInboundLoopRuntime);
1004
1046
  process: (message: InboundMessage) => Promise<void>;
1005
1047
  private resolveRoute;
1048
+ private dispatchSlashCommandMaybe;
1006
1049
  private dispatchChannelReplyRouteMaybe;
1007
1050
  private publishLegacyReply;
1008
1051
  }
@@ -1020,7 +1063,8 @@ type ResolvedInboundRoute = {
1020
1063
  accountId?: string | null;
1021
1064
  };
1022
1065
  type ChannelReplyRouterDispatchParams = {
1023
- agent: NcpRunnerAgent;
1066
+ agentRunClient: AgentRunClient;
1067
+ assetApi?: AssetApi;
1024
1068
  route: ChannelReplyRoute;
1025
1069
  sessionId: string;
1026
1070
  content: string;
@@ -1040,7 +1084,7 @@ declare function dispatchChannelReplyRoute(params: ChannelReplyRouterDispatchPar
1040
1084
  //#region src/features/ncp-dispatch/utils/nextclaw-ncp-dispatch.utils.d.ts
1041
1085
  type DirectPromptDispatchParams = {
1042
1086
  config: Config;
1043
- agentRunRequests: NcpRunnerAgent;
1087
+ agentRunClient: AgentRunClient;
1044
1088
  content: string;
1045
1089
  sessionKey?: string;
1046
1090
  channel?: string;
@@ -1101,6 +1145,42 @@ declare function createAssetTools(params: {
1101
1145
  contentBasePath?: string;
1102
1146
  }): NcpTool[];
1103
1147
  //#endregion
1148
+ //#region src/features/native-runtime/utils/nextclaw-ncp-run-context.utils.d.ts
1149
+ type NextclawNcpResolvedAgentProfile = {
1150
+ agentId: string;
1151
+ contextTokens: number;
1152
+ execTimeoutSeconds: number;
1153
+ model: string;
1154
+ reservedContextTokens: number;
1155
+ restrictToWorkspace: boolean;
1156
+ searchConfig: Config["search"];
1157
+ workspace: string;
1158
+ };
1159
+ type NextclawNcpRunContextParams = {
1160
+ configManager: ConfigManager;
1161
+ sessionId: string;
1162
+ requestMetadata?: Record<string, unknown>;
1163
+ sessionMetadata?: Record<string, unknown>;
1164
+ storedAgentId?: string;
1165
+ };
1166
+ type NextclawNcpResolvedRunContext = {
1167
+ channel: string;
1168
+ chatId: string;
1169
+ config: Config;
1170
+ effectiveModel: string;
1171
+ effectiveWorkspace: string;
1172
+ profile: NextclawNcpResolvedAgentProfile;
1173
+ requestMetadata: Record<string, unknown>;
1174
+ requestedSkills: ReturnType<RequestedSkillsMetadataReader["readSelection"]>;
1175
+ requestedToolNames: string[];
1176
+ runtimeThinking: ReturnType<typeof resolveThinkingLevel>;
1177
+ sessionKey: string;
1178
+ sessionMetadata: Record<string, unknown>;
1179
+ toolRunContext: ToolRunContext;
1180
+ };
1181
+ declare function buildSessionOrchestrationSection(): string;
1182
+ declare function resolveNextclawNcpRunContext(params: NextclawNcpRunContextParams): NextclawNcpResolvedRunContext;
1183
+ //#endregion
1104
1184
  //#region src/features/native-runtime/utils/nextclaw-ncp-session-preferences.utils.d.ts
1105
1185
  declare function normalizeOptionalString(value: unknown): string | undefined;
1106
1186
  declare function readMetadataModel(metadata: Record<string, unknown>): string | null;
@@ -1156,5 +1236,5 @@ type SkillRecord = {
1156
1236
  metadata: Record<string, unknown>;
1157
1237
  };
1158
1238
  //#endregion
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 };
1239
+ export { AgentId, AgentManager, AgentRecord, AgentRunClient, AgentRunReply, AgentRunReplyOptions, AgentRunRequestManager, AgentRunStreamOptions, AgentRuntimeEntry, AgentRuntimeManager, AgentRuntimeManagerOptions, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AssetApi, AutomationId, AutomationManager, AutomationManagerOptions, BuildAgentRunSendPayloadParams, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionManager, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextCompactionTimelineCheckpoint, ContextWindowPreviewManager, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DirectPromptDispatchParams, ExtensionLoadProgress, ExtensionLoadResult, ExtensionManager, 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, NcpSessionManager, NcpSessionManagerOptions, NextclawKernel, NextclawKernelOptions, NextclawNcpContextBuilder, NextclawNcpResolvedAgentProfile, NextclawNcpResolvedRunContext, NextclawNcpRunContextParams, ProviderManagerNcpLLMApi, SessionId, SessionRequestManager, SessionRequestManagerOptions, SessionRunManager, SkillFrontmatter, SkillId, type SkillInfo, SkillManager, SkillRecord, type SkillScope, TaskId, ToolId, ToolManager, ToolProvider, ToolRecord, ToolRegistrationContext, ToolRunContext, ToolRuntimeRegistry, ToolRuntimeRegistryOptions, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, UpdateToolCallResult, buildAgentRunSendPayload, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildSessionOrchestrationSection, buildUserMessageParts, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createContextWindowSignature, createLlmUsageRecord, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isContextCompactionTimelineMessage, isContextWindowSnapshot, isReplyCapableChannel, listExtensionChannelIds, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, normalizeOptionalString, parseSkillFrontmatter, projectNcpMessagesWithContextCompaction, readContextWindowEventSessionId, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, resolveAgentHandoffDepth, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolveNextclawNcpRunContext, resolveSessionChannelContext, runGatewayInboundLoop, sanitizeLlmUsage, serializeUnsignedUpdateManifest, shouldRefreshContextWindowDuringStream, shouldRefreshContextWindowImmediately, stripSkillFrontmatter, syncSessionThinkingPreference, toNcpMessages, upsertContextCompactionTimelineMessage, waitForAgentRuntimeSessionReply };
1160
1240
  //# sourceMappingURL=index.d.ts.map