@aigne/example-workflow-code-execution 1.9.0 → 1.10.1

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
@@ -108,7 +108,7 @@ const sandbox = FunctionAgent.from({
108
108
  inputSchema: z.object({
109
109
  code: z.string().describe("The code to run"),
110
110
  }),
111
- fn: async (input: { code: string }) => {
111
+ process: async (input: { code: string }) => {
112
112
  const { code } = input;
113
113
  // biome-ignore lint/security/noGlobalEval: <explanation>
114
114
  const result = eval(code);
package/index.ts CHANGED
@@ -9,11 +9,18 @@ const model = await loadModel();
9
9
 
10
10
  const sandbox = FunctionAgent.from({
11
11
  name: "evaluateJs",
12
- description: "Run JavaScript code in a sandboxed environment and return the result.",
12
+ description: `
13
+ This agent generates a JavaScript code snippet that is suitable to be passed directly into Node.js's 'eval' function. Follow these constraints:
14
+ - Do NOT use any top-level 'return' statements, as the code is not inside a function.
15
+ - The code can define variables or perform calculations.
16
+ - To return a value from the code, make sure the final line is an expression (not a statement) whose value will be the result.
17
+ - Do NOT wrap the code in a function or IIFE unless explicitly instructed.
18
+ - The code should be self-contained and valid JavaScript.`,
19
+
13
20
  inputSchema: z.object({
14
- jsCode: z.string().describe("The code to run"),
21
+ jsCode: z.string().describe("JavaScript code snippet to evaluate"),
15
22
  }),
16
- fn: async (input: { jsCode: string }) => {
23
+ process: async (input: { jsCode: string }) => {
17
24
  const { jsCode } = input;
18
25
  // biome-ignore lint/security/noGlobalEval: <explanation>
19
26
  const result = eval(jsCode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-code-execution",
3
- "version": "1.9.0",
3
+ "version": "1.10.1",
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",
@@ -16,13 +16,13 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "openai": "^4.94.0",
20
- "zod": "^3.24.2",
21
- "@aigne/cli": "^1.8.1",
22
- "@aigne/core": "^1.13.0"
19
+ "openai": "^4.97.0",
20
+ "zod": "^3.24.4",
21
+ "@aigne/cli": "^1.9.1",
22
+ "@aigne/core": "^1.15.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@aigne/test-utils": "^0.1.0"
25
+ "@aigne/test-utils": "^0.2.0"
26
26
  },
27
27
  "scripts": {
28
28
  "start": "bun run index.ts",
@@ -16,7 +16,7 @@ const sandbox = FunctionAgent.from({
16
16
  inputSchema: z.object({
17
17
  code: z.string().describe("The code to run"),
18
18
  }),
19
- fn: async (input: { code: string }) => {
19
+ process: async (input: { code: string }) => {
20
20
  const { code } = input;
21
21
  // biome-ignore lint/security/noGlobalEval: <explanation>
22
22
  const result = eval(code);
File without changes