-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathshell_command_tool.h
More file actions
65 lines (56 loc) · 1.59 KB
/
Copy pathshell_command_tool.h
File metadata and controls
65 lines (56 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file shell_command_tool.h
* @brief Shell Command Tool Header
* @version 0.1
* @date 2025-08-24
*
* @copyright Copyright (c) 2026 Edge AI, LLC. All rights reserved.
*
*/
#pragma once
#include <agents-cpp/tool.h>
namespace agents {
namespace tools {
/**
* @brief Shell command tool that provides secure command execution capabilities
*/
class ShellCommandTool : public Tool {
public:
/**
* @brief Construct a new Shell Command Tool object
*/
ShellCommandTool();
/**
* @brief Execute the Shell Command Tool
* @param params The parameters for the Shell Command Tool
* @return ToolResult The result of the Shell Command Tool
*/
ToolResult execute(const JsonObject& params) const override;
/*! @cond PRIVATE */
protected:
/**
* @brief Setup the parameters for the Shell Command Tool
*/
void setupParameters();
/**
* @brief Validate the command
* @param command The command to validate
* @return true if the command is valid, false otherwise
*/
bool validateCommand(const std::string& command) const;
/**
* @brief Check if the command is dangerous
* @param command The command to check
* @return true if the command is dangerous, false otherwise
*/
bool isDangerousCommand(const std::string& command) const;
/**
* @brief Execute the command
* @param command The command to execute
* @return ToolResult The result of the command execution
*/
ToolResult executeCommand(const std::string& command) const;
/*! @endcond */
};
} // namespace tools
} // namespace agents