@graphai/shell_utilty_agent 0.0.2 → 0.0.4

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 CHANGED
@@ -1,12 +1,12 @@
1
1
 
2
- # shell_util_agent for GraphAI
2
+ # @graphai/shell_utilty_agent for GraphAI
3
3
 
4
- shell utility agent
4
+ shell utilty agent
5
5
 
6
6
  ### Install
7
7
 
8
8
  ```sh
9
- yarn add shell_util_agent
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 "shell_util_agent";
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
 
@@ -1,8 +1,13 @@
1
1
  import { AgentFunction, AgentFunctionInfo } from "graphai";
2
- export declare const runShellCommand: (command: string, path?: string) => Promise<unknown>;
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;
@@ -37,24 +37,19 @@ 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([error, stdout].join("\n"));
46
- }
47
- else if (stderr) {
48
- reject([stderr, stdout].join("\n"));
43
+ reject(error);
49
44
  }
50
45
  else if (stdout) {
51
- resolve(stdout);
46
+ resolve({ text: stdout, stderr });
52
47
  }
53
48
  });
54
49
  });
55
50
  };
56
51
  exports.runShellCommand = runShellCommand;
57
- const runShellAgent = async ({ namedInputs }) => {
52
+ const runShellAgent = async ({ namedInputs, }) => {
58
53
  const { baseDir, dirs, command } = namedInputs;
59
54
  const dir = (() => {
60
55
  if (dirs) {
@@ -66,34 +61,32 @@ 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
66
  catch (error) {
74
67
  if (error instanceof Error) {
75
68
  return {
76
- error: error.message
69
+ error: error.message,
77
70
  };
78
71
  }
79
- return {
80
- error,
81
- };
72
+ return { error };
82
73
  }
83
- ;
84
74
  };
85
75
  exports.runShellAgent = runShellAgent;
86
76
  const runShellAgentInfo = {
87
77
  name: "runShellAgent",
88
78
  agent: exports.runShellAgent,
89
79
  mock: exports.runShellAgent,
90
- samples: [{
91
- params: { baseDir: "./" },
92
- inputs: { command: "echo 1" },
80
+ samples: [
81
+ {
82
+ params: {},
83
+ inputs: { command: "echo 1", baseDir: "./" },
93
84
  result: {
94
- text: "1\n"
85
+ text: "1\n",
86
+ stderr: "",
95
87
  },
96
- }],
88
+ },
89
+ ],
97
90
  description: "shell utility agent",
98
91
  category: ["system"],
99
92
  author: "isamu arimoto",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphai/shell_utilty_agent",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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.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.2",
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",