pulse-coder-engine 0.0.1-alpha.1 → 0.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-in/index.cjs +1291 -0
- package/dist/built-in/index.cjs.map +1 -0
- package/dist/built-in/index.d.cts +3 -0
- package/dist/built-in/index.d.ts +3 -0
- package/dist/built-in/index.js +1250 -0
- package/dist/built-in/index.js.map +1 -0
- package/dist/index-DDqISE31.d.cts +120 -0
- package/dist/index-DDqISE31.d.ts +120 -0
- package/dist/index.cjs +1826 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +484 -0
- package/dist/index.d.ts +484 -0
- package/dist/index.js +1769 -0
- package/dist/index.js.map +1 -0
- package/package.json +13 -5
- package/examples/new-engine-usage.ts +0 -52
- package/src/Engine.ts +0 -150
- package/src/ai/index.ts +0 -116
- package/src/built-in/index.ts +0 -27
- package/src/built-in/mcp-plugin/index.ts +0 -104
- package/src/built-in/skills-plugin/index.ts +0 -223
- package/src/built-in/sub-agent-plugin/index.ts +0 -203
- package/src/config/index.ts +0 -35
- package/src/context/index.ts +0 -134
- package/src/core/loop.ts +0 -147
- package/src/index.ts +0 -17
- package/src/plugin/EnginePlugin.ts +0 -60
- package/src/plugin/PluginManager.ts +0 -426
- package/src/plugin/UserConfigPlugin.ts +0 -183
- package/src/prompt/index.ts +0 -1
- package/src/prompt/system.ts +0 -126
- package/src/shared/types.ts +0 -50
- package/src/tools/bash.ts +0 -59
- package/src/tools/clarify.ts +0 -74
- package/src/tools/edit.ts +0 -79
- package/src/tools/grep.ts +0 -148
- package/src/tools/index.ts +0 -44
- package/src/tools/ls.ts +0 -20
- package/src/tools/read.ts +0 -69
- package/src/tools/tavily.ts +0 -55
- package/src/tools/utils.ts +0 -16
- package/src/tools/write.ts +0 -42
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -11
package/src/tools/tavily.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import type { Tool } from "../shared/types";
|
|
3
|
-
import { truncateOutput } from "./utils";
|
|
4
|
-
|
|
5
|
-
export const TavilyTool: Tool<
|
|
6
|
-
{ query: string; maxResults?: number },
|
|
7
|
-
{ results: Array<{ title: string; url: string; content: string; score?: number }> }
|
|
8
|
-
> = {
|
|
9
|
-
name: 'tavily',
|
|
10
|
-
description: 'Search the web using Tavily API',
|
|
11
|
-
inputSchema: z.object({
|
|
12
|
-
query: z.string().describe('The search query'),
|
|
13
|
-
maxResults: z.number().optional().default(5).describe('Maximum number of results to return'),
|
|
14
|
-
}),
|
|
15
|
-
execute: async ({ query, maxResults = 5 }) => {
|
|
16
|
-
const apiKey = process.env.TAVILY_API_KEY;
|
|
17
|
-
|
|
18
|
-
if (!apiKey) {
|
|
19
|
-
throw new Error('TAVILY_API_KEY environment variable is not set');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const response = await fetch('https://api.tavily.com/search', {
|
|
23
|
-
method: 'POST',
|
|
24
|
-
headers: {
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
},
|
|
27
|
-
body: JSON.stringify({
|
|
28
|
-
api_key: apiKey,
|
|
29
|
-
query,
|
|
30
|
-
max_results: maxResults,
|
|
31
|
-
search_depth: 'basic',
|
|
32
|
-
include_answer: false,
|
|
33
|
-
include_raw_content: false,
|
|
34
|
-
include_images: false,
|
|
35
|
-
}),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
if (!response.ok) {
|
|
39
|
-
throw new Error(`Tavily API error: ${response.status} ${response.statusText}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const data = await response.json();
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
results: data.results?.map((result: any) => ({
|
|
46
|
-
title: result.title || '',
|
|
47
|
-
url: result.url || '',
|
|
48
|
-
content: truncateOutput(result.content || ''),
|
|
49
|
-
score: result.score || 0,
|
|
50
|
-
})) || [],
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default TavilyTool;
|
package/src/tools/utils.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MAX_TOOL_OUTPUT_LENGTH } from "../config";
|
|
2
|
-
|
|
3
|
-
export const truncateOutput = (output: string): string => {
|
|
4
|
-
if (output.length <= MAX_TOOL_OUTPUT_LENGTH) {
|
|
5
|
-
return output;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const half = Math.floor(MAX_TOOL_OUTPUT_LENGTH / 2);
|
|
9
|
-
const removed = output.length - MAX_TOOL_OUTPUT_LENGTH;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
output.slice(0, half) +
|
|
13
|
-
`\n\n... [truncated ${removed} characters] ...\n\n` +
|
|
14
|
-
output.slice(-half)
|
|
15
|
-
);
|
|
16
|
-
};
|
package/src/tools/write.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { writeFileSync, mkdirSync, existsSync } from "fs";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
import type { Tool } from "../shared/types";
|
|
5
|
-
|
|
6
|
-
export const WriteTool: Tool<
|
|
7
|
-
{ filePath: string; content: string },
|
|
8
|
-
{ success: boolean; created: boolean; bytes: number }
|
|
9
|
-
> = {
|
|
10
|
-
name: 'write',
|
|
11
|
-
description: 'Write contents to a file. Automatically creates parent directories if they do not exist. Will overwrite existing files.',
|
|
12
|
-
inputSchema: z.object({
|
|
13
|
-
filePath: z.string().describe('The absolute path to the file to write (must be absolute, not relative)'),
|
|
14
|
-
content: z.string().describe('The content to write to the file'),
|
|
15
|
-
}),
|
|
16
|
-
execute: async ({ filePath, content }) => {
|
|
17
|
-
// Check if file already exists
|
|
18
|
-
const fileExists = existsSync(filePath);
|
|
19
|
-
|
|
20
|
-
// Get the directory path
|
|
21
|
-
const dir = dirname(filePath);
|
|
22
|
-
|
|
23
|
-
// Create parent directories if they don't exist
|
|
24
|
-
if (!existsSync(dir)) {
|
|
25
|
-
mkdirSync(dir, { recursive: true });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Write the file
|
|
29
|
-
writeFileSync(filePath, content, 'utf-8');
|
|
30
|
-
|
|
31
|
-
// Calculate bytes written
|
|
32
|
-
const bytes = Buffer.byteLength(content, 'utf-8');
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
success: true,
|
|
36
|
-
created: !fileExists,
|
|
37
|
-
bytes,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default WriteTool;
|
package/tsconfig.json
DELETED