xx-ai-cli 0.1.0
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 +21 -0
- package/README.md +328 -0
- package/dist/commands/agent.d.ts +12 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +311 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/ask.d.ts +7 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +52 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/chat.d.ts +9 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +129 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/cmd.d.ts +6 -0
- package/dist/commands/cmd.d.ts.map +1 -0
- package/dist/commands/cmd.js +52 -0
- package/dist/commands/cmd.js.map +1 -0
- package/dist/commands/code.d.ts +8 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/code.js +75 -0
- package/dist/commands/code.js.map +1 -0
- package/dist/commands/file.d.ts +7 -0
- package/dist/commands/file.d.ts.map +1 -0
- package/dist/commands/file.js +66 -0
- package/dist/commands/file.js.map +1 -0
- package/dist/commands/history.d.ts +5 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +159 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +144 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +24 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +328 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/model.d.ts +6 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +128 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/pkg.d.ts +12 -0
- package/dist/commands/pkg.d.ts.map +1 -0
- package/dist/commands/pkg.js +132 -0
- package/dist/commands/pkg.js.map +1 -0
- package/dist/commands/run.d.ts +9 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +185 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/core/agentTask.d.ts +20 -0
- package/dist/core/agentTask.d.ts.map +1 -0
- package/dist/core/agentTask.js +81 -0
- package/dist/core/agentTask.js.map +1 -0
- package/dist/core/config.d.ts +41 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +153 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/executor.d.ts +20 -0
- package/dist/core/executor.d.ts.map +1 -0
- package/dist/core/executor.js +68 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/files.d.ts +24 -0
- package/dist/core/files.d.ts.map +1 -0
- package/dist/core/files.js +95 -0
- package/dist/core/files.js.map +1 -0
- package/dist/core/github.d.ts +32 -0
- package/dist/core/github.d.ts.map +1 -0
- package/dist/core/github.js +82 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/prompt.d.ts +9 -0
- package/dist/core/prompt.d.ts.map +1 -0
- package/dist/core/prompt.js +44 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/router.d.ts +16 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/router.js +182 -0
- package/dist/core/router.js.map +1 -0
- package/dist/core/search.d.ts +14 -0
- package/dist/core/search.d.ts.map +1 -0
- package/dist/core/search.js +179 -0
- package/dist/core/search.js.map +1 -0
- package/dist/core/session.d.ts +38 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +172 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/stream.d.ts +15 -0
- package/dist/core/stream.d.ts.map +1 -0
- package/dist/core/stream.js +102 -0
- package/dist/core/stream.js.map +1 -0
- package/dist/core/tools.d.ts +343 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +293 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +372 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/renderer.d.ts +17 -0
- package/dist/ui/renderer.d.ts.map +1 -0
- package/dist/ui/renderer.js +69 -0
- package/dist/ui/renderer.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { createParser } from 'eventsource-parser';
|
|
2
|
+
export async function chat(modelConfig, messages, options = {}) {
|
|
3
|
+
const { stream = true, onChunk, tools } = options;
|
|
4
|
+
const { baseURL, apiKey, model, maxTokens, temperature } = modelConfig;
|
|
5
|
+
const body = {
|
|
6
|
+
model,
|
|
7
|
+
messages,
|
|
8
|
+
max_tokens: maxTokens,
|
|
9
|
+
temperature,
|
|
10
|
+
stream,
|
|
11
|
+
};
|
|
12
|
+
// 注入工具定义
|
|
13
|
+
if (tools && tools.length > 0) {
|
|
14
|
+
body.tools = tools;
|
|
15
|
+
body.tool_choice = 'auto';
|
|
16
|
+
// 工具调用时不能流式(部分模型限制),但我们仍尝试
|
|
17
|
+
}
|
|
18
|
+
const response = await fetch(`${baseURL}/chat/completions`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: {
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
Authorization: `Bearer ${apiKey}`,
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify(body),
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const err = await response.text();
|
|
28
|
+
throw new Error(`API 请求失败 [${response.status}]: ${err}`);
|
|
29
|
+
}
|
|
30
|
+
// ─── 非流式 ────────────────────────────────────────────────
|
|
31
|
+
if (!stream) {
|
|
32
|
+
const data = (await response.json());
|
|
33
|
+
const choice = data.choices[0];
|
|
34
|
+
const toolCalls = choice?.message?.tool_calls;
|
|
35
|
+
const content = choice?.message?.content ?? '';
|
|
36
|
+
return {
|
|
37
|
+
content,
|
|
38
|
+
toolCalls: toolCalls && toolCalls.length > 0 ? toolCalls : undefined,
|
|
39
|
+
finishReason: choice?.finish_reason,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// ─── 流式处理 ─────────────────────────────────────────────
|
|
43
|
+
let fullContent = '';
|
|
44
|
+
const partialToolCalls = {};
|
|
45
|
+
const parser = createParser({
|
|
46
|
+
onEvent(event) {
|
|
47
|
+
if (event.data === '[DONE]')
|
|
48
|
+
return;
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(event.data);
|
|
51
|
+
const delta = parsed.choices[0]?.delta;
|
|
52
|
+
if (!delta)
|
|
53
|
+
return;
|
|
54
|
+
// 普通文本
|
|
55
|
+
if (delta.content) {
|
|
56
|
+
fullContent += delta.content;
|
|
57
|
+
onChunk?.(delta.content);
|
|
58
|
+
}
|
|
59
|
+
// 工具调用 delta 拼接
|
|
60
|
+
if (delta.tool_calls) {
|
|
61
|
+
for (const tc of delta.tool_calls) {
|
|
62
|
+
if (!partialToolCalls[tc.index]) {
|
|
63
|
+
partialToolCalls[tc.index] = { id: tc.id ?? '', name: '', arguments: '' };
|
|
64
|
+
}
|
|
65
|
+
if (tc.function?.name)
|
|
66
|
+
partialToolCalls[tc.index].name += tc.function.name;
|
|
67
|
+
if (tc.function?.arguments)
|
|
68
|
+
partialToolCalls[tc.index].arguments += tc.function.arguments;
|
|
69
|
+
if (tc.id)
|
|
70
|
+
partialToolCalls[tc.index].id = tc.id;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// 忽略解析错误
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
const reader = response.body?.getReader();
|
|
80
|
+
if (!reader)
|
|
81
|
+
throw new Error('无法读取响应流');
|
|
82
|
+
const decoder = new TextDecoder();
|
|
83
|
+
while (true) {
|
|
84
|
+
const { done, value } = await reader.read();
|
|
85
|
+
if (done)
|
|
86
|
+
break;
|
|
87
|
+
parser.feed(decoder.decode(value, { stream: true }));
|
|
88
|
+
}
|
|
89
|
+
// 组装 toolCalls
|
|
90
|
+
const toolCallsResult = Object.values(partialToolCalls).length > 0
|
|
91
|
+
? Object.values(partialToolCalls).map((tc, i) => ({
|
|
92
|
+
id: tc.id || `call_${i}`,
|
|
93
|
+
type: 'function',
|
|
94
|
+
function: { name: tc.name, arguments: tc.arguments },
|
|
95
|
+
}))
|
|
96
|
+
: undefined;
|
|
97
|
+
return {
|
|
98
|
+
content: fullContent,
|
|
99
|
+
toolCalls: toolCallsResult,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/core/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiBlD,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,WAAwB,EACxB,QAAmB,EACnB,UAAuB,EAAE;IAEzB,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;IAEvE,MAAM,IAAI,GAA4B;QACpC,KAAK;QACL,QAAQ;QACR,UAAU,EAAE,SAAS;QACrB,WAAW;QACX,MAAM;KACP,CAAC;IAEF,SAAS;IACT,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC1B,2BAA2B;IAC7B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,mBAAmB,EAAE;QAC1D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAA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AAE,CAAC;IAClC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;YAAE,MAAM;QAChB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,eAAe;IACf,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC;QAChE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAChD,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE;YACxB,IAAI,EAAE,UAAmB;YACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE;SACrD,CAAC,CAAC;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,eAAe;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
export declare const TOOL_DEFINITIONS: ({
|
|
2
|
+
type: string;
|
|
3
|
+
function: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
query: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
max_results: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
path?: undefined;
|
|
19
|
+
max_lines?: undefined;
|
|
20
|
+
content?: undefined;
|
|
21
|
+
search?: undefined;
|
|
22
|
+
replace?: undefined;
|
|
23
|
+
show_hidden?: undefined;
|
|
24
|
+
depth?: undefined;
|
|
25
|
+
pattern?: undefined;
|
|
26
|
+
file_glob?: undefined;
|
|
27
|
+
command?: undefined;
|
|
28
|
+
description?: undefined;
|
|
29
|
+
package?: undefined;
|
|
30
|
+
global?: undefined;
|
|
31
|
+
dev?: undefined;
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
type: string;
|
|
38
|
+
function: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
parameters: {
|
|
42
|
+
type: string;
|
|
43
|
+
properties: {
|
|
44
|
+
path: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
default?: undefined;
|
|
48
|
+
};
|
|
49
|
+
max_lines: {
|
|
50
|
+
type: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
query?: undefined;
|
|
54
|
+
max_results?: undefined;
|
|
55
|
+
content?: undefined;
|
|
56
|
+
search?: undefined;
|
|
57
|
+
replace?: undefined;
|
|
58
|
+
show_hidden?: undefined;
|
|
59
|
+
depth?: undefined;
|
|
60
|
+
pattern?: undefined;
|
|
61
|
+
file_glob?: undefined;
|
|
62
|
+
command?: undefined;
|
|
63
|
+
description?: undefined;
|
|
64
|
+
package?: undefined;
|
|
65
|
+
global?: undefined;
|
|
66
|
+
dev?: undefined;
|
|
67
|
+
};
|
|
68
|
+
required: string[];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
type: string;
|
|
73
|
+
function: {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
parameters: {
|
|
77
|
+
type: string;
|
|
78
|
+
properties: {
|
|
79
|
+
path: {
|
|
80
|
+
type: string;
|
|
81
|
+
description: string;
|
|
82
|
+
default?: undefined;
|
|
83
|
+
};
|
|
84
|
+
content: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
query?: undefined;
|
|
89
|
+
max_results?: undefined;
|
|
90
|
+
max_lines?: undefined;
|
|
91
|
+
search?: undefined;
|
|
92
|
+
replace?: undefined;
|
|
93
|
+
show_hidden?: undefined;
|
|
94
|
+
depth?: undefined;
|
|
95
|
+
pattern?: undefined;
|
|
96
|
+
file_glob?: undefined;
|
|
97
|
+
command?: undefined;
|
|
98
|
+
description?: undefined;
|
|
99
|
+
package?: undefined;
|
|
100
|
+
global?: undefined;
|
|
101
|
+
dev?: undefined;
|
|
102
|
+
};
|
|
103
|
+
required: string[];
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
type: string;
|
|
108
|
+
function: {
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
parameters: {
|
|
112
|
+
type: string;
|
|
113
|
+
properties: {
|
|
114
|
+
path: {
|
|
115
|
+
type: string;
|
|
116
|
+
description: string;
|
|
117
|
+
default?: undefined;
|
|
118
|
+
};
|
|
119
|
+
search: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
replace: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
query?: undefined;
|
|
128
|
+
max_results?: undefined;
|
|
129
|
+
max_lines?: undefined;
|
|
130
|
+
content?: undefined;
|
|
131
|
+
show_hidden?: undefined;
|
|
132
|
+
depth?: undefined;
|
|
133
|
+
pattern?: undefined;
|
|
134
|
+
file_glob?: undefined;
|
|
135
|
+
command?: undefined;
|
|
136
|
+
description?: undefined;
|
|
137
|
+
package?: undefined;
|
|
138
|
+
global?: undefined;
|
|
139
|
+
dev?: undefined;
|
|
140
|
+
};
|
|
141
|
+
required: string[];
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
} | {
|
|
145
|
+
type: string;
|
|
146
|
+
function: {
|
|
147
|
+
name: string;
|
|
148
|
+
description: string;
|
|
149
|
+
parameters: {
|
|
150
|
+
type: string;
|
|
151
|
+
properties: {
|
|
152
|
+
path: {
|
|
153
|
+
type: string;
|
|
154
|
+
description: string;
|
|
155
|
+
default: string;
|
|
156
|
+
};
|
|
157
|
+
show_hidden: {
|
|
158
|
+
type: string;
|
|
159
|
+
description: string;
|
|
160
|
+
default: boolean;
|
|
161
|
+
};
|
|
162
|
+
query?: undefined;
|
|
163
|
+
max_results?: undefined;
|
|
164
|
+
max_lines?: undefined;
|
|
165
|
+
content?: undefined;
|
|
166
|
+
search?: undefined;
|
|
167
|
+
replace?: undefined;
|
|
168
|
+
depth?: undefined;
|
|
169
|
+
pattern?: undefined;
|
|
170
|
+
file_glob?: undefined;
|
|
171
|
+
command?: undefined;
|
|
172
|
+
description?: undefined;
|
|
173
|
+
package?: undefined;
|
|
174
|
+
global?: undefined;
|
|
175
|
+
dev?: undefined;
|
|
176
|
+
};
|
|
177
|
+
required?: undefined;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
} | {
|
|
181
|
+
type: string;
|
|
182
|
+
function: {
|
|
183
|
+
name: string;
|
|
184
|
+
description: string;
|
|
185
|
+
parameters: {
|
|
186
|
+
type: string;
|
|
187
|
+
properties: {
|
|
188
|
+
path: {
|
|
189
|
+
type: string;
|
|
190
|
+
description: string;
|
|
191
|
+
default: string;
|
|
192
|
+
};
|
|
193
|
+
depth: {
|
|
194
|
+
type: string;
|
|
195
|
+
description: string;
|
|
196
|
+
default: number;
|
|
197
|
+
};
|
|
198
|
+
query?: undefined;
|
|
199
|
+
max_results?: undefined;
|
|
200
|
+
max_lines?: undefined;
|
|
201
|
+
content?: undefined;
|
|
202
|
+
search?: undefined;
|
|
203
|
+
replace?: undefined;
|
|
204
|
+
show_hidden?: undefined;
|
|
205
|
+
pattern?: undefined;
|
|
206
|
+
file_glob?: undefined;
|
|
207
|
+
command?: undefined;
|
|
208
|
+
description?: undefined;
|
|
209
|
+
package?: undefined;
|
|
210
|
+
global?: undefined;
|
|
211
|
+
dev?: undefined;
|
|
212
|
+
};
|
|
213
|
+
required?: undefined;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
} | {
|
|
217
|
+
type: string;
|
|
218
|
+
function: {
|
|
219
|
+
name: string;
|
|
220
|
+
description: string;
|
|
221
|
+
parameters: {
|
|
222
|
+
type: string;
|
|
223
|
+
properties: {
|
|
224
|
+
pattern: {
|
|
225
|
+
type: string;
|
|
226
|
+
description: string;
|
|
227
|
+
};
|
|
228
|
+
path: {
|
|
229
|
+
type: string;
|
|
230
|
+
description: string;
|
|
231
|
+
default: string;
|
|
232
|
+
};
|
|
233
|
+
file_glob: {
|
|
234
|
+
type: string;
|
|
235
|
+
description: string;
|
|
236
|
+
default: string;
|
|
237
|
+
};
|
|
238
|
+
query?: undefined;
|
|
239
|
+
max_results?: undefined;
|
|
240
|
+
max_lines?: undefined;
|
|
241
|
+
content?: undefined;
|
|
242
|
+
search?: undefined;
|
|
243
|
+
replace?: undefined;
|
|
244
|
+
show_hidden?: undefined;
|
|
245
|
+
depth?: undefined;
|
|
246
|
+
command?: undefined;
|
|
247
|
+
description?: undefined;
|
|
248
|
+
package?: undefined;
|
|
249
|
+
global?: undefined;
|
|
250
|
+
dev?: undefined;
|
|
251
|
+
};
|
|
252
|
+
required: string[];
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
} | {
|
|
256
|
+
type: string;
|
|
257
|
+
function: {
|
|
258
|
+
name: string;
|
|
259
|
+
description: string;
|
|
260
|
+
parameters: {
|
|
261
|
+
type: string;
|
|
262
|
+
properties: {
|
|
263
|
+
command: {
|
|
264
|
+
type: string;
|
|
265
|
+
description: string;
|
|
266
|
+
};
|
|
267
|
+
description: {
|
|
268
|
+
type: string;
|
|
269
|
+
description: string;
|
|
270
|
+
};
|
|
271
|
+
query?: undefined;
|
|
272
|
+
max_results?: undefined;
|
|
273
|
+
path?: undefined;
|
|
274
|
+
max_lines?: undefined;
|
|
275
|
+
content?: undefined;
|
|
276
|
+
search?: undefined;
|
|
277
|
+
replace?: undefined;
|
|
278
|
+
show_hidden?: undefined;
|
|
279
|
+
depth?: undefined;
|
|
280
|
+
pattern?: undefined;
|
|
281
|
+
file_glob?: undefined;
|
|
282
|
+
package?: undefined;
|
|
283
|
+
global?: undefined;
|
|
284
|
+
dev?: undefined;
|
|
285
|
+
};
|
|
286
|
+
required: string[];
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
} | {
|
|
290
|
+
type: string;
|
|
291
|
+
function: {
|
|
292
|
+
name: string;
|
|
293
|
+
description: string;
|
|
294
|
+
parameters: {
|
|
295
|
+
type: string;
|
|
296
|
+
properties: {
|
|
297
|
+
package: {
|
|
298
|
+
type: string;
|
|
299
|
+
description: string;
|
|
300
|
+
};
|
|
301
|
+
global: {
|
|
302
|
+
type: string;
|
|
303
|
+
description: string;
|
|
304
|
+
default: boolean;
|
|
305
|
+
};
|
|
306
|
+
dev: {
|
|
307
|
+
type: string;
|
|
308
|
+
description: string;
|
|
309
|
+
default: boolean;
|
|
310
|
+
};
|
|
311
|
+
query?: undefined;
|
|
312
|
+
max_results?: undefined;
|
|
313
|
+
path?: undefined;
|
|
314
|
+
max_lines?: undefined;
|
|
315
|
+
content?: undefined;
|
|
316
|
+
search?: undefined;
|
|
317
|
+
replace?: undefined;
|
|
318
|
+
show_hidden?: undefined;
|
|
319
|
+
depth?: undefined;
|
|
320
|
+
pattern?: undefined;
|
|
321
|
+
file_glob?: undefined;
|
|
322
|
+
command?: undefined;
|
|
323
|
+
description?: undefined;
|
|
324
|
+
};
|
|
325
|
+
required: string[];
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
})[];
|
|
329
|
+
export interface ToolCall {
|
|
330
|
+
id: string;
|
|
331
|
+
type: 'function';
|
|
332
|
+
function: {
|
|
333
|
+
name: string;
|
|
334
|
+
arguments: string;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
export interface ToolResult {
|
|
338
|
+
tool_call_id: string;
|
|
339
|
+
role: 'tool';
|
|
340
|
+
content: string;
|
|
341
|
+
}
|
|
342
|
+
export declare function executeTool(toolCall: ToolCall): Promise<ToolResult>;
|
|
343
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyI5B,CAAC;AAgCF,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CA8IzE"}
|