@nuvin/agent-core 0.0.0-rc.3 → 0.0.0-rc.5
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/VERSION +2 -2
- package/dist/agent/index.d.ts +28 -525
- package/dist/agent/index.js +1 -1
- package/dist/chunk-G2FR4UGO.js +1 -1
- package/dist/chunk-LXQDGX4K.js +1 -1
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-P54V754C.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.d.ts +23 -319
- package/dist/formats/index.js +1 -1
- package/dist/models/index.d.ts +330 -634
- package/dist/models/index.js +1 -1
- package/dist/shared/index.d.ts +14 -709
- package/dist/shared/index.js +1 -1
- package/dist/tools/index.d.ts +583 -967
- package/dist/tools/index.js +1 -1
- package/package.json +9 -1
- package/dist/chunk-VFTQW5WK.js +0 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,1021 +1,637 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Diagnostic, Location, Hover, DocumentSymbol, SymbolInformation, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from 'vscode-languageserver-types';
|
|
2
|
+
import { b1 as ToolDefinition, au as ToolOutputEnvelope, b2 as AnyToolDefinition, aX as ToolRuntimeEventHandler, aW as ToolRuntimeToolCallHandler, aZ as ToolRuntime, H as JsonObject, V as JsonSchemaObject, W as JsonSchema, bc as AgentDefinitionFactoryContext, A as AgentOptions, a$ as ToolOutputValue, at as ToolResultChunk, _ as ToolResultContent, a_ as InferJsonSchema, az as ToolExecutionContext, aj as ToolSchema, I as JsonValue } from '../types-QPBW5jHO.js';
|
|
3
|
+
import { CommandDefinitionReference, SerializedCommandDefinition, MCPAuthConfig, MCPServerConfig } from '@nuvin/config';
|
|
3
4
|
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
4
5
|
import { CallToolResult, ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
11
|
-
export interface JsonSchemaString {
|
|
12
|
-
type: "string";
|
|
13
|
-
}
|
|
14
|
-
export interface JsonSchemaNumber {
|
|
15
|
-
type: "number";
|
|
16
|
-
}
|
|
17
|
-
export interface JsonSchemaBoolean {
|
|
18
|
-
type: "boolean";
|
|
19
|
-
}
|
|
20
|
-
export interface JsonSchemaArray<TItem extends JsonSchema = JsonSchema> {
|
|
21
|
-
type: "array";
|
|
22
|
-
items: TItem;
|
|
23
|
-
}
|
|
24
|
-
export interface JsonSchemaObject<TProperties extends Record<string, JsonSchema> = Record<string, JsonSchema>, TRequired extends readonly string[] | undefined = readonly string[] | undefined> {
|
|
25
|
-
type: "object";
|
|
26
|
-
properties: TProperties;
|
|
27
|
-
required?: TRequired;
|
|
28
|
-
}
|
|
29
|
-
export type JsonSchema = JsonSchemaArray | JsonSchemaBoolean | JsonSchemaNumber | JsonSchemaObject | JsonSchemaString;
|
|
30
|
-
export interface TextBlock {
|
|
31
|
-
type: "text";
|
|
32
|
-
text: string;
|
|
33
|
-
}
|
|
34
|
-
export type ImageMediaType = "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
35
|
-
export interface ImageBlock {
|
|
36
|
-
type: "image";
|
|
37
|
-
source: {
|
|
38
|
-
type: "base64";
|
|
39
|
-
media_type: ImageMediaType;
|
|
40
|
-
data: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export type ToolResultContentBlock = ImageBlock | TextBlock;
|
|
44
|
-
export type ToolResultContent = string | ToolResultContentBlock[];
|
|
45
|
-
export interface AnthropicThinkingBlock {
|
|
46
|
-
type: "anthropic_thinking";
|
|
47
|
-
thinking: string;
|
|
48
|
-
signature: string;
|
|
49
|
-
}
|
|
50
|
-
export interface AnthropicRedactedThinkingBlock {
|
|
51
|
-
type: "anthropic_redacted_thinking";
|
|
52
|
-
data: string;
|
|
53
|
-
}
|
|
54
|
-
export interface OpenAiReasoningSummaryText {
|
|
55
|
-
type: "summary_text";
|
|
56
|
-
text: string;
|
|
57
|
-
}
|
|
58
|
-
export interface OpenAiReasoningBlock {
|
|
59
|
-
type: "openai_reasoning";
|
|
60
|
-
encryptedContent?: string;
|
|
61
|
-
id?: string;
|
|
62
|
-
summary: OpenAiReasoningSummaryText[];
|
|
63
|
-
text?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ToolUseBlock {
|
|
66
|
-
type: "tool_use";
|
|
67
|
-
id: string;
|
|
68
|
-
name: string;
|
|
69
|
-
input: JsonValue;
|
|
70
|
-
}
|
|
71
|
-
export interface ToolResultBlock {
|
|
72
|
-
type: "tool_result";
|
|
73
|
-
tool_use_id: string;
|
|
74
|
-
content: ToolResultContent;
|
|
75
|
-
is_error: boolean;
|
|
76
|
-
}
|
|
77
|
-
export interface AnthropicThinkingWireBlock {
|
|
78
|
-
type: "thinking";
|
|
79
|
-
thinking: string;
|
|
80
|
-
signature: string;
|
|
81
|
-
}
|
|
82
|
-
export interface AnthropicRedactedThinkingWireBlock {
|
|
83
|
-
type: "redacted_thinking";
|
|
84
|
-
data: string;
|
|
85
|
-
}
|
|
86
|
-
export type AnthropicAssistantContentBlock = AnthropicRedactedThinkingWireBlock | AnthropicThinkingWireBlock | TextBlock | ToolUseBlock;
|
|
87
|
-
export type ReasoningVisibility = "continuity-only" | "user-visible";
|
|
88
|
-
export type AutoReasoningEffort = "low" | "medium" | "high";
|
|
89
|
-
export interface AutoReasoningConfig {
|
|
90
|
-
effort: AutoReasoningEffort;
|
|
91
|
-
}
|
|
92
|
-
export type AnthropicThinkingDisplay = "omitted" | "summarized";
|
|
93
|
-
export type AnthropicThinkingEffort = "low" | "medium" | "high";
|
|
94
|
-
export interface AnthropicEnabledThinkingConfig {
|
|
95
|
-
type: "enabled";
|
|
96
|
-
budgetTokens: number;
|
|
97
|
-
display?: AnthropicThinkingDisplay;
|
|
98
|
-
interleaved?: boolean;
|
|
99
|
-
}
|
|
100
|
-
export interface AnthropicAdaptiveThinkingConfig {
|
|
101
|
-
type: "adaptive";
|
|
102
|
-
display?: AnthropicThinkingDisplay;
|
|
103
|
-
effort?: AnthropicThinkingEffort;
|
|
104
|
-
interleaved?: boolean;
|
|
105
|
-
}
|
|
106
|
-
export interface AnthropicDisabledThinkingConfig {
|
|
107
|
-
type: "disabled";
|
|
108
|
-
}
|
|
109
|
-
export type AnthropicThinkingConfig = AnthropicAdaptiveThinkingConfig | AnthropicDisabledThinkingConfig | AnthropicEnabledThinkingConfig;
|
|
110
|
-
export type OpenAiReasoningEffort = "high" | "low" | "medium" | "minimal" | "none" | "xhigh";
|
|
111
|
-
export type OpenAiReasoningSummary = "auto" | "concise" | "detailed";
|
|
112
|
-
export interface OpenAiReasoningConfig {
|
|
113
|
-
effort?: OpenAiReasoningEffort;
|
|
114
|
-
includeEncryptedContent?: boolean;
|
|
115
|
-
summary?: OpenAiReasoningSummary;
|
|
116
|
-
}
|
|
117
|
-
export interface ReasoningConfig {
|
|
118
|
-
auto?: AutoReasoningConfig;
|
|
119
|
-
anthropic?: AnthropicThinkingConfig;
|
|
120
|
-
openai?: OpenAiReasoningConfig;
|
|
121
|
-
visibility?: ReasoningVisibility;
|
|
122
|
-
}
|
|
123
|
-
export interface MessageProviderState {
|
|
124
|
-
anthropicAssistantContent?: AnthropicAssistantContentBlock[];
|
|
125
|
-
openaiResponsesOutput?: OpenAiResponsesOutputItem[];
|
|
126
|
-
openaiResponsesResponseId?: string;
|
|
127
|
-
}
|
|
128
|
-
export type AssistantContentBlock = AnthropicRedactedThinkingBlock | AnthropicThinkingBlock | OpenAiReasoningBlock | TextBlock | ToolUseBlock;
|
|
129
|
-
export type ContentBlock = AssistantContentBlock | ToolResultBlock;
|
|
130
|
-
export type ContentInput = ContentBlock[] | string | null | undefined;
|
|
131
|
-
export type MessageRole = "assistant" | "user";
|
|
132
|
-
export interface Message {
|
|
133
|
-
id?: string;
|
|
134
|
-
role: MessageRole;
|
|
135
|
-
content: ContentBlock[];
|
|
136
|
-
providerState?: MessageProviderState;
|
|
137
|
-
}
|
|
138
|
-
export interface IdentifiedMessage extends Message {
|
|
139
|
-
id: string;
|
|
140
|
-
}
|
|
141
|
-
export interface MessageInput {
|
|
142
|
-
id?: string;
|
|
143
|
-
role: MessageRole;
|
|
144
|
-
content?: ContentInput;
|
|
145
|
-
providerState?: MessageProviderState;
|
|
146
|
-
}
|
|
147
|
-
export interface ToolSchema {
|
|
148
|
-
name: string;
|
|
149
|
-
description: string;
|
|
150
|
-
input_schema: JsonSchemaObject;
|
|
151
|
-
}
|
|
152
|
-
export interface ChatRequest {
|
|
153
|
-
model: string;
|
|
154
|
-
maxTokens: number;
|
|
155
|
-
reasoning?: ReasoningConfig;
|
|
156
|
-
system: TextBlock[];
|
|
157
|
-
messages: Message[];
|
|
158
|
-
tools: ToolSchema[];
|
|
159
|
-
metadata: {
|
|
160
|
-
sessionId: string;
|
|
161
|
-
turnId: string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export interface ChatResponse {
|
|
165
|
-
id: string;
|
|
166
|
-
content: AssistantContentBlock[];
|
|
167
|
-
stopReason: "end_turn" | "tool_use";
|
|
168
|
-
usage: {
|
|
169
|
-
inputTokens: number;
|
|
170
|
-
outputTokens: number;
|
|
171
|
-
reasoningTokens?: number;
|
|
172
|
-
};
|
|
173
|
-
providerState?: MessageProviderState;
|
|
174
|
-
}
|
|
175
|
-
export interface ContentDeltaChunk {
|
|
176
|
-
type: "content_delta";
|
|
177
|
-
index?: number;
|
|
178
|
-
text?: string;
|
|
179
|
-
}
|
|
180
|
-
export interface ToolUseDeltaChunk {
|
|
181
|
-
type: "tool_use_delta";
|
|
182
|
-
id: string;
|
|
183
|
-
index: number;
|
|
184
|
-
inputDelta?: string;
|
|
185
|
-
name?: string;
|
|
186
|
-
}
|
|
187
|
-
export interface AnthropicThinkingDeltaChunk {
|
|
188
|
-
type: "anthropic_thinking_delta";
|
|
189
|
-
index: number;
|
|
190
|
-
thinking: string;
|
|
191
|
-
}
|
|
192
|
-
export interface OpenAiReasoningDeltaChunk {
|
|
193
|
-
type: "openai_reasoning_delta";
|
|
194
|
-
contentIndex: number;
|
|
195
|
-
delta: string;
|
|
196
|
-
itemId: string;
|
|
197
|
-
outputIndex: number;
|
|
198
|
-
}
|
|
199
|
-
export interface OpenAiReasoningSummaryDeltaChunk {
|
|
200
|
-
type: "openai_reasoning_summary_delta";
|
|
201
|
-
delta: string;
|
|
202
|
-
itemId: string;
|
|
203
|
-
outputIndex: number;
|
|
204
|
-
summaryIndex: number;
|
|
7
|
+
interface LspPosition {
|
|
8
|
+
file: string;
|
|
9
|
+
line: number;
|
|
10
|
+
character: number;
|
|
205
11
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
contentIndex?: number;
|
|
209
|
-
delta?: string;
|
|
210
|
-
index?: number;
|
|
211
|
-
itemId?: string;
|
|
212
|
-
outputIndex?: number;
|
|
213
|
-
signature?: string;
|
|
214
|
-
summaryIndex?: number;
|
|
215
|
-
text?: string;
|
|
216
|
-
thinking?: string;
|
|
217
|
-
inputDelta?: string;
|
|
218
|
-
name?: string;
|
|
219
|
-
id?: string;
|
|
220
|
-
response?: ChatResponse;
|
|
12
|
+
interface LspServiceConfig {
|
|
13
|
+
enabled?: boolean;
|
|
221
14
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
export interface ModelExecutionOptions {
|
|
267
|
-
signal?: AbortSignal;
|
|
268
|
-
}
|
|
269
|
-
export interface EngineChatModel {
|
|
270
|
-
model: string;
|
|
271
|
-
maxTokens?: number;
|
|
272
|
-
complete(request: ChatRequest, options?: ModelExecutionOptions): Promise<ChatResponse>;
|
|
273
|
-
stream?(request: ChatRequest, options?: ModelExecutionOptions): AsyncIterable<ChatResponseChunk>;
|
|
274
|
-
getModels?(signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
275
|
-
}
|
|
276
|
-
export interface AgentEventContext {
|
|
277
|
-
sessionId: string;
|
|
278
|
-
turnId: string;
|
|
279
|
-
state: TurnState;
|
|
280
|
-
}
|
|
281
|
-
export interface ToolExecutionContext extends AgentEventContext {
|
|
282
|
-
signal: AbortSignal;
|
|
283
|
-
toolCallId?: string;
|
|
284
|
-
}
|
|
285
|
-
export interface ToolRuntimeStartedEvent {
|
|
286
|
-
type: "tool_started";
|
|
287
|
-
toolCall: ToolUseBlock;
|
|
288
|
-
}
|
|
289
|
-
export interface ToolRuntimeOutputChunkEvent {
|
|
290
|
-
type: "tool_output_chunk";
|
|
291
|
-
toolCall: ToolUseBlock;
|
|
292
|
-
chunk: ToolResultChunk;
|
|
293
|
-
}
|
|
294
|
-
export interface ToolRuntimeCompletedEvent {
|
|
295
|
-
type: "tool_completed";
|
|
296
|
-
toolCall: ToolUseBlock;
|
|
297
|
-
result: ToolResult;
|
|
298
|
-
}
|
|
299
|
-
export interface ToolRuntimeRejectedEvent {
|
|
300
|
-
type: "tool_rejected";
|
|
301
|
-
toolCall: ToolUseBlock;
|
|
302
|
-
result: ToolResult;
|
|
303
|
-
}
|
|
304
|
-
export type ToolRuntimeEvent = ToolRuntimeOutputChunkEvent | ToolRuntimeCompletedEvent | ToolRuntimeRejectedEvent | ToolRuntimeStartedEvent;
|
|
305
|
-
export interface AgentUserMessageEvent {
|
|
306
|
-
type: "user_message";
|
|
307
|
-
message: Message;
|
|
308
|
-
}
|
|
309
|
-
export interface AgentModelRequestEvent {
|
|
310
|
-
type: "model_request";
|
|
311
|
-
request: ChatRequest;
|
|
312
|
-
}
|
|
313
|
-
export interface AgentModelResponseEvent {
|
|
314
|
-
type: "model_response";
|
|
315
|
-
response: ChatResponse;
|
|
316
|
-
}
|
|
317
|
-
export interface AgentAssistantMessageEvent {
|
|
318
|
-
type: "assistant_message";
|
|
319
|
-
message: IdentifiedMessage;
|
|
320
|
-
}
|
|
321
|
-
export interface AgentAssistantChunkEvent {
|
|
322
|
-
type: "assistant_chunk";
|
|
323
|
-
index: number;
|
|
324
|
-
messageId: string;
|
|
325
|
-
chunk: ContentDeltaChunk;
|
|
326
|
-
}
|
|
327
|
-
export interface AgentToolUseMessageEvent {
|
|
328
|
-
type: "tool_use_message";
|
|
329
|
-
message: IdentifiedMessage;
|
|
330
|
-
}
|
|
331
|
-
export interface AgentToolUseChunkEvent {
|
|
332
|
-
type: "tool_use_chunk";
|
|
333
|
-
index: number;
|
|
334
|
-
messageId: string;
|
|
335
|
-
chunk: ToolUseDeltaChunk;
|
|
336
|
-
}
|
|
337
|
-
export interface AgentReasoningMessageEvent {
|
|
338
|
-
type: "reasoning_message";
|
|
339
|
-
message: IdentifiedMessage;
|
|
340
|
-
}
|
|
341
|
-
export interface AgentReasoningChunkEvent {
|
|
342
|
-
type: "reasoning_chunk";
|
|
343
|
-
index: number;
|
|
344
|
-
messageId: string;
|
|
345
|
-
chunk: AnthropicThinkingDeltaChunk | OpenAiReasoningDeltaChunk | OpenAiReasoningSummaryDeltaChunk;
|
|
346
|
-
text: string;
|
|
347
|
-
}
|
|
348
|
-
export interface AgentToolCallEvent {
|
|
349
|
-
type: "tool_call";
|
|
350
|
-
toolCall: ToolUseBlock;
|
|
351
|
-
}
|
|
352
|
-
export interface AgentToolResultEvent {
|
|
353
|
-
type: "tool_result";
|
|
354
|
-
result: ToolResult;
|
|
355
|
-
}
|
|
356
|
-
export interface AgentToolResultMessageEvent {
|
|
357
|
-
type: "tool_result_message";
|
|
358
|
-
message: Message;
|
|
359
|
-
}
|
|
360
|
-
export interface AgentFinalMessageEvent {
|
|
361
|
-
type: "final_message";
|
|
362
|
-
message: IdentifiedMessage;
|
|
363
|
-
}
|
|
364
|
-
export interface AgentTurnCompleteEvent {
|
|
365
|
-
type: "turn_complete";
|
|
366
|
-
state: TurnState;
|
|
367
|
-
}
|
|
368
|
-
export type AgentLifecycleEvent = AgentAssistantChunkEvent | AgentAssistantMessageEvent | AgentFinalMessageEvent | AgentModelRequestEvent | AgentModelResponseEvent | AgentReasoningChunkEvent | AgentReasoningMessageEvent | AgentToolCallEvent | AgentToolUseChunkEvent | AgentToolUseMessageEvent | AgentToolResultEvent | AgentToolResultMessageEvent | AgentTurnCompleteEvent | AgentUserMessageEvent;
|
|
369
|
-
export type AgentEvent = AgentLifecycleEvent | ToolRuntimeEvent;
|
|
370
|
-
export type ToolRuntimeDispatchDecision = {
|
|
371
|
-
action: "reject";
|
|
372
|
-
reason?: string;
|
|
373
|
-
} | {
|
|
374
|
-
action: "run";
|
|
375
|
-
};
|
|
376
|
-
export type ToolRuntimeToolCallHandler = (toolCall: ToolUseBlock, ctx: ToolExecutionContext) => Promise<ToolRuntimeDispatchDecision | undefined> | ToolRuntimeDispatchDecision | undefined;
|
|
377
|
-
export type ToolRuntimeEventHandler = (event: ToolRuntimeEvent, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
378
|
-
export type AgentEventHandler = (event: AgentEvent, ctx: AgentEventContext) => Promise<void> | void;
|
|
379
|
-
export interface ToolRuntime {
|
|
380
|
-
listToolSchemas(): ToolSchema[];
|
|
381
|
-
setTools(tools: AnyToolDefinition[]): void;
|
|
382
|
-
executeCalls(toolCalls: ToolUseBlock[], ctx: ToolExecutionContext): Promise<ToolResult[]>;
|
|
383
|
-
execute(toolCall: ToolUseBlock, ctx: ToolExecutionContext): Promise<ToolResult>;
|
|
384
|
-
}
|
|
385
|
-
export type InferJsonSchema<TSchema extends JsonSchema> = TSchema extends JsonSchemaString ? string : TSchema extends JsonSchemaNumber ? number : TSchema extends JsonSchemaBoolean ? boolean : TSchema extends JsonSchemaArray<infer TItem> ? InferJsonSchema<TItem>[] : TSchema extends JsonSchemaObject<infer TProperties, infer TRequired> ? Expand<RequiredProperties<TProperties, TRequired> & OptionalProperties<TProperties, TRequired>> : never;
|
|
386
|
-
export type Expand<TValue> = TValue extends infer TObject ? {
|
|
387
|
-
[TKey in keyof TObject]: TObject[TKey];
|
|
388
|
-
} : never;
|
|
389
|
-
export type RequiredKeyUnion<TRequired extends readonly string[] | undefined> = TRequired extends readonly string[] ? TRequired[number] : never;
|
|
390
|
-
export type OptionalKeyUnion<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = Exclude<keyof TProperties, RequiredKeyUnion<TRequired>>;
|
|
391
|
-
export type RequiredProperties<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = {
|
|
392
|
-
[TKey in Extract<keyof TProperties, RequiredKeyUnion<TRequired>>]: InferJsonSchema<TProperties[TKey]>;
|
|
393
|
-
};
|
|
394
|
-
export type OptionalProperties<TProperties extends Record<string, JsonSchema>, TRequired extends readonly string[] | undefined> = {
|
|
395
|
-
[TKey in OptionalKeyUnion<TProperties, TRequired>]?: InferJsonSchema<TProperties[TKey]>;
|
|
396
|
-
};
|
|
397
|
-
export type ToolOutputValue = JsonValue | ToolOutputEnvelope;
|
|
398
|
-
export type ToolGenerator<TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined> = AsyncGenerator<TYield, TReturn, void>;
|
|
399
|
-
export interface ToolDefinition<TInput extends JsonObject = JsonObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined, TSchema extends JsonSchemaObject = JsonSchemaObject> {
|
|
400
|
-
name: string;
|
|
401
|
-
description: string;
|
|
402
|
-
inputSchema: TSchema;
|
|
403
|
-
execute(input: TInput, ctx: ToolExecutionContext): ToolGenerator<TYield, TReturn>;
|
|
404
|
-
}
|
|
405
|
-
export type AnyToolDefinition = ToolDefinition<JsonObject, ToolOutputValue, ToolOutputValue | undefined, JsonSchemaObject>;
|
|
406
|
-
export type Stage = "afterModelResponse" | "afterToolResult" | "afterTurnComplete" | "beforeAssistantAppend" | "beforeFinalOutput" | "beforeModelRequest" | "beforeToolExecution" | "beforeToolResultAppend" | "onUserMessage";
|
|
407
|
-
export interface PayloadByStage {
|
|
408
|
-
onUserMessage: Message;
|
|
409
|
-
beforeModelRequest: ChatRequest;
|
|
410
|
-
afterModelResponse: ChatResponse;
|
|
411
|
-
beforeToolExecution: ToolUseBlock;
|
|
412
|
-
afterToolResult: ToolResult;
|
|
413
|
-
beforeAssistantAppend: Message;
|
|
414
|
-
beforeFinalOutput: Message;
|
|
415
|
-
beforeToolResultAppend: Message;
|
|
416
|
-
afterTurnComplete: TurnState;
|
|
417
|
-
}
|
|
418
|
-
export interface ExtensionContext {
|
|
419
|
-
state: TurnState;
|
|
420
|
-
}
|
|
421
|
-
type Transformer$1<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => PayloadByStage[S] | Promise<PayloadByStage[S]>;
|
|
422
|
-
export type Observer<S extends Stage> = (payload: PayloadByStage[S], ctx: ExtensionContext) => Promise<void> | void;
|
|
423
|
-
export interface TransformerExtensionRegistration<S extends Stage = Stage> {
|
|
424
|
-
id: string;
|
|
425
|
-
stage: S;
|
|
426
|
-
kind: "transformer";
|
|
427
|
-
order: number;
|
|
428
|
-
enabled: boolean;
|
|
429
|
-
run: Transformer$1<S>;
|
|
430
|
-
}
|
|
431
|
-
export interface ObserverExtensionRegistration<S extends Stage = Stage> {
|
|
432
|
-
id: string;
|
|
433
|
-
stage: S;
|
|
434
|
-
kind: "observer";
|
|
435
|
-
order: number;
|
|
436
|
-
enabled: boolean;
|
|
437
|
-
run: Observer<S>;
|
|
438
|
-
}
|
|
439
|
-
export type ExtensionRegistration<S extends Stage = Stage> = ObserverExtensionRegistration<S> | TransformerExtensionRegistration<S>;
|
|
440
|
-
export type AnyExtensionRegistration = {
|
|
441
|
-
[S in Stage]: ExtensionRegistration<S>;
|
|
442
|
-
}[Stage];
|
|
443
|
-
export interface ExtensionRegistry {
|
|
444
|
-
register(extension: AnyExtensionRegistration): void;
|
|
445
|
-
runTransformers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<PayloadByStage[S]>;
|
|
446
|
-
runObservers<S extends Stage>(stage: S, payload: PayloadByStage[S], ctx: ExtensionContext): Promise<void>;
|
|
447
|
-
}
|
|
448
|
-
export type AgentInput = MessageInput | string;
|
|
449
|
-
export interface AgentOptions {
|
|
450
|
-
sessionId?: string;
|
|
451
|
-
systemPrompt?: string;
|
|
452
|
-
messages?: MessageInput[];
|
|
453
|
-
message?: AgentInput;
|
|
454
|
-
onEvent?: AgentEventHandler;
|
|
455
|
-
onToolCall?: ToolRuntimeToolCallHandler;
|
|
456
|
-
registry?: ExtensionRegistry;
|
|
457
|
-
extensions?: AnyExtensionRegistration[];
|
|
458
|
-
chatModel?: EngineChatModel;
|
|
459
|
-
tools?: AnyToolDefinition[];
|
|
460
|
-
}
|
|
461
|
-
export interface AgentDefinitionFactoryContext {
|
|
462
|
-
agentId: string;
|
|
463
|
-
parentSessionId?: string;
|
|
464
|
-
runId?: string;
|
|
465
|
-
toolCallId?: string;
|
|
466
|
-
}
|
|
467
|
-
export interface OpenAiFunctionCall {
|
|
468
|
-
type: "function_call";
|
|
469
|
-
call_id: string;
|
|
470
|
-
name: string;
|
|
471
|
-
arguments: string;
|
|
472
|
-
}
|
|
473
|
-
export interface OpenAiOutputTextPart {
|
|
474
|
-
type: "output_text";
|
|
475
|
-
text: string;
|
|
476
|
-
}
|
|
477
|
-
export interface OpenAiRefusalPart {
|
|
478
|
-
type: "refusal";
|
|
479
|
-
refusal: string;
|
|
480
|
-
}
|
|
481
|
-
export interface OpenAiOutputMessage {
|
|
482
|
-
type: "message";
|
|
483
|
-
content?: Array<OpenAiOutputTextPart | OpenAiRefusalPart>;
|
|
484
|
-
role?: string;
|
|
485
|
-
status?: string;
|
|
486
|
-
}
|
|
487
|
-
export interface OpenAiReasoningOutputItem {
|
|
488
|
-
type: "reasoning";
|
|
489
|
-
content?: Array<{
|
|
490
|
-
text?: string;
|
|
491
|
-
type?: string;
|
|
492
|
-
}>;
|
|
493
|
-
encrypted_content?: string;
|
|
494
|
-
id?: string;
|
|
495
|
-
status?: string;
|
|
496
|
-
summary?: OpenAiReasoningSummaryText[];
|
|
497
|
-
text?: string;
|
|
498
|
-
}
|
|
499
|
-
export type OpenAiResponsesOutputItem = JsonObject | OpenAiFunctionCall | OpenAiOutputMessage | OpenAiReasoningOutputItem;
|
|
500
|
-
export interface BashToolInput {
|
|
501
|
-
command: string;
|
|
502
|
-
cwd?: string;
|
|
503
|
-
timeoutMs?: number;
|
|
504
|
-
ignoreOutput?: boolean;
|
|
505
|
-
}
|
|
506
|
-
export interface BashToolOptions {
|
|
507
|
-
defaultCwd?: string;
|
|
508
|
-
defaultTimeoutMs?: number;
|
|
509
|
-
description?: string;
|
|
510
|
-
env?: NodeJS.ProcessEnv;
|
|
511
|
-
name?: string;
|
|
512
|
-
shellPath?: string;
|
|
513
|
-
stripAnsi?: boolean;
|
|
514
|
-
}
|
|
515
|
-
export declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
516
|
-
command: string;
|
|
517
|
-
cwd?: string | undefined;
|
|
518
|
-
timeoutMs?: number | undefined;
|
|
519
|
-
ignoreOutput?: boolean | undefined;
|
|
15
|
+
|
|
16
|
+
interface LspService {
|
|
17
|
+
isEnabled(): boolean;
|
|
18
|
+
hasClients(file: string): Promise<boolean>;
|
|
19
|
+
touchFile(filePath: string, waitDiagnostics?: boolean): Promise<void>;
|
|
20
|
+
diagnostics(): Promise<Record<string, Diagnostic[]>>;
|
|
21
|
+
diagnosticsForFile(filePath: string): Promise<Diagnostic[]>;
|
|
22
|
+
definition(pos: LspPosition): Promise<Location[]>;
|
|
23
|
+
references(pos: LspPosition): Promise<Location[]>;
|
|
24
|
+
hover(pos: LspPosition): Promise<Hover[]>;
|
|
25
|
+
documentSymbol(filePath: string): Promise<(DocumentSymbol | SymbolInformation)[]>;
|
|
26
|
+
workspaceSymbol(query: string): Promise<SymbolInformation[]>;
|
|
27
|
+
implementation(pos: LspPosition): Promise<Location[]>;
|
|
28
|
+
prepareCallHierarchy(pos: LspPosition): Promise<CallHierarchyItem[]>;
|
|
29
|
+
incomingCalls(pos: LspPosition): Promise<CallHierarchyIncomingCall[]>;
|
|
30
|
+
outgoingCalls(pos: LspPosition): Promise<CallHierarchyOutgoingCall[]>;
|
|
31
|
+
shutdown(): Promise<void>;
|
|
32
|
+
status(): {
|
|
33
|
+
connectedClients: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
declare function createLspService(config?: LspServiceConfig): LspService;
|
|
37
|
+
|
|
38
|
+
interface BashToolInput {
|
|
39
|
+
command: string;
|
|
40
|
+
cwd?: string;
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
ignoreOutput?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface BashToolOptions {
|
|
45
|
+
allowedDirs?: readonly string[];
|
|
46
|
+
defaultCwd?: string;
|
|
47
|
+
defaultTimeoutMs?: number;
|
|
48
|
+
description?: string;
|
|
49
|
+
env?: NodeJS.ProcessEnv;
|
|
50
|
+
name?: string;
|
|
51
|
+
shellPath?: string;
|
|
52
|
+
stripAnsi?: boolean;
|
|
53
|
+
}
|
|
54
|
+
declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
55
|
+
command: string;
|
|
56
|
+
timeoutMs?: number | undefined;
|
|
57
|
+
cwd?: string | undefined;
|
|
58
|
+
ignoreOutput?: boolean | undefined;
|
|
520
59
|
}, string, ToolOutputEnvelope, {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
"command"
|
|
538
|
-
];
|
|
60
|
+
type: "object";
|
|
61
|
+
properties: {
|
|
62
|
+
command: {
|
|
63
|
+
type: "string";
|
|
64
|
+
};
|
|
65
|
+
cwd: {
|
|
66
|
+
type: "string";
|
|
67
|
+
};
|
|
68
|
+
timeoutMs: {
|
|
69
|
+
type: "number";
|
|
70
|
+
};
|
|
71
|
+
ignoreOutput: {
|
|
72
|
+
type: "boolean";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
required: readonly ["command"];
|
|
539
76
|
}>;
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
77
|
+
declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
|
|
78
|
+
command: string;
|
|
79
|
+
timeoutMs?: number | undefined;
|
|
80
|
+
cwd?: string | undefined;
|
|
81
|
+
ignoreOutput?: boolean | undefined;
|
|
545
82
|
}, string, ToolOutputEnvelope, {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
"command"
|
|
563
|
-
];
|
|
83
|
+
type: "object";
|
|
84
|
+
properties: {
|
|
85
|
+
command: {
|
|
86
|
+
type: "string";
|
|
87
|
+
};
|
|
88
|
+
cwd: {
|
|
89
|
+
type: "string";
|
|
90
|
+
};
|
|
91
|
+
timeoutMs: {
|
|
92
|
+
type: "number";
|
|
93
|
+
};
|
|
94
|
+
ignoreOutput: {
|
|
95
|
+
type: "boolean";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
required: readonly ["command"];
|
|
564
99
|
}>;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
oauth?: MCPOAuthConfig;
|
|
576
|
-
}
|
|
577
|
-
export interface MCPServerConfig {
|
|
578
|
-
command?: string;
|
|
579
|
-
args?: string[];
|
|
580
|
-
env?: Record<string, string>;
|
|
581
|
-
transport?: "stdio" | "http";
|
|
582
|
-
url?: string;
|
|
583
|
-
headers?: Record<string, string>;
|
|
584
|
-
prefix?: string;
|
|
585
|
-
timeoutMs?: number;
|
|
586
|
-
enabled?: boolean;
|
|
587
|
-
auth?: MCPAuthConfig;
|
|
588
|
-
}
|
|
589
|
-
export interface CommandDefinitionSource {
|
|
590
|
-
scope: AgentDefinitionSourceScope;
|
|
591
|
-
path: string;
|
|
592
|
-
directory?: string;
|
|
593
|
-
kind?: "custom" | "default";
|
|
594
|
-
}
|
|
595
|
-
export interface CommandDefinitionReference {
|
|
596
|
-
id: string;
|
|
597
|
-
name: string;
|
|
598
|
-
description: string;
|
|
599
|
-
argumentHint?: string;
|
|
600
|
-
arguments?: string[];
|
|
601
|
-
source: CommandDefinitionSource;
|
|
602
|
-
}
|
|
603
|
-
export interface SerializedCommandDefinition extends CommandDefinitionReference {
|
|
604
|
-
instructions: string;
|
|
605
|
-
}
|
|
606
|
-
export type AgentDefinitionSourceScope = "builtin" | "direct" | "env" | "explicit" | "global" | "local" | "profile";
|
|
607
|
-
export type CommandReference = CommandDefinitionReference;
|
|
608
|
-
export type LoadedCommand = SerializedCommandDefinition;
|
|
609
|
-
export interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
|
|
610
|
-
commands: TRef[];
|
|
611
|
-
loadCommand: (reference: TRef) => Promise<LoadedCommand>;
|
|
612
|
-
}
|
|
613
|
-
export declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): ToolDefinition<{
|
|
614
|
-
name: string;
|
|
615
|
-
args?: string | undefined;
|
|
100
|
+
|
|
101
|
+
type CommandReference = CommandDefinitionReference;
|
|
102
|
+
type LoadedCommand = SerializedCommandDefinition;
|
|
103
|
+
interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
|
|
104
|
+
commands: TRef[];
|
|
105
|
+
loadCommand: (reference: TRef) => Promise<LoadedCommand>;
|
|
106
|
+
}
|
|
107
|
+
declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): ToolDefinition<{
|
|
108
|
+
name: string;
|
|
109
|
+
args?: string | undefined;
|
|
616
110
|
}, ToolOutputEnvelope, undefined, {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
"name"
|
|
628
|
-
];
|
|
111
|
+
type: "object";
|
|
112
|
+
properties: {
|
|
113
|
+
name: {
|
|
114
|
+
type: "string";
|
|
115
|
+
};
|
|
116
|
+
args: {
|
|
117
|
+
type: "string";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
required: readonly ["name"];
|
|
629
121
|
}>;
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
122
|
+
|
|
123
|
+
interface FileEditToolOptions {
|
|
124
|
+
allowedDirs?: readonly string[];
|
|
125
|
+
defaultCwd?: string;
|
|
126
|
+
name?: string;
|
|
127
|
+
}
|
|
128
|
+
declare function createFileEditTool(options?: FileEditToolOptions): ToolDefinition<{
|
|
129
|
+
filePath: string;
|
|
130
|
+
oldText: string;
|
|
131
|
+
newText: string;
|
|
132
|
+
dryRun?: boolean | undefined;
|
|
639
133
|
}, ToolOutputEnvelope, undefined, {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
"filePath",
|
|
657
|
-
"oldText",
|
|
658
|
-
"newText"
|
|
659
|
-
];
|
|
134
|
+
type: "object";
|
|
135
|
+
properties: {
|
|
136
|
+
filePath: {
|
|
137
|
+
type: "string";
|
|
138
|
+
};
|
|
139
|
+
oldText: {
|
|
140
|
+
type: "string";
|
|
141
|
+
};
|
|
142
|
+
newText: {
|
|
143
|
+
type: "string";
|
|
144
|
+
};
|
|
145
|
+
dryRun: {
|
|
146
|
+
type: "boolean";
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
required: readonly ["filePath", "oldText", "newText"];
|
|
660
150
|
}>;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
151
|
+
|
|
152
|
+
interface FileNewToolOptions {
|
|
153
|
+
allowedDirs?: readonly string[];
|
|
154
|
+
defaultCwd?: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
}
|
|
157
|
+
declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
|
|
158
|
+
content: string;
|
|
159
|
+
filePath: string;
|
|
668
160
|
}, ToolOutputEnvelope, undefined, {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
"filePath",
|
|
680
|
-
"content"
|
|
681
|
-
];
|
|
161
|
+
type: "object";
|
|
162
|
+
properties: {
|
|
163
|
+
filePath: {
|
|
164
|
+
type: "string";
|
|
165
|
+
};
|
|
166
|
+
content: {
|
|
167
|
+
type: "string";
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
required: readonly ["filePath", "content"];
|
|
682
171
|
}>;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
172
|
+
|
|
173
|
+
interface FileReadToolOptions {
|
|
174
|
+
allowedDirs?: readonly string[];
|
|
175
|
+
defaultCwd?: string;
|
|
176
|
+
name?: string;
|
|
177
|
+
}
|
|
178
|
+
declare function createFileReadTool(options?: FileReadToolOptions): ToolDefinition<{
|
|
179
|
+
path: string;
|
|
180
|
+
lineStart?: number | undefined;
|
|
181
|
+
lineEnd?: number | undefined;
|
|
691
182
|
}, ToolOutputEnvelope, undefined, {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
"path"
|
|
706
|
-
];
|
|
183
|
+
type: "object";
|
|
184
|
+
properties: {
|
|
185
|
+
path: {
|
|
186
|
+
type: "string";
|
|
187
|
+
};
|
|
188
|
+
lineStart: {
|
|
189
|
+
type: "number";
|
|
190
|
+
};
|
|
191
|
+
lineEnd: {
|
|
192
|
+
type: "number";
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
required: readonly ["path"];
|
|
707
196
|
}>;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
197
|
+
|
|
198
|
+
interface GlobToolOptions {
|
|
199
|
+
allowedDirs?: readonly string[];
|
|
200
|
+
defaultCwd?: string;
|
|
201
|
+
limit?: number;
|
|
202
|
+
name?: string;
|
|
203
|
+
}
|
|
204
|
+
declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
|
|
205
|
+
pattern: string;
|
|
206
|
+
path?: string | undefined;
|
|
207
|
+
limit?: number | undefined;
|
|
717
208
|
}, ToolOutputEnvelope, undefined, {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
"pattern"
|
|
732
|
-
];
|
|
209
|
+
type: "object";
|
|
210
|
+
properties: {
|
|
211
|
+
pattern: {
|
|
212
|
+
type: "string";
|
|
213
|
+
};
|
|
214
|
+
path: {
|
|
215
|
+
type: "string";
|
|
216
|
+
};
|
|
217
|
+
limit: {
|
|
218
|
+
type: "number";
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
required: readonly ["pattern"];
|
|
733
222
|
}>;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
223
|
+
|
|
224
|
+
interface GrepToolOptions {
|
|
225
|
+
allowedDirs?: readonly string[];
|
|
226
|
+
defaultCwd?: string;
|
|
227
|
+
limit?: number;
|
|
228
|
+
name?: string;
|
|
229
|
+
}
|
|
230
|
+
declare function createGrepTool(options?: GrepToolOptions): ToolDefinition<{
|
|
231
|
+
pattern: string;
|
|
232
|
+
path?: string | undefined;
|
|
233
|
+
limit?: number | undefined;
|
|
234
|
+
include?: string | undefined;
|
|
235
|
+
context?: number | undefined;
|
|
745
236
|
}, ToolOutputEnvelope, undefined, {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
"pattern"
|
|
766
|
-
];
|
|
237
|
+
type: "object";
|
|
238
|
+
properties: {
|
|
239
|
+
pattern: {
|
|
240
|
+
type: "string";
|
|
241
|
+
};
|
|
242
|
+
path: {
|
|
243
|
+
type: "string";
|
|
244
|
+
};
|
|
245
|
+
include: {
|
|
246
|
+
type: "string";
|
|
247
|
+
};
|
|
248
|
+
limit: {
|
|
249
|
+
type: "number";
|
|
250
|
+
};
|
|
251
|
+
context: {
|
|
252
|
+
type: "number";
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
required: readonly ["pattern"];
|
|
767
256
|
}>;
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
export declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
|
|
773
|
-
export interface LsToolOptions {
|
|
774
|
-
defaultCwd?: string;
|
|
775
|
-
name?: string;
|
|
257
|
+
|
|
258
|
+
interface InternalToolRuntimeOptions {
|
|
259
|
+
onEvent?: ToolRuntimeEventHandler;
|
|
260
|
+
onToolCall?: ToolRuntimeToolCallHandler;
|
|
776
261
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
262
|
+
declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
|
|
263
|
+
|
|
264
|
+
interface LsToolOptions {
|
|
265
|
+
allowedDirs?: readonly string[];
|
|
266
|
+
defaultCwd?: string;
|
|
267
|
+
name?: string;
|
|
268
|
+
}
|
|
269
|
+
declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
|
|
270
|
+
path: string;
|
|
271
|
+
limit: number;
|
|
780
272
|
}, ToolOutputEnvelope, undefined, {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
273
|
+
type: "object";
|
|
274
|
+
properties: {
|
|
275
|
+
path: {
|
|
276
|
+
type: "string";
|
|
277
|
+
};
|
|
278
|
+
limit: {
|
|
279
|
+
type: "number";
|
|
280
|
+
};
|
|
281
|
+
};
|
|
790
282
|
}>;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
283
|
+
|
|
284
|
+
interface LspToolOptions {
|
|
285
|
+
defaultCwd?: string;
|
|
286
|
+
allowedDirs?: readonly string[];
|
|
287
|
+
lspService?: LspService;
|
|
288
|
+
name?: string;
|
|
289
|
+
}
|
|
290
|
+
declare function createLspTool(options?: LspToolOptions): ToolDefinition<{
|
|
291
|
+
filePath: string;
|
|
292
|
+
line: number;
|
|
293
|
+
character: number;
|
|
294
|
+
operation: string;
|
|
295
|
+
query?: string | undefined;
|
|
296
|
+
}, ToolOutputEnvelope, undefined, {
|
|
297
|
+
type: "object";
|
|
298
|
+
properties: {
|
|
299
|
+
operation: {
|
|
300
|
+
type: "string";
|
|
301
|
+
enum: string[];
|
|
302
|
+
};
|
|
303
|
+
filePath: {
|
|
304
|
+
type: "string";
|
|
305
|
+
};
|
|
306
|
+
line: {
|
|
307
|
+
type: "number";
|
|
308
|
+
};
|
|
309
|
+
character: {
|
|
310
|
+
type: "number";
|
|
311
|
+
};
|
|
312
|
+
query: {
|
|
313
|
+
type: "string";
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
required: readonly ["operation", "filePath", "line", "character"];
|
|
317
|
+
}>;
|
|
318
|
+
|
|
319
|
+
interface McpOAuthProviderOptions {
|
|
320
|
+
serverName: string;
|
|
321
|
+
callbackUrl: string;
|
|
322
|
+
storageDir: string;
|
|
323
|
+
config: MCPAuthConfig;
|
|
324
|
+
onRedirect(url: URL): void | Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
declare function createMcpOAuthProvider(options: McpOAuthProviderOptions): OAuthClientProvider;
|
|
327
|
+
|
|
328
|
+
interface McpToolDescriptor {
|
|
329
|
+
name: string;
|
|
330
|
+
description?: string;
|
|
331
|
+
inputSchema?: unknown;
|
|
332
|
+
}
|
|
333
|
+
interface McpToolClient {
|
|
334
|
+
callTool(input: {
|
|
335
|
+
name: string;
|
|
336
|
+
arguments?: JsonObject;
|
|
337
|
+
}): Promise<CallToolResult>;
|
|
338
|
+
}
|
|
339
|
+
declare function createMcpToolName(serverName: string, toolName: string): string;
|
|
340
|
+
declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
|
|
341
|
+
declare function createMcpTool(options: {
|
|
342
|
+
serverName: string;
|
|
343
|
+
tool: McpToolDescriptor;
|
|
344
|
+
client: McpToolClient;
|
|
816
345
|
}): ToolDefinition<{
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
346
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
|
|
347
|
+
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
348
|
+
})[] | {
|
|
349
|
+
[x: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
|
|
350
|
+
})[] | {
|
|
351
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
352
|
+
})[] | {
|
|
353
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
354
|
+
})[] | {
|
|
355
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
356
|
+
})[] | {
|
|
357
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
358
|
+
})[] | {
|
|
359
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
360
|
+
})[] | {
|
|
361
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
362
|
+
})[] | {
|
|
363
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
364
|
+
})[] | {
|
|
365
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
366
|
+
})[] | {
|
|
367
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
368
|
+
})[] | {
|
|
369
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
370
|
+
};
|
|
842
371
|
}, ToolOutputEnvelope, undefined, JsonSchemaObject<Record<string, JsonSchema>, readonly string[] | undefined>>;
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
372
|
+
|
|
373
|
+
interface ConnectedMcpClient extends McpToolClient {
|
|
374
|
+
listTools(): Promise<ListToolsResult>;
|
|
375
|
+
close(): Promise<void>;
|
|
846
376
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
377
|
+
type McpServerConnectionStatus = {
|
|
378
|
+
status: "connected";
|
|
379
|
+
toolCount: number;
|
|
850
380
|
} | {
|
|
851
|
-
|
|
381
|
+
status: "disabled";
|
|
852
382
|
} | {
|
|
853
|
-
|
|
854
|
-
|
|
383
|
+
status: "authRequired";
|
|
384
|
+
message: string;
|
|
855
385
|
} | {
|
|
856
|
-
|
|
857
|
-
|
|
386
|
+
status: "error";
|
|
387
|
+
message: string;
|
|
858
388
|
};
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
389
|
+
interface McpToolBundle {
|
|
390
|
+
tools: AnyToolDefinition[];
|
|
391
|
+
servers: Record<string, McpServerConnectionStatus>;
|
|
392
|
+
close(): Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
interface McpConnectionOptions {
|
|
395
|
+
oauth?: {
|
|
396
|
+
storageDir: string;
|
|
397
|
+
callbackUrl: string;
|
|
398
|
+
onRedirect(serverName: string, url: URL): void | Promise<void>;
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
|
|
402
|
+
declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
|
|
403
|
+
declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
|
|
404
|
+
declare function createMcpToolsFromServers(options: {
|
|
405
|
+
servers?: Record<string, MCPServerConfig>;
|
|
406
|
+
allowedTools?: Record<string, Record<string, boolean>>;
|
|
407
|
+
connection?: McpConnectionOptions;
|
|
408
|
+
connect?: McpConnector;
|
|
879
409
|
}): Promise<McpToolBundle>;
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
410
|
+
|
|
411
|
+
declare function createMockToolRuntime(): ToolRuntime;
|
|
412
|
+
|
|
413
|
+
type RipgrepMatch = {
|
|
414
|
+
filePath: string;
|
|
415
|
+
isContext?: boolean;
|
|
416
|
+
lineNum: number;
|
|
417
|
+
lineText: string;
|
|
886
418
|
};
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
419
|
+
declare function filepath(): Promise<string>;
|
|
420
|
+
declare function files(opts: {
|
|
421
|
+
cwd: string;
|
|
422
|
+
glob?: string[];
|
|
891
423
|
}): AsyncGenerator<string>;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
424
|
+
declare function search(opts: {
|
|
425
|
+
context?: number;
|
|
426
|
+
cwd: string;
|
|
427
|
+
file?: string;
|
|
428
|
+
glob?: string;
|
|
429
|
+
limit?: number;
|
|
430
|
+
pattern: string;
|
|
899
431
|
}): Promise<RipgrepMatch[]>;
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
432
|
+
|
|
433
|
+
interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
|
|
434
|
+
parentSessionId: string;
|
|
435
|
+
runId: string;
|
|
903
436
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
437
|
+
type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => AgentOptions | Promise<AgentOptions>);
|
|
438
|
+
interface CreateDelegationToolsOptions {
|
|
439
|
+
agents?: Record<string, DelegatedAgentDefinition>;
|
|
907
440
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
441
|
+
declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
442
|
+
task: string;
|
|
443
|
+
agentId: string;
|
|
911
444
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
445
|
+
type: "object";
|
|
446
|
+
properties: {
|
|
447
|
+
agentId: {
|
|
448
|
+
type: "string";
|
|
449
|
+
};
|
|
450
|
+
task: {
|
|
451
|
+
type: "string";
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
required: string[];
|
|
922
455
|
}>;
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
456
|
+
declare const createDelegateToAgentTool: typeof createAssignTaskTool;
|
|
457
|
+
declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
458
|
+
task: string;
|
|
459
|
+
agentId: string;
|
|
927
460
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
461
|
+
type: "object";
|
|
462
|
+
properties: {
|
|
463
|
+
agentId: {
|
|
464
|
+
type: "string";
|
|
465
|
+
};
|
|
466
|
+
task: {
|
|
467
|
+
type: "string";
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
required: string[];
|
|
938
471
|
}>[];
|
|
472
|
+
|
|
939
473
|
/** Minimal shape of a skill source reference — matches @nuvin/config SkillDefinitionSource */
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
474
|
+
interface SkillSource {
|
|
475
|
+
path: string;
|
|
476
|
+
directory?: string;
|
|
477
|
+
scope?: string;
|
|
944
478
|
}
|
|
945
479
|
/** Minimal shape of a skill reference — matches @nuvin/config SkillDefinitionReference */
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
480
|
+
interface SkillReference {
|
|
481
|
+
id: string;
|
|
482
|
+
name: string;
|
|
483
|
+
description: string;
|
|
484
|
+
source: SkillSource;
|
|
951
485
|
}
|
|
952
486
|
/** Minimal shape of a loaded skill — matches @nuvin/config SerializedSkillDefinition */
|
|
953
|
-
|
|
954
|
-
|
|
487
|
+
interface LoadedSkill extends SkillReference {
|
|
488
|
+
instructions: string;
|
|
955
489
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
490
|
+
interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
|
|
491
|
+
skills: TRef[];
|
|
492
|
+
loadSkill: (reference: TRef) => Promise<LoadedSkill>;
|
|
959
493
|
}
|
|
960
|
-
|
|
961
|
-
|
|
494
|
+
declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
|
|
495
|
+
name: string;
|
|
962
496
|
}, ToolOutputEnvelope, undefined, {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
"name"
|
|
971
|
-
];
|
|
497
|
+
type: "object";
|
|
498
|
+
properties: {
|
|
499
|
+
name: {
|
|
500
|
+
type: "string";
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
required: readonly ["name"];
|
|
972
504
|
}>;
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
505
|
+
|
|
506
|
+
declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
|
|
507
|
+
declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
|
|
508
|
+
declare class ToolExecutionError extends Error {
|
|
509
|
+
readonly structured: JsonObject;
|
|
510
|
+
constructor(message: string, structured?: JsonObject);
|
|
511
|
+
}
|
|
512
|
+
declare function defineTool<TSchema extends JsonSchemaObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined>(definition: {
|
|
513
|
+
name: string;
|
|
514
|
+
description: string;
|
|
515
|
+
inputSchema: TSchema;
|
|
516
|
+
execute(input: InferJsonSchema<TSchema>, ctx: ToolExecutionContext): AsyncGenerator<TYield, TReturn, void>;
|
|
984
517
|
}): ToolDefinition<InferJsonSchema<TSchema>, TYield, TReturn, TSchema>;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
518
|
+
declare class ToolRegistry {
|
|
519
|
+
private readonly toolsByName;
|
|
520
|
+
constructor(tools?: AnyToolDefinition[]);
|
|
521
|
+
register(tool: AnyToolDefinition): void;
|
|
522
|
+
get(name: string): AnyToolDefinition | undefined;
|
|
523
|
+
list(): AnyToolDefinition[];
|
|
524
|
+
listToolSchemas(): ToolSchema[];
|
|
525
|
+
}
|
|
526
|
+
declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
|
|
527
|
+
declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
|
|
528
|
+
|
|
529
|
+
interface ViewFileToolOptions {
|
|
530
|
+
allowedDirs?: readonly string[];
|
|
531
|
+
defaultCwd?: string;
|
|
532
|
+
maxBytes?: number;
|
|
533
|
+
name?: string;
|
|
534
|
+
}
|
|
535
|
+
declare function createViewFileTool(options?: ViewFileToolOptions): ToolDefinition<{
|
|
536
|
+
path: string;
|
|
537
|
+
detail?: string | undefined;
|
|
538
|
+
}, ToolOutputEnvelope, undefined, {
|
|
539
|
+
type: "object";
|
|
540
|
+
properties: {
|
|
541
|
+
path: {
|
|
542
|
+
type: "string";
|
|
543
|
+
};
|
|
544
|
+
detail: {
|
|
545
|
+
type: "string";
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
required: readonly ["path"];
|
|
549
|
+
}>;
|
|
550
|
+
|
|
551
|
+
interface WebFetchToolOptions {
|
|
552
|
+
maxBytes?: number;
|
|
553
|
+
timeoutMs?: number;
|
|
554
|
+
name?: string;
|
|
555
|
+
}
|
|
556
|
+
declare function createWebFetchTool(options?: WebFetchToolOptions): ToolDefinition<{
|
|
557
|
+
url: string;
|
|
558
|
+
description?: string | undefined;
|
|
1003
559
|
}, ToolOutputEnvelope, undefined, {
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
"path"
|
|
1015
|
-
];
|
|
560
|
+
type: "object";
|
|
561
|
+
properties: {
|
|
562
|
+
description: {
|
|
563
|
+
type: "string";
|
|
564
|
+
};
|
|
565
|
+
url: {
|
|
566
|
+
type: "string";
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
required: readonly ["url"];
|
|
1016
570
|
}>;
|
|
1017
|
-
export declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
|
|
1018
|
-
export declare function assertWorkspaceFile(filePath: string): Promise<void>;
|
|
1019
|
-
export declare function isProbablyBinary(buffer: Buffer): boolean;
|
|
1020
571
|
|
|
1021
|
-
|
|
572
|
+
interface WebSearchToolOptions {
|
|
573
|
+
googleCseKey: string;
|
|
574
|
+
googleCseCx: string;
|
|
575
|
+
name?: string;
|
|
576
|
+
}
|
|
577
|
+
declare function createWebSearchTool(options: WebSearchToolOptions): ToolDefinition<{
|
|
578
|
+
query: string;
|
|
579
|
+
type?: string | undefined;
|
|
580
|
+
count?: number | undefined;
|
|
581
|
+
description?: string | undefined;
|
|
582
|
+
offset?: number | undefined;
|
|
583
|
+
safe?: boolean | undefined;
|
|
584
|
+
domains?: string[] | undefined;
|
|
585
|
+
recencyDays?: number | undefined;
|
|
586
|
+
lang?: string | undefined;
|
|
587
|
+
region?: string | undefined;
|
|
588
|
+
hydrateMeta?: boolean | undefined;
|
|
589
|
+
}, ToolOutputEnvelope, undefined, {
|
|
590
|
+
type: "object";
|
|
591
|
+
properties: {
|
|
592
|
+
description: {
|
|
593
|
+
type: "string";
|
|
594
|
+
};
|
|
595
|
+
query: {
|
|
596
|
+
type: "string";
|
|
597
|
+
};
|
|
598
|
+
count: {
|
|
599
|
+
type: "number";
|
|
600
|
+
};
|
|
601
|
+
offset: {
|
|
602
|
+
type: "number";
|
|
603
|
+
};
|
|
604
|
+
domains: {
|
|
605
|
+
type: "array";
|
|
606
|
+
items: {
|
|
607
|
+
type: "string";
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
recencyDays: {
|
|
611
|
+
type: "number";
|
|
612
|
+
};
|
|
613
|
+
lang: {
|
|
614
|
+
type: "string";
|
|
615
|
+
};
|
|
616
|
+
region: {
|
|
617
|
+
type: "string";
|
|
618
|
+
};
|
|
619
|
+
safe: {
|
|
620
|
+
type: "boolean";
|
|
621
|
+
};
|
|
622
|
+
type: {
|
|
623
|
+
type: "string";
|
|
624
|
+
};
|
|
625
|
+
hydrateMeta: {
|
|
626
|
+
type: "boolean";
|
|
627
|
+
};
|
|
628
|
+
};
|
|
629
|
+
required: readonly ["query"];
|
|
630
|
+
}>;
|
|
631
|
+
|
|
632
|
+
declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
|
|
633
|
+
declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
|
|
634
|
+
declare function assertWorkspaceFile(filePath: string): Promise<void>;
|
|
635
|
+
declare function isProbablyBinary(buffer: Buffer): boolean;
|
|
636
|
+
|
|
637
|
+
export { type BashToolInput, type BashToolOptions, type CommandReference, type CommandToolOptions, type CreateDelegationToolsOptions, type DelegatedAgentDefinition, type DelegatedAgentFactoryContext, type FileEditToolOptions, type FileNewToolOptions, type FileReadToolOptions, type GlobToolOptions, type GrepToolOptions, type LoadedCommand, type LoadedSkill, type LsToolOptions, type LspService, type LspServiceConfig, type LspToolOptions, type McpConnectionOptions, type McpConnector, type McpOAuthProviderOptions, type McpServerConnectionStatus, type McpToolBundle, type McpToolClient, type McpToolDescriptor, type RipgrepMatch, type SkillReference, type SkillSource, type SkillToolOptions, ToolExecutionError, ToolRegistry, type ViewFileToolOptions, type WebFetchToolOptions, type WebSearchToolOptions, assertWorkspaceFile, buildMcpHttpHeaders, connectMcpServer, createAssignTaskTool, createBashTool, createDelegateToAgentTool, createDelegationTools, createFileEditTool, createFileNewTool, createFileReadTool, createGlobTool, createGrepTool, createInternalToolRuntime, createInvokeCommandTool, createLoadSkillTool, createLsTool, createLspService, createLspTool, createMcpOAuthProvider, createMcpTool, createMcpToolName, createMcpToolsFromServers, createMockToolRuntime, createShellExecTool, createToolOutput, createViewFileTool, createWebFetchTool, createWebSearchTool, defineTool, deriveFinalToolOutput, filepath, files, isProbablyBinary, normalizeToolOutputValue, resolveAllowedPath, resolveWorkspacePath, search, toNuvinToolSchema, validateToolInput };
|