@nextclaw/kernel 0.6.21 → 0.6.22
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 +229 -94
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1867 -707
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AUTOMATIC_UPDATE_CHECK_INTERVAL_MS, getAutomaticUpdateCheckDelay, resolveAutomaticUpdateCheckIntervalMs } from "./utils/automatic-update-check.utils.js";
|
|
2
2
|
import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateStatus, i as UpdateManifestReader, l as UpdateProgress, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateSnapshot } from "./update-manifest.types-CQpbURTE.js";
|
|
3
|
-
import { BaseChannel, Config, ContextCompactionCheckpoint, ContextCompactionPlan, ContextWindowSnapshot, CreateAgentProfileInput, CreateSessionContextInheritanceInput, CreateSessionInput, CreatedSession, CronService, EffectiveAgentProfile, ExtensionChannelBinding, ExtensionDiagnostic, ExtensionRegistry, ExtensionUiMetadata, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, ModelThinkingCapability, OutboundMessage, RequestSessionParams, RequestedSkillsMetadataReader, SearchConfig, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchService, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, UpdateAgentProfileInput, buildCompressingCompactionCheckpoint, resolveThinkingLevel } from "@nextclaw/core";
|
|
3
|
+
import { BaseChannel, Config, ContextCompactionCheckpoint, ContextCompactionPhase, ContextCompactionPlan, ContextWindowSnapshot, CreateAgentProfileInput, CreateSessionContextInheritanceInput, CreateSessionInput, CreatedSession, CronService, EffectiveAgentProfile, ExtensionChannelBinding, ExtensionDiagnostic, ExtensionRegistry, ExtensionUiMetadata, GatewayController, InboundAttachment, InboundMessage, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, ModelThinkingCapability, OutboundMessage, ProviderModelDiscoveryResult, RequestSessionParams, RequestedSkillsMetadataReader, SearchConfig, SessionMessage, SessionRequestDispatcher, SessionRequestRecord, SessionRequestToolResult, SessionSearchService, SkillInfo, SkillInfo as SkillInfo$1, SkillScope, SpawnSessionAndRequestParams, ThinkingLevel, UpdateAgentProfileInput, buildCompressingCompactionCheckpoint, resolveThinkingLevel } from "@nextclaw/core";
|
|
4
4
|
import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpAgentRuntime, NcpEndpointEvent, NcpEventType, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessagePart, NcpRunHandle, NcpSessionApi, NcpSessionMessagePageInfo, NcpSessionPatch, NcpSessionSummary, NcpTool, OpenAIChatChunk } from "@nextclaw/ncp";
|
|
5
|
-
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
6
5
|
import { AgentRunSendIngressPayload, EventBus, InboxDelivery, InboxDeliveryContentType, InboxDeliveryContinueResult, InboxDeliveryListView, InboxDeliverySource, InboxDeliveryStateAction, Ingress, RuntimeModelSelectionMode, Unsubscribe } from "@nextclaw/shared";
|
|
6
|
+
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
7
7
|
import { AgentSessionRecord, ChatTarget, NcpReplyInput, RuntimeFactoryParams } from "@nextclaw/ncp-toolkit";
|
|
8
8
|
|
|
9
9
|
//#region src/features/runtime-registry/utils/agent-runtime-registry.utils.d.ts
|
|
@@ -156,8 +156,16 @@ type ProviderConnectionTestInput = {
|
|
|
156
156
|
maxTokens?: number;
|
|
157
157
|
signal?: AbortSignal;
|
|
158
158
|
};
|
|
159
|
+
type ProviderModelsDiscoverInput = {
|
|
160
|
+
providerName: string | null;
|
|
161
|
+
apiKey?: string | null;
|
|
162
|
+
apiBase?: string | null;
|
|
163
|
+
extraHeaders?: Record<string, string> | null;
|
|
164
|
+
signal?: AbortSignal;
|
|
165
|
+
};
|
|
159
166
|
declare class LlmProviderManager {
|
|
160
167
|
private readonly providerRegistry;
|
|
168
|
+
private readonly providerModelDiscovery;
|
|
161
169
|
private readonly providerPool;
|
|
162
170
|
private readonly missingProvider;
|
|
163
171
|
private config;
|
|
@@ -167,6 +175,8 @@ declare class LlmProviderManager {
|
|
|
167
175
|
readonly chat: (params: ProviderChatParams) => Promise<LLMResponse>;
|
|
168
176
|
readonly chatStream: (this: LlmProviderManager, params: ProviderChatParams) => AsyncGenerator<LLMStreamEvent>;
|
|
169
177
|
readonly testConnection: (input: ProviderConnectionTestInput) => Promise<void>;
|
|
178
|
+
supportsModelDiscovery: (providerName: string | null) => boolean;
|
|
179
|
+
discoverModels: (input: ProviderModelsDiscoverInput) => Promise<ProviderModelDiscoveryResult>;
|
|
170
180
|
private resolveRoute;
|
|
171
181
|
private resolveProvider;
|
|
172
182
|
private matchPrefixedProvider;
|
|
@@ -180,6 +190,53 @@ declare class LlmProviderManager {
|
|
|
180
190
|
private buildCacheKey;
|
|
181
191
|
}
|
|
182
192
|
//#endregion
|
|
193
|
+
//#region src/managers/provider-model-catalog.manager.d.ts
|
|
194
|
+
declare const PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS: number;
|
|
195
|
+
type ProviderModelCatalogEntry = {
|
|
196
|
+
providerId: string;
|
|
197
|
+
models: string[];
|
|
198
|
+
source: "provider" | "catalog" | null;
|
|
199
|
+
fetchedAt: string | null;
|
|
200
|
+
lastError: {
|
|
201
|
+
message: string;
|
|
202
|
+
occurredAt: string;
|
|
203
|
+
} | null;
|
|
204
|
+
};
|
|
205
|
+
type ProviderModelCatalogSnapshot = {
|
|
206
|
+
refreshIntervalMs: number;
|
|
207
|
+
refreshing: boolean;
|
|
208
|
+
lastRefreshStartedAt: string | null;
|
|
209
|
+
lastRefreshCompletedAt: string | null;
|
|
210
|
+
providers: Record<string, ProviderModelCatalogEntry>;
|
|
211
|
+
};
|
|
212
|
+
type ProviderModelCatalogManagerOptions = {
|
|
213
|
+
refreshIntervalMs?: number;
|
|
214
|
+
providerTimeoutMs?: number;
|
|
215
|
+
now?: () => Date;
|
|
216
|
+
};
|
|
217
|
+
declare class ProviderModelCatalogManager {
|
|
218
|
+
private readonly providerManager;
|
|
219
|
+
private config;
|
|
220
|
+
private readonly entries;
|
|
221
|
+
private readonly providerTimeoutMs;
|
|
222
|
+
private readonly refreshIntervalMs;
|
|
223
|
+
private readonly now;
|
|
224
|
+
private refreshTask;
|
|
225
|
+
private refreshPending;
|
|
226
|
+
private refreshTimer;
|
|
227
|
+
private started;
|
|
228
|
+
private lastRefreshStartedAt;
|
|
229
|
+
private lastRefreshCompletedAt;
|
|
230
|
+
constructor(providerManager: Pick<LlmProviderManager, "discoverModels" | "supportsModelDiscovery">, options?: ProviderModelCatalogManagerOptions);
|
|
231
|
+
load: (config: Config) => void;
|
|
232
|
+
start: () => void;
|
|
233
|
+
dispose: () => void;
|
|
234
|
+
refresh: () => Promise<void>;
|
|
235
|
+
getSnapshot: () => ProviderModelCatalogSnapshot;
|
|
236
|
+
private refreshConfiguredProviders;
|
|
237
|
+
private refreshProvider;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
183
240
|
//#region src/managers/config.manager.d.ts
|
|
184
241
|
type ConfigManagerRuntimeHooks = {
|
|
185
242
|
resolveChannelConfig?: (config: Config) => Config;
|
|
@@ -199,6 +256,7 @@ type ConfigManagerOptions = {
|
|
|
199
256
|
configPath?: string;
|
|
200
257
|
channels: ChannelManager;
|
|
201
258
|
providerManager: LlmProviderManager;
|
|
259
|
+
providerModelCatalogManager?: Pick<ProviderModelCatalogManager, "load">;
|
|
202
260
|
};
|
|
203
261
|
type ConfigMutationResult = Record<string, unknown> & {
|
|
204
262
|
ok: boolean;
|
|
@@ -275,6 +333,10 @@ declare class AgentManager {
|
|
|
275
333
|
getAgent: (agentId: string) => EffectiveAgentProfile | null;
|
|
276
334
|
getDefaultAgentId: () => string;
|
|
277
335
|
resolveAgentProfile: (agentId?: string | null) => ResolvedAgentProfile;
|
|
336
|
+
resolveAgentProfileForContextWindow: (params: {
|
|
337
|
+
agentId: string;
|
|
338
|
+
contextTokens: number;
|
|
339
|
+
}) => ResolvedAgentProfile;
|
|
278
340
|
resolveAgentProfileForRun: (params?: {
|
|
279
341
|
agentId?: string | null;
|
|
280
342
|
requestMetadata?: Record<string, unknown>;
|
|
@@ -288,27 +350,6 @@ declare class AgentManager {
|
|
|
288
350
|
private resolveAgentProfileFromConfig;
|
|
289
351
|
}
|
|
290
352
|
//#endregion
|
|
291
|
-
//#region src/utils/ncp-agent-session-journal.utils.d.ts
|
|
292
|
-
declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
293
|
-
declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
|
|
294
|
-
declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
|
|
295
|
-
declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
|
|
296
|
-
type NcpAgentSessionSnapshotMessageEvent = {
|
|
297
|
-
type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
|
|
298
|
-
payload: Extract<NcpEndpointEvent, {
|
|
299
|
-
type: NcpEventType.MessageSent;
|
|
300
|
-
}>["payload"];
|
|
301
|
-
};
|
|
302
|
-
type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
|
|
303
|
-
type NcpSessionRequestJournalEvent = {
|
|
304
|
-
type: NcpSessionRequestJournalEventType;
|
|
305
|
-
payload: {
|
|
306
|
-
sessionId: string;
|
|
307
|
-
request: unknown;
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
type NcpAgentSessionJournalReplayEvent = NcpEndpointEvent | NcpAgentSessionSnapshotMessageEvent | NcpSessionRequestJournalEvent;
|
|
311
|
-
//#endregion
|
|
312
353
|
//#region src/types/agent-run.types.d.ts
|
|
313
354
|
type ThinkingEffort = string;
|
|
314
355
|
type ContextBlock = string;
|
|
@@ -350,6 +391,125 @@ type ToolProvider = {
|
|
|
350
391
|
provide: (request: AgentRunRequest) => Promise<readonly NcpTool[]> | readonly NcpTool[];
|
|
351
392
|
};
|
|
352
393
|
//#endregion
|
|
394
|
+
//#region src/managers/context-provider.manager.d.ts
|
|
395
|
+
declare class ContextProviderManager {
|
|
396
|
+
private readonly providers;
|
|
397
|
+
register: (provider: ContextProvider) => (() => void);
|
|
398
|
+
buildContext: (request: AgentRunRequest) => Promise<readonly ContextBlock[]>;
|
|
399
|
+
dispose: () => void;
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/managers/tool-provider.manager.d.ts
|
|
403
|
+
type ToolRunContext = {
|
|
404
|
+
agentId: string;
|
|
405
|
+
channel: string;
|
|
406
|
+
chatId: string;
|
|
407
|
+
config: Config;
|
|
408
|
+
execTimeoutSeconds: number;
|
|
409
|
+
handoffDepth: number;
|
|
410
|
+
metadata: Record<string, unknown>;
|
|
411
|
+
restrictToWorkspace: boolean;
|
|
412
|
+
searchConfig: SearchConfig;
|
|
413
|
+
sessionId: string;
|
|
414
|
+
workspace: string;
|
|
415
|
+
};
|
|
416
|
+
declare class ToolProviderManager {
|
|
417
|
+
private readonly providers;
|
|
418
|
+
register: (provider: ToolProvider) => (() => void);
|
|
419
|
+
buildTools: (request: AgentRunRequest) => Promise<readonly NcpTool[]>;
|
|
420
|
+
dispose: () => void;
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/managers/agent-context-window.manager.d.ts
|
|
424
|
+
type AgentContextWindowEvaluation = {
|
|
425
|
+
agentId: string;
|
|
426
|
+
contextTokens: number;
|
|
427
|
+
fixedInputTokens: number;
|
|
428
|
+
minimumContextTokens: number;
|
|
429
|
+
reservedContextTokens: number;
|
|
430
|
+
};
|
|
431
|
+
type AgentRunSurface = {
|
|
432
|
+
contextBlocks: readonly string[];
|
|
433
|
+
tools: readonly NcpTool[];
|
|
434
|
+
};
|
|
435
|
+
declare class AgentContextWindowManager {
|
|
436
|
+
private readonly agentManager;
|
|
437
|
+
private readonly contextProviderManager;
|
|
438
|
+
private readonly toolProviderManager;
|
|
439
|
+
private readonly runInputBudgetBySession;
|
|
440
|
+
private readonly preflightService;
|
|
441
|
+
constructor(agentManager: AgentManager, contextProviderManager: ContextProviderManager, toolProviderManager: ToolProviderManager);
|
|
442
|
+
resolveRunSurface: (request: AgentRunRequest) => Promise<AgentRunSurface>;
|
|
443
|
+
forgetSession: (sessionId: string) => void;
|
|
444
|
+
previewSession: (params: {
|
|
445
|
+
requestMetadata: Record<string, unknown>;
|
|
446
|
+
sessionId: string;
|
|
447
|
+
sessionMessages: readonly NcpMessage[];
|
|
448
|
+
storedAgentId?: string;
|
|
449
|
+
storedMetadata: Record<string, unknown>;
|
|
450
|
+
}) => Promise<ContextWindowSnapshot | null>;
|
|
451
|
+
assertCanSave: (params: {
|
|
452
|
+
agentId: string;
|
|
453
|
+
contextTokens: number;
|
|
454
|
+
}) => Promise<AgentContextWindowEvaluation>;
|
|
455
|
+
assertDefaultCanSave: (contextTokens: number) => Promise<AgentContextWindowEvaluation[]>;
|
|
456
|
+
private createValidationRequest;
|
|
457
|
+
private estimateFixedInputTokens;
|
|
458
|
+
private resolveSessionFixedInputTokens;
|
|
459
|
+
private buildRunSurface;
|
|
460
|
+
private resolveMinimumContextTokens;
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/managers/agent-run-context-compaction.manager.d.ts
|
|
464
|
+
type AgentRunContextCompactionInput = {
|
|
465
|
+
sessionId: string;
|
|
466
|
+
agentId: string;
|
|
467
|
+
contextBlocks: readonly string[];
|
|
468
|
+
messages: readonly NcpMessage[];
|
|
469
|
+
metadata: Record<string, unknown>;
|
|
470
|
+
model: string;
|
|
471
|
+
phase?: ContextCompactionPhase;
|
|
472
|
+
signal?: AbortSignal;
|
|
473
|
+
tools?: readonly NcpTool[];
|
|
474
|
+
};
|
|
475
|
+
declare class AgentRunContextCompactionManager {
|
|
476
|
+
private readonly preflightService;
|
|
477
|
+
constructor(agentManager: AgentManager, providerManager: LlmProviderRuntime);
|
|
478
|
+
runPreflight: (input: AgentRunContextCompactionInput) => AsyncIterable<NcpEndpointEvent>;
|
|
479
|
+
runManual: (input: AgentRunContextCompactionInput) => Promise<readonly NcpEndpointEvent[]>;
|
|
480
|
+
private run;
|
|
481
|
+
private toEvent;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/utils/ncp-agent-session-journal.utils.d.ts
|
|
485
|
+
declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
486
|
+
declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
|
|
487
|
+
declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
|
|
488
|
+
declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
|
|
489
|
+
type NcpAgentSessionSnapshotMessageEvent = {
|
|
490
|
+
type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
|
|
491
|
+
payload: Extract<NcpEndpointEvent, {
|
|
492
|
+
type: NcpEventType.MessageSent;
|
|
493
|
+
}>["payload"];
|
|
494
|
+
};
|
|
495
|
+
type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
|
|
496
|
+
type NcpSessionRequestJournalEvent = {
|
|
497
|
+
type: NcpSessionRequestJournalEventType;
|
|
498
|
+
payload: {
|
|
499
|
+
sessionId: string;
|
|
500
|
+
request: unknown;
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
type NcpAgentSessionJournalReplayEvent = NcpEndpointEvent | NcpAgentSessionSnapshotMessageEvent | NcpSessionRequestJournalEvent;
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/utils/ncp-agent-unfinished-run.utils.d.ts
|
|
506
|
+
type UnfinishedNcpAgentRun = {
|
|
507
|
+
sessionId: string;
|
|
508
|
+
messageId?: string;
|
|
509
|
+
runId?: string;
|
|
510
|
+
startedAt?: string;
|
|
511
|
+
};
|
|
512
|
+
//#endregion
|
|
353
513
|
//#region src/types/session.types.d.ts
|
|
354
514
|
type SessionMessagePage = {
|
|
355
515
|
messages: NcpMessage[];
|
|
@@ -409,6 +569,7 @@ declare class NcpAgentSessionJournalStore {
|
|
|
409
569
|
private readonly writeChains;
|
|
410
570
|
private readonly metadataStore;
|
|
411
571
|
private readonly messageProjectionStore;
|
|
572
|
+
private readonly unfinishedRunStore;
|
|
412
573
|
private readonly summaryIndexStore;
|
|
413
574
|
constructor(journalDir: string);
|
|
414
575
|
appendSessionEvent: (params: {
|
|
@@ -417,6 +578,7 @@ declare class NcpAgentSessionJournalStore {
|
|
|
417
578
|
}) => Promise<void>;
|
|
418
579
|
getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
419
580
|
listSessionSummaries: () => Promise<NcpSessionSummary[]>;
|
|
581
|
+
listUnfinishedRuns: () => Promise<UnfinishedNcpAgentRun[]>;
|
|
420
582
|
listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
|
|
421
583
|
listSessionMessagePage: (params: {
|
|
422
584
|
sessionId: string;
|
|
@@ -505,6 +667,7 @@ type CreateNcpSessionInput = CreateSessionInput & {
|
|
|
505
667
|
sessionId?: string;
|
|
506
668
|
};
|
|
507
669
|
type SessionManagerOptions = {
|
|
670
|
+
agentContextWindowManager: AgentContextWindowManager;
|
|
508
671
|
agentManager: AgentManager;
|
|
509
672
|
configManager: ConfigManager;
|
|
510
673
|
eventBus: EventBus;
|
|
@@ -514,13 +677,10 @@ type SessionManagerOptions = {
|
|
|
514
677
|
};
|
|
515
678
|
declare class SessionManager implements NcpSessionApi {
|
|
516
679
|
private readonly options;
|
|
517
|
-
readonly cleanups: Array<() => void>;
|
|
518
|
-
private readonly contextWindowPreview;
|
|
519
680
|
private readonly eventIngestion;
|
|
520
681
|
private readonly workingDirResolver;
|
|
521
|
-
private started;
|
|
522
682
|
constructor(options: SessionManagerOptions);
|
|
523
|
-
start: () => void
|
|
683
|
+
start: () => Promise<void>;
|
|
524
684
|
dispose: () => void;
|
|
525
685
|
createSession: (params: CreateNcpSessionInput) => Promise<CreatedSession>;
|
|
526
686
|
appendSessionEvent: (params: {
|
|
@@ -548,31 +708,14 @@ declare class SessionManager implements NcpSessionApi {
|
|
|
548
708
|
getOrCreateAgentRunSession: (params: CreateAgentRunSessionParams) => Promise<AgentRunSession>;
|
|
549
709
|
patchSessionMetadata: (sessionId: string, patch: Record<string, unknown>) => Promise<void>;
|
|
550
710
|
clearSessionMessages: (sessionId: string) => Promise<number>;
|
|
711
|
+
rewindSessionBeforeMessage: (sessionId: string, messageId: string) => Promise<AgentSessionRecord>;
|
|
551
712
|
publishSessionChange: (sessionKey: string) => Promise<void>;
|
|
552
713
|
private createSummaryFromRecord;
|
|
714
|
+
private createSummaryWithContextWindow;
|
|
553
715
|
private publishSessionMetadataChanged;
|
|
554
716
|
private applySessionProjectPatch;
|
|
555
717
|
}
|
|
556
718
|
//#endregion
|
|
557
|
-
//#region src/managers/agent-run-context-compaction.manager.d.ts
|
|
558
|
-
type AgentRunContextCompactionInput = {
|
|
559
|
-
sessionId: string;
|
|
560
|
-
agentId: string;
|
|
561
|
-
contextBlocks: readonly string[];
|
|
562
|
-
messages: readonly NcpMessage[];
|
|
563
|
-
metadata: Record<string, unknown>;
|
|
564
|
-
model: string;
|
|
565
|
-
};
|
|
566
|
-
declare class AgentRunContextCompactionManager {
|
|
567
|
-
private readonly sessionManager;
|
|
568
|
-
private readonly preflightService;
|
|
569
|
-
constructor(agentManager: AgentManager, providerManager: LlmProviderRuntime, sessionManager: SessionManager);
|
|
570
|
-
runPreflight: (input: AgentRunContextCompactionInput) => Promise<readonly NcpEndpointEvent[]>;
|
|
571
|
-
runManual: (input: AgentRunContextCompactionInput) => Promise<readonly NcpEndpointEvent[]>;
|
|
572
|
-
private run;
|
|
573
|
-
private toEvents;
|
|
574
|
-
}
|
|
575
|
-
//#endregion
|
|
576
719
|
//#region src/managers/session-run.manager.d.ts
|
|
577
720
|
type SessionRunQueuedRequest = {
|
|
578
721
|
id: string;
|
|
@@ -605,6 +748,7 @@ declare class SessionRun {
|
|
|
605
748
|
messages: readonly NcpMessage[];
|
|
606
749
|
};
|
|
607
750
|
applyEvents: (events: readonly NcpEndpointEvent[]) => Promise<void>;
|
|
751
|
+
replaceMessages: (messages: readonly NcpMessage[]) => void;
|
|
608
752
|
onStatusChange: (listener: (status: "idle" | "running") => void) => (() => void);
|
|
609
753
|
enqueueRequest: (request: AgentRunRequest, session: AgentRunSession) => SessionRunQueuedRequest;
|
|
610
754
|
listQueuedRequests: () => readonly SessionRunQueuedRequest[];
|
|
@@ -692,56 +836,29 @@ declare class AgentRuntimeManager {
|
|
|
692
836
|
private disposeAllRuntimes;
|
|
693
837
|
}
|
|
694
838
|
//#endregion
|
|
695
|
-
//#region src/managers/context-provider.manager.d.ts
|
|
696
|
-
declare class ContextProviderManager {
|
|
697
|
-
private readonly providers;
|
|
698
|
-
register: (provider: ContextProvider) => (() => void);
|
|
699
|
-
buildContext: (request: AgentRunRequest) => Promise<readonly ContextBlock[]>;
|
|
700
|
-
dispose: () => void;
|
|
701
|
-
}
|
|
702
|
-
//#endregion
|
|
703
|
-
//#region src/managers/tool-provider.manager.d.ts
|
|
704
|
-
type ToolRunContext = {
|
|
705
|
-
agentId: string;
|
|
706
|
-
channel: string;
|
|
707
|
-
chatId: string;
|
|
708
|
-
config: Config;
|
|
709
|
-
execTimeoutSeconds: number;
|
|
710
|
-
handoffDepth: number;
|
|
711
|
-
metadata: Record<string, unknown>;
|
|
712
|
-
restrictToWorkspace: boolean;
|
|
713
|
-
searchConfig: SearchConfig;
|
|
714
|
-
sessionId: string;
|
|
715
|
-
workspace: string;
|
|
716
|
-
};
|
|
717
|
-
declare class ToolProviderManager {
|
|
718
|
-
private readonly providers;
|
|
719
|
-
register: (provider: ToolProvider) => (() => void);
|
|
720
|
-
buildTools: (request: AgentRunRequest) => Promise<readonly NcpTool[]>;
|
|
721
|
-
dispose: () => void;
|
|
722
|
-
}
|
|
723
|
-
//#endregion
|
|
724
839
|
//#region src/managers/agent-run-request.manager.d.ts
|
|
725
840
|
declare class AgentRunRequestManager {
|
|
726
841
|
private readonly agentRuntimeManager;
|
|
727
842
|
private readonly agentManager;
|
|
728
843
|
private readonly configManager;
|
|
729
|
-
private readonly
|
|
844
|
+
private readonly agentContextWindowManager;
|
|
730
845
|
private readonly eventBus;
|
|
731
846
|
private readonly ingress;
|
|
732
847
|
private readonly sessionManager;
|
|
733
848
|
private readonly sessionRunManager;
|
|
734
|
-
private readonly toolProviderManager;
|
|
735
849
|
readonly cleanups: Array<() => void>;
|
|
736
850
|
private readonly observedSessionRuns;
|
|
851
|
+
private readonly sessionCommandManager;
|
|
737
852
|
private started;
|
|
738
|
-
constructor(agentRuntimeManager: AgentRuntimeManager, agentManager: AgentManager, configManager: ConfigManager,
|
|
853
|
+
constructor(agentRuntimeManager: AgentRuntimeManager, agentManager: AgentManager, configManager: ConfigManager, agentContextWindowManager: AgentContextWindowManager, eventBus: EventBus, ingress: Ingress, sessionManager: SessionManager, sessionRunManager: SessionRunManager);
|
|
739
854
|
start: () => void;
|
|
740
855
|
dispose: () => void;
|
|
741
856
|
listQueuedInputs: (sessionId: string) => readonly SessionQueuedInput[];
|
|
742
857
|
removeQueuedInput: (sessionId: string, queuedInputId: string) => SessionQueuedInput | null;
|
|
743
858
|
private handleSendRequest;
|
|
744
859
|
private handleAbortRequest;
|
|
860
|
+
private handleEditMessageRequest;
|
|
861
|
+
private handleContinueRequest;
|
|
745
862
|
private handleSessionMessageRequest;
|
|
746
863
|
private send;
|
|
747
864
|
private startQueuedRun;
|
|
@@ -1588,6 +1705,7 @@ declare class NextclawKernel {
|
|
|
1588
1705
|
readonly ingress: Ingress;
|
|
1589
1706
|
readonly messageBus: MessageBus;
|
|
1590
1707
|
readonly llmProviders: LlmProviderManager;
|
|
1708
|
+
readonly providerModelCatalog: ProviderModelCatalogManager;
|
|
1591
1709
|
readonly llmUsage: LlmUsageManager;
|
|
1592
1710
|
readonly configManager: ConfigManager;
|
|
1593
1711
|
readonly accessManager: AccessManager;
|
|
@@ -1608,6 +1726,7 @@ declare class NextclawKernel {
|
|
|
1608
1726
|
readonly serviceAppManager: ServiceAppManager;
|
|
1609
1727
|
readonly extensions: ExtensionManager;
|
|
1610
1728
|
readonly agentRuntimeManager: AgentRuntimeManager;
|
|
1729
|
+
readonly agentContextWindowManager: AgentContextWindowManager;
|
|
1611
1730
|
readonly contextCompactionManager: AgentRunContextCompactionManager;
|
|
1612
1731
|
readonly contextProviderManager: ContextProviderManager;
|
|
1613
1732
|
readonly sessionRunManager: SessionRunManager;
|
|
@@ -1872,23 +1991,19 @@ declare const DEFAULT_SERVICE_ACTION_RISK: ServiceActionRisk;
|
|
|
1872
1991
|
declare function buildServiceActionId(appId: string, actionName: string): string;
|
|
1873
1992
|
declare function getServiceActionName(actionId: string, appId: string): string;
|
|
1874
1993
|
//#endregion
|
|
1875
|
-
//#region src/features/context-compaction/
|
|
1876
|
-
declare class
|
|
1877
|
-
private readonly
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
storedAgentId?: string;
|
|
1884
|
-
storedMetadata: Record<string, unknown>;
|
|
1885
|
-
}) => ContextWindowSnapshot | null;
|
|
1994
|
+
//#region src/features/context-compaction/services/context-compaction-journal-recovery.service.d.ts
|
|
1995
|
+
declare class ContextCompactionJournalRecoveryService {
|
|
1996
|
+
private readonly pendingMessageIds;
|
|
1997
|
+
private readonly recoveredTerminals;
|
|
1998
|
+
seed: (messages: readonly NcpMessage[]) => void;
|
|
1999
|
+
track: (event: NcpEndpointEvent) => void;
|
|
2000
|
+
terminalize: (message: NcpMessage) => NcpMessage;
|
|
2001
|
+
private readCheckpoint;
|
|
1886
2002
|
}
|
|
1887
2003
|
//#endregion
|
|
1888
2004
|
//#region src/features/context-compaction/services/context-compaction-preflight.service.d.ts
|
|
1889
2005
|
type ContextCompactionPreflightResult = {
|
|
1890
2006
|
contextWindow: ContextWindowSnapshot;
|
|
1891
|
-
metadataPatch: Record<string, unknown>;
|
|
1892
2007
|
sessionMessages: NcpMessage[];
|
|
1893
2008
|
timelineMessage: NcpMessage | null;
|
|
1894
2009
|
};
|
|
@@ -1898,13 +2013,21 @@ type ContextCompactionPreflightBeginResult = {
|
|
|
1898
2013
|
pendingCompaction: ContextCompactionPendingWork | null;
|
|
1899
2014
|
};
|
|
1900
2015
|
type ContextCompactionTrigger = "automatic" | "manual";
|
|
2016
|
+
type ContinuationMessageBoundary = {
|
|
2017
|
+
messageId: string;
|
|
2018
|
+
coveredPartCount: number;
|
|
2019
|
+
};
|
|
1901
2020
|
type ContextCompactionPendingWork = {
|
|
1902
2021
|
checkpoint: ReturnType<typeof buildCompressingCompactionCheckpoint>;
|
|
2022
|
+
contextBlockMessages: Record<string, unknown>[];
|
|
2023
|
+
continuationMessageBoundary: ContinuationMessageBoundary | null;
|
|
1903
2024
|
contextTokens: number;
|
|
2025
|
+
phase: ContextCompactionPhase;
|
|
1904
2026
|
serviceMessageId: string;
|
|
1905
2027
|
model: string;
|
|
1906
2028
|
plan: ContextCompactionPlan;
|
|
1907
2029
|
reservedContextTokens: number;
|
|
2030
|
+
snapshotFixedInputTokens: number;
|
|
1908
2031
|
sessionId: string;
|
|
1909
2032
|
sessionMessages: NcpMessage[];
|
|
1910
2033
|
};
|
|
@@ -1915,25 +2038,30 @@ declare class ContextCompactionPreflightService {
|
|
|
1915
2038
|
private readonly contextWindowBudgetService;
|
|
1916
2039
|
constructor(agentManager: AgentManager, providerManager?: LlmProviderRuntime | undefined);
|
|
1917
2040
|
preview: (params: {
|
|
2041
|
+
completeInputBudget?: boolean;
|
|
1918
2042
|
contextBlocks?: readonly string[];
|
|
2043
|
+
fixedInputTokens?: number;
|
|
1919
2044
|
requestMetadata: Record<string, unknown>;
|
|
1920
2045
|
sessionId: string;
|
|
1921
2046
|
sessionMessages: readonly NcpMessage[];
|
|
1922
2047
|
storedAgentId?: string;
|
|
1923
2048
|
storedMetadata: Record<string, unknown>;
|
|
2049
|
+
tools?: readonly NcpTool[];
|
|
1924
2050
|
}) => ContextWindowSnapshot | null;
|
|
1925
2051
|
begin: (params: {
|
|
1926
2052
|
contextBlocks?: readonly string[];
|
|
1927
2053
|
inputMessages: readonly NcpMessage[];
|
|
1928
2054
|
model: string;
|
|
2055
|
+
phase?: ContextCompactionPhase;
|
|
1929
2056
|
requestMetadata: Record<string, unknown>;
|
|
1930
2057
|
sessionId: string;
|
|
1931
2058
|
sessionMessages: readonly NcpMessage[];
|
|
1932
2059
|
storedAgentId?: string;
|
|
1933
2060
|
storedMetadata: Record<string, unknown>;
|
|
2061
|
+
tools?: readonly NcpTool[];
|
|
1934
2062
|
trigger?: ContextCompactionTrigger;
|
|
1935
2063
|
}) => ContextCompactionPreflightBeginResult;
|
|
1936
|
-
finish: (pending: ContextCompactionPendingWork) => Promise<ContextCompactionPreflightResult>;
|
|
2064
|
+
finish: (pending: ContextCompactionPendingWork, signal?: AbortSignal) => Promise<ContextCompactionPreflightResult>;
|
|
1937
2065
|
private generateSummary;
|
|
1938
2066
|
private resolveCompactionProfile;
|
|
1939
2067
|
}
|
|
@@ -1943,7 +2071,10 @@ declare const NEXTCLAW_TIMELINE_KIND_METADATA_KEY = "nextclaw_timeline_kind";
|
|
|
1943
2071
|
declare const CONTEXT_COMPACTION_TIMELINE_KIND = "context_compaction";
|
|
1944
2072
|
declare const CONTEXT_COMPACTION_PROJECTION_METADATA_KEY = "nextclaw_context_projection";
|
|
1945
2073
|
declare const CONTEXT_COMPACTION_PROJECTION_KIND = "compressed_context";
|
|
2074
|
+
declare const CONTEXT_COMPACTION_CONTINUATION_TEXT = "Continue the active run from the compressed working context. Do not repeat completed tool calls; proceed with the next required action.";
|
|
2075
|
+
declare const CONTEXT_COMPACTION_SYSTEM_PREAMBLE: string;
|
|
1946
2076
|
type ContextCompactionTimelineCheckpoint = ContextCompactionCheckpoint;
|
|
2077
|
+
declare function readContextCompactionCheckpoint(message: NcpMessage): ContextCompactionCheckpoint | null;
|
|
1947
2078
|
declare function createContextCompactionMessageId(): string;
|
|
1948
2079
|
declare function buildContextCompactionTimelineNcpMessage(params: {
|
|
1949
2080
|
messageId: string;
|
|
@@ -1957,10 +2088,14 @@ declare function isContextCompactionProjectionMessage(message: {
|
|
|
1957
2088
|
metadata?: Record<string, unknown> | undefined;
|
|
1958
2089
|
} | null | undefined): boolean;
|
|
1959
2090
|
declare function readLatestContextCompactionCheckpoint(sessionMessages: readonly NcpMessage[]): ContextCompactionCheckpoint | null;
|
|
1960
|
-
|
|
2091
|
+
type ContextCompactionModelProjection = {
|
|
2092
|
+
messages: NcpMessage[];
|
|
2093
|
+
stablePrefixMessageCount: number;
|
|
2094
|
+
};
|
|
2095
|
+
declare function buildContextCompactionModelProjection(params: {
|
|
1961
2096
|
sessionId: string;
|
|
1962
2097
|
sessionMessages: readonly NcpMessage[];
|
|
1963
|
-
}):
|
|
2098
|
+
}): ContextCompactionModelProjection;
|
|
1964
2099
|
declare function readContextWindowEventSessionId(event: NcpEndpointEvent): string | null;
|
|
1965
2100
|
declare function isContextWindowSnapshot(value: unknown): value is Record<string, unknown>;
|
|
1966
2101
|
declare function createContextWindowSignature(value: Record<string, unknown>): string;
|
|
@@ -2054,5 +2189,5 @@ declare function resolveLegacyEventType(message: SessionMessage): string;
|
|
|
2054
2189
|
declare function getUiContentParamsBootstrapScript(): string;
|
|
2055
2190
|
declare function injectUiContentParamsBootstrap(html: string): string;
|
|
2056
2191
|
//#endregion
|
|
2057
|
-
export { AUTOMATIC_UPDATE_CHECK_INTERVAL_MS, AccessLoginResult, AccessManager, AccessManagerOptions, AccessPasswordStatus, AccessPrincipal, AccessRole, AccessSessionRecord, AccessSessionState, AgentManager, AgentManagerOptions, AgentRunClient, type AgentRunReply, type AgentRunReplyOptions, AgentRunSession, type AgentRunStreamOptions, AgentRuntimeEntry, AgentRuntimeProviderRegistration, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AgentRuntimeSessionTypeProvider, type AssetApi, AutomationManager, AutomationManagerOptions, type BuildAgentRunSendPayloadParams, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_PROJECTION_KIND, CONTEXT_COMPACTION_PROJECTION_METADATA_KEY, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelManager, ChannelReplyRouterDispatchParams, CommandRegistry, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextCompactionTimelineCheckpoint, ContextCompactionTrigger,
|
|
2192
|
+
export { AUTOMATIC_UPDATE_CHECK_INTERVAL_MS, AccessLoginResult, AccessManager, AccessManagerOptions, AccessPasswordStatus, AccessPrincipal, AccessRole, AccessSessionRecord, AccessSessionState, AgentManager, AgentManagerOptions, AgentRunClient, type AgentRunReply, type AgentRunReplyOptions, AgentRunSession, type AgentRunStreamOptions, AgentRuntimeEntry, AgentRuntimeProviderRegistration, AgentRuntimeSessionRequestDispatcherOptions, AgentRuntimeSessionTypeDescribeParams, AgentRuntimeSessionTypeIcon, AgentRuntimeSessionTypeOption, AgentRuntimeSessionTypeProvider, type AssetApi, AutomationManager, AutomationManagerOptions, type BuildAgentRunSendPayloadParams, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_CONTINUATION_TEXT, CONTEXT_COMPACTION_PROJECTION_KIND, CONTEXT_COMPACTION_PROJECTION_METADATA_KEY, CONTEXT_COMPACTION_SYSTEM_PREAMBLE, CONTEXT_COMPACTION_TIMELINE_KIND, ChannelManager, ChannelReplyRouterDispatchParams, CommandRegistry, ConfigManager, ConfigManagerOptions, ConfigManagerRuntimeHooks, ConfigMutationResult, ContextCompactionJournalRecoveryService, ContextCompactionModelProjection, ContextCompactionPreflightBeginResult, ContextCompactionPreflightResult, ContextCompactionPreflightService, ContextCompactionTimelineCheckpoint, ContextCompactionTrigger, CreateAgentRunSessionParams, CreateInboxDeliveryInput, CreateProjectInput, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_SERVICE_ACTION_RISK, DirectPromptDispatchParams, ExtensionLoadProgress, ExtensionLoadResult, ExtensionManager, GatewayInboundLoopRuntime, GatewayInboundProcessor, InboxDeliveryError, InboxDeliveryErrorCode, InboxDeliveryManager, InboxDeliveryManagerOptions, InstallationKind, InstalledSkillDetail, InstalledSkillSummary, InstalledSkillsList, type LearningLoopRuntimeConfig, LlmProviderManager, LlmProviderRuntime, LlmUsageManager, LlmUsageManagerOptions, LlmUsageRecord, LlmUsageSnapshot, LlmUsageStats, LlmUsageStore, LlmUsageStoreOptions, LlmUsageSummary, LocalizedTextMap, MAX_INBOX_DELIVERY_CONTENT_LENGTH, McpManager, McpServiceAppRuntimeService, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NcpAgentSessionJournalStore, NextclawKernel, NextclawKernelOptions, NextclawNcpResolvedAgentProfile, NextclawNcpResolvedRunContext, NextclawNcpRunContextResolveParams, PANEL_APP_AGENT_CAPABILITIES, PROJECT_TEMPLATE_IDS, PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS, PanelAppAgentCapability, PanelAppAgentGenerateObjectInput, PanelAppAgentGenerateObjectRequest, PanelAppAgentGenerateObjectResult, PanelAppAgentRunClient, PanelAppAgentSendPayload, PanelAppAgentSendRequest, PanelAppAgentSendResult, PanelAppAssetTokenService, PanelAppBridgeSession, PanelAppCapabilityGrant, PanelAppCapabilityGrantCaller, type PanelAppClientGrant, PanelAppContent, PanelAppDeleteResult, PanelAppEntry, PanelAppError, PanelAppErrorCode, PanelAppList, PanelAppManager, type PanelAppPreferencesUpdate, PreferenceEntry, PreferenceError, PreferenceErrorCode, PreferenceJsonValue, PreferenceManager, PreferenceManagerOptions, ProjectError, ProjectErrorCode, ProjectManager, ProjectManagerOptions, ProjectRecord, ProjectTemplate, ProjectTemplateId, ProviderManagerNcpLLMApi, ProviderModelCatalogEntry, ProviderModelCatalogManager, ProviderModelCatalogSnapshot, ProviderModelsDiscoverInput, ResolvedAgentProfile, SERVICE_APP_MANIFEST_FILE_NAME, ServiceAction, ServiceActionCaller, ServiceActionGrant, ServiceActionGrantRequest, ServiceActionGrantState, ServiceActionInvokeRequest, ServiceActionInvokeResult, ServiceActionRisk, ServiceActionRuntimeState, ServiceAppDeleteResult, ServiceAppError, ServiceAppErrorCode, ServiceAppList, ServiceAppManager, ServiceAppManifest, ServiceAppManifestAction, ServiceAppProtocol, ServiceAppRecord, ServiceAppRuntimeStatus, SessionContextCompactionError, SessionContextCompactionErrorCode, SessionContextCompactionManager, SessionContextCompactionResult, SessionManager, SessionManagerOptions, SessionMessageCursorError, SessionMessagePage, type SessionQueuedInput, SessionRequestManager, SessionRequestManagerOptions, SessionSettingsError, SessionSettingsPatch, SkillFrontmatter, type SkillInfo, SkillManager, type SkillScope, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdateProgress, UpdateSnapshot, UpdateStatus, buildAgentRunSendPayload, buildContextCompactionModelProjection, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildNextclawNcpRunContext, buildServiceActionId, createAgentRuntimeSessionRequestDispatcher, createAssetTools, createContextCompactionMessageId, createContextWindowSignature, createLlmUsageRecord, describeAgentRuntimeSessionTypes, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, getAutomaticUpdateCheckDelay, getServiceActionName, getServiceAppManifestPath, getUiContentParamsBootstrapScript, getUnsignedUpdateManifest, hasLlmUsageTelemetry, injectUiContentParamsBootstrap, isContextCompactionProjectionMessage, isContextCompactionTimelineMessage, isContextWindowSnapshot, isInboxDeliveryError, isPanelAppAgentCapability, isPanelAppError, isPreferenceError, isProjectError, isReplyCapableChannel, isServiceAppError, isSessionContextCompactionError, isSessionMessageCursorError, isSessionSettingsError, listExtensionChannelIds, listServiceAppManifestActions, mergeServiceAppRuntimeActions, normalizeAgentRuntimeSessionTypeIcon, normalizeLlmUsageModel, normalizeOptionalString, parseServiceAppManifest, parseSkillFrontmatter, readContextCompactionCheckpoint, readContextWindowEventSessionId, readLatestContextCompactionCheckpoint, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, readServiceAppManifest, resolveAgentRuntimeEntries, resolveAutomaticUpdateCheckIntervalMs, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolveSessionChannelContext, runGatewayInboundLoop, sanitizeLlmUsage, serializeUnsignedUpdateManifest, shouldRefreshContextWindowDuringStream, shouldRefreshContextWindowImmediately, stripSkillFrontmatter, syncSessionThinkingPreference, toNcpMessages, waitForAgentRuntimeSessionReply };
|
|
2058
2193
|
//# sourceMappingURL=index.d.ts.map
|