@nextclaw/kernel 0.19.2-beta.0 → 0.19.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/worker/index.d.ts +4 -0
- package/dist/app/worker/index.js +3 -0
- package/dist/automatic-update-check.utils-C6lQfErN.d.ts +11 -0
- package/dist/automatic-update-check.utils-C6lQfErN.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4339
- package/dist/index.js +12555 -18773
- package/dist/index.js.map +1 -1
- package/dist/nextclaw-harness.manager-7URpTz3z.js +9030 -0
- package/dist/nextclaw-harness.manager-7URpTz3z.js.map +1 -0
- package/dist/nextclaw-harness.manager-Df5Zagn_.d.ts +6001 -0
- package/dist/nextclaw-harness.manager-Df5Zagn_.d.ts.map +1 -0
- package/dist/types/update-contract.types.d.ts +1 -1
- package/dist/types/update-contract.types.js +1 -1
- package/dist/{update-manifest.types-eSil_QH0.js → update-manifest.types-CBp2VTM1.js} +1 -1
- package/dist/{update-manifest.types-eSil_QH0.js.map → update-manifest.types-CBp2VTM1.js.map} +1 -1
- package/dist/{update-manifest.types-Dl4B87Pa.d.ts → update-manifest.types-C_60CVvw.d.ts} +1 -1
- package/dist/{update-manifest.types-Dl4B87Pa.d.ts.map → update-manifest.types-C_60CVvw.d.ts.map} +1 -1
- package/dist/utils/automatic-update-check.utils.d.ts +2 -11
- package/package.json +17 -57
- package/dist/agent-model-input-budget.utils-tw9zs9WM.js +0 -26
- package/dist/agent-model-input-budget.utils-tw9zs9WM.js.map +0 -1
- package/dist/agent-run-context-compaction.manager-BV6tB0wL.d.ts +0 -28
- package/dist/agent-run-context-compaction.manager-BV6tB0wL.d.ts.map +0 -1
- package/dist/agent-run-model-input-builder.service-C3ydUx3d.js +0 -320
- package/dist/agent-run-model-input-builder.service-C3ydUx3d.js.map +0 -1
- package/dist/agent-run.types-CNVBBJnd.d.ts +0 -71
- package/dist/agent-run.types-CNVBBJnd.d.ts.map +0 -1
- package/dist/context-compaction-preflight.service-ClJEGWKS.d.ts +0 -97
- package/dist/context-compaction-preflight.service-ClJEGWKS.d.ts.map +0 -1
- package/dist/context-compaction-preflight.service-K0tE34Oz.js +0 -689
- package/dist/context-compaction-preflight.service-K0tE34Oz.js.map +0 -1
- package/dist/context-compaction.utils-Csf80mdq.d.ts +0 -42
- package/dist/context-compaction.utils-Csf80mdq.d.ts.map +0 -1
- package/dist/features/context-compaction/services/context-compaction-preflight.service.d.ts +0 -2
- package/dist/features/context-compaction/services/context-compaction-preflight.service.js +0 -2
- package/dist/features/context-compaction/utils/context-compaction.utils.d.ts +0 -2
- package/dist/features/context-compaction/utils/context-compaction.utils.js +0 -202
- package/dist/features/context-compaction/utils/context-compaction.utils.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/managers/agent-run-context-compaction.manager.d.ts +0 -2
- package/dist/managers/agent-run-context-compaction.manager.js +0 -68
- package/dist/managers/agent-run-context-compaction.manager.js.map +0 -1
- package/dist/request-context-tail.manager-DXC4rdAP.d.ts +0 -22
- package/dist/request-context-tail.manager-DXC4rdAP.d.ts.map +0 -1
- package/dist/services/agent-run-model-input-builder.service.d.ts +0 -58
- package/dist/services/agent-run-model-input-builder.service.d.ts.map +0 -1
- package/dist/services/agent-run-model-input-builder.service.js +0 -2
- package/dist/tool-schema.tools-CtZEKWeY.js +0 -75
- package/dist/tool-schema.tools-CtZEKWeY.js.map +0 -1
- package/dist/tools/show-content.tools.d.ts +0 -10
- package/dist/tools/show-content.tools.d.ts.map +0 -1
- package/dist/tools/show-content.tools.js +0 -294
- package/dist/tools/show-content.tools.js.map +0 -1
- package/dist/tools/tool-schema.tools.d.ts +0 -29
- package/dist/tools/tool-schema.tools.d.ts.map +0 -1
- package/dist/tools/tool-schema.tools.js +0 -2
- package/dist/tools/user-question.tools.d.ts +0 -63
- package/dist/tools/user-question.tools.d.ts.map +0 -1
- package/dist/tools/user-question.tools.js +0 -77
- package/dist/tools/user-question.tools.js.map +0 -1
- package/dist/user-question.manager-38KBgZCg.d.ts +0 -1038
- package/dist/user-question.manager-38KBgZCg.d.ts.map +0 -1
- package/dist/user-question.utils-DWVtPv4S.d.ts +0 -27
- package/dist/user-question.utils-DWVtPv4S.d.ts.map +0 -1
- package/dist/utils/agent-onboarding-context.utils.d.ts +0 -6
- package/dist/utils/agent-onboarding-context.utils.d.ts.map +0 -1
- package/dist/utils/agent-onboarding-context.utils.js +0 -39
- package/dist/utils/agent-onboarding-context.utils.js.map +0 -1
- package/dist/utils/automatic-update-check.utils.d.ts.map +0 -1
- package/dist/utils/user-question.utils.d.ts +0 -2
- package/dist/utils/user-question.utils.js +0 -105
- package/dist/utils/user-question.utils.js.map +0 -1
|
@@ -1,1038 +0,0 @@
|
|
|
1
|
-
import { a as ContextBlock, d as ToolProvider, o as ContextProvider, r as AgentRunRequest, u as ThinkingEffort } from "./agent-run.types-CNVBBJnd.js";
|
|
2
|
-
import { n as UserQuestionPrompt, r as UserQuestionView } from "./user-question.utils-DWVtPv4S.js";
|
|
3
|
-
import { AgentRunSendIngressPayload, EventBus, Ingress } from "@nextclaw/shared";
|
|
4
|
-
import { LocalAssetStore } from "@nextclaw/ncp-agent-runtime";
|
|
5
|
-
import { BaseChannel, Config, ContextWindowSnapshot, CreateAgentProfileInput, CreateSessionContextInheritanceInput, CreateSessionInput, CreatedSession, DiagnosticRuntime, EffectiveAgentProfile, ExtensionRegistry, LLMProvider, LLMResponse, LLMStreamEvent, MessageBus, OutboundMessage, ProviderCatalogPlugin, ProviderModelDiscoveryResult, ProviderSpec, SearchConfig, SessionSearchService, ThinkingLevel, UpdateAgentProfileInput } from "@nextclaw/core";
|
|
6
|
-
import { ListMessagesOptions, ListSessionsOptions, NcpAgentConversationStateManager, NcpEndpointEvent, NcpEventType, NcpMessage, NcpRunHandle, NcpSessionApi, NcpSessionMessagePageInfo, NcpSessionPatch, NcpSessionSummary, NcpTool } from "@nextclaw/ncp";
|
|
7
|
-
import { AgentSessionRecord } from "@nextclaw/ncp-toolkit";
|
|
8
|
-
|
|
9
|
-
//#region src/managers/channel.manager.d.ts
|
|
10
|
-
declare class ChannelManager {
|
|
11
|
-
private readonly deps;
|
|
12
|
-
private channels;
|
|
13
|
-
private channelConfig;
|
|
14
|
-
private dispatching;
|
|
15
|
-
private dispatchTask;
|
|
16
|
-
private extensionChannels;
|
|
17
|
-
constructor(deps: {
|
|
18
|
-
bus: MessageBus;
|
|
19
|
-
diagnostics?: Pick<DiagnosticRuntime, "record" | "readCorrelationId">;
|
|
20
|
-
});
|
|
21
|
-
readonly load: (params: {
|
|
22
|
-
channelConfig: Config;
|
|
23
|
-
extensionChannels?: ExtensionRegistry["channels"];
|
|
24
|
-
}) => void;
|
|
25
|
-
readonly reload: (params: {
|
|
26
|
-
channelConfig: Config;
|
|
27
|
-
extensionChannels?: ExtensionRegistry["channels"];
|
|
28
|
-
start?: boolean;
|
|
29
|
-
}) => Promise<void>;
|
|
30
|
-
readonly start: () => Promise<void>;
|
|
31
|
-
readonly stop: () => Promise<void>;
|
|
32
|
-
readonly status: () => Record<string, {
|
|
33
|
-
enabled: boolean;
|
|
34
|
-
running: boolean;
|
|
35
|
-
}>;
|
|
36
|
-
get enabledChannels(): string[];
|
|
37
|
-
readonly getChannel: (name: string) => BaseChannel<Record<string, unknown>> | null;
|
|
38
|
-
readonly deliver: (message: OutboundMessage) => Promise<boolean>;
|
|
39
|
-
private readonly recordDelivery;
|
|
40
|
-
private readonly initChannels;
|
|
41
|
-
private readonly startChannel;
|
|
42
|
-
private readonly normalizeOutbound;
|
|
43
|
-
private readonly dispatchOutbound;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/managers/llm-provider.manager.d.ts
|
|
47
|
-
type ProviderChatParams = {
|
|
48
|
-
messages: Array<Record<string, unknown>>;
|
|
49
|
-
tools?: Array<Record<string, unknown>>;
|
|
50
|
-
model?: string | null;
|
|
51
|
-
maxTokens?: number;
|
|
52
|
-
thinkingLevel?: ThinkingLevel | null;
|
|
53
|
-
sessionId?: string;
|
|
54
|
-
requestId?: string;
|
|
55
|
-
signal?: AbortSignal;
|
|
56
|
-
};
|
|
57
|
-
type LlmProviderRuntime = {
|
|
58
|
-
get: (model?: string | null) => LLMProvider;
|
|
59
|
-
chat: (params: ProviderChatParams) => Promise<LLMResponse>;
|
|
60
|
-
chatStream: (params: ProviderChatParams) => AsyncGenerator<LLMStreamEvent>;
|
|
61
|
-
};
|
|
62
|
-
type ProviderConnectionTestInput = {
|
|
63
|
-
providerName: string | null;
|
|
64
|
-
apiKey?: string | null;
|
|
65
|
-
apiBase?: string | null;
|
|
66
|
-
defaultModel: string;
|
|
67
|
-
extraHeaders?: Record<string, string> | null;
|
|
68
|
-
wireApi?: "auto" | "chat" | "responses" | null;
|
|
69
|
-
messages: Array<Record<string, unknown>>;
|
|
70
|
-
maxTokens?: number;
|
|
71
|
-
signal?: AbortSignal;
|
|
72
|
-
};
|
|
73
|
-
type ProviderModelsDiscoverInput = {
|
|
74
|
-
providerName: string | null;
|
|
75
|
-
apiKey?: string | null;
|
|
76
|
-
apiBase?: string | null;
|
|
77
|
-
extraHeaders?: Record<string, string> | null;
|
|
78
|
-
signal?: AbortSignal;
|
|
79
|
-
};
|
|
80
|
-
declare class LlmProviderManager {
|
|
81
|
-
private readonly providerRegistry;
|
|
82
|
-
private readonly contributedProviderPlugins;
|
|
83
|
-
private readonly providerModelDiscovery;
|
|
84
|
-
private readonly providerPool;
|
|
85
|
-
private readonly missingProvider;
|
|
86
|
-
private config;
|
|
87
|
-
constructor();
|
|
88
|
-
registerProviderPlugin: (plugin: ProviderCatalogPlugin) => (() => void);
|
|
89
|
-
listProviderSpecs: () => readonly ProviderSpec[];
|
|
90
|
-
load: (config: Config) => void;
|
|
91
|
-
get: (model?: string | null) => LLMProvider;
|
|
92
|
-
readonly chat: (params: ProviderChatParams) => Promise<LLMResponse>;
|
|
93
|
-
readonly chatStream: (this: LlmProviderManager, params: ProviderChatParams) => AsyncGenerator<LLMStreamEvent>;
|
|
94
|
-
readonly testConnection: (input: ProviderConnectionTestInput) => Promise<void>;
|
|
95
|
-
supportsModelDiscovery: (providerName: string | null) => boolean;
|
|
96
|
-
discoverModels: (input: ProviderModelsDiscoverInput) => Promise<ProviderModelDiscoveryResult>;
|
|
97
|
-
private refreshProviderRegistry;
|
|
98
|
-
private resolveRoute;
|
|
99
|
-
private resolveProvider;
|
|
100
|
-
private matchPrefixedProvider;
|
|
101
|
-
private resolveProviderType;
|
|
102
|
-
private resolveProviderApiKey;
|
|
103
|
-
private rewriteModelForTemplate;
|
|
104
|
-
private normalizeProviderModelConfigForRoute;
|
|
105
|
-
private getOrCreateProvider;
|
|
106
|
-
private createProvider;
|
|
107
|
-
private prepareMessagesForProvider;
|
|
108
|
-
private buildRequestHeaders;
|
|
109
|
-
private buildCacheKey;
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/managers/provider-model-catalog.manager.d.ts
|
|
113
|
-
declare const PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS: number;
|
|
114
|
-
type ProviderModelCatalogEntry = {
|
|
115
|
-
providerId: string;
|
|
116
|
-
models: string[];
|
|
117
|
-
source: "provider" | "catalog" | null;
|
|
118
|
-
fetchedAt: string | null;
|
|
119
|
-
lastError: {
|
|
120
|
-
message: string;
|
|
121
|
-
occurredAt: string;
|
|
122
|
-
} | null;
|
|
123
|
-
};
|
|
124
|
-
type ProviderModelCatalogSnapshot = {
|
|
125
|
-
refreshIntervalMs: number;
|
|
126
|
-
refreshing: boolean;
|
|
127
|
-
lastRefreshStartedAt: string | null;
|
|
128
|
-
lastRefreshCompletedAt: string | null;
|
|
129
|
-
providers: Record<string, ProviderModelCatalogEntry>;
|
|
130
|
-
};
|
|
131
|
-
type ProviderModelCatalogManagerOptions = {
|
|
132
|
-
refreshIntervalMs?: number;
|
|
133
|
-
providerTimeoutMs?: number;
|
|
134
|
-
now?: () => Date;
|
|
135
|
-
};
|
|
136
|
-
declare class ProviderModelCatalogManager {
|
|
137
|
-
private readonly providerManager;
|
|
138
|
-
private config;
|
|
139
|
-
private readonly entries;
|
|
140
|
-
private readonly providerTimeoutMs;
|
|
141
|
-
private readonly refreshIntervalMs;
|
|
142
|
-
private readonly now;
|
|
143
|
-
private refreshTask;
|
|
144
|
-
private refreshPending;
|
|
145
|
-
private refreshTimer;
|
|
146
|
-
private started;
|
|
147
|
-
private lastRefreshStartedAt;
|
|
148
|
-
private lastRefreshCompletedAt;
|
|
149
|
-
constructor(providerManager: Pick<LlmProviderManager, "discoverModels" | "supportsModelDiscovery">, options?: ProviderModelCatalogManagerOptions);
|
|
150
|
-
load: (config: Config) => void;
|
|
151
|
-
start: () => void;
|
|
152
|
-
dispose: () => void;
|
|
153
|
-
refresh: () => Promise<void>;
|
|
154
|
-
getSnapshot: () => ProviderModelCatalogSnapshot;
|
|
155
|
-
private refreshConfiguredProviders;
|
|
156
|
-
private refreshProvider;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/managers/config.manager.d.ts
|
|
160
|
-
type ConfigManagerRuntimeHooks = {
|
|
161
|
-
resolveChannelConfig?: (config: Config) => Config;
|
|
162
|
-
getExtensionChannels?: () => ExtensionRegistry["channels"];
|
|
163
|
-
applyAgentRuntimeConfig?: (config: Config) => void;
|
|
164
|
-
reloadExtensions?: (params: {
|
|
165
|
-
config: Config;
|
|
166
|
-
changedPaths: string[];
|
|
167
|
-
}) => Promise<void> | void;
|
|
168
|
-
reloadCompanion?: (params: {
|
|
169
|
-
config: Config;
|
|
170
|
-
changedPaths: string[];
|
|
171
|
-
}) => Promise<void> | void;
|
|
172
|
-
reloadMcp?: (params: {
|
|
173
|
-
config: Config;
|
|
174
|
-
changedPaths: string[];
|
|
175
|
-
}) => Promise<void> | void;
|
|
176
|
-
onRestartRequired?: (paths: string[]) => void;
|
|
177
|
-
};
|
|
178
|
-
type ConfigManagerOptions = {
|
|
179
|
-
configPath?: string;
|
|
180
|
-
channels: ChannelManager;
|
|
181
|
-
diagnostics?: Pick<DiagnosticRuntime, "record">;
|
|
182
|
-
providerManager: LlmProviderManager;
|
|
183
|
-
providerModelCatalogManager?: Pick<ProviderModelCatalogManager, "load">;
|
|
184
|
-
};
|
|
185
|
-
type ConfigMutationResult = Record<string, unknown> & {
|
|
186
|
-
ok: boolean;
|
|
187
|
-
error?: string;
|
|
188
|
-
};
|
|
189
|
-
type RawConfigMutationParams = {
|
|
190
|
-
raw: string;
|
|
191
|
-
baseHash?: string;
|
|
192
|
-
note?: string;
|
|
193
|
-
version?: string;
|
|
194
|
-
};
|
|
195
|
-
declare class ConfigManager {
|
|
196
|
-
private readonly options;
|
|
197
|
-
readonly configPath: string;
|
|
198
|
-
private currentConfig;
|
|
199
|
-
private hooks;
|
|
200
|
-
private reloadTask;
|
|
201
|
-
private providerReloadTask;
|
|
202
|
-
private reloadTimer;
|
|
203
|
-
private reloadRunning;
|
|
204
|
-
private reloadPending;
|
|
205
|
-
constructor(options: ConfigManagerOptions);
|
|
206
|
-
get config(): Config;
|
|
207
|
-
loadConfig: () => Config;
|
|
208
|
-
getDefaultModel: () => string;
|
|
209
|
-
getModelMaxTokens: (model: string) => number | undefined;
|
|
210
|
-
installRuntimeHooks: (hooks: ConfigManagerRuntimeHooks) => (() => void);
|
|
211
|
-
applyLiveConfigReload: () => Promise<void>;
|
|
212
|
-
applyReloadPlan: (nextConfig: Config) => Promise<void>;
|
|
213
|
-
private recordConfigEvent;
|
|
214
|
-
getConfigSnapshot: (params?: {
|
|
215
|
-
version?: string;
|
|
216
|
-
}) => Record<string, unknown>;
|
|
217
|
-
getConfigSchema: (params?: {
|
|
218
|
-
version?: string;
|
|
219
|
-
}) => Record<string, unknown>;
|
|
220
|
-
applyRawConfig: (params: RawConfigMutationParams) => Promise<ConfigMutationResult>;
|
|
221
|
-
patchRawConfig: (params: RawConfigMutationParams) => Promise<ConfigMutationResult>;
|
|
222
|
-
applyConfig: (nextConfig: Config, note?: string) => Promise<ConfigMutationResult>;
|
|
223
|
-
scheduleReload: (reason: string) => void;
|
|
224
|
-
runReload: (_reason: string) => Promise<void>;
|
|
225
|
-
reloadConfig: (reason?: string) => Promise<string>;
|
|
226
|
-
rebuildChannels: (nextConfig: Config, options?: {
|
|
227
|
-
start?: boolean;
|
|
228
|
-
}) => Promise<void>;
|
|
229
|
-
private resolveChannelConfig;
|
|
230
|
-
private resolveExtensionChannels;
|
|
231
|
-
private reloadProvider;
|
|
232
|
-
private reloadMcp;
|
|
233
|
-
private reloadCompanion;
|
|
234
|
-
private readConfigSnapshot;
|
|
235
|
-
private redactConfig;
|
|
236
|
-
private validateBaseHash;
|
|
237
|
-
private validateConfigInput;
|
|
238
|
-
private mutateRawConfig;
|
|
239
|
-
private applyConfigChange;
|
|
240
|
-
private createConfigMutationResult;
|
|
241
|
-
}
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region src/managers/agent.manager.d.ts
|
|
244
|
-
type ResolvedAgentProfile = EffectiveAgentProfile & {
|
|
245
|
-
contextTokens: number;
|
|
246
|
-
model: string;
|
|
247
|
-
reservedContextTokens: number;
|
|
248
|
-
};
|
|
249
|
-
type AgentManagerOptions = {
|
|
250
|
-
configPath?: string;
|
|
251
|
-
initializeAgentHomeDirectory?: (homeDirectory: string) => void;
|
|
252
|
-
};
|
|
253
|
-
declare class AgentManager {
|
|
254
|
-
private readonly configManager?;
|
|
255
|
-
private readonly options;
|
|
256
|
-
constructor(configManager?: Pick<ConfigManager, "applyLiveConfigReload" | "loadConfig"> | undefined, options?: AgentManagerOptions);
|
|
257
|
-
listAgents: () => EffectiveAgentProfile[];
|
|
258
|
-
getAgent: (agentId: string) => EffectiveAgentProfile | null;
|
|
259
|
-
getDefaultAgentId: () => string;
|
|
260
|
-
resolveAgentProfile: (agentId?: string | null) => ResolvedAgentProfile;
|
|
261
|
-
resolveAgentProfileForContextWindow: (params: {
|
|
262
|
-
agentId: string;
|
|
263
|
-
contextTokens: number;
|
|
264
|
-
}) => ResolvedAgentProfile;
|
|
265
|
-
resolveAgentProfileForRun: (params?: {
|
|
266
|
-
agentId?: string | null;
|
|
267
|
-
requestMetadata?: Record<string, unknown>;
|
|
268
|
-
storedAgentId?: string | null;
|
|
269
|
-
}) => ResolvedAgentProfile;
|
|
270
|
-
createAgent: (input: CreateAgentProfileInput) => Promise<EffectiveAgentProfile>;
|
|
271
|
-
updateAgent: (input: UpdateAgentProfileInput) => Promise<EffectiveAgentProfile>;
|
|
272
|
-
removeAgent: (agentId: string) => Promise<boolean>;
|
|
273
|
-
private loadConfig;
|
|
274
|
-
private reloadLiveConfig;
|
|
275
|
-
private resolveAgentProfileFromConfig;
|
|
276
|
-
}
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region src/managers/context-provider.manager.d.ts
|
|
279
|
-
declare class ContextProviderManager {
|
|
280
|
-
private readonly providers;
|
|
281
|
-
register: (provider: ContextProvider) => (() => void);
|
|
282
|
-
buildContext: (request: AgentRunRequest) => Promise<readonly ContextBlock[]>;
|
|
283
|
-
dispose: () => void;
|
|
284
|
-
}
|
|
285
|
-
//#endregion
|
|
286
|
-
//#region src/managers/tool-provider.manager.d.ts
|
|
287
|
-
type ToolRunContext = {
|
|
288
|
-
agentId: string;
|
|
289
|
-
channel: string;
|
|
290
|
-
chatId: string;
|
|
291
|
-
config: Config;
|
|
292
|
-
execTimeoutSeconds: number;
|
|
293
|
-
handoffDepth: number;
|
|
294
|
-
metadata: Record<string, unknown>;
|
|
295
|
-
restrictToWorkspace: boolean;
|
|
296
|
-
searchConfig: SearchConfig;
|
|
297
|
-
sessionId: string;
|
|
298
|
-
workspace: string;
|
|
299
|
-
};
|
|
300
|
-
declare class ToolProviderManager {
|
|
301
|
-
private readonly diagnostics?;
|
|
302
|
-
private readonly providers;
|
|
303
|
-
private allowedToolNames;
|
|
304
|
-
constructor(diagnostics?: Pick<DiagnosticRuntime, "record"> | undefined);
|
|
305
|
-
register: (provider: ToolProvider) => (() => void);
|
|
306
|
-
/** An embedding may narrow the catalog before its first run. */
|
|
307
|
-
restrictToTools: (names: readonly string[]) => void;
|
|
308
|
-
buildTools: (request: AgentRunRequest) => Promise<readonly NcpTool[]>;
|
|
309
|
-
private readonly isAllowed;
|
|
310
|
-
dispose: () => void;
|
|
311
|
-
private readonly wrapTool;
|
|
312
|
-
}
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region src/managers/agent-context-window.manager.d.ts
|
|
315
|
-
type AgentContextWindowEvaluation = {
|
|
316
|
-
agentId: string;
|
|
317
|
-
contextTokens: number;
|
|
318
|
-
fixedInputTokens: number;
|
|
319
|
-
minimumContextTokens: number;
|
|
320
|
-
reservedContextTokens: number;
|
|
321
|
-
};
|
|
322
|
-
type AgentRunSurface = {
|
|
323
|
-
contextBlocks: readonly string[];
|
|
324
|
-
tools: readonly NcpTool[];
|
|
325
|
-
};
|
|
326
|
-
declare class AgentContextWindowManager {
|
|
327
|
-
private readonly agentManager;
|
|
328
|
-
private readonly contextProviderManager;
|
|
329
|
-
private readonly toolProviderManager;
|
|
330
|
-
private readonly runInputBudgetBySession;
|
|
331
|
-
private readonly preflightService;
|
|
332
|
-
constructor(agentManager: AgentManager, contextProviderManager: ContextProviderManager, toolProviderManager: ToolProviderManager, assetStore?: LocalAssetStore | null);
|
|
333
|
-
resolveRunSurface: (request: AgentRunRequest) => Promise<AgentRunSurface>;
|
|
334
|
-
forgetSession: (sessionId: string) => void;
|
|
335
|
-
previewSession: (params: {
|
|
336
|
-
requestMetadata: Record<string, unknown>;
|
|
337
|
-
sessionId: string;
|
|
338
|
-
sessionMessages: readonly NcpMessage[];
|
|
339
|
-
storedAgentId?: string;
|
|
340
|
-
storedMetadata: Record<string, unknown>;
|
|
341
|
-
}) => Promise<ContextWindowSnapshot | null>;
|
|
342
|
-
assertCanSave: (params: {
|
|
343
|
-
agentId: string;
|
|
344
|
-
contextTokens: number;
|
|
345
|
-
}) => Promise<AgentContextWindowEvaluation>;
|
|
346
|
-
assertDefaultCanSave: (contextTokens: number) => Promise<AgentContextWindowEvaluation[]>;
|
|
347
|
-
private createValidationRequest;
|
|
348
|
-
private estimateFixedInputTokens;
|
|
349
|
-
private resolveSessionFixedInputTokens;
|
|
350
|
-
private buildRunSurface;
|
|
351
|
-
private resolveMinimumContextTokens;
|
|
352
|
-
}
|
|
353
|
-
//#endregion
|
|
354
|
-
//#region src/utils/ncp-agent-session-journal.utils.d.ts
|
|
355
|
-
declare const NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE = "session.snapshot.message";
|
|
356
|
-
declare const NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE = "session.request.accepted";
|
|
357
|
-
declare const NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE = "session.request.completed";
|
|
358
|
-
declare const NCP_SESSION_REQUEST_FAILED_EVENT_TYPE = "session.request.failed";
|
|
359
|
-
type NcpAgentSessionSnapshotMessageEvent = {
|
|
360
|
-
type: typeof NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE;
|
|
361
|
-
payload: Extract<NcpEndpointEvent, {
|
|
362
|
-
type: NcpEventType.MessageSent;
|
|
363
|
-
}>["payload"];
|
|
364
|
-
};
|
|
365
|
-
type NcpSessionRequestJournalEventType = typeof NCP_SESSION_REQUEST_ACCEPTED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_COMPLETED_EVENT_TYPE | typeof NCP_SESSION_REQUEST_FAILED_EVENT_TYPE;
|
|
366
|
-
type NcpSessionRequestJournalEvent = {
|
|
367
|
-
type: NcpSessionRequestJournalEventType;
|
|
368
|
-
payload: {
|
|
369
|
-
sessionId: string;
|
|
370
|
-
request: unknown;
|
|
371
|
-
};
|
|
372
|
-
};
|
|
373
|
-
type NcpAgentSessionJournalReplayEvent = NcpEndpointEvent | NcpAgentSessionSnapshotMessageEvent | NcpSessionRequestJournalEvent;
|
|
374
|
-
//#endregion
|
|
375
|
-
//#region src/utils/ncp-agent-unfinished-run.utils.d.ts
|
|
376
|
-
type UnfinishedNcpAgentRun = {
|
|
377
|
-
sessionId: string;
|
|
378
|
-
messageId?: string;
|
|
379
|
-
runId?: string;
|
|
380
|
-
startedAt?: string;
|
|
381
|
-
};
|
|
382
|
-
//#endregion
|
|
383
|
-
//#region src/types/session.types.d.ts
|
|
384
|
-
type SessionMetadataUpdate = {
|
|
385
|
-
sessionId: string;
|
|
386
|
-
metadata: Record<string, unknown>;
|
|
387
|
-
expectedMetadata?: Record<string, unknown>;
|
|
388
|
-
};
|
|
389
|
-
type SessionMessagePage = {
|
|
390
|
-
messages: NcpMessage[];
|
|
391
|
-
messageDetailCursors: Record<string, string>;
|
|
392
|
-
total: number;
|
|
393
|
-
pageInfo: NcpSessionMessagePageInfo;
|
|
394
|
-
contextWindow: Record<string, unknown> | null;
|
|
395
|
-
};
|
|
396
|
-
type SessionTokenUsageStatus = "reported" | "partial" | "unavailable";
|
|
397
|
-
type SessionTokenUsageTotals = {
|
|
398
|
-
inputTokens: number | null;
|
|
399
|
-
outputTokens: number | null;
|
|
400
|
-
cachedInputTokens: number | null;
|
|
401
|
-
totalTokens: number | null;
|
|
402
|
-
cacheHitRate: number | null;
|
|
403
|
-
};
|
|
404
|
-
type SessionModelTokenUsage = SessionTokenUsageTotals & {
|
|
405
|
-
model: string;
|
|
406
|
-
runCount: number;
|
|
407
|
-
modelCallCount: number | null;
|
|
408
|
-
reportedModelCallCount: number | null;
|
|
409
|
-
status: SessionTokenUsageStatus;
|
|
410
|
-
};
|
|
411
|
-
type SessionTokenUsageSummary = {
|
|
412
|
-
sessionId: string;
|
|
413
|
-
totals: SessionTokenUsageTotals;
|
|
414
|
-
models: SessionModelTokenUsage[];
|
|
415
|
-
runCount: number;
|
|
416
|
-
modelCallCount: number | null;
|
|
417
|
-
reportedModelCallCount: number | null;
|
|
418
|
-
status: SessionTokenUsageStatus;
|
|
419
|
-
};
|
|
420
|
-
declare class SessionMessageCursorError extends Error {
|
|
421
|
-
constructor(message?: string);
|
|
422
|
-
}
|
|
423
|
-
declare function isSessionMessageCursorError(error: unknown): error is SessionMessageCursorError;
|
|
424
|
-
type AgentRunSession = {
|
|
425
|
-
sessionId: string;
|
|
426
|
-
agentId?: string;
|
|
427
|
-
agentRuntimeId: string;
|
|
428
|
-
metadata: Record<string, unknown>;
|
|
429
|
-
model?: string;
|
|
430
|
-
projectRoot?: string;
|
|
431
|
-
projectId?: string;
|
|
432
|
-
workingDir: string;
|
|
433
|
-
thinkingEffort?: ThinkingEffort | null;
|
|
434
|
-
};
|
|
435
|
-
type CreateAgentRunSessionParams = {
|
|
436
|
-
sessionId?: string;
|
|
437
|
-
peerId?: string;
|
|
438
|
-
agentId?: string;
|
|
439
|
-
agentRuntimeId?: string;
|
|
440
|
-
channel?: string;
|
|
441
|
-
metadata?: Record<string, unknown>;
|
|
442
|
-
model?: string;
|
|
443
|
-
parentSessionId?: string;
|
|
444
|
-
projectRoot?: string;
|
|
445
|
-
sourceSessionId?: string;
|
|
446
|
-
sourceSessionMetadata?: Record<string, unknown>;
|
|
447
|
-
contextInheritance?: CreateSessionContextInheritanceInput;
|
|
448
|
-
task?: string;
|
|
449
|
-
thinkingEffort?: ThinkingEffort | null;
|
|
450
|
-
};
|
|
451
|
-
type SessionSettingsPatch = {
|
|
452
|
-
label?: string | null;
|
|
453
|
-
preferredModel?: string | null;
|
|
454
|
-
preferredThinking?: string | null;
|
|
455
|
-
sessionType?: string | null;
|
|
456
|
-
projectRoot?: string | null;
|
|
457
|
-
uiReadAt?: string | null;
|
|
458
|
-
};
|
|
459
|
-
declare class SessionSettingsError extends Error {
|
|
460
|
-
readonly code: "PREFERRED_THINKING_INVALID";
|
|
461
|
-
constructor(code: "PREFERRED_THINKING_INVALID", message: string);
|
|
462
|
-
}
|
|
463
|
-
declare function isSessionSettingsError(error: unknown): error is SessionSettingsError;
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/stores/ncp-agent-session-journal.store.d.ts
|
|
466
|
-
declare class NcpAgentSessionJournalStore {
|
|
467
|
-
private readonly journalDir;
|
|
468
|
-
private readonly sessions;
|
|
469
|
-
private readonly nextSeqBySession;
|
|
470
|
-
private readonly writeChains;
|
|
471
|
-
private readonly metadataStore;
|
|
472
|
-
private readonly messageProjectionStore;
|
|
473
|
-
private readonly journalLoaderStore;
|
|
474
|
-
private readonly unfinishedRunStore;
|
|
475
|
-
private readonly summaryIndexStore;
|
|
476
|
-
private readonly summaryReadStore;
|
|
477
|
-
constructor(journalDir: string);
|
|
478
|
-
initialize: () => Promise<void>;
|
|
479
|
-
close: () => void;
|
|
480
|
-
appendSessionEvent: (params: {
|
|
481
|
-
sessionId: string;
|
|
482
|
-
event: NcpAgentSessionJournalReplayEvent;
|
|
483
|
-
}) => Promise<void>;
|
|
484
|
-
synchronizeSessionMessageProjection: (sessionId: string) => Promise<boolean>;
|
|
485
|
-
getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
486
|
-
listSessionSummaries: (options?: {
|
|
487
|
-
limit?: number;
|
|
488
|
-
}) => Promise<NcpSessionSummary[]>;
|
|
489
|
-
listSessionSummaryPage: (options: {
|
|
490
|
-
page: number;
|
|
491
|
-
pageSize: number;
|
|
492
|
-
query?: string;
|
|
493
|
-
}) => Promise<{
|
|
494
|
-
sessions: NcpSessionSummary[];
|
|
495
|
-
total: number;
|
|
496
|
-
}>;
|
|
497
|
-
getSessionSummary: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
498
|
-
listUnfinishedRuns: () => Promise<UnfinishedNcpAgentRun[]>;
|
|
499
|
-
listSessionMessages: (sessionId: string) => Promise<NcpMessage[]>;
|
|
500
|
-
listSessionMessagePage: (params: {
|
|
501
|
-
sessionId: string;
|
|
502
|
-
limit: number;
|
|
503
|
-
cursor?: string;
|
|
504
|
-
}) => Promise<SessionMessagePage | null>;
|
|
505
|
-
updateSessionMessageProjectionContextWindow: (sessionId: string, contextWindow: Record<string, unknown> | null) => Promise<void>;
|
|
506
|
-
getSessionMessageProjectionContextWindow: (sessionId: string) => Promise<Record<string, unknown> | null>;
|
|
507
|
-
setSessionMetadata: (params: {
|
|
508
|
-
sessionId: string;
|
|
509
|
-
metadata: Record<string, unknown>;
|
|
510
|
-
}) => Promise<boolean>;
|
|
511
|
-
updateSessionMetadata: (params: SessionMetadataUpdate) => Promise<boolean>;
|
|
512
|
-
private setSessionMetadataNow;
|
|
513
|
-
private updateSessionMetadataNow;
|
|
514
|
-
importSessionSnapshot: (record: AgentSessionRecord) => Promise<void>;
|
|
515
|
-
deleteSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
516
|
-
hasSession: (sessionId: string) => Promise<boolean>;
|
|
517
|
-
private appendSessionEventNow;
|
|
518
|
-
private loadSession;
|
|
519
|
-
private appendJournalEntry;
|
|
520
|
-
private ensureJournalDir;
|
|
521
|
-
private sessionPath;
|
|
522
|
-
}
|
|
523
|
-
//#endregion
|
|
524
|
-
//#region src/features/projects/types/project.types.d.ts
|
|
525
|
-
declare const PROJECT_TEMPLATE_IDS: readonly ["empty", "knowledge-base"];
|
|
526
|
-
type ProjectTemplateId = (typeof PROJECT_TEMPLATE_IDS)[number];
|
|
527
|
-
type ProjectTemplate = {
|
|
528
|
-
id: ProjectTemplateId;
|
|
529
|
-
name: string;
|
|
530
|
-
description: string;
|
|
531
|
-
};
|
|
532
|
-
type ProjectRecord = {
|
|
533
|
-
id: string;
|
|
534
|
-
name: string;
|
|
535
|
-
rootPath: string;
|
|
536
|
-
template?: ProjectTemplateId;
|
|
537
|
-
createdAt: string;
|
|
538
|
-
updatedAt: string;
|
|
539
|
-
};
|
|
540
|
-
type CreateProjectInput = {
|
|
541
|
-
name: string;
|
|
542
|
-
rootPath?: string;
|
|
543
|
-
template?: ProjectTemplateId;
|
|
544
|
-
};
|
|
545
|
-
type ProjectSessionBinding = {
|
|
546
|
-
projectId: string;
|
|
547
|
-
rootPath: string;
|
|
548
|
-
};
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region src/features/projects/managers/project.manager.d.ts
|
|
551
|
-
type ProjectManagerOptions = {
|
|
552
|
-
databasePath: string;
|
|
553
|
-
legacyStorePath: string;
|
|
554
|
-
getDefaultWorkspacePath: () => string;
|
|
555
|
-
onProjectRegistered?: (project: ProjectRecord) => Promise<void>;
|
|
556
|
-
};
|
|
557
|
-
type ProjectErrorCode = "PROJECT_NAME_INVALID" | "PROJECT_PATH_INVALID_TYPE" | "PROJECT_PATH_NOT_FOUND" | "PROJECT_PATH_NOT_DIRECTORY" | "PROJECT_PATH_IS_DEFAULT_WORKSPACE" | "PROJECT_PATH_NOT_EMPTY" | "PROJECT_TEMPLATE_INVALID" | "PROJECT_NOT_FOUND" | "PROJECT_REMOVE_CONFIRMATION_MISMATCH";
|
|
558
|
-
declare class ProjectError extends Error {
|
|
559
|
-
readonly code: ProjectErrorCode;
|
|
560
|
-
constructor(code: ProjectErrorCode, message: string);
|
|
561
|
-
}
|
|
562
|
-
declare function isProjectError(error: unknown): error is ProjectError;
|
|
563
|
-
declare class ProjectManager {
|
|
564
|
-
private readonly options;
|
|
565
|
-
private readonly store;
|
|
566
|
-
constructor(options: ProjectManagerOptions);
|
|
567
|
-
initialize: () => Promise<void>;
|
|
568
|
-
dispose: () => void;
|
|
569
|
-
listProjects: () => Promise<ProjectRecord[]>;
|
|
570
|
-
getProjectById: (projectId: string) => Promise<ProjectRecord | null>;
|
|
571
|
-
getRegisteredProject: (rootPath: unknown) => Promise<ProjectRecord | null>;
|
|
572
|
-
listTemplates: () => ProjectTemplate[];
|
|
573
|
-
createProject: (input: CreateProjectInput) => Promise<ProjectRecord>;
|
|
574
|
-
addExistingProject: (rootPath: unknown, name?: string) => Promise<ProjectRecord | null>;
|
|
575
|
-
registerExistingProject: (rootPath: unknown, name?: string) => Promise<ProjectRecord | null>;
|
|
576
|
-
removeProject: (projectId: string, confirmProjectId: string) => Promise<ProjectRecord>;
|
|
577
|
-
normalizeSessionProjectRoot: (value: unknown) => Promise<string | null>;
|
|
578
|
-
normalizeSessionProjectContext: (value: unknown) => Promise<ProjectSessionBinding | null>;
|
|
579
|
-
resolveExistingProjectRoot: (value: unknown) => Promise<string | null>;
|
|
580
|
-
private upsertProject;
|
|
581
|
-
private assertNotDefaultWorkspace;
|
|
582
|
-
private isDefaultWorkspace;
|
|
583
|
-
private materializeTemplate;
|
|
584
|
-
private readPathState;
|
|
585
|
-
private normalizeName;
|
|
586
|
-
private normalizeTemplate;
|
|
587
|
-
private resolvePath;
|
|
588
|
-
private resolveDefaultWorkspacePath;
|
|
589
|
-
private isMissingFileError;
|
|
590
|
-
}
|
|
591
|
-
//#endregion
|
|
592
|
-
//#region src/features/projects/types/project-work.types.d.ts
|
|
593
|
-
declare const PROJECT_WORK_STATE_CATEGORIES: readonly ["backlog", "unstarted", "started", "completed", "canceled"];
|
|
594
|
-
type ProjectWorkStateCategory = (typeof PROJECT_WORK_STATE_CATEGORIES)[number];
|
|
595
|
-
declare const PROJECT_WORK_ATTENTION_VALUES: readonly ["none", "blocked", "awaiting-user"];
|
|
596
|
-
type ProjectWorkAttention = (typeof PROJECT_WORK_ATTENTION_VALUES)[number];
|
|
597
|
-
type ProjectWorkActor = {
|
|
598
|
-
kind: "agent" | "cli" | "system" | "user";
|
|
599
|
-
id?: string;
|
|
600
|
-
sessionId?: string;
|
|
601
|
-
};
|
|
602
|
-
type ProjectWorkState = {
|
|
603
|
-
id: string;
|
|
604
|
-
projectId: string;
|
|
605
|
-
name: string;
|
|
606
|
-
category: ProjectWorkStateCategory;
|
|
607
|
-
position: number;
|
|
608
|
-
isDefault: boolean;
|
|
609
|
-
createdAt: string;
|
|
610
|
-
updatedAt: string;
|
|
611
|
-
};
|
|
612
|
-
type ProjectWorkItem = {
|
|
613
|
-
id: string;
|
|
614
|
-
projectId: string;
|
|
615
|
-
title: string;
|
|
616
|
-
description: string;
|
|
617
|
-
stateId: string;
|
|
618
|
-
attention: ProjectWorkAttention;
|
|
619
|
-
version: number;
|
|
620
|
-
createdAt: string;
|
|
621
|
-
updatedAt: string;
|
|
622
|
-
deletedAt: string | null;
|
|
623
|
-
};
|
|
624
|
-
type ProjectWorkActivityType = "artifact-linked" | "artifact-unlinked" | "created" | "deleted" | "restored" | "state-changed" | "updated";
|
|
625
|
-
type ProjectWorkActivity = {
|
|
626
|
-
id: string;
|
|
627
|
-
projectId: string;
|
|
628
|
-
workItemId: string;
|
|
629
|
-
type: ProjectWorkActivityType;
|
|
630
|
-
actor: ProjectWorkActor;
|
|
631
|
-
details: Record<string, unknown>;
|
|
632
|
-
createdAt: string;
|
|
633
|
-
};
|
|
634
|
-
type ProjectWorkArtifactLink = {
|
|
635
|
-
id: string;
|
|
636
|
-
projectId: string;
|
|
637
|
-
workItemId: string;
|
|
638
|
-
path: string;
|
|
639
|
-
label: string | null;
|
|
640
|
-
createdAt: string;
|
|
641
|
-
};
|
|
642
|
-
type ProjectWorkItemDetail = ProjectWorkItem & {
|
|
643
|
-
state: ProjectWorkState;
|
|
644
|
-
artifacts: ProjectWorkArtifactLink[];
|
|
645
|
-
};
|
|
646
|
-
type ProjectWorkItemListEntry = ProjectWorkItem & {
|
|
647
|
-
state: ProjectWorkState;
|
|
648
|
-
artifactCount: number;
|
|
649
|
-
};
|
|
650
|
-
type ProjectWorkListInput = {
|
|
651
|
-
stateId?: string;
|
|
652
|
-
includeDeleted?: boolean;
|
|
653
|
-
cursor?: string;
|
|
654
|
-
limit?: number;
|
|
655
|
-
};
|
|
656
|
-
type ProjectWorkItemPage = {
|
|
657
|
-
items: ProjectWorkItemListEntry[];
|
|
658
|
-
nextCursor: string | null;
|
|
659
|
-
total: number;
|
|
660
|
-
};
|
|
661
|
-
type ProjectRecentArtifact = {
|
|
662
|
-
id: string;
|
|
663
|
-
path: string;
|
|
664
|
-
label: string | null;
|
|
665
|
-
workItemId: string;
|
|
666
|
-
workItemTitle: string;
|
|
667
|
-
createdAt: string;
|
|
668
|
-
exists: boolean;
|
|
669
|
-
};
|
|
670
|
-
type ProjectRecentArtifactPage = {
|
|
671
|
-
artifacts: ProjectRecentArtifact[];
|
|
672
|
-
nextCursor: string | null;
|
|
673
|
-
total: number;
|
|
674
|
-
};
|
|
675
|
-
type ProjectWorkSummary = {
|
|
676
|
-
active: number;
|
|
677
|
-
attention: number;
|
|
678
|
-
completed: number;
|
|
679
|
-
total: number;
|
|
680
|
-
updatedAt: string | null;
|
|
681
|
-
};
|
|
682
|
-
type ProjectWorkActivityPage = {
|
|
683
|
-
activities: ProjectWorkActivity[];
|
|
684
|
-
nextCursor: string | null;
|
|
685
|
-
};
|
|
686
|
-
type CreateProjectWorkItemInput = {
|
|
687
|
-
title: string;
|
|
688
|
-
description?: string;
|
|
689
|
-
stateId?: string;
|
|
690
|
-
attention?: ProjectWorkAttention;
|
|
691
|
-
};
|
|
692
|
-
type UpdateProjectWorkItemInput = {
|
|
693
|
-
title?: string;
|
|
694
|
-
description?: string;
|
|
695
|
-
stateId?: string;
|
|
696
|
-
attention?: ProjectWorkAttention;
|
|
697
|
-
expectedVersion?: number;
|
|
698
|
-
};
|
|
699
|
-
type CreateProjectWorkStateInput = {
|
|
700
|
-
name: string;
|
|
701
|
-
category: ProjectWorkStateCategory;
|
|
702
|
-
position?: number;
|
|
703
|
-
isDefault?: boolean;
|
|
704
|
-
};
|
|
705
|
-
type UpdateProjectWorkStateInput = {
|
|
706
|
-
name?: string;
|
|
707
|
-
category?: ProjectWorkStateCategory;
|
|
708
|
-
position?: number;
|
|
709
|
-
isDefault?: boolean;
|
|
710
|
-
};
|
|
711
|
-
//#endregion
|
|
712
|
-
//#region src/features/projects/managers/project-work.manager.d.ts
|
|
713
|
-
declare class ProjectWorkManager {
|
|
714
|
-
private readonly options;
|
|
715
|
-
private readonly store;
|
|
716
|
-
private readonly queries;
|
|
717
|
-
constructor(options: {
|
|
718
|
-
databasePath: string;
|
|
719
|
-
eventBus: EventBus;
|
|
720
|
-
projectManager: ProjectManager;
|
|
721
|
-
});
|
|
722
|
-
initialize: () => Promise<void>;
|
|
723
|
-
dispose: () => void;
|
|
724
|
-
ensureProject: (projectId: string) => Promise<void>;
|
|
725
|
-
list: (projectId: string, input?: ProjectWorkListInput) => Promise<ProjectWorkItemPage>;
|
|
726
|
-
summary: (projectId: string) => Promise<ProjectWorkSummary>;
|
|
727
|
-
listRecentArtifacts: (projectId: string, input?: {
|
|
728
|
-
cursor?: string;
|
|
729
|
-
limit?: number;
|
|
730
|
-
query?: string;
|
|
731
|
-
}) => Promise<ProjectRecentArtifactPage>;
|
|
732
|
-
get: (projectId: string, workItemId: string) => Promise<ProjectWorkItemDetail>;
|
|
733
|
-
create: (projectId: string, input: CreateProjectWorkItemInput, actor: ProjectWorkActor) => Promise<ProjectWorkItemDetail>;
|
|
734
|
-
update: (projectId: string, workItemId: string, input: UpdateProjectWorkItemInput, actor: ProjectWorkActor) => Promise<ProjectWorkItemDetail>;
|
|
735
|
-
delete: (projectId: string, workItemId: string, actor: ProjectWorkActor) => Promise<ProjectWorkItemDetail>;
|
|
736
|
-
restore: (projectId: string, workItemId: string, actor: ProjectWorkActor) => Promise<ProjectWorkItemDetail>;
|
|
737
|
-
listActivities: (projectId: string, workItemId: string, options?: {
|
|
738
|
-
cursor?: string;
|
|
739
|
-
limit?: number;
|
|
740
|
-
}) => Promise<ProjectWorkActivityPage>;
|
|
741
|
-
listStates: (projectId: string) => Promise<ProjectWorkState[]>;
|
|
742
|
-
createState: (projectId: string, input: CreateProjectWorkStateInput) => Promise<ProjectWorkState>;
|
|
743
|
-
updateState: (projectId: string, stateId: string, input: UpdateProjectWorkStateInput) => Promise<ProjectWorkState>;
|
|
744
|
-
deleteState: (projectId: string, stateId: string, migrateToStateId: string | null, actor: ProjectWorkActor) => Promise<void>;
|
|
745
|
-
linkArtifact: (params: {
|
|
746
|
-
projectId: string;
|
|
747
|
-
workItemId: string;
|
|
748
|
-
path: string;
|
|
749
|
-
label?: string;
|
|
750
|
-
actor: ProjectWorkActor;
|
|
751
|
-
}) => Promise<ProjectWorkArtifactLink>;
|
|
752
|
-
unlinkArtifact: (params: {
|
|
753
|
-
projectId: string;
|
|
754
|
-
workItemId: string;
|
|
755
|
-
artifactLinkId: string;
|
|
756
|
-
actor: ProjectWorkActor;
|
|
757
|
-
}) => Promise<void>;
|
|
758
|
-
private setDeleted;
|
|
759
|
-
private requireProject;
|
|
760
|
-
private requireName;
|
|
761
|
-
private assertAttention;
|
|
762
|
-
private assertCategory;
|
|
763
|
-
private normalizeActor;
|
|
764
|
-
private normalizeArtifactPath;
|
|
765
|
-
private emit;
|
|
766
|
-
}
|
|
767
|
-
//#endregion
|
|
768
|
-
//#region src/features/projects/types/project-material.types.d.ts
|
|
769
|
-
type ProjectAgreementMaterial = {
|
|
770
|
-
path: "AGENTS.md";
|
|
771
|
-
available: boolean;
|
|
772
|
-
};
|
|
773
|
-
type ProjectSkillMaterial = {
|
|
774
|
-
ref: string;
|
|
775
|
-
name: string;
|
|
776
|
-
description?: string;
|
|
777
|
-
path: string;
|
|
778
|
-
};
|
|
779
|
-
//#endregion
|
|
780
|
-
//#region src/features/projects/services/project-material.service.d.ts
|
|
781
|
-
declare class ProjectMaterialService {
|
|
782
|
-
private readonly options;
|
|
783
|
-
constructor(options: {
|
|
784
|
-
projectManager: Pick<ProjectManager, "getProjectById">;
|
|
785
|
-
});
|
|
786
|
-
getAgreement: (projectId: string) => Promise<ProjectAgreementMaterial>;
|
|
787
|
-
listSkills: (projectId: string) => Promise<ProjectSkillMaterial[]>;
|
|
788
|
-
private requireProject;
|
|
789
|
-
private isFile;
|
|
790
|
-
}
|
|
791
|
-
//#endregion
|
|
792
|
-
//#region src/features/projects/types/project-work-error.types.d.ts
|
|
793
|
-
type ProjectWorkErrorCode = "PROJECT_NOT_FOUND" | "PROJECT_WORK_ARTIFACT_INVALID" | "PROJECT_WORK_ARTIFACT_NOT_FOUND" | "PROJECT_WORK_ITEM_NOT_FOUND" | "PROJECT_WORK_STATE_IN_USE" | "PROJECT_WORK_STATE_INVALID" | "PROJECT_WORK_STATE_NOT_FOUND" | "PROJECT_WORK_VALIDATION_FAILED" | "PROJECT_WORK_VERSION_CONFLICT";
|
|
794
|
-
declare class ProjectWorkError extends Error {
|
|
795
|
-
readonly code: ProjectWorkErrorCode;
|
|
796
|
-
constructor(code: ProjectWorkErrorCode, message: string);
|
|
797
|
-
}
|
|
798
|
-
declare function isProjectWorkError(error: unknown): error is ProjectWorkError;
|
|
799
|
-
//#endregion
|
|
800
|
-
//#region src/services/session-event-coordinator.service.d.ts
|
|
801
|
-
type PublishSessionEventParams = {
|
|
802
|
-
sessionId: string;
|
|
803
|
-
event: NcpEndpointEvent;
|
|
804
|
-
source: string;
|
|
805
|
-
synchronizeMessageProjection?: boolean;
|
|
806
|
-
persistFirst?: boolean;
|
|
807
|
-
};
|
|
808
|
-
//#endregion
|
|
809
|
-
//#region src/managers/session.manager.d.ts
|
|
810
|
-
type CreateNcpSessionInput = CreateSessionInput & {
|
|
811
|
-
sessionId?: string;
|
|
812
|
-
};
|
|
813
|
-
type SessionManagerOptions = {
|
|
814
|
-
providerManager?: LlmProviderRuntime;
|
|
815
|
-
agentContextWindowManager: AgentContextWindowManager;
|
|
816
|
-
agentManager: AgentManager;
|
|
817
|
-
configManager: ConfigManager;
|
|
818
|
-
eventBus: EventBus;
|
|
819
|
-
journalStore: NcpAgentSessionJournalStore;
|
|
820
|
-
projectManager: ProjectManager;
|
|
821
|
-
sessionSearch: SessionSearchService;
|
|
822
|
-
beforeDeleteSession?: (sessionId: string) => Promise<void>;
|
|
823
|
-
};
|
|
824
|
-
declare class SessionManager implements NcpSessionApi {
|
|
825
|
-
private readonly options;
|
|
826
|
-
private readonly titles?;
|
|
827
|
-
private readonly sessionEvents;
|
|
828
|
-
private readonly settings;
|
|
829
|
-
private readonly summaryProjection;
|
|
830
|
-
private readonly workingDirResolver;
|
|
831
|
-
constructor(options: SessionManagerOptions);
|
|
832
|
-
start: () => Promise<void>;
|
|
833
|
-
dispose: () => void;
|
|
834
|
-
close: () => Promise<void>;
|
|
835
|
-
publishSessionEvent: (params: PublishSessionEventParams) => Promise<void>;
|
|
836
|
-
flushSessionEvents: () => Promise<void>;
|
|
837
|
-
createSession: (params: CreateNcpSessionInput) => Promise<CreatedSession>;
|
|
838
|
-
appendSessionEvent: (params: {
|
|
839
|
-
sessionId: string;
|
|
840
|
-
event: NcpAgentSessionJournalReplayEvent;
|
|
841
|
-
}) => Promise<void>;
|
|
842
|
-
applyGeneratedTitle: (sessionId: string, expectedMetadata: Record<string, unknown>, title: string | null, messageId: string) => Promise<boolean>;
|
|
843
|
-
setSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
844
|
-
updateSessionMetadata: (sessionId: string, metadata: Record<string, unknown>) => Promise<boolean>;
|
|
845
|
-
private writeSessionMetadata;
|
|
846
|
-
updateSession: (sessionId: string, patch: NcpSessionPatch) => Promise<NcpSessionSummary | null>;
|
|
847
|
-
patchSessionSettings: (sessionId: string, patch: SessionSettingsPatch, options?: {
|
|
848
|
-
createIfMissing?: boolean;
|
|
849
|
-
}) => Promise<NcpSessionSummary | null>;
|
|
850
|
-
deleteSession: (sessionId: string) => Promise<void>;
|
|
851
|
-
getSessionRecord: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
852
|
-
listSessions: (options?: ListSessionsOptions) => Promise<NcpSessionSummary[]>;
|
|
853
|
-
listSessionPage: (options: {
|
|
854
|
-
page: number;
|
|
855
|
-
pageSize: number;
|
|
856
|
-
query?: string;
|
|
857
|
-
}) => Promise<{
|
|
858
|
-
sessions: NcpSessionSummary[];
|
|
859
|
-
total: number;
|
|
860
|
-
}>;
|
|
861
|
-
listSessionMessages: (sessionId: string, options?: ListMessagesOptions) => Promise<NcpMessage[]>;
|
|
862
|
-
getSessionTokenUsage: (sessionId: string) => Promise<SessionTokenUsageSummary | null>;
|
|
863
|
-
listSessionMessagePage: (sessionId: string, options: {
|
|
864
|
-
limit: number;
|
|
865
|
-
cursor?: string;
|
|
866
|
-
}) => Promise<SessionMessagePage | null>;
|
|
867
|
-
getSession: (sessionId: string) => Promise<NcpSessionSummary | null>;
|
|
868
|
-
getContextWindow: (sessionId: string, liveRecord?: AgentSessionRecord | null) => Promise<Record<string, unknown> | null>;
|
|
869
|
-
getAgentRunSession: (sessionId: string) => Promise<AgentRunSession>;
|
|
870
|
-
createAgentRunSession: (params: CreateAgentRunSessionParams) => Promise<AgentRunSession>;
|
|
871
|
-
getOrCreateAgentRunSession: (params: CreateAgentRunSessionParams) => Promise<AgentRunSession>;
|
|
872
|
-
private toAgentRunSession;
|
|
873
|
-
patchSessionMetadata: (sessionId: string, patch: Record<string, unknown>) => Promise<void>;
|
|
874
|
-
clearSessionMessages: (sessionId: string) => Promise<number>;
|
|
875
|
-
rewindSessionBeforeMessage: (sessionId: string, messageId: string) => Promise<AgentSessionRecord>;
|
|
876
|
-
publishSessionChange: (sessionKey: string) => Promise<void>;
|
|
877
|
-
}
|
|
878
|
-
//#endregion
|
|
879
|
-
//#region src/types/product-activity.types.d.ts
|
|
880
|
-
type ProductActivityKind = "intent_accepted" | "run_succeeded";
|
|
881
|
-
type ProductActivitySource = "direct" | "channel";
|
|
882
|
-
type ProductActivitySignal = {
|
|
883
|
-
kind: ProductActivityKind;
|
|
884
|
-
occurredAt: string;
|
|
885
|
-
source: ProductActivitySource;
|
|
886
|
-
};
|
|
887
|
-
type ProductActivitySink = {
|
|
888
|
-
record: (signal: ProductActivitySignal) => Promise<void> | void;
|
|
889
|
-
};
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region src/managers/session-run.manager.d.ts
|
|
892
|
-
type SessionRunQueuedRequest = {
|
|
893
|
-
id: string;
|
|
894
|
-
runId: string;
|
|
895
|
-
enqueuedAt: string;
|
|
896
|
-
request: AgentRunRequest;
|
|
897
|
-
session: AgentRunSession;
|
|
898
|
-
};
|
|
899
|
-
type SessionRunActiveRequest = SessionRunQueuedRequest & {
|
|
900
|
-
signal: AbortSignal;
|
|
901
|
-
};
|
|
902
|
-
type SessionRunPendingRequest = SessionRunQueuedRequest & {
|
|
903
|
-
placement: "queued" | "steering";
|
|
904
|
-
intendedRunId: string | null;
|
|
905
|
-
};
|
|
906
|
-
declare class SessionRun {
|
|
907
|
-
private readonly stateManager;
|
|
908
|
-
private readonly productActivitySink?;
|
|
909
|
-
readonly sessionId: string;
|
|
910
|
-
private readonly statusListeners;
|
|
911
|
-
private readonly pendingInputs;
|
|
912
|
-
private activeRunId;
|
|
913
|
-
private activeRunController;
|
|
914
|
-
private activeProductActivitySource;
|
|
915
|
-
constructor(seed: {
|
|
916
|
-
sessionId: string;
|
|
917
|
-
messages: readonly NcpMessage[];
|
|
918
|
-
}, stateManager?: NcpAgentConversationStateManager, productActivitySink?: ProductActivitySink | undefined);
|
|
919
|
-
getSnapshot: () => {
|
|
920
|
-
messages: readonly NcpMessage[];
|
|
921
|
-
};
|
|
922
|
-
applyEvents: (events: readonly NcpEndpointEvent[]) => Promise<void>;
|
|
923
|
-
replaceMessages: (messages: readonly NcpMessage[]) => void;
|
|
924
|
-
onStatusChange: (listener: (status: "idle" | "running") => void) => (() => void);
|
|
925
|
-
enqueueRequest: (request: AgentRunRequest, session: AgentRunSession) => SessionRunQueuedRequest;
|
|
926
|
-
listQueuedRequests: () => readonly SessionRunQueuedRequest[];
|
|
927
|
-
listPendingRequests: () => readonly SessionRunPendingRequest[];
|
|
928
|
-
removeQueuedRequest: (queuedRequestId: string) => SessionRunQueuedRequest | null;
|
|
929
|
-
moveQueuedRequestToNextStep: (queuedRequestId: string) => SessionRunPendingRequest | null;
|
|
930
|
-
claimNextStepRequests: (runId: string) => readonly SessionRunPendingRequest[];
|
|
931
|
-
acknowledgeNextStepRequests: (requestIds: readonly string[]) => void;
|
|
932
|
-
getActiveRunId: () => string | null;
|
|
933
|
-
beginNextRun: () => SessionRunActiveRequest | null;
|
|
934
|
-
abortRun: (runId?: string, reason?: unknown) => boolean;
|
|
935
|
-
isRunning: () => boolean;
|
|
936
|
-
isBusy: () => boolean;
|
|
937
|
-
dispose: () => void;
|
|
938
|
-
private applyRunEvents;
|
|
939
|
-
private emitStatusChangeIfNeeded;
|
|
940
|
-
}
|
|
941
|
-
declare class SessionRunManager {
|
|
942
|
-
private readonly sessionManager;
|
|
943
|
-
private readonly productActivitySink?;
|
|
944
|
-
private readonly runs;
|
|
945
|
-
private readonly pendingCreations;
|
|
946
|
-
constructor(sessionManager: SessionManager, productActivitySink?: ProductActivitySink | undefined);
|
|
947
|
-
getSessionRun: (sessionId: string) => SessionRun | null;
|
|
948
|
-
isSessionRunning: (sessionId: string) => boolean;
|
|
949
|
-
listActiveRuns: () => ReadonlyArray<{
|
|
950
|
-
sessionId: string;
|
|
951
|
-
runId: string;
|
|
952
|
-
}>;
|
|
953
|
-
getOrCreateSessionRun: (sessionId: string) => Promise<SessionRun>;
|
|
954
|
-
createSessionRun: (sessionId: string) => Promise<SessionRun>;
|
|
955
|
-
deleteSessionRun: (sessionId: string) => boolean;
|
|
956
|
-
dispose: () => void;
|
|
957
|
-
}
|
|
958
|
-
//#endregion
|
|
959
|
-
//#region src/services/agent-run-client.service.d.ts
|
|
960
|
-
type AgentRunReplyOptions = {
|
|
961
|
-
abortSignal?: AbortSignal;
|
|
962
|
-
onAssistantDelta?: (delta: string) => void;
|
|
963
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
964
|
-
missingCompletedMessageError?: string;
|
|
965
|
-
runErrorMessage?: string;
|
|
966
|
-
};
|
|
967
|
-
type AgentRunStreamOptions = {
|
|
968
|
-
abortSignal?: AbortSignal;
|
|
969
|
-
onEvent?: (event: NcpEndpointEvent) => void;
|
|
970
|
-
};
|
|
971
|
-
type AgentRunReply = {
|
|
972
|
-
handle: NcpRunHandle;
|
|
973
|
-
text: string;
|
|
974
|
-
completedMessage: NcpMessage;
|
|
975
|
-
};
|
|
976
|
-
type AgentRunExecution = {
|
|
977
|
-
handle: NcpRunHandle;
|
|
978
|
-
events: AsyncIterable<NcpEndpointEvent>;
|
|
979
|
-
result: Promise<AgentRunReply>;
|
|
980
|
-
cancel: () => Promise<void>;
|
|
981
|
-
dispose: () => void;
|
|
982
|
-
};
|
|
983
|
-
declare class AgentRunClient {
|
|
984
|
-
private readonly options;
|
|
985
|
-
constructor(options: {
|
|
986
|
-
eventBus: Pick<EventBus, "on">;
|
|
987
|
-
ingress: Pick<Ingress, "handle">;
|
|
988
|
-
});
|
|
989
|
-
send: (input: AgentRunSendIngressPayload) => Promise<NcpRunHandle>;
|
|
990
|
-
sendAndWaitForReply: (input: AgentRunSendIngressPayload, options?: AgentRunReplyOptions) => Promise<AgentRunReply>;
|
|
991
|
-
startRun: (input: AgentRunSendIngressPayload, options?: AgentRunReplyOptions) => Promise<AgentRunExecution>;
|
|
992
|
-
sendAndStreamEvents: (this: AgentRunClient, input: AgentRunSendIngressPayload, options?: AgentRunStreamOptions) => AsyncGenerator<NcpEndpointEvent>;
|
|
993
|
-
private prepareObserver;
|
|
994
|
-
private sendWithCorrelation;
|
|
995
|
-
}
|
|
996
|
-
//#endregion
|
|
997
|
-
//#region src/managers/user-question.manager.d.ts
|
|
998
|
-
type UserQuestionResolution = {
|
|
999
|
-
question: UserQuestionView;
|
|
1000
|
-
handle: NcpRunHandle | null;
|
|
1001
|
-
};
|
|
1002
|
-
type UserQuestionReplyResolution = UserQuestionResolution & {
|
|
1003
|
-
text: string | null;
|
|
1004
|
-
};
|
|
1005
|
-
declare class UserQuestionError extends Error {
|
|
1006
|
-
readonly code: "NOT_FOUND" | "INVALID_ANSWER" | "CONFLICT" | "UNSUPPORTED_RUNTIME";
|
|
1007
|
-
constructor(code: "NOT_FOUND" | "INVALID_ANSWER" | "CONFLICT" | "UNSUPPORTED_RUNTIME", message: string);
|
|
1008
|
-
}
|
|
1009
|
-
declare class UserQuestionManager {
|
|
1010
|
-
private readonly sessions;
|
|
1011
|
-
private readonly runs;
|
|
1012
|
-
private readonly ingress;
|
|
1013
|
-
private readonly resolutions;
|
|
1014
|
-
constructor(sessions: SessionManager, runs: SessionRunManager, ingress: Ingress);
|
|
1015
|
-
ask: (sessionId: string, prompts: readonly UserQuestionPrompt[]) => Promise<{
|
|
1016
|
-
accepted: true;
|
|
1017
|
-
questionIds: string[];
|
|
1018
|
-
}>;
|
|
1019
|
-
list: (sessionId: string) => Promise<UserQuestionView[]>;
|
|
1020
|
-
resolve: (input: {
|
|
1021
|
-
sessionId: string;
|
|
1022
|
-
questionId: string;
|
|
1023
|
-
action: "answer" | "dismiss";
|
|
1024
|
-
answer?: string;
|
|
1025
|
-
}) => Promise<UserQuestionResolution>;
|
|
1026
|
-
resolveAndWaitForReply: (input: {
|
|
1027
|
-
sessionId: string;
|
|
1028
|
-
questionId: string;
|
|
1029
|
-
action: "answer" | "dismiss";
|
|
1030
|
-
answer?: string;
|
|
1031
|
-
}, client: AgentRunClient, options?: AgentRunReplyOptions) => Promise<UserQuestionReplyResolution>;
|
|
1032
|
-
private resolveOnce;
|
|
1033
|
-
private prepareResolution;
|
|
1034
|
-
private assertNativeSession;
|
|
1035
|
-
}
|
|
1036
|
-
//#endregion
|
|
1037
|
-
export { CreateProjectInput as $, ProjectRecentArtifact as A, PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS as At, ProjectWorkItemListEntry as B, ProjectAgreementMaterial as C, AgentManager as Ct, CreateProjectWorkStateInput as D, ConfigManagerOptions as Dt, CreateProjectWorkItemInput as E, ConfigManager as Et, ProjectWorkActor as F, LlmProviderRuntime as Ft, ProjectWorkSummary as G, ProjectWorkListInput as H, ProjectWorkArtifactLink as I, ProviderModelsDiscoverInput as It, ProjectError as J, UpdateProjectWorkItemInput as K, ProjectWorkAttention as L, ChannelManager as Lt, ProjectWorkActivity as M, ProviderModelCatalogManager as Mt, ProjectWorkActivityPage as N, ProviderModelCatalogSnapshot as Nt, PROJECT_WORK_ATTENTION_VALUES as O, ConfigManagerRuntimeHooks as Ot, ProjectWorkActivityType as P, LlmProviderManager as Pt, isProjectError as Q, ProjectWorkItem as R, ProjectMaterialService as S, ContextProviderManager as St, ProjectWorkManager as T, ResolvedAgentProfile as Tt, ProjectWorkState as U, ProjectWorkItemPage as V, ProjectWorkStateCategory as W, ProjectManager as X, ProjectErrorCode as Y, ProjectManagerOptions as Z, SessionManager as _, isSessionMessageCursorError as _t, AgentRunClient as a, NcpAgentSessionJournalStore as at, ProjectWorkErrorCode as b, ToolProviderManager as bt, AgentRunReplyOptions as c, SessionMessageCursorError as ct, SessionRunManager as d, SessionModelTokenUsage as dt, PROJECT_TEMPLATE_IDS as et, SessionRunPendingRequest as f, SessionSettingsError as ft, ProductActivitySource as g, SessionTokenUsageTotals as gt, ProductActivitySink as h, SessionTokenUsageSummary as ht, UserQuestionResolution as i, ProjectTemplateId as it, ProjectRecentArtifactPage as j, ProviderModelCatalogEntry as jt, PROJECT_WORK_STATE_CATEGORIES as k, ConfigMutationResult as kt, AgentRunStreamOptions as l, SessionMessagePage as lt, ProductActivitySignal as m, SessionTokenUsageStatus as mt, UserQuestionManager as n, ProjectSessionBinding as nt, AgentRunExecution as o, AgentRunSession as ot, ProductActivityKind as p, SessionSettingsPatch as pt, UpdateProjectWorkStateInput as q, UserQuestionReplyResolution as r, ProjectTemplate as rt, AgentRunReply as s, CreateAgentRunSessionParams as st, UserQuestionError as t, ProjectRecord as tt, SessionRun as u, SessionMetadataUpdate as ut, SessionManagerOptions as v, isSessionSettingsError as vt, ProjectSkillMaterial as w, AgentManagerOptions as wt, isProjectWorkError as x, ToolRunContext as xt, ProjectWorkError as y, AgentContextWindowManager as yt, ProjectWorkItemDetail as z };
|
|
1038
|
-
//# sourceMappingURL=user-question.manager-38KBgZCg.d.ts.map
|