@aigne/example-workflow-code-execution 1.8.0 → 1.9.0
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 +1 -2
- package/index.ts +6 -6
- package/package.json +3 -3
- package/usage.ts +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,6 @@ class sandbox processing
|
|
|
26
26
|
|
|
27
27
|
Workflow of a code-execution between user and coder using a sandbox:
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
```mermaid
|
|
31
30
|
sequenceDiagram
|
|
32
31
|
|
|
@@ -104,7 +103,7 @@ const model = new OpenAIChatModel({
|
|
|
104
103
|
});
|
|
105
104
|
|
|
106
105
|
const sandbox = FunctionAgent.from({
|
|
107
|
-
name: "
|
|
106
|
+
name: "evaluateJs",
|
|
108
107
|
description: "A js sandbox for running javascript code",
|
|
109
108
|
inputSchema: z.object({
|
|
110
109
|
code: z.string().describe("The code to run"),
|
package/index.ts
CHANGED
|
@@ -8,15 +8,15 @@ import { z } from "zod";
|
|
|
8
8
|
const model = await loadModel();
|
|
9
9
|
|
|
10
10
|
const sandbox = FunctionAgent.from({
|
|
11
|
-
name: "
|
|
12
|
-
description: "
|
|
11
|
+
name: "evaluateJs",
|
|
12
|
+
description: "Run JavaScript code in a sandboxed environment and return the result.",
|
|
13
13
|
inputSchema: z.object({
|
|
14
|
-
|
|
14
|
+
jsCode: z.string().describe("The code to run"),
|
|
15
15
|
}),
|
|
16
|
-
fn: async (input: {
|
|
17
|
-
const {
|
|
16
|
+
fn: async (input: { jsCode: string }) => {
|
|
17
|
+
const { jsCode } = input;
|
|
18
18
|
// biome-ignore lint/security/noGlobalEval: <explanation>
|
|
19
|
-
const result = eval(
|
|
19
|
+
const result = eval(jsCode);
|
|
20
20
|
return { result };
|
|
21
21
|
},
|
|
22
22
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-code-execution",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework to build a code-execution workflow",
|
|
5
5
|
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
6
6
|
"homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/workflow-code-execution",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"openai": "^4.94.0",
|
|
20
20
|
"zod": "^3.24.2",
|
|
21
|
-
"@aigne/
|
|
22
|
-
"@aigne/
|
|
21
|
+
"@aigne/cli": "^1.8.1",
|
|
22
|
+
"@aigne/core": "^1.13.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@aigne/test-utils": "^0.1.0"
|
package/usage.ts
CHANGED
|
@@ -11,7 +11,7 @@ const model = new OpenAIChatModel({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
const sandbox = FunctionAgent.from({
|
|
14
|
-
name: "
|
|
14
|
+
name: "evaluateJs",
|
|
15
15
|
description: "A js sandbox for running javascript code",
|
|
16
16
|
inputSchema: z.object({
|
|
17
17
|
code: z.string().describe("The code to run"),
|