@nextclaw/kernel 0.1.7 → 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 -525
- package/dist/index.js +6037 -4457
- 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,110 +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
|
-
resolveMessageToolHints: (params: {
|
|
144
|
-
channel?: string | null;
|
|
145
|
-
config?: Config;
|
|
146
|
-
accountId?: string | null;
|
|
147
|
-
}) => string[];
|
|
148
|
-
}
|
|
149
111
|
//#endregion
|
|
150
112
|
//#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
|
|
151
113
|
declare const DEFAULT_AGENT_RUNTIME_ENTRY_ID = "native";
|
|
@@ -218,7 +180,6 @@ type AgentRuntimeResolverConfig = {
|
|
|
218
180
|
};
|
|
219
181
|
declare function resolveAgentRuntimeEntries(params: {
|
|
220
182
|
config: AgentRuntimeResolverConfig;
|
|
221
|
-
providerKinds: string[];
|
|
222
183
|
}): {
|
|
223
184
|
defaultEntryId: string;
|
|
224
185
|
entries: AgentRuntimeEntry[];
|
|
@@ -232,7 +193,6 @@ declare class AgentRuntimeRegistry {
|
|
|
232
193
|
entries: AgentRuntimeEntry[];
|
|
233
194
|
defaultEntryId?: string;
|
|
234
195
|
}) => void;
|
|
235
|
-
listProviderKinds: () => string[];
|
|
236
196
|
createRuntime: (params: RuntimeFactoryParams) => NcpAgentRuntime;
|
|
237
197
|
listSessionTypes: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
|
|
238
198
|
defaultType: string;
|
|
@@ -240,273 +200,86 @@ declare class AgentRuntimeRegistry {
|
|
|
240
200
|
}>;
|
|
241
201
|
}
|
|
242
202
|
//#endregion
|
|
243
|
-
//#region src/features/runtime-registry/controllers/plugin-runtime-registration.controller.d.ts
|
|
244
|
-
declare class PluginRuntimeRegistrationController {
|
|
245
|
-
private readonly runtimeRegistry;
|
|
246
|
-
private readonly extensions;
|
|
247
|
-
private readonly pluginRuntimeScopes;
|
|
248
|
-
private pluginRuntimeSnapshotKey;
|
|
249
|
-
constructor(runtimeRegistry: AgentRuntimeRegistry, extensions: ExtensionManager);
|
|
250
|
-
refreshPluginRuntimeRegistrations: () => void;
|
|
251
|
-
dispose: () => void;
|
|
252
|
-
private syncPluginRuntimeRegistrations;
|
|
253
|
-
private resolveActiveExtensionRegistry;
|
|
254
|
-
}
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/features/ncp-dispatch/utils/agent-runtime-handle.utils.d.ts
|
|
257
|
-
type AgentRuntimeSessionTypes = Awaited<ReturnType<AgentRuntimeRegistry["listSessionTypes"]>>;
|
|
258
|
-
type AgentRuntimeEndpoint = {
|
|
259
|
-
agentClientEndpoint: NcpAgentClientEndpoint;
|
|
260
|
-
streamProvider?: NcpHttpAgentStreamProvider;
|
|
261
|
-
listSessionTypes?: (params?: AgentRuntimeSessionTypeDescribeParams) => Promise<AgentRuntimeSessionTypes> | AgentRuntimeSessionTypes;
|
|
262
|
-
assetApi?: {
|
|
263
|
-
put: (input: {
|
|
264
|
-
fileName: string;
|
|
265
|
-
mimeType?: string | null;
|
|
266
|
-
bytes: Uint8Array;
|
|
267
|
-
createdAt?: Date;
|
|
268
|
-
}) => ReturnType<LocalAssetStore["putBytes"]>;
|
|
269
|
-
stat: LocalAssetStore["statRecord"];
|
|
270
|
-
resolveContentPath: LocalAssetStore["resolveContentPath"];
|
|
271
|
-
};
|
|
272
|
-
basePath?: string;
|
|
273
|
-
};
|
|
274
|
-
type AgentRuntimeHandle = AgentRuntimeEndpoint & {
|
|
275
|
-
runApi: NcpAgentRunApi;
|
|
276
|
-
sessionApi: NcpSessionApi;
|
|
277
|
-
applyMcpConfig?: (config: Config) => Promise<void>;
|
|
278
|
-
dispose?: () => Promise<void>;
|
|
279
|
-
};
|
|
280
|
-
declare function createAgentRuntimeHandle(params: {
|
|
281
|
-
backend: DefaultNcpAgentBackend;
|
|
282
|
-
agentClientEndpoint?: NcpAgentClientEndpoint;
|
|
283
|
-
runtimeRegistry: AgentRuntimeRegistry;
|
|
284
|
-
refreshPluginRuntimeRegistrations: () => void;
|
|
285
|
-
refreshConfiguredRuntimeEntries: () => void;
|
|
286
|
-
applyMcpConfig: (config: Config) => Promise<void>;
|
|
287
|
-
dispose: () => Promise<void>;
|
|
288
|
-
assetStore: LocalAssetStore;
|
|
289
|
-
}): AgentRuntimeHandle;
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-runner.utils.d.ts
|
|
292
|
-
type AssetApi = {
|
|
293
|
-
put: (input: {
|
|
294
|
-
fileName: string;
|
|
295
|
-
mimeType?: string | null;
|
|
296
|
-
bytes: Uint8Array;
|
|
297
|
-
createdAt?: Date;
|
|
298
|
-
}) => Promise<{
|
|
299
|
-
uri: string;
|
|
300
|
-
}>;
|
|
301
|
-
resolveContentPath?: (uri: string) => string | null;
|
|
302
|
-
};
|
|
303
|
-
type NcpRunnerAgent = {
|
|
304
|
-
runApi: NcpAgentRunApi;
|
|
305
|
-
assetApi?: AssetApi;
|
|
306
|
-
};
|
|
307
|
-
type RunPromptOverNcpParams = {
|
|
308
|
-
agent: NcpRunnerAgent;
|
|
309
|
-
sessionId: string;
|
|
310
|
-
content: string;
|
|
311
|
-
attachments?: InboundAttachment[];
|
|
312
|
-
metadata?: Record<string, unknown>;
|
|
313
|
-
abortSignal?: AbortSignal;
|
|
314
|
-
onAssistantDelta?: (delta: string) => void;
|
|
315
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
316
|
-
missingCompletedMessageError?: string;
|
|
317
|
-
runErrorMessage?: string;
|
|
318
|
-
};
|
|
319
|
-
type StreamPromptOverNcpParams = Omit<RunPromptOverNcpParams, "onAssistantDelta" | "missingCompletedMessageError" | "runErrorMessage">;
|
|
320
|
-
declare function buildUserMessageParts(params: {
|
|
321
|
-
content: string;
|
|
322
|
-
attachments?: InboundAttachment[];
|
|
323
|
-
assetApi?: AssetApi;
|
|
324
|
-
}): Promise<NcpMessagePart[]>;
|
|
325
|
-
declare function buildNcpUserMessage(params: {
|
|
326
|
-
sessionId: string;
|
|
327
|
-
content: string;
|
|
328
|
-
attachments?: InboundAttachment[];
|
|
329
|
-
metadata?: Record<string, unknown>;
|
|
330
|
-
assetApi?: AssetApi;
|
|
331
|
-
}): Promise<NcpMessage>;
|
|
332
|
-
declare function streamPromptOverNcp(params: StreamPromptOverNcpParams): AsyncGenerator<NcpEndpointEvent>;
|
|
333
|
-
declare function runPromptOverNcp(params: RunPromptOverNcpParams): Promise<{
|
|
334
|
-
text: string;
|
|
335
|
-
completedMessage: NcpMessage;
|
|
336
|
-
}>;
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/features/ncp-dispatch/utils/channel-reply.utils.d.ts
|
|
339
|
-
type ReplyCapableChannel = BaseChannel<Record<string, unknown>> & {
|
|
340
|
-
consumeNcpReply(input: NcpReplyInput): Promise<void>;
|
|
341
|
-
};
|
|
342
|
-
type ChannelReplyRoute = {
|
|
343
|
-
target: ChatTarget;
|
|
344
|
-
channel: ReplyCapableChannel;
|
|
345
|
-
};
|
|
346
|
-
type ResolvedInboundRoute = {
|
|
347
|
-
accountId?: string | null;
|
|
348
|
-
};
|
|
349
|
-
type ChannelReplyRouterDispatchParams = {
|
|
350
|
-
agent: NcpRunnerAgent;
|
|
351
|
-
route: ChannelReplyRoute;
|
|
352
|
-
sessionId: string;
|
|
353
|
-
content: string;
|
|
354
|
-
attachments?: InboundAttachment[];
|
|
355
|
-
metadata?: Record<string, unknown>;
|
|
356
|
-
abortSignal?: AbortSignal;
|
|
357
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
358
|
-
};
|
|
359
|
-
declare function isReplyCapableChannel(channel: BaseChannel<Record<string, unknown>> | null | undefined): channel is ReplyCapableChannel;
|
|
360
|
-
declare function resolveChannelReplyRoute(params: {
|
|
361
|
-
channel: BaseChannel<Record<string, unknown>> | null | undefined;
|
|
362
|
-
message: InboundMessage;
|
|
363
|
-
route: ResolvedInboundRoute;
|
|
364
|
-
}): ChannelReplyRoute | null;
|
|
365
|
-
declare function dispatchChannelReplyRoute(params: ChannelReplyRouterDispatchParams): Promise<void>;
|
|
366
|
-
//#endregion
|
|
367
|
-
//#region src/features/ncp-dispatch/utils/nextclaw-ncp-dispatch.utils.d.ts
|
|
368
|
-
type DirectPromptDispatchParams = {
|
|
369
|
-
config: Config;
|
|
370
|
-
sessionManager: SessionManager;
|
|
371
|
-
resolveNcpAgent?: () => NcpRunnerAgent | null;
|
|
372
|
-
content: string;
|
|
373
|
-
sessionKey?: string;
|
|
374
|
-
channel?: string;
|
|
375
|
-
chatId?: string;
|
|
376
|
-
attachments?: InboundAttachment[];
|
|
377
|
-
metadata?: Record<string, unknown>;
|
|
378
|
-
agentId?: string;
|
|
379
|
-
abortSignal?: AbortSignal;
|
|
380
|
-
onAssistantDelta?: (delta: string) => void;
|
|
381
|
-
};
|
|
382
|
-
type GatewayInboundLoopRuntime = {
|
|
383
|
-
kernel: {
|
|
384
|
-
channels: ChannelManager$1;
|
|
385
|
-
};
|
|
386
|
-
messageBus: MessageBus;
|
|
387
|
-
sessionManager: SessionManager;
|
|
388
|
-
configManager: {
|
|
389
|
-
loadConfig: () => Config;
|
|
390
|
-
};
|
|
391
|
-
liveAgentRuntime: NcpRunnerAgent | null;
|
|
392
|
-
appEventBus?: EventBus;
|
|
393
|
-
};
|
|
394
|
-
declare function dispatchPromptOverNcp(params: DirectPromptDispatchParams): Promise<string>;
|
|
395
|
-
declare function runGatewayInboundLoop(runtime: GatewayInboundLoopRuntime): Promise<void>;
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region src/types/llm-usage.types.d.ts
|
|
398
|
-
type LlmUsageSummary = {
|
|
399
|
-
promptTokens: number;
|
|
400
|
-
completionTokens: number;
|
|
401
|
-
totalTokens: number;
|
|
402
|
-
cachedTokens: number;
|
|
403
|
-
cacheHit: boolean;
|
|
404
|
-
cacheMetricKeys: string[];
|
|
405
|
-
};
|
|
406
|
-
type LlmUsageRecord = {
|
|
407
|
-
version: 1;
|
|
408
|
-
observedAt: string;
|
|
409
|
-
source: string;
|
|
410
|
-
model: string | null;
|
|
411
|
-
usage: Record<string, number>;
|
|
412
|
-
summary: LlmUsageSummary;
|
|
413
|
-
};
|
|
414
|
-
type LlmUsageSnapshot = LlmUsageRecord;
|
|
415
|
-
declare function createLlmUsageRecord(params: {
|
|
416
|
-
observedAt?: string;
|
|
417
|
-
source: string;
|
|
418
|
-
model?: string | null;
|
|
419
|
-
usage: Record<string, number>;
|
|
420
|
-
}): LlmUsageRecord;
|
|
421
|
-
declare function sanitizeLlmUsage(usage: Record<string, number>): Record<string, number>;
|
|
422
|
-
declare function hasLlmUsageTelemetry(usage: Record<string, number>): boolean;
|
|
423
|
-
declare function buildLlmUsageSummary(usage: Record<string, number>): LlmUsageSummary;
|
|
424
|
-
declare function normalizeLlmUsageModel(value: string | null | undefined): string | null;
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region src/stores/llm-usage.store.d.ts
|
|
427
|
-
type LlmUsageStoreOptions = {
|
|
428
|
-
snapshotPath?: string;
|
|
429
|
-
historyPath?: string;
|
|
430
|
-
};
|
|
431
|
-
declare class LlmUsageStore {
|
|
432
|
-
private readonly options;
|
|
433
|
-
constructor(options?: LlmUsageStoreOptions);
|
|
434
|
-
get snapshotPath(): string;
|
|
435
|
-
get historyPath(): string;
|
|
436
|
-
readSnapshot: () => LlmUsageRecord | null;
|
|
437
|
-
writeSnapshot: (snapshot: LlmUsageRecord) => void;
|
|
438
|
-
clearSnapshot: () => void;
|
|
439
|
-
listHistory: () => LlmUsageRecord[];
|
|
440
|
-
appendHistory: (record: LlmUsageRecord) => void;
|
|
441
|
-
clearHistory: () => void;
|
|
442
|
-
}
|
|
443
|
-
//#endregion
|
|
444
|
-
//#region src/managers/llm-usage.manager.d.ts
|
|
445
|
-
type LlmUsageManagerOptions = {
|
|
446
|
-
store?: LlmUsageStore;
|
|
447
|
-
};
|
|
448
|
-
declare class LlmUsageManager {
|
|
449
|
-
private readonly store;
|
|
450
|
-
constructor(options?: LlmUsageManagerOptions);
|
|
451
|
-
observeProviderManager: (providerManager: LlmProviderRuntime, source: string) => LlmProviderRuntime;
|
|
452
|
-
record: (params: {
|
|
453
|
-
observedAt?: string;
|
|
454
|
-
source: string;
|
|
455
|
-
model?: string | null;
|
|
456
|
-
usage: Record<string, number>;
|
|
457
|
-
}) => LlmUsageRecord | null;
|
|
458
|
-
}
|
|
459
|
-
//#endregion
|
|
460
203
|
//#region src/managers/agent-runtime.manager.d.ts
|
|
461
204
|
type AgentRuntimeManagerOptions = {
|
|
462
|
-
bus: MessageBus;
|
|
463
|
-
providerManager: LlmProviderRuntime;
|
|
464
|
-
sessions: SessionManager;
|
|
465
|
-
ingress: Ingress;
|
|
466
|
-
sessionRequests: SessionRequestManager;
|
|
467
|
-
sessionSearch: SessionSearchManager;
|
|
468
|
-
ncpAgentSessionStore: AgentSessionStore;
|
|
469
|
-
cronService?: CronService | null;
|
|
470
205
|
configManager: {
|
|
471
206
|
loadConfig: () => Config;
|
|
472
207
|
};
|
|
473
|
-
|
|
474
|
-
eventBus: EventBus;
|
|
475
|
-
handleNcpEvent: (event: NcpEndpointEvent) => void;
|
|
476
|
-
llmUsage: LlmUsageManager;
|
|
477
|
-
onSessionUpdated: (sessionKey: string) => void;
|
|
208
|
+
assetStore: LocalAssetStore;
|
|
478
209
|
};
|
|
479
210
|
declare class AgentRuntimeManager {
|
|
480
211
|
private readonly params;
|
|
481
212
|
private readonly runtimeRegistry;
|
|
482
|
-
private readonly mcpRuntimeSupport;
|
|
483
|
-
private readonly assetStore;
|
|
484
|
-
private readonly pluginRuntimeRegistrationController;
|
|
485
213
|
private readonly refreshConfiguredRuntimeEntries;
|
|
486
|
-
private backend;
|
|
487
|
-
private handle;
|
|
488
|
-
private builtinNarpRegistrations;
|
|
489
|
-
private kernelBootstrapped;
|
|
490
|
-
private warmupPromise;
|
|
491
|
-
private unsubscribeNcpEvents;
|
|
492
|
-
private unsubscribeAgentRuntimeRequestIngress;
|
|
493
|
-
private gatewayController;
|
|
494
214
|
private disposed;
|
|
495
215
|
constructor(params: AgentRuntimeManagerOptions);
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
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
|
+
});
|
|
503
241
|
dispose: () => Promise<void>;
|
|
504
|
-
|
|
505
|
-
|
|
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;
|
|
506
255
|
private publishSessionRunStatus;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
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;
|
|
510
283
|
private readonly assertNotDisposed;
|
|
511
284
|
}
|
|
512
285
|
//#endregion
|
|
@@ -518,6 +291,50 @@ declare class AutomationManager extends CronService {
|
|
|
518
291
|
constructor(options: AutomationManagerOptions);
|
|
519
292
|
}
|
|
520
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
|
|
521
338
|
//#region src/managers/config.manager.d.ts
|
|
522
339
|
type ConfigManagerRuntimeHooks = {
|
|
523
340
|
resolveChannelConfig?: (config: Config) => Config;
|
|
@@ -546,6 +363,16 @@ type ConfigManagerOptions = {
|
|
|
546
363
|
channels: ChannelManager$1;
|
|
547
364
|
providerManager: LlmProviderManager;
|
|
548
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
|
+
};
|
|
549
376
|
declare class ConfigManager {
|
|
550
377
|
private readonly options;
|
|
551
378
|
readonly configPath: string;
|
|
@@ -562,6 +389,14 @@ declare class ConfigManager {
|
|
|
562
389
|
installRuntimeHooks: (hooks: ConfigManagerRuntimeHooks) => void;
|
|
563
390
|
applyLiveConfigReload: () => Promise<void>;
|
|
564
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>;
|
|
565
400
|
scheduleReload: (reason: string) => void;
|
|
566
401
|
runReload: (reason: string) => Promise<void>;
|
|
567
402
|
reloadConfig: (reason?: string) => Promise<string>;
|
|
@@ -574,86 +409,260 @@ declare class ConfigManager {
|
|
|
574
409
|
private reloadPlugins;
|
|
575
410
|
private reloadMcp;
|
|
576
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;
|
|
577
486
|
}
|
|
578
487
|
//#endregion
|
|
579
|
-
//#region src/
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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;
|
|
590
521
|
};
|
|
591
|
-
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
|
+
}
|
|
592
534
|
//#endregion
|
|
593
|
-
//#region src/managers/
|
|
594
|
-
type
|
|
595
|
-
|
|
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
|
+
}>;
|
|
596
558
|
};
|
|
597
|
-
type
|
|
598
|
-
|
|
599
|
-
sessionManager: SessionManager;
|
|
600
|
-
sessionRequester: LearningLoopSessionRequester;
|
|
601
|
-
resolveLearningLoopConfig?: () => LearningLoopRuntimeConfig;
|
|
559
|
+
type LlmUsageManagerOptions = {
|
|
560
|
+
store?: LlmUsageStore;
|
|
602
561
|
};
|
|
603
|
-
declare class
|
|
604
|
-
private readonly
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
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>;
|
|
609
593
|
start: () => void;
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
private
|
|
613
|
-
private readRuntimeConfig;
|
|
614
|
-
private buildReviewTitle;
|
|
594
|
+
applyConfig: (config: Config) => Promise<void>;
|
|
595
|
+
dispose: () => Promise<void>;
|
|
596
|
+
private prewarmEnabledServersSafely;
|
|
615
597
|
}
|
|
616
598
|
//#endregion
|
|
617
|
-
//#region src/
|
|
618
|
-
type
|
|
619
|
-
|
|
620
|
-
name
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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[];
|
|
625
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;
|
|
626
613
|
//#endregion
|
|
627
614
|
//#region src/managers/skill.manager.d.ts
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
enableSkill: (skillId: SkillId) => never;
|
|
634
|
-
disableSkill: (skillId: SkillId) => never;
|
|
635
|
-
resolveSkills: (skillIds: SkillId[]) => never;
|
|
636
|
-
}
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region src/types/tool.types.d.ts
|
|
639
|
-
type ToolRecord = {
|
|
640
|
-
id: ToolId;
|
|
615
|
+
type WorkspaceParams = {
|
|
616
|
+
workspace: string;
|
|
617
|
+
};
|
|
618
|
+
type InstalledSkillSummary = {
|
|
619
|
+
ref: string;
|
|
641
620
|
name: string;
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
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;
|
|
646
632
|
};
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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;
|
|
657
666
|
}
|
|
658
667
|
//#endregion
|
|
659
668
|
//#region src/services/ncp-session-api.service.d.ts
|
|
@@ -665,7 +674,7 @@ type NcpSessionApiServiceOptions = {
|
|
|
665
674
|
eventBus: EventBus;
|
|
666
675
|
getConfig: () => Config;
|
|
667
676
|
isLiveSessionRunning?: (sessionId: string) => boolean;
|
|
668
|
-
ncpAgentSessionStore
|
|
677
|
+
ncpAgentSessionStore: NcpAgentSessionReadableStore;
|
|
669
678
|
sessionManager: SessionManager;
|
|
670
679
|
};
|
|
671
680
|
declare class NcpSessionApiService implements NcpSessionApi {
|
|
@@ -681,6 +690,7 @@ declare class NcpSessionApiService implements NcpSessionApi {
|
|
|
681
690
|
getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
682
691
|
updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
|
|
683
692
|
deleteSession: (sessionId: string) => Promise<void>;
|
|
693
|
+
private createSummaryFromRecord;
|
|
684
694
|
private withLiveSessionStatus;
|
|
685
695
|
}
|
|
686
696
|
//#endregion
|
|
@@ -712,47 +722,166 @@ declare class NextclawKernel {
|
|
|
712
722
|
readonly agents: AgentManager;
|
|
713
723
|
readonly sessions: SessionManager;
|
|
714
724
|
readonly control: NextclawKernelControlManager<unknown, unknown, unknown>;
|
|
715
|
-
readonly
|
|
725
|
+
readonly toolManager: ToolManager;
|
|
716
726
|
readonly skills: SkillManager;
|
|
717
727
|
readonly automation: AutomationManager;
|
|
718
728
|
readonly channels: ChannelManager$1;
|
|
719
729
|
readonly sessionRequests: SessionRequestManager;
|
|
720
730
|
readonly sessionSearch: SessionSearchManager;
|
|
731
|
+
readonly assetStore: LocalAssetStore;
|
|
732
|
+
readonly mcpManager: McpManager;
|
|
721
733
|
readonly ncpSessionApi: NcpSessionApiService;
|
|
722
734
|
readonly extensions: ExtensionManager;
|
|
735
|
+
readonly agentRunRequestManager: AgentRunRequestManager;
|
|
736
|
+
readonly sessionRunManager: SessionRunManager;
|
|
723
737
|
readonly agentRuntimeManager: AgentRuntimeManager;
|
|
724
|
-
readonly learningLoop: LearningLoopManager;
|
|
725
|
-
private readonly sessionLifecycleEvents;
|
|
726
738
|
private readonly ncpAgentSessionStore;
|
|
727
739
|
private readonly ncpAgentSessionJournalStore;
|
|
728
740
|
private readonly contributions;
|
|
741
|
+
private gatewayController;
|
|
729
742
|
constructor(options?: NextclawKernelOptions);
|
|
743
|
+
provideGatewayController: (gatewayController: GatewayController) => void;
|
|
744
|
+
getGatewayController: () => GatewayController | undefined;
|
|
730
745
|
start: () => Promise<void>;
|
|
731
746
|
dispose: () => Promise<void>;
|
|
732
|
-
|
|
733
|
-
private handleNcpEvent;
|
|
747
|
+
publishSessionUpdated: (sessionKey: string) => void;
|
|
734
748
|
}
|
|
735
749
|
//#endregion
|
|
736
|
-
//#region src/
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
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;
|
|
742
756
|
//#endregion
|
|
743
|
-
//#region src/features/narp-runtime/services/builtin-narp-runtime-
|
|
757
|
+
//#region src/features/narp-runtime/services/builtin-narp-runtime-provider.service.d.ts
|
|
744
758
|
declare const NARP_HTTP_RUNTIME_KIND = "narp-http";
|
|
745
759
|
declare const NARP_STDIO_RUNTIME_KIND = "narp-stdio";
|
|
746
|
-
declare class
|
|
760
|
+
declare class BuiltinNarpRuntimeProviderService {
|
|
747
761
|
private readonly getConfig;
|
|
748
762
|
constructor(getConfig: () => Config);
|
|
749
|
-
|
|
763
|
+
createProviders: () => AgentRuntimeProviderRegistration[];
|
|
750
764
|
private createUnavailableRuntime;
|
|
751
765
|
private createHttpRuntime;
|
|
752
766
|
private createStdioRuntime;
|
|
753
767
|
}
|
|
754
768
|
//#endregion
|
|
755
|
-
//#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
|
|
756
885
|
type ContextWindowOwner = "nextclaw" | "runtime";
|
|
757
886
|
type ContextCompactionPreflightResult = {
|
|
758
887
|
contextWindow: ContextWindowSnapshot;
|
|
@@ -806,109 +935,67 @@ declare class ContextCompactionPreflightService {
|
|
|
806
935
|
private generateSummary;
|
|
807
936
|
}
|
|
808
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
|
|
809
972
|
//#region src/features/native-runtime/services/native-agent-runtime-factory.service.d.ts
|
|
810
973
|
type NativeRuntimeFactory = (runtimeParams: RuntimeFactoryParams) => NcpAgentRuntime;
|
|
811
|
-
type UpdateToolCallResult = (params: {
|
|
812
|
-
sessionId: string;
|
|
813
|
-
toolCallId: string;
|
|
814
|
-
result: unknown;
|
|
815
|
-
}) => Promise<void>;
|
|
816
974
|
type NativeAgentRuntimeFactoryOptions = {
|
|
817
|
-
bus: MessageBus;
|
|
818
975
|
providerManager: LlmProviderRuntime;
|
|
819
976
|
sessions: SessionManager;
|
|
820
|
-
sessionRequests: SessionRequestManager;
|
|
821
|
-
sessionSearch: SessionSearchManager;
|
|
822
|
-
cronService?: CronService | null;
|
|
823
977
|
configManager: {
|
|
824
978
|
loadConfig: () => Config;
|
|
825
979
|
};
|
|
826
|
-
extensions: ExtensionManager;
|
|
827
980
|
llmUsage: LlmUsageManager;
|
|
828
981
|
onSessionUpdated: (sessionKey: string) => void;
|
|
829
|
-
resolveGatewayController: () => GatewayController | undefined;
|
|
830
|
-
mcpToolRegistryAdapter: McpNcpToolRegistryAdapter;
|
|
831
982
|
assetStore: LocalAssetStore;
|
|
832
983
|
updateToolCallResult: UpdateToolCallResult;
|
|
984
|
+
toolManager: ToolManager;
|
|
833
985
|
};
|
|
834
986
|
declare class NativeAgentRuntimeFactory {
|
|
835
987
|
private readonly options;
|
|
836
988
|
private readonly observedProviderManager;
|
|
837
989
|
constructor(options: NativeAgentRuntimeFactoryOptions);
|
|
838
990
|
create: NativeRuntimeFactory;
|
|
839
|
-
resolveOpenAiToolsForRuntime: (input: NcpAgentRunInput) => _$_nextclaw_ncp0.OpenAITool[] | undefined;
|
|
840
991
|
private createToolRegistry;
|
|
841
992
|
}
|
|
842
993
|
//#endregion
|
|
843
|
-
//#region src/features/native-runtime/services/nextclaw-ncp-tool-registry.service.d.ts
|
|
844
|
-
type NextclawNcpToolRegistryOptions = {
|
|
845
|
-
bus: MessageBus;
|
|
846
|
-
providerManager: LlmProviderRuntime;
|
|
847
|
-
sessionManager: SessionManager;
|
|
848
|
-
cronService?: CronService | null;
|
|
849
|
-
gatewayController?: GatewayController;
|
|
850
|
-
getConfig: () => Config;
|
|
851
|
-
getExtensionRegistry?: () => ExtensionRegistry | undefined;
|
|
852
|
-
getAdditionalTools?: (context: PreparedRunContext) => ReadonlyArray<NcpTool>;
|
|
853
|
-
onSessionUpdated?: (sessionKey: string) => void;
|
|
854
|
-
sessionRequestManager: SessionRequestManager;
|
|
855
|
-
updateToolCallResult: (params: {
|
|
856
|
-
sessionId: string;
|
|
857
|
-
toolCallId: string;
|
|
858
|
-
result: unknown;
|
|
859
|
-
}) => Promise<void>;
|
|
860
|
-
};
|
|
861
|
-
type PreparedRunContext = {
|
|
862
|
-
agentId: string;
|
|
863
|
-
channel: string;
|
|
864
|
-
chatId: string;
|
|
865
|
-
config: Config;
|
|
866
|
-
contextTokens: number;
|
|
867
|
-
execTimeoutSeconds: number;
|
|
868
|
-
handoffDepth: number;
|
|
869
|
-
maxTokens?: number;
|
|
870
|
-
metadata: Record<string, unknown>;
|
|
871
|
-
model: string;
|
|
872
|
-
restrictToWorkspace: boolean;
|
|
873
|
-
searchConfig: SearchConfig;
|
|
874
|
-
sessionId: string;
|
|
875
|
-
workspace: string;
|
|
876
|
-
};
|
|
877
|
-
declare class NextclawNcpToolRegistry implements NcpToolRegistry {
|
|
878
|
-
private readonly options;
|
|
879
|
-
private registry;
|
|
880
|
-
private readonly tools;
|
|
881
|
-
private currentExtensionToolContext;
|
|
882
|
-
constructor(options: NextclawNcpToolRegistryOptions);
|
|
883
|
-
prepareForRun: (context: PreparedRunContext) => void;
|
|
884
|
-
listTools: () => ReadonlyArray<NcpTool>;
|
|
885
|
-
getTool: (name: string) => NcpTool | undefined;
|
|
886
|
-
getToolDefinitions: () => ReadonlyArray<NcpToolDefinition>;
|
|
887
|
-
execute: (toolCallId: string, toolName: string, args: unknown) => Promise<unknown>;
|
|
888
|
-
private buildToolExecutionContext;
|
|
889
|
-
private registerDefaultTools;
|
|
890
|
-
private registerMessagingTools;
|
|
891
|
-
private resolveMessageChannels;
|
|
892
|
-
private registerExtensionTools;
|
|
893
|
-
private registerTool;
|
|
894
|
-
private registerAdditionalTools;
|
|
895
|
-
private isToolAvailable;
|
|
896
|
-
}
|
|
897
|
-
declare function resolveAgentHandoffDepth(metadata: Record<string, unknown>): number;
|
|
898
|
-
declare function readAccountIdForHints(metadata: Record<string, unknown>, sessionMetadata: Record<string, unknown>): string | undefined;
|
|
899
|
-
//#endregion
|
|
900
994
|
//#region src/features/native-runtime/services/nextclaw-ncp-context-builder.service.d.ts
|
|
901
|
-
type MessageToolHintsResolver = (params: {
|
|
902
|
-
sessionKey: string;
|
|
903
|
-
channel: string;
|
|
904
|
-
chatId: string;
|
|
905
|
-
accountId?: string | null;
|
|
906
|
-
}) => string[];
|
|
907
995
|
type NextclawNcpContextBuilderOptions = {
|
|
908
996
|
sessionManager: SessionManager;
|
|
909
|
-
toolRegistry:
|
|
997
|
+
toolRegistry: ToolRuntimeRegistry;
|
|
910
998
|
getConfig: () => Config;
|
|
911
|
-
resolveMessageToolHints?: MessageToolHintsResolver;
|
|
912
999
|
assetStore?: LocalAssetStore | null;
|
|
913
1000
|
};
|
|
914
1001
|
declare class NextclawNcpContextBuilder implements NcpContextBuilder {
|
|
@@ -935,12 +1022,6 @@ declare function createAssetTools(params: {
|
|
|
935
1022
|
}): NcpTool[];
|
|
936
1023
|
//#endregion
|
|
937
1024
|
//#region src/features/session-request/utils/agent-runtime-session-request-dispatcher.utils.d.ts
|
|
938
|
-
declare const AGENT_RUNTIME_SESSION_MESSAGE_INGRESS_TYPE: _$_nextclaw_shared0.TypedKey<AgentRuntimeSessionMessageRequest>;
|
|
939
|
-
type AgentRuntimeSessionMessageRequest = {
|
|
940
|
-
message: NcpMessage;
|
|
941
|
-
requestId: string;
|
|
942
|
-
sessionId: string;
|
|
943
|
-
};
|
|
944
1025
|
type AgentRuntimeSessionRequestDispatcherOptions = {
|
|
945
1026
|
eventBus: EventBus;
|
|
946
1027
|
ingress: Ingress;
|
|
@@ -960,6 +1041,12 @@ declare function dispatchAgentRuntimeSessionRequest(input: {
|
|
|
960
1041
|
}): Promise<void>;
|
|
961
1042
|
declare function createAgentRuntimeSessionRequestDispatcher(options: AgentRuntimeSessionRequestDispatcherOptions): SessionRequestDispatcher;
|
|
962
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
|
|
963
1050
|
//#region src/utils/ncp-session-summary.utils.d.ts
|
|
964
1051
|
declare function createNcpSessionSummary(params: {
|
|
965
1052
|
sessionId: string;
|
|
@@ -976,4 +1063,24 @@ declare function createNcpSessionSummary(params: {
|
|
|
976
1063
|
declare function toNcpMessages(sessionId: string, messages: SessionMessage[]): NcpMessage[];
|
|
977
1064
|
declare function resolveLegacyEventType(message: SessionMessage): string;
|
|
978
1065
|
//#endregion
|
|
979
|
-
|
|
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 };
|