@nuvin/agent-core 0.0.0-rc.3 → 0.0.0-rc.4

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.
@@ -1,1021 +1,570 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
1
+ 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';
2
+ import { CommandDefinitionReference, SerializedCommandDefinition, MCPAuthConfig, MCPServerConfig } from '@nuvin/config';
3
3
  import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
4
4
  import { CallToolResult, ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
5
5
 
6
- export type JsonPrimitive = boolean | number | string | null;
7
- export interface JsonObject {
8
- [key: string]: JsonValue;
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;
205
- }
206
- export interface ChatResponseChunk {
207
- type: "anthropic_signature_delta" | "anthropic_thinking_delta" | "content_delta" | "done" | "openai_reasoning_delta" | "openai_reasoning_summary_delta" | "tool_use_delta";
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;
221
- }
222
- export interface ModelLimits {
223
- contextWindow?: number;
224
- maxOutput?: number;
225
- }
226
- export interface ModelInfo {
227
- id: string;
228
- name: string;
229
- limits?: ModelLimits;
230
- supportedEndpoints?: string[];
231
- }
232
- export interface ToolResultMeta {
233
- truncated?: boolean;
234
- originalBytes?: number;
235
- transforms: string[];
236
- }
237
- export interface ToolResultChunk {
238
- output: string;
239
- structured: JsonObject;
240
- content?: ToolResultContent;
241
- }
242
- export interface ToolOutputEnvelope {
243
- output: string;
244
- structured?: JsonObject;
245
- content?: ToolResultContent;
246
- }
247
- export interface ToolResult {
248
- callId: string;
249
- toolName: string;
250
- status: "error" | "ok";
251
- output: string;
252
- structured: JsonObject;
253
- content?: ToolResultContent;
254
- chunks: ToolResultChunk[];
255
- meta: ToolResultMeta;
256
- }
257
- export interface TurnState {
258
- sessionId: string;
259
- turnId: string;
260
- system: TextBlock[];
261
- messages: Message[];
262
- lastResponse?: ChatResponse;
263
- toolResults: ToolResult[];
264
- finalMessage?: IdentifiedMessage;
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;
6
+ interface BashToolInput {
7
+ command: string;
8
+ cwd?: string;
9
+ timeoutMs?: number;
10
+ ignoreOutput?: boolean;
11
+ }
12
+ interface BashToolOptions {
13
+ allowedDirs?: readonly string[];
14
+ defaultCwd?: string;
15
+ defaultTimeoutMs?: number;
16
+ description?: string;
17
+ env?: NodeJS.ProcessEnv;
18
+ name?: string;
19
+ shellPath?: string;
20
+ stripAnsi?: boolean;
21
+ }
22
+ declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
23
+ command: string;
24
+ cwd?: string | undefined;
25
+ timeoutMs?: number | undefined;
26
+ ignoreOutput?: boolean | undefined;
520
27
  }, string, ToolOutputEnvelope, {
521
- type: "object";
522
- properties: {
523
- command: {
524
- type: "string";
525
- };
526
- cwd: {
527
- type: "string";
528
- };
529
- timeoutMs: {
530
- type: "number";
531
- };
532
- ignoreOutput: {
533
- type: "boolean";
534
- };
535
- };
536
- required: readonly [
537
- "command"
538
- ];
28
+ type: "object";
29
+ properties: {
30
+ command: {
31
+ type: "string";
32
+ };
33
+ cwd: {
34
+ type: "string";
35
+ };
36
+ timeoutMs: {
37
+ type: "number";
38
+ };
39
+ ignoreOutput: {
40
+ type: "boolean";
41
+ };
42
+ };
43
+ required: readonly ["command"];
539
44
  }>;
540
- export declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
541
- command: string;
542
- cwd?: string | undefined;
543
- timeoutMs?: number | undefined;
544
- ignoreOutput?: boolean | undefined;
45
+ declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
46
+ command: string;
47
+ cwd?: string | undefined;
48
+ timeoutMs?: number | undefined;
49
+ ignoreOutput?: boolean | undefined;
545
50
  }, string, ToolOutputEnvelope, {
546
- type: "object";
547
- properties: {
548
- command: {
549
- type: "string";
550
- };
551
- cwd: {
552
- type: "string";
553
- };
554
- timeoutMs: {
555
- type: "number";
556
- };
557
- ignoreOutput: {
558
- type: "boolean";
559
- };
560
- };
561
- required: readonly [
562
- "command"
563
- ];
51
+ type: "object";
52
+ properties: {
53
+ command: {
54
+ type: "string";
55
+ };
56
+ cwd: {
57
+ type: "string";
58
+ };
59
+ timeoutMs: {
60
+ type: "number";
61
+ };
62
+ ignoreOutput: {
63
+ type: "boolean";
64
+ };
65
+ };
66
+ required: readonly ["command"];
564
67
  }>;
565
- export interface MCPOAuthConfig {
566
- clientId?: string;
567
- clientMetadataUrl?: string;
568
- authorizationServer?: string;
569
- scopes?: string[];
570
- tokenStorageKey?: string;
571
- }
572
- export interface MCPAuthConfig {
573
- type: "none" | "bearer" | "oauth";
574
- token?: string;
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;
68
+
69
+ type CommandReference = CommandDefinitionReference;
70
+ type LoadedCommand = SerializedCommandDefinition;
71
+ interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
72
+ commands: TRef[];
73
+ loadCommand: (reference: TRef) => Promise<LoadedCommand>;
74
+ }
75
+ declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): ToolDefinition<{
76
+ name: string;
77
+ args?: string | undefined;
616
78
  }, ToolOutputEnvelope, undefined, {
617
- type: "object";
618
- properties: {
619
- name: {
620
- type: "string";
621
- };
622
- args: {
623
- type: "string";
624
- };
625
- };
626
- required: readonly [
627
- "name"
628
- ];
79
+ type: "object";
80
+ properties: {
81
+ name: {
82
+ type: "string";
83
+ };
84
+ args: {
85
+ type: "string";
86
+ };
87
+ };
88
+ required: readonly ["name"];
629
89
  }>;
630
- export interface FileEditToolOptions {
631
- defaultCwd?: string;
632
- name?: string;
633
- }
634
- export declare function createFileEditTool(options?: FileEditToolOptions): ToolDefinition<{
635
- filePath: string;
636
- oldText: string;
637
- newText: string;
638
- dryRun?: boolean | undefined;
90
+
91
+ interface FileEditToolOptions {
92
+ allowedDirs?: readonly string[];
93
+ defaultCwd?: string;
94
+ name?: string;
95
+ }
96
+ declare function createFileEditTool(options?: FileEditToolOptions): ToolDefinition<{
97
+ filePath: string;
98
+ oldText: string;
99
+ newText: string;
100
+ dryRun?: boolean | undefined;
639
101
  }, ToolOutputEnvelope, undefined, {
640
- type: "object";
641
- properties: {
642
- filePath: {
643
- type: "string";
644
- };
645
- oldText: {
646
- type: "string";
647
- };
648
- newText: {
649
- type: "string";
650
- };
651
- dryRun: {
652
- type: "boolean";
653
- };
654
- };
655
- required: readonly [
656
- "filePath",
657
- "oldText",
658
- "newText"
659
- ];
102
+ type: "object";
103
+ properties: {
104
+ filePath: {
105
+ type: "string";
106
+ };
107
+ oldText: {
108
+ type: "string";
109
+ };
110
+ newText: {
111
+ type: "string";
112
+ };
113
+ dryRun: {
114
+ type: "boolean";
115
+ };
116
+ };
117
+ required: readonly ["filePath", "oldText", "newText"];
660
118
  }>;
661
- export interface FileNewToolOptions {
662
- defaultCwd?: string;
663
- name?: string;
664
- }
665
- export declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
666
- content: string;
667
- filePath: string;
119
+
120
+ interface FileNewToolOptions {
121
+ allowedDirs?: readonly string[];
122
+ defaultCwd?: string;
123
+ name?: string;
124
+ }
125
+ declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
126
+ content: string;
127
+ filePath: string;
668
128
  }, ToolOutputEnvelope, undefined, {
669
- type: "object";
670
- properties: {
671
- filePath: {
672
- type: "string";
673
- };
674
- content: {
675
- type: "string";
676
- };
677
- };
678
- required: readonly [
679
- "filePath",
680
- "content"
681
- ];
129
+ type: "object";
130
+ properties: {
131
+ filePath: {
132
+ type: "string";
133
+ };
134
+ content: {
135
+ type: "string";
136
+ };
137
+ };
138
+ required: readonly ["filePath", "content"];
682
139
  }>;
683
- export interface FileReadToolOptions {
684
- defaultCwd?: string;
685
- name?: string;
686
- }
687
- export declare function createFileReadTool(options?: FileReadToolOptions): ToolDefinition<{
688
- path: string;
689
- lineStart?: number | undefined;
690
- lineEnd?: number | undefined;
140
+
141
+ interface FileReadToolOptions {
142
+ allowedDirs?: readonly string[];
143
+ defaultCwd?: string;
144
+ name?: string;
145
+ }
146
+ declare function createFileReadTool(options?: FileReadToolOptions): ToolDefinition<{
147
+ path: string;
148
+ lineStart?: number | undefined;
149
+ lineEnd?: number | undefined;
691
150
  }, ToolOutputEnvelope, undefined, {
692
- type: "object";
693
- properties: {
694
- path: {
695
- type: "string";
696
- };
697
- lineStart: {
698
- type: "number";
699
- };
700
- lineEnd: {
701
- type: "number";
702
- };
703
- };
704
- required: readonly [
705
- "path"
706
- ];
151
+ type: "object";
152
+ properties: {
153
+ path: {
154
+ type: "string";
155
+ };
156
+ lineStart: {
157
+ type: "number";
158
+ };
159
+ lineEnd: {
160
+ type: "number";
161
+ };
162
+ };
163
+ required: readonly ["path"];
707
164
  }>;
708
- export interface GlobToolOptions {
709
- defaultCwd?: string;
710
- limit?: number;
711
- name?: string;
712
- }
713
- export declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
714
- pattern: string;
715
- path?: string | undefined;
716
- limit?: number | undefined;
165
+
166
+ interface GlobToolOptions {
167
+ allowedDirs?: readonly string[];
168
+ defaultCwd?: string;
169
+ limit?: number;
170
+ name?: string;
171
+ }
172
+ declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
173
+ pattern: string;
174
+ path?: string | undefined;
175
+ limit?: number | undefined;
717
176
  }, ToolOutputEnvelope, undefined, {
718
- type: "object";
719
- properties: {
720
- pattern: {
721
- type: "string";
722
- };
723
- path: {
724
- type: "string";
725
- };
726
- limit: {
727
- type: "number";
728
- };
729
- };
730
- required: readonly [
731
- "pattern"
732
- ];
177
+ type: "object";
178
+ properties: {
179
+ pattern: {
180
+ type: "string";
181
+ };
182
+ path: {
183
+ type: "string";
184
+ };
185
+ limit: {
186
+ type: "number";
187
+ };
188
+ };
189
+ required: readonly ["pattern"];
733
190
  }>;
734
- export interface GrepToolOptions {
735
- defaultCwd?: string;
736
- limit?: number;
737
- name?: string;
738
- }
739
- export declare function createGrepTool(options?: GrepToolOptions): ToolDefinition<{
740
- pattern: string;
741
- path?: string | undefined;
742
- limit?: number | undefined;
743
- include?: string | undefined;
744
- context?: number | undefined;
191
+
192
+ interface GrepToolOptions {
193
+ allowedDirs?: readonly string[];
194
+ defaultCwd?: string;
195
+ limit?: number;
196
+ name?: string;
197
+ }
198
+ declare function createGrepTool(options?: GrepToolOptions): ToolDefinition<{
199
+ pattern: string;
200
+ path?: string | undefined;
201
+ limit?: number | undefined;
202
+ include?: string | undefined;
203
+ context?: number | undefined;
745
204
  }, ToolOutputEnvelope, undefined, {
746
- type: "object";
747
- properties: {
748
- pattern: {
749
- type: "string";
750
- };
751
- path: {
752
- type: "string";
753
- };
754
- include: {
755
- type: "string";
756
- };
757
- limit: {
758
- type: "number";
759
- };
760
- context: {
761
- type: "number";
762
- };
763
- };
764
- required: readonly [
765
- "pattern"
766
- ];
205
+ type: "object";
206
+ properties: {
207
+ pattern: {
208
+ type: "string";
209
+ };
210
+ path: {
211
+ type: "string";
212
+ };
213
+ include: {
214
+ type: "string";
215
+ };
216
+ limit: {
217
+ type: "number";
218
+ };
219
+ context: {
220
+ type: "number";
221
+ };
222
+ };
223
+ required: readonly ["pattern"];
767
224
  }>;
768
- export interface InternalToolRuntimeOptions {
769
- onEvent?: ToolRuntimeEventHandler;
770
- onToolCall?: ToolRuntimeToolCallHandler;
771
- }
772
- export declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
773
- export interface LsToolOptions {
774
- defaultCwd?: string;
775
- name?: string;
225
+
226
+ interface InternalToolRuntimeOptions {
227
+ onEvent?: ToolRuntimeEventHandler;
228
+ onToolCall?: ToolRuntimeToolCallHandler;
776
229
  }
777
- export declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
778
- path: string;
779
- limit: number;
230
+ declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
231
+
232
+ interface LsToolOptions {
233
+ allowedDirs?: readonly string[];
234
+ defaultCwd?: string;
235
+ name?: string;
236
+ }
237
+ declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
238
+ path: string;
239
+ limit: number;
780
240
  }, ToolOutputEnvelope, undefined, {
781
- type: "object";
782
- properties: {
783
- path: {
784
- type: "string";
785
- };
786
- limit: {
787
- type: "number";
788
- };
789
- };
241
+ type: "object";
242
+ properties: {
243
+ path: {
244
+ type: "string";
245
+ };
246
+ limit: {
247
+ type: "number";
248
+ };
249
+ };
790
250
  }>;
791
- export interface McpOAuthProviderOptions {
792
- serverName: string;
793
- callbackUrl: string;
794
- storageDir: string;
795
- config: MCPAuthConfig;
796
- onRedirect(url: URL): void | Promise<void>;
797
- }
798
- export declare function createMcpOAuthProvider(options: McpOAuthProviderOptions): OAuthClientProvider;
799
- export interface McpToolDescriptor {
800
- name: string;
801
- description?: string;
802
- inputSchema?: unknown;
803
- }
804
- export interface McpToolClient {
805
- callTool(input: {
806
- name: string;
807
- arguments?: JsonObject;
808
- }): Promise<CallToolResult>;
809
- }
810
- export declare function createMcpToolName(serverName: string, toolName: string): string;
811
- export declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
812
- export declare function createMcpTool(options: {
813
- serverName: string;
814
- tool: McpToolDescriptor;
815
- client: McpToolClient;
251
+
252
+ interface McpOAuthProviderOptions {
253
+ serverName: string;
254
+ callbackUrl: string;
255
+ storageDir: string;
256
+ config: MCPAuthConfig;
257
+ onRedirect(url: URL): void | Promise<void>;
258
+ }
259
+ declare function createMcpOAuthProvider(options: McpOAuthProviderOptions): OAuthClientProvider;
260
+
261
+ interface McpToolDescriptor {
262
+ name: string;
263
+ description?: string;
264
+ inputSchema?: unknown;
265
+ }
266
+ interface McpToolClient {
267
+ callTool(input: {
268
+ name: string;
269
+ arguments?: JsonObject;
270
+ }): Promise<CallToolResult>;
271
+ }
272
+ declare function createMcpToolName(serverName: string, toolName: string): string;
273
+ declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
274
+ declare function createMcpTool(options: {
275
+ serverName: string;
276
+ tool: McpToolDescriptor;
277
+ client: McpToolClient;
816
278
  }): ToolDefinition<{
817
- [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 | {
818
- [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
819
- })[] | {
820
- [x: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
821
- })[] | {
822
- [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
823
- })[] | {
824
- [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
825
- })[] | {
826
- [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;
827
- })[] | {
828
- [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;
829
- })[] | {
830
- [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;
831
- })[] | {
832
- [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;
833
- })[] | {
834
- [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;
835
- })[] | {
836
- [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;
837
- })[] | {
838
- [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;
839
- })[] | {
840
- [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;
841
- };
279
+ [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 | {
280
+ [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
281
+ })[] | {
282
+ [x: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
283
+ })[] | {
284
+ [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
285
+ })[] | {
286
+ [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
287
+ })[] | {
288
+ [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;
289
+ })[] | {
290
+ [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;
291
+ })[] | {
292
+ [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;
293
+ })[] | {
294
+ [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;
295
+ })[] | {
296
+ [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;
297
+ })[] | {
298
+ [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;
299
+ })[] | {
300
+ [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;
301
+ })[] | {
302
+ [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;
303
+ };
842
304
  }, ToolOutputEnvelope, undefined, JsonSchemaObject<Record<string, JsonSchema>, readonly string[] | undefined>>;
843
- export interface ConnectedMcpClient extends McpToolClient {
844
- listTools(): Promise<ListToolsResult>;
845
- close(): Promise<void>;
305
+
306
+ interface ConnectedMcpClient extends McpToolClient {
307
+ listTools(): Promise<ListToolsResult>;
308
+ close(): Promise<void>;
846
309
  }
847
- export type McpServerConnectionStatus = {
848
- status: "connected";
849
- toolCount: number;
310
+ type McpServerConnectionStatus = {
311
+ status: "connected";
312
+ toolCount: number;
850
313
  } | {
851
- status: "disabled";
314
+ status: "disabled";
852
315
  } | {
853
- status: "authRequired";
854
- message: string;
316
+ status: "authRequired";
317
+ message: string;
855
318
  } | {
856
- status: "error";
857
- message: string;
319
+ status: "error";
320
+ message: string;
858
321
  };
859
- export interface McpToolBundle {
860
- tools: AnyToolDefinition[];
861
- servers: Record<string, McpServerConnectionStatus>;
862
- close(): Promise<void>;
863
- }
864
- export interface McpConnectionOptions {
865
- oauth?: {
866
- storageDir: string;
867
- callbackUrl: string;
868
- onRedirect(serverName: string, url: URL): void | Promise<void>;
869
- };
870
- }
871
- export type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
872
- export declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
873
- export declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
874
- export declare function createMcpToolsFromServers(options: {
875
- servers?: Record<string, MCPServerConfig>;
876
- allowedTools?: Record<string, Record<string, boolean>>;
877
- connection?: McpConnectionOptions;
878
- connect?: McpConnector;
322
+ interface McpToolBundle {
323
+ tools: AnyToolDefinition[];
324
+ servers: Record<string, McpServerConnectionStatus>;
325
+ close(): Promise<void>;
326
+ }
327
+ interface McpConnectionOptions {
328
+ oauth?: {
329
+ storageDir: string;
330
+ callbackUrl: string;
331
+ onRedirect(serverName: string, url: URL): void | Promise<void>;
332
+ };
333
+ }
334
+ type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
335
+ declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
336
+ declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
337
+ declare function createMcpToolsFromServers(options: {
338
+ servers?: Record<string, MCPServerConfig>;
339
+ allowedTools?: Record<string, Record<string, boolean>>;
340
+ connection?: McpConnectionOptions;
341
+ connect?: McpConnector;
879
342
  }): Promise<McpToolBundle>;
880
- export declare function createMockToolRuntime(): ToolRuntime;
881
- export type RipgrepMatch = {
882
- filePath: string;
883
- isContext?: boolean;
884
- lineNum: number;
885
- lineText: string;
343
+
344
+ declare function createMockToolRuntime(): ToolRuntime;
345
+
346
+ type RipgrepMatch = {
347
+ filePath: string;
348
+ isContext?: boolean;
349
+ lineNum: number;
350
+ lineText: string;
886
351
  };
887
- export declare function filepath(): Promise<string>;
888
- export declare function files(opts: {
889
- cwd: string;
890
- glob?: string[];
352
+ declare function filepath(): Promise<string>;
353
+ declare function files(opts: {
354
+ cwd: string;
355
+ glob?: string[];
891
356
  }): AsyncGenerator<string>;
892
- export declare function search(opts: {
893
- context?: number;
894
- cwd: string;
895
- file?: string;
896
- glob?: string;
897
- limit?: number;
898
- pattern: string;
357
+ declare function search(opts: {
358
+ context?: number;
359
+ cwd: string;
360
+ file?: string;
361
+ glob?: string;
362
+ limit?: number;
363
+ pattern: string;
899
364
  }): Promise<RipgrepMatch[]>;
900
- export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
901
- parentSessionId: string;
902
- runId: string;
365
+
366
+ interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
367
+ parentSessionId: string;
368
+ runId: string;
903
369
  }
904
- export type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => AgentOptions | Promise<AgentOptions>);
905
- export interface CreateDelegationToolsOptions {
906
- agents?: Record<string, DelegatedAgentDefinition>;
370
+ type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => AgentOptions | Promise<AgentOptions>);
371
+ interface CreateDelegationToolsOptions {
372
+ agents?: Record<string, DelegatedAgentDefinition>;
907
373
  }
908
- export declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
909
- task: string;
910
- agentId: string;
374
+ declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
375
+ task: string;
376
+ agentId: string;
911
377
  }, ToolOutputEnvelope, ToolOutputEnvelope, {
912
- type: "object";
913
- properties: {
914
- agentId: {
915
- type: "string";
916
- };
917
- task: {
918
- type: "string";
919
- };
920
- };
921
- required: string[];
378
+ type: "object";
379
+ properties: {
380
+ agentId: {
381
+ type: "string";
382
+ };
383
+ task: {
384
+ type: "string";
385
+ };
386
+ };
387
+ required: string[];
922
388
  }>;
923
- export declare const createDelegateToAgentTool: typeof createAssignTaskTool;
924
- export declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
925
- task: string;
926
- agentId: string;
389
+ declare const createDelegateToAgentTool: typeof createAssignTaskTool;
390
+ declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
391
+ task: string;
392
+ agentId: string;
927
393
  }, ToolOutputEnvelope, ToolOutputEnvelope, {
928
- type: "object";
929
- properties: {
930
- agentId: {
931
- type: "string";
932
- };
933
- task: {
934
- type: "string";
935
- };
936
- };
937
- required: string[];
394
+ type: "object";
395
+ properties: {
396
+ agentId: {
397
+ type: "string";
398
+ };
399
+ task: {
400
+ type: "string";
401
+ };
402
+ };
403
+ required: string[];
938
404
  }>[];
405
+
939
406
  /** Minimal shape of a skill source reference — matches @nuvin/config SkillDefinitionSource */
940
- export interface SkillSource {
941
- path: string;
942
- directory?: string;
943
- scope?: string;
407
+ interface SkillSource {
408
+ path: string;
409
+ directory?: string;
410
+ scope?: string;
944
411
  }
945
412
  /** Minimal shape of a skill reference — matches @nuvin/config SkillDefinitionReference */
946
- export interface SkillReference {
947
- id: string;
948
- name: string;
949
- description: string;
950
- source: SkillSource;
413
+ interface SkillReference {
414
+ id: string;
415
+ name: string;
416
+ description: string;
417
+ source: SkillSource;
951
418
  }
952
419
  /** Minimal shape of a loaded skill — matches @nuvin/config SerializedSkillDefinition */
953
- export interface LoadedSkill extends SkillReference {
954
- instructions: string;
420
+ interface LoadedSkill extends SkillReference {
421
+ instructions: string;
955
422
  }
956
- export interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
957
- skills: TRef[];
958
- loadSkill: (reference: TRef) => Promise<LoadedSkill>;
423
+ interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
424
+ skills: TRef[];
425
+ loadSkill: (reference: TRef) => Promise<LoadedSkill>;
959
426
  }
960
- export declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
961
- name: string;
427
+ declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
428
+ name: string;
962
429
  }, ToolOutputEnvelope, undefined, {
963
- type: "object";
964
- properties: {
965
- name: {
966
- type: "string";
967
- };
968
- };
969
- required: readonly [
970
- "name"
971
- ];
430
+ type: "object";
431
+ properties: {
432
+ name: {
433
+ type: "string";
434
+ };
435
+ };
436
+ required: readonly ["name"];
972
437
  }>;
973
- export declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
974
- export declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
975
- export declare class ToolExecutionError extends Error {
976
- readonly structured: JsonObject;
977
- constructor(message: string, structured?: JsonObject);
978
- }
979
- export declare function defineTool<TSchema extends JsonSchemaObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined>(definition: {
980
- name: string;
981
- description: string;
982
- inputSchema: TSchema;
983
- execute(input: InferJsonSchema<TSchema>, ctx: ToolExecutionContext): AsyncGenerator<TYield, TReturn, void>;
438
+
439
+ declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
440
+ declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
441
+ declare class ToolExecutionError extends Error {
442
+ readonly structured: JsonObject;
443
+ constructor(message: string, structured?: JsonObject);
444
+ }
445
+ declare function defineTool<TSchema extends JsonSchemaObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined>(definition: {
446
+ name: string;
447
+ description: string;
448
+ inputSchema: TSchema;
449
+ execute(input: InferJsonSchema<TSchema>, ctx: ToolExecutionContext): AsyncGenerator<TYield, TReturn, void>;
984
450
  }): ToolDefinition<InferJsonSchema<TSchema>, TYield, TReturn, TSchema>;
985
- export declare class ToolRegistry {
986
- private readonly toolsByName;
987
- constructor(tools?: AnyToolDefinition[]);
988
- register(tool: AnyToolDefinition): void;
989
- get(name: string): AnyToolDefinition | undefined;
990
- list(): AnyToolDefinition[];
991
- listToolSchemas(): ToolSchema[];
992
- }
993
- export declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
994
- export declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
995
- export interface ViewFileToolOptions {
996
- defaultCwd?: string;
997
- maxBytes?: number;
998
- name?: string;
999
- }
1000
- export declare function createViewFileTool(options?: ViewFileToolOptions): ToolDefinition<{
1001
- path: string;
1002
- detail?: string | undefined;
451
+ declare class ToolRegistry {
452
+ private readonly toolsByName;
453
+ constructor(tools?: AnyToolDefinition[]);
454
+ register(tool: AnyToolDefinition): void;
455
+ get(name: string): AnyToolDefinition | undefined;
456
+ list(): AnyToolDefinition[];
457
+ listToolSchemas(): ToolSchema[];
458
+ }
459
+ declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
460
+ declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
461
+
462
+ interface ViewFileToolOptions {
463
+ allowedDirs?: readonly string[];
464
+ defaultCwd?: string;
465
+ maxBytes?: number;
466
+ name?: string;
467
+ }
468
+ declare function createViewFileTool(options?: ViewFileToolOptions): ToolDefinition<{
469
+ path: string;
470
+ detail?: string | undefined;
471
+ }, ToolOutputEnvelope, undefined, {
472
+ type: "object";
473
+ properties: {
474
+ path: {
475
+ type: "string";
476
+ };
477
+ detail: {
478
+ type: "string";
479
+ };
480
+ };
481
+ required: readonly ["path"];
482
+ }>;
483
+
484
+ interface WebFetchToolOptions {
485
+ maxBytes?: number;
486
+ timeoutMs?: number;
487
+ name?: string;
488
+ }
489
+ declare function createWebFetchTool(options?: WebFetchToolOptions): ToolDefinition<{
490
+ url: string;
491
+ description?: string | undefined;
1003
492
  }, ToolOutputEnvelope, undefined, {
1004
- type: "object";
1005
- properties: {
1006
- path: {
1007
- type: "string";
1008
- };
1009
- detail: {
1010
- type: "string";
1011
- };
1012
- };
1013
- required: readonly [
1014
- "path"
1015
- ];
493
+ type: "object";
494
+ properties: {
495
+ description: {
496
+ type: "string";
497
+ };
498
+ url: {
499
+ type: "string";
500
+ };
501
+ };
502
+ required: readonly ["url"];
1016
503
  }>;
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
504
 
1021
- export {};
505
+ interface WebSearchToolOptions {
506
+ googleCseKey: string;
507
+ googleCseCx: string;
508
+ name?: string;
509
+ }
510
+ declare function createWebSearchTool(options: WebSearchToolOptions): ToolDefinition<{
511
+ query: string;
512
+ type?: string | undefined;
513
+ count?: number | undefined;
514
+ description?: string | undefined;
515
+ offset?: number | undefined;
516
+ safe?: boolean | undefined;
517
+ domains?: string[] | undefined;
518
+ recencyDays?: number | undefined;
519
+ lang?: string | undefined;
520
+ region?: string | undefined;
521
+ hydrateMeta?: boolean | undefined;
522
+ }, ToolOutputEnvelope, undefined, {
523
+ type: "object";
524
+ properties: {
525
+ description: {
526
+ type: "string";
527
+ };
528
+ query: {
529
+ type: "string";
530
+ };
531
+ count: {
532
+ type: "number";
533
+ };
534
+ offset: {
535
+ type: "number";
536
+ };
537
+ domains: {
538
+ type: "array";
539
+ items: {
540
+ type: "string";
541
+ };
542
+ };
543
+ recencyDays: {
544
+ type: "number";
545
+ };
546
+ lang: {
547
+ type: "string";
548
+ };
549
+ region: {
550
+ type: "string";
551
+ };
552
+ safe: {
553
+ type: "boolean";
554
+ };
555
+ type: {
556
+ type: "string";
557
+ };
558
+ hydrateMeta: {
559
+ type: "boolean";
560
+ };
561
+ };
562
+ required: readonly ["query"];
563
+ }>;
564
+
565
+ declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
566
+ declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
567
+ declare function assertWorkspaceFile(filePath: string): Promise<void>;
568
+ declare function isProbablyBinary(buffer: Buffer): boolean;
569
+
570
+ 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 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, createMcpOAuthProvider, createMcpTool, createMcpToolName, createMcpToolsFromServers, createMockToolRuntime, createShellExecTool, createToolOutput, createViewFileTool, createWebFetchTool, createWebSearchTool, defineTool, deriveFinalToolOutput, filepath, files, isProbablyBinary, normalizeToolOutputValue, resolveAllowedPath, resolveWorkspacePath, search, toNuvinToolSchema, validateToolInput };