Spaces:
Runtime error
Runtime error
Tales-Cunha commited on
Commit ·
69b971b
1
Parent(s): 834e3b9
feat: Criar nodes stub e grafo linear
Browse files- .gitignore +2 -0
- package-lock.json +227 -64
- package.json +4 -2
- src/agents/tester/agent.ts +32 -10
- src/agents/tester/state.ts +36 -6
- src/agents/tester/types.ts +25 -0
- src/index.ts +21 -5
- tests/state.test.ts +23 -0
- tests/stub-run.ts +19 -0
- tsconfig.json +1 -1
.gitignore
CHANGED
|
@@ -141,3 +141,5 @@ dist
|
|
| 141 |
vite.config.js.timestamp-*
|
| 142 |
vite.config.ts.timestamp-*
|
| 143 |
.vite/
|
|
|
|
|
|
|
|
|
| 141 |
vite.config.js.timestamp-*
|
| 142 |
vite.config.ts.timestamp-*
|
| 143 |
.vite/
|
| 144 |
+
|
| 145 |
+
|
package-lock.json
CHANGED
|
@@ -10,7 +10,8 @@
|
|
| 10 |
"license": "ISC",
|
| 11 |
"dependencies": {
|
| 12 |
"@langchain/core": "^1.1.45",
|
| 13 |
-
"@langchain/langgraph": "^1.3.
|
|
|
|
| 14 |
"@langchain/openrouter": "^0.2.4",
|
| 15 |
"dotenv": "^17.4.2",
|
| 16 |
"langchain": "^1.4.0",
|
|
@@ -18,7 +19,8 @@
|
|
| 18 |
},
|
| 19 |
"devDependencies": {
|
| 20 |
"@biomejs/biome": "2.4.14",
|
| 21 |
-
"@types/node": "^25.
|
|
|
|
| 22 |
"typescript": "^6.0.3",
|
| 23 |
"vitest": "^4.1.5"
|
| 24 |
}
|
|
@@ -192,6 +194,19 @@
|
|
| 192 |
"integrity": "sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==",
|
| 193 |
"license": "MIT"
|
| 194 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
"node_modules/@emnapi/core": {
|
| 196 |
"version": "1.10.0",
|
| 197 |
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
@@ -226,6 +241,16 @@
|
|
| 226 |
"tslib": "^2.4.0"
|
| 227 |
}
|
| 228 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
"node_modules/@jridgewell/sourcemap-codec": {
|
| 230 |
"version": "1.5.5",
|
| 231 |
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
|
@@ -233,17 +258,25 @@
|
|
| 233 |
"dev": true,
|
| 234 |
"license": "MIT"
|
| 235 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
"node_modules/@langchain/core": {
|
| 237 |
-
"version": "1.1.
|
| 238 |
-
"resolved": "https://registry.npmjs.org/@langchain/core/-/core-1.1.
|
| 239 |
-
"integrity": "sha512-
|
| 240 |
"license": "MIT",
|
| 241 |
"dependencies": {
|
| 242 |
"@cfworker/json-schema": "^4.0.2",
|
| 243 |
"@standard-schema/spec": "^1.1.0",
|
| 244 |
-
"ansi-styles": "^5.0.0",
|
| 245 |
-
"camelcase": "6",
|
| 246 |
-
"decamelize": "1.2.0",
|
| 247 |
"js-tiktoken": "^1.0.12",
|
| 248 |
"langsmith": ">=0.5.0 <1.0.0",
|
| 249 |
"mustache": "^4.2.0",
|
|
@@ -255,13 +288,13 @@
|
|
| 255 |
}
|
| 256 |
},
|
| 257 |
"node_modules/@langchain/langgraph": {
|
| 258 |
-
"version": "1.3.
|
| 259 |
-
"resolved": "https://registry.npmjs.org/@langchain/langgraph/-/langgraph-1.3.
|
| 260 |
-
"integrity": "sha512-
|
| 261 |
"license": "MIT",
|
| 262 |
"dependencies": {
|
| 263 |
"@langchain/langgraph-checkpoint": "^1.0.2",
|
| 264 |
-
"@langchain/langgraph-sdk": "~1.9.
|
| 265 |
"@langchain/protocol": "^0.0.15",
|
| 266 |
"@standard-schema/spec": "1.1.0",
|
| 267 |
"uuid": "^10.0.0"
|
|
@@ -296,12 +329,11 @@
|
|
| 296 |
}
|
| 297 |
},
|
| 298 |
"node_modules/@langchain/langgraph-sdk": {
|
| 299 |
-
"version": "1.9.
|
| 300 |
-
"resolved": "https://registry.npmjs.org/@langchain/langgraph-sdk/-/langgraph-sdk-1.9.
|
| 301 |
-
"integrity": "sha512-
|
| 302 |
"license": "MIT",
|
| 303 |
"dependencies": {
|
| 304 |
-
"@langchain/core": "^1.1.44",
|
| 305 |
"@langchain/protocol": "^0.0.15",
|
| 306 |
"@types/json-schema": "^7.0.15",
|
| 307 |
"p-queue": "^9.0.1",
|
|
@@ -309,6 +341,7 @@
|
|
| 309 |
"uuid": "^13.0.0"
|
| 310 |
},
|
| 311 |
"peerDependencies": {
|
|
|
|
| 312 |
"react": "^18 || ^19",
|
| 313 |
"react-dom": "^18 || ^19",
|
| 314 |
"svelte": "^4.0.0 || ^5.0.0",
|
|
@@ -336,9 +369,9 @@
|
|
| 336 |
"license": "MIT"
|
| 337 |
},
|
| 338 |
"node_modules/@langchain/langgraph-sdk/node_modules/p-queue": {
|
| 339 |
-
"version": "9.
|
| 340 |
-
"resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.
|
| 341 |
-
"integrity": "sha512-
|
| 342 |
"license": "MIT",
|
| 343 |
"dependencies": {
|
| 344 |
"eventemitter3": "^5.0.4",
|
|
@@ -377,20 +410,20 @@
|
|
| 377 |
}
|
| 378 |
},
|
| 379 |
"node_modules/@langchain/openai": {
|
| 380 |
-
"version": "1.4.
|
| 381 |
-
"resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-1.4.
|
| 382 |
-
"integrity": "sha512-
|
| 383 |
"license": "MIT",
|
| 384 |
"dependencies": {
|
| 385 |
"js-tiktoken": "^1.0.12",
|
| 386 |
-
"openai": "^6.
|
| 387 |
"zod": "^3.25.76 || ^4"
|
| 388 |
},
|
| 389 |
"engines": {
|
| 390 |
"node": ">=20"
|
| 391 |
},
|
| 392 |
"peerDependencies": {
|
| 393 |
-
"@langchain/core": "^1.1.
|
| 394 |
}
|
| 395 |
},
|
| 396 |
"node_modules/@langchain/openrouter": {
|
|
@@ -410,6 +443,23 @@
|
|
| 410 |
"@langchain/core": "^1.0.0"
|
| 411 |
}
|
| 412 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
"node_modules/@langchain/protocol": {
|
| 414 |
"version": "0.0.15",
|
| 415 |
"resolved": "https://registry.npmjs.org/@langchain/protocol/-/protocol-0.0.15.tgz",
|
|
@@ -715,6 +765,34 @@
|
|
| 715 |
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
| 716 |
"license": "MIT"
|
| 717 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
"node_modules/@tybys/wasm-util": {
|
| 719 |
"version": "0.10.2",
|
| 720 |
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
|
|
@@ -758,13 +836,13 @@
|
|
| 758 |
"license": "MIT"
|
| 759 |
},
|
| 760 |
"node_modules/@types/node": {
|
| 761 |
-
"version": "25.
|
| 762 |
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.
|
| 763 |
-
"integrity": "sha512-+
|
| 764 |
"dev": true,
|
| 765 |
"license": "MIT",
|
| 766 |
"dependencies": {
|
| 767 |
-
"undici-types": "
|
| 768 |
}
|
| 769 |
},
|
| 770 |
"node_modules/@vitest/expect": {
|
|
@@ -880,18 +958,39 @@
|
|
| 880 |
"url": "https://opencollective.com/vitest"
|
| 881 |
}
|
| 882 |
},
|
| 883 |
-
"node_modules/
|
| 884 |
-
"version": "
|
| 885 |
-
"resolved": "https://registry.npmjs.org/
|
| 886 |
-
"integrity": "sha512-
|
|
|
|
| 887 |
"license": "MIT",
|
|
|
|
|
|
|
|
|
|
| 888 |
"engines": {
|
| 889 |
-
"node": ">=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 890 |
},
|
| 891 |
-
"
|
| 892 |
-
"
|
| 893 |
}
|
| 894 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 895 |
"node_modules/assertion-error": {
|
| 896 |
"version": "2.0.1",
|
| 897 |
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
|
|
@@ -922,18 +1021,6 @@
|
|
| 922 |
],
|
| 923 |
"license": "MIT"
|
| 924 |
},
|
| 925 |
-
"node_modules/camelcase": {
|
| 926 |
-
"version": "6.3.0",
|
| 927 |
-
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
|
| 928 |
-
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
|
| 929 |
-
"license": "MIT",
|
| 930 |
-
"engines": {
|
| 931 |
-
"node": ">=10"
|
| 932 |
-
},
|
| 933 |
-
"funding": {
|
| 934 |
-
"url": "https://github.com/sponsors/sindresorhus"
|
| 935 |
-
}
|
| 936 |
-
},
|
| 937 |
"node_modules/chai": {
|
| 938 |
"version": "6.2.2",
|
| 939 |
"resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
|
|
@@ -951,14 +1038,12 @@
|
|
| 951 |
"dev": true,
|
| 952 |
"license": "MIT"
|
| 953 |
},
|
| 954 |
-
"node_modules/
|
| 955 |
-
"version": "1.
|
| 956 |
-
"resolved": "https://registry.npmjs.org/
|
| 957 |
-
"integrity": "sha512-
|
| 958 |
-
"
|
| 959 |
-
"
|
| 960 |
-
"node": ">=0.10.0"
|
| 961 |
-
}
|
| 962 |
},
|
| 963 |
"node_modules/detect-libc": {
|
| 964 |
"version": "2.1.2",
|
|
@@ -970,6 +1055,16 @@
|
|
| 970 |
"node": ">=8"
|
| 971 |
}
|
| 972 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 973 |
"node_modules/dotenv": {
|
| 974 |
"version": "17.4.2",
|
| 975 |
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
|
|
@@ -1058,9 +1153,9 @@
|
|
| 1058 |
}
|
| 1059 |
},
|
| 1060 |
"node_modules/is-network-error": {
|
| 1061 |
-
"version": "1.3.
|
| 1062 |
-
"resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.
|
| 1063 |
-
"integrity": "sha512-
|
| 1064 |
"license": "MIT",
|
| 1065 |
"engines": {
|
| 1066 |
"node": ">=16"
|
|
@@ -1400,6 +1495,13 @@
|
|
| 1400 |
"@jridgewell/sourcemap-codec": "^1.5.5"
|
| 1401 |
}
|
| 1402 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1403 |
"node_modules/mustache": {
|
| 1404 |
"version": "4.2.0",
|
| 1405 |
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
|
|
@@ -1440,9 +1542,9 @@
|
|
| 1440 |
"license": "MIT"
|
| 1441 |
},
|
| 1442 |
"node_modules/openai": {
|
| 1443 |
-
"version": "6.
|
| 1444 |
-
"resolved": "https://registry.npmjs.org/openai/-/openai-6.
|
| 1445 |
-
"integrity": "sha512-
|
| 1446 |
"license": "Apache-2.0",
|
| 1447 |
"bin": {
|
| 1448 |
"openai": "bin/cli"
|
|
@@ -1677,6 +1779,50 @@
|
|
| 1677 |
"node": ">=14.0.0"
|
| 1678 |
}
|
| 1679 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1680 |
"node_modules/tslib": {
|
| 1681 |
"version": "2.8.1",
|
| 1682 |
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
|
@@ -1700,9 +1846,9 @@
|
|
| 1700 |
}
|
| 1701 |
},
|
| 1702 |
"node_modules/undici-types": {
|
| 1703 |
-
"version": "7.
|
| 1704 |
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.
|
| 1705 |
-
"integrity": "sha512-
|
| 1706 |
"dev": true,
|
| 1707 |
"license": "MIT"
|
| 1708 |
},
|
|
@@ -1720,6 +1866,13 @@
|
|
| 1720 |
"uuid": "dist/bin/uuid"
|
| 1721 |
}
|
| 1722 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1723 |
"node_modules/vite": {
|
| 1724 |
"version": "8.0.11",
|
| 1725 |
"resolved": "https://registry.npmjs.org/vite/-/vite-8.0.11.tgz",
|
|
@@ -1905,6 +2058,16 @@
|
|
| 1905 |
"node": ">=8"
|
| 1906 |
}
|
| 1907 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1908 |
"node_modules/zod": {
|
| 1909 |
"version": "4.4.3",
|
| 1910 |
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
|
|
|
|
| 10 |
"license": "ISC",
|
| 11 |
"dependencies": {
|
| 12 |
"@langchain/core": "^1.1.45",
|
| 13 |
+
"@langchain/langgraph": "^1.3.2",
|
| 14 |
+
"@langchain/openai": "^1.4.6",
|
| 15 |
"@langchain/openrouter": "^0.2.4",
|
| 16 |
"dotenv": "^17.4.2",
|
| 17 |
"langchain": "^1.4.0",
|
|
|
|
| 19 |
},
|
| 20 |
"devDependencies": {
|
| 21 |
"@biomejs/biome": "2.4.14",
|
| 22 |
+
"@types/node": "^25.9.1",
|
| 23 |
+
"ts-node": "^10.9.2",
|
| 24 |
"typescript": "^6.0.3",
|
| 25 |
"vitest": "^4.1.5"
|
| 26 |
}
|
|
|
|
| 194 |
"integrity": "sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==",
|
| 195 |
"license": "MIT"
|
| 196 |
},
|
| 197 |
+
"node_modules/@cspotcode/source-map-support": {
|
| 198 |
+
"version": "0.8.1",
|
| 199 |
+
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
| 200 |
+
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
| 201 |
+
"dev": true,
|
| 202 |
+
"license": "MIT",
|
| 203 |
+
"dependencies": {
|
| 204 |
+
"@jridgewell/trace-mapping": "0.3.9"
|
| 205 |
+
},
|
| 206 |
+
"engines": {
|
| 207 |
+
"node": ">=12"
|
| 208 |
+
}
|
| 209 |
+
},
|
| 210 |
"node_modules/@emnapi/core": {
|
| 211 |
"version": "1.10.0",
|
| 212 |
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
|
|
|
| 241 |
"tslib": "^2.4.0"
|
| 242 |
}
|
| 243 |
},
|
| 244 |
+
"node_modules/@jridgewell/resolve-uri": {
|
| 245 |
+
"version": "3.1.2",
|
| 246 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
| 247 |
+
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
| 248 |
+
"dev": true,
|
| 249 |
+
"license": "MIT",
|
| 250 |
+
"engines": {
|
| 251 |
+
"node": ">=6.0.0"
|
| 252 |
+
}
|
| 253 |
+
},
|
| 254 |
"node_modules/@jridgewell/sourcemap-codec": {
|
| 255 |
"version": "1.5.5",
|
| 256 |
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
|
|
|
| 258 |
"dev": true,
|
| 259 |
"license": "MIT"
|
| 260 |
},
|
| 261 |
+
"node_modules/@jridgewell/trace-mapping": {
|
| 262 |
+
"version": "0.3.9",
|
| 263 |
+
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
| 264 |
+
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
| 265 |
+
"dev": true,
|
| 266 |
+
"license": "MIT",
|
| 267 |
+
"dependencies": {
|
| 268 |
+
"@jridgewell/resolve-uri": "^3.0.3",
|
| 269 |
+
"@jridgewell/sourcemap-codec": "^1.4.10"
|
| 270 |
+
}
|
| 271 |
+
},
|
| 272 |
"node_modules/@langchain/core": {
|
| 273 |
+
"version": "1.1.47",
|
| 274 |
+
"resolved": "https://registry.npmjs.org/@langchain/core/-/core-1.1.47.tgz",
|
| 275 |
+
"integrity": "sha512-+fiPu6ZFnJMrZyKeM77OIVPoMPAY6OKWacnPlojHtXTbMMzb2cEOKAJV0U07cDl86NHSCIYYa0i4CyKZzXbHQQ==",
|
| 276 |
"license": "MIT",
|
| 277 |
"dependencies": {
|
| 278 |
"@cfworker/json-schema": "^4.0.2",
|
| 279 |
"@standard-schema/spec": "^1.1.0",
|
|
|
|
|
|
|
|
|
|
| 280 |
"js-tiktoken": "^1.0.12",
|
| 281 |
"langsmith": ">=0.5.0 <1.0.0",
|
| 282 |
"mustache": "^4.2.0",
|
|
|
|
| 288 |
}
|
| 289 |
},
|
| 290 |
"node_modules/@langchain/langgraph": {
|
| 291 |
+
"version": "1.3.2",
|
| 292 |
+
"resolved": "https://registry.npmjs.org/@langchain/langgraph/-/langgraph-1.3.2.tgz",
|
| 293 |
+
"integrity": "sha512-SL7Ktsr681R7da+1b2MVOWEbaCoFJOXEJPTGOjg4JIG4C7quWbTYC8DzxhcCxte6D/8cGp0rYDBnbKLXEpNqlA==",
|
| 294 |
"license": "MIT",
|
| 295 |
"dependencies": {
|
| 296 |
"@langchain/langgraph-checkpoint": "^1.0.2",
|
| 297 |
+
"@langchain/langgraph-sdk": "~1.9.4",
|
| 298 |
"@langchain/protocol": "^0.0.15",
|
| 299 |
"@standard-schema/spec": "1.1.0",
|
| 300 |
"uuid": "^10.0.0"
|
|
|
|
| 329 |
}
|
| 330 |
},
|
| 331 |
"node_modules/@langchain/langgraph-sdk": {
|
| 332 |
+
"version": "1.9.4",
|
| 333 |
+
"resolved": "https://registry.npmjs.org/@langchain/langgraph-sdk/-/langgraph-sdk-1.9.4.tgz",
|
| 334 |
+
"integrity": "sha512-hhASJGKa2MDJDtDkuIFdWGysMTog/HkYe0r6B6Gn1XqsURWnF7FIFl9diITAPOv1tB8YpyjnbpsBj/NkT5d+jQ==",
|
| 335 |
"license": "MIT",
|
| 336 |
"dependencies": {
|
|
|
|
| 337 |
"@langchain/protocol": "^0.0.15",
|
| 338 |
"@types/json-schema": "^7.0.15",
|
| 339 |
"p-queue": "^9.0.1",
|
|
|
|
| 341 |
"uuid": "^13.0.0"
|
| 342 |
},
|
| 343 |
"peerDependencies": {
|
| 344 |
+
"@langchain/core": "^1.1.44",
|
| 345 |
"react": "^18 || ^19",
|
| 346 |
"react-dom": "^18 || ^19",
|
| 347 |
"svelte": "^4.0.0 || ^5.0.0",
|
|
|
|
| 369 |
"license": "MIT"
|
| 370 |
},
|
| 371 |
"node_modules/@langchain/langgraph-sdk/node_modules/p-queue": {
|
| 372 |
+
"version": "9.3.0",
|
| 373 |
+
"resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz",
|
| 374 |
+
"integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==",
|
| 375 |
"license": "MIT",
|
| 376 |
"dependencies": {
|
| 377 |
"eventemitter3": "^5.0.4",
|
|
|
|
| 410 |
}
|
| 411 |
},
|
| 412 |
"node_modules/@langchain/openai": {
|
| 413 |
+
"version": "1.4.6",
|
| 414 |
+
"resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-1.4.6.tgz",
|
| 415 |
+
"integrity": "sha512-R92/hW1aFlL9YNWLDEy1ePBnsn83kPOINNsVD+asjTJKB/00Dwf6s0VBpgZLRJiSWOW/RvbLJ/V4Djayh5boyQ==",
|
| 416 |
"license": "MIT",
|
| 417 |
"dependencies": {
|
| 418 |
"js-tiktoken": "^1.0.12",
|
| 419 |
+
"openai": "^6.37.0",
|
| 420 |
"zod": "^3.25.76 || ^4"
|
| 421 |
},
|
| 422 |
"engines": {
|
| 423 |
"node": ">=20"
|
| 424 |
},
|
| 425 |
"peerDependencies": {
|
| 426 |
+
"@langchain/core": "^1.1.47"
|
| 427 |
}
|
| 428 |
},
|
| 429 |
"node_modules/@langchain/openrouter": {
|
|
|
|
| 443 |
"@langchain/core": "^1.0.0"
|
| 444 |
}
|
| 445 |
},
|
| 446 |
+
"node_modules/@langchain/openrouter/node_modules/@langchain/openai": {
|
| 447 |
+
"version": "1.4.5",
|
| 448 |
+
"resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-1.4.5.tgz",
|
| 449 |
+
"integrity": "sha512-bQ2WMIZfSh02trJLYSAtiIcD3j6EBCiAm9nw0dZWQsVaUxmWc3JJqs8uUte6AkMazmLHzcUIw+14UkXO5fRJvQ==",
|
| 450 |
+
"license": "MIT",
|
| 451 |
+
"dependencies": {
|
| 452 |
+
"js-tiktoken": "^1.0.12",
|
| 453 |
+
"openai": "^6.34.0",
|
| 454 |
+
"zod": "^3.25.76 || ^4"
|
| 455 |
+
},
|
| 456 |
+
"engines": {
|
| 457 |
+
"node": ">=20"
|
| 458 |
+
},
|
| 459 |
+
"peerDependencies": {
|
| 460 |
+
"@langchain/core": "^1.1.42"
|
| 461 |
+
}
|
| 462 |
+
},
|
| 463 |
"node_modules/@langchain/protocol": {
|
| 464 |
"version": "0.0.15",
|
| 465 |
"resolved": "https://registry.npmjs.org/@langchain/protocol/-/protocol-0.0.15.tgz",
|
|
|
|
| 765 |
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
| 766 |
"license": "MIT"
|
| 767 |
},
|
| 768 |
+
"node_modules/@tsconfig/node10": {
|
| 769 |
+
"version": "1.0.12",
|
| 770 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",
|
| 771 |
+
"integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",
|
| 772 |
+
"dev": true,
|
| 773 |
+
"license": "MIT"
|
| 774 |
+
},
|
| 775 |
+
"node_modules/@tsconfig/node12": {
|
| 776 |
+
"version": "1.0.11",
|
| 777 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
| 778 |
+
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
| 779 |
+
"dev": true,
|
| 780 |
+
"license": "MIT"
|
| 781 |
+
},
|
| 782 |
+
"node_modules/@tsconfig/node14": {
|
| 783 |
+
"version": "1.0.3",
|
| 784 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
| 785 |
+
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
| 786 |
+
"dev": true,
|
| 787 |
+
"license": "MIT"
|
| 788 |
+
},
|
| 789 |
+
"node_modules/@tsconfig/node16": {
|
| 790 |
+
"version": "1.0.4",
|
| 791 |
+
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
| 792 |
+
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
| 793 |
+
"dev": true,
|
| 794 |
+
"license": "MIT"
|
| 795 |
+
},
|
| 796 |
"node_modules/@tybys/wasm-util": {
|
| 797 |
"version": "0.10.2",
|
| 798 |
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
|
|
|
|
| 836 |
"license": "MIT"
|
| 837 |
},
|
| 838 |
"node_modules/@types/node": {
|
| 839 |
+
"version": "25.9.1",
|
| 840 |
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.1.tgz",
|
| 841 |
+
"integrity": "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==",
|
| 842 |
"dev": true,
|
| 843 |
"license": "MIT",
|
| 844 |
"dependencies": {
|
| 845 |
+
"undici-types": ">=7.24.0 <7.24.7"
|
| 846 |
}
|
| 847 |
},
|
| 848 |
"node_modules/@vitest/expect": {
|
|
|
|
| 958 |
"url": "https://opencollective.com/vitest"
|
| 959 |
}
|
| 960 |
},
|
| 961 |
+
"node_modules/acorn": {
|
| 962 |
+
"version": "8.16.0",
|
| 963 |
+
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
| 964 |
+
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
| 965 |
+
"dev": true,
|
| 966 |
"license": "MIT",
|
| 967 |
+
"bin": {
|
| 968 |
+
"acorn": "bin/acorn"
|
| 969 |
+
},
|
| 970 |
"engines": {
|
| 971 |
+
"node": ">=0.4.0"
|
| 972 |
+
}
|
| 973 |
+
},
|
| 974 |
+
"node_modules/acorn-walk": {
|
| 975 |
+
"version": "8.3.5",
|
| 976 |
+
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz",
|
| 977 |
+
"integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==",
|
| 978 |
+
"dev": true,
|
| 979 |
+
"license": "MIT",
|
| 980 |
+
"dependencies": {
|
| 981 |
+
"acorn": "^8.11.0"
|
| 982 |
},
|
| 983 |
+
"engines": {
|
| 984 |
+
"node": ">=0.4.0"
|
| 985 |
}
|
| 986 |
},
|
| 987 |
+
"node_modules/arg": {
|
| 988 |
+
"version": "4.1.3",
|
| 989 |
+
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
| 990 |
+
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
| 991 |
+
"dev": true,
|
| 992 |
+
"license": "MIT"
|
| 993 |
+
},
|
| 994 |
"node_modules/assertion-error": {
|
| 995 |
"version": "2.0.1",
|
| 996 |
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
|
|
|
|
| 1021 |
],
|
| 1022 |
"license": "MIT"
|
| 1023 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1024 |
"node_modules/chai": {
|
| 1025 |
"version": "6.2.2",
|
| 1026 |
"resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
|
|
|
|
| 1038 |
"dev": true,
|
| 1039 |
"license": "MIT"
|
| 1040 |
},
|
| 1041 |
+
"node_modules/create-require": {
|
| 1042 |
+
"version": "1.1.1",
|
| 1043 |
+
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
| 1044 |
+
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
| 1045 |
+
"dev": true,
|
| 1046 |
+
"license": "MIT"
|
|
|
|
|
|
|
| 1047 |
},
|
| 1048 |
"node_modules/detect-libc": {
|
| 1049 |
"version": "2.1.2",
|
|
|
|
| 1055 |
"node": ">=8"
|
| 1056 |
}
|
| 1057 |
},
|
| 1058 |
+
"node_modules/diff": {
|
| 1059 |
+
"version": "4.0.4",
|
| 1060 |
+
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
| 1061 |
+
"integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==",
|
| 1062 |
+
"dev": true,
|
| 1063 |
+
"license": "BSD-3-Clause",
|
| 1064 |
+
"engines": {
|
| 1065 |
+
"node": ">=0.3.1"
|
| 1066 |
+
}
|
| 1067 |
+
},
|
| 1068 |
"node_modules/dotenv": {
|
| 1069 |
"version": "17.4.2",
|
| 1070 |
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
|
|
|
|
| 1153 |
}
|
| 1154 |
},
|
| 1155 |
"node_modules/is-network-error": {
|
| 1156 |
+
"version": "1.3.2",
|
| 1157 |
+
"resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.2.tgz",
|
| 1158 |
+
"integrity": "sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==",
|
| 1159 |
"license": "MIT",
|
| 1160 |
"engines": {
|
| 1161 |
"node": ">=16"
|
|
|
|
| 1495 |
"@jridgewell/sourcemap-codec": "^1.5.5"
|
| 1496 |
}
|
| 1497 |
},
|
| 1498 |
+
"node_modules/make-error": {
|
| 1499 |
+
"version": "1.3.6",
|
| 1500 |
+
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
| 1501 |
+
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
| 1502 |
+
"dev": true,
|
| 1503 |
+
"license": "ISC"
|
| 1504 |
+
},
|
| 1505 |
"node_modules/mustache": {
|
| 1506 |
"version": "4.2.0",
|
| 1507 |
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
|
|
|
|
| 1542 |
"license": "MIT"
|
| 1543 |
},
|
| 1544 |
"node_modules/openai": {
|
| 1545 |
+
"version": "6.38.0",
|
| 1546 |
+
"resolved": "https://registry.npmjs.org/openai/-/openai-6.38.0.tgz",
|
| 1547 |
+
"integrity": "sha512-AoMplt2UalrpgUDMh3L09QWjNRlgJPipclQvA6sYAaeF6nHNBMgmikAZGmcYLn8on4d9sQY9Q8bOLfrBS7Lc8g==",
|
| 1548 |
"license": "Apache-2.0",
|
| 1549 |
"bin": {
|
| 1550 |
"openai": "bin/cli"
|
|
|
|
| 1779 |
"node": ">=14.0.0"
|
| 1780 |
}
|
| 1781 |
},
|
| 1782 |
+
"node_modules/ts-node": {
|
| 1783 |
+
"version": "10.9.2",
|
| 1784 |
+
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
| 1785 |
+
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
| 1786 |
+
"dev": true,
|
| 1787 |
+
"license": "MIT",
|
| 1788 |
+
"dependencies": {
|
| 1789 |
+
"@cspotcode/source-map-support": "^0.8.0",
|
| 1790 |
+
"@tsconfig/node10": "^1.0.7",
|
| 1791 |
+
"@tsconfig/node12": "^1.0.7",
|
| 1792 |
+
"@tsconfig/node14": "^1.0.0",
|
| 1793 |
+
"@tsconfig/node16": "^1.0.2",
|
| 1794 |
+
"acorn": "^8.4.1",
|
| 1795 |
+
"acorn-walk": "^8.1.1",
|
| 1796 |
+
"arg": "^4.1.0",
|
| 1797 |
+
"create-require": "^1.1.0",
|
| 1798 |
+
"diff": "^4.0.1",
|
| 1799 |
+
"make-error": "^1.1.1",
|
| 1800 |
+
"v8-compile-cache-lib": "^3.0.1",
|
| 1801 |
+
"yn": "3.1.1"
|
| 1802 |
+
},
|
| 1803 |
+
"bin": {
|
| 1804 |
+
"ts-node": "dist/bin.js",
|
| 1805 |
+
"ts-node-cwd": "dist/bin-cwd.js",
|
| 1806 |
+
"ts-node-esm": "dist/bin-esm.js",
|
| 1807 |
+
"ts-node-script": "dist/bin-script.js",
|
| 1808 |
+
"ts-node-transpile-only": "dist/bin-transpile.js",
|
| 1809 |
+
"ts-script": "dist/bin-script-deprecated.js"
|
| 1810 |
+
},
|
| 1811 |
+
"peerDependencies": {
|
| 1812 |
+
"@swc/core": ">=1.2.50",
|
| 1813 |
+
"@swc/wasm": ">=1.2.50",
|
| 1814 |
+
"@types/node": "*",
|
| 1815 |
+
"typescript": ">=2.7"
|
| 1816 |
+
},
|
| 1817 |
+
"peerDependenciesMeta": {
|
| 1818 |
+
"@swc/core": {
|
| 1819 |
+
"optional": true
|
| 1820 |
+
},
|
| 1821 |
+
"@swc/wasm": {
|
| 1822 |
+
"optional": true
|
| 1823 |
+
}
|
| 1824 |
+
}
|
| 1825 |
+
},
|
| 1826 |
"node_modules/tslib": {
|
| 1827 |
"version": "2.8.1",
|
| 1828 |
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
|
|
|
| 1846 |
}
|
| 1847 |
},
|
| 1848 |
"node_modules/undici-types": {
|
| 1849 |
+
"version": "7.24.6",
|
| 1850 |
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
| 1851 |
+
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
| 1852 |
"dev": true,
|
| 1853 |
"license": "MIT"
|
| 1854 |
},
|
|
|
|
| 1866 |
"uuid": "dist/bin/uuid"
|
| 1867 |
}
|
| 1868 |
},
|
| 1869 |
+
"node_modules/v8-compile-cache-lib": {
|
| 1870 |
+
"version": "3.0.1",
|
| 1871 |
+
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
| 1872 |
+
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
| 1873 |
+
"dev": true,
|
| 1874 |
+
"license": "MIT"
|
| 1875 |
+
},
|
| 1876 |
"node_modules/vite": {
|
| 1877 |
"version": "8.0.11",
|
| 1878 |
"resolved": "https://registry.npmjs.org/vite/-/vite-8.0.11.tgz",
|
|
|
|
| 2058 |
"node": ">=8"
|
| 2059 |
}
|
| 2060 |
},
|
| 2061 |
+
"node_modules/yn": {
|
| 2062 |
+
"version": "3.1.1",
|
| 2063 |
+
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
| 2064 |
+
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
| 2065 |
+
"dev": true,
|
| 2066 |
+
"license": "MIT",
|
| 2067 |
+
"engines": {
|
| 2068 |
+
"node": ">=6"
|
| 2069 |
+
}
|
| 2070 |
+
},
|
| 2071 |
"node_modules/zod": {
|
| 2072 |
"version": "4.4.3",
|
| 2073 |
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
|
package.json
CHANGED
|
@@ -22,13 +22,15 @@
|
|
| 22 |
"homepage": "https://github.com/uandersonricardo/projeto-talp1#readme",
|
| 23 |
"devDependencies": {
|
| 24 |
"@biomejs/biome": "2.4.14",
|
| 25 |
-
"@types/node": "^25.
|
|
|
|
| 26 |
"typescript": "^6.0.3",
|
| 27 |
"vitest": "^4.1.5"
|
| 28 |
},
|
| 29 |
"dependencies": {
|
| 30 |
"@langchain/core": "^1.1.45",
|
| 31 |
-
"@langchain/langgraph": "^1.3.
|
|
|
|
| 32 |
"@langchain/openrouter": "^0.2.4",
|
| 33 |
"dotenv": "^17.4.2",
|
| 34 |
"langchain": "^1.4.0",
|
|
|
|
| 22 |
"homepage": "https://github.com/uandersonricardo/projeto-talp1#readme",
|
| 23 |
"devDependencies": {
|
| 24 |
"@biomejs/biome": "2.4.14",
|
| 25 |
+
"@types/node": "^25.9.1",
|
| 26 |
+
"ts-node": "^10.9.2",
|
| 27 |
"typescript": "^6.0.3",
|
| 28 |
"vitest": "^4.1.5"
|
| 29 |
},
|
| 30 |
"dependencies": {
|
| 31 |
"@langchain/core": "^1.1.45",
|
| 32 |
+
"@langchain/langgraph": "^1.3.2",
|
| 33 |
+
"@langchain/openai": "^1.4.6",
|
| 34 |
"@langchain/openrouter": "^0.2.4",
|
| 35 |
"dotenv": "^17.4.2",
|
| 36 |
"langchain": "^1.4.0",
|
src/agents/tester/agent.ts
CHANGED
|
@@ -1,13 +1,35 @@
|
|
| 1 |
-
import {
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
};
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
.
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { StateGraph, END, START } from "@langchain/langgraph";
|
| 2 |
+
import { PoCStateAnnotation, PoCState } from "./state.js";
|
| 3 |
|
| 4 |
+
async function oracleNode(state: PoCState): Promise<Partial<PoCState>> {
|
| 5 |
+
console.log("[oracleNode] stub — report recebido:", state.report.id);
|
| 6 |
+
return {};
|
| 7 |
+
}
|
| 8 |
|
| 9 |
+
async function generatePoCNode(state: PoCState): Promise<Partial<PoCState>> {
|
| 10 |
+
console.log("[generatePoCNode] stub — iteração:", state.iterations);
|
| 11 |
+
return { iterations: 1 };
|
| 12 |
+
}
|
| 13 |
|
| 14 |
+
async function runFoundryNode(state: PoCState): Promise<Partial<PoCState>> {
|
| 15 |
+
console.log("[runFoundryNode] stub");
|
| 16 |
+
return { status: "success" };
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
async function reflectNode(state: PoCState): Promise<Partial<PoCState>> {
|
| 20 |
+
console.log("[reflectNode] stub");
|
| 21 |
+
return {};
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
const graph = new StateGraph(PoCStateAnnotation)
|
| 25 |
+
.addNode("oracleNode", oracleNode)
|
| 26 |
+
.addNode("generatePoCNode", generatePoCNode)
|
| 27 |
+
.addNode("runFoundryNode", runFoundryNode)
|
| 28 |
+
.addNode("reflectNode", reflectNode)
|
| 29 |
+
.addEdge(START, "oracleNode")
|
| 30 |
+
.addEdge("oracleNode", "generatePoCNode")
|
| 31 |
+
.addEdge("generatePoCNode", "runFoundryNode")
|
| 32 |
+
.addEdge("runFoundryNode", "reflectNode")
|
| 33 |
+
.addEdge("reflectNode", END);
|
| 34 |
+
|
| 35 |
+
export const testerAgent = graph.compile();
|
src/agents/tester/state.ts
CHANGED
|
@@ -1,8 +1,38 @@
|
|
| 1 |
-
import {
|
| 2 |
-
import {
|
| 3 |
|
| 4 |
-
export const
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
});
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Annotation } from "@langchain/langgraph";
|
| 2 |
+
import { VulnerabilityReport, OracleContext } from "./types.js";
|
| 3 |
|
| 4 |
+
export const PoCStateAnnotation = Annotation.Root({
|
| 5 |
+
report: Annotation<VulnerabilityReport>(),
|
| 6 |
+
|
| 7 |
+
oracleContext: Annotation<OracleContext | null>({
|
| 8 |
+
default: () => null,
|
| 9 |
+
reducer: (_, y) => y, // overwrite — filled once by oracleNode
|
| 10 |
+
}),
|
| 11 |
+
|
| 12 |
+
pocCode: Annotation<string>({
|
| 13 |
+
default: () => "",
|
| 14 |
+
reducer: (_, y) => y, // overwrite — always latest version
|
| 15 |
+
}),
|
| 16 |
+
|
| 17 |
+
executionLogs: Annotation<string[]>({
|
| 18 |
+
default: () => [],
|
| 19 |
+
reducer: (x, y) => x.concat(y), // append — never lose previous logs
|
| 20 |
+
}),
|
| 21 |
+
|
| 22 |
+
lastError: Annotation<string | null>({
|
| 23 |
+
default: () => null,
|
| 24 |
+
reducer: (_, y) => y, // overwrite — last error analysis
|
| 25 |
+
}),
|
| 26 |
+
|
| 27 |
+
iterations: Annotation<number>({
|
| 28 |
+
default: () => 0,
|
| 29 |
+
reducer: (x, y) => x + y, // additive — incremented by +1 per call
|
| 30 |
+
}),
|
| 31 |
+
|
| 32 |
+
status: Annotation<"running" | "success" | "failed" | "timeout">({
|
| 33 |
+
default: () => "running",
|
| 34 |
+
reducer: (_, y) => y, // overwrite
|
| 35 |
+
}),
|
| 36 |
});
|
| 37 |
+
|
| 38 |
+
export type PoCState = typeof PoCStateAnnotation.State;
|
src/agents/tester/types.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface VulnerabilityReport {
|
| 2 |
+
id: string;
|
| 3 |
+
severity: "critical" | "high" | "medium" | "low";
|
| 4 |
+
type: string;
|
| 5 |
+
title: string;
|
| 6 |
+
description: string;
|
| 7 |
+
affectedContract: {
|
| 8 |
+
name: string;
|
| 9 |
+
sourceCode: string; // Solidity completo, preferencialmente flattened
|
| 10 |
+
};
|
| 11 |
+
attackVector: string;
|
| 12 |
+
suggestedCheatcodes?: string[];
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export interface OracleContext {
|
| 16 |
+
solidityScaffold: string; // Exploit.t.sol parcial com setUp() pronto
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
export interface PoCResult {
|
| 20 |
+
reportId: string;
|
| 21 |
+
status: "success" | "failed" | "timeout";
|
| 22 |
+
solidityCode: string;
|
| 23 |
+
executionLogs: string[];
|
| 24 |
+
iterations: number;
|
| 25 |
+
}
|
src/index.ts
CHANGED
|
@@ -3,20 +3,36 @@ import "dotenv/config";
|
|
| 3 |
import { auditorAgent } from "./agents/auditor/agent.ts";
|
| 4 |
import { coderAgent } from "./agents/coder/agent.ts";
|
| 5 |
import { testerAgent } from "./agents/tester/agent.ts";
|
|
|
|
| 6 |
|
| 7 |
const requirements = ["ERC20 token", "pausable", "ownable"];
|
| 8 |
|
| 9 |
const coderResult = await coderAgent.invoke({ requirements });
|
| 10 |
console.log("======= Coder =======");
|
| 11 |
-
console.log(coderResult.contract);
|
| 12 |
|
| 13 |
const auditorResult = await auditorAgent.invoke({ solidityFile: coderResult.contract });
|
| 14 |
console.log("\n======= Auditor =======");
|
| 15 |
-
console.log(auditorResult.vulnerabilities);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
const testerResult = await testerAgent.invoke({
|
| 18 |
-
|
| 19 |
-
vulnerability: auditorResult.vulnerabilities[0] ?? {},
|
| 20 |
});
|
|
|
|
| 21 |
console.log("\n======= Tester =======");
|
| 22 |
-
console.log(testerResult.
|
|
|
|
|
|
| 3 |
import { auditorAgent } from "./agents/auditor/agent.ts";
|
| 4 |
import { coderAgent } from "./agents/coder/agent.ts";
|
| 5 |
import { testerAgent } from "./agents/tester/agent.ts";
|
| 6 |
+
import type { VulnerabilityReport } from "./agents/tester/types.ts";
|
| 7 |
|
| 8 |
const requirements = ["ERC20 token", "pausable", "ownable"];
|
| 9 |
|
| 10 |
const coderResult = await coderAgent.invoke({ requirements });
|
| 11 |
console.log("======= Coder =======");
|
| 12 |
+
// console.log(coderResult.contract);
|
| 13 |
|
| 14 |
const auditorResult = await auditorAgent.invoke({ solidityFile: coderResult.contract });
|
| 15 |
console.log("\n======= Auditor =======");
|
| 16 |
+
// console.log(auditorResult.vulnerabilities);
|
| 17 |
+
|
| 18 |
+
// Mapeamento temporário para satisfazer o novo estado do testerAgent
|
| 19 |
+
const mockReport: VulnerabilityReport = {
|
| 20 |
+
id: "test-001",
|
| 21 |
+
severity: "high",
|
| 22 |
+
type: "reentrancy",
|
| 23 |
+
title: "Vulnerabilidade Detectada",
|
| 24 |
+
description: "Descrição da vulnerabilidade",
|
| 25 |
+
affectedContract: {
|
| 26 |
+
name: "Contract",
|
| 27 |
+
sourceCode: coderResult.contract,
|
| 28 |
+
},
|
| 29 |
+
attackVector: "Vetor de ataque",
|
| 30 |
+
};
|
| 31 |
|
| 32 |
const testerResult = await testerAgent.invoke({
|
| 33 |
+
report: mockReport,
|
|
|
|
| 34 |
});
|
| 35 |
+
|
| 36 |
console.log("\n======= Tester =======");
|
| 37 |
+
console.log("Status:", testerResult.status);
|
| 38 |
+
console.log("Iterations:", testerResult.iterations);
|
tests/state.test.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PoCStateAnnotation } from "../src/agents/tester/state.js";
|
| 2 |
+
|
| 3 |
+
const s = (PoCStateAnnotation as any).spec;
|
| 4 |
+
if (s.iterations !== undefined) {
|
| 5 |
+
console.log("Estado OK: iterations existe");
|
| 6 |
+
} else {
|
| 7 |
+
console.error("Erro: iterations não existe no spec");
|
| 8 |
+
process.exit(1);
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
// Teste de reducer aditivo para iterations
|
| 12 |
+
const iterationsSpec = s.iterations;
|
| 13 |
+
const initial = 0;
|
| 14 |
+
const update = 1;
|
| 15 |
+
const result = (iterationsSpec.reducer || ((x: number, y: number) => x + y))(initial, update);
|
| 16 |
+
if (result === 1) {
|
| 17 |
+
console.log("Reducer aditivo OK: 0 + 1 = 1");
|
| 18 |
+
} else {
|
| 19 |
+
console.error(`Erro no reducer aditivo: esperado 1, recebido ${result}`);
|
| 20 |
+
process.exit(1);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
console.log("Teste de estado concluído com sucesso");
|
tests/stub-run.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { testerAgent } from "../src/agents/tester/agent.js";
|
| 2 |
+
|
| 3 |
+
const mockReport = {
|
| 4 |
+
id: "test-stub",
|
| 5 |
+
severity: "high" as const,
|
| 6 |
+
type: "reentrancy",
|
| 7 |
+
title: "Test",
|
| 8 |
+
description: "Test",
|
| 9 |
+
attackVector: "Test",
|
| 10 |
+
affectedContract: { name: "Test", sourceCode: "pragma solidity ^0.8.0;" }
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
const result = await testerAgent.invoke({ report: mockReport });
|
| 14 |
+
|
| 15 |
+
console.assert(result.status === "success", `status deve ser success, mas foi ${result.status}`);
|
| 16 |
+
console.assert(result.iterations === 1, `iterations deve ser 1, mas foi ${result.iterations}`);
|
| 17 |
+
|
| 18 |
+
console.log("Grafo stub OK:", result.status);
|
| 19 |
+
console.log("Iterations:", result.iterations);
|
tsconfig.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
"outDir": "./dist",
|
| 9 |
"moduleResolution": "nodenext",
|
| 10 |
"module": "nodenext",
|
| 11 |
-
"target": "
|
| 12 |
"types": [
|
| 13 |
"node"
|
| 14 |
],
|
|
|
|
| 8 |
"outDir": "./dist",
|
| 9 |
"moduleResolution": "nodenext",
|
| 10 |
"module": "nodenext",
|
| 11 |
+
"target": "ES2022",
|
| 12 |
"types": [
|
| 13 |
"node"
|
| 14 |
],
|