@nextclaw/kernel 0.1.8 → 0.1.9
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 +632 -512
- package/dist/index.js +6020 -4506
- package/package.json +15 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
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, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, SearchConfig, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestManager, SessionRequestRecord,
|
|
3
|
-
import * as _$_nextclaw_shared0 from "@nextclaw/shared";
|
|
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";
|
|
4
3
|
import { EventBus, Ingress, Unsubscribe } from "@nextclaw/shared";
|
|
5
|
-
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
6
4
|
import * as _$_nextclaw_ncp0 from "@nextclaw/ncp";
|
|
7
|
-
import { ListMessagesOptions, ListSessionsOptions,
|
|
8
|
-
import { AgentSessionStore, ChatTarget, DefaultNcpAgentBackend, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
|
|
9
|
-
import { McpNcpToolRegistryAdapter } from "@nextclaw/ncp-mcp";
|
|
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";
|
|
10
6
|
import { PluginChannelBinding, PluginRegistry, PluginUiMetadata } from "@nextclaw/openclaw-compat";
|
|
11
|
-
import {
|
|
7
|
+
import { AgentSessionStore, ChatTarget, EventPublisher, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
|
|
8
|
+
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
12
9
|
|
|
13
10
|
//#region src/types/entity-ids.types.d.ts
|
|
14
11
|
type AgentId = string;
|
|
@@ -42,105 +39,75 @@ declare class AgentManager {
|
|
|
42
39
|
detachTool: (agentId: AgentId, toolId: ToolId) => never;
|
|
43
40
|
}
|
|
44
41
|
//#endregion
|
|
45
|
-
//#region src/managers/
|
|
46
|
-
type
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
//#region src/managers/tool.manager.d.ts
|
|
43
|
+
type UpdateToolCallResult = (params: {
|
|
44
|
+
sessionId: string;
|
|
45
|
+
toolCallId: string;
|
|
46
|
+
result: unknown;
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
type ToolRunContext = {
|
|
49
|
+
agentId: string;
|
|
50
|
+
channel: string;
|
|
51
|
+
chatId: string;
|
|
52
|
+
config: Config;
|
|
53
|
+
execTimeoutSeconds: number;
|
|
54
|
+
handoffDepth: number;
|
|
55
|
+
metadata: Record<string, unknown>;
|
|
56
|
+
restrictToWorkspace: boolean;
|
|
57
|
+
searchConfig: SearchConfig;
|
|
58
|
+
sessionId: string;
|
|
59
|
+
workspace: string;
|
|
53
60
|
};
|
|
54
|
-
type
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
type ToolRegistrationContext = {
|
|
62
|
+
registerTool: (tool: Tool) => void;
|
|
63
|
+
registerNcpTool: (tool: NcpTool) => void;
|
|
64
|
+
hasTool: (name: string) => boolean;
|
|
65
|
+
getExtensionToolRunContext: () => ExtensionToolContext;
|
|
58
66
|
};
|
|
59
|
-
type
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
apiBase?: string | null;
|
|
63
|
-
defaultModel: string;
|
|
64
|
-
extraHeaders?: Record<string, string> | null;
|
|
65
|
-
wireApi?: "auto" | "chat" | "responses" | null;
|
|
66
|
-
messages: Array<Record<string, unknown>>;
|
|
67
|
-
maxTokens?: number;
|
|
68
|
-
signal?: AbortSignal;
|
|
67
|
+
type ToolProvider = {
|
|
68
|
+
id: string;
|
|
69
|
+
registerTools: (context: ToolRunContext, registry: ToolRegistrationContext) => void;
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
private resolveProvider;
|
|
83
|
-
private matchPrefixedProvider;
|
|
84
|
-
private getOrCreateProvider;
|
|
85
|
-
private createProvider;
|
|
86
|
-
private buildCacheKey;
|
|
71
|
+
type ToolRuntimeRegistryOptions = {
|
|
72
|
+
updateToolCallResult: UpdateToolCallResult;
|
|
73
|
+
};
|
|
74
|
+
type ToolRuntimeRegistry = NcpToolRegistry & {
|
|
75
|
+
prepareForRun: (context: ToolRunContext) => void;
|
|
76
|
+
};
|
|
77
|
+
declare class ToolManager {
|
|
78
|
+
private readonly providers;
|
|
79
|
+
provideTools: (provider: ToolProvider) => {
|
|
80
|
+
dispose: () => void;
|
|
81
|
+
};
|
|
82
|
+
createRuntimeRegistry: (options: ToolRuntimeRegistryOptions) => ToolRuntimeRegistry;
|
|
87
83
|
}
|
|
84
|
+
declare function resolveAgentHandoffDepth(metadata: Record<string, unknown>): number;
|
|
88
85
|
//#endregion
|
|
89
|
-
//#region src/
|
|
90
|
-
type
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
entry: {
|
|
97
|
-
id: string;
|
|
98
|
-
label: string;
|
|
99
|
-
type: string;
|
|
100
|
-
enabled?: boolean;
|
|
101
|
-
config?: Record<string, unknown>;
|
|
102
|
-
};
|
|
103
|
-
runtimeParams: RuntimeFactoryParams;
|
|
104
|
-
}) => NcpAgentRuntime;
|
|
105
|
-
describeSessionType?: (params?: {
|
|
106
|
-
describeMode?: "observation" | "probe";
|
|
107
|
-
}) => Promise<Record<string, unknown> | null | undefined> | Record<string, unknown> | null | undefined;
|
|
108
|
-
describeSessionTypeForEntry?: (params: {
|
|
109
|
-
entry: {
|
|
110
|
-
id: string;
|
|
111
|
-
label: string;
|
|
112
|
-
type: string;
|
|
113
|
-
enabled?: boolean;
|
|
114
|
-
config?: Record<string, unknown>;
|
|
115
|
-
};
|
|
116
|
-
describeParams?: {
|
|
117
|
-
describeMode?: "observation" | "probe";
|
|
118
|
-
};
|
|
119
|
-
}) => Promise<Record<string, unknown> | null | undefined> | Record<string, unknown> | null | undefined;
|
|
120
|
-
source?: string;
|
|
86
|
+
//#region src/utils/session-run.utils.d.ts
|
|
87
|
+
type LiveSessionExecution = {
|
|
88
|
+
runId: string;
|
|
89
|
+
controller: AbortController;
|
|
90
|
+
requestEnvelope: MaterializedAgentRunRequest;
|
|
91
|
+
abortHandled: boolean;
|
|
92
|
+
closed: boolean;
|
|
121
93
|
};
|
|
122
|
-
type
|
|
123
|
-
|
|
94
|
+
type MaterializedAgentRunRequest = NcpRequestEnvelope & {
|
|
95
|
+
runId: string;
|
|
124
96
|
};
|
|
125
|
-
type
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
97
|
+
type LiveSession = {
|
|
98
|
+
sessionId: string;
|
|
99
|
+
agentId?: string;
|
|
100
|
+
createdAt: string;
|
|
101
|
+
stateManager: NcpAgentConversationStateManager;
|
|
102
|
+
metadata: Record<string, unknown>;
|
|
103
|
+
runtime: NcpAgentRuntime;
|
|
104
|
+
publisher: EventPublisher;
|
|
105
|
+
activeExecution: LiveSessionExecution | null;
|
|
106
|
+
};
|
|
107
|
+
type PublishSessionEventOptions = {
|
|
108
|
+
dispatchToStateManager?: boolean;
|
|
109
|
+
persistSession?: boolean;
|
|
130
110
|
};
|
|
131
|
-
declare class ExtensionManager {
|
|
132
|
-
private pluginRegistry;
|
|
133
|
-
private extensionRegistry;
|
|
134
|
-
private channelBindings;
|
|
135
|
-
private uiMetadata;
|
|
136
|
-
loadContributions: (contributions: ExtensionContributions) => void;
|
|
137
|
-
loadExtensionRegistry: (extensionRegistry: NextclawExtensionRegistry) => void;
|
|
138
|
-
getExtensionRegistry: () => NextclawExtensionRegistry;
|
|
139
|
-
getChannelBindings: () => PluginChannelBinding[];
|
|
140
|
-
getUiMetadata: () => PluginUiMetadata[];
|
|
141
|
-
toConfigView: (config: Config) => Config;
|
|
142
|
-
mergeConfigView: (current: Config, nextConfigView: Record<string, unknown>) => Config;
|
|
143
|
-
}
|
|
144
111
|
//#endregion
|
|
145
112
|
//#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
|
|
146
113
|
declare const DEFAULT_AGENT_RUNTIME_ENTRY_ID = "native";
|
|
@@ -213,7 +180,6 @@ type AgentRuntimeResolverConfig = {
|
|
|
213
180
|
};
|
|
214
181
|
declare function resolveAgentRuntimeEntries(params: {
|
|
215
182
|
config: AgentRuntimeResolverConfig;
|
|
216
|
-
providerKinds: string[];
|
|
217
183
|
}): {
|
|
218
184
|
defaultEntryId: string;
|
|
219
185
|
entries: AgentRuntimeEntry[];
|
|
@@ -227,7 +193,6 @@ declare class AgentRuntimeRegistry {
|
|
|
227
193
|
entries: AgentRuntimeEntry[];
|
|
228
194
|
defaultEntryId?: string;
|
|
229
195
|
}) => void;
|
|
230
|
-
listProviderKinds: () => string[];
|
|
231
196
|
createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
|
|
232
197
|
listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
|
|
233
198
|
defaultType: string;
|
|
@@ -235,273 +200,86 @@ declare class AgentRuntimeRegistry {
|
|
|
235
200
|
}>;
|
|
236
201
|
}
|
|
237
202
|
//#endregion
|
|
238
|
-
//#region src/features/runtime-registry/controllers/plugin-runtime-registration.controller.d.ts
|
|
239
|
-
declare class PluginRuntimeRegistrationController {
|
|
240
|
-
private readonly runtimeRegistry;
|
|
241
|
-
private readonly extensions;
|
|
242
|
-
private readonly pluginRuntimeScopes;
|
|
243
|
-
private pluginRuntimeSnapshotKey;
|
|
244
|
-
constructor(runtimeRegistry: AgentRuntimeRegistry, extensions: ExtensionManager);
|
|
245
|
-
refreshPluginRuntimeRegistrations: () => void;
|
|
246
|
-
dispose: () => void;
|
|
247
|
-
private syncPluginRuntimeRegistrations;
|
|
248
|
-
private resolveActiveExtensionRegistry;
|
|
249
|
-
}
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region src/features/ncp-dispatch/utils/agent-runtime-handle.utils.d.ts
|
|
252
|
-
type AgentRuntimeSessionTypes = Awaited<ReturnType<AgentRuntimeRegistry["listSessionTypes"]>>;
|
|
253
|
-
type AgentRuntimeEndpoint = {
|
|
254
|
-
agentClientEndpoint: NcpAgentClientEndpoint;
|
|
255
|
-
streamProvider?: NcpHttpAgentStreamProvider;
|
|
256
|
-
listSessionTypes?: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<AgentRuntimeSessionTypes> | AgentRuntimeSessionTypes;
|
|
257
|
-
assetApi?: {
|
|
258
|
-
put: (input: {
|
|
259
|
-
fileName: string;
|
|
260
|
-
mimeType?: string | null;
|
|
261
|
-
bytes: Uint8Array;
|
|
262
|
-
createdAt?: Date;
|
|
263
|
-
}) => ReturnType<LocalAssetStore["putBytes"]>;
|
|
264
|
-
stat: LocalAssetStore["statRecord"];
|
|
265
|
-
resolveContentPath: LocalAssetStore["resolveContentPath"];
|
|
266
|
-
};
|
|
267
|
-
basePath?: string;
|
|
268
|
-
};
|
|
269
|
-
type AgentRuntimeHandle = AgentRuntimeEndpoint & {
|
|
270
|
-
runApi: NcpAgentRunApi;
|
|
271
|
-
sessionApi: NcpSessionApi;
|
|
272
|
-
applyMcpConfig?: (config: Config) => Promise<void>;
|
|
273
|
-
dispose?: () => Promise<void>;
|
|
274
|
-
};
|
|
275
|
-
declare function createAgentRuntimeHandle(params: {
|
|
276
|
-
backend: DefaultNcpAgentBackend;
|
|
277
|
-
agentClientEndpoint?: NcpAgentClientEndpoint;
|
|
278
|
-
runtimeRegistry: AgentRuntimeRegistry;
|
|
279
|
-
refreshPluginRuntimeRegistrations: () => void;
|
|
280
|
-
refreshConfiguredRuntimeEntries: () => void;
|
|
281
|
-
applyMcpConfig: (config: Config) => Promise<void>;
|
|
282
|
-
dispose: () => Promise<void>;
|
|
283
|
-
assetStore: LocalAssetStore;
|
|
284
|
-
}): AgentRuntimeHandle;
|
|
285
|
-
//#endregion
|
|
286
|
-
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-runner.utils.d.ts
|
|
287
|
-
type AssetApi = {
|
|
288
|
-
put: (input: {
|
|
289
|
-
fileName: string;
|
|
290
|
-
mimeType?: string | null;
|
|
291
|
-
bytes: Uint8Array;
|
|
292
|
-
createdAt?: Date;
|
|
293
|
-
}) => Promise<{
|
|
294
|
-
uri: string;
|
|
295
|
-
}>;
|
|
296
|
-
resolveContentPath?: (uri: string) => string | null;
|
|
297
|
-
};
|
|
298
|
-
type NcpRunnerAgent = {
|
|
299
|
-
runApi: NcpAgentRunApi;
|
|
300
|
-
assetApi?: AssetApi;
|
|
301
|
-
};
|
|
302
|
-
type RunPromptOverNcpParams = {
|
|
303
|
-
agent: NcpRunnerAgent;
|
|
304
|
-
sessionId: string;
|
|
305
|
-
content: string;
|
|
306
|
-
attachments?: InboundAttachment[];
|
|
307
|
-
metadata?: Record<string, unknown>;
|
|
308
|
-
abortSignal?: AbortSignal;
|
|
309
|
-
onAssistantDelta?: (delta: string) => void;
|
|
310
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
311
|
-
missingCompletedMessageError?: string;
|
|
312
|
-
runErrorMessage?: string;
|
|
313
|
-
};
|
|
314
|
-
type StreamPromptOverNcpParams = Omit<RunPromptOverNcpParams, "onAssistantDelta" | "missingCompletedMessageError" | "runErrorMessage">;
|
|
315
|
-
declare function buildUserMessageParts(params: {
|
|
316
|
-
content: string;
|
|
317
|
-
attachments?: InboundAttachment[];
|
|
318
|
-
assetApi?: AssetApi;
|
|
319
|
-
}): Promise<NcpMessagePart[]>;
|
|
320
|
-
declare function buildNcpUserMessage(params: {
|
|
321
|
-
sessionId: string;
|
|
322
|
-
content: string;
|
|
323
|
-
attachments?: InboundAttachment[];
|
|
324
|
-
metadata?: Record<string, unknown>;
|
|
325
|
-
assetApi?: AssetApi;
|
|
326
|
-
}): Promise<NcpMessage>;
|
|
327
|
-
declare function streamPromptOverNcp(params: StreamPromptOverNcpParams): AsyncGenerator<NcpEndpointEvent>;
|
|
328
|
-
declare function runPromptOverNcp(params: RunPromptOverNcpParams): Promise<{
|
|
329
|
-
text: string;
|
|
330
|
-
completedMessage: NcpMessage;
|
|
331
|
-
}>;
|
|
332
|
-
//#endregion
|
|
333
|
-
//#region src/features/ncp-dispatch/utils/channel-reply.utils.d.ts
|
|
334
|
-
type ReplyCapableChannel = BaseChannel<Record<string, unknown>> & {
|
|
335
|
-
consumeNcpReply(input: NcpReplyInput): Promise<void>;
|
|
336
|
-
};
|
|
337
|
-
type ChannelReplyRoute = {
|
|
338
|
-
target: ChatTarget;
|
|
339
|
-
channel: ReplyCapableChannel;
|
|
340
|
-
};
|
|
341
|
-
type ResolvedInboundRoute = {
|
|
342
|
-
accountId?: string | null;
|
|
343
|
-
};
|
|
344
|
-
type ChannelReplyRouterDispatchParams = {
|
|
345
|
-
agent: NcpRunnerAgent;
|
|
346
|
-
route: ChannelReplyRoute;
|
|
347
|
-
sessionId: string;
|
|
348
|
-
content: string;
|
|
349
|
-
attachments?: InboundAttachment[];
|
|
350
|
-
metadata?: Record<string, unknown>;
|
|
351
|
-
abortSignal?: AbortSignal;
|
|
352
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
353
|
-
};
|
|
354
|
-
declare function isReplyCapableChannel(channel: BaseChannel<Record<string, unknown>> | null | undefined): channel is ReplyCapableChannel;
|
|
355
|
-
declare function resolveChannelReplyRoute(params: {
|
|
356
|
-
channel: BaseChannel<Record<string, unknown>> | null | undefined;
|
|
357
|
-
message: InboundMessage;
|
|
358
|
-
route: ResolvedInboundRoute;
|
|
359
|
-
}): ChannelReplyRoute | null;
|
|
360
|
-
declare function dispatchChannelReplyRoute(params: ChannelReplyRouterDispatchParams): Promise<void>;
|
|
361
|
-
//#endregion
|
|
362
|
-
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-dispatch.utils.d.ts
|
|
363
|
-
type DirectPromptDispatchParams = {
|
|
364
|
-
config: Config;
|
|
365
|
-
sessionManager: SessionManager;
|
|
366
|
-
resolveNcpAgent?: () => NcpRunnerAgent | null;
|
|
367
|
-
content: string;
|
|
368
|
-
sessionKey?: string;
|
|
369
|
-
channel?: string;
|
|
370
|
-
chatId?: string;
|
|
371
|
-
attachments?: InboundAttachment[];
|
|
372
|
-
metadata?: Record<string, unknown>;
|
|
373
|
-
agentId?: string;
|
|
374
|
-
abortSignal?: AbortSignal;
|
|
375
|
-
onAssistantDelta?: (delta: string) => void;
|
|
376
|
-
};
|
|
377
|
-
type GatewayInboundLoopRuntime = {
|
|
378
|
-
kernel: {
|
|
379
|
-
channels: ChannelManager$1;
|
|
380
|
-
};
|
|
381
|
-
messageBus: MessageBus;
|
|
382
|
-
sessionManager: SessionManager;
|
|
383
|
-
configManager: {
|
|
384
|
-
loadConfig: () => Config;
|
|
385
|
-
};
|
|
386
|
-
liveAgentRuntime: NcpRunnerAgent | null;
|
|
387
|
-
appEventBus?: EventBus;
|
|
388
|
-
};
|
|
389
|
-
declare function dispatchPromptOverNcp(params: DirectPromptDispatchParams): Promise<string>;
|
|
390
|
-
declare function runGatewayInboundLoop(runtime: GatewayInboundLoopRuntime): Promise<void>;
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region src/types/llm-usage.types.d.ts
|
|
393
|
-
type LlmUsageSummary = {
|
|
394
|
-
promptTokens: number;
|
|
395
|
-
completionTokens: number;
|
|
396
|
-
totalTokens: number;
|
|
397
|
-
cachedTokens: number;
|
|
398
|
-
cacheHit: boolean;
|
|
399
|
-
cacheMetricKeys: string[];
|
|
400
|
-
};
|
|
401
|
-
type LlmUsageRecord = {
|
|
402
|
-
version: 1;
|
|
403
|
-
observedAt: string;
|
|
404
|
-
source: string;
|
|
405
|
-
model: string | null;
|
|
406
|
-
usage: Record<string, number>;
|
|
407
|
-
summary: LlmUsageSummary;
|
|
408
|
-
};
|
|
409
|
-
type LlmUsageSnapshot = LlmUsageRecord;
|
|
410
|
-
declare function createLlmUsageRecord(params: {
|
|
411
|
-
observedAt?: string;
|
|
412
|
-
source: string;
|
|
413
|
-
model?: string | null;
|
|
414
|
-
usage: Record<string, number>;
|
|
415
|
-
}): LlmUsageRecord;
|
|
416
|
-
declare function sanitizeLlmUsage(usage: Record<string, number>): Record<string, number>;
|
|
417
|
-
declare function hasLlmUsageTelemetry(usage: Record<string, number>): boolean;
|
|
418
|
-
declare function buildLlmUsageSummary(usage: Record<string, number>): LlmUsageSummary;
|
|
419
|
-
declare function normalizeLlmUsageModel(value: string | null | undefined): string | null;
|
|
420
|
-
//#endregion
|
|
421
|
-
//#region src/stores/llm-usage.store.d.ts
|
|
422
|
-
type LlmUsageStoreOptions = {
|
|
423
|
-
snapshotPath?: string;
|
|
424
|
-
historyPath?: string;
|
|
425
|
-
};
|
|
426
|
-
declare class LlmUsageStore {
|
|
427
|
-
private readonly options;
|
|
428
|
-
constructor(options?: LlmUsageStoreOptions);
|
|
429
|
-
get snapshotPath(): string;
|
|
430
|
-
get historyPath(): string;
|
|
431
|
-
readSnapshot: () => LlmUsageRecord | null;
|
|
432
|
-
writeSnapshot: (snapshot: LlmUsageRecord) => void;
|
|
433
|
-
clearSnapshot: () => void;
|
|
434
|
-
listHistory: () => LlmUsageRecord[];
|
|
435
|
-
appendHistory: (record: LlmUsageRecord) => void;
|
|
436
|
-
clearHistory: () => void;
|
|
437
|
-
}
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/managers/llm-usage.manager.d.ts
|
|
440
|
-
type LlmUsageManagerOptions = {
|
|
441
|
-
store?: LlmUsageStore;
|
|
442
|
-
};
|
|
443
|
-
declare class LlmUsageManager {
|
|
444
|
-
private readonly store;
|
|
445
|
-
constructor(options?: LlmUsageManagerOptions);
|
|
446
|
-
observeProviderManager: (providerManager: LlmProviderRuntime, source: string) => LlmProviderRuntime;
|
|
447
|
-
record: (params: {
|
|
448
|
-
observedAt?: string;
|
|
449
|
-
source: string;
|
|
450
|
-
model?: string | null;
|
|
451
|
-
usage: Record<string, number>;
|
|
452
|
-
}) => LlmUsageRecord | null;
|
|
453
|
-
}
|
|
454
|
-
//#endregion
|
|
455
203
|
//#region src/managers/agent-runtime.manager.d.ts
|
|
456
204
|
type AgentRuntimeManagerOptions = {
|
|
457
|
-
bus: MessageBus;
|
|
458
|
-
providerManager: LlmProviderRuntime;
|
|
459
|
-
sessions: SessionManager;
|
|
460
|
-
ingress: Ingress;
|
|
461
|
-
sessionRequests: SessionRequestManager;
|
|
462
|
-
sessionSearch: SessionSearchManager;
|
|
463
|
-
ncpAgentSessionStore: AgentSessionStore;
|
|
464
|
-
cronService?: CronService | null;
|
|
465
205
|
configManager: {
|
|
466
206
|
loadConfig: () => Config;
|
|
467
207
|
};
|
|
468
|
-
|
|
469
|
-
eventBus: EventBus;
|
|
470
|
-
handleNcpEvent: (event: NcpEndpointEvent) => void;
|
|
471
|
-
llmUsage: LlmUsageManager;
|
|
472
|
-
onSessionUpdated: (sessionKey: string) => void;
|
|
208
|
+
assetStore: LocalAssetStore;
|
|
473
209
|
};
|
|
474
210
|
declare class AgentRuntimeManager {
|
|
475
211
|
private readonly params;
|
|
476
212
|
private readonly runtimeRegistry;
|
|
477
|
-
private readonly mcpRuntimeSupport;
|
|
478
|
-
private readonly assetStore;
|
|
479
|
-
private readonly pluginRuntimeRegistrationController;
|
|
480
213
|
private readonly refreshConfiguredRuntimeEntries;
|
|
481
|
-
private backend;
|
|
482
|
-
private handle;
|
|
483
|
-
private builtinNarpRegistrations;
|
|
484
|
-
private kernelBootstrapped;
|
|
485
|
-
private warmupPromise;
|
|
486
|
-
private unsubscribeNcpEvents;
|
|
487
|
-
private unsubscribeAgentRuntimeRequestIngress;
|
|
488
|
-
private gatewayController;
|
|
489
214
|
private disposed;
|
|
490
215
|
constructor(params: AgentRuntimeManagerOptions);
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
216
|
+
registerRuntimeProvider: (registration: AgentRuntimeProviderRegistration) => Disposable;
|
|
217
|
+
createRuntime: (runtimeParams: RuntimeFactoryParams) => _$_nextclaw_ncp0.NcpAgentRuntime;
|
|
218
|
+
listSessionTypes: (describeParams?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
|
|
219
|
+
defaultType: string;
|
|
220
|
+
options: AgentRuntimeSessionTypeOption[];
|
|
221
|
+
}>;
|
|
222
|
+
dispose: () => Promise<void>;
|
|
223
|
+
private readonly assertNotDisposed;
|
|
224
|
+
}
|
|
225
|
+
//#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
|
+
});
|
|
498
241
|
dispose: () => Promise<void>;
|
|
499
|
-
|
|
500
|
-
|
|
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
|
+
appendSessionEvent: (sessionId: string, event: NcpEndpointEvent, options?: PublishSessionEventOptions) => Promise<void>;
|
|
250
|
+
private readonly ensureLiveSession;
|
|
251
|
+
private readonly requireLiveSession;
|
|
252
|
+
private readonly publishSessionEvent;
|
|
253
|
+
private readonly persistLiveSessionEvent;
|
|
254
|
+
private readonly assertNotDisposed;
|
|
501
255
|
private publishSessionRunStatus;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
256
|
+
}
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/managers/agent-run-request.manager.d.ts
|
|
259
|
+
declare class AgentRunRequestManager {
|
|
260
|
+
private readonly cleanups;
|
|
261
|
+
private readonly sessions;
|
|
262
|
+
private readonly ingress;
|
|
263
|
+
private readonly sessionRunManager;
|
|
264
|
+
private readonly onSessionUpdated;
|
|
265
|
+
private disposed;
|
|
266
|
+
private started;
|
|
267
|
+
constructor(options: {
|
|
268
|
+
sessions: SessionManager;
|
|
269
|
+
ingress: Ingress;
|
|
270
|
+
sessionRunManager: SessionRunManager;
|
|
271
|
+
onSessionUpdated: (sessionKey: string) => void;
|
|
272
|
+
});
|
|
273
|
+
start: () => void;
|
|
274
|
+
dispose: () => Promise<void>;
|
|
275
|
+
run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
|
|
276
|
+
private readonly handleSendRequest;
|
|
277
|
+
private readonly handleAbortRequest;
|
|
278
|
+
private readonly iterateRun;
|
|
279
|
+
private readonly materializeSendEnvelope;
|
|
280
|
+
private readonly toNcpSendEnvelope;
|
|
281
|
+
private readonly materializeRunEnvelope;
|
|
282
|
+
private readonly handleSessionMessageRequest;
|
|
505
283
|
private readonly assertNotDisposed;
|
|
506
284
|
}
|
|
507
285
|
//#endregion
|
|
@@ -513,6 +291,50 @@ declare class AutomationManager extends CronService {
|
|
|
513
291
|
constructor(options: AutomationManagerOptions);
|
|
514
292
|
}
|
|
515
293
|
//#endregion
|
|
294
|
+
//#region src/managers/llm-provider.manager.d.ts
|
|
295
|
+
type ProviderChatParams = {
|
|
296
|
+
messages: Array<Record<string, unknown>>;
|
|
297
|
+
tools?: Array<Record<string, unknown>>;
|
|
298
|
+
model?: string | null;
|
|
299
|
+
maxTokens?: number;
|
|
300
|
+
thinkingLevel?: ThinkingLevel | null;
|
|
301
|
+
signal?: AbortSignal;
|
|
302
|
+
};
|
|
303
|
+
type LlmProviderRuntime = {
|
|
304
|
+
get: (model?: string | null) => LLMProvider;
|
|
305
|
+
chat: (params: ProviderChatParams) => Promise<LLMResponse>;
|
|
306
|
+
chatStream: (params: ProviderChatParams) => AsyncGenerator<LLMStreamEvent>;
|
|
307
|
+
};
|
|
308
|
+
type ProviderConnectionTestInput = {
|
|
309
|
+
providerName: string | null;
|
|
310
|
+
apiKey?: string | null;
|
|
311
|
+
apiBase?: string | null;
|
|
312
|
+
defaultModel: string;
|
|
313
|
+
extraHeaders?: Record<string, string> | null;
|
|
314
|
+
wireApi?: "auto" | "chat" | "responses" | null;
|
|
315
|
+
messages: Array<Record<string, unknown>>;
|
|
316
|
+
maxTokens?: number;
|
|
317
|
+
signal?: AbortSignal;
|
|
318
|
+
};
|
|
319
|
+
declare class LlmProviderManager {
|
|
320
|
+
private readonly providerRegistry;
|
|
321
|
+
private readonly providerPool;
|
|
322
|
+
private readonly missingProvider;
|
|
323
|
+
private config;
|
|
324
|
+
constructor();
|
|
325
|
+
load: (config: Config) => void;
|
|
326
|
+
get: (model?: string | null) => LLMProvider;
|
|
327
|
+
readonly chat: (params: ProviderChatParams) => Promise<LLMResponse>;
|
|
328
|
+
readonly chatStream: (this: LlmProviderManager, params: ProviderChatParams) => AsyncGenerator<LLMStreamEvent>;
|
|
329
|
+
readonly testConnection: (input: ProviderConnectionTestInput) => Promise<void>;
|
|
330
|
+
private resolveRoute;
|
|
331
|
+
private resolveProvider;
|
|
332
|
+
private matchPrefixedProvider;
|
|
333
|
+
private getOrCreateProvider;
|
|
334
|
+
private createProvider;
|
|
335
|
+
private buildCacheKey;
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
516
338
|
//#region src/managers/config.manager.d.ts
|
|
517
339
|
type ConfigManagerRuntimeHooks = {
|
|
518
340
|
resolveChannelConfig?: (config: Config) => Config;
|
|
@@ -541,6 +363,16 @@ type ConfigManagerOptions = {
|
|
|
541
363
|
channels: ChannelManager$1;
|
|
542
364
|
providerManager: LlmProviderManager;
|
|
543
365
|
};
|
|
366
|
+
type ConfigMutationResult = Record<string, unknown> & {
|
|
367
|
+
ok: boolean;
|
|
368
|
+
error?: string;
|
|
369
|
+
};
|
|
370
|
+
type RawConfigMutationParams = {
|
|
371
|
+
raw: string;
|
|
372
|
+
baseHash?: string;
|
|
373
|
+
note?: string;
|
|
374
|
+
version?: string;
|
|
375
|
+
};
|
|
544
376
|
declare class ConfigManager {
|
|
545
377
|
private readonly options;
|
|
546
378
|
readonly configPath: string;
|
|
@@ -557,6 +389,14 @@ declare class ConfigManager {
|
|
|
557
389
|
installRuntimeHooks: (hooks: ConfigManagerRuntimeHooks) => void;
|
|
558
390
|
applyLiveConfigReload: () => Promise<void>;
|
|
559
391
|
applyReloadPlan: (nextConfig: Config) => Promise<void>;
|
|
392
|
+
getConfigSnapshot: (params?: {
|
|
393
|
+
version?: string;
|
|
394
|
+
}) => Record<string, unknown>;
|
|
395
|
+
getConfigSchema: (params?: {
|
|
396
|
+
version?: string;
|
|
397
|
+
}) => Record<string, unknown>;
|
|
398
|
+
applyRawConfig: (params: RawConfigMutationParams) => Promise<ConfigMutationResult>;
|
|
399
|
+
patchRawConfig: (params: RawConfigMutationParams) => Promise<ConfigMutationResult>;
|
|
560
400
|
scheduleReload: (reason: string) => void;
|
|
561
401
|
runReload: (reason: string) => Promise<void>;
|
|
562
402
|
reloadConfig: (reason?: string) => Promise<string>;
|
|
@@ -569,86 +409,260 @@ declare class ConfigManager {
|
|
|
569
409
|
private reloadPlugins;
|
|
570
410
|
private reloadMcp;
|
|
571
411
|
private reloadCompanion;
|
|
412
|
+
private readConfigSnapshot;
|
|
413
|
+
private redactConfig;
|
|
414
|
+
private validateBaseHash;
|
|
415
|
+
private validateConfigInput;
|
|
416
|
+
private mutateRawConfig;
|
|
417
|
+
private applyConfigChange;
|
|
418
|
+
private createConfigMutationResult;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/services/extension-plugin-registry.service.d.ts
|
|
422
|
+
type ExtensionPluginLoadProgress = {
|
|
423
|
+
loadedPluginCount: number;
|
|
424
|
+
pluginId?: string;
|
|
425
|
+
};
|
|
426
|
+
declare class ExtensionPluginRegistryService {
|
|
427
|
+
discoverEnabledPluginCount: (params: {
|
|
428
|
+
config: Config;
|
|
429
|
+
workspace: string;
|
|
430
|
+
}) => number;
|
|
431
|
+
load: (params: {
|
|
432
|
+
config: Config;
|
|
433
|
+
workspace: string;
|
|
434
|
+
}) => PluginRegistry;
|
|
435
|
+
loadProgressively: (params: {
|
|
436
|
+
config: Config;
|
|
437
|
+
workspace: string;
|
|
438
|
+
onPluginProcessed?: (params: ExtensionPluginLoadProgress) => void;
|
|
439
|
+
}) => Promise<PluginRegistry>;
|
|
440
|
+
private resolveLoadingContext;
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/managers/extension.manager.d.ts
|
|
444
|
+
type ExtensionLoadProgress = ExtensionPluginLoadProgress;
|
|
445
|
+
type ExtensionLoadResult = {
|
|
446
|
+
diagnostics: PluginRegistry["diagnostics"];
|
|
447
|
+
totalPluginCount: number;
|
|
448
|
+
loadedPluginCount: number;
|
|
449
|
+
shouldRestartChannels: boolean;
|
|
450
|
+
};
|
|
451
|
+
type ExtensionManagerOptions = {
|
|
452
|
+
configManager: Pick<ConfigManager, "loadConfig">;
|
|
453
|
+
eventBus: Pick<EventBus, "emitEnvelope">;
|
|
454
|
+
ingress: Pick<Ingress, "addHandler">;
|
|
455
|
+
messageBus: Pick<MessageBus, "publishInbound">;
|
|
456
|
+
};
|
|
457
|
+
type ExtensionLoadParams = {
|
|
458
|
+
config?: Config;
|
|
459
|
+
changedPaths?: readonly string[];
|
|
460
|
+
onLoadStart?: (params: {
|
|
461
|
+
totalPluginCount: number;
|
|
462
|
+
}) => void;
|
|
463
|
+
onPluginProcessed?: (params: ExtensionLoadProgress) => void;
|
|
464
|
+
};
|
|
465
|
+
declare class ExtensionManager {
|
|
466
|
+
private readonly options;
|
|
467
|
+
private snapshot;
|
|
468
|
+
private readonly runtime;
|
|
469
|
+
private readonly pluginRegistry;
|
|
470
|
+
constructor(options: ExtensionManagerOptions);
|
|
471
|
+
load: (params: ExtensionLoadParams) => Promise<ExtensionLoadResult>;
|
|
472
|
+
reloadForConfigChange: (params: ExtensionLoadParams & {
|
|
473
|
+
changedPaths: readonly string[];
|
|
474
|
+
}) => Promise<ExtensionLoadResult>;
|
|
475
|
+
registerIngressHandlers: () => void;
|
|
476
|
+
start: (params: {
|
|
477
|
+
endpoint: string | null;
|
|
478
|
+
}) => Promise<void>;
|
|
479
|
+
stop: () => Promise<void>;
|
|
480
|
+
getExtensionRegistry: () => ExtensionRegistry;
|
|
481
|
+
getChannelBindings: () => PluginChannelBinding[];
|
|
482
|
+
getUiMetadata: () => PluginUiMetadata[];
|
|
483
|
+
toConfigView: (config: Config) => Config;
|
|
484
|
+
mergeConfigView: (current: Config, nextConfigView: Record<string, unknown>) => Config;
|
|
485
|
+
private readonly getWorkspace;
|
|
572
486
|
}
|
|
573
487
|
//#endregion
|
|
574
|
-
//#region src/
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
488
|
+
//#region src/types/llm-usage.types.d.ts
|
|
489
|
+
type LlmUsageSummary = {
|
|
490
|
+
promptTokens: number;
|
|
491
|
+
completionTokens: number;
|
|
492
|
+
totalTokens: number;
|
|
493
|
+
cachedTokens: number;
|
|
494
|
+
cacheHit: boolean;
|
|
495
|
+
cacheMetricKeys: string[];
|
|
496
|
+
};
|
|
497
|
+
type LlmUsageRecord = {
|
|
498
|
+
version: 1;
|
|
499
|
+
observedAt: string;
|
|
500
|
+
source: string;
|
|
501
|
+
model: string | null;
|
|
502
|
+
usage: Record<string, number>;
|
|
503
|
+
summary: LlmUsageSummary;
|
|
504
|
+
};
|
|
505
|
+
type LlmUsageSnapshot = LlmUsageRecord;
|
|
506
|
+
declare function createLlmUsageRecord(params: {
|
|
507
|
+
observedAt?: string;
|
|
508
|
+
source: string;
|
|
509
|
+
model?: string | null;
|
|
510
|
+
usage: Record<string, number>;
|
|
511
|
+
}): LlmUsageRecord;
|
|
512
|
+
declare function sanitizeLlmUsage(usage: Record<string, number>): Record<string, number>;
|
|
513
|
+
declare function hasLlmUsageTelemetry(usage: Record<string, number>): boolean;
|
|
514
|
+
declare function buildLlmUsageSummary(usage: Record<string, number>): LlmUsageSummary;
|
|
515
|
+
declare function normalizeLlmUsageModel(value: string | null | undefined): string | null;
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/stores/llm-usage.store.d.ts
|
|
518
|
+
type LlmUsageStoreOptions = {
|
|
519
|
+
snapshotPath?: string;
|
|
520
|
+
historyPath?: string;
|
|
585
521
|
};
|
|
586
|
-
declare
|
|
522
|
+
declare class LlmUsageStore {
|
|
523
|
+
private readonly options;
|
|
524
|
+
constructor(options?: LlmUsageStoreOptions);
|
|
525
|
+
get snapshotPath(): string;
|
|
526
|
+
get historyPath(): string;
|
|
527
|
+
readSnapshot: () => LlmUsageRecord | null;
|
|
528
|
+
writeSnapshot: (snapshot: LlmUsageRecord) => void;
|
|
529
|
+
clearSnapshot: () => void;
|
|
530
|
+
listHistory: () => LlmUsageRecord[];
|
|
531
|
+
appendHistory: (record: LlmUsageRecord) => void;
|
|
532
|
+
clearHistory: () => void;
|
|
533
|
+
}
|
|
587
534
|
//#endregion
|
|
588
|
-
//#region src/managers/
|
|
589
|
-
type
|
|
590
|
-
|
|
535
|
+
//#region src/managers/llm-usage.manager.d.ts
|
|
536
|
+
type LlmUsageStats = {
|
|
537
|
+
totalRecords: number;
|
|
538
|
+
usageRecordCount: number;
|
|
539
|
+
emptyUsageRecordCount: number;
|
|
540
|
+
promptTokenRecordCount: number;
|
|
541
|
+
oldestObservedAt: string | null;
|
|
542
|
+
latestObservedAt: string | null;
|
|
543
|
+
totalPromptTokens: number;
|
|
544
|
+
totalCompletionTokens: number;
|
|
545
|
+
totalTokens: number;
|
|
546
|
+
totalCachedTokens: number;
|
|
547
|
+
cacheHitRecords: number;
|
|
548
|
+
cacheHitRate: number;
|
|
549
|
+
tokenCacheRate: number;
|
|
550
|
+
sources: Array<{
|
|
551
|
+
value: string;
|
|
552
|
+
count: number;
|
|
553
|
+
}>;
|
|
554
|
+
models: Array<{
|
|
555
|
+
value: string;
|
|
556
|
+
count: number;
|
|
557
|
+
}>;
|
|
591
558
|
};
|
|
592
|
-
type
|
|
593
|
-
|
|
594
|
-
sessionManager: SessionManager;
|
|
595
|
-
sessionRequester: LearningLoopSessionRequester;
|
|
596
|
-
resolveLearningLoopConfig?: () => LearningLoopRuntimeConfig;
|
|
559
|
+
type LlmUsageManagerOptions = {
|
|
560
|
+
store?: LlmUsageStore;
|
|
597
561
|
};
|
|
598
|
-
declare class
|
|
599
|
-
private readonly
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
562
|
+
declare class LlmUsageManager {
|
|
563
|
+
private readonly store;
|
|
564
|
+
constructor(options?: LlmUsageManagerOptions);
|
|
565
|
+
get snapshotPath(): string;
|
|
566
|
+
get historyPath(): string;
|
|
567
|
+
observeProviderManager: (providerManager: LlmProviderRuntime, source: string) => LlmProviderRuntime;
|
|
568
|
+
record: (params: {
|
|
569
|
+
observedAt?: string;
|
|
570
|
+
source: string;
|
|
571
|
+
model?: string | null;
|
|
572
|
+
usage: Record<string, number>;
|
|
573
|
+
}) => LlmUsageRecord | null;
|
|
574
|
+
getSnapshot: () => LlmUsageRecord | null;
|
|
575
|
+
getHistory: (limit?: string | number) => LlmUsageRecord[];
|
|
576
|
+
resolveHistoryLimit: (value?: string | number) => number;
|
|
577
|
+
getStats: () => LlmUsageStats;
|
|
578
|
+
private readonly bumpCounter;
|
|
579
|
+
private readonly toSortedCounts;
|
|
580
|
+
}
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/managers/mcp.manager.d.ts
|
|
583
|
+
declare class McpManager {
|
|
584
|
+
private currentMcpConfig;
|
|
585
|
+
private readonly mcpLifecycleManager;
|
|
586
|
+
private readonly mcpRegistryService;
|
|
587
|
+
private readonly toolRegistryAdapter;
|
|
588
|
+
private warmupPromise;
|
|
589
|
+
constructor(getConfig: () => Config);
|
|
590
|
+
listToolsForRun: (params: {
|
|
591
|
+
agentId: string;
|
|
592
|
+
}) => ReadonlyArray<NcpTool>;
|
|
604
593
|
start: () => void;
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
private
|
|
608
|
-
private readRuntimeConfig;
|
|
609
|
-
private buildReviewTitle;
|
|
594
|
+
applyConfig: (config: Config) => Promise<void>;
|
|
595
|
+
dispose: () => Promise<void>;
|
|
596
|
+
private prewarmEnabledServersSafely;
|
|
610
597
|
}
|
|
611
598
|
//#endregion
|
|
612
|
-
//#region src/
|
|
613
|
-
type
|
|
614
|
-
|
|
615
|
-
name
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
599
|
+
//#region src/utils/skill-frontmatter.utils.d.ts
|
|
600
|
+
type LocalizedTextMap = Record<string, string>;
|
|
601
|
+
type SkillFrontmatter = {
|
|
602
|
+
name?: string;
|
|
603
|
+
summary?: string;
|
|
604
|
+
summaryI18n?: LocalizedTextMap;
|
|
605
|
+
description?: string;
|
|
606
|
+
descriptionI18n?: LocalizedTextMap;
|
|
607
|
+
author?: string;
|
|
608
|
+
tags?: string[];
|
|
620
609
|
};
|
|
610
|
+
declare function parseSkillFrontmatter(raw: string): SkillFrontmatter;
|
|
611
|
+
declare function stripSkillFrontmatter(raw: string): string;
|
|
612
|
+
declare function buildLocalizedTextMap(englishText: string, ...maps: Array<LocalizedTextMap | Partial<LocalizedTextMap> | undefined>): LocalizedTextMap;
|
|
621
613
|
//#endregion
|
|
622
614
|
//#region src/managers/skill.manager.d.ts
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
enableSkill: (skillId: SkillId) => never;
|
|
629
|
-
disableSkill: (skillId: SkillId) => never;
|
|
630
|
-
resolveSkills: (skillIds: SkillId[]) => never;
|
|
631
|
-
}
|
|
632
|
-
//#endregion
|
|
633
|
-
//#region src/types/tool.types.d.ts
|
|
634
|
-
type ToolRecord = {
|
|
635
|
-
id: ToolId;
|
|
615
|
+
type WorkspaceParams = {
|
|
616
|
+
workspace: string;
|
|
617
|
+
};
|
|
618
|
+
type InstalledSkillSummary = {
|
|
619
|
+
ref: string;
|
|
636
620
|
name: string;
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
621
|
+
path: string;
|
|
622
|
+
relativePath: string | null;
|
|
623
|
+
scope: SkillInfo$1["scope"];
|
|
624
|
+
source: SkillInfo$1["source"];
|
|
625
|
+
summary: string | null;
|
|
626
|
+
summaryI18n: LocalizedTextMap | null;
|
|
627
|
+
description: string | null;
|
|
628
|
+
descriptionI18n: LocalizedTextMap | null;
|
|
629
|
+
author: string | null;
|
|
630
|
+
tags: string[];
|
|
631
|
+
always: boolean;
|
|
641
632
|
};
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
633
|
+
type InstalledSkillDetail = InstalledSkillSummary & {
|
|
634
|
+
metadata: Record<string, string> | null;
|
|
635
|
+
raw: string;
|
|
636
|
+
bodyRaw: string;
|
|
637
|
+
};
|
|
638
|
+
type InstalledSkillsList = {
|
|
639
|
+
workspace: string;
|
|
640
|
+
total: number;
|
|
641
|
+
skills: InstalledSkillSummary[];
|
|
642
|
+
};
|
|
643
|
+
declare class SkillManager {
|
|
644
|
+
private readonly loader;
|
|
645
|
+
private readonly workspace;
|
|
646
|
+
constructor(params: WorkspaceParams);
|
|
647
|
+
listSkills: (params?: {
|
|
648
|
+
filterUnavailable?: boolean;
|
|
649
|
+
}) => SkillInfo$1[];
|
|
650
|
+
getSkillInfo: (selector: string) => SkillInfo$1 | null;
|
|
651
|
+
getSkillMetadata: (selector: string | SkillInfo$1) => Record<string, string> | null;
|
|
652
|
+
loadSkillContent: (selector: string) => string | null;
|
|
653
|
+
listInstalledSkills: (params?: {
|
|
654
|
+
query?: string;
|
|
655
|
+
scope?: string;
|
|
656
|
+
}) => InstalledSkillsList;
|
|
657
|
+
getInstalledSkillDetail: (selector: string) => InstalledSkillDetail | null;
|
|
658
|
+
findBuiltinSkill: (name: string) => SkillInfo$1 | null;
|
|
659
|
+
resolveBuiltinSkillDir: (name: string) => string | null;
|
|
660
|
+
private buildInstalledSkillSummary;
|
|
661
|
+
private matchesInstalledSkillQuery;
|
|
662
|
+
private readAlwaysFlag;
|
|
663
|
+
private buildRelativePath;
|
|
664
|
+
private normalizeInstalledScope;
|
|
665
|
+
private normalizeOptionalString;
|
|
652
666
|
}
|
|
653
667
|
//#endregion
|
|
654
668
|
//#region src/services/ncp-session-api.service.d.ts
|
|
@@ -660,7 +674,7 @@ type NcpSessionApiServiceOptions = {
|
|
|
660
674
|
eventBus: EventBus;
|
|
661
675
|
getConfig: () => Config;
|
|
662
676
|
isLiveSessionRunning?: (sessionId: string) => boolean;
|
|
663
|
-
ncpAgentSessionStore
|
|
677
|
+
ncpAgentSessionStore: NcpAgentSessionReadableStore;
|
|
664
678
|
sessionManager: SessionManager;
|
|
665
679
|
};
|
|
666
680
|
declare class NcpSessionApiService implements NcpSessionApi {
|
|
@@ -676,6 +690,7 @@ declare class NcpSessionApiService implements NcpSessionApi {
|
|
|
676
690
|
getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
677
691
|
updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
|
|
678
692
|
deleteSession: (sessionId: string) => Promise<void>;
|
|
693
|
+
private createSummaryFromRecord;
|
|
679
694
|
private withLiveSessionStatus;
|
|
680
695
|
}
|
|
681
696
|
//#endregion
|
|
@@ -707,47 +722,166 @@ declare class NextclawKernel {
|
|
|
707
722
|
readonly agents: AgentManager;
|
|
708
723
|
readonly sessions: SessionManager;
|
|
709
724
|
readonly control: NextclawKernelControlManager<unknown, unknown, unknown>;
|
|
710
|
-
readonly
|
|
725
|
+
readonly toolManager: ToolManager;
|
|
711
726
|
readonly skills: SkillManager;
|
|
712
727
|
readonly automation: AutomationManager;
|
|
713
728
|
readonly channels: ChannelManager$1;
|
|
714
729
|
readonly sessionRequests: SessionRequestManager;
|
|
715
730
|
readonly sessionSearch: SessionSearchManager;
|
|
731
|
+
readonly assetStore: LocalAssetStore;
|
|
732
|
+
readonly mcpManager: McpManager;
|
|
716
733
|
readonly ncpSessionApi: NcpSessionApiService;
|
|
717
734
|
readonly extensions: ExtensionManager;
|
|
735
|
+
readonly agentRunRequestManager: AgentRunRequestManager;
|
|
736
|
+
readonly sessionRunManager: SessionRunManager;
|
|
718
737
|
readonly agentRuntimeManager: AgentRuntimeManager;
|
|
719
|
-
readonly learningLoop: LearningLoopManager;
|
|
720
|
-
private readonly sessionLifecycleEvents;
|
|
721
738
|
private readonly ncpAgentSessionStore;
|
|
722
739
|
private readonly ncpAgentSessionJournalStore;
|
|
723
740
|
private readonly contributions;
|
|
741
|
+
private gatewayController;
|
|
724
742
|
constructor(options?: NextclawKernelOptions);
|
|
743
|
+
provideGatewayController: (gatewayController: GatewayController) => void;
|
|
744
|
+
getGatewayController: () => GatewayController | undefined;
|
|
725
745
|
start: () => Promise<void>;
|
|
726
746
|
dispose: () => Promise<void>;
|
|
727
|
-
|
|
728
|
-
private handleNcpEvent;
|
|
747
|
+
publishSessionUpdated: (sessionKey: string) => void;
|
|
729
748
|
}
|
|
730
749
|
//#endregion
|
|
731
|
-
//#region src/
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
750
|
+
//#region src/contributions/learning-loop/config.d.ts
|
|
751
|
+
type LearningLoopRuntimeConfig = {
|
|
752
|
+
enabled: boolean;
|
|
753
|
+
toolCallThreshold: number;
|
|
754
|
+
};
|
|
755
|
+
declare function readLearningLoopRuntimeConfig(config: Config): LearningLoopRuntimeConfig;
|
|
737
756
|
//#endregion
|
|
738
|
-
//#region src/features/narp-runtime/services/builtin-narp-runtime-
|
|
757
|
+
//#region src/features/narp-runtime/services/builtin-narp-runtime-provider.service.d.ts
|
|
739
758
|
declare const NARP_HTTP_RUNTIME_KIND = "narp-http";
|
|
740
759
|
declare const NARP_STDIO_RUNTIME_KIND = "narp-stdio";
|
|
741
|
-
declare class
|
|
760
|
+
declare class BuiltinNarpRuntimeProviderService {
|
|
742
761
|
private readonly getConfig;
|
|
743
762
|
constructor(getConfig: () => Config);
|
|
744
|
-
|
|
763
|
+
createProviders: () => AgentRuntimeProviderRegistration[];
|
|
745
764
|
private createUnavailableRuntime;
|
|
746
765
|
private createHttpRuntime;
|
|
747
766
|
private createStdioRuntime;
|
|
748
767
|
}
|
|
749
768
|
//#endregion
|
|
750
|
-
//#region src/features/
|
|
769
|
+
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-runner.utils.d.ts
|
|
770
|
+
type AssetApi = {
|
|
771
|
+
put: (input: {
|
|
772
|
+
fileName: string;
|
|
773
|
+
mimeType?: string | null;
|
|
774
|
+
bytes: Uint8Array;
|
|
775
|
+
createdAt?: Date;
|
|
776
|
+
}) => Promise<{
|
|
777
|
+
uri: string;
|
|
778
|
+
}>;
|
|
779
|
+
resolveContentPath?: (uri: string) => string | null;
|
|
780
|
+
};
|
|
781
|
+
type NcpRunnerAgent = {
|
|
782
|
+
run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
|
|
783
|
+
assetApi?: AssetApi;
|
|
784
|
+
};
|
|
785
|
+
type RunPromptOverNcpParams = {
|
|
786
|
+
agent: NcpRunnerAgent;
|
|
787
|
+
sessionId: string;
|
|
788
|
+
content: string;
|
|
789
|
+
attachments?: InboundAttachment[];
|
|
790
|
+
metadata?: Record<string, unknown>;
|
|
791
|
+
abortSignal?: AbortSignal;
|
|
792
|
+
onAssistantDelta?: (delta: string) => void;
|
|
793
|
+
onEvent?: (event: NcpEndpointEvent) => void;
|
|
794
|
+
missingCompletedMessageError?: string;
|
|
795
|
+
runErrorMessage?: string;
|
|
796
|
+
};
|
|
797
|
+
type StreamPromptOverNcpParams = Omit<RunPromptOverNcpParams, "onAssistantDelta" | "missingCompletedMessageError" | "runErrorMessage">;
|
|
798
|
+
declare function buildUserMessageParts(params: {
|
|
799
|
+
content: string;
|
|
800
|
+
attachments?: InboundAttachment[];
|
|
801
|
+
assetApi?: AssetApi;
|
|
802
|
+
}): Promise<NcpMessagePart[]>;
|
|
803
|
+
declare function buildNcpUserMessage(params: {
|
|
804
|
+
sessionId: string;
|
|
805
|
+
content: string;
|
|
806
|
+
attachments?: InboundAttachment[];
|
|
807
|
+
metadata?: Record<string, unknown>;
|
|
808
|
+
assetApi?: AssetApi;
|
|
809
|
+
}): Promise<NcpMessage>;
|
|
810
|
+
declare function streamPromptOverNcp(params: StreamPromptOverNcpParams): AsyncGenerator<NcpEndpointEvent>;
|
|
811
|
+
declare function runPromptOverNcp(params: RunPromptOverNcpParams): Promise<{
|
|
812
|
+
text: string;
|
|
813
|
+
completedMessage: NcpMessage;
|
|
814
|
+
}>;
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/features/ncp-dispatch/services/gateway-inbound-processor.service.d.ts
|
|
817
|
+
type GatewayInboundLoopRuntime = {
|
|
818
|
+
kernel: {
|
|
819
|
+
channels: ChannelManager$1;
|
|
820
|
+
agentRunRequestManager: NcpRunnerAgent;
|
|
821
|
+
};
|
|
822
|
+
messageBus: MessageBus;
|
|
823
|
+
configManager: {
|
|
824
|
+
loadConfig: () => Config;
|
|
825
|
+
};
|
|
826
|
+
appEventBus?: EventBus;
|
|
827
|
+
};
|
|
828
|
+
declare class GatewayInboundProcessor {
|
|
829
|
+
private runtime;
|
|
830
|
+
constructor(runtime: GatewayInboundLoopRuntime);
|
|
831
|
+
process: (message: InboundMessage) => Promise<void>;
|
|
832
|
+
private resolveRoute;
|
|
833
|
+
private dispatchChannelReplyRouteMaybe;
|
|
834
|
+
private publishLegacyReply;
|
|
835
|
+
}
|
|
836
|
+
declare function runGatewayInboundLoop(runtime: GatewayInboundLoopRuntime): Promise<void>;
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/features/ncp-dispatch/utils/channel-reply.utils.d.ts
|
|
839
|
+
type ReplyCapableChannel = BaseChannel<Record<string, unknown>> & {
|
|
840
|
+
consumeNcpReply(input: NcpReplyInput): Promise<void>;
|
|
841
|
+
};
|
|
842
|
+
type ChannelReplyRoute = {
|
|
843
|
+
target: ChatTarget;
|
|
844
|
+
channel: ReplyCapableChannel;
|
|
845
|
+
};
|
|
846
|
+
type ResolvedInboundRoute = {
|
|
847
|
+
accountId?: string | null;
|
|
848
|
+
};
|
|
849
|
+
type ChannelReplyRouterDispatchParams = {
|
|
850
|
+
agent: NcpRunnerAgent;
|
|
851
|
+
route: ChannelReplyRoute;
|
|
852
|
+
sessionId: string;
|
|
853
|
+
content: string;
|
|
854
|
+
attachments?: InboundAttachment[];
|
|
855
|
+
metadata?: Record<string, unknown>;
|
|
856
|
+
abortSignal?: AbortSignal;
|
|
857
|
+
onEvent?: (event: NcpEndpointEvent) => void;
|
|
858
|
+
};
|
|
859
|
+
declare function isReplyCapableChannel(channel: BaseChannel<Record<string, unknown>> | null | undefined): channel is ReplyCapableChannel;
|
|
860
|
+
declare function resolveChannelReplyRoute(params: {
|
|
861
|
+
channel: BaseChannel<Record<string, unknown>> | null | undefined;
|
|
862
|
+
message: InboundMessage;
|
|
863
|
+
route: ResolvedInboundRoute;
|
|
864
|
+
}): ChannelReplyRoute | null;
|
|
865
|
+
declare function dispatchChannelReplyRoute(params: ChannelReplyRouterDispatchParams): Promise<void>;
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-dispatch.utils.d.ts
|
|
868
|
+
type DirectPromptDispatchParams = {
|
|
869
|
+
config: Config;
|
|
870
|
+
sessionManager: SessionManager;
|
|
871
|
+
agentRunRequests: NcpRunnerAgent;
|
|
872
|
+
content: string;
|
|
873
|
+
sessionKey?: string;
|
|
874
|
+
channel?: string;
|
|
875
|
+
chatId?: string;
|
|
876
|
+
attachments?: InboundAttachment[];
|
|
877
|
+
metadata?: Record<string, unknown>;
|
|
878
|
+
agentId?: string;
|
|
879
|
+
abortSignal?: AbortSignal;
|
|
880
|
+
onAssistantDelta?: (delta: string) => void;
|
|
881
|
+
};
|
|
882
|
+
declare function dispatchPromptOverNcp(params: DirectPromptDispatchParams): Promise<string>;
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
|
|
751
885
|
type ContextWindowOwner = "nextclaw" | "runtime";
|
|
752
886
|
type ContextCompactionPreflightResult = {
|
|
753
887
|
contextWindow: ContextWindowSnapshot;
|
|
@@ -801,100 +935,66 @@ declare class ContextCompactionPreflightService {
|
|
|
801
935
|
private generateSummary;
|
|
802
936
|
}
|
|
803
937
|
//#endregion
|
|
938
|
+
//#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
|
|
939
|
+
declare function projectNcpMessagesWithContextCompaction(params: {
|
|
940
|
+
sessionId: string;
|
|
941
|
+
sessionMessages: readonly NcpMessage[];
|
|
942
|
+
}): NcpMessage[];
|
|
943
|
+
//#endregion
|
|
944
|
+
//#region src/features/context-compaction/utils/context-compaction-timeline-message.utils.d.ts
|
|
945
|
+
declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
|
|
946
|
+
declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
|
|
947
|
+
type ContextCompactionTimelineCheckpoint = {
|
|
948
|
+
version: 1;
|
|
949
|
+
id: string;
|
|
950
|
+
status: "compressing" | "compressed";
|
|
951
|
+
summary: string;
|
|
952
|
+
coveredMessageCount: number;
|
|
953
|
+
coveredSessionMessageCount: number;
|
|
954
|
+
originalEstimatedTokens: number;
|
|
955
|
+
projectedEstimatedTokens: number;
|
|
956
|
+
createdAt: string;
|
|
957
|
+
updatedAt: string;
|
|
958
|
+
};
|
|
959
|
+
declare function buildContextCompactionTimelineNcpMessage(params: {
|
|
960
|
+
sessionId: string;
|
|
961
|
+
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
962
|
+
}): NcpMessage;
|
|
963
|
+
declare function upsertContextCompactionTimelineMessage(params: {
|
|
964
|
+
session: Session;
|
|
965
|
+
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
966
|
+
insertBeforeMessageIds?: readonly string[];
|
|
967
|
+
}): void;
|
|
968
|
+
declare function isContextCompactionTimelineMessage(message: {
|
|
969
|
+
metadata?: Record<string, unknown> | undefined;
|
|
970
|
+
} | null | undefined): boolean;
|
|
971
|
+
//#endregion
|
|
804
972
|
//#region src/features/native-runtime/services/native-agent-runtime-factory.service.d.ts
|
|
805
973
|
type NativeRuntimeFactory = (runtimeParams: RuntimeFactoryParams) => NcpAgentRuntime;
|
|
806
|
-
type UpdateToolCallResult = (params: {
|
|
807
|
-
sessionId: string;
|
|
808
|
-
toolCallId: string;
|
|
809
|
-
result: unknown;
|
|
810
|
-
}) => Promise<void>;
|
|
811
974
|
type NativeAgentRuntimeFactoryOptions = {
|
|
812
|
-
bus: MessageBus;
|
|
813
975
|
providerManager: LlmProviderRuntime;
|
|
814
976
|
sessions: SessionManager;
|
|
815
|
-
sessionRequests: SessionRequestManager;
|
|
816
|
-
sessionSearch: SessionSearchManager;
|
|
817
|
-
cronService?: CronService | null;
|
|
818
977
|
configManager: {
|
|
819
978
|
loadConfig: () => Config;
|
|
820
979
|
};
|
|
821
|
-
extensions: ExtensionManager;
|
|
822
980
|
llmUsage: LlmUsageManager;
|
|
823
981
|
onSessionUpdated: (sessionKey: string) => void;
|
|
824
|
-
resolveGatewayController: () => GatewayController | undefined;
|
|
825
|
-
mcpToolRegistryAdapter: McpNcpToolRegistryAdapter;
|
|
826
982
|
assetStore: LocalAssetStore;
|
|
827
983
|
updateToolCallResult: UpdateToolCallResult;
|
|
984
|
+
toolManager: ToolManager;
|
|
828
985
|
};
|
|
829
986
|
declare class NativeAgentRuntimeFactory {
|
|
830
987
|
private readonly options;
|
|
831
988
|
private readonly observedProviderManager;
|
|
832
989
|
constructor(options: NativeAgentRuntimeFactoryOptions);
|
|
833
990
|
create: NativeRuntimeFactory;
|
|
834
|
-
resolveOpenAiToolsForRuntime: (input: NcpAgentRunInput) => _$_nextclaw_ncp0.OpenAITool[] | undefined;
|
|
835
991
|
private createToolRegistry;
|
|
836
992
|
}
|
|
837
993
|
//#endregion
|
|
838
|
-
//#region src/features/native-runtime/services/nextclaw-ncp-tool-registry.service.d.ts
|
|
839
|
-
type NextclawNcpToolRegistryOptions = {
|
|
840
|
-
bus: MessageBus;
|
|
841
|
-
providerManager: LlmProviderRuntime;
|
|
842
|
-
sessionManager: SessionManager;
|
|
843
|
-
cronService?: CronService | null;
|
|
844
|
-
gatewayController?: GatewayController;
|
|
845
|
-
getConfig: () => Config;
|
|
846
|
-
getExtensionRegistry?: () => ExtensionRegistry | undefined;
|
|
847
|
-
getAdditionalTools?: (context: PreparedRunContext) => ReadonlyArray<NcpTool>;
|
|
848
|
-
onSessionUpdated?: (sessionKey: string) => void;
|
|
849
|
-
sessionRequestManager: SessionRequestManager;
|
|
850
|
-
updateToolCallResult: (params: {
|
|
851
|
-
sessionId: string;
|
|
852
|
-
toolCallId: string;
|
|
853
|
-
result: unknown;
|
|
854
|
-
}) => Promise<void>;
|
|
855
|
-
};
|
|
856
|
-
type PreparedRunContext = {
|
|
857
|
-
agentId: string;
|
|
858
|
-
channel: string;
|
|
859
|
-
chatId: string;
|
|
860
|
-
config: Config;
|
|
861
|
-
contextTokens: number;
|
|
862
|
-
execTimeoutSeconds: number;
|
|
863
|
-
handoffDepth: number;
|
|
864
|
-
maxTokens?: number;
|
|
865
|
-
metadata: Record<string, unknown>;
|
|
866
|
-
model: string;
|
|
867
|
-
restrictToWorkspace: boolean;
|
|
868
|
-
searchConfig: SearchConfig;
|
|
869
|
-
sessionId: string;
|
|
870
|
-
workspace: string;
|
|
871
|
-
};
|
|
872
|
-
declare class NextclawNcpToolRegistry implements NcpToolRegistry {
|
|
873
|
-
private readonly options;
|
|
874
|
-
private registry;
|
|
875
|
-
private readonly tools;
|
|
876
|
-
private currentExtensionToolContext;
|
|
877
|
-
constructor(options: NextclawNcpToolRegistryOptions);
|
|
878
|
-
prepareForRun: (context: PreparedRunContext) => void;
|
|
879
|
-
listTools: () => ReadonlyArray<NcpTool>;
|
|
880
|
-
getTool: (name: string) => NcpTool | undefined;
|
|
881
|
-
getToolDefinitions: () => ReadonlyArray<NcpToolDefinition>;
|
|
882
|
-
execute: (toolCallId: string, toolName: string, args: unknown) => Promise<unknown>;
|
|
883
|
-
private buildToolExecutionContext;
|
|
884
|
-
private registerDefaultTools;
|
|
885
|
-
private registerMessagingTools;
|
|
886
|
-
private resolveMessageChannels;
|
|
887
|
-
private registerExtensionTools;
|
|
888
|
-
private registerTool;
|
|
889
|
-
private registerAdditionalTools;
|
|
890
|
-
private isToolAvailable;
|
|
891
|
-
}
|
|
892
|
-
declare function resolveAgentHandoffDepth(metadata: Record<string, unknown>): number;
|
|
893
|
-
//#endregion
|
|
894
994
|
//#region src/features/native-runtime/services/nextclaw-ncp-context-builder.service.d.ts
|
|
895
995
|
type NextclawNcpContextBuilderOptions = {
|
|
896
996
|
sessionManager: SessionManager;
|
|
897
|
-
toolRegistry:
|
|
997
|
+
toolRegistry: ToolRuntimeRegistry;
|
|
898
998
|
getConfig: () => Config;
|
|
899
999
|
assetStore?: LocalAssetStore | null;
|
|
900
1000
|
};
|
|
@@ -922,12 +1022,6 @@ declare function createAssetTools(params: {
|
|
|
922
1022
|
}): NcpTool[];
|
|
923
1023
|
//#endregion
|
|
924
1024
|
//#region src/features/session-request/utils/agent-runtime-session-request-dispatcher.utils.d.ts
|
|
925
|
-
declare const AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE: _$_nextclaw_shared0.TypedKey<AgentRuntimeSessionMessageRequest>;
|
|
926
|
-
type AgentRuntimeSessionMessageRequest = {
|
|
927
|
-
message: NcpMessage;
|
|
928
|
-
requestId: string;
|
|
929
|
-
sessionId: string;
|
|
930
|
-
};
|
|
931
1025
|
type AgentRuntimeSessionRequestDispatcherOptions = {
|
|
932
1026
|
eventBus: EventBus;
|
|
933
1027
|
ingress: Ingress;
|
|
@@ -947,6 +1041,12 @@ declare function dispatchAgentRuntimeSessionRequest(input: {
|
|
|
947
1041
|
}): Promise<void>;
|
|
948
1042
|
declare function createAgentRuntimeSessionRequestDispatcher(options: AgentRuntimeSessionRequestDispatcherOptions): SessionRequestDispatcher;
|
|
949
1043
|
//#endregion
|
|
1044
|
+
//#region src/features/extension-runtime/utils/extension-channel-catalog.utils.d.ts
|
|
1045
|
+
declare function listExtensionChannelIds(params: {
|
|
1046
|
+
config: Config;
|
|
1047
|
+
workspace: string;
|
|
1048
|
+
}): string[];
|
|
1049
|
+
//#endregion
|
|
950
1050
|
//#region src/utils/ncp-session-summary.utils.d.ts
|
|
951
1051
|
declare function createNcpSessionSummary(params: {
|
|
952
1052
|
sessionId: string;
|
|
@@ -963,4 +1063,24 @@ declare function createNcpSessionSummary(params: {
|
|
|
963
1063
|
declare function toNcpMessages(sessionId: string, messages: SessionMessage[]): NcpMessage[];
|
|
964
1064
|
declare function resolveLegacyEventType(message: SessionMessage): string;
|
|
965
1065
|
//#endregion
|
|
966
|
-
|
|
1066
|
+
//#region src/types/tool.types.d.ts
|
|
1067
|
+
type ToolRecord = {
|
|
1068
|
+
id: ToolId;
|
|
1069
|
+
name: string;
|
|
1070
|
+
description: string;
|
|
1071
|
+
inputSchema?: Record<string, unknown>;
|
|
1072
|
+
enabled: boolean;
|
|
1073
|
+
metadata: Record<string, unknown>;
|
|
1074
|
+
};
|
|
1075
|
+
//#endregion
|
|
1076
|
+
//#region src/types/skill.types.d.ts
|
|
1077
|
+
type SkillRecord = {
|
|
1078
|
+
id: SkillId;
|
|
1079
|
+
name: string;
|
|
1080
|
+
description: string;
|
|
1081
|
+
toolIds: ToolId[];
|
|
1082
|
+
enabled: boolean;
|
|
1083
|
+
metadata: Record<string, unknown>;
|
|
1084
|
+
};
|
|
1085
|
+
//#endregion
|
|
1086
|
+
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 };
|