termux-dev 1.2.2 → 1.4.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/README.md +48 -0
- package/assets/banner.svg +1 -1
- package/assets/preview.png +0 -0
- package/dist/cli/doctor.js +8 -2
- package/dist/cli/export.js +62 -0
- package/dist/cli/headless.js +110 -0
- package/dist/cli/index.js +411 -224
- package/dist/cli/prompt.js +16 -2
- package/dist/cli/server.js +1 -1
- package/dist/cli/updater.js +0 -6
- package/dist/core/commands.js +100 -0
- package/dist/core/history.js +10 -0
- package/dist/core/loop.js +5 -1
- package/dist/core/models.js +1 -1
- package/dist/core/pricing.js +1 -1
- package/dist/core/repomap.js +135 -0
- package/dist/core/usage.js +119 -0
- package/dist/mcp/client.js +218 -0
- package/dist/mcp/manager.js +196 -0
- package/dist/mcp/types.js +1 -0
- package/dist/permissions/guard.js +69 -15
- package/dist/prompts/builder.js +9 -0
- package/dist/providers/openai.js +37 -8
- package/dist/tools/bash.js +7 -0
- package/dist/tools/fs.js +1 -1
- package/dist/tools/index.js +4 -2
- package/dist/tools/web.js +3 -3
- package/package.json +1 -1
package/dist/tools/bash.js
CHANGED
|
@@ -20,20 +20,27 @@ export const bashTool = {
|
|
|
20
20
|
return new Promise((resolve, reject) => {
|
|
21
21
|
const proc = spawn(args.command, { shell: true });
|
|
22
22
|
let output = '';
|
|
23
|
+
let isTruncated = false;
|
|
23
24
|
const timeout = setTimeout(() => {
|
|
24
25
|
proc.kill();
|
|
25
26
|
resolve(output + '\n[Process killed due to timeout]');
|
|
26
27
|
}, 30000);
|
|
27
28
|
proc.stdout.on('data', (data) => {
|
|
29
|
+
if (isTruncated)
|
|
30
|
+
return;
|
|
28
31
|
output += data.toString();
|
|
29
32
|
if (output.length > 20000) {
|
|
33
|
+
isTruncated = true;
|
|
30
34
|
output = output.substring(0, 20000) + '\n[Output truncated]';
|
|
31
35
|
proc.kill();
|
|
32
36
|
}
|
|
33
37
|
});
|
|
34
38
|
proc.stderr.on('data', (data) => {
|
|
39
|
+
if (isTruncated)
|
|
40
|
+
return;
|
|
35
41
|
output += data.toString();
|
|
36
42
|
if (output.length > 20000) {
|
|
43
|
+
isTruncated = true;
|
|
37
44
|
output = output.substring(0, 20000) + '\n[Output truncated]';
|
|
38
45
|
proc.kill();
|
|
39
46
|
}
|
package/dist/tools/fs.js
CHANGED
|
@@ -153,7 +153,7 @@ export const editFileTool = {
|
|
|
153
153
|
let addCounter = startLine;
|
|
154
154
|
addedArr.forEach((l) => diffLines.push(`${addCounter++} + ${l}`));
|
|
155
155
|
contextAfter.forEach((l) => diffLines.push(`${addCounter++} ${l}`));
|
|
156
|
-
const newContent = content.
|
|
156
|
+
const newContent = content.slice(0, targetIndex) + args.replacement + content.slice(targetIndex + target.length);
|
|
157
157
|
await fs.writeFile(args.path, newContent, 'utf8');
|
|
158
158
|
return JSON.stringify({
|
|
159
159
|
status: 'success',
|
package/dist/tools/index.js
CHANGED
|
@@ -9,11 +9,13 @@ import { saveMemoryTool } from '../core/memory.js';
|
|
|
9
9
|
import { planReadyTool, lastPlanReady, resetPlanReady } from './plan.js';
|
|
10
10
|
import { todoListTool, currentTodoList, resetTodoList } from './todo.js';
|
|
11
11
|
import { servePreviewTool } from './server.js';
|
|
12
|
+
import { MCPManager } from '../mcp/manager.js';
|
|
12
13
|
export function getTools(planMode) {
|
|
13
14
|
const baseTools = [readFileTool, listDirTool, searchTool, askQuestionsTool, webSearchTool, fetchUrlTool, saveMemoryTool, planReadyTool, todoListTool];
|
|
15
|
+
const mcpTools = MCPManager.getInstance().getTools();
|
|
14
16
|
if (planMode) {
|
|
15
|
-
return baseTools;
|
|
17
|
+
return [...baseTools, ...mcpTools];
|
|
16
18
|
}
|
|
17
|
-
return [...baseTools, writeFileTool, editFileTool, mkdirTool, bashTool, diagnoseCodeTool, installPackageTool, servePreviewTool];
|
|
19
|
+
return [...baseTools, writeFileTool, editFileTool, mkdirTool, bashTool, diagnoseCodeTool, installPackageTool, servePreviewTool, ...mcpTools];
|
|
18
20
|
}
|
|
19
21
|
export { webSearchTool, fetchUrlTool, diagnoseCodeTool, installPackageTool, saveMemoryTool, planReadyTool, lastPlanReady, resetPlanReady, todoListTool, currentTodoList, resetTodoList, servePreviewTool };
|
package/dist/tools/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function stripHtml(html) {
|
|
2
2
|
return html
|
|
3
|
-
.replace(/<script\b[
|
|
4
|
-
.replace(/<style\b[
|
|
5
|
-
.replace(/<svg\b[
|
|
3
|
+
.replace(/<script\b[\s\S]*?<\/script>/gi, '')
|
|
4
|
+
.replace(/<style\b[\s\S]*?<\/style>/gi, '')
|
|
5
|
+
.replace(/<svg\b[\s\S]*?<\/svg>/gi, '')
|
|
6
6
|
.replace(/<[^>]+>/g, ' ')
|
|
7
7
|
.replace(/"/g, '"')
|
|
8
8
|
.replace(/&/g, '&')
|
package/package.json
CHANGED