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

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,473 +1,1021 @@
1
- import { aZ as ToolDefinition, aq as ToolOutputEnvelope, a_ as AnyToolDefinition, aT as ToolRuntimeEventHandler, aS as ToolRuntimeToolCallHandler, aV as ToolRuntime, H as JsonObject, V as JsonSchemaObject, W as JsonSchema, b8 as AgentDefinitionFactoryContext, A as AgentOptions, aX as ToolOutputValue, ap as ToolResultChunk, aW as InferJsonSchema, av as ToolExecutionContext, af as ToolSchema, I as JsonValue } from '../types-D11KxtW1.js';
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
2
3
  import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
3
- import { MCPAuthConfig, MCPServerConfig } from '@nuvin/config';
4
4
  import { CallToolResult, ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
5
5
 
6
- interface BashToolInput {
7
- command: string;
8
- cwd?: string;
9
- timeoutMs?: number;
10
- ignoreOutput?: boolean;
11
- }
12
- interface BashToolOptions {
13
- defaultCwd?: string;
14
- defaultTimeoutMs?: number;
15
- description?: string;
16
- env?: NodeJS.ProcessEnv;
17
- name?: string;
18
- shellPath?: string;
19
- stripAnsi?: boolean;
20
- }
21
- declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
22
- command: string;
23
- cwd?: string | undefined;
24
- timeoutMs?: number | undefined;
25
- ignoreOutput?: boolean | undefined;
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;
26
520
  }, string, ToolOutputEnvelope, {
27
- type: "object";
28
- properties: {
29
- command: {
30
- type: "string";
31
- };
32
- cwd: {
33
- type: "string";
34
- };
35
- timeoutMs: {
36
- type: "number";
37
- };
38
- ignoreOutput: {
39
- type: "boolean";
40
- };
41
- };
42
- required: readonly ["command"];
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
+ ];
43
539
  }>;
44
- declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
45
- command: string;
46
- cwd?: string | undefined;
47
- timeoutMs?: number | undefined;
48
- ignoreOutput?: boolean | undefined;
540
+ export declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
541
+ command: string;
542
+ cwd?: string | undefined;
543
+ timeoutMs?: number | undefined;
544
+ ignoreOutput?: boolean | undefined;
49
545
  }, string, ToolOutputEnvelope, {
50
- type: "object";
51
- properties: {
52
- command: {
53
- type: "string";
54
- };
55
- cwd: {
56
- type: "string";
57
- };
58
- timeoutMs: {
59
- type: "number";
60
- };
61
- ignoreOutput: {
62
- type: "boolean";
63
- };
64
- };
65
- required: readonly ["command"];
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
+ ];
66
564
  }>;
67
-
68
- interface CommandSource {
69
- path: string;
70
- directory?: string;
71
- scope?: string;
72
- }
73
- interface CommandReference {
74
- id: string;
75
- name: string;
76
- description: string;
77
- argumentHint?: string;
78
- arguments?: string[];
79
- source: CommandSource;
80
- }
81
- interface LoadedCommand extends CommandReference {
82
- instructions: string;
83
- }
84
- interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
85
- commands: TRef[];
86
- loadCommand: (reference: TRef) => Promise<LoadedCommand>;
87
- }
88
- declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): ToolDefinition<{
89
- name: string;
90
- args?: string | undefined;
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;
91
616
  }, ToolOutputEnvelope, undefined, {
92
- type: "object";
93
- properties: {
94
- name: {
95
- type: "string";
96
- };
97
- args: {
98
- type: "string";
99
- };
100
- };
101
- required: readonly ["name"];
617
+ type: "object";
618
+ properties: {
619
+ name: {
620
+ type: "string";
621
+ };
622
+ args: {
623
+ type: "string";
624
+ };
625
+ };
626
+ required: readonly [
627
+ "name"
628
+ ];
102
629
  }>;
103
-
104
- interface FileEditToolOptions {
105
- defaultCwd?: string;
106
- name?: string;
107
- }
108
- declare function createFileEditTool(options?: FileEditToolOptions): ToolDefinition<{
109
- filePath: string;
110
- oldText: string;
111
- newText: string;
112
- dryRun?: boolean | undefined;
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;
113
639
  }, ToolOutputEnvelope, undefined, {
114
- type: "object";
115
- properties: {
116
- filePath: {
117
- type: "string";
118
- };
119
- oldText: {
120
- type: "string";
121
- };
122
- newText: {
123
- type: "string";
124
- };
125
- dryRun: {
126
- type: "boolean";
127
- };
128
- };
129
- required: readonly ["filePath", "oldText", "newText"];
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
+ ];
130
660
  }>;
131
-
132
- interface FileNewToolOptions {
133
- defaultCwd?: string;
134
- name?: string;
661
+ export interface FileNewToolOptions {
662
+ defaultCwd?: string;
663
+ name?: string;
135
664
  }
136
- declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
137
- filePath: string;
138
- content: string;
665
+ export declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
666
+ content: string;
667
+ filePath: string;
139
668
  }, ToolOutputEnvelope, undefined, {
140
- type: "object";
141
- properties: {
142
- filePath: {
143
- type: "string";
144
- };
145
- content: {
146
- type: "string";
147
- };
148
- };
149
- required: readonly ["filePath", "content"];
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
+ ];
150
682
  }>;
151
-
152
- interface FileReadToolOptions {
153
- defaultCwd?: string;
154
- name?: string;
155
- }
156
- declare function createFileReadTool(options?: FileReadToolOptions): ToolDefinition<{
157
- path: string;
158
- lineStart?: number | undefined;
159
- lineEnd?: number | undefined;
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;
160
691
  }, ToolOutputEnvelope, undefined, {
161
- type: "object";
162
- properties: {
163
- path: {
164
- type: "string";
165
- };
166
- lineStart: {
167
- type: "number";
168
- };
169
- lineEnd: {
170
- type: "number";
171
- };
172
- };
173
- required: readonly ["path"];
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
+ ];
174
707
  }>;
175
-
176
- interface GlobToolOptions {
177
- defaultCwd?: string;
178
- limit?: number;
179
- name?: string;
180
- }
181
- declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
182
- pattern: string;
183
- path?: string | undefined;
184
- limit?: number | undefined;
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;
185
717
  }, ToolOutputEnvelope, undefined, {
186
- type: "object";
187
- properties: {
188
- pattern: {
189
- type: "string";
190
- };
191
- path: {
192
- type: "string";
193
- };
194
- limit: {
195
- type: "number";
196
- };
197
- };
198
- required: readonly ["pattern"];
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
+ ];
199
733
  }>;
200
-
201
- interface GrepToolOptions {
202
- defaultCwd?: string;
203
- limit?: number;
204
- name?: string;
205
- }
206
- declare function createGrepTool(options?: GrepToolOptions): ToolDefinition<{
207
- pattern: string;
208
- path?: string | undefined;
209
- limit?: number | undefined;
210
- include?: string | undefined;
211
- context?: number | undefined;
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;
212
745
  }, ToolOutputEnvelope, undefined, {
213
- type: "object";
214
- properties: {
215
- pattern: {
216
- type: "string";
217
- };
218
- path: {
219
- type: "string";
220
- };
221
- include: {
222
- type: "string";
223
- };
224
- limit: {
225
- type: "number";
226
- };
227
- context: {
228
- type: "number";
229
- };
230
- };
231
- required: readonly ["pattern"];
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
+ ];
232
767
  }>;
233
-
234
- interface InternalToolRuntimeOptions {
235
- onEvent?: ToolRuntimeEventHandler;
236
- onToolCall?: ToolRuntimeToolCallHandler;
768
+ export interface InternalToolRuntimeOptions {
769
+ onEvent?: ToolRuntimeEventHandler;
770
+ onToolCall?: ToolRuntimeToolCallHandler;
237
771
  }
238
- declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
239
-
240
- interface LsToolOptions {
241
- defaultCwd?: string;
242
- name?: string;
772
+ export declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
773
+ export interface LsToolOptions {
774
+ defaultCwd?: string;
775
+ name?: string;
243
776
  }
244
- declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
245
- path: string;
246
- limit: number;
777
+ export declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
778
+ path: string;
779
+ limit: number;
247
780
  }, ToolOutputEnvelope, undefined, {
248
- type: "object";
249
- properties: {
250
- path: {
251
- type: "string";
252
- };
253
- limit: {
254
- type: "number";
255
- };
256
- };
781
+ type: "object";
782
+ properties: {
783
+ path: {
784
+ type: "string";
785
+ };
786
+ limit: {
787
+ type: "number";
788
+ };
789
+ };
257
790
  }>;
258
-
259
- interface McpOAuthProviderOptions {
260
- serverName: string;
261
- callbackUrl: string;
262
- storageDir: string;
263
- config: MCPAuthConfig;
264
- onRedirect(url: URL): void | Promise<void>;
265
- }
266
- declare function createMcpOAuthProvider(options: McpOAuthProviderOptions): OAuthClientProvider;
267
-
268
- interface McpToolDescriptor {
269
- name: string;
270
- description?: string;
271
- inputSchema?: unknown;
272
- }
273
- interface McpToolClient {
274
- callTool(input: {
275
- name: string;
276
- arguments?: JsonObject;
277
- }): Promise<CallToolResult>;
278
- }
279
- declare function createMcpToolName(serverName: string, toolName: string): string;
280
- declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
281
- declare function createMcpTool(options: {
282
- serverName: string;
283
- tool: McpToolDescriptor;
284
- client: McpToolClient;
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;
285
816
  }): ToolDefinition<{
286
- [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 | {
287
- [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
288
- })[] | {
289
- [x: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
290
- })[] | {
291
- [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
292
- })[] | {
293
- [x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
294
- })[] | {
295
- [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;
296
- })[] | {
297
- [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;
298
- })[] | {
299
- [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;
300
- })[] | {
301
- [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;
302
- })[] | {
303
- [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;
304
- })[] | {
305
- [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;
306
- })[] | {
307
- [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;
308
- })[] | {
309
- [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;
310
- };
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
+ };
311
842
  }, ToolOutputEnvelope, undefined, JsonSchemaObject<Record<string, JsonSchema>, readonly string[] | undefined>>;
312
-
313
- interface ConnectedMcpClient extends McpToolClient {
314
- listTools(): Promise<ListToolsResult>;
315
- close(): Promise<void>;
843
+ export interface ConnectedMcpClient extends McpToolClient {
844
+ listTools(): Promise<ListToolsResult>;
845
+ close(): Promise<void>;
316
846
  }
317
- type McpServerConnectionStatus = {
318
- status: "connected";
319
- toolCount: number;
847
+ export type McpServerConnectionStatus = {
848
+ status: "connected";
849
+ toolCount: number;
320
850
  } | {
321
- status: "disabled";
851
+ status: "disabled";
322
852
  } | {
323
- status: "authRequired";
324
- message: string;
853
+ status: "authRequired";
854
+ message: string;
325
855
  } | {
326
- status: "error";
327
- message: string;
856
+ status: "error";
857
+ message: string;
328
858
  };
329
- interface McpToolBundle {
330
- tools: AnyToolDefinition[];
331
- servers: Record<string, McpServerConnectionStatus>;
332
- close(): Promise<void>;
333
- }
334
- interface McpConnectionOptions {
335
- oauth?: {
336
- storageDir: string;
337
- callbackUrl: string;
338
- onRedirect(serverName: string, url: URL): void | Promise<void>;
339
- };
340
- }
341
- type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
342
- declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
343
- declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
344
- declare function createMcpToolsFromServers(options: {
345
- servers?: Record<string, MCPServerConfig>;
346
- allowedTools?: Record<string, Record<string, boolean>>;
347
- connection?: McpConnectionOptions;
348
- connect?: McpConnector;
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;
349
879
  }): Promise<McpToolBundle>;
350
-
351
- declare function createMockToolRuntime(): ToolRuntime;
352
-
353
- type RipgrepMatch = {
354
- filePath: string;
355
- isContext?: boolean;
356
- lineNum: number;
357
- lineText: string;
880
+ export declare function createMockToolRuntime(): ToolRuntime;
881
+ export type RipgrepMatch = {
882
+ filePath: string;
883
+ isContext?: boolean;
884
+ lineNum: number;
885
+ lineText: string;
358
886
  };
359
- declare function filepath(): Promise<string>;
360
- declare function files(opts: {
361
- cwd: string;
362
- glob?: string[];
887
+ export declare function filepath(): Promise<string>;
888
+ export declare function files(opts: {
889
+ cwd: string;
890
+ glob?: string[];
363
891
  }): AsyncGenerator<string>;
364
- declare function search(opts: {
365
- context?: number;
366
- cwd: string;
367
- file?: string;
368
- glob?: string;
369
- limit?: number;
370
- pattern: 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;
371
899
  }): Promise<RipgrepMatch[]>;
372
-
373
- interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
374
- parentSessionId: string;
375
- runId: string;
900
+ export interface DelegatedAgentFactoryContext extends AgentDefinitionFactoryContext {
901
+ parentSessionId: string;
902
+ runId: string;
376
903
  }
377
- type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => AgentOptions | Promise<AgentOptions>);
378
- interface CreateDelegationToolsOptions {
379
- agents?: Record<string, DelegatedAgentDefinition>;
904
+ export type DelegatedAgentDefinition = AgentOptions | ((ctx: DelegatedAgentFactoryContext) => AgentOptions | Promise<AgentOptions>);
905
+ export interface CreateDelegationToolsOptions {
906
+ agents?: Record<string, DelegatedAgentDefinition>;
380
907
  }
381
- declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
382
- task: string;
383
- agentId: string;
908
+ export declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
909
+ task: string;
910
+ agentId: string;
384
911
  }, ToolOutputEnvelope, ToolOutputEnvelope, {
385
- type: "object";
386
- properties: {
387
- agentId: {
388
- type: "string";
389
- };
390
- task: {
391
- type: "string";
392
- };
393
- };
394
- required: string[];
912
+ type: "object";
913
+ properties: {
914
+ agentId: {
915
+ type: "string";
916
+ };
917
+ task: {
918
+ type: "string";
919
+ };
920
+ };
921
+ required: string[];
395
922
  }>;
396
- declare const createDelegateToAgentTool: typeof createAssignTaskTool;
397
- declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
398
- task: string;
399
- agentId: string;
923
+ export declare const createDelegateToAgentTool: typeof createAssignTaskTool;
924
+ export declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
925
+ task: string;
926
+ agentId: string;
400
927
  }, ToolOutputEnvelope, ToolOutputEnvelope, {
401
- type: "object";
402
- properties: {
403
- agentId: {
404
- type: "string";
405
- };
406
- task: {
407
- type: "string";
408
- };
409
- };
410
- required: string[];
928
+ type: "object";
929
+ properties: {
930
+ agentId: {
931
+ type: "string";
932
+ };
933
+ task: {
934
+ type: "string";
935
+ };
936
+ };
937
+ required: string[];
411
938
  }>[];
412
-
413
939
  /** Minimal shape of a skill source reference — matches @nuvin/config SkillDefinitionSource */
414
- interface SkillSource {
415
- path: string;
416
- directory?: string;
417
- scope?: string;
940
+ export interface SkillSource {
941
+ path: string;
942
+ directory?: string;
943
+ scope?: string;
418
944
  }
419
945
  /** Minimal shape of a skill reference — matches @nuvin/config SkillDefinitionReference */
420
- interface SkillReference {
421
- id: string;
422
- name: string;
423
- description: string;
424
- source: SkillSource;
946
+ export interface SkillReference {
947
+ id: string;
948
+ name: string;
949
+ description: string;
950
+ source: SkillSource;
425
951
  }
426
952
  /** Minimal shape of a loaded skill — matches @nuvin/config SerializedSkillDefinition */
427
- interface LoadedSkill extends SkillReference {
428
- instructions: string;
953
+ export interface LoadedSkill extends SkillReference {
954
+ instructions: string;
429
955
  }
430
- interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
431
- skills: TRef[];
432
- loadSkill: (reference: TRef) => Promise<LoadedSkill>;
956
+ export interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
957
+ skills: TRef[];
958
+ loadSkill: (reference: TRef) => Promise<LoadedSkill>;
433
959
  }
434
- declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
435
- name: string;
960
+ export declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
961
+ name: string;
436
962
  }, ToolOutputEnvelope, undefined, {
437
- type: "object";
438
- properties: {
439
- name: {
440
- type: "string";
441
- };
442
- };
443
- required: readonly ["name"];
963
+ type: "object";
964
+ properties: {
965
+ name: {
966
+ type: "string";
967
+ };
968
+ };
969
+ required: readonly [
970
+ "name"
971
+ ];
444
972
  }>;
445
-
446
- declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
447
- declare function createToolOutput(output: string, structured?: JsonObject): ToolOutputEnvelope;
448
- declare class ToolExecutionError extends Error {
449
- readonly structured: JsonObject;
450
- constructor(message: string, structured?: JsonObject);
451
- }
452
- declare function defineTool<TSchema extends JsonSchemaObject, TYield extends ToolOutputValue = ToolOutputValue, TReturn extends ToolOutputValue | undefined = ToolOutputValue | undefined>(definition: {
453
- name: string;
454
- description: string;
455
- inputSchema: TSchema;
456
- execute(input: InferJsonSchema<TSchema>, ctx: ToolExecutionContext): AsyncGenerator<TYield, TReturn, void>;
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>;
457
984
  }): ToolDefinition<InferJsonSchema<TSchema>, TYield, TReturn, TSchema>;
458
- declare class ToolRegistry {
459
- private readonly toolsByName;
460
- constructor(tools?: AnyToolDefinition[]);
461
- register(tool: AnyToolDefinition): void;
462
- get(name: string): AnyToolDefinition | undefined;
463
- list(): AnyToolDefinition[];
464
- listToolSchemas(): ToolSchema[];
465
- }
466
- declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
467
- declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
468
-
469
- declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
470
- declare function assertWorkspaceFile(filePath: string): Promise<void>;
471
- declare function isProbablyBinary(buffer: Buffer): boolean;
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;
1003
+ }, 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
+ ];
1016
+ }>;
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;
472
1020
 
473
- export { type BashToolInput, type BashToolOptions, type CommandReference, type CommandSource, 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, assertWorkspaceFile, buildMcpHttpHeaders, connectMcpServer, createAssignTaskTool, createBashTool, createDelegateToAgentTool, createDelegationTools, createFileEditTool, createFileNewTool, createFileReadTool, createGlobTool, createGrepTool, createInternalToolRuntime, createInvokeCommandTool, createLoadSkillTool, createLsTool, createMcpOAuthProvider, createMcpTool, createMcpToolName, createMcpToolsFromServers, createMockToolRuntime, createShellExecTool, createToolOutput, defineTool, deriveFinalToolOutput, filepath, files, isProbablyBinary, normalizeToolOutputValue, resolveWorkspacePath, search, toNuvinToolSchema, validateToolInput };
1021
+ export {};