@nuvin/agent-core 0.0.0-rc.1 → 0.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION +2 -2
- package/dist/agent/index.d.ts +53 -5
- package/dist/agent/index.js +1 -1
- package/dist/chunk-FFIZ6TKW.js +1 -0
- package/dist/chunk-NYZR4XKO.js +1 -1
- package/dist/chunk-SEP4YYY3.js +1 -0
- package/dist/chunk-VDDXTXQ4.js +1 -0
- package/dist/chunk-WJMBJOVF.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/formats/index.d.ts +17 -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-F0kn75gb.d.ts → provider-adapters-CURkQPbY.d.ts} +1 -1
- package/dist/shared/index.d.ts +8 -3
- package/dist/shared/index.js +1 -1
- package/dist/tools/index.d.ts +333 -23
- package/dist/tools/index.js +1 -1
- package/dist/{types-D11KxtW1.d.ts → types-Df0vlfj-.d.ts} +75 -27
- package/package.json +14 -4
- package/dist/chunk-C6OLKGP6.js +0 -1
- package/dist/chunk-U2BLX7Y5.js +0 -1
- package/dist/chunk-WVVWOCQ5.js +0 -1
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { G as AutoReasoningEffort, v as ReasoningConfig, H as AnthropicThinkingConfig, I as OpenAiReasoningConfig, f as TurnState } from '../types-Df0vlfj-.js';
|
|
2
|
+
export { aQ as AgentAssistantChunkEvent, aP as AgentAssistantMessageEvent, bl as AgentDefinition, bk as AgentDefinitionFactoryContext, A as AgentEvent, aB as AgentEventContext, b3 as AgentEventHandler, aY as AgentFinalMessageEvent, b as AgentInput, a$ as AgentLifecycleEvent, aN as AgentModelRequestEvent, aO as AgentModelResponseEvent, a as AgentOptions, a_ as AgentProviderRetryEvent, aU as AgentReasoningChunkEvent, aT as AgentReasoningMessageEvent, c as AgentSendOptions, aV as AgentToolCallEvent, aW as AgentToolResultEvent, aX as AgentToolResultMessageEvent, aS as AgentToolUseChunkEvent, aR as AgentToolUseMessageEvent, aZ as AgentTurnCompleteEvent, aM as AgentUserMessageEvent, ad as AnthropicAdaptiveThinkingConfig, a7 as AnthropicAssistantContentBlock, ae as AnthropicDisabledThinkingConfig, ac as AnthropicEnabledThinkingConfig, a2 as AnthropicRedactedThinkingBlock, a6 as AnthropicRedactedThinkingWireBlock, aq as AnthropicSignatureDeltaChunk, a1 as AnthropicThinkingBlock, ap as AnthropicThinkingDeltaChunk, aa as AnthropicThinkingDisplay, ab as AnthropicThinkingEffort, a5 as AnthropicThinkingWireBlock, bj as AnyExtensionRegistration, b9 as AnyToolDefinition, aE as AskUserAnswers, aC as AskUserOption, aD as AskUserQuestion, aF as AskUserQuestionRequest, ai as AssistantContentBlock, a9 as AutoReasoningConfig, B as BaseChatModelOptions, aA as ChatModel, C as ChatRequest, n as ChatResponse, w as ChatResponseChunk, k as CompileRequestInput, g as ContentBlock, an as ContentDeltaChunk, i as ContentInput, bt as CreateManagedRunInput, au as DoneChunk, E as EngineChatModel, be as ExtensionContext, d as ExtensionRegistry, ak as IdentifiedMessage, _ as ImageBlock, Z as ImageMediaType, b5 as InferJsonSchema, K as JsonObject, J as JsonPrimitive, Y as JsonSchema, W as JsonSchemaArray, V as JsonSchemaBoolean, U as JsonSchemaNumber, X as JsonSchemaObject, Q as JsonSchemaString, N as JsonSchemaType, L as JsonValue, bo as ManagedAgentRun, bp as ManagedAgentRunHandle, bn as ManagedRunError, bq as ManagedRunEvent, br as ManagedRunEventHandler, bm as ManagedRunStatus, M as Message, j as MessageInput, ah as MessageProviderState, aj as MessageRole, x as ModelExecutionOptions, y as ModelInfo, z as ModelLimits, l as ModelRequest, m as ModelResponse, bg as Observer, bi as ObserverExtensionRegistration, bb as ObserverOnlyStage, bx as OpenAiFunctionCall, by as OpenAiFunctionCallOutput, bF as OpenAiFunctionTool, bv as OpenAiInputImage, bw as OpenAiInputMessage, bu as OpenAiInputText, bB as OpenAiOutputMessage, bz as OpenAiOutputTextPart, a4 as OpenAiReasoningBlock, ar as OpenAiReasoningDeltaChunk, af as OpenAiReasoningEffort, bC as OpenAiReasoningOutputItem, ag as OpenAiReasoningSummary, as as OpenAiReasoningSummaryDeltaChunk, a3 as OpenAiReasoningSummaryText, bA as OpenAiRefusalPart, bD as OpenAiResponsesOutputItem, bE as OpenAiResponsesReasoningParam, O as OpenAiResponsesRequest, bd as PayloadByStage, az as PrepareRequestInput, t as PreparedRequest, u as ProviderCredential, D as ProviderCredentialKind, F as ProviderEndpoints, s as ProviderRequestMutator, at as ProviderRetryChunk, P as ProviderSessionResolver, a8 as ReasoningVisibility, r as ResolvedProviderSession, R as RunTurnDeps, bs as RuntimeManagerOptions, bc as Stage, S as SystemInput, h as TextBlock, b8 as ToolDefinition, aG as ToolExecutionContext, b7 as ToolGenerator, ax as ToolOutputEnvelope, b6 as ToolOutputValue, q as ToolResult, p as ToolResultBlock, aw as ToolResultChunk, a0 as ToolResultContent, $ as ToolResultContentBlock, av as ToolResultMeta, b4 as ToolRuntime, aJ as ToolRuntimeCompletedEvent, b0 as ToolRuntimeDispatchDecision, aL as ToolRuntimeEvent, b2 as ToolRuntimeEventHandler, aI as ToolRuntimeOutputChunkEvent, aK as ToolRuntimeRejectedEvent, aH as ToolRuntimeStartedEvent, b1 as ToolRuntimeToolCallHandler, al as ToolSchema, o as ToolUseBlock, ao as ToolUseDeltaChunk, ba as TransformableStage, bf as Transformer, bh as TransformerExtensionRegistration, e as TurnInput, T as TurnResult, ay as TurnResultStatus, am as Usage } from '../types-Df0vlfj-.js';
|
|
3
3
|
|
|
4
4
|
declare class OperationAbortedError extends Error {
|
|
5
5
|
readonly code = "ABORT_ERR";
|
|
@@ -14,4 +14,9 @@ declare function mapAutoReasoningEffortToBudgetTokens(effort: AutoReasoningEffor
|
|
|
14
14
|
declare function resolveAnthropicThinkingConfig(reasoning: ReasoningConfig | undefined): AnthropicThinkingConfig | undefined;
|
|
15
15
|
declare function resolveOpenAiReasoningConfig(reasoning: ReasoningConfig | undefined): OpenAiReasoningConfig | undefined;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare class TurnFailedError extends Error {
|
|
18
|
+
readonly state: TurnState;
|
|
19
|
+
constructor(cause: unknown, state: TurnState);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { AnthropicThinkingConfig, AutoReasoningEffort, OpenAiReasoningConfig, OperationAbortedError, ReasoningConfig, TurnFailedError, TurnState, addAbortListener, isAbortError, mapAutoReasoningEffortToBudgetTokens, resolveAnthropicThinkingConfig, resolveOpenAiReasoningConfig, throwIfAborted, toAbortError };
|
package/dist/shared/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x17b5(){var _0xd5e3b2=['ntiWwe1xsu1d','mJG5ntnOsurPEfa','mJjMuLbtq2y','mJCZndmYDeH3rKnW','mteXnZK1vg5LCKDy','ntzvANfezLm','mJeWnZi2tNrUvNr3','mtCWmJG3sgTYs1P4','ndrYAM5prNq','mty4ndyWvgXPsunp','mJq4mZi4txn5CeP0'];_0x17b5=function(){return _0xd5e3b2;};return _0x17b5();}(function(_0x5e5a50,_0x281532){var _0x24740e={_0x2c4a1d:0x1f6,_0x7667a4:0x1f1,_0x1d1e25:0x1ec,_0xbdcc82:0x43f,_0x2157a4:0x441,_0x36d8c3:0x447,_0x350ba0:0x1ee,_0x2ec419:0x43d,_0x2ea8ca:0x449,_0x53bc4f:0x449,_0x1e3d25:0x1ee,_0x1bbb9f:0x1f3,_0x32ae53:0x43e,_0x4cc170:0x43e,_0x90669:0x436,_0x588f38:0x43b,_0x311f25:0x447,_0x5c568b:0x447,_0x4f36da:0x1ea,_0x2bcb13:0x1f0},_0x73bca2={_0x69a702:0x283};function _0x4db19f(_0x342e60,_0x3fb3ad,_0xeda88f,_0x25ec91){return _0xd360(_0x3fb3ad-_0x73bca2._0x69a702,_0x25ec91);}function _0x4e83c2(_0x217d68,_0x536683,_0x3b871d,_0x3c2a79){return _0xd360(_0x536683-0x32,_0x3c2a79);}var _0xd9baf4=_0x5e5a50();while(!![]){try{var _0x24a9c2=parseInt(_0x4e83c2(_0x24740e._0x2c4a1d,_0x24740e._0x7667a4,_0x24740e._0x1d1e25,0x1ee))/0x1+parseInt(_0x4db19f(_0x24740e._0xbdcc82,_0x24740e._0x2157a4,_0x24740e._0x36d8c3,0x444))/0x2+parseInt(_0x4e83c2(0x1ed,0x1e9,_0x24740e._0x350ba0,0x1ec))/0x3+parseInt(_0x4db19f(_0x24740e._0x2ec419,0x443,_0x24740e._0x2ea8ca,_0x24740e._0x53bc4f))/0x4*(-parseInt(_0x4e83c2(0x1ef,_0x24740e._0x1e3d25,_0x24740e._0x1bbb9f,0x1e9))/0x5)+-parseInt(_0x4db19f(0x43d,_0x24740e._0x32ae53,0x439,_0x24740e._0x4cc170))/0x6*(-parseInt(_0x4db19f(0x445,0x440,0x445,0x443))/0x7)+-parseInt(_0x4db19f(0x438,0x43b,0x437,_0x24740e._0x90669))/0x8*(parseInt(_0x4db19f(_0x24740e._0xbdcc82,0x43c,0x440,_0x24740e._0x588f38))/0x9)+parseInt(_0x4db19f(0x43f,0x444,_0x24740e._0x311f25,_0x24740e._0x5c568b))/0xa*(-parseInt(_0x4e83c2(_0x24740e._0x4f36da,0x1ec,_0x24740e._0x2bcb13,0x1f2))/0xb);if(_0x24a9c2===_0x281532)break;else _0xd9baf4['push'](_0xd9baf4['shift']());}catch(_0x463a6e){_0xd9baf4['push'](_0xd9baf4['shift']());}}}(_0x17b5,0x39310));import{mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig}from'../chunk-NYZR4XKO.js';function _0xd360(_0x14163b,_0x9f63c2){_0x14163b=_0x14163b-0x1b7;var _0x17b517=_0x17b5();var _0xd360bd=_0x17b517[_0x14163b];if(_0xd360['FuQCpK']===undefined){var _0x1294f5=function(_0x14dc29){var _0x14cd85='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xe3c03e='',_0x41049c='';for(var _0x3a6930=0x0,_0x381cc1,_0x16a8b7,_0x54ca4a=0x0;_0x16a8b7=_0x14dc29['charAt'](_0x54ca4a++);~_0x16a8b7&&(_0x381cc1=_0x3a6930%0x4?_0x381cc1*0x40+_0x16a8b7:_0x16a8b7,_0x3a6930++%0x4)?_0xe3c03e+=String['fromCharCode'](0xff&_0x381cc1>>(-0x2*_0x3a6930&0x6)):0x0){_0x16a8b7=_0x14cd85['indexOf'](_0x16a8b7);}for(var _0x1a689b=0x0,_0x181264=_0xe3c03e['length'];_0x1a689b<_0x181264;_0x1a689b++){_0x41049c+='%'+('00'+_0xe3c03e['charCodeAt'](_0x1a689b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x41049c);};_0xd360['kmwZxY']=_0x1294f5,_0xd360['AveMvB']={},_0xd360['FuQCpK']=!![];}var _0x338bb7=_0x17b517[0x0],_0x3fcf7a=_0x14163b+_0x338bb7,_0x101ce4=_0xd360['AveMvB'][_0x3fcf7a];return!_0x101ce4?(_0xd360bd=_0xd360['kmwZxY'](_0xd360bd),_0xd360['AveMvB'][_0x3fcf7a]=_0xd360bd):_0xd360bd=_0x101ce4,_0xd360bd;}import{TurnFailedError}from'../chunk-FFIZ6TKW.js';import{OperationAbortedError,addAbortListener,isAbortError,throwIfAborted,toAbortError}from'../chunk-X7VAACWY.js';export{OperationAbortedError,TurnFailedError,addAbortListener,isAbortError,mapAutoReasoningEffortToBudgetTokens,resolveAnthropicThinkingConfig,resolveOpenAiReasoningConfig,throwIfAborted,toAbortError};
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,8 +1,95 @@
|
|
|
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';
|
|
2
4
|
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
3
|
-
import { MCPAuthConfig, MCPServerConfig } from '@nuvin/config';
|
|
4
5
|
import { CallToolResult, ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
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
|
+
}>;
|
|
92
|
+
|
|
6
93
|
interface BashToolInput {
|
|
7
94
|
command: string;
|
|
8
95
|
cwd?: string;
|
|
@@ -10,6 +97,7 @@ interface BashToolInput {
|
|
|
10
97
|
ignoreOutput?: boolean;
|
|
11
98
|
}
|
|
12
99
|
interface BashToolOptions {
|
|
100
|
+
allowedDirs?: readonly string[];
|
|
13
101
|
defaultCwd?: string;
|
|
14
102
|
defaultTimeoutMs?: number;
|
|
15
103
|
description?: string;
|
|
@@ -20,8 +108,8 @@ interface BashToolOptions {
|
|
|
20
108
|
}
|
|
21
109
|
declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
22
110
|
command: string;
|
|
23
|
-
cwd?: string | undefined;
|
|
24
111
|
timeoutMs?: number | undefined;
|
|
112
|
+
cwd?: string | undefined;
|
|
25
113
|
ignoreOutput?: boolean | undefined;
|
|
26
114
|
}, string, ToolOutputEnvelope, {
|
|
27
115
|
type: "object";
|
|
@@ -43,8 +131,8 @@ declare function createBashTool(options?: BashToolOptions): ToolDefinition<{
|
|
|
43
131
|
}>;
|
|
44
132
|
declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<{
|
|
45
133
|
command: string;
|
|
46
|
-
cwd?: string | undefined;
|
|
47
134
|
timeoutMs?: number | undefined;
|
|
135
|
+
cwd?: string | undefined;
|
|
48
136
|
ignoreOutput?: boolean | undefined;
|
|
49
137
|
}, string, ToolOutputEnvelope, {
|
|
50
138
|
type: "object";
|
|
@@ -65,22 +153,8 @@ declare function createShellExecTool(options?: BashToolOptions): ToolDefinition<
|
|
|
65
153
|
required: readonly ["command"];
|
|
66
154
|
}>;
|
|
67
155
|
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
}
|
|
156
|
+
type CommandReference = CommandDefinitionReference;
|
|
157
|
+
type LoadedCommand = SerializedCommandDefinition;
|
|
84
158
|
interface CommandToolOptions<TRef extends CommandReference = CommandReference> {
|
|
85
159
|
commands: TRef[];
|
|
86
160
|
loadCommand: (reference: TRef) => Promise<LoadedCommand>;
|
|
@@ -102,6 +176,7 @@ declare function createInvokeCommandTool<TRef extends CommandReference>(options:
|
|
|
102
176
|
}>;
|
|
103
177
|
|
|
104
178
|
interface FileEditToolOptions {
|
|
179
|
+
allowedDirs?: readonly string[];
|
|
105
180
|
defaultCwd?: string;
|
|
106
181
|
name?: string;
|
|
107
182
|
}
|
|
@@ -130,12 +205,13 @@ declare function createFileEditTool(options?: FileEditToolOptions): ToolDefiniti
|
|
|
130
205
|
}>;
|
|
131
206
|
|
|
132
207
|
interface FileNewToolOptions {
|
|
208
|
+
allowedDirs?: readonly string[];
|
|
133
209
|
defaultCwd?: string;
|
|
134
210
|
name?: string;
|
|
135
211
|
}
|
|
136
212
|
declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition<{
|
|
137
|
-
filePath: string;
|
|
138
213
|
content: string;
|
|
214
|
+
filePath: string;
|
|
139
215
|
}, ToolOutputEnvelope, undefined, {
|
|
140
216
|
type: "object";
|
|
141
217
|
properties: {
|
|
@@ -150,6 +226,7 @@ declare function createFileNewTool(options?: FileNewToolOptions): ToolDefinition
|
|
|
150
226
|
}>;
|
|
151
227
|
|
|
152
228
|
interface FileReadToolOptions {
|
|
229
|
+
allowedDirs?: readonly string[];
|
|
153
230
|
defaultCwd?: string;
|
|
154
231
|
name?: string;
|
|
155
232
|
}
|
|
@@ -174,6 +251,7 @@ declare function createFileReadTool(options?: FileReadToolOptions): ToolDefiniti
|
|
|
174
251
|
}>;
|
|
175
252
|
|
|
176
253
|
interface GlobToolOptions {
|
|
254
|
+
allowedDirs?: readonly string[];
|
|
177
255
|
defaultCwd?: string;
|
|
178
256
|
limit?: number;
|
|
179
257
|
name?: string;
|
|
@@ -199,6 +277,7 @@ declare function createGlobTool(options?: GlobToolOptions): ToolDefinition<{
|
|
|
199
277
|
}>;
|
|
200
278
|
|
|
201
279
|
interface GrepToolOptions {
|
|
280
|
+
allowedDirs?: readonly string[];
|
|
202
281
|
defaultCwd?: string;
|
|
203
282
|
limit?: number;
|
|
204
283
|
name?: string;
|
|
@@ -238,6 +317,7 @@ interface InternalToolRuntimeOptions {
|
|
|
238
317
|
declare function createInternalToolRuntime(tools?: AnyToolDefinition[], options?: InternalToolRuntimeOptions): ToolRuntime;
|
|
239
318
|
|
|
240
319
|
interface LsToolOptions {
|
|
320
|
+
allowedDirs?: readonly string[];
|
|
241
321
|
defaultCwd?: string;
|
|
242
322
|
name?: string;
|
|
243
323
|
}
|
|
@@ -256,6 +336,41 @@ declare function createLsTool(options?: LsToolOptions): ToolDefinition<{
|
|
|
256
336
|
};
|
|
257
337
|
}>;
|
|
258
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
|
+
|
|
259
374
|
interface McpOAuthProviderOptions {
|
|
260
375
|
serverName: string;
|
|
261
376
|
callbackUrl: string;
|
|
@@ -379,14 +494,22 @@ interface CreateDelegationToolsOptions {
|
|
|
379
494
|
agents?: Record<string, DelegatedAgentDefinition>;
|
|
380
495
|
}
|
|
381
496
|
declare function createAssignTaskTool(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
497
|
+
description: string;
|
|
382
498
|
task: string;
|
|
383
499
|
agentId: string;
|
|
500
|
+
nickname: string;
|
|
384
501
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
385
502
|
type: "object";
|
|
386
503
|
properties: {
|
|
387
504
|
agentId: {
|
|
388
505
|
type: "string";
|
|
389
506
|
};
|
|
507
|
+
description: {
|
|
508
|
+
type: "string";
|
|
509
|
+
};
|
|
510
|
+
nickname: {
|
|
511
|
+
type: "string";
|
|
512
|
+
};
|
|
390
513
|
task: {
|
|
391
514
|
type: "string";
|
|
392
515
|
};
|
|
@@ -395,14 +518,22 @@ declare function createAssignTaskTool(options: CreateDelegationToolsOptions): To
|
|
|
395
518
|
}>;
|
|
396
519
|
declare const createDelegateToAgentTool: typeof createAssignTaskTool;
|
|
397
520
|
declare function createDelegationTools(options: CreateDelegationToolsOptions): ToolDefinition<{
|
|
521
|
+
description: string;
|
|
398
522
|
task: string;
|
|
399
523
|
agentId: string;
|
|
524
|
+
nickname: string;
|
|
400
525
|
}, ToolOutputEnvelope, ToolOutputEnvelope, {
|
|
401
526
|
type: "object";
|
|
402
527
|
properties: {
|
|
403
528
|
agentId: {
|
|
404
529
|
type: "string";
|
|
405
530
|
};
|
|
531
|
+
description: {
|
|
532
|
+
type: "string";
|
|
533
|
+
};
|
|
534
|
+
nickname: {
|
|
535
|
+
type: "string";
|
|
536
|
+
};
|
|
406
537
|
task: {
|
|
407
538
|
type: "string";
|
|
408
539
|
};
|
|
@@ -443,8 +574,84 @@ declare function createLoadSkillTool<TRef extends SkillReference>(options: Skill
|
|
|
443
574
|
required: readonly ["name"];
|
|
444
575
|
}>;
|
|
445
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
|
+
|
|
446
653
|
declare function normalizeToolOutputValue(output: ToolOutputValue): ToolResultChunk;
|
|
447
|
-
declare function createToolOutput(output: string, structured?: JsonObject): ToolOutputEnvelope;
|
|
654
|
+
declare function createToolOutput(output: string, structured?: JsonObject, content?: ToolResultContent): ToolOutputEnvelope;
|
|
448
655
|
declare class ToolExecutionError extends Error {
|
|
449
656
|
readonly structured: JsonObject;
|
|
450
657
|
constructor(message: string, structured?: JsonObject);
|
|
@@ -466,8 +673,111 @@ declare class ToolRegistry {
|
|
|
466
673
|
declare function validateToolInput<TSchema extends JsonSchemaObject>(input: JsonValue, schema: TSchema): InferJsonSchema<TSchema>;
|
|
467
674
|
declare function deriveFinalToolOutput(chunks: ToolResultChunk[]): ToolResultChunk;
|
|
468
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
|
+
|
|
469
778
|
declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
|
|
779
|
+
declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
|
|
470
780
|
declare function assertWorkspaceFile(filePath: string): Promise<void>;
|
|
471
781
|
declare function isProbablyBinary(buffer: Buffer): boolean;
|
|
472
782
|
|
|
473
|
-
export { type BashToolInput, type BashToolOptions, type CommandReference, type
|
|
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 };
|