@dexto/tools-process 1.6.0 → 1.6.2
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/bash-exec-tool.cjs +27 -23
- package/dist/bash-exec-tool.d.ts.map +1 -1
- package/dist/bash-exec-tool.js +28 -24
- package/dist/bash-output-tool.cjs +6 -1
- package/dist/bash-output-tool.d.ts.map +1 -1
- package/dist/bash-output-tool.js +7 -2
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +485 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/kill-process-tool.cjs +6 -1
- package/dist/kill-process-tool.d.ts.map +1 -1
- package/dist/kill-process-tool.js +7 -2
- package/dist/tool-factory.cjs +12 -0
- package/dist/tool-factory.d.ts.map +1 -1
- package/dist/tool-factory.js +12 -0
- package/package.json +4 -4
- package/dist/bash-exec-tool.d.cts +0 -38
- package/dist/bash-output-tool.d.cts +0 -25
- package/dist/command-pattern-utils.d.cts +0 -30
- package/dist/command-pattern-utils.test.d.cts +0 -2
- package/dist/command-validator.d.cts +0 -52
- package/dist/error-codes.d.cts +0 -26
- package/dist/errors.d.cts +0 -90
- package/dist/kill-process-tool.d.cts +0 -25
- package/dist/process-service.d.cts +0 -100
- package/dist/tool-factory-config.d.cts +0 -56
- package/dist/tool-factory.d.cts +0 -7
- package/dist/types.d.cts +0 -108
package/dist/bash-exec-tool.cjs
CHANGED
|
@@ -48,7 +48,6 @@ const BashExecInputSchema = import_zod.z.object({
|
|
|
48
48
|
function createBashExecTool(getProcessService) {
|
|
49
49
|
return (0, import_core.defineTool)({
|
|
50
50
|
id: "bash_exec",
|
|
51
|
-
displayName: "Bash",
|
|
52
51
|
aliases: ["bash"],
|
|
53
52
|
description: `Execute a shell command in the project root directory.
|
|
54
53
|
|
|
@@ -96,29 +95,32 @@ Each command runs in a fresh shell, so cd does not persist between calls.
|
|
|
96
95
|
|
|
97
96
|
Security: Dangerous commands are blocked. Injection attempts are detected. Requires approval with pattern-based session memory.`,
|
|
98
97
|
inputSchema: BashExecInputSchema,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
approval: {
|
|
99
|
+
patternKey: (input) => (0, import_command_pattern_utils.generateCommandPatternKey)(input.command),
|
|
100
|
+
suggestPatterns: (input) => (0, import_command_pattern_utils.generateCommandPatternSuggestions)(input.command)
|
|
102
101
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
presentation: {
|
|
103
|
+
describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
|
|
104
|
+
title: "Bash",
|
|
105
|
+
argsText: (0, import_core.truncateForHeader)(input.command, 140)
|
|
106
|
+
}),
|
|
107
|
+
/**
|
|
108
|
+
* Generate preview for approval UI - shows the command to be executed
|
|
109
|
+
*/
|
|
110
|
+
preview: async (input, _context) => {
|
|
111
|
+
const { command, run_in_background } = input;
|
|
112
|
+
const preview = {
|
|
113
|
+
type: "shell",
|
|
114
|
+
title: "Bash",
|
|
115
|
+
command,
|
|
116
|
+
exitCode: 0,
|
|
117
|
+
// Placeholder - not executed yet
|
|
118
|
+
duration: 0,
|
|
119
|
+
// Placeholder - not executed yet
|
|
120
|
+
isBackground: run_in_background
|
|
121
|
+
};
|
|
122
|
+
return preview;
|
|
123
|
+
}
|
|
122
124
|
},
|
|
123
125
|
async execute(input, context) {
|
|
124
126
|
const resolvedProcessService = await getProcessService(context);
|
|
@@ -148,6 +150,7 @@ Security: Dangerous commands are blocked. Injection attempts are detected. Requi
|
|
|
148
150
|
if ("stdout" in result) {
|
|
149
151
|
const _display = {
|
|
150
152
|
type: "shell",
|
|
153
|
+
title: "Bash",
|
|
151
154
|
command,
|
|
152
155
|
exitCode: result.exitCode,
|
|
153
156
|
duration: result.duration,
|
|
@@ -165,6 +168,7 @@ Security: Dangerous commands are blocked. Injection attempts are detected. Requi
|
|
|
165
168
|
} else {
|
|
166
169
|
const _display = {
|
|
167
170
|
type: "shell",
|
|
171
|
+
title: "Bash",
|
|
168
172
|
command,
|
|
169
173
|
exitCode: 0,
|
|
170
174
|
// Background process hasn't exited yet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-exec-tool.d.ts","sourceRoot":"","sources":["../src/bash-exec-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAwBZ,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9F,wBAAgB,kBAAkB,CAC9B,iBAAiB,EAAE,oBAAoB,GACxC,IAAI,CAAC,OAAO,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"bash-exec-tool.d.ts","sourceRoot":"","sources":["../src/bash-exec-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAwBZ,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9F,wBAAgB,kBAAkB,CAC9B,iBAAiB,EAAE,oBAAoB,GACxC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAmKlC"}
|
package/dist/bash-exec-tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { defineTool } from "@dexto/core";
|
|
3
|
+
import { createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
|
|
4
4
|
import { ProcessError } from "./errors.js";
|
|
5
5
|
import {
|
|
6
6
|
generateCommandPatternKey,
|
|
@@ -18,7 +18,6 @@ const BashExecInputSchema = z.object({
|
|
|
18
18
|
function createBashExecTool(getProcessService) {
|
|
19
19
|
return defineTool({
|
|
20
20
|
id: "bash_exec",
|
|
21
|
-
displayName: "Bash",
|
|
22
21
|
aliases: ["bash"],
|
|
23
22
|
description: `Execute a shell command in the project root directory.
|
|
24
23
|
|
|
@@ -66,29 +65,32 @@ Each command runs in a fresh shell, so cd does not persist between calls.
|
|
|
66
65
|
|
|
67
66
|
Security: Dangerous commands are blocked. Injection attempts are detected. Requires approval with pattern-based session memory.`,
|
|
68
67
|
inputSchema: BashExecInputSchema,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
approval: {
|
|
69
|
+
patternKey: (input) => generateCommandPatternKey(input.command),
|
|
70
|
+
suggestPatterns: (input) => generateCommandPatternSuggestions(input.command)
|
|
72
71
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
72
|
+
presentation: {
|
|
73
|
+
describeHeader: (input) => createLocalToolCallHeader({
|
|
74
|
+
title: "Bash",
|
|
75
|
+
argsText: truncateForHeader(input.command, 140)
|
|
76
|
+
}),
|
|
77
|
+
/**
|
|
78
|
+
* Generate preview for approval UI - shows the command to be executed
|
|
79
|
+
*/
|
|
80
|
+
preview: async (input, _context) => {
|
|
81
|
+
const { command, run_in_background } = input;
|
|
82
|
+
const preview = {
|
|
83
|
+
type: "shell",
|
|
84
|
+
title: "Bash",
|
|
85
|
+
command,
|
|
86
|
+
exitCode: 0,
|
|
87
|
+
// Placeholder - not executed yet
|
|
88
|
+
duration: 0,
|
|
89
|
+
// Placeholder - not executed yet
|
|
90
|
+
isBackground: run_in_background
|
|
91
|
+
};
|
|
92
|
+
return preview;
|
|
93
|
+
}
|
|
92
94
|
},
|
|
93
95
|
async execute(input, context) {
|
|
94
96
|
const resolvedProcessService = await getProcessService(context);
|
|
@@ -118,6 +120,7 @@ Security: Dangerous commands are blocked. Injection attempts are detected. Requi
|
|
|
118
120
|
if ("stdout" in result) {
|
|
119
121
|
const _display = {
|
|
120
122
|
type: "shell",
|
|
123
|
+
title: "Bash",
|
|
121
124
|
command,
|
|
122
125
|
exitCode: result.exitCode,
|
|
123
126
|
duration: result.duration,
|
|
@@ -135,6 +138,7 @@ Security: Dangerous commands are blocked. Injection attempts are detected. Requi
|
|
|
135
138
|
} else {
|
|
136
139
|
const _display = {
|
|
137
140
|
type: "shell",
|
|
141
|
+
title: "Bash",
|
|
138
142
|
command,
|
|
139
143
|
exitCode: 0,
|
|
140
144
|
// Background process hasn't exited yet
|
|
@@ -29,9 +29,14 @@ const BashOutputInputSchema = import_zod.z.object({
|
|
|
29
29
|
function createBashOutputTool(getProcessService) {
|
|
30
30
|
return (0, import_core.defineTool)({
|
|
31
31
|
id: "bash_output",
|
|
32
|
-
displayName: "Bash Output",
|
|
33
32
|
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
34
33
|
inputSchema: BashOutputInputSchema,
|
|
34
|
+
presentation: {
|
|
35
|
+
describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
|
|
36
|
+
title: "Bash Output",
|
|
37
|
+
argsText: (0, import_core.truncateForHeader)(input.process_id, 80)
|
|
38
|
+
})
|
|
39
|
+
},
|
|
35
40
|
async execute(input, context) {
|
|
36
41
|
const resolvedProcessService = await getProcessService(context);
|
|
37
42
|
const { process_id } = input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-output-tool.d.ts","sourceRoot":"","sources":["../src/bash-output-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,QAAA,MAAM,qBAAqB;;;;;;EAId,CAAC;AAEd;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,iBAAiB,EAAE,oBAAoB,GACxC,IAAI,CAAC,OAAO,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"bash-output-tool.d.ts","sourceRoot":"","sources":["../src/bash-output-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,QAAA,MAAM,qBAAqB;;;;;;EAId,CAAC;AAEd;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,iBAAiB,EAAE,oBAAoB,GACxC,IAAI,CAAC,OAAO,qBAAqB,CAAC,CA+BpC"}
|
package/dist/bash-output-tool.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { defineTool } from "@dexto/core";
|
|
2
|
+
import { createLocalToolCallHeader, defineTool, truncateForHeader } from "@dexto/core";
|
|
3
3
|
const BashOutputInputSchema = z.object({
|
|
4
4
|
process_id: z.string().describe("Process ID from bash_exec (when run_in_background=true)")
|
|
5
5
|
}).strict();
|
|
6
6
|
function createBashOutputTool(getProcessService) {
|
|
7
7
|
return defineTool({
|
|
8
8
|
id: "bash_output",
|
|
9
|
-
displayName: "Bash Output",
|
|
10
9
|
description: "Retrieve output from a background process started with bash_exec. Returns stdout, stderr, status (running/completed/failed), exit code, and duration. Each call returns only new output since last read. The output buffer is cleared after reading. Use this tool to monitor long-running commands.",
|
|
11
10
|
inputSchema: BashOutputInputSchema,
|
|
11
|
+
presentation: {
|
|
12
|
+
describeHeader: (input) => createLocalToolCallHeader({
|
|
13
|
+
title: "Bash Output",
|
|
14
|
+
argsText: truncateForHeader(input.process_id, 80)
|
|
15
|
+
})
|
|
16
|
+
},
|
|
12
17
|
async execute(input, context) {
|
|
13
18
|
const resolvedProcessService = await getProcessService(context);
|
|
14
19
|
const { process_id } = input;
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ __export(index_exports, {
|
|
|
22
22
|
ProcessError: () => import_errors.ProcessError,
|
|
23
23
|
ProcessErrorCode: () => import_error_codes.ProcessErrorCode,
|
|
24
24
|
ProcessService: () => import_process_service.ProcessService,
|
|
25
|
+
ProcessToolsConfigSchema: () => import_tool_factory_config.ProcessToolsConfigSchema,
|
|
25
26
|
createBashExecTool: () => import_bash_exec_tool.createBashExecTool,
|
|
26
27
|
createBashOutputTool: () => import_bash_output_tool.createBashOutputTool,
|
|
27
28
|
createKillProcessTool: () => import_kill_process_tool.createKillProcessTool,
|
|
@@ -29,6 +30,7 @@ __export(index_exports, {
|
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(index_exports);
|
|
31
32
|
var import_tool_factory = require("./tool-factory.js");
|
|
33
|
+
var import_tool_factory_config = require("./tool-factory-config.js");
|
|
32
34
|
var import_process_service = require("./process-service.js");
|
|
33
35
|
var import_command_validator = require("./command-validator.js");
|
|
34
36
|
var import_errors = require("./errors.js");
|
|
@@ -42,6 +44,7 @@ var import_kill_process_tool = require("./kill-process-tool.js");
|
|
|
42
44
|
ProcessError,
|
|
43
45
|
ProcessErrorCode,
|
|
44
46
|
ProcessService,
|
|
47
|
+
ProcessToolsConfigSchema,
|
|
45
48
|
createBashExecTool,
|
|
46
49
|
createBashOutputTool,
|
|
47
50
|
createKillProcessTool,
|