@receptron/graphai_cli 0.5.12 → 0.5.13
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/package.json +10 -11
- package/templates/agent.md +30 -0
- package/templates/readme.md +23 -0
- package/lib/agentdoc.d.ts +0 -2
- package/lib/agentdoc.js +0 -32
- package/lib/file_utils.d.ts +0 -3
- package/lib/file_utils.js +0 -39
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -20
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@receptron/graphai_cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"description": "GraphAI command line tools.",
|
|
5
5
|
"main": "lib/graphai_cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"graphai": "lib/graphai_cli.js"
|
|
8
|
-
"agentdoc": "lib/agentdoc.js"
|
|
7
|
+
"graphai": "lib/graphai_cli.js"
|
|
9
8
|
},
|
|
10
9
|
"files": [
|
|
11
|
-
"./lib"
|
|
10
|
+
"./lib",
|
|
11
|
+
"./templates"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && tsc-alias",
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/receptron/
|
|
26
|
+
"url": "git+https://github.com/receptron/graphai"
|
|
27
27
|
},
|
|
28
28
|
"author": "Receptron team",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"bugs": {
|
|
31
|
-
"url": "https://github.com/receptron/
|
|
31
|
+
"url": "https://github.com/receptron/graphai/issues"
|
|
32
32
|
},
|
|
33
|
-
"homepage": "https://github.com/receptron/
|
|
33
|
+
"homepage": "https://github.com/receptron/graphai#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
36
36
|
"@types/json-schema-generator": "^2.0.3",
|
|
37
|
-
"@types/yargs": "^17.0.
|
|
37
|
+
"@types/yargs": "^17.0.33"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@graphai/agent_filters": "^0.0.6",
|
|
41
41
|
"@graphai/agents": "^0.0.21",
|
|
42
|
-
"@receptron/test_utils": "^0.0.
|
|
42
|
+
"@receptron/test_utils": "^0.0.7",
|
|
43
43
|
"dotenv": "^16.4.5",
|
|
44
44
|
"graphai": "^0.5.5",
|
|
45
45
|
"json-schema-generator": "^2.0.6",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"types": "./lib/graphai_cli.d.ts",
|
|
49
49
|
"directories": {
|
|
50
|
-
"lib": "lib"
|
|
51
|
-
"template": "template"
|
|
50
|
+
"lib": "lib"
|
|
52
51
|
}
|
|
53
52
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# {name}
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
{description}
|
|
6
|
+
|
|
7
|
+
## Schema
|
|
8
|
+
|
|
9
|
+
{schemas}
|
|
10
|
+
|
|
11
|
+
## Input Format
|
|
12
|
+
|
|
13
|
+
{resultKey}
|
|
14
|
+
|
|
15
|
+
## Samples
|
|
16
|
+
|
|
17
|
+
{samples}
|
|
18
|
+
|
|
19
|
+
## Author
|
|
20
|
+
|
|
21
|
+
{author}
|
|
22
|
+
|
|
23
|
+
## Repository
|
|
24
|
+
|
|
25
|
+
{repository}
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
{license}
|
|
30
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# {packageName} for GraphAI
|
|
3
|
+
|
|
4
|
+
{description}
|
|
5
|
+
|
|
6
|
+
### Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
yarn add {packageName}
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Usage
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { GraphAI } from "graphai";
|
|
16
|
+
import { {agents} } from "{packageName}";
|
|
17
|
+
|
|
18
|
+
const agents = { {agents} };
|
|
19
|
+
|
|
20
|
+
const graph = new GraphAI(graph_data, agents);
|
|
21
|
+
const result = await graph.run();
|
|
22
|
+
```
|
|
23
|
+
|
package/lib/agentdoc.d.ts
DELETED
package/lib/agentdoc.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const docs_1 = require("./docs");
|
|
9
|
-
const main = async () => {
|
|
10
|
-
const path = process.cwd();
|
|
11
|
-
const packageJson = JSON.parse(fs_1.default.readFileSync(path + "/package.json", "utf8"));
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
-
const agents = require(path + "/lib/index");
|
|
14
|
-
const agentAttribute = (key) => {
|
|
15
|
-
if (key === "packageName") {
|
|
16
|
-
return packageJson.name;
|
|
17
|
-
}
|
|
18
|
-
if (key === "description") {
|
|
19
|
-
return packageJson.description;
|
|
20
|
-
}
|
|
21
|
-
if (key === "agents") {
|
|
22
|
-
return Object.keys(agents).join(", ");
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const temp = (0, docs_1.readTemplate)("readme.md");
|
|
26
|
-
const md = ["packageName", "description", "agents"].reduce((tmp, key) => {
|
|
27
|
-
tmp = tmp.replaceAll("{" + key + "}", agentAttribute(key));
|
|
28
|
-
return tmp;
|
|
29
|
-
}, temp);
|
|
30
|
-
fs_1.default.writeFileSync(path + "/README.md", md);
|
|
31
|
-
};
|
|
32
|
-
main();
|
package/lib/file_utils.d.ts
DELETED
package/lib/file_utils.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fileBaseName = exports.readGraphaiData = exports.mkdirLogDir = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const yaml_1 = __importDefault(require("yaml"));
|
|
10
|
-
const mkdirLogDir = (logsDir) => {
|
|
11
|
-
if (!fs_1.default.existsSync(logsDir)) {
|
|
12
|
-
fs_1.default.mkdirSync(logsDir, { recursive: true });
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
exports.mkdirLogDir = mkdirLogDir;
|
|
16
|
-
const readGraphaiData = (file) => {
|
|
17
|
-
if (file.endsWith(".yaml") || file.endsWith(".yml")) {
|
|
18
|
-
return readYamlFile(file);
|
|
19
|
-
}
|
|
20
|
-
if (file.endsWith(".json")) {
|
|
21
|
-
return readJsonFile(file);
|
|
22
|
-
}
|
|
23
|
-
throw new Error("No file exists " + file);
|
|
24
|
-
};
|
|
25
|
-
exports.readGraphaiData = readGraphaiData;
|
|
26
|
-
const readJsonFile = (fileName) => {
|
|
27
|
-
const file_file = fs_1.default.readFileSync(fileName, "utf8");
|
|
28
|
-
const file = JSON.parse(file_file);
|
|
29
|
-
return file;
|
|
30
|
-
};
|
|
31
|
-
const readYamlFile = (fileName) => {
|
|
32
|
-
const file_file = fs_1.default.readFileSync(fileName, "utf8");
|
|
33
|
-
const file = yaml_1.default.parse(file_file);
|
|
34
|
-
return file;
|
|
35
|
-
};
|
|
36
|
-
const fileBaseName = (file) => {
|
|
37
|
-
return path_1.default.basename(file).replace(/\.[a-zA-Z_-]+$/, "");
|
|
38
|
-
};
|
|
39
|
-
exports.fileBaseName = fileBaseName;
|
package/lib/utils.d.ts
DELETED
package/lib/utils.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.callbackLog = void 0;
|
|
4
|
-
const type_1 = require("graphai/lib/type");
|
|
5
|
-
const callbackLog = ({ nodeId, state, inputs, result, errorMessage }) => {
|
|
6
|
-
if (state === type_1.NodeState.Executing) {
|
|
7
|
-
console.log(`${nodeId.padEnd(10)} =>( ${(JSON.stringify(inputs) ?? "").slice(0, 60)}`);
|
|
8
|
-
}
|
|
9
|
-
else if (state === type_1.NodeState.Injected || state == type_1.NodeState.Completed) {
|
|
10
|
-
const shortName = state === type_1.NodeState.Injected ? "= " : "{} ";
|
|
11
|
-
console.log(`${nodeId.padEnd(10)} ${shortName} ${(JSON.stringify(result) ?? "").slice(0, 60)}`);
|
|
12
|
-
}
|
|
13
|
-
else if (state == type_1.NodeState.Failed) {
|
|
14
|
-
console.log(`${nodeId.padEnd(10)} ERR ${(errorMessage ?? "").slice(0, 60)}`);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
console.log(`${nodeId.padEnd(10)} ${state}`);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.callbackLog = callbackLog;
|