@graphai/shell_utilty_agent 0.0.1 → 0.0.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/README.md +7 -11
- package/lib/run_shell_agent.js +10 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
#
|
|
2
|
+
# @graphai/shell_utilty_agent for GraphAI
|
|
3
3
|
|
|
4
|
-
shell
|
|
4
|
+
shell utilty agent
|
|
5
5
|
|
|
6
6
|
### Install
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
yarn add
|
|
9
|
+
yarn add @graphai/shell_utilty_agent
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ yarn add shell_util_agent
|
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { GraphAI } from "graphai";
|
|
17
|
-
import { runShellAgent } from "
|
|
17
|
+
import { runShellAgent } from "@graphai/shell_utilty_agent";
|
|
18
18
|
|
|
19
19
|
const agents = { runShellAgent };
|
|
20
20
|
|
|
@@ -25,20 +25,16 @@ const result = await graph.run();
|
|
|
25
25
|
### Agents description
|
|
26
26
|
- runShellAgent - shell utility agent
|
|
27
27
|
|
|
28
|
-
### Input/Output/Params Schema & samples
|
|
29
|
-
- [runShellAgent](https://github.com/receptron/graphai/blob/main/docs/agentDocs/system/runShellAgent.md)
|
|
30
|
-
|
|
31
28
|
### Input/Params example
|
|
32
29
|
- runShellAgent
|
|
33
30
|
|
|
34
31
|
```typescript
|
|
35
32
|
{
|
|
36
33
|
"inputs": {
|
|
37
|
-
"command": "echo 1"
|
|
38
|
-
},
|
|
39
|
-
"params": {
|
|
34
|
+
"command": "echo 1",
|
|
40
35
|
"baseDir": "./"
|
|
41
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"params": {}
|
|
42
38
|
}
|
|
43
39
|
```
|
|
44
40
|
|
package/lib/run_shell_agent.js
CHANGED
|
@@ -54,7 +54,7 @@ const runShellCommand = (command, path) => {
|
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
exports.runShellCommand = runShellCommand;
|
|
57
|
-
const runShellAgent = async ({ namedInputs }) => {
|
|
57
|
+
const runShellAgent = async ({ namedInputs, }) => {
|
|
58
58
|
const { baseDir, dirs, command } = namedInputs;
|
|
59
59
|
const dir = (() => {
|
|
60
60
|
if (dirs) {
|
|
@@ -67,33 +67,34 @@ const runShellAgent = async ({ namedInputs }) => {
|
|
|
67
67
|
try {
|
|
68
68
|
const result = await (0, exports.runShellCommand)(command, dir);
|
|
69
69
|
return {
|
|
70
|
-
text: result
|
|
70
|
+
text: result,
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
catch (error) {
|
|
74
74
|
if (error instanceof Error) {
|
|
75
75
|
return {
|
|
76
|
-
error: error.message
|
|
76
|
+
error: error.message,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
return {
|
|
80
80
|
error,
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
;
|
|
84
83
|
};
|
|
85
84
|
exports.runShellAgent = runShellAgent;
|
|
86
85
|
const runShellAgentInfo = {
|
|
87
86
|
name: "runShellAgent",
|
|
88
87
|
agent: exports.runShellAgent,
|
|
89
88
|
mock: exports.runShellAgent,
|
|
90
|
-
samples: [
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
samples: [
|
|
90
|
+
{
|
|
91
|
+
params: {},
|
|
92
|
+
inputs: { command: "echo 1", baseDir: "./" },
|
|
93
93
|
result: {
|
|
94
|
-
text: "1\n"
|
|
94
|
+
text: "1\n",
|
|
95
95
|
},
|
|
96
|
-
}
|
|
96
|
+
},
|
|
97
|
+
],
|
|
97
98
|
description: "shell utility agent",
|
|
98
99
|
category: ["system"],
|
|
99
100
|
author: "isamu arimoto",
|