@graphai/shell_utilty_agent 0.0.3 → 0.0.5
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/lib/run_shell_agent.d.ts +6 -1
- package/lib/run_shell_agent.js +9 -16
- package/package.json +3 -3
package/lib/run_shell_agent.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { AgentFunction, AgentFunctionInfo } from "graphai";
|
|
2
|
-
export declare const runShellCommand: (command: string, path?: string) => Promise<
|
|
2
|
+
export declare const runShellCommand: (command: string, path?: string) => Promise<{
|
|
3
|
+
text?: string | unknown;
|
|
4
|
+
error?: unknown;
|
|
5
|
+
stderr?: unknown;
|
|
6
|
+
}>;
|
|
3
7
|
export declare const runShellAgent: AgentFunction<null, {
|
|
4
8
|
text?: string | unknown;
|
|
5
9
|
error?: unknown;
|
|
10
|
+
stderr?: unknown;
|
|
6
11
|
}, {
|
|
7
12
|
command: string;
|
|
8
13
|
baseDir?: string;
|
package/lib/run_shell_agent.js
CHANGED
|
@@ -37,18 +37,13 @@ exports.runShellAgent = exports.runShellCommand = void 0;
|
|
|
37
37
|
const child_process_1 = require("child_process");
|
|
38
38
|
const path = __importStar(require("node:path"));
|
|
39
39
|
const runShellCommand = (command, path) => {
|
|
40
|
-
// console.log(command, path);
|
|
41
40
|
return new Promise((resolve, reject) => {
|
|
42
|
-
// const exec = require("child_process").exec;
|
|
43
41
|
(0, child_process_1.exec)(command, { cwd: path ?? process.cwd() }, function (error, stdout, stderr) {
|
|
44
42
|
if (error) {
|
|
45
|
-
reject(
|
|
46
|
-
}
|
|
47
|
-
else if (stderr) {
|
|
48
|
-
reject([stderr, stdout].join("\n"));
|
|
43
|
+
reject({ error, stderr, stdout });
|
|
49
44
|
}
|
|
50
45
|
else if (stdout) {
|
|
51
|
-
resolve(stdout);
|
|
46
|
+
resolve({ text: stdout, stderr });
|
|
52
47
|
}
|
|
53
48
|
});
|
|
54
49
|
});
|
|
@@ -66,19 +61,16 @@ const runShellAgent = async ({ namedInputs, }) => {
|
|
|
66
61
|
})();
|
|
67
62
|
try {
|
|
68
63
|
const result = await (0, exports.runShellCommand)(command, dir);
|
|
69
|
-
return
|
|
70
|
-
text: result,
|
|
71
|
-
};
|
|
64
|
+
return result;
|
|
72
65
|
}
|
|
73
|
-
catch (
|
|
74
|
-
if (
|
|
66
|
+
catch (err) {
|
|
67
|
+
if (err instanceof Error) {
|
|
75
68
|
return {
|
|
76
|
-
error:
|
|
69
|
+
error: err.message,
|
|
77
70
|
};
|
|
78
71
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
72
|
+
const { error, stderr, stdout } = err;
|
|
73
|
+
return { error, stderr, stdout };
|
|
82
74
|
}
|
|
83
75
|
};
|
|
84
76
|
exports.runShellAgent = runShellAgent;
|
|
@@ -92,6 +84,7 @@ const runShellAgentInfo = {
|
|
|
92
84
|
inputs: { command: "echo 1", baseDir: "./" },
|
|
93
85
|
result: {
|
|
94
86
|
text: "1\n",
|
|
87
|
+
stderr: "",
|
|
95
88
|
},
|
|
96
89
|
},
|
|
97
90
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphai/shell_utilty_agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "shell utilty agent",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"author": "isamu arimoto",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@graphai/vanilla": "^0.2.
|
|
21
|
+
"@graphai/vanilla": "^0.2.5",
|
|
22
22
|
"@receptron/agentdoc": "^0.0.6",
|
|
23
23
|
"@receptron/test_utils": "^0.2.2",
|
|
24
24
|
"@types/node": "^22.10.1",
|
|
25
25
|
"eslint": "^9.16.0",
|
|
26
|
-
"graphai": "^0.6.
|
|
26
|
+
"graphai": "^0.6.4",
|
|
27
27
|
"prettier": "^3.4.2",
|
|
28
28
|
"ts-node": "^10.9.2",
|
|
29
29
|
"tsconfig-paths": "^4.2.0",
|