@polka-codes/core 0.1.6 → 0.1.8
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/index.js +8855 -5
- package/package.json +4 -1
- package/dist/Agent/AgentBase.d.ts +0 -49
- package/dist/Agent/AgentBase.js +0 -158
- package/dist/Agent/AgentBase.js.map +0 -1
- package/dist/Agent/CoderAgent/index.d.ts +0 -17
- package/dist/Agent/CoderAgent/index.js +0 -32
- package/dist/Agent/CoderAgent/index.js.map +0 -1
- package/dist/Agent/CoderAgent/prompts.d.ts +0 -20
- package/dist/Agent/CoderAgent/prompts.js +0 -165
- package/dist/Agent/CoderAgent/prompts.js.map +0 -1
- package/dist/Agent/index.d.ts +0 -2
- package/dist/Agent/index.js +0 -3
- package/dist/Agent/index.js.map +0 -1
- package/dist/Agent/parseAssistantMessage.d.ts +0 -45
- package/dist/Agent/parseAssistantMessage.js +0 -103
- package/dist/Agent/parseAssistantMessage.js.map +0 -1
- package/dist/Agent/prompts.d.ts +0 -7
- package/dist/Agent/prompts.js +0 -93
- package/dist/Agent/prompts.js.map +0 -1
- package/dist/AiService/AiServiceBase.d.ts +0 -29
- package/dist/AiService/AiServiceBase.js +0 -3
- package/dist/AiService/AiServiceBase.js.map +0 -1
- package/dist/AiService/AnthropicService.d.ts +0 -11
- package/dist/AiService/AnthropicService.js +0 -185
- package/dist/AiService/AnthropicService.js.map +0 -1
- package/dist/AiService/DeepSeekService.d.ts +0 -11
- package/dist/AiService/DeepSeekService.js +0 -64
- package/dist/AiService/DeepSeekService.js.map +0 -1
- package/dist/AiService/ModelInfo.d.ts +0 -79
- package/dist/AiService/ModelInfo.js +0 -67
- package/dist/AiService/ModelInfo.js.map +0 -1
- package/dist/AiService/OllamaService.d.ts +0 -11
- package/dist/AiService/OllamaService.js +0 -47
- package/dist/AiService/OllamaService.js.map +0 -1
- package/dist/AiService/index.d.ts +0 -12
- package/dist/AiService/index.js +0 -20
- package/dist/AiService/index.js.map +0 -1
- package/dist/AiService/utils.d.ts +0 -4
- package/dist/AiService/utils.js +0 -187
- package/dist/AiService/utils.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -5
- package/dist/logger.js +0 -25
- package/dist/logger.js.map +0 -1
- package/dist/tools/index.d.ts +0 -3
- package/dist/tools/index.js +0 -4
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/tools.d.ts +0 -200
- package/dist/tools/tools.js +0 -329
- package/dist/tools/tools.js.map +0 -1
- package/dist/tools/types.d.ts +0 -49
- package/dist/tools/types.js +0 -9
- package/dist/tools/types.js.map +0 -1
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// source: https://github.com/cline/cline/blob/f6c19c29a64ca84e9360df7ab2c07d128dcebe64/src/api/providers/ollama.ts
|
|
2
|
-
import OpenAI from "openai";
|
|
3
|
-
import { createServiceLogger } from "../logger.js";
|
|
4
|
-
import { AiServiceBase } from "./AiServiceBase.js";
|
|
5
|
-
import { openAiModelInfoSaneDefaults } from "./ModelInfo.js";
|
|
6
|
-
import { convertToOpenAiMessages } from "./utils.js";
|
|
7
|
-
const logger = createServiceLogger("OllamaService");
|
|
8
|
-
export class OllamaService extends AiServiceBase {
|
|
9
|
-
#client;
|
|
10
|
-
model;
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
this.#client = new OpenAI({
|
|
14
|
-
baseURL: `${options.baseUrl || "http://localhost:11434"}/v1`,
|
|
15
|
-
apiKey: "ollama",
|
|
16
|
-
});
|
|
17
|
-
this.model = {
|
|
18
|
-
id: options.modelId || "",
|
|
19
|
-
info: openAiModelInfoSaneDefaults,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
async *send(systemPrompt, messages) {
|
|
23
|
-
logger.debug({ modelId: this.model.id, messagesCount: messages.length }, "Starting message stream");
|
|
24
|
-
const openAiMessages = [
|
|
25
|
-
{ role: "system", content: systemPrompt },
|
|
26
|
-
...convertToOpenAiMessages(messages),
|
|
27
|
-
];
|
|
28
|
-
logger.trace({ modelId: this.model.id, messagesCount: messages.length }, "Sending messages to Ollama");
|
|
29
|
-
const stream = await this.#client.chat.completions.create({
|
|
30
|
-
model: this.model.id,
|
|
31
|
-
messages: openAiMessages,
|
|
32
|
-
temperature: 0,
|
|
33
|
-
stream: true,
|
|
34
|
-
});
|
|
35
|
-
for await (const chunk of stream) {
|
|
36
|
-
const delta = chunk.choices[0]?.delta;
|
|
37
|
-
if (delta?.content) {
|
|
38
|
-
yield {
|
|
39
|
-
type: "text",
|
|
40
|
-
text: delta.content,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
logger.debug("Stream ended");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=OllamaService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OllamaService.js","sourceRoot":"","sources":["../../src/AiService/OllamaService.ts"],"names":[],"mappings":"AAAA,mHAAmH;AAEnH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,aAAa,EAA4D,MAAM,iBAAiB,CAAA;AACzG,OAAO,EAAkB,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEjD,MAAM,MAAM,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAA;AAEnD,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAQ;IAEN,KAAK,CAAiC;IAE/C,YAAY,OAAyB;QACnC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC;YACxB,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,wBAAwB,KAAK;YAC5D,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;QAEF,IAA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import type { AiServiceBase, AiServiceOptions, MessageParam } from "./AiServiceBase.js";
|
|
2
|
-
import { AnthropicService } from "./AnthropicService.js";
|
|
3
|
-
import { DeepSeekService } from "./DeepSeekService.js";
|
|
4
|
-
import type { ModelInfo } from "./ModelInfo.js";
|
|
5
|
-
import { OllamaService } from "./OllamaService.js";
|
|
6
|
-
export declare enum AiServiceProvider {
|
|
7
|
-
Anthropic = "anthropic",
|
|
8
|
-
Ollama = "ollama",
|
|
9
|
-
DeepSeek = "deepseek"
|
|
10
|
-
}
|
|
11
|
-
export declare const createService: (provider: AiServiceProvider, options: AiServiceOptions) => AnthropicService | DeepSeekService | OllamaService;
|
|
12
|
-
export type { MessageParam, AiServiceOptions, AiServiceBase, ModelInfo };
|
package/dist/AiService/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AnthropicService } from "./AnthropicService.js";
|
|
2
|
-
import { DeepSeekService } from "./DeepSeekService.js";
|
|
3
|
-
import { OllamaService } from "./OllamaService.js";
|
|
4
|
-
export var AiServiceProvider;
|
|
5
|
-
(function (AiServiceProvider) {
|
|
6
|
-
AiServiceProvider["Anthropic"] = "anthropic";
|
|
7
|
-
AiServiceProvider["Ollama"] = "ollama";
|
|
8
|
-
AiServiceProvider["DeepSeek"] = "deepseek";
|
|
9
|
-
})(AiServiceProvider || (AiServiceProvider = {}));
|
|
10
|
-
export const createService = (provider, options) => {
|
|
11
|
-
switch (provider) {
|
|
12
|
-
case AiServiceProvider.Anthropic:
|
|
13
|
-
return new AnthropicService(options);
|
|
14
|
-
case AiServiceProvider.Ollama:
|
|
15
|
-
return new OllamaService(options);
|
|
16
|
-
case AiServiceProvider.DeepSeek:
|
|
17
|
-
return new DeepSeekService(options);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AiService/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,4CAAuB,CAAA;IACvB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;AACvB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA2B,EAAE,OAAyB,EAAE,EAAE;IACtF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,iBAAiB,CAAC,SAAS;YAC9B,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAA;QACtC,KAAK,iBAAiB,CAAC,MAAM;YAC3B,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;QACnC,KAAK,iBAAiB,CAAC,QAAQ;YAC7B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;IACvC,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Anthropic } from '@anthropic-ai/sdk';
|
|
2
|
-
import type OpenAI from 'openai';
|
|
3
|
-
export declare function convertToOpenAiMessages(anthropicMessages: Anthropic.Messages.MessageParam[]): OpenAI.Chat.ChatCompletionMessageParam[];
|
|
4
|
-
export declare function convertToAnthropicMessage(completion: OpenAI.Chat.Completions.ChatCompletion): Anthropic.Messages.Message;
|
package/dist/AiService/utils.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
// source: https://github.com/cline/cline/blob/f6c19c29a64ca84e9360df7ab2c07d128dcebe64/src/api/transform/openai-format.ts
|
|
2
|
-
import { createServiceLogger } from "../logger.js";
|
|
3
|
-
const logger = createServiceLogger("utils");
|
|
4
|
-
export function convertToOpenAiMessages(anthropicMessages) {
|
|
5
|
-
const openAiMessages = [];
|
|
6
|
-
for (const anthropicMessage of anthropicMessages) {
|
|
7
|
-
if (typeof anthropicMessage.content === "string") {
|
|
8
|
-
openAiMessages.push({
|
|
9
|
-
role: anthropicMessage.role,
|
|
10
|
-
content: anthropicMessage.content,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// image_url.url is base64 encoded image data
|
|
15
|
-
// ensure it contains the content-type of the image: data:image/png;base64,
|
|
16
|
-
/*
|
|
17
|
-
{ role: "user", content: "" | { type: "text", text: string } | { type: "image_url", image_url: { url: string } } },
|
|
18
|
-
// content required unless tool_calls is present
|
|
19
|
-
{ role: "assistant", content?: "" | null, tool_calls?: [{ id: "", function: { name: "", arguments: "" }, type: "function" }] },
|
|
20
|
-
{ role: "tool", tool_call_id: "", content: ""}
|
|
21
|
-
*/
|
|
22
|
-
if (anthropicMessage.role === "user") {
|
|
23
|
-
const { nonToolMessages, toolMessages } = anthropicMessage.content.reduce((acc, part) => {
|
|
24
|
-
if (part.type === "tool_result") {
|
|
25
|
-
acc.toolMessages.push(part);
|
|
26
|
-
}
|
|
27
|
-
else if (part.type === "text" || part.type === "image") {
|
|
28
|
-
acc.nonToolMessages.push(part);
|
|
29
|
-
} // user cannot send tool_use messages
|
|
30
|
-
return acc;
|
|
31
|
-
}, { nonToolMessages: [], toolMessages: [] });
|
|
32
|
-
// Process tool result messages FIRST since they must follow the tool use messages
|
|
33
|
-
const toolResultImages = [];
|
|
34
|
-
for (const toolMessage of toolMessages) {
|
|
35
|
-
// The Anthropic SDK allows tool results to be a string or an array of text and image blocks, enabling rich and structured content. In contrast, the OpenAI SDK only supports tool results as a single string, so we map the Anthropic tool result parts into one concatenated string to maintain compatibility.
|
|
36
|
-
let content;
|
|
37
|
-
if (typeof toolMessage.content === "string") {
|
|
38
|
-
content = toolMessage.content;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
content =
|
|
42
|
-
toolMessage.content
|
|
43
|
-
?.map((part) => {
|
|
44
|
-
if (part.type === "image") {
|
|
45
|
-
toolResultImages.push(part);
|
|
46
|
-
return "(see following user message for image)";
|
|
47
|
-
}
|
|
48
|
-
return part.text;
|
|
49
|
-
})
|
|
50
|
-
.join("\n") ?? "";
|
|
51
|
-
}
|
|
52
|
-
openAiMessages.push({
|
|
53
|
-
role: "tool",
|
|
54
|
-
tool_call_id: toolMessage.tool_use_id,
|
|
55
|
-
content: content,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
// If tool results contain images, send as a separate user message
|
|
59
|
-
// I ran into an issue where if I gave feedback for one of many tool uses, the request would fail.
|
|
60
|
-
// "Messages following `tool_use` blocks must begin with a matching number of `tool_result` blocks."
|
|
61
|
-
// Therefore we need to send these images after the tool result messages
|
|
62
|
-
// NOTE: it's actually okay to have multiple user messages in a row, the model will treat them as a continuation of the same input (this way works better than combining them into one message, since the tool result specifically mentions (see following user message for image)
|
|
63
|
-
// UPDATE v2.0: we don't use tools anymore, but if we did it's important to note that the openrouter prompt caching mechanism requires one user message at a time, so we would need to add these images to the user content array instead.
|
|
64
|
-
// if (toolResultImages.length > 0) {
|
|
65
|
-
// openAiMessages.push({
|
|
66
|
-
// role: "user",
|
|
67
|
-
// content: toolResultImages.map((part) => ({
|
|
68
|
-
// type: "image_url",
|
|
69
|
-
// image_url: { url: `data:${part.source.media_type};base64,${part.source.data}` },
|
|
70
|
-
// })),
|
|
71
|
-
// })
|
|
72
|
-
// }
|
|
73
|
-
// Process non-tool messages
|
|
74
|
-
if (nonToolMessages.length > 0) {
|
|
75
|
-
openAiMessages.push({
|
|
76
|
-
role: "user",
|
|
77
|
-
content: nonToolMessages.map((part) => {
|
|
78
|
-
if (part.type === "image") {
|
|
79
|
-
return {
|
|
80
|
-
type: "image_url",
|
|
81
|
-
image_url: {
|
|
82
|
-
url: `data:${part.source.media_type};base64,${part.source.data}`,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return { type: "text", text: part.text };
|
|
87
|
-
}),
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else if (anthropicMessage.role === "assistant") {
|
|
92
|
-
const { nonToolMessages, toolMessages } = anthropicMessage.content.reduce((acc, part) => {
|
|
93
|
-
if (part.type === "tool_use") {
|
|
94
|
-
acc.toolMessages.push(part);
|
|
95
|
-
}
|
|
96
|
-
else if (part.type === "text" || part.type === "image") {
|
|
97
|
-
acc.nonToolMessages.push(part);
|
|
98
|
-
} // assistant cannot send tool_result messages
|
|
99
|
-
return acc;
|
|
100
|
-
}, { nonToolMessages: [], toolMessages: [] });
|
|
101
|
-
// Process non-tool messages
|
|
102
|
-
let content;
|
|
103
|
-
if (nonToolMessages.length > 0) {
|
|
104
|
-
content = nonToolMessages
|
|
105
|
-
.map((part) => {
|
|
106
|
-
if (part.type === "image") {
|
|
107
|
-
return ""; // impossible as the assistant cannot send images
|
|
108
|
-
}
|
|
109
|
-
return part.text;
|
|
110
|
-
})
|
|
111
|
-
.join("\n");
|
|
112
|
-
}
|
|
113
|
-
// Process tool use messages
|
|
114
|
-
const tool_calls = toolMessages.map((toolMessage) => ({
|
|
115
|
-
id: toolMessage.id,
|
|
116
|
-
type: "function",
|
|
117
|
-
function: {
|
|
118
|
-
name: toolMessage.name,
|
|
119
|
-
// json string
|
|
120
|
-
arguments: JSON.stringify(toolMessage.input),
|
|
121
|
-
},
|
|
122
|
-
}));
|
|
123
|
-
openAiMessages.push({
|
|
124
|
-
role: "assistant",
|
|
125
|
-
content,
|
|
126
|
-
// Cannot be an empty array. API expects an array with minimum length 1, and will respond with an error if it's empty
|
|
127
|
-
tool_calls: tool_calls.length > 0 ? tool_calls : undefined,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return openAiMessages;
|
|
133
|
-
}
|
|
134
|
-
// Convert OpenAI response to Anthropic format
|
|
135
|
-
export function convertToAnthropicMessage(completion) {
|
|
136
|
-
const openAiMessage = completion.choices[0].message;
|
|
137
|
-
const anthropicMessage = {
|
|
138
|
-
id: completion.id,
|
|
139
|
-
type: "message",
|
|
140
|
-
role: openAiMessage.role, // always "assistant"
|
|
141
|
-
content: [
|
|
142
|
-
{
|
|
143
|
-
type: "text",
|
|
144
|
-
text: openAiMessage.content || "",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
model: completion.model,
|
|
148
|
-
stop_reason: (() => {
|
|
149
|
-
switch (completion.choices[0].finish_reason) {
|
|
150
|
-
case "stop":
|
|
151
|
-
return "end_turn";
|
|
152
|
-
case "length":
|
|
153
|
-
return "max_tokens";
|
|
154
|
-
case "tool_calls":
|
|
155
|
-
return "tool_use";
|
|
156
|
-
default:
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
})(),
|
|
160
|
-
stop_sequence: null, // which custom stop_sequence was generated, if any (not applicable if you don't use stop_sequence)
|
|
161
|
-
usage: {
|
|
162
|
-
input_tokens: completion.usage?.prompt_tokens || 0,
|
|
163
|
-
output_tokens: completion.usage?.completion_tokens || 0,
|
|
164
|
-
cache_creation_input_tokens: null,
|
|
165
|
-
cache_read_input_tokens: null,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
if (openAiMessage.tool_calls && openAiMessage.tool_calls.length > 0) {
|
|
169
|
-
anthropicMessage.content.push(...openAiMessage.tool_calls.map((toolCall) => {
|
|
170
|
-
let parsedInput = {};
|
|
171
|
-
try {
|
|
172
|
-
parsedInput = JSON.parse(toolCall.function.arguments || "{}");
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
logger.warn("Failed to parse tool arguments:", error);
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
type: "tool_use",
|
|
179
|
-
id: toolCall.id,
|
|
180
|
-
name: toolCall.function.name,
|
|
181
|
-
input: parsedInput,
|
|
182
|
-
};
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
185
|
-
return anthropicMessage;
|
|
186
|
-
}
|
|
187
|
-
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DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import pino from 'pino';
|
|
2
|
-
export declare const getLogger: () => pino.Logger<never, boolean>;
|
|
3
|
-
export declare const setLogger: (newLogger: pino.Logger) => void;
|
|
4
|
-
export declare const createServiceLogger: (service: string) => pino.Logger<never, boolean>;
|
|
5
|
-
export type Logger = pino.Logger;
|
package/dist/logger.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import pino from 'pino';
|
|
2
|
-
let logger = undefined;
|
|
3
|
-
export const getLogger = () => {
|
|
4
|
-
if (!logger) {
|
|
5
|
-
logger = pino({
|
|
6
|
-
level: process.env.LOG_LEVEL || 'info',
|
|
7
|
-
redact: ['apiKey'],
|
|
8
|
-
transport: {
|
|
9
|
-
target: 'pino-pretty',
|
|
10
|
-
options: {
|
|
11
|
-
colorize: true,
|
|
12
|
-
translateTime: 'SYS:standard',
|
|
13
|
-
ignore: 'pid,hostname',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return logger;
|
|
19
|
-
};
|
|
20
|
-
export const setLogger = (newLogger) => {
|
|
21
|
-
logger = newLogger;
|
|
22
|
-
};
|
|
23
|
-
// Create namespaced loggers for different services
|
|
24
|
-
export const createServiceLogger = (service) => getLogger().child({ service });
|
|
25
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,IAAI,MAAM,GAA4B,SAAS,CAAA;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,IAAI,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;YACtC,MAAM,EAAE,CAAC,QAAQ,CAAC;YAClB,SAAS,EAAE;gBACT,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE;oBACP,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,cAAc;oBAC7B,MAAM,EAAE,cAAc;iBACvB;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,SAAsB,EAAE,EAAE;IAClD,MAAM,GAAG,SAAS,CAAA;AACpB,CAAC,CAAA;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA"}
|
package/dist/tools/index.d.ts
DELETED
package/dist/tools/index.js
DELETED
package/dist/tools/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AAEvB,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAA"}
|
package/dist/tools/tools.d.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
export declare const executeCommand: {
|
|
2
|
-
readonly name: "execute_command";
|
|
3
|
-
readonly description: "Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory.";
|
|
4
|
-
readonly parameters: [{
|
|
5
|
-
readonly name: "command";
|
|
6
|
-
readonly description: "The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions.";
|
|
7
|
-
readonly required: true;
|
|
8
|
-
readonly usageValue: "Your command here";
|
|
9
|
-
}, {
|
|
10
|
-
readonly name: "requires_approval";
|
|
11
|
-
readonly description: "A boolean indicating whether this command requires explicit user approval before execution in case the user has auto-approve mode enabled. Set to 'true' for potentially impactful operations like installing/uninstalling packages, deleting/overwriting files, system configuration changes, network operations, or any commands that could have unintended side effects. Set to 'false' for safe operations like reading files/directories, running development servers, building projects, and other non-destructive operations.";
|
|
12
|
-
readonly required: false;
|
|
13
|
-
readonly usageValue: "true or false";
|
|
14
|
-
}];
|
|
15
|
-
readonly examples: [{
|
|
16
|
-
readonly description: "Request to execute a command";
|
|
17
|
-
readonly parameters: [{
|
|
18
|
-
readonly name: "command";
|
|
19
|
-
readonly value: "npm run dev";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "requires_approval";
|
|
22
|
-
readonly value: "false";
|
|
23
|
-
}];
|
|
24
|
-
}];
|
|
25
|
-
};
|
|
26
|
-
export declare const readFile: {
|
|
27
|
-
readonly name: "read_file";
|
|
28
|
-
readonly description: "Request to read the contents of one or multiple files at the specified paths. Use comma separated paths to read multiple files. Use this when you need to examine the contents of an existing file you do not know the contents of, for example to analyze code, review text files, or extract information from configuration files. May not be suitable for other types of binary files, as it returns the raw content as a string.";
|
|
29
|
-
readonly parameters: [{
|
|
30
|
-
readonly name: "path";
|
|
31
|
-
readonly description: "The path of the file to read";
|
|
32
|
-
readonly required: true;
|
|
33
|
-
readonly usageValue: "Comma separated paths here";
|
|
34
|
-
}];
|
|
35
|
-
readonly examples: [{
|
|
36
|
-
readonly description: "Request to read the contents of a file";
|
|
37
|
-
readonly parameters: [{
|
|
38
|
-
readonly name: "path";
|
|
39
|
-
readonly value: "src/main.js";
|
|
40
|
-
}];
|
|
41
|
-
}, {
|
|
42
|
-
readonly description: "Request to read multiple files";
|
|
43
|
-
readonly parameters: [{
|
|
44
|
-
readonly name: "path";
|
|
45
|
-
readonly value: "src/main.js,src/index.js";
|
|
46
|
-
}];
|
|
47
|
-
}];
|
|
48
|
-
};
|
|
49
|
-
export declare const writeToFile: {
|
|
50
|
-
readonly name: "write_to_file";
|
|
51
|
-
readonly description: "Request to write content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.";
|
|
52
|
-
readonly parameters: [{
|
|
53
|
-
readonly name: "path";
|
|
54
|
-
readonly description: "The path of the file to write to";
|
|
55
|
-
readonly required: true;
|
|
56
|
-
readonly usageValue: "File path here";
|
|
57
|
-
}, {
|
|
58
|
-
readonly name: "content";
|
|
59
|
-
readonly description: "The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified.";
|
|
60
|
-
readonly required: true;
|
|
61
|
-
readonly usageValue: "Your file content here";
|
|
62
|
-
}];
|
|
63
|
-
readonly examples: [{
|
|
64
|
-
readonly description: "Request to write content to a file";
|
|
65
|
-
readonly parameters: [{
|
|
66
|
-
readonly name: "path";
|
|
67
|
-
readonly value: "src/main.js";
|
|
68
|
-
}, {
|
|
69
|
-
readonly name: "content";
|
|
70
|
-
readonly value: "import React from 'react';\n\nfunction App() {\n return (\n <div>\n <h1>Hello, World!</h1>\n </div>\n );\n}\n\nexport default App;\n";
|
|
71
|
-
}];
|
|
72
|
-
}];
|
|
73
|
-
};
|
|
74
|
-
export declare const replaceInFile: {
|
|
75
|
-
readonly name: "replace_in_file";
|
|
76
|
-
readonly description: "Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.";
|
|
77
|
-
readonly parameters: [{
|
|
78
|
-
readonly name: "path";
|
|
79
|
-
readonly description: "The path of the file to modify";
|
|
80
|
-
readonly required: true;
|
|
81
|
-
readonly usageValue: "File path here";
|
|
82
|
-
}, {
|
|
83
|
-
readonly name: "diff";
|
|
84
|
-
readonly description: "One or more SEARCH/REPLACE blocks following this exact format:\n ```\n <<<<<<< SEARCH\n [exact content to find]\n =======\n [new content to replace with]\n >>>>>>> REPLACE\n ```\n Critical rules:\n 1. SEARCH content must match the associated file section to find EXACTLY:\n * Match character-for-character including whitespace, indentation, line endings\n * Include all comments, docstrings, etc.\n 2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence.\n * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes.\n * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change.\n * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file.\n 3. Keep SEARCH/REPLACE blocks concise:\n * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file.\n * Include just the changing lines, and a few surrounding lines if needed for uniqueness.\n * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks.\n * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures.\n 4. Special operations:\n * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location)\n * To delete code: Use empty REPLACE section";
|
|
85
|
-
readonly required: true;
|
|
86
|
-
readonly usageValue: "Search and replace blocks here";
|
|
87
|
-
}];
|
|
88
|
-
readonly examples: [{
|
|
89
|
-
readonly description: "Request to replace sections of content in a file";
|
|
90
|
-
readonly parameters: [{
|
|
91
|
-
readonly name: "path";
|
|
92
|
-
readonly value: "src/main.js";
|
|
93
|
-
}, {
|
|
94
|
-
readonly name: "diff";
|
|
95
|
-
readonly value: "\n<<<<<<< SEARCH\nimport React from 'react';\n=======\nimport React, { useState } from 'react';\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\n=======\n>>>>>>> REPLACE\n\n<<<<<<< SEARCH\nreturn (\n <div>\n=======\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\nreturn (\n <div>\n>>>>>>> REPLACE\n";
|
|
96
|
-
}];
|
|
97
|
-
}];
|
|
98
|
-
};
|
|
99
|
-
export declare const searchFiles: {
|
|
100
|
-
readonly name: "search_files";
|
|
101
|
-
readonly description: "Request to perform a regex search across files in a specified directory, outputting context-rich results that include surrounding lines. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.";
|
|
102
|
-
readonly parameters: [{
|
|
103
|
-
readonly name: "path";
|
|
104
|
-
readonly description: "The path of the directory to search in (relative to the current working directory). This directory will be recursively searched.";
|
|
105
|
-
readonly required: true;
|
|
106
|
-
readonly usageValue: "Directory path here";
|
|
107
|
-
}, {
|
|
108
|
-
readonly name: "regex";
|
|
109
|
-
readonly description: "The regular expression pattern to search for. Uses Rust regex syntax.";
|
|
110
|
-
readonly required: true;
|
|
111
|
-
readonly usageValue: "Your regex pattern here";
|
|
112
|
-
}, {
|
|
113
|
-
readonly name: "file_pattern";
|
|
114
|
-
readonly description: "Glob pattern to filter files (e.g., \"*.ts\" for TypeScript files). If not provided, it will search all files (*).";
|
|
115
|
-
readonly required: false;
|
|
116
|
-
readonly usageValue: "file pattern here (optional)";
|
|
117
|
-
}];
|
|
118
|
-
readonly examples: [{
|
|
119
|
-
readonly description: "Request to perform a regex search across files";
|
|
120
|
-
readonly parameters: [{
|
|
121
|
-
readonly name: "path";
|
|
122
|
-
readonly value: "src";
|
|
123
|
-
}, {
|
|
124
|
-
readonly name: "regex";
|
|
125
|
-
readonly value: "^src/components/";
|
|
126
|
-
}, {
|
|
127
|
-
readonly name: "file_pattern";
|
|
128
|
-
readonly value: "*.ts";
|
|
129
|
-
}];
|
|
130
|
-
}];
|
|
131
|
-
};
|
|
132
|
-
export declare const listFiles: {
|
|
133
|
-
readonly name: "list_files";
|
|
134
|
-
readonly description: "Request to list files and directories within the specified directory. If recursive is true, it will list all files and directories recursively. If recursive is false or not provided, it will only list the top-level contents. Do not use this tool to confirm the existence of files you may have created, as the user will let you know if the files were created successfully or not.";
|
|
135
|
-
readonly parameters: [{
|
|
136
|
-
readonly name: "path";
|
|
137
|
-
readonly description: "The path of the directory to list contents for (relative to the current working directory)";
|
|
138
|
-
readonly required: true;
|
|
139
|
-
readonly usageValue: "Directory path here";
|
|
140
|
-
}, {
|
|
141
|
-
readonly name: "depth";
|
|
142
|
-
readonly description: "The depth of the directory to list contents for. Use 0 for the top-level directory only, 1 for the top-level directory and its children, and so on.";
|
|
143
|
-
readonly required: false;
|
|
144
|
-
readonly usageValue: "a number (optional)";
|
|
145
|
-
}];
|
|
146
|
-
readonly examples: [{
|
|
147
|
-
readonly description: "Request to list files";
|
|
148
|
-
readonly parameters: [{
|
|
149
|
-
readonly name: "path";
|
|
150
|
-
readonly value: "src";
|
|
151
|
-
}, {
|
|
152
|
-
readonly name: "recursive";
|
|
153
|
-
readonly value: "true";
|
|
154
|
-
}];
|
|
155
|
-
}];
|
|
156
|
-
};
|
|
157
|
-
export declare const listCodeDefinitionNames: {
|
|
158
|
-
readonly name: "list_code_definition_names";
|
|
159
|
-
readonly description: "Request to list definition names (classes, functions, methods, etc.) used in source code files at the top level of the specified directory. This tool provides insights into the codebase structure and important constructs, encapsulating high-level concepts and relationships that are crucial for understanding the overall architecture.";
|
|
160
|
-
readonly parameters: [{
|
|
161
|
-
readonly name: "path";
|
|
162
|
-
readonly description: "The path of the directory (relative to the current working directory ${cwd.toPosix()}) to list top level source code definitions for.";
|
|
163
|
-
readonly required: true;
|
|
164
|
-
readonly usageValue: "Directory path here";
|
|
165
|
-
}];
|
|
166
|
-
};
|
|
167
|
-
export declare const askFollowupQuestion: {
|
|
168
|
-
readonly name: "ask_followup_question";
|
|
169
|
-
readonly description: "Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth.";
|
|
170
|
-
readonly parameters: [{
|
|
171
|
-
readonly name: "question";
|
|
172
|
-
readonly description: "The question to ask the user. This should be a clear, specific question that addresses the information you need.";
|
|
173
|
-
readonly required: true;
|
|
174
|
-
readonly usageValue: "Your question here";
|
|
175
|
-
}];
|
|
176
|
-
readonly examples: [{
|
|
177
|
-
readonly description: "Request to ask a question";
|
|
178
|
-
readonly parameters: [{
|
|
179
|
-
readonly name: "question";
|
|
180
|
-
readonly value: "What is the name of the project?";
|
|
181
|
-
}];
|
|
182
|
-
}];
|
|
183
|
-
};
|
|
184
|
-
export declare const attemptCompletion: {
|
|
185
|
-
readonly name: "attempt_completion";
|
|
186
|
-
readonly description: "After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user.";
|
|
187
|
-
readonly parameters: [{
|
|
188
|
-
readonly name: "result";
|
|
189
|
-
readonly description: "The result of the task. Formulate this result in a way that is final and does not require further input from the user. Don't end your result with questions or offers for further assistance.";
|
|
190
|
-
readonly required: true;
|
|
191
|
-
readonly usageValue: "Your final result description here";
|
|
192
|
-
}];
|
|
193
|
-
readonly examples: [{
|
|
194
|
-
readonly description: "Request to present the result of the task";
|
|
195
|
-
readonly parameters: [{
|
|
196
|
-
readonly name: "result";
|
|
197
|
-
readonly value: "Your final result description here";
|
|
198
|
-
}];
|
|
199
|
-
}];
|
|
200
|
-
};
|