@nuvin/agent-core 0.0.0-rc.0 → 0.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/dist/VERSION +2 -2
- package/dist/agent/index.d.ts +54 -5
- package/dist/agent/index.js +1 -1
- package/dist/chunk-3OMYFJLN.js +1 -0
- package/dist/chunk-4DNIDCX7.js +1 -0
- package/dist/chunk-G2FR4UGO.js +1 -0
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.d.ts +6 -3
- package/dist/formats/index.js +1 -1
- package/dist/models/index.d.ts +15 -12
- package/dist/models/index.js +1 -1
- package/dist/{provider-adapters-BHDQNPHa.d.ts → provider-adapters-CURkQPbY.d.ts} +1 -1
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/tools/index.d.ts +482 -8
- package/dist/tools/index.js +1 -1
- package/dist/{types-BueDJWnx.d.ts → types-Df0vlfj-.d.ts} +76 -27
- package/package.json +22 -11
- package/dist/chunk-C6OLKGP6.js +0 -1
- package/dist/chunk-EJTTW4JQ.js +0 -1
- package/dist/chunk-U2BLX7Y5.js +0 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,94 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Diagnostic, Location, Hover, DocumentSymbol, SymbolInformation, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from 'vscode-languageserver-types';
|
|
2
|
+
import { b8 as ToolDefinition, ax as ToolOutputEnvelope, b9 as AnyToolDefinition, b2 as ToolRuntimeEventHandler, b1 as ToolRuntimeToolCallHandler, b4 as ToolRuntime, K as JsonObject, X as JsonSchemaObject, Y as JsonSchema, bk as AgentDefinitionFactoryContext, a as AgentOptions, q as ToolResult, b6 as ToolOutputValue, aw as ToolResultChunk, a0 as ToolResultContent, b5 as InferJsonSchema, aG as ToolExecutionContext, al as ToolSchema, L as JsonValue } from '../types-Df0vlfj-.js';
|
|
3
|
+
import { CommandDefinitionReference, SerializedCommandDefinition, MCPAuthConfig, MCPServerConfig } from '@nuvin/config';
|
|
4
|
+
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
5
|
+
import { CallToolResult, ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
|
|
7
|
+
interface LspPosition {
|
|
8
|
+
file: string;
|
|
9
|
+
line: number;
|
|
10
|
+
character: number;
|
|
11
|
+
}
|
|
12
|
+
interface LspServiceConfig {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface LspService {
|
|
17
|
+
isEnabled(): boolean;
|
|
18
|
+
hasClients(file: string): Promise<boolean>;
|
|
19
|
+
touchFile(filePath: string, waitDiagnostics?: boolean): Promise<void>;
|
|
20
|
+
diagnostics(): Promise<Record<string, Diagnostic[]>>;
|
|
21
|
+
diagnosticsForFile(filePath: string): Promise<Diagnostic[]>;
|
|
22
|
+
definition(pos: LspPosition): Promise<Location[]>;
|
|
23
|
+
references(pos: LspPosition): Promise<Location[]>;
|
|
24
|
+
hover(pos: LspPosition): Promise<Hover[]>;
|
|
25
|
+
documentSymbol(filePath: string): Promise<(DocumentSymbol | SymbolInformation)[]>;
|
|
26
|
+
workspaceSymbol(query: string): Promise<SymbolInformation[]>;
|
|
27
|
+
implementation(pos: LspPosition): Promise<Location[]>;
|
|
28
|
+
prepareCallHierarchy(pos: LspPosition): Promise<CallHierarchyItem[]>;
|
|
29
|
+
incomingCalls(pos: LspPosition): Promise<CallHierarchyIncomingCall[]>;
|
|
30
|
+
outgoingCalls(pos: LspPosition): Promise<CallHierarchyOutgoingCall[]>;
|
|
31
|
+
shutdown(): Promise<void>;
|
|
32
|
+
status(): {
|
|
33
|
+
connectedClients: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
declare function createLspService(config?: LspServiceConfig): LspService;
|
|
37
|
+
|
|
38
|
+
declare function createAskUserTool(): ToolDefinition<{
|
|
39
|
+
answers: {};
|
|
40
|
+
questions: {
|
|
41
|
+
question: string;
|
|
42
|
+
header: string;
|
|
43
|
+
options: {
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
}[];
|
|
47
|
+
multiSelect: boolean;
|
|
48
|
+
}[];
|
|
49
|
+
}, ToolOutputEnvelope, ToolOutputEnvelope | undefined, {
|
|
50
|
+
type: "object";
|
|
51
|
+
properties: {
|
|
52
|
+
questions: {
|
|
53
|
+
type: "array";
|
|
54
|
+
items: {
|
|
55
|
+
type: "object";
|
|
56
|
+
properties: {
|
|
57
|
+
question: {
|
|
58
|
+
type: "string";
|
|
59
|
+
};
|
|
60
|
+
header: {
|
|
61
|
+
type: "string";
|
|
62
|
+
};
|
|
63
|
+
options: {
|
|
64
|
+
type: "array";
|
|
65
|
+
items: {
|
|
66
|
+
type: "object";
|
|
67
|
+
properties: {
|
|
68
|
+
label: {
|
|
69
|
+
type: "string";
|
|
70
|
+
};
|
|
71
|
+
description: {
|
|
72
|
+
type: "string";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
required: string[];
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
multiSelect: {
|
|
79
|
+
type: "boolean";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
required: string[];
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
answers: {
|
|
86
|
+
type: "object";
|
|
87
|
+
properties: {};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
required: string[];
|
|
91
|
+
}>;
|
|
2
92
|
|
|
3
93
|
interface BashToolInput {
|
|
4
94
|
command: string;
|
|
@@ -7,6 +97,7 @@ interface BashToolInput {
|
|
|
7
97
|
ignoreOutput?: boolean;
|
|
8
98
|
}
|
|
9
99
|
interface BashToolOptions {
|
|
100
|
+
allowedDirs?: readonly string[];
|
|
10
101
|
defaultCwd?: string;
|
|
11
102
|
defaultTimeoutMs?: number;
|
|
12
103
|
description?: string;
|
|
@@ -17,8 +108,8 @@ interface BashToolOptions {
|
|
|
17
108
|
}
|
|
18
109
|
declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
19
110
|
command: string;
|
|
20
|
-
cwd?: string | undefined;
|
|
21
111
|
timeoutMs?: number | undefined;
|
|
112
|
+
cwd?: string | undefined;
|
|
22
113
|
ignoreOutput?: boolean | undefined;
|
|
23
114
|
}, string, ToolOutputEnvelope, {
|
|
24
115
|
type: "object";
|
|
@@ -40,8 +131,8 @@ declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
|
40
131
|
}>;
|
|
41
132
|
declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
|
|
42
133
|
command: string;
|
|
43
|
-
cwd?: string | undefined;
|
|
44
134
|
timeoutMs?: number | undefined;
|
|
135
|
+
cwd?: string | undefined;
|
|
45
136
|
ignoreOutput?: boolean | undefined;
|
|
46
137
|
}, string, ToolOutputEnvelope, {
|
|
47
138
|
type: "object";
|
|
@@ -62,7 +153,30 @@ declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<
|
|
|
62
153
|
required: readonly ["command"];
|
|
63
154
|
}>;
|
|
64
155
|
|
|
156
|
+
type CommandReference = CommandDefinitionReference;
|
|
157
|
+
type LoadedCommand = SerializedCommandDefinition;
|
|
158
|
+
interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
|
|
159
|
+
commands: TRef[];
|
|
160
|
+
loadCommand: (reference: TRef) => Promise<LoadedCommand>;
|
|
161
|
+
}
|
|
162
|
+
declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): ToolDefinition<{
|
|
163
|
+
name: string;
|
|
164
|
+
args?: string | undefined;
|
|
165
|
+
}, ToolOutputEnvelope, undefined, {
|
|
166
|
+
type: "object";
|
|
167
|
+
properties: {
|
|
168
|
+
name: {
|
|
169
|
+
type: "string";
|
|
170
|
+
};
|
|
171
|
+
args: {
|
|
172
|
+
type: "string";
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
required: readonly ["name"];
|
|
176
|
+
}>;
|
|
177
|
+
|
|
65
178
|
interface FileEditToolOptions {
|
|
179
|
+
allowedDirs?: readonly string[];
|
|
66
180
|
defaultCwd?: string;
|
|
67
181
|
name?: string;
|
|
68
182
|
}
|
|
@@ -91,12 +205,13 @@ declare function createFileEditTool(options?: FileEditToolOptions): ToolDefiniti
|
|
|
91
205
|
}>;
|
|
92
206
|
|
|
93
207
|
interface FileNewToolOptions {
|
|
208
|
+
allowedDirs?: readonly string[];
|
|
94
209
|
defaultCwd?: string;
|
|
95
210
|
name?: string;
|
|
96
211
|
}
|
|
97
212
|
declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
|
|
98
|
-
filePath: string;
|
|
99
213
|
content: string;
|
|
214
|
+
filePath: string;
|
|
100
215
|
}, ToolOutputEnvelope, undefined, {
|
|
101
216
|
type: "object";
|
|
102
217
|
properties: {
|
|
@@ -111,6 +226,7 @@ declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition
|
|
|
111
226
|
}>;
|
|
112
227
|
|
|
113
228
|
interface FileReadToolOptions {
|
|
229
|
+
allowedDirs?: readonly string[];
|
|
114
230
|
defaultCwd?: string;
|
|
115
231
|
name?: string;
|
|
116
232
|
}
|
|
@@ -135,6 +251,7 @@ declare function createFileReadTool(options?: FileReadToolOptions): ToolDefiniti
|
|
|
135
251
|
}>;
|
|
136
252
|
|
|
137
253
|
interface GlobToolOptions {
|
|
254
|
+
allowedDirs?: readonly string[];
|
|
138
255
|
defaultCwd?: string;
|
|
139
256
|
limit?: number;
|
|
140
257
|
name?: string;
|
|
@@ -160,6 +277,7 @@ declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
|
|
|
160
277
|
}>;
|
|
161
278
|
|
|
162
279
|
interface GrepToolOptions {
|
|
280
|
+
allowedDirs?: readonly string[];
|
|
163
281
|
defaultCwd?: string;
|
|
164
282
|
limit?: number;
|
|
165
283
|
name?: string;
|
|
@@ -199,6 +317,7 @@ interface InternalToolRuntimeOptions {
|
|
|
199
317
|
declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
|
|
200
318
|
|
|
201
319
|
interface LsToolOptions {
|
|
320
|
+
allowedDirs?: readonly string[];
|
|
202
321
|
defaultCwd?: string;
|
|
203
322
|
name?: string;
|
|
204
323
|
}
|
|
@@ -217,6 +336,133 @@ declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
|
|
|
217
336
|
};
|
|
218
337
|
}>;
|
|
219
338
|
|
|
339
|
+
interface LspToolOptions {
|
|
340
|
+
defaultCwd?: string;
|
|
341
|
+
allowedDirs?: readonly string[];
|
|
342
|
+
lspService?: LspService;
|
|
343
|
+
name?: string;
|
|
344
|
+
}
|
|
345
|
+
declare function createLspTool(options?: LspToolOptions): ToolDefinition<{
|
|
346
|
+
filePath: string;
|
|
347
|
+
line: number;
|
|
348
|
+
character: number;
|
|
349
|
+
operation: string;
|
|
350
|
+
query?: string | undefined;
|
|
351
|
+
}, ToolOutputEnvelope, undefined, {
|
|
352
|
+
type: "object";
|
|
353
|
+
properties: {
|
|
354
|
+
operation: {
|
|
355
|
+
type: "string";
|
|
356
|
+
enum: string[];
|
|
357
|
+
};
|
|
358
|
+
filePath: {
|
|
359
|
+
type: "string";
|
|
360
|
+
};
|
|
361
|
+
line: {
|
|
362
|
+
type: "number";
|
|
363
|
+
};
|
|
364
|
+
character: {
|
|
365
|
+
type: "number";
|
|
366
|
+
};
|
|
367
|
+
query: {
|
|
368
|
+
type: "string";
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
required: readonly ["operation", "filePath", "line", "character"];
|
|
372
|
+
}>;
|
|
373
|
+
|
|
374
|
+
interface McpOAuthProviderOptions {
|
|
375
|
+
serverName: string;
|
|
376
|
+
callbackUrl: string;
|
|
377
|
+
storageDir: string;
|
|
378
|
+
config: MCPAuthConfig;
|
|
379
|
+
onRedirect(url: URL): void | Promise<void>;
|
|
380
|
+
}
|
|
381
|
+
declare function createMcpOAuthProvider(options: McpOAuthProviderOptions): OAuthClientProvider;
|
|
382
|
+
|
|
383
|
+
interface McpToolDescriptor {
|
|
384
|
+
name: string;
|
|
385
|
+
description?: string;
|
|
386
|
+
inputSchema?: unknown;
|
|
387
|
+
}
|
|
388
|
+
interface McpToolClient {
|
|
389
|
+
callTool(input: {
|
|
390
|
+
name: string;
|
|
391
|
+
arguments?: JsonObject;
|
|
392
|
+
}): Promise<CallToolResult>;
|
|
393
|
+
}
|
|
394
|
+
declare function createMcpToolName(serverName: string, toolName: string): string;
|
|
395
|
+
declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
|
|
396
|
+
declare function createMcpTool(options: {
|
|
397
|
+
serverName: string;
|
|
398
|
+
tool: McpToolDescriptor;
|
|
399
|
+
client: McpToolClient;
|
|
400
|
+
}): ToolDefinition<{
|
|
401
|
+
[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 | {
|
|
402
|
+
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
403
|
+
})[] | {
|
|
404
|
+
[x: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
|
|
405
|
+
})[] | {
|
|
406
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
407
|
+
})[] | {
|
|
408
|
+
[x: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
409
|
+
})[] | {
|
|
410
|
+
[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;
|
|
411
|
+
})[] | {
|
|
412
|
+
[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;
|
|
413
|
+
})[] | {
|
|
414
|
+
[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;
|
|
415
|
+
})[] | {
|
|
416
|
+
[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;
|
|
417
|
+
})[] | {
|
|
418
|
+
[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;
|
|
419
|
+
})[] | {
|
|
420
|
+
[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;
|
|
421
|
+
})[] | {
|
|
422
|
+
[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;
|
|
423
|
+
})[] | {
|
|
424
|
+
[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;
|
|
425
|
+
};
|
|
426
|
+
}, ToolOutputEnvelope, undefined, JsonSchemaObject<Record<string, JsonSchema>, readonly string[] | undefined>>;
|
|
427
|
+
|
|
428
|
+
interface ConnectedMcpClient extends McpToolClient {
|
|
429
|
+
listTools(): Promise<ListToolsResult>;
|
|
430
|
+
close(): Promise<void>;
|
|
431
|
+
}
|
|
432
|
+
type McpServerConnectionStatus = {
|
|
433
|
+
status: "connected";
|
|
434
|
+
toolCount: number;
|
|
435
|
+
} | {
|
|
436
|
+
status: "disabled";
|
|
437
|
+
} | {
|
|
438
|
+
status: "authRequired";
|
|
439
|
+
message: string;
|
|
440
|
+
} | {
|
|
441
|
+
status: "error";
|
|
442
|
+
message: string;
|
|
443
|
+
};
|
|
444
|
+
interface McpToolBundle {
|
|
445
|
+
tools: AnyToolDefinition[];
|
|
446
|
+
servers: Record<string, McpServerConnectionStatus>;
|
|
447
|
+
close(): Promise<void>;
|
|
448
|
+
}
|
|
449
|
+
interface McpConnectionOptions {
|
|
450
|
+
oauth?: {
|
|
451
|
+
storageDir: string;
|
|
452
|
+
callbackUrl: string;
|
|
453
|
+
onRedirect(serverName: string, url: URL): void | Promise<void>;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
|
|
457
|
+
declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
|
|
458
|
+
declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
|
|
459
|
+
declare function createMcpToolsFromServers(options: {
|
|
460
|
+
servers?: Record<string, MCPServerConfig>;
|
|
461
|
+
allowedTools?: Record<string, Record<string, boolean>>;
|
|
462
|
+
connection?: McpConnectionOptions;
|
|
463
|
+
connect?: McpConnector;
|
|
464
|
+
}): Promise<McpToolBundle>;
|
|
465
|
+
|
|
220
466
|
declare function createMockToolRuntime(): ToolRuntime;
|
|
221
467
|
|
|
222
468
|
type RipgrepMatch = {
|
|
@@ -248,14 +494,22 @@ interface CreateDelegationToolsOptions {
|
|
|
248
494
|
agents?: Record<string, DelegatedAgentDefinition>;
|
|
249
495
|
}
|
|
250
496
|
declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
251
|
-
|
|
497
|
+
description: string;
|
|
252
498
|
task: string;
|
|
499
|
+
agentId: string;
|
|
500
|
+
nickname: string;
|
|
253
501
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
254
502
|
type: "object";
|
|
255
503
|
properties: {
|
|
256
504
|
agentId: {
|
|
257
505
|
type: "string";
|
|
258
506
|
};
|
|
507
|
+
description: {
|
|
508
|
+
type: "string";
|
|
509
|
+
};
|
|
510
|
+
nickname: {
|
|
511
|
+
type: "string";
|
|
512
|
+
};
|
|
259
513
|
task: {
|
|
260
514
|
type: "string";
|
|
261
515
|
};
|
|
@@ -264,14 +518,22 @@ declare function createAssignTaskTool(options: CreateDelegationToolsOptions): To
|
|
|
264
518
|
}>;
|
|
265
519
|
declare const createDelegateToAgentTool: typeof createAssignTaskTool;
|
|
266
520
|
declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
267
|
-
|
|
521
|
+
description: string;
|
|
268
522
|
task: string;
|
|
523
|
+
agentId: string;
|
|
524
|
+
nickname: string;
|
|
269
525
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
270
526
|
type: "object";
|
|
271
527
|
properties: {
|
|
272
528
|
agentId: {
|
|
273
529
|
type: "string";
|
|
274
530
|
};
|
|
531
|
+
description: {
|
|
532
|
+
type: "string";
|
|
533
|
+
};
|
|
534
|
+
nickname: {
|
|
535
|
+
type: "string";
|
|
536
|
+
};
|
|
275
537
|
task: {
|
|
276
538
|
type: "string";
|
|
277
539
|
};
|
|
@@ -279,8 +541,117 @@ declare function createDelegationTools(options: CreateDelegationToolsOptions): T
|
|
|
279
541
|
required: string[];
|
|
280
542
|
}>[];
|
|
281
543
|
|
|
544
|
+
/** Minimal shape of a skill source reference — matches @nuvin/config SkillDefinitionSource */
|
|
545
|
+
interface SkillSource {
|
|
546
|
+
path: string;
|
|
547
|
+
directory?: string;
|
|
548
|
+
scope?: string;
|
|
549
|
+
}
|
|
550
|
+
/** Minimal shape of a skill reference — matches @nuvin/config SkillDefinitionReference */
|
|
551
|
+
interface SkillReference {
|
|
552
|
+
id: string;
|
|
553
|
+
name: string;
|
|
554
|
+
description: string;
|
|
555
|
+
source: SkillSource;
|
|
556
|
+
}
|
|
557
|
+
/** Minimal shape of a loaded skill — matches @nuvin/config SerializedSkillDefinition */
|
|
558
|
+
interface LoadedSkill extends SkillReference {
|
|
559
|
+
instructions: string;
|
|
560
|
+
}
|
|
561
|
+
interface SkillToolOptions<TRef extends SkillReference = SkillReference> {
|
|
562
|
+
skills: TRef[];
|
|
563
|
+
loadSkill: (reference: TRef) => Promise<LoadedSkill>;
|
|
564
|
+
}
|
|
565
|
+
declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): ToolDefinition<{
|
|
566
|
+
name: string;
|
|
567
|
+
}, ToolOutputEnvelope, undefined, {
|
|
568
|
+
type: "object";
|
|
569
|
+
properties: {
|
|
570
|
+
name: {
|
|
571
|
+
type: "string";
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
required: readonly ["name"];
|
|
575
|
+
}>;
|
|
576
|
+
|
|
577
|
+
type TodoStatus = "pending" | "in_progress" | "completed";
|
|
578
|
+
type TodoPriority = "high" | "medium" | "low";
|
|
579
|
+
type TodoInputItem = {
|
|
580
|
+
id: string;
|
|
581
|
+
content: string;
|
|
582
|
+
status: TodoStatus;
|
|
583
|
+
priority: TodoPriority;
|
|
584
|
+
createdAt?: string;
|
|
585
|
+
};
|
|
586
|
+
type TodoItem = TodoInputItem & {
|
|
587
|
+
sessionId: string;
|
|
588
|
+
createdAt: string;
|
|
589
|
+
updatedAt: string;
|
|
590
|
+
};
|
|
591
|
+
type TodoStats = {
|
|
592
|
+
total: number;
|
|
593
|
+
pending: number;
|
|
594
|
+
inProgress: number;
|
|
595
|
+
completed: number;
|
|
596
|
+
};
|
|
597
|
+
declare class TodoStore {
|
|
598
|
+
private readonly todosBySession;
|
|
599
|
+
getTodos(sessionId: string): TodoItem[];
|
|
600
|
+
setTodos(sessionId: string, todos: TodoItem[]): void;
|
|
601
|
+
getStats(sessionId: string): TodoStats;
|
|
602
|
+
}
|
|
603
|
+
declare function createTodoWriteTool(store?: TodoStore): ToolDefinition<{
|
|
604
|
+
todos: {
|
|
605
|
+
content: string;
|
|
606
|
+
id: string;
|
|
607
|
+
priority: string;
|
|
608
|
+
status: string;
|
|
609
|
+
createdAt: string;
|
|
610
|
+
}[];
|
|
611
|
+
}, never, ToolOutputEnvelope, {
|
|
612
|
+
type: "object";
|
|
613
|
+
properties: {
|
|
614
|
+
todos: {
|
|
615
|
+
type: "array";
|
|
616
|
+
items: {
|
|
617
|
+
type: "object";
|
|
618
|
+
properties: {
|
|
619
|
+
content: {
|
|
620
|
+
type: "string";
|
|
621
|
+
};
|
|
622
|
+
status: {
|
|
623
|
+
type: "string";
|
|
624
|
+
};
|
|
625
|
+
priority: {
|
|
626
|
+
type: "string";
|
|
627
|
+
};
|
|
628
|
+
id: {
|
|
629
|
+
type: "string";
|
|
630
|
+
};
|
|
631
|
+
createdAt: {
|
|
632
|
+
type: "string";
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
required: string[];
|
|
636
|
+
};
|
|
637
|
+
};
|
|
638
|
+
};
|
|
639
|
+
required: string[];
|
|
640
|
+
}>;
|
|
641
|
+
|
|
642
|
+
interface ToolOutputOffloadOptions {
|
|
643
|
+
maxBytes: number;
|
|
644
|
+
sessionDir?: string;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Truncate a tool result's output if it exceeds `maxBytes`.
|
|
648
|
+
* Full output is written to `{sessionDir}/{toolName}_{sanitizedCallId}.log`.
|
|
649
|
+
* Returns the (possibly truncated) result. Mutates nothing.
|
|
650
|
+
*/
|
|
651
|
+
declare function truncateToolOutput(result: ToolResult, options: ToolOutputOffloadOptions): Promise<ToolResult>;
|
|
652
|
+
|
|
282
653
|
declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
|
|
283
|
-
declare function createToolOutput(output: string, structured?: JsonObject): ToolOutputEnvelope;
|
|
654
|
+
declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
|
|
284
655
|
declare class ToolExecutionError extends Error {
|
|
285
656
|
readonly structured: JsonObject;
|
|
286
657
|
constructor(message: string, structured?: JsonObject);
|
|
@@ -302,8 +673,111 @@ declare class ToolRegistry {
|
|
|
302
673
|
declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
|
|
303
674
|
declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
|
|
304
675
|
|
|
676
|
+
interface ViewFileToolOptions {
|
|
677
|
+
allowedDirs?: readonly string[];
|
|
678
|
+
defaultCwd?: string;
|
|
679
|
+
maxBytes?: number;
|
|
680
|
+
name?: string;
|
|
681
|
+
}
|
|
682
|
+
declare function createViewFileTool(options?: ViewFileToolOptions): ToolDefinition<{
|
|
683
|
+
path: string;
|
|
684
|
+
detail?: string | undefined;
|
|
685
|
+
}, ToolOutputEnvelope, undefined, {
|
|
686
|
+
type: "object";
|
|
687
|
+
properties: {
|
|
688
|
+
path: {
|
|
689
|
+
type: "string";
|
|
690
|
+
};
|
|
691
|
+
detail: {
|
|
692
|
+
type: "string";
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
required: readonly ["path"];
|
|
696
|
+
}>;
|
|
697
|
+
|
|
698
|
+
interface WebFetchToolOptions {
|
|
699
|
+
timeoutMs?: number;
|
|
700
|
+
name?: string;
|
|
701
|
+
}
|
|
702
|
+
declare function createWebFetchTool(options?: WebFetchToolOptions): ToolDefinition<{
|
|
703
|
+
url: string;
|
|
704
|
+
description?: string | undefined;
|
|
705
|
+
}, ToolOutputEnvelope, undefined, {
|
|
706
|
+
type: "object";
|
|
707
|
+
properties: {
|
|
708
|
+
description: {
|
|
709
|
+
type: "string";
|
|
710
|
+
};
|
|
711
|
+
url: {
|
|
712
|
+
type: "string";
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
required: readonly ["url"];
|
|
716
|
+
}>;
|
|
717
|
+
|
|
718
|
+
interface WebSearchToolOptions {
|
|
719
|
+
googleCseKey: string;
|
|
720
|
+
googleCseCx: string;
|
|
721
|
+
name?: string;
|
|
722
|
+
}
|
|
723
|
+
declare function createWebSearchTool(options: WebSearchToolOptions): ToolDefinition<{
|
|
724
|
+
query: string;
|
|
725
|
+
type?: string | undefined;
|
|
726
|
+
description?: string | undefined;
|
|
727
|
+
count?: number | undefined;
|
|
728
|
+
offset?: number | undefined;
|
|
729
|
+
safe?: boolean | undefined;
|
|
730
|
+
domains?: string[] | undefined;
|
|
731
|
+
recencyDays?: number | undefined;
|
|
732
|
+
lang?: string | undefined;
|
|
733
|
+
region?: string | undefined;
|
|
734
|
+
hydrateMeta?: boolean | undefined;
|
|
735
|
+
}, ToolOutputEnvelope, undefined, {
|
|
736
|
+
type: "object";
|
|
737
|
+
properties: {
|
|
738
|
+
description: {
|
|
739
|
+
type: "string";
|
|
740
|
+
};
|
|
741
|
+
query: {
|
|
742
|
+
type: "string";
|
|
743
|
+
};
|
|
744
|
+
count: {
|
|
745
|
+
type: "number";
|
|
746
|
+
};
|
|
747
|
+
offset: {
|
|
748
|
+
type: "number";
|
|
749
|
+
};
|
|
750
|
+
domains: {
|
|
751
|
+
type: "array";
|
|
752
|
+
items: {
|
|
753
|
+
type: "string";
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
recencyDays: {
|
|
757
|
+
type: "number";
|
|
758
|
+
};
|
|
759
|
+
lang: {
|
|
760
|
+
type: "string";
|
|
761
|
+
};
|
|
762
|
+
region: {
|
|
763
|
+
type: "string";
|
|
764
|
+
};
|
|
765
|
+
safe: {
|
|
766
|
+
type: "boolean";
|
|
767
|
+
};
|
|
768
|
+
type: {
|
|
769
|
+
type: "string";
|
|
770
|
+
};
|
|
771
|
+
hydrateMeta: {
|
|
772
|
+
type: "boolean";
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
required: readonly ["query"];
|
|
776
|
+
}>;
|
|
777
|
+
|
|
305
778
|
declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
|
|
779
|
+
declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
|
|
306
780
|
declare function assertWorkspaceFile(filePath: string): Promise<void>;
|
|
307
781
|
declare function isProbablyBinary(buffer: Buffer): boolean;
|
|
308
782
|
|
|
309
|
-
export { type BashToolInput, type BashToolOptions, type CreateDelegationToolsOptions, type DelegatedAgentDefinition, type DelegatedAgentFactoryContext, type FileEditToolOptions, type FileNewToolOptions, type FileReadToolOptions, type GlobToolOptions, type GrepToolOptions, type LsToolOptions, type RipgrepMatch, ToolExecutionError, ToolRegistry, assertWorkspaceFile, createAssignTaskTool, createBashTool, createDelegateToAgentTool, createDelegationTools, createFileEditTool, createFileNewTool, createFileReadTool, createGlobTool, createGrepTool, createInternalToolRuntime, createLsTool, createMockToolRuntime, createShellExecTool, createToolOutput, defineTool, deriveFinalToolOutput, filepath, files, isProbablyBinary, normalizeToolOutputValue, resolveWorkspacePath, search, validateToolInput };
|
|
783
|
+
export { type BashToolInput, type BashToolOptions, type CommandReference, type CommandToolOptions, type CreateDelegationToolsOptions, type DelegatedAgentDefinition, type DelegatedAgentFactoryContext, type FileEditToolOptions, type FileNewToolOptions, type FileReadToolOptions, type GlobToolOptions, type GrepToolOptions, type LoadedCommand, type LoadedSkill, type LsToolOptions, type LspService, type LspServiceConfig, type LspToolOptions, type McpConnectionOptions, type McpConnector, type McpOAuthProviderOptions, type McpServerConnectionStatus, type McpToolBundle, type McpToolClient, type McpToolDescriptor, type RipgrepMatch, type SkillReference, type SkillSource, type SkillToolOptions, ToolExecutionError, type ToolOutputOffloadOptions, ToolRegistry, type ViewFileToolOptions, type WebFetchToolOptions, type WebSearchToolOptions, assertWorkspaceFile, buildMcpHttpHeaders, connectMcpServer, createAskUserTool, createAssignTaskTool, createBashTool, createDelegateToAgentTool, createDelegationTools, createFileEditTool, createFileNewTool, createFileReadTool, createGlobTool, createGrepTool, createInternalToolRuntime, createInvokeCommandTool, createLoadSkillTool, createLsTool, createLspService, createLspTool, createMcpOAuthProvider, createMcpTool, createMcpToolName, createMcpToolsFromServers, createMockToolRuntime, createShellExecTool, createTodoWriteTool, createToolOutput, createViewFileTool, createWebFetchTool, createWebSearchTool, defineTool, deriveFinalToolOutput, filepath, files, isProbablyBinary, normalizeToolOutputValue, resolveAllowedPath, resolveWorkspacePath, search, toNuvinToolSchema, truncateToolOutput, validateToolInput };
|