@nextclaw/kernel 0.1.15-beta.1 → 0.1.15-beta.3
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 +366 -501
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5193 -6108
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
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 { AgentRouteResolver, BaseChannel, ChannelManager, ChannelManager as ChannelManager$1, Config, ContextCompactionPlan, ContextWindowSnapshot, CreateSessionInput, CreatedSession, CronService, Disposable, ExtensionChannelBinding, ExtensionDiagnostic, ExtensionRegistry, ExtensionUiMetadata, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, RequestSessionParams, RequestedSkillsMetadataReader, SearchConfig, Session, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchManager, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, buildCompressingCompactionCheckpoint, resolveThinkingLevel } from "@nextclaw/core";
|
|
2
3
|
import { AgentRunSendIngressPayload, EventBus, Ingress, Unsubscribe } from "@nextclaw/shared";
|
|
3
|
-
import
|
|
4
|
-
import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpAgentRunInput, NcpAgentRunSendOptions, NcpAgentRuntime, NcpContextBuilder, NcpContextPrepareOptions, NcpEndpointEvent, NcpEventType, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessagePart, NcpRequestEnvelope, NcpRunHandle, NcpSessionApi, NcpSessionPatch, NcpSessionSummary, NcpTool, NcpToolRegistry, OpenAIChatChunk } from "@nextclaw/ncp";
|
|
4
|
+
import { ListMessagesOptions, ListSessionsOptions, NcpAgentRuntime, NcpEndpointEvent, NcpEventType, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpRunHandle, NcpSessionApi, NcpSessionPatch, NcpSessionSummary, NcpTool, OpenAIChatChunk } from "@nextclaw/ncp";
|
|
5
5
|
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
6
|
-
import { BaseChannel, ChannelManager, ChannelManager as ChannelManager$1, Config, ContextCompactionPlan, ContextWindowSnapshot, CreateSessionInput, CreatedSession, CronService, Disposable, ExtensionChannelBinding, ExtensionDiagnostic, ExtensionRegistry, ExtensionToolContext, ExtensionUiMetadata, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, RequestSessionParams, RequestedSkillsMetadataReader, SearchConfig, Session, SessionManager, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchManager, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, Tool, buildCompressingCompactionCheckpoint, resolveThinkingLevel } from "@nextclaw/core";
|
|
7
|
-
import * as _$_nextclaw_ncp_toolkit0 from "@nextclaw/ncp-toolkit";
|
|
8
6
|
import { AgentSessionRecord, ChatTarget, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
|
|
9
|
-
|
|
10
7
|
//#region src/features/runtime-registry/services/agent-runtime-registry.service.d.ts
|
|
11
8
|
type AgentRuntimeSessionTypeIcon = {
|
|
12
9
|
kind: "image";
|
|
@@ -131,154 +128,12 @@ declare class AgentManager {
|
|
|
131
128
|
detachTool: (agentId: AgentId, toolId: ToolId) => never;
|
|
132
129
|
}
|
|
133
130
|
//#endregion
|
|
134
|
-
//#region src/managers/
|
|
135
|
-
type
|
|
136
|
-
|
|
137
|
-
toolCallId: string;
|
|
138
|
-
result: unknown;
|
|
139
|
-
}) => Promise<void>;
|
|
140
|
-
type ToolRunContext = {
|
|
141
|
-
agentId: string;
|
|
142
|
-
channel: string;
|
|
143
|
-
chatId: string;
|
|
144
|
-
config: Config;
|
|
145
|
-
execTimeoutSeconds: number;
|
|
146
|
-
handoffDepth: number;
|
|
147
|
-
metadata: Record<string, unknown>;
|
|
148
|
-
restrictToWorkspace: boolean;
|
|
149
|
-
searchConfig: SearchConfig;
|
|
150
|
-
sessionId: string;
|
|
151
|
-
workspace: string;
|
|
152
|
-
};
|
|
153
|
-
type ToolRegistrationContext = {
|
|
154
|
-
registerTool: (tool: Tool) => void;
|
|
155
|
-
registerNcpTool: (tool: NcpTool) => void;
|
|
156
|
-
hasTool: (name: string) => boolean;
|
|
157
|
-
getExtensionToolRunContext: () => ExtensionToolContext;
|
|
158
|
-
};
|
|
159
|
-
type ToolProvider = {
|
|
160
|
-
id: string;
|
|
161
|
-
registerTools: (context: ToolRunContext, registry: ToolRegistrationContext) => void;
|
|
162
|
-
};
|
|
163
|
-
type ToolRuntimeRegistryOptions = {
|
|
164
|
-
updateToolCallResult: UpdateToolCallResult;
|
|
165
|
-
};
|
|
166
|
-
type ToolRuntimeRegistry = NcpToolRegistry & {
|
|
167
|
-
prepareForRun: (context: ToolRunContext) => void;
|
|
168
|
-
};
|
|
169
|
-
declare class ToolManager {
|
|
170
|
-
private readonly providers;
|
|
171
|
-
provideTools: (provider: ToolProvider) => {
|
|
172
|
-
dispose: () => void;
|
|
173
|
-
};
|
|
174
|
-
createRuntimeRegistry: (options: ToolRuntimeRegistryOptions) => ToolRuntimeRegistry;
|
|
175
|
-
}
|
|
176
|
-
declare function resolveAgentHandoffDepth(metadata: Record<string, unknown>): number;
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/utils/session-run.utils.d.ts
|
|
179
|
-
type LiveSessionExecution = {
|
|
180
|
-
runId: string;
|
|
181
|
-
controller: AbortController;
|
|
182
|
-
requestEnvelope: MaterializedAgentRunRequest;
|
|
183
|
-
abortHandled: boolean;
|
|
184
|
-
closed: boolean;
|
|
185
|
-
};
|
|
186
|
-
type MaterializedAgentRunRequest = NcpRequestEnvelope & {
|
|
187
|
-
runId: string;
|
|
188
|
-
};
|
|
189
|
-
type LiveSession = {
|
|
190
|
-
sessionId: string;
|
|
191
|
-
agentId?: string;
|
|
192
|
-
stateManager: NcpAgentConversationStateManager;
|
|
193
|
-
runtime: NcpAgentRuntime;
|
|
194
|
-
activeExecution: LiveSessionExecution | null;
|
|
195
|
-
};
|
|
196
|
-
type PublishSessionEventOptions = {
|
|
197
|
-
dispatchToStateManager?: boolean;
|
|
198
|
-
persistSession?: boolean;
|
|
199
|
-
};
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region src/managers/agent-runtime.manager.d.ts
|
|
202
|
-
type AgentRuntimeManagerOptions = {
|
|
203
|
-
configManager: {
|
|
204
|
-
loadConfig: () => Config;
|
|
205
|
-
};
|
|
206
|
-
assetStore: LocalAssetStore;
|
|
207
|
-
};
|
|
208
|
-
declare class AgentRuntimeManager {
|
|
209
|
-
private readonly params;
|
|
210
|
-
private readonly runtimeRegistry;
|
|
211
|
-
private readonly refreshConfiguredRuntimeEntries;
|
|
212
|
-
private disposed;
|
|
213
|
-
constructor(params: AgentRuntimeManagerOptions);
|
|
214
|
-
registerRuntimeProvider: (registration: AgentRuntimeProviderRegistration) => Disposable;
|
|
215
|
-
createRuntime: (runtimeParams: RuntimeFactoryParams) => _$_nextclaw_ncp0.NcpAgentRuntime;
|
|
216
|
-
resolveSessionMetadata: (sessionMetadata: Record<string, unknown>) => Record<string, unknown>;
|
|
217
|
-
listSessionTypes: (describeParams?: AgentRuntimeSessionTypeDescribeParams) => Promise<{
|
|
218
|
-
defaultType: string;
|
|
219
|
-
options: AgentRuntimeSessionTypeOption[];
|
|
220
|
-
}>;
|
|
221
|
-
dispose: () => Promise<void>;
|
|
222
|
-
private readonly assertNotDisposed;
|
|
223
|
-
}
|
|
224
|
-
//#endregion
|
|
225
|
-
//#region src/utils/ncp-agent-session-journal.utils.d.ts
|
|
226
|
-
declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
227
|
-
declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
|
|
228
|
-
declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
|
|
229
|
-
declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
|
|
230
|
-
type NcpAgentSessionSnapshotMessageEvent = {
|
|
231
|
-
type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
|
|
232
|
-
payload: Extract<NcpEndpointEvent, {
|
|
233
|
-
type: NcpEventType.MessageSent;
|
|
234
|
-
}>["payload"];
|
|
235
|
-
};
|
|
236
|
-
type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
|
|
237
|
-
type NcpSessionRequestJournalEvent = {
|
|
238
|
-
type: NcpSessionRequestJournalEventType;
|
|
239
|
-
payload: {
|
|
240
|
-
sessionId: string;
|
|
241
|
-
request: unknown;
|
|
242
|
-
};
|
|
131
|
+
//#region src/managers/automation.manager.d.ts
|
|
132
|
+
type AutomationManagerOptions = {
|
|
133
|
+
storePath: string;
|
|
243
134
|
};
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//#region src/stores/ncp-agent-session-journal.store.d.ts
|
|
247
|
-
declare class NcpAgentSessionJournalStore {
|
|
248
|
-
private readonly journalDir;
|
|
249
|
-
private readonly sessions;
|
|
250
|
-
private readonly nextSeqBySession;
|
|
251
|
-
private readonly writeChains;
|
|
252
|
-
private readonly metadataStore;
|
|
253
|
-
private readonly summaryIndexStore;
|
|
254
|
-
constructor(journalDir: string);
|
|
255
|
-
appendSessionEvent: (params: {
|
|
256
|
-
sessionId: string;
|
|
257
|
-
event: NcpAgentSessionJournalReplayEvent;
|
|
258
|
-
}) => Promise<void>;
|
|
259
|
-
getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
260
|
-
listSessionSummaries: () => Promise<NcpSessionSummary[]>;
|
|
261
|
-
listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
|
|
262
|
-
setSessionMetadata: (params: {
|
|
263
|
-
sessionId: string;
|
|
264
|
-
metadata: Record<string, unknown>;
|
|
265
|
-
}) => Promise<boolean>;
|
|
266
|
-
updateSessionMetadata: (params: {
|
|
267
|
-
sessionId: string;
|
|
268
|
-
metadata: Record<string, unknown>;
|
|
269
|
-
}) => Promise<boolean>;
|
|
270
|
-
private setSessionMetadataNow;
|
|
271
|
-
private updateSessionMetadataNow;
|
|
272
|
-
importSessionSnapshot: (record: AgentSessionRecord) => Promise<void>;
|
|
273
|
-
deleteSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
274
|
-
hasSession: (sessionId: string) => Promise<boolean>;
|
|
275
|
-
private appendSessionEventNow;
|
|
276
|
-
private withMetadata;
|
|
277
|
-
private loadSession;
|
|
278
|
-
private parseSessionJournal;
|
|
279
|
-
private appendJournalEntry;
|
|
280
|
-
private ensureJournalDir;
|
|
281
|
-
private sessionPath;
|
|
135
|
+
declare class AutomationManager extends CronService {
|
|
136
|
+
constructor(options: AutomationManagerOptions);
|
|
282
137
|
}
|
|
283
138
|
//#endregion
|
|
284
139
|
//#region src/managers/llm-provider.manager.d.ts
|
|
@@ -402,229 +257,6 @@ declare class ConfigManager {
|
|
|
402
257
|
private createConfigMutationResult;
|
|
403
258
|
}
|
|
404
259
|
//#endregion
|
|
405
|
-
//#region src/managers/ncp-session.manager.d.ts
|
|
406
|
-
type CreateNcpSessionInput = CreateSessionInput & {
|
|
407
|
-
sessionId?: string;
|
|
408
|
-
};
|
|
409
|
-
type NcpSessionManagerOptions = {
|
|
410
|
-
configManager: ConfigManager;
|
|
411
|
-
eventBus: EventBus;
|
|
412
|
-
journalStore: NcpAgentSessionJournalStore;
|
|
413
|
-
sessionSearch: SessionSearchManager;
|
|
414
|
-
};
|
|
415
|
-
declare class NcpSessionManager implements NcpSessionApi {
|
|
416
|
-
private readonly options;
|
|
417
|
-
private readonly contextWindowPreview;
|
|
418
|
-
private readonly runningSessionIds;
|
|
419
|
-
private readonly unsubscribeSessionRunStatus;
|
|
420
|
-
constructor(options: NcpSessionManagerOptions);
|
|
421
|
-
dispose: () => void;
|
|
422
|
-
createSession: (params: CreateNcpSessionInput) => Promise<CreatedSession>;
|
|
423
|
-
appendSessionEvent: (params: {
|
|
424
|
-
sessionId: string;
|
|
425
|
-
event: NcpAgentSessionJournalReplayEvent;
|
|
426
|
-
}) => Promise<void>;
|
|
427
|
-
setSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
428
|
-
updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
429
|
-
updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
|
|
430
|
-
deleteSession: (sessionId: string) => Promise<void>;
|
|
431
|
-
getSessionRecord: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
432
|
-
listSessions: (options?: ListSessionsOptions) => Promise<NcpSessionSummary[]>;
|
|
433
|
-
listSessionMessages: (sessionId: string, options?: ListMessagesOptions) => Promise<NcpMessage[]>;
|
|
434
|
-
getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
435
|
-
getContextWindow: (sessionId: string, liveRecord?: AgentSessionRecord | null) => Promise<Record<string, unknown> | null>;
|
|
436
|
-
publishSessionChange: (sessionKey: string) => Promise<void>;
|
|
437
|
-
private createSummaryFromRecord;
|
|
438
|
-
private withLiveSessionStatus;
|
|
439
|
-
private handleSessionRunStatus;
|
|
440
|
-
private publishSessionMetadataChanged;
|
|
441
|
-
}
|
|
442
|
-
//#endregion
|
|
443
|
-
//#region src/managers/session-run.manager.d.ts
|
|
444
|
-
declare class SessionRunManager {
|
|
445
|
-
private readonly agentRuntimeManager;
|
|
446
|
-
private readonly ncpSessionManager;
|
|
447
|
-
private readonly eventBus;
|
|
448
|
-
private readonly liveSessions;
|
|
449
|
-
private readonly cleanups;
|
|
450
|
-
private disposed;
|
|
451
|
-
constructor(options: {
|
|
452
|
-
agentRuntimeManager: AgentRuntimeManager;
|
|
453
|
-
eventBus: EventBus;
|
|
454
|
-
ncpSessionManager: NcpSessionManager;
|
|
455
|
-
});
|
|
456
|
-
dispose: () => Promise<void>;
|
|
457
|
-
isRunning: (sessionId: string) => boolean;
|
|
458
|
-
getOrCreateLiveSession: (sessionId: string, initialMetadata?: Record<string, unknown>) => Promise<LiveSession>;
|
|
459
|
-
getActiveSessionRun: (sessionId: string) => LiveSessionExecution | null;
|
|
460
|
-
getLiveSessionRecord: (sessionId: string) => _$_nextclaw_ncp_toolkit0.AgentSessionRecord | null;
|
|
461
|
-
setActiveSessionRun: (sessionId: string, activeRun: LiveSessionExecution) => void;
|
|
462
|
-
deleteActiveSessionRun: (sessionId: string, runId: string) => void;
|
|
463
|
-
updateToolCallResult: UpdateToolCallResult;
|
|
464
|
-
updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
465
|
-
appendSessionEvent: (sessionId: string, event: NcpEndpointEvent, options?: PublishSessionEventOptions) => Promise<void>;
|
|
466
|
-
private readonly ensureLiveSession;
|
|
467
|
-
private readonly requireLiveSession;
|
|
468
|
-
private readonly publishSessionEvent;
|
|
469
|
-
private readonly persistLiveSessionEvent;
|
|
470
|
-
private readonly assertNotDisposed;
|
|
471
|
-
private publishSessionRunStatus;
|
|
472
|
-
}
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/features/context-compaction/managers/context-compaction.manager.d.ts
|
|
475
|
-
declare class ContextWindowPreviewManager {
|
|
476
|
-
private readonly options;
|
|
477
|
-
private readonly preflightService;
|
|
478
|
-
constructor(options: {
|
|
479
|
-
configManager: ConfigManager;
|
|
480
|
-
});
|
|
481
|
-
preview: (params: {
|
|
482
|
-
requestMetadata: Record<string, unknown>;
|
|
483
|
-
sessionId: string;
|
|
484
|
-
sessionMessages: readonly NcpMessage[];
|
|
485
|
-
storedAgentId?: string;
|
|
486
|
-
storedMetadata: Record<string, unknown>;
|
|
487
|
-
}) => ContextWindowSnapshot | null;
|
|
488
|
-
}
|
|
489
|
-
declare class ContextCompactionManager {
|
|
490
|
-
private readonly options;
|
|
491
|
-
private readonly preflightService;
|
|
492
|
-
constructor(options: {
|
|
493
|
-
configManager: ConfigManager;
|
|
494
|
-
providerManager?: LlmProviderRuntime;
|
|
495
|
-
sessionRunManager: SessionRunManager;
|
|
496
|
-
});
|
|
497
|
-
runLivePreflight: (this: ContextCompactionManager, params: {
|
|
498
|
-
input: NcpAgentRunInput;
|
|
499
|
-
session: LiveSession;
|
|
500
|
-
}) => AsyncIterable<NcpEndpointEvent>;
|
|
501
|
-
private applyLivePreflightResult;
|
|
502
|
-
}
|
|
503
|
-
//#endregion
|
|
504
|
-
//#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
|
|
505
|
-
type ContextCompactionPreflightResult = {
|
|
506
|
-
contextWindow: ContextWindowSnapshot;
|
|
507
|
-
metadataPatch: Record<string, unknown>;
|
|
508
|
-
sessionMessages: NcpMessage[];
|
|
509
|
-
timelineMessage: NcpMessage | null;
|
|
510
|
-
};
|
|
511
|
-
type ContextCompactionPreflightBeginResult = ContextCompactionPreflightResult & {
|
|
512
|
-
pendingCompaction: ContextCompactionPendingWork | null;
|
|
513
|
-
};
|
|
514
|
-
type ContextCompactionPendingWork = {
|
|
515
|
-
checkpoint: ReturnType<typeof buildCompressingCompactionCheckpoint>;
|
|
516
|
-
contextTokens: number;
|
|
517
|
-
model: string;
|
|
518
|
-
plan: ContextCompactionPlan;
|
|
519
|
-
reservedContextTokens: number;
|
|
520
|
-
sessionId: string;
|
|
521
|
-
sessionMessages: NcpMessage[];
|
|
522
|
-
};
|
|
523
|
-
declare class ContextCompactionPreflightService {
|
|
524
|
-
private readonly options;
|
|
525
|
-
private readonly compactionService;
|
|
526
|
-
private readonly contextWindowBudgetService;
|
|
527
|
-
constructor(options: {
|
|
528
|
-
configManager: ConfigManager;
|
|
529
|
-
providerManager?: LlmProviderRuntime;
|
|
530
|
-
});
|
|
531
|
-
preview: (params: {
|
|
532
|
-
requestMetadata: Record<string, unknown>;
|
|
533
|
-
sessionId: string;
|
|
534
|
-
sessionMessages: readonly NcpMessage[];
|
|
535
|
-
storedAgentId?: string;
|
|
536
|
-
storedMetadata: Record<string, unknown>;
|
|
537
|
-
}) => ContextWindowSnapshot | null;
|
|
538
|
-
begin: (params: {
|
|
539
|
-
inputMessages: readonly NcpMessage[];
|
|
540
|
-
requestMetadata: Record<string, unknown>;
|
|
541
|
-
sessionId: string;
|
|
542
|
-
sessionMessages: readonly NcpMessage[];
|
|
543
|
-
storedAgentId?: string;
|
|
544
|
-
storedMetadata: Record<string, unknown>;
|
|
545
|
-
}) => ContextCompactionPreflightBeginResult;
|
|
546
|
-
finish: (pending: ContextCompactionPendingWork) => Promise<ContextCompactionPreflightResult>;
|
|
547
|
-
private generateSummary;
|
|
548
|
-
}
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region src/features/context-compaction/utils/context-window-event.utils.d.ts
|
|
551
|
-
declare function readContextWindowEventSessionId(event: NcpEndpointEvent): string | null;
|
|
552
|
-
declare function isContextWindowSnapshot(value: unknown): value is Record<string, unknown>;
|
|
553
|
-
declare function createContextWindowSignature(value: Record<string, unknown>): string;
|
|
554
|
-
declare function shouldRefreshContextWindowDuringStream(event: NcpEndpointEvent): boolean;
|
|
555
|
-
declare function shouldRefreshContextWindowImmediately(event: NcpEndpointEvent): boolean;
|
|
556
|
-
//#endregion
|
|
557
|
-
//#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
|
|
558
|
-
declare function projectNcpMessagesWithContextCompaction(params: {
|
|
559
|
-
sessionId: string;
|
|
560
|
-
sessionMessages: readonly NcpMessage[];
|
|
561
|
-
}): NcpMessage[];
|
|
562
|
-
//#endregion
|
|
563
|
-
//#region src/features/context-compaction/utils/context-compaction-timeline-message.utils.d.ts
|
|
564
|
-
declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
|
|
565
|
-
declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
|
|
566
|
-
type ContextCompactionTimelineCheckpoint = {
|
|
567
|
-
version: 1;
|
|
568
|
-
id: string;
|
|
569
|
-
status: "compressing" | "compressed";
|
|
570
|
-
summary: string;
|
|
571
|
-
coveredMessageCount: number;
|
|
572
|
-
coveredSessionMessageCount: number;
|
|
573
|
-
originalEstimatedTokens: number;
|
|
574
|
-
projectedEstimatedTokens: number;
|
|
575
|
-
createdAt: string;
|
|
576
|
-
updatedAt: string;
|
|
577
|
-
};
|
|
578
|
-
declare function buildContextCompactionTimelineNcpMessage(params: {
|
|
579
|
-
sessionId: string;
|
|
580
|
-
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
581
|
-
}): NcpMessage;
|
|
582
|
-
declare function upsertContextCompactionTimelineMessage(params: {
|
|
583
|
-
session: Session;
|
|
584
|
-
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
585
|
-
insertBeforeMessageIds?: readonly string[];
|
|
586
|
-
}): void;
|
|
587
|
-
declare function isContextCompactionTimelineMessage(message: {
|
|
588
|
-
metadata?: Record<string, unknown> | undefined;
|
|
589
|
-
} | null | undefined): boolean;
|
|
590
|
-
//#endregion
|
|
591
|
-
//#region src/managers/agent-run-request.manager.d.ts
|
|
592
|
-
declare class AgentRunRequestManager {
|
|
593
|
-
private readonly contextCompactionManager;
|
|
594
|
-
private readonly cleanups;
|
|
595
|
-
private readonly ingress;
|
|
596
|
-
private readonly ncpSessionManager;
|
|
597
|
-
private readonly sessionRunManager;
|
|
598
|
-
private disposed;
|
|
599
|
-
private started;
|
|
600
|
-
constructor(options: {
|
|
601
|
-
contextCompactionManager: ContextCompactionManager;
|
|
602
|
-
ingress: Ingress;
|
|
603
|
-
ncpSessionManager: NcpSessionManager;
|
|
604
|
-
sessionRunManager: SessionRunManager;
|
|
605
|
-
});
|
|
606
|
-
start: () => void;
|
|
607
|
-
dispose: () => Promise<void>;
|
|
608
|
-
run: (envelope: NcpRequestEnvelope, options?: NcpAgentRunSendOptions) => AsyncIterable<NcpEndpointEvent>;
|
|
609
|
-
private readonly handleSendRequest;
|
|
610
|
-
private readonly handleAbortRequest;
|
|
611
|
-
private readonly iterateRun;
|
|
612
|
-
private readonly materializeSendEnvelope;
|
|
613
|
-
private readonly toNcpSendEnvelope;
|
|
614
|
-
private readonly materializeRunEnvelope;
|
|
615
|
-
private readonly prepareRunSessionMetadata;
|
|
616
|
-
private readonly handleSessionMessageRequest;
|
|
617
|
-
private readonly assertNotDisposed;
|
|
618
|
-
}
|
|
619
|
-
//#endregion
|
|
620
|
-
//#region src/managers/automation.manager.d.ts
|
|
621
|
-
type AutomationManagerOptions = {
|
|
622
|
-
storePath: string;
|
|
623
|
-
};
|
|
624
|
-
declare class AutomationManager extends CronService {
|
|
625
|
-
constructor(options: AutomationManagerOptions);
|
|
626
|
-
}
|
|
627
|
-
//#endregion
|
|
628
260
|
//#region src/managers/extension.manager.d.ts
|
|
629
261
|
type ExtensionLoadProgress = {
|
|
630
262
|
extensionId: string;
|
|
@@ -708,81 +340,235 @@ type LlmUsageStoreOptions = {
|
|
|
708
340
|
snapshotPath?: string;
|
|
709
341
|
historyPath?: string;
|
|
710
342
|
};
|
|
711
|
-
declare class LlmUsageStore {
|
|
343
|
+
declare class LlmUsageStore {
|
|
344
|
+
private readonly options;
|
|
345
|
+
constructor(options?: LlmUsageStoreOptions);
|
|
346
|
+
get snapshotPath(): string;
|
|
347
|
+
get historyPath(): string;
|
|
348
|
+
readSnapshot: () => LlmUsageRecord | null;
|
|
349
|
+
writeSnapshot: (snapshot: LlmUsageRecord) => void;
|
|
350
|
+
clearSnapshot: () => void;
|
|
351
|
+
listHistory: () => LlmUsageRecord[];
|
|
352
|
+
appendHistory: (record: LlmUsageRecord) => void;
|
|
353
|
+
clearHistory: () => void;
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/managers/llm-usage.manager.d.ts
|
|
357
|
+
type LlmUsageStats = {
|
|
358
|
+
totalRecords: number;
|
|
359
|
+
usageRecordCount: number;
|
|
360
|
+
emptyUsageRecordCount: number;
|
|
361
|
+
promptTokenRecordCount: number;
|
|
362
|
+
oldestObservedAt: string | null;
|
|
363
|
+
latestObservedAt: string | null;
|
|
364
|
+
totalPromptTokens: number;
|
|
365
|
+
totalCompletionTokens: number;
|
|
366
|
+
totalTokens: number;
|
|
367
|
+
totalCachedTokens: number;
|
|
368
|
+
cacheHitRecords: number;
|
|
369
|
+
cacheHitRate: number;
|
|
370
|
+
tokenCacheRate: number;
|
|
371
|
+
sources: Array<{
|
|
372
|
+
value: string;
|
|
373
|
+
count: number;
|
|
374
|
+
}>;
|
|
375
|
+
models: Array<{
|
|
376
|
+
value: string;
|
|
377
|
+
count: number;
|
|
378
|
+
}>;
|
|
379
|
+
};
|
|
380
|
+
type LlmUsageManagerOptions = {
|
|
381
|
+
store?: LlmUsageStore;
|
|
382
|
+
};
|
|
383
|
+
declare class LlmUsageManager {
|
|
384
|
+
private readonly store;
|
|
385
|
+
constructor(options?: LlmUsageManagerOptions);
|
|
386
|
+
get snapshotPath(): string;
|
|
387
|
+
get historyPath(): string;
|
|
388
|
+
observeProviderManager: (providerManager: LlmProviderRuntime, source: string) => LlmProviderRuntime;
|
|
389
|
+
record: (params: {
|
|
390
|
+
observedAt?: string;
|
|
391
|
+
source: string;
|
|
392
|
+
model?: string | null;
|
|
393
|
+
usage: Record<string, number>;
|
|
394
|
+
}) => LlmUsageRecord | null;
|
|
395
|
+
getSnapshot: () => LlmUsageRecord | null;
|
|
396
|
+
getHistory: (limit?: string | number) => LlmUsageRecord[];
|
|
397
|
+
resolveHistoryLimit: (value?: string | number) => number;
|
|
398
|
+
getStats: () => LlmUsageStats;
|
|
399
|
+
private readonly bumpCounter;
|
|
400
|
+
private readonly toSortedCounts;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/managers/mcp.manager.d.ts
|
|
404
|
+
declare class McpManager {
|
|
405
|
+
private currentMcpConfig;
|
|
406
|
+
private readonly mcpLifecycleManager;
|
|
407
|
+
private readonly mcpRegistryService;
|
|
408
|
+
private readonly toolRegistryAdapter;
|
|
409
|
+
private warmupPromise;
|
|
410
|
+
constructor(getConfig: () => Config);
|
|
411
|
+
listToolsForRun: (params: {
|
|
412
|
+
agentId: string;
|
|
413
|
+
}) => ReadonlyArray<NcpTool>;
|
|
414
|
+
start: () => void;
|
|
415
|
+
applyConfig: (config: Config) => Promise<void>;
|
|
416
|
+
dispose: () => Promise<void>;
|
|
417
|
+
private prewarmEnabledServersSafely;
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/utils/ncp-agent-session-journal.utils.d.ts
|
|
421
|
+
declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
422
|
+
declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
|
|
423
|
+
declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
|
|
424
|
+
declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
|
|
425
|
+
type NcpAgentSessionSnapshotMessageEvent = {
|
|
426
|
+
type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
|
|
427
|
+
payload: Extract<NcpEndpointEvent, {
|
|
428
|
+
type: NcpEventType.MessageSent;
|
|
429
|
+
}>["payload"];
|
|
430
|
+
};
|
|
431
|
+
type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
|
|
432
|
+
type NcpSessionRequestJournalEvent = {
|
|
433
|
+
type: NcpSessionRequestJournalEventType;
|
|
434
|
+
payload: {
|
|
435
|
+
sessionId: string;
|
|
436
|
+
request: unknown;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
type NcpAgentSessionJournalReplayEvent = NcpEndpointEvent | NcpAgentSessionSnapshotMessageEvent | NcpSessionRequestJournalEvent;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/stores/ncp-agent-session-journal.store.d.ts
|
|
442
|
+
declare class NcpAgentSessionJournalStore {
|
|
443
|
+
private readonly journalDir;
|
|
444
|
+
private readonly sessions;
|
|
445
|
+
private readonly nextSeqBySession;
|
|
446
|
+
private readonly writeChains;
|
|
447
|
+
private readonly metadataStore;
|
|
448
|
+
private readonly summaryIndexStore;
|
|
449
|
+
constructor(journalDir: string);
|
|
450
|
+
appendSessionEvent: (params: {
|
|
451
|
+
sessionId: string;
|
|
452
|
+
event: NcpAgentSessionJournalReplayEvent;
|
|
453
|
+
}) => Promise<void>;
|
|
454
|
+
getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
455
|
+
listSessionSummaries: () => Promise<NcpSessionSummary[]>;
|
|
456
|
+
listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
|
|
457
|
+
setSessionMetadata: (params: {
|
|
458
|
+
sessionId: string;
|
|
459
|
+
metadata: Record<string, unknown>;
|
|
460
|
+
}) => Promise<boolean>;
|
|
461
|
+
updateSessionMetadata: (params: {
|
|
462
|
+
sessionId: string;
|
|
463
|
+
metadata: Record<string, unknown>;
|
|
464
|
+
}) => Promise<boolean>;
|
|
465
|
+
private setSessionMetadataNow;
|
|
466
|
+
private updateSessionMetadataNow;
|
|
467
|
+
importSessionSnapshot: (record: AgentSessionRecord) => Promise<void>;
|
|
468
|
+
deleteSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
469
|
+
hasSession: (sessionId: string) => Promise<boolean>;
|
|
470
|
+
private appendSessionEventNow;
|
|
471
|
+
private withMetadata;
|
|
472
|
+
private loadSession;
|
|
473
|
+
private parseSessionJournal;
|
|
474
|
+
private appendJournalEntry;
|
|
475
|
+
private ensureJournalDir;
|
|
476
|
+
private sessionPath;
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/managers/ncp-session.manager.d.ts
|
|
480
|
+
type CreateNcpSessionInput = CreateSessionInput & {
|
|
481
|
+
sessionId?: string;
|
|
482
|
+
};
|
|
483
|
+
type NcpSessionManagerOptions = {
|
|
484
|
+
configManager: ConfigManager;
|
|
485
|
+
eventBus: EventBus;
|
|
486
|
+
journalStore: NcpAgentSessionJournalStore;
|
|
487
|
+
sessionSearch: SessionSearchManager;
|
|
488
|
+
};
|
|
489
|
+
declare class NcpSessionManager implements NcpSessionApi {
|
|
712
490
|
private readonly options;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
491
|
+
private readonly contextWindowPreview;
|
|
492
|
+
constructor(options: NcpSessionManagerOptions);
|
|
493
|
+
dispose: () => void;
|
|
494
|
+
createSession: (params: CreateNcpSessionInput) => Promise<CreatedSession>;
|
|
495
|
+
appendSessionEvent: (params: {
|
|
496
|
+
sessionId: string;
|
|
497
|
+
event: NcpAgentSessionJournalReplayEvent;
|
|
498
|
+
}) => Promise<void>;
|
|
499
|
+
setSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
500
|
+
updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
501
|
+
updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
|
|
502
|
+
deleteSession: (sessionId: string) => Promise<void>;
|
|
503
|
+
getSessionRecord: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
504
|
+
listSessions: (options?: ListSessionsOptions) => Promise<NcpSessionSummary[]>;
|
|
505
|
+
listSessionMessages: (sessionId: string, options?: ListMessagesOptions) => Promise<NcpMessage[]>;
|
|
506
|
+
getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
507
|
+
getContextWindow: (sessionId: string, liveRecord?: AgentSessionRecord | null) => Promise<Record<string, unknown> | null>;
|
|
508
|
+
publishSessionChange: (sessionKey: string) => Promise<void>;
|
|
509
|
+
private createSummaryFromRecord;
|
|
510
|
+
private publishSessionMetadataChanged;
|
|
722
511
|
}
|
|
723
512
|
//#endregion
|
|
724
|
-
//#region src/
|
|
725
|
-
type
|
|
726
|
-
|
|
727
|
-
usageRecordCount: number;
|
|
728
|
-
emptyUsageRecordCount: number;
|
|
729
|
-
promptTokenRecordCount: number;
|
|
730
|
-
oldestObservedAt: string | null;
|
|
731
|
-
latestObservedAt: string | null;
|
|
732
|
-
totalPromptTokens: number;
|
|
733
|
-
totalCompletionTokens: number;
|
|
734
|
-
totalTokens: number;
|
|
735
|
-
totalCachedTokens: number;
|
|
736
|
-
cacheHitRecords: number;
|
|
737
|
-
cacheHitRate: number;
|
|
738
|
-
tokenCacheRate: number;
|
|
739
|
-
sources: Array<{
|
|
740
|
-
value: string;
|
|
741
|
-
count: number;
|
|
742
|
-
}>;
|
|
743
|
-
models: Array<{
|
|
744
|
-
value: string;
|
|
745
|
-
count: number;
|
|
746
|
-
}>;
|
|
513
|
+
//#region src/stores/panel-app-state.store.d.ts
|
|
514
|
+
type PanelAppPreferencesUpdate = {
|
|
515
|
+
favorite?: boolean;
|
|
747
516
|
};
|
|
748
|
-
|
|
749
|
-
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/managers/panel-app.manager.d.ts
|
|
519
|
+
declare const PANEL_APP_CONTENT_TYPE: "text/html; charset=utf-8";
|
|
520
|
+
type PanelAppEntry = {
|
|
521
|
+
id: string;
|
|
522
|
+
fileName: string;
|
|
523
|
+
title: string;
|
|
524
|
+
description?: string;
|
|
525
|
+
icon?: string;
|
|
526
|
+
contentPath: string;
|
|
527
|
+
updatedAt: string;
|
|
528
|
+
sizeBytes: number;
|
|
529
|
+
favorite: boolean;
|
|
530
|
+
lastOpenedAt?: string;
|
|
531
|
+
openCount: number;
|
|
750
532
|
};
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
getStats: () => LlmUsageStats;
|
|
767
|
-
private readonly bumpCounter;
|
|
768
|
-
private readonly toSortedCounts;
|
|
533
|
+
type PanelAppList = {
|
|
534
|
+
workspacePath: string;
|
|
535
|
+
panelsPath: string;
|
|
536
|
+
entries: PanelAppEntry[];
|
|
537
|
+
};
|
|
538
|
+
type PanelAppContent = {
|
|
539
|
+
id: string;
|
|
540
|
+
fileName: string;
|
|
541
|
+
html: string;
|
|
542
|
+
contentType: typeof PANEL_APP_CONTENT_TYPE;
|
|
543
|
+
};
|
|
544
|
+
type PanelAppErrorCode = "PANEL_APP_INVALID_ID" | "PANEL_APP_NOT_FOUND" | "PANEL_APP_READ_FAILED";
|
|
545
|
+
declare class PanelAppError extends Error {
|
|
546
|
+
readonly code: PanelAppErrorCode;
|
|
547
|
+
constructor(code: PanelAppErrorCode, message: string);
|
|
769
548
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
private
|
|
549
|
+
declare function isPanelAppError(error: unknown): error is PanelAppError;
|
|
550
|
+
declare class PanelAppManager {
|
|
551
|
+
private readonly params;
|
|
552
|
+
constructor(params: {
|
|
553
|
+
configManager: ConfigManager;
|
|
554
|
+
});
|
|
555
|
+
listPanelApps: () => Promise<PanelAppList>;
|
|
556
|
+
getPanelAppContent: (id: string) => Promise<PanelAppContent>;
|
|
557
|
+
updatePanelAppPreferences: (id: string, preferences: PanelAppPreferencesUpdate) => Promise<PanelAppEntry>;
|
|
558
|
+
recordPanelAppOpened: (id: string) => Promise<PanelAppEntry>;
|
|
559
|
+
private getWorkspacePath;
|
|
560
|
+
private getPanelsPath;
|
|
561
|
+
private createStateStore;
|
|
562
|
+
private listPanelAppFileNames;
|
|
563
|
+
private buildPanelAppEntry;
|
|
564
|
+
private resolvePanelAppFileName;
|
|
565
|
+
private encodePanelAppId;
|
|
566
|
+
private decodePanelAppId;
|
|
567
|
+
private isPanelAppFileName;
|
|
568
|
+
private toPanelAppTitle;
|
|
569
|
+
private comparePanelApps;
|
|
570
|
+
private compareIsoDesc;
|
|
571
|
+
private isMissingFileError;
|
|
786
572
|
}
|
|
787
573
|
//#endregion
|
|
788
574
|
//#region src/utils/skill-frontmatter.utils.d.ts
|
|
@@ -922,7 +708,6 @@ declare class NextclawKernel {
|
|
|
922
708
|
readonly agents: AgentManager;
|
|
923
709
|
readonly sessions: SessionManager;
|
|
924
710
|
readonly control: NextclawKernelControlManager<unknown, unknown, unknown>;
|
|
925
|
-
readonly toolManager: ToolManager;
|
|
926
711
|
readonly skills: SkillManager;
|
|
927
712
|
readonly automation: AutomationManager;
|
|
928
713
|
readonly channels: ChannelManager$1;
|
|
@@ -931,11 +716,10 @@ declare class NextclawKernel {
|
|
|
931
716
|
readonly assetStore: LocalAssetStore;
|
|
932
717
|
readonly mcpManager: McpManager;
|
|
933
718
|
readonly ncpSessionManager: NcpSessionManager;
|
|
719
|
+
readonly panelAppManager: PanelAppManager;
|
|
934
720
|
readonly extensions: ExtensionManager;
|
|
935
|
-
readonly agentRunRequestManager: AgentRunRequestManager;
|
|
936
|
-
readonly sessionRunManager: SessionRunManager;
|
|
937
|
-
readonly agentRuntimeManager: AgentRuntimeManager;
|
|
938
721
|
private readonly ncpAgentSessionJournalStore;
|
|
722
|
+
private readonly kernelBranch;
|
|
939
723
|
private readonly agentRunContribution;
|
|
940
724
|
private readonly contributions;
|
|
941
725
|
private gatewayController;
|
|
@@ -944,6 +728,7 @@ declare class NextclawKernel {
|
|
|
944
728
|
defaultType: string;
|
|
945
729
|
options: AgentRuntimeSessionTypeOption[];
|
|
946
730
|
}>;
|
|
731
|
+
isSessionRunning: (sessionId: string) => boolean;
|
|
947
732
|
provideGatewayController: (gatewayController: GatewayController) => void;
|
|
948
733
|
getGatewayController: () => GatewayController | undefined;
|
|
949
734
|
start: () => Promise<void>;
|
|
@@ -972,25 +757,22 @@ declare class BuiltinNarpRuntimeProviderService {
|
|
|
972
757
|
private createStdioRuntime;
|
|
973
758
|
}
|
|
974
759
|
//#endregion
|
|
975
|
-
//#region src/features/
|
|
976
|
-
type
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
};
|
|
987
|
-
type BuildAgentRunSendPayloadParams = {
|
|
760
|
+
//#region src/features/agent-run/managers/tool-provider.manager.d.ts
|
|
761
|
+
type ToolRunContext = {
|
|
762
|
+
agentId: string;
|
|
763
|
+
channel: string;
|
|
764
|
+
chatId: string;
|
|
765
|
+
config: Config;
|
|
766
|
+
execTimeoutSeconds: number;
|
|
767
|
+
handoffDepth: number;
|
|
768
|
+
metadata: Record<string, unknown>;
|
|
769
|
+
restrictToWorkspace: boolean;
|
|
770
|
+
searchConfig: SearchConfig;
|
|
988
771
|
sessionId: string;
|
|
989
|
-
|
|
990
|
-
attachments?: InboundAttachment[];
|
|
991
|
-
metadata?: Record<string, unknown>;
|
|
992
|
-
assetApi?: AssetApi;
|
|
772
|
+
workspace: string;
|
|
993
773
|
};
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/features/agent-run/services/agent-run-client.service.d.ts
|
|
994
776
|
type AgentRunReplyOptions = {
|
|
995
777
|
abortSignal?: AbortSignal;
|
|
996
778
|
onAssistantDelta?: (delta: string) => void;
|
|
@@ -1007,12 +789,6 @@ type AgentRunReply = {
|
|
|
1007
789
|
text: string;
|
|
1008
790
|
completedMessage: NcpMessage;
|
|
1009
791
|
};
|
|
1010
|
-
declare function buildUserMessageParts(params: {
|
|
1011
|
-
content: string;
|
|
1012
|
-
attachments?: InboundAttachment[];
|
|
1013
|
-
assetApi?: AssetApi;
|
|
1014
|
-
}): Promise<NcpMessagePart[]>;
|
|
1015
|
-
declare function buildAgentRunSendPayload(params: BuildAgentRunSendPayloadParams): Promise<AgentRunSendIngressPayload>;
|
|
1016
792
|
declare class AgentRunClient {
|
|
1017
793
|
private readonly options;
|
|
1018
794
|
constructor(options: {
|
|
@@ -1026,6 +802,27 @@ declare class AgentRunClient {
|
|
|
1026
802
|
private sendWithCorrelation;
|
|
1027
803
|
}
|
|
1028
804
|
//#endregion
|
|
805
|
+
//#region src/features/agent-run/utils/agent-run-send-payload.utils.d.ts
|
|
806
|
+
type AssetApi = {
|
|
807
|
+
putBytes: (input: {
|
|
808
|
+
fileName: string;
|
|
809
|
+
mimeType?: string | null;
|
|
810
|
+
bytes: Uint8Array;
|
|
811
|
+
createdAt?: Date;
|
|
812
|
+
}) => Promise<{
|
|
813
|
+
uri: string;
|
|
814
|
+
}>;
|
|
815
|
+
resolveContentPath?: (uri: string) => string | null;
|
|
816
|
+
};
|
|
817
|
+
type BuildAgentRunSendPayloadParams = {
|
|
818
|
+
sessionId: string;
|
|
819
|
+
content: string;
|
|
820
|
+
attachments?: InboundAttachment[];
|
|
821
|
+
metadata?: Record<string, unknown>;
|
|
822
|
+
assetApi?: AssetApi;
|
|
823
|
+
};
|
|
824
|
+
declare function buildAgentRunSendPayload(params: BuildAgentRunSendPayloadParams): Promise<AgentRunSendIngressPayload>;
|
|
825
|
+
//#endregion
|
|
1029
826
|
//#region src/features/ncp-dispatch/services/gateway-inbound-processor.service.d.ts
|
|
1030
827
|
type GatewayInboundLoopRuntime = {
|
|
1031
828
|
kernel: {
|
|
@@ -1047,7 +844,7 @@ declare class GatewayInboundProcessor {
|
|
|
1047
844
|
private resolveRoute;
|
|
1048
845
|
private dispatchSlashCommandMaybe;
|
|
1049
846
|
private dispatchChannelReplyRouteMaybe;
|
|
1050
|
-
private
|
|
847
|
+
private publishChannelReply;
|
|
1051
848
|
}
|
|
1052
849
|
declare function runGatewayInboundLoop(runtime: GatewayInboundLoopRuntime): Promise<void>;
|
|
1053
850
|
//#endregion
|
|
@@ -1097,41 +894,109 @@ type DirectPromptDispatchParams = {
|
|
|
1097
894
|
};
|
|
1098
895
|
declare function dispatchPromptOverNcp(params: DirectPromptDispatchParams): Promise<string>;
|
|
1099
896
|
//#endregion
|
|
1100
|
-
//#region src/features/
|
|
1101
|
-
|
|
1102
|
-
type NativeAgentRuntimeFactoryOptions = {
|
|
1103
|
-
providerManager: LlmProviderRuntime;
|
|
1104
|
-
configManager: ConfigManager;
|
|
1105
|
-
llmUsage: LlmUsageManager;
|
|
1106
|
-
assetStore: LocalAssetStore;
|
|
1107
|
-
updateToolCallResult: UpdateToolCallResult;
|
|
1108
|
-
toolManager: ToolManager;
|
|
1109
|
-
};
|
|
1110
|
-
declare class NativeAgentRuntimeFactory {
|
|
897
|
+
//#region src/features/context-compaction/managers/context-compaction.manager.d.ts
|
|
898
|
+
declare class ContextWindowPreviewManager {
|
|
1111
899
|
private readonly options;
|
|
1112
|
-
private readonly
|
|
1113
|
-
constructor(options:
|
|
1114
|
-
|
|
1115
|
-
|
|
900
|
+
private readonly preflightService;
|
|
901
|
+
constructor(options: {
|
|
902
|
+
configManager: ConfigManager;
|
|
903
|
+
});
|
|
904
|
+
preview: (params: {
|
|
905
|
+
requestMetadata: Record<string, unknown>;
|
|
906
|
+
sessionId: string;
|
|
907
|
+
sessionMessages: readonly NcpMessage[];
|
|
908
|
+
storedAgentId?: string;
|
|
909
|
+
storedMetadata: Record<string, unknown>;
|
|
910
|
+
}) => ContextWindowSnapshot | null;
|
|
1116
911
|
}
|
|
1117
912
|
//#endregion
|
|
1118
|
-
//#region src/features/
|
|
1119
|
-
type
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
913
|
+
//#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
|
|
914
|
+
type ContextCompactionPreflightResult = {
|
|
915
|
+
contextWindow: ContextWindowSnapshot;
|
|
916
|
+
metadataPatch: Record<string, unknown>;
|
|
917
|
+
sessionMessages: NcpMessage[];
|
|
918
|
+
timelineMessage: NcpMessage | null;
|
|
919
|
+
};
|
|
920
|
+
type ContextCompactionPreflightBeginResult = ContextCompactionPreflightResult & {
|
|
921
|
+
pendingCompaction: ContextCompactionPendingWork | null;
|
|
922
|
+
};
|
|
923
|
+
type ContextCompactionPendingWork = {
|
|
924
|
+
checkpoint: ReturnType<typeof buildCompressingCompactionCheckpoint>;
|
|
925
|
+
contextTokens: number;
|
|
926
|
+
model: string;
|
|
927
|
+
plan: ContextCompactionPlan;
|
|
928
|
+
reservedContextTokens: number;
|
|
929
|
+
sessionId: string;
|
|
930
|
+
sessionMessages: NcpMessage[];
|
|
1124
931
|
};
|
|
1125
|
-
declare class
|
|
932
|
+
declare class ContextCompactionPreflightService {
|
|
1126
933
|
private readonly options;
|
|
1127
|
-
private readonly
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
934
|
+
private readonly compactionService;
|
|
935
|
+
private readonly contextWindowBudgetService;
|
|
936
|
+
constructor(options: {
|
|
937
|
+
configManager: ConfigManager;
|
|
938
|
+
providerManager?: LlmProviderRuntime;
|
|
939
|
+
});
|
|
940
|
+
preview: (params: {
|
|
941
|
+
requestMetadata: Record<string, unknown>;
|
|
942
|
+
sessionId: string;
|
|
943
|
+
sessionMessages: readonly NcpMessage[];
|
|
944
|
+
storedAgentId?: string;
|
|
945
|
+
storedMetadata: Record<string, unknown>;
|
|
946
|
+
}) => ContextWindowSnapshot | null;
|
|
947
|
+
begin: (params: {
|
|
948
|
+
inputMessages: readonly NcpMessage[];
|
|
949
|
+
requestMetadata: Record<string, unknown>;
|
|
950
|
+
sessionId: string;
|
|
951
|
+
sessionMessages: readonly NcpMessage[];
|
|
952
|
+
storedAgentId?: string;
|
|
953
|
+
storedMetadata: Record<string, unknown>;
|
|
954
|
+
}) => ContextCompactionPreflightBeginResult;
|
|
955
|
+
finish: (pending: ContextCompactionPendingWork) => Promise<ContextCompactionPreflightResult>;
|
|
956
|
+
private generateSummary;
|
|
1133
957
|
}
|
|
1134
958
|
//#endregion
|
|
959
|
+
//#region src/features/context-compaction/utils/context-window-event.utils.d.ts
|
|
960
|
+
declare function readContextWindowEventSessionId(event: NcpEndpointEvent): string | null;
|
|
961
|
+
declare function isContextWindowSnapshot(value: unknown): value is Record<string, unknown>;
|
|
962
|
+
declare function createContextWindowSignature(value: Record<string, unknown>): string;
|
|
963
|
+
declare function shouldRefreshContextWindowDuringStream(event: NcpEndpointEvent): boolean;
|
|
964
|
+
declare function shouldRefreshContextWindowImmediately(event: NcpEndpointEvent): boolean;
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/features/context-compaction/utils/context-compaction-projection.utils.d.ts
|
|
967
|
+
declare function projectNcpMessagesWithContextCompaction(params: {
|
|
968
|
+
sessionId: string;
|
|
969
|
+
sessionMessages: readonly NcpMessage[];
|
|
970
|
+
}): NcpMessage[];
|
|
971
|
+
//#endregion
|
|
972
|
+
//#region src/features/context-compaction/utils/context-compaction-timeline-message.utils.d.ts
|
|
973
|
+
declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
|
|
974
|
+
declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
|
|
975
|
+
type ContextCompactionTimelineCheckpoint = {
|
|
976
|
+
version: 1;
|
|
977
|
+
id: string;
|
|
978
|
+
status: "compressing" | "compressed";
|
|
979
|
+
summary: string;
|
|
980
|
+
coveredMessageCount: number;
|
|
981
|
+
coveredSessionMessageCount: number;
|
|
982
|
+
originalEstimatedTokens: number;
|
|
983
|
+
projectedEstimatedTokens: number;
|
|
984
|
+
createdAt: string;
|
|
985
|
+
updatedAt: string;
|
|
986
|
+
};
|
|
987
|
+
declare function buildContextCompactionTimelineNcpMessage(params: {
|
|
988
|
+
sessionId: string;
|
|
989
|
+
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
990
|
+
}): NcpMessage;
|
|
991
|
+
declare function upsertContextCompactionTimelineMessage(params: {
|
|
992
|
+
session: Session;
|
|
993
|
+
checkpoint: ContextCompactionTimelineCheckpoint;
|
|
994
|
+
insertBeforeMessageIds?: readonly string[];
|
|
995
|
+
}): void;
|
|
996
|
+
declare function isContextCompactionTimelineMessage(message: {
|
|
997
|
+
metadata?: Record<string, unknown> | undefined;
|
|
998
|
+
} | null | undefined): boolean;
|
|
999
|
+
//#endregion
|
|
1135
1000
|
//#region src/features/native-runtime/services/provider-manager-ncp-llm-api.service.d.ts
|
|
1136
1001
|
declare class ProviderManagerNcpLLMApi implements NcpLLMApi {
|
|
1137
1002
|
private readonly providerManager;
|
|
@@ -1236,5 +1101,5 @@ type SkillRecord = {
|
|
|
1236
1101
|
metadata: Record<string, unknown>;
|
|
1237
1102
|
};
|
|
1238
1103
|
//#endregion
|
|
1239
|
-
export { AgentId, AgentManager, AgentRecord, AgentRunClient, AgentRunReply, AgentRunReplyOptions,
|
|
1104
|
+
export { AgentId, AgentManager, AgentRecord, AgentRunClient, type AgentRunReply, type AgentRunReplyOptions, type AgentRunStreamOptions, AgentRuntimeEntry, AgentRuntimeProviderRegistration, AgentRuntimeRegistry, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, type AssetApi, AutomationId, AutomationManager, AutomationManagerOptions, type BuildAgentRunSendPayloadParams, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelId, ChannelManager, ChannelReplyRouterDispatchParams, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextCompactionTimelineCheckpoint, ContextWindowPreviewManager, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DirectPromptDispatchParams, ExtensionLoadProgress, ExtensionLoadResult, ExtensionManager, GatewayInboundLoopRuntime, GatewayInboundProcessor, InstallationKind, InstalledSkillDetail, InstalledSkillSummary, InstalledSkillsList, type LearningLoopRuntimeConfig, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStats, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, LocalizedTextMap, McpManager, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NcpAgentSessionJournalStore, NcpSessionManager, NcpSessionManagerOptions, NextclawKernel, NextclawKernelOptions, NextclawNcpResolvedAgentProfile, NextclawNcpResolvedRunContext, NextclawNcpRunContextParams, PanelAppContent, PanelAppEntry, PanelAppError, PanelAppErrorCode, PanelAppList, PanelAppManager, type PanelAppPreferencesUpdate, ProviderManagerNcpLLMApi, SessionId, SessionRequestManager, SessionRequestManagerOptions, SkillFrontmatter, SkillId, type SkillInfo, SkillManager, SkillRecord, type SkillScope, TaskId, ToolId, ToolRecord, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, buildAgentRunSendPayload, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildSessionOrchestrationSection, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createContextWindowSignature, createLlmUsageRecord, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getUnsignedUpdateManifest, hasLlmUsageTelemetry, isContextCompactionTimelineMessage, isContextWindowSnapshot, isPanelAppError, isReplyCapableChannel, listExtensionChannelIds, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, normalizeOptionalString, parseSkillFrontmatter, projectNcpMessagesWithContextCompaction, readContextWindowEventSessionId, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, resolveAgentRuntimeEntries, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolveNextclawNcpRunContext, resolveSessionChannelContext, runGatewayInboundLoop, sanitizeLlmUsage, serializeUnsignedUpdateManifest, shouldRefreshContextWindowDuringStream, shouldRefreshContextWindowImmediately, stripSkillFrontmatter, syncSessionThinkingPreference, toNcpMessages, upsertContextCompactionTimelineMessage, waitForAgentRuntimeSessionReply };
|
|
1240
1105
|
//# sourceMappingURL=index.d.ts.map
|