@codebolt/agent 6.1.20 → 6.1.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/README.md +1 -0
- package/dist/processor-pieces/messageModifiers/argumentProcessorModifier.js +11 -15
- package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.d.ts +0 -1
- package/dist/processor-pieces/messageModifiers/atFileProcessorModifier.js +16 -33
- package/dist/processor-pieces/messageModifiers/capabilityContextModifier.js +3 -2
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.d.ts +8 -0
- package/dist/processor-pieces/messageModifiers/chatHistoryMessageModifier.js +150 -27
- package/dist/processor-pieces/messageModifiers/chatRecordingModifier.js +3 -3
- package/dist/processor-pieces/messageModifiers/contextAssemblyModifier.js +18 -12
- package/dist/processor-pieces/messageModifiers/directoryContextModifier.d.ts +1 -0
- package/dist/processor-pieces/messageModifiers/directoryContextModifier.js +15 -15
- package/dist/processor-pieces/messageModifiers/environmentContextModifier.d.ts +1 -0
- package/dist/processor-pieces/messageModifiers/environmentContextModifier.js +48 -2
- package/dist/processor-pieces/messageModifiers/ideContextModifier.js +3 -2
- package/dist/processor-pieces/messageModifiers/index.d.ts +1 -0
- package/dist/processor-pieces/messageModifiers/index.js +3 -1
- package/dist/processor-pieces/messageModifiers/memoryImportModifier.js +9 -15
- package/dist/processor-pieces/messageModifiers/toolInjectionModifier.js +17 -20
- package/dist/processor-pieces/messageModifiers/toolManifestPromptModifier.d.ts +18 -0
- package/dist/processor-pieces/messageModifiers/toolManifestPromptModifier.js +57 -0
- package/dist/processor-pieces/postInferenceProcessors/loopDetectionModifier.js +8 -19
- package/dist/processor-pieces/postToolCallProcessors/conversationCompactorModifier.d.ts +1 -1
- package/dist/processor-pieces/postToolCallProcessors/conversationCompactorModifier.js +28 -20
- package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.js +3 -3
- package/dist/processor-pieces/preInferenceProcessors/chatCompressionModifier.js +2 -2
- package/dist/processor-pieces/utils/messageModifierHelper.js +3 -3
- package/dist/types/libFunctionTypes.d.ts +139 -7
- package/dist/unified/agent/agent.d.ts +13 -0
- package/dist/unified/agent/agent.js +180 -19
- package/dist/unified/agent/tools.d.ts +14 -0
- package/dist/unified/agent/tools.js +82 -51
- package/dist/unified/base/agentStep.d.ts +2 -1
- package/dist/unified/base/agentStep.js +47 -16
- package/dist/unified/base/initialPromptGenerator.d.ts +2 -0
- package/dist/unified/base/initialPromptGenerator.js +42 -19
- package/dist/unified/base/promptContext.d.ts +3 -0
- package/dist/unified/base/promptContext.js +193 -15
- package/dist/unified/base/responseExecutor.d.ts +6 -0
- package/dist/unified/base/responseExecutor.js +256 -69
- package/dist/unified/index.d.ts +1 -0
- package/dist/unified/index.js +3 -1
- package/dist/unified/services/CompressionCoordinator.js +9 -9
- package/dist/unified/services/compaction/autoCompact.d.ts +2 -1
- package/dist/unified/services/compaction/autoCompact.js +19 -11
- package/dist/unified/services/compaction/compactionOrchestrator.d.ts +1 -0
- package/dist/unified/services/compaction/compactionOrchestrator.js +8 -0
- package/dist/unified/services/compaction/contextCollapse.d.ts +2 -1
- package/dist/unified/services/compaction/contextCollapse.js +17 -9
- package/dist/unified/services/compaction/reactiveCompact.d.ts +3 -0
- package/dist/unified/services/compaction/reactiveCompact.js +17 -8
- package/dist/unified/types/libTypes.d.ts +189 -10
- package/dist/unified/utils/agentToolLoader.d.ts +17 -1
- package/dist/unified/utils/agentToolLoader.js +182 -31
- package/package.json +5 -1
|
@@ -42,6 +42,7 @@ export declare class CompactionOrchestrator {
|
|
|
42
42
|
private readonly layerOrder;
|
|
43
43
|
private readonly layers;
|
|
44
44
|
constructor(options?: CompactionOrchestratorOptions);
|
|
45
|
+
private normalizeLLMRole;
|
|
45
46
|
/**
|
|
46
47
|
* Run the full compaction pipeline.
|
|
47
48
|
* Each layer is checked and applied in priority order.
|
|
@@ -35,6 +35,7 @@ class CompactionOrchestrator {
|
|
|
35
35
|
modelTokenLimit: (_a = options === null || options === void 0 ? void 0 : options.modelTokenLimit) !== null && _a !== void 0 ? _a : DEFAULT_MODEL_TOKEN_LIMIT,
|
|
36
36
|
autoCompactEnabled: (_b = options === null || options === void 0 ? void 0 : options.autoCompactEnabled) !== null && _b !== void 0 ? _b : true,
|
|
37
37
|
contextCollapseEnabled: (_c = options === null || options === void 0 ? void 0 : options.contextCollapseEnabled) !== null && _c !== void 0 ? _c : false,
|
|
38
|
+
llmRole: this.normalizeLLMRole(options === null || options === void 0 ? void 0 : options.llmRole),
|
|
38
39
|
enableLogging: (_d = options === null || options === void 0 ? void 0 : options.enableLogging) !== null && _d !== void 0 ? _d : false,
|
|
39
40
|
};
|
|
40
41
|
this.snip = new snipCompact_1.SnipCompact({ enableLogging: this.options.enableLogging });
|
|
@@ -42,14 +43,17 @@ class CompactionOrchestrator {
|
|
|
42
43
|
this.collapse = new contextCollapse_1.ContextCollapse({
|
|
43
44
|
modelTokenLimit: this.options.modelTokenLimit,
|
|
44
45
|
enableLogging: this.options.enableLogging,
|
|
46
|
+
...(this.options.llmRole ? { llmRole: this.options.llmRole } : {}),
|
|
45
47
|
});
|
|
46
48
|
this.auto = new autoCompact_1.AutoCompact({
|
|
47
49
|
modelTokenLimit: this.options.modelTokenLimit,
|
|
48
50
|
enableLogging: this.options.enableLogging,
|
|
51
|
+
...(this.options.llmRole ? { llmRole: this.options.llmRole } : {}),
|
|
49
52
|
});
|
|
50
53
|
this.reactive = new reactiveCompact_1.ReactiveCompact({
|
|
51
54
|
modelTokenLimit: this.options.modelTokenLimit,
|
|
52
55
|
enableLogging: this.options.enableLogging,
|
|
56
|
+
...(this.options.llmRole ? { llmRole: this.options.llmRole } : {}),
|
|
53
57
|
});
|
|
54
58
|
this.cleanup = new postCompactCleanup_1.PostCompactCleanup({
|
|
55
59
|
enableLogging: this.options.enableLogging,
|
|
@@ -63,6 +67,10 @@ class CompactionOrchestrator {
|
|
|
63
67
|
];
|
|
64
68
|
this.layers = new Map(layerEntries);
|
|
65
69
|
}
|
|
70
|
+
normalizeLLMRole(llmRole) {
|
|
71
|
+
const normalized = llmRole === null || llmRole === void 0 ? void 0 : llmRole.trim();
|
|
72
|
+
return normalized ? normalized : undefined;
|
|
73
|
+
}
|
|
66
74
|
/**
|
|
67
75
|
* Run the full compaction pipeline.
|
|
68
76
|
* Each layer is checked and applied in priority order.
|
|
@@ -22,7 +22,7 @@ export interface ContextCollapseOptions {
|
|
|
22
22
|
blockingThreshold?: number;
|
|
23
23
|
/** Model token limit (default: 128000) */
|
|
24
24
|
modelTokenLimit?: number;
|
|
25
|
-
/** LLM role for granular summarization
|
|
25
|
+
/** LLM role for granular summarization */
|
|
26
26
|
llmRole?: string;
|
|
27
27
|
/** Max summaries to keep in the collapse store (default: 20) */
|
|
28
28
|
maxSummaries?: number;
|
|
@@ -37,6 +37,7 @@ export declare class ContextCollapse implements CompactionLayer {
|
|
|
37
37
|
/** Staged collapses waiting for API confirmation */
|
|
38
38
|
private staged;
|
|
39
39
|
constructor(options?: ContextCollapseOptions);
|
|
40
|
+
private normalizeLLMRole;
|
|
40
41
|
shouldApply(ctx: CompactionContext): boolean;
|
|
41
42
|
apply(ctx: CompactionContext): Promise<CompactionContext>;
|
|
42
43
|
/**
|
|
@@ -25,7 +25,7 @@ const DEFAULT_BLOCKING_THRESHOLD = 0.95;
|
|
|
25
25
|
const MIN_COLLAPSE_TOKENS = 2000;
|
|
26
26
|
class ContextCollapse {
|
|
27
27
|
constructor(options) {
|
|
28
|
-
var _a, _b, _c, _d, _e
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
29
|
this.name = 'collapse';
|
|
30
30
|
/** The collapse store: ordered list of collapsed ranges */
|
|
31
31
|
this.store = [];
|
|
@@ -35,11 +35,15 @@ class ContextCollapse {
|
|
|
35
35
|
commitThreshold: (_a = options === null || options === void 0 ? void 0 : options.commitThreshold) !== null && _a !== void 0 ? _a : DEFAULT_COMMIT_THRESHOLD,
|
|
36
36
|
blockingThreshold: (_b = options === null || options === void 0 ? void 0 : options.blockingThreshold) !== null && _b !== void 0 ? _b : DEFAULT_BLOCKING_THRESHOLD,
|
|
37
37
|
modelTokenLimit: (_c = options === null || options === void 0 ? void 0 : options.modelTokenLimit) !== null && _c !== void 0 ? _c : 128000,
|
|
38
|
-
llmRole: (
|
|
39
|
-
maxSummaries: (
|
|
40
|
-
enableLogging: (
|
|
38
|
+
llmRole: this.normalizeLLMRole(options === null || options === void 0 ? void 0 : options.llmRole),
|
|
39
|
+
maxSummaries: (_d = options === null || options === void 0 ? void 0 : options.maxSummaries) !== null && _d !== void 0 ? _d : 20,
|
|
40
|
+
enableLogging: (_e = options === null || options === void 0 ? void 0 : options.enableLogging) !== null && _e !== void 0 ? _e : false,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
normalizeLLMRole(llmRole) {
|
|
44
|
+
const normalized = llmRole === null || llmRole === void 0 ? void 0 : llmRole.trim();
|
|
45
|
+
return normalized ? normalized : undefined;
|
|
46
|
+
}
|
|
43
47
|
shouldApply(ctx) {
|
|
44
48
|
if (!ctx.contextCollapseEnabled)
|
|
45
49
|
return false;
|
|
@@ -213,7 +217,7 @@ class ContextCollapse {
|
|
|
213
217
|
];
|
|
214
218
|
}
|
|
215
219
|
async generateGranularSummary(messages) {
|
|
216
|
-
var _a, _b
|
|
220
|
+
var _a, _b;
|
|
217
221
|
const estimator = new types_1.TokenEstimator();
|
|
218
222
|
// For small ranges, create a structural summary without LLM
|
|
219
223
|
const tokenCount = estimator.estimateForMessages(messages);
|
|
@@ -238,13 +242,17 @@ class ContextCollapse {
|
|
|
238
242
|
const prompt = `Summarize this conversation segment concisely. Preserve: key decisions, file paths, code changes, errors encountered, current task state. Be factual and specific.
|
|
239
243
|
|
|
240
244
|
${historyText}`;
|
|
241
|
-
const
|
|
242
|
-
|
|
245
|
+
const inferencePayload = {
|
|
246
|
+
formatVersion: 'codebolt.llm.v2',
|
|
247
|
+
input: [
|
|
243
248
|
{ role: 'system', content: 'You are a precise conversation summarizer. Be concise but complete.' },
|
|
244
249
|
{ role: 'user', content: prompt },
|
|
245
250
|
],
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
...(this.options.llmRole ? { llmrole: this.options.llmRole } : {}),
|
|
252
|
+
};
|
|
253
|
+
console.log('[ContextCollapse] llm.inference payload:', inferencePayload);
|
|
254
|
+
const response = await codebolt.llm.inference(inferencePayload);
|
|
255
|
+
const summary = ((_a = response === null || response === void 0 ? void 0 : response.completion) === null || _a === void 0 ? void 0 : _a.output_text) || ((_b = response === null || response === void 0 ? void 0 : response.completion) === null || _b === void 0 ? void 0 : _b.content);
|
|
248
256
|
if (summary && typeof summary === 'string' && summary.trim().length > 0) {
|
|
249
257
|
return summary.trim();
|
|
250
258
|
}
|
|
@@ -18,6 +18,8 @@ export interface ReactiveCompactOptions {
|
|
|
18
18
|
retryLimit?: number;
|
|
19
19
|
/** Model token limit (default: 128000) */
|
|
20
20
|
modelTokenLimit?: number;
|
|
21
|
+
/** LLM role for emergency summarization calls */
|
|
22
|
+
llmRole?: string;
|
|
21
23
|
/** Enable logging (default: false) */
|
|
22
24
|
enableLogging?: boolean;
|
|
23
25
|
}
|
|
@@ -34,6 +36,7 @@ export declare class ReactiveCompact implements CompactionLayer {
|
|
|
34
36
|
private hasAttemptedThisTurn;
|
|
35
37
|
private retryCount;
|
|
36
38
|
constructor(options?: ReactiveCompactOptions);
|
|
39
|
+
private normalizeLLMRole;
|
|
37
40
|
shouldApply(_ctx: CompactionContext): boolean;
|
|
38
41
|
apply(_ctx: CompactionContext): Promise<CompactionContext>;
|
|
39
42
|
reset(): void;
|
|
@@ -39,9 +39,14 @@ class ReactiveCompact {
|
|
|
39
39
|
this.options = {
|
|
40
40
|
retryLimit: (_a = options === null || options === void 0 ? void 0 : options.retryLimit) !== null && _a !== void 0 ? _a : 1,
|
|
41
41
|
modelTokenLimit: (_b = options === null || options === void 0 ? void 0 : options.modelTokenLimit) !== null && _b !== void 0 ? _b : 128000,
|
|
42
|
+
llmRole: this.normalizeLLMRole(options === null || options === void 0 ? void 0 : options.llmRole),
|
|
42
43
|
enableLogging: (_c = options === null || options === void 0 ? void 0 : options.enableLogging) !== null && _c !== void 0 ? _c : false,
|
|
43
44
|
};
|
|
44
45
|
}
|
|
46
|
+
normalizeLLMRole(llmRole) {
|
|
47
|
+
const normalized = llmRole === null || llmRole === void 0 ? void 0 : llmRole.trim();
|
|
48
|
+
return normalized ? normalized : undefined;
|
|
49
|
+
}
|
|
45
50
|
shouldApply(_ctx) {
|
|
46
51
|
// Reactive only fires when explicitly triggered by an error
|
|
47
52
|
// via tryRecoverFromError(), not proactively
|
|
@@ -235,7 +240,7 @@ class ReactiveCompact {
|
|
|
235
240
|
];
|
|
236
241
|
}
|
|
237
242
|
async forceCompact(messages) {
|
|
238
|
-
var _a, _b
|
|
243
|
+
var _a, _b;
|
|
239
244
|
try {
|
|
240
245
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
241
246
|
const codebolt = require('@codebolt/codeboltjs');
|
|
@@ -266,21 +271,25 @@ class ReactiveCompact {
|
|
|
266
271
|
|
|
267
272
|
Conversation:
|
|
268
273
|
${historyText}`;
|
|
269
|
-
const
|
|
270
|
-
|
|
274
|
+
const inferencePayload = {
|
|
275
|
+
formatVersion: 'codebolt.llm.v2',
|
|
276
|
+
input: [
|
|
271
277
|
{
|
|
272
278
|
role: 'system',
|
|
273
279
|
content: 'Create an extremely concise summary. Focus on actionable facts only.',
|
|
274
280
|
},
|
|
275
281
|
{ role: 'user', content: prompt },
|
|
276
282
|
],
|
|
277
|
-
|
|
283
|
+
...(this.options.llmRole ? { llmrole: this.options.llmRole } : {}),
|
|
284
|
+
};
|
|
285
|
+
console.log('[ReactiveCompact] llm.inference payload:', inferencePayload);
|
|
286
|
+
const response = await codebolt.llm.inference(inferencePayload);
|
|
278
287
|
let summary;
|
|
279
|
-
if (typeof ((_a = response === null || response === void 0 ? void 0 : response.completion) === null || _a === void 0 ? void 0 : _a.
|
|
280
|
-
summary = response.completion.
|
|
288
|
+
if (typeof ((_a = response === null || response === void 0 ? void 0 : response.completion) === null || _a === void 0 ? void 0 : _a.output_text) === 'string') {
|
|
289
|
+
summary = response.completion.output_text;
|
|
281
290
|
}
|
|
282
|
-
else if (
|
|
283
|
-
summary = response.completion.
|
|
291
|
+
else if (typeof ((_b = response === null || response === void 0 ? void 0 : response.completion) === null || _b === void 0 ? void 0 : _b.content) === 'string') {
|
|
292
|
+
summary = response.completion.content;
|
|
284
293
|
}
|
|
285
294
|
if (!summary || summary.trim().length === 0) {
|
|
286
295
|
return null;
|
|
@@ -175,16 +175,193 @@ export interface CodeboltAPI {
|
|
|
175
175
|
/** Stream LLM response */
|
|
176
176
|
stream(params: LLMInferenceParams): AsyncIterable<LLMResponse>;
|
|
177
177
|
};
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
/** Generic tool operations */
|
|
179
|
+
tools?: {
|
|
180
|
+
/** List CodeBoltJS built-in tools */
|
|
181
|
+
listBuiltInTools(options?: {
|
|
182
|
+
namespace?: string;
|
|
183
|
+
grep?: string;
|
|
184
|
+
limit?: number;
|
|
185
|
+
}): Promise<{
|
|
186
|
+
data: {
|
|
187
|
+
tools: Array<{
|
|
188
|
+
name: string;
|
|
189
|
+
toolName: string;
|
|
190
|
+
namespace: string;
|
|
191
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
192
|
+
sourceId?: string;
|
|
193
|
+
displayName?: string;
|
|
194
|
+
description?: string;
|
|
195
|
+
inputSchema: Record<string, unknown>;
|
|
196
|
+
}>;
|
|
197
|
+
};
|
|
198
|
+
}>;
|
|
199
|
+
/** List external tools: MCP, plugin, and project-local */
|
|
200
|
+
listExternalTools(options?: {
|
|
201
|
+
namespace?: string;
|
|
202
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
203
|
+
sourceId?: string;
|
|
204
|
+
grep?: string;
|
|
205
|
+
limit?: number;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
data: {
|
|
208
|
+
tools: Array<{
|
|
209
|
+
name: string;
|
|
210
|
+
toolName: string;
|
|
211
|
+
namespace: string;
|
|
212
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
213
|
+
sourceId?: string;
|
|
214
|
+
displayName?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
inputSchema: Record<string, unknown>;
|
|
217
|
+
}>;
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
220
|
+
/** List all tools callable in the current runtime context */
|
|
221
|
+
listRuntimeTools(options?: {
|
|
222
|
+
includeBuiltIn?: boolean;
|
|
223
|
+
includeExternal?: boolean;
|
|
224
|
+
includeAgentLocal?: boolean;
|
|
225
|
+
namespace?: string;
|
|
226
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
227
|
+
sourceId?: string;
|
|
228
|
+
grep?: string;
|
|
229
|
+
limit?: number;
|
|
230
|
+
}): Promise<{
|
|
231
|
+
data: {
|
|
232
|
+
tools: Array<{
|
|
233
|
+
name: string;
|
|
234
|
+
toolName: string;
|
|
235
|
+
namespace: string;
|
|
236
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
237
|
+
sourceId?: string;
|
|
238
|
+
displayName?: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
inputSchema: Record<string, unknown>;
|
|
241
|
+
}>;
|
|
242
|
+
};
|
|
243
|
+
}>;
|
|
244
|
+
/** List tool namespaces such as fs, terminal, browser, or an MCP server name */
|
|
245
|
+
listToolNamespaces(options?: {
|
|
246
|
+
includeBuiltIn?: boolean;
|
|
247
|
+
includeExternal?: boolean;
|
|
248
|
+
includeAgentLocal?: boolean;
|
|
249
|
+
namespace?: string;
|
|
250
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
251
|
+
sourceId?: string;
|
|
252
|
+
grep?: string;
|
|
253
|
+
limit?: number;
|
|
254
|
+
}): Promise<{
|
|
255
|
+
data: {
|
|
256
|
+
namespaces: Array<{
|
|
257
|
+
namespace: string;
|
|
258
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
259
|
+
sourceId?: string;
|
|
260
|
+
displayName?: string;
|
|
261
|
+
toolCount?: number;
|
|
262
|
+
}>;
|
|
263
|
+
};
|
|
264
|
+
}>;
|
|
265
|
+
/** List tools in one namespace */
|
|
266
|
+
listToolsByNamespace(namespace: string, options?: {
|
|
267
|
+
includeBuiltIn?: boolean;
|
|
268
|
+
includeExternal?: boolean;
|
|
269
|
+
includeAgentLocal?: boolean;
|
|
270
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
271
|
+
sourceId?: string;
|
|
272
|
+
grep?: string;
|
|
273
|
+
limit?: number;
|
|
274
|
+
}): Promise<{
|
|
275
|
+
data: {
|
|
276
|
+
tools: Array<{
|
|
277
|
+
name: string;
|
|
278
|
+
toolName: string;
|
|
279
|
+
namespace: string;
|
|
280
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
281
|
+
sourceId?: string;
|
|
282
|
+
displayName?: string;
|
|
283
|
+
description?: string;
|
|
284
|
+
inputSchema: Record<string, unknown>;
|
|
285
|
+
}>;
|
|
286
|
+
};
|
|
287
|
+
}>;
|
|
288
|
+
/** List tool sources such as built-in, MCP, plugin, project-local, and agent-local identities */
|
|
289
|
+
listToolSources(options?: {
|
|
290
|
+
includeBuiltIn?: boolean;
|
|
291
|
+
includeExternal?: boolean;
|
|
292
|
+
includeAgentLocal?: boolean;
|
|
293
|
+
namespace?: string;
|
|
294
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
295
|
+
sourceId?: string;
|
|
296
|
+
grep?: string;
|
|
297
|
+
limit?: number;
|
|
298
|
+
}): Promise<{
|
|
299
|
+
data: {
|
|
300
|
+
sources: Array<{
|
|
301
|
+
sourceId: string;
|
|
302
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
303
|
+
displayName?: string;
|
|
304
|
+
namespaces?: string[];
|
|
305
|
+
toolCount?: number;
|
|
306
|
+
}>;
|
|
307
|
+
};
|
|
308
|
+
}>;
|
|
309
|
+
/** List tools supplied by one source identity */
|
|
310
|
+
listToolsBySource(sourceId: string, options?: {
|
|
311
|
+
includeBuiltIn?: boolean;
|
|
312
|
+
includeExternal?: boolean;
|
|
313
|
+
includeAgentLocal?: boolean;
|
|
314
|
+
namespace?: string;
|
|
315
|
+
sourceType?: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
316
|
+
grep?: string;
|
|
317
|
+
limit?: number;
|
|
318
|
+
}): Promise<{
|
|
319
|
+
data: {
|
|
320
|
+
tools: Array<{
|
|
321
|
+
name: string;
|
|
322
|
+
toolName: string;
|
|
323
|
+
namespace: string;
|
|
324
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
325
|
+
sourceId?: string;
|
|
326
|
+
displayName?: string;
|
|
327
|
+
description?: string;
|
|
328
|
+
inputSchema: Record<string, unknown>;
|
|
329
|
+
}>;
|
|
330
|
+
};
|
|
331
|
+
}>;
|
|
332
|
+
/** Get one runtime tool descriptor */
|
|
333
|
+
getRuntimeTool(name: string): Promise<{
|
|
334
|
+
data: {
|
|
335
|
+
tool?: {
|
|
336
|
+
name: string;
|
|
337
|
+
toolName: string;
|
|
338
|
+
namespace: string;
|
|
339
|
+
sourceType: 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
340
|
+
sourceId?: string;
|
|
341
|
+
displayName?: string;
|
|
342
|
+
description?: string;
|
|
343
|
+
inputSchema: Record<string, unknown>;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
}>;
|
|
347
|
+
/** Execute a tool by runtime name */
|
|
348
|
+
execute(toolName: string, params?: unknown, options?: {
|
|
349
|
+
namespace?: string;
|
|
350
|
+
sourceId?: string;
|
|
351
|
+
}): Promise<{
|
|
352
|
+
data?: unknown;
|
|
353
|
+
result?: unknown;
|
|
183
354
|
}>;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
355
|
+
};
|
|
356
|
+
/** MCP server lifecycle/configuration operations */
|
|
357
|
+
mcp: {
|
|
358
|
+
getEnabledMCPServers(): Promise<unknown>;
|
|
359
|
+
getLocalMCPServers(): Promise<unknown>;
|
|
360
|
+
getMentionedMCPServers(userMessage: unknown): Promise<unknown>;
|
|
361
|
+
searchAvailableMCPServers(query: string): Promise<unknown>;
|
|
362
|
+
configureMCPServer(name: string, config: Record<string, unknown>): Promise<unknown>;
|
|
363
|
+
getMcpList(): Promise<unknown>;
|
|
364
|
+
getEnabledMcps(): Promise<unknown>;
|
|
188
365
|
};
|
|
189
366
|
/** File system operations */
|
|
190
367
|
fs: {
|
|
@@ -200,7 +377,9 @@ export interface CodeboltAPI {
|
|
|
200
377
|
/** Agent operations */
|
|
201
378
|
agent?: {
|
|
202
379
|
/** Start a sub-agent */
|
|
203
|
-
startAgent(agentName: string, params: unknown
|
|
380
|
+
startAgent(agentName: string, params: unknown, options?: {
|
|
381
|
+
llm?: unknown;
|
|
382
|
+
}): Promise<{
|
|
204
383
|
data: unknown;
|
|
205
384
|
}>;
|
|
206
385
|
/** List available agents */
|
|
@@ -5,6 +5,19 @@ type ToolResponse = {
|
|
|
5
5
|
tools?: unknown;
|
|
6
6
|
} | unknown;
|
|
7
7
|
};
|
|
8
|
+
export type ToolSourceType = 'built-in' | 'mcp' | 'plugin' | 'project-local' | 'agent-local' | 'unknown';
|
|
9
|
+
export interface RuntimeToolDescriptor {
|
|
10
|
+
name: string;
|
|
11
|
+
toolName: string;
|
|
12
|
+
namespace: string;
|
|
13
|
+
sourceType: ToolSourceType;
|
|
14
|
+
sourceId?: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
inputSchema: Record<string, unknown>;
|
|
18
|
+
outputSchema?: Record<string, unknown>;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
8
21
|
export declare class LocalToolConfigurationError extends Error {
|
|
9
22
|
constructor(message: string);
|
|
10
23
|
}
|
|
@@ -15,10 +28,13 @@ export interface AgentLocalToolRegistry {
|
|
|
15
28
|
export declare function normalizeToolForModel(tool: Tool): Tool;
|
|
16
29
|
export declare function resolveToolExecutionName(modelToolName: string): string;
|
|
17
30
|
export declare function normalizeToolResponse(response: ToolResponse | undefined): Tool[];
|
|
31
|
+
export declare function normalizeRuntimeToolResponse(response: ToolResponse | undefined): RuntimeToolDescriptor[];
|
|
18
32
|
export declare function mergeTools(...toolGroups: Tool[][]): Tool[];
|
|
33
|
+
export declare function mergeRuntimeTools(...toolGroups: RuntimeToolDescriptor[][]): RuntimeToolDescriptor[];
|
|
19
34
|
export declare function createAgentLocalToolRegistry(localTools?: AgentLocalTool[]): AgentLocalToolRegistry;
|
|
20
35
|
export declare function assertNoLocalToolSchemaCollisions(localSchemas: Tool[], externalSchemas: Tool[]): void;
|
|
21
36
|
export declare function listProjectLocalTools(): Promise<Tool[]>;
|
|
22
|
-
export declare function listAgentAvailableTools(
|
|
37
|
+
export declare function listAgentAvailableTools(mentionedNamespaces?: unknown[]): Promise<Tool[]>;
|
|
38
|
+
export declare function listAgentRuntimeTools(localTools?: AgentLocalTool[]): Promise<RuntimeToolDescriptor[]>;
|
|
23
39
|
export declare function appendUniqueTools(targetTools: Tool[], toolsToAppend: Tool[]): void;
|
|
24
40
|
export {};
|