onbuzz 3.3.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/LICENSE +267 -0
- package/README.md +425 -0
- package/bin/cli.js +556 -0
- package/bin/loxia-terminal-v2.js +162 -0
- package/bin/loxia-terminal.js +90 -0
- package/bin/start-with-terminal.js +200 -0
- package/node_modules/@isaacs/balanced-match/LICENSE.md +23 -0
- package/node_modules/@isaacs/balanced-match/README.md +60 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts +9 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts +9 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/balanced-match/package.json +79 -0
- package/node_modules/@isaacs/brace-expansion/LICENSE +23 -0
- package/node_modules/@isaacs/brace-expansion/README.md +97 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts +6 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +199 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts +6 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.js +195 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/brace-expansion/package.json +60 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1177 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts +388 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/glob.js +247 -0
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/glob/dist/commonjs/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts +76 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/pattern.js +219 -0
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
- package/node_modules/glob/dist/esm/glob.d.ts +388 -0
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/glob.js +243 -0
- package/node_modules/glob/dist/esm/glob.js.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.js +23 -0
- package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
- package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
- package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/ignore.js +115 -0
- package/node_modules/glob/dist/esm/ignore.js.map +1 -0
- package/node_modules/glob/dist/esm/index.d.ts +97 -0
- package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.js.map +1 -0
- package/node_modules/glob/dist/esm/index.min.js +4 -0
- package/node_modules/glob/dist/esm/index.min.js.map +7 -0
- package/node_modules/glob/dist/esm/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.d.ts +76 -0
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/pattern.js +215 -0
- package/node_modules/glob/dist/esm/pattern.js.map +1 -0
- package/node_modules/glob/dist/esm/processor.d.ts +59 -0
- package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/processor.js +294 -0
- package/node_modules/glob/dist/esm/processor.js.map +1 -0
- package/node_modules/glob/dist/esm/walker.d.ts +97 -0
- package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/walker.js +381 -0
- package/node_modules/glob/dist/esm/walker.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/glob/node_modules/minimatch/README.md +453 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js +591 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js +1029 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js +587 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts +94 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.js +1016 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/package.json +67 -0
- package/node_modules/glob/package.json +101 -0
- package/node_modules/minipass/LICENSE +15 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1018 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +82 -0
- package/node_modules/package-json-from-dist/LICENSE.md +63 -0
- package/node_modules/package-json-from-dist/README.md +110 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +89 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.js +134 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +1 -0
- package/node_modules/package-json-from-dist/dist/commonjs/package.json +3 -0
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts +89 -0
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +1 -0
- package/node_modules/package-json-from-dist/dist/esm/index.js +129 -0
- package/node_modules/package-json-from-dist/dist/esm/index.js.map +1 -0
- package/node_modules/package-json-from-dist/dist/esm/package.json +3 -0
- package/node_modules/package-json-from-dist/package.json +68 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +636 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
- package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/esm/index.js +1983 -0
- package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/path-scurry/node_modules/lru-cache/README.md +383 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts +1323 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1589 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts +1323 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1585 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/package.json +101 -0
- package/node_modules/path-scurry/package.json +88 -0
- package/node_modules/rimraf/LICENSE.md +55 -0
- package/node_modules/rimraf/README.md +226 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.js +58 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/error.d.ts +6 -0
- package/node_modules/rimraf/dist/commonjs/error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/error.js +10 -0
- package/node_modules/rimraf/dist/commonjs/error.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.js +38 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fs.d.ts +15 -0
- package/node_modules/rimraf/dist/commonjs/fs.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fs.js +33 -0
- package/node_modules/rimraf/dist/commonjs/fs.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.js +24 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/index.d.ts +50 -0
- package/node_modules/rimraf/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/index.js +78 -0
- package/node_modules/rimraf/dist/commonjs/index.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts +34 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.js +53 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/package.json +3 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.js +48 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.js +19 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts +8 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.js +65 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.js +8 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js +138 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.js +24 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.js +103 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.js +159 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/use-native.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/use-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/use-native.js +18 -0
- package/node_modules/rimraf/dist/commonjs/use-native.js.map +1 -0
- package/node_modules/rimraf/dist/esm/bin.d.mts +3 -0
- package/node_modules/rimraf/dist/esm/bin.d.mts.map +1 -0
- package/node_modules/rimraf/dist/esm/bin.mjs +250 -0
- package/node_modules/rimraf/dist/esm/bin.mjs.map +1 -0
- package/node_modules/rimraf/dist/esm/default-tmp.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/default-tmp.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/default-tmp.js +55 -0
- package/node_modules/rimraf/dist/esm/default-tmp.js.map +1 -0
- package/node_modules/rimraf/dist/esm/error.d.ts +6 -0
- package/node_modules/rimraf/dist/esm/error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/error.js +5 -0
- package/node_modules/rimraf/dist/esm/error.js.map +1 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.js +33 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.js.map +1 -0
- package/node_modules/rimraf/dist/esm/fs.d.ts +15 -0
- package/node_modules/rimraf/dist/esm/fs.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/fs.js +18 -0
- package/node_modules/rimraf/dist/esm/fs.js.map +1 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.js +19 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.js.map +1 -0
- package/node_modules/rimraf/dist/esm/index.d.ts +50 -0
- package/node_modules/rimraf/dist/esm/index.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/index.js +70 -0
- package/node_modules/rimraf/dist/esm/index.js.map +1 -0
- package/node_modules/rimraf/dist/esm/opt-arg.d.ts +34 -0
- package/node_modules/rimraf/dist/esm/opt-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/opt-arg.js +46 -0
- package/node_modules/rimraf/dist/esm/opt-arg.js.map +1 -0
- package/node_modules/rimraf/dist/esm/package.json +3 -0
- package/node_modules/rimraf/dist/esm/path-arg.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/path-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/path-arg.js +46 -0
- package/node_modules/rimraf/dist/esm/path-arg.js.map +1 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.js +14 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.js.map +1 -0
- package/node_modules/rimraf/dist/esm/retry-busy.d.ts +8 -0
- package/node_modules/rimraf/dist/esm/retry-busy.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/retry-busy.js +60 -0
- package/node_modules/rimraf/dist/esm/retry-busy.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.js +5 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.js +133 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.js +19 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.js +98 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.js +154 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.js.map +1 -0
- package/node_modules/rimraf/dist/esm/use-native.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/use-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/use-native.js +15 -0
- package/node_modules/rimraf/dist/esm/use-native.js.map +1 -0
- package/node_modules/rimraf/package.json +92 -0
- package/package.json +152 -0
- package/scripts/install-scanners.js +258 -0
- package/scripts/watchdog.js +147 -0
- package/src/analyzers/CSSAnalyzer.js +297 -0
- package/src/analyzers/ConfigValidator.js +690 -0
- package/src/analyzers/ESLintAnalyzer.js +320 -0
- package/src/analyzers/JavaScriptAnalyzer.js +261 -0
- package/src/analyzers/PrettierFormatter.js +247 -0
- package/src/analyzers/PythonAnalyzer.js +283 -0
- package/src/analyzers/SecurityAnalyzer.js +729 -0
- package/src/analyzers/SparrowAnalyzer.js +341 -0
- package/src/analyzers/TypeScriptAnalyzer.js +247 -0
- package/src/analyzers/codeCloneDetector/analyzer.js +344 -0
- package/src/analyzers/codeCloneDetector/detector.js +250 -0
- package/src/analyzers/codeCloneDetector/index.js +192 -0
- package/src/analyzers/codeCloneDetector/parser.js +199 -0
- package/src/analyzers/codeCloneDetector/reporter.js +148 -0
- package/src/analyzers/codeCloneDetector/scanner.js +88 -0
- package/src/core/agentPool.js +1957 -0
- package/src/core/agentScheduler.js +3212 -0
- package/src/core/contextManager.js +709 -0
- package/src/core/flowExecutor.js +928 -0
- package/src/core/messageProcessor.js +808 -0
- package/src/core/orchestrator.js +584 -0
- package/src/core/stateManager.js +1500 -0
- package/src/index.js +972 -0
- package/src/interfaces/cli.js +553 -0
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +208 -0
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +236 -0
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +138 -0
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +137 -0
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +350 -0
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +156 -0
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +332 -0
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +256 -0
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +388 -0
- package/src/interfaces/terminal/api/apiClient.js +299 -0
- package/src/interfaces/terminal/api/messageRouter.js +262 -0
- package/src/interfaces/terminal/api/session.js +266 -0
- package/src/interfaces/terminal/api/websocket.js +497 -0
- package/src/interfaces/terminal/components/AgentCreator.js +705 -0
- package/src/interfaces/terminal/components/AgentEditor.js +678 -0
- package/src/interfaces/terminal/components/AgentSwitcher.js +330 -0
- package/src/interfaces/terminal/components/ErrorBoundary.js +92 -0
- package/src/interfaces/terminal/components/ErrorPanel.js +264 -0
- package/src/interfaces/terminal/components/Header.js +28 -0
- package/src/interfaces/terminal/components/HelpPanel.js +231 -0
- package/src/interfaces/terminal/components/InputBox.js +118 -0
- package/src/interfaces/terminal/components/Layout.js +603 -0
- package/src/interfaces/terminal/components/LoadingSpinner.js +71 -0
- package/src/interfaces/terminal/components/MessageList.js +281 -0
- package/src/interfaces/terminal/components/MultilineTextInput.js +251 -0
- package/src/interfaces/terminal/components/SearchPanel.js +265 -0
- package/src/interfaces/terminal/components/SettingsPanel.js +415 -0
- package/src/interfaces/terminal/components/StatusBar.js +65 -0
- package/src/interfaces/terminal/components/TextInput.js +127 -0
- package/src/interfaces/terminal/config/agentEditorConstants.js +227 -0
- package/src/interfaces/terminal/config/constants.js +393 -0
- package/src/interfaces/terminal/index.js +168 -0
- package/src/interfaces/terminal/state/useAgentControl.js +496 -0
- package/src/interfaces/terminal/state/useAgents.js +537 -0
- package/src/interfaces/terminal/state/useConnection.js +444 -0
- package/src/interfaces/terminal/state/useMessages.js +630 -0
- package/src/interfaces/terminal/state/useTools.js +554 -0
- package/src/interfaces/terminal/utils/debugLogger.js +44 -0
- package/src/interfaces/terminal/utils/settingsStorage.js +232 -0
- package/src/interfaces/terminal/utils/theme.js +85 -0
- package/src/interfaces/webServer.js +5457 -0
- package/src/modules/fileExplorer/controller.js +413 -0
- package/src/modules/fileExplorer/index.js +37 -0
- package/src/modules/fileExplorer/middleware.js +92 -0
- package/src/modules/fileExplorer/routes.js +158 -0
- package/src/modules/fileExplorer/types.js +44 -0
- package/src/services/agentActivityService.js +399 -0
- package/src/services/aiService.js +2618 -0
- package/src/services/apiKeyManager.js +334 -0
- package/src/services/benchmarkService.js +196 -0
- package/src/services/budgetService.js +565 -0
- package/src/services/contextInjectionService.js +268 -0
- package/src/services/conversationCompactionService.js +1103 -0
- package/src/services/credentialVault.js +685 -0
- package/src/services/errorHandler.js +810 -0
- package/src/services/fileAttachmentService.js +547 -0
- package/src/services/flowContextService.js +189 -0
- package/src/services/memoryService.js +521 -0
- package/src/services/modelRouterService.js +365 -0
- package/src/services/modelsService.js +323 -0
- package/src/services/ollamaService.js +452 -0
- package/src/services/portRegistry.js +336 -0
- package/src/services/portTracker.js +223 -0
- package/src/services/projectDetector.js +404 -0
- package/src/services/promptService.js +372 -0
- package/src/services/qualityInspector.js +796 -0
- package/src/services/scheduleService.js +725 -0
- package/src/services/serviceRegistry.js +386 -0
- package/src/services/skillsService.js +486 -0
- package/src/services/telegramService.js +920 -0
- package/src/services/tokenCountingService.js +316 -0
- package/src/services/visualEditorBridge.js +1033 -0
- package/src/services/visualEditorServer.js +1727 -0
- package/src/services/whatsappService.js +663 -0
- package/src/tools/__tests__/webTool.e2e.test.js +569 -0
- package/src/tools/__tests__/webTool.unit.test.js +195 -0
- package/src/tools/agentCommunicationTool.js +1343 -0
- package/src/tools/agentDelayTool.js +498 -0
- package/src/tools/asyncToolManager.js +604 -0
- package/src/tools/baseTool.js +887 -0
- package/src/tools/browserTool.js +897 -0
- package/src/tools/cloneDetectionTool.js +581 -0
- package/src/tools/codeMapTool.js +857 -0
- package/src/tools/dependencyResolverTool.js +1212 -0
- package/src/tools/docxTool.js +623 -0
- package/src/tools/excelTool.js +636 -0
- package/src/tools/fileContentReplaceTool.js +840 -0
- package/src/tools/fileTreeTool.js +833 -0
- package/src/tools/filesystemTool.js +1217 -0
- package/src/tools/helpTool.js +198 -0
- package/src/tools/imageTool.js +1034 -0
- package/src/tools/importAnalyzerTool.js +1056 -0
- package/src/tools/jobDoneTool.js +388 -0
- package/src/tools/memoryTool.js +554 -0
- package/src/tools/pdfTool.js +627 -0
- package/src/tools/seekTool.js +883 -0
- package/src/tools/skillsTool.js +276 -0
- package/src/tools/staticAnalysisTool.js +2146 -0
- package/src/tools/taskManagerTool.js +2836 -0
- package/src/tools/terminalTool.js +2486 -0
- package/src/tools/userPromptTool.js +474 -0
- package/src/tools/videoTool.js +1139 -0
- package/src/tools/visionTool.js +507 -0
- package/src/tools/visualEditorTool.js +1175 -0
- package/src/tools/webTool.js +3114 -0
- package/src/tools/whatsappTool.js +457 -0
- package/src/types/agent.js +519 -0
- package/src/types/contextReference.js +972 -0
- package/src/types/conversation.js +730 -0
- package/src/types/toolCommand.js +747 -0
- package/src/utilities/attachmentValidator.js +288 -0
- package/src/utilities/browserStealth.js +630 -0
- package/src/utilities/configManager.js +618 -0
- package/src/utilities/constants.js +870 -0
- package/src/utilities/directoryAccessManager.js +566 -0
- package/src/utilities/fileProcessor.js +307 -0
- package/src/utilities/humanBehavior.js +453 -0
- package/src/utilities/jsonRepair.js +242 -0
- package/src/utilities/logger.js +436 -0
- package/src/utilities/platformUtils.js +255 -0
- package/src/utilities/platformUtils.test.js +98 -0
- package/src/utilities/stealthConstants.js +377 -0
- package/src/utilities/structuredFileValidator.js +699 -0
- package/src/utilities/tagParser.js +878 -0
- package/src/utilities/toolConstants.js +415 -0
- package/src/utilities/userDataDir.js +300 -0
- package/web-ui/build/brands/autopilot/favicon.svg +1 -0
- package/web-ui/build/brands/autopilot/logo.webp +0 -0
- package/web-ui/build/brands/onbuzz/favicon.svg +1 -0
- package/web-ui/build/brands/onbuzz/logo-text.webp +0 -0
- package/web-ui/build/brands/onbuzz/logo.webp +0 -0
- package/web-ui/build/index.html +15 -0
- package/web-ui/build/logo.png +0 -0
- package/web-ui/build/logo2.png +0 -0
- package/web-ui/build/static/index-SmQFfvBs.js +746 -0
- package/web-ui/build/static/index-V2ySwjHp.css +1 -0
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowExecutor - Executes visual flow pipelines
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* - Execute flow nodes in topologically sorted order
|
|
6
|
+
* - Queue messages to agents via MessageProcessor
|
|
7
|
+
* - Detect completion via jobdone tool results
|
|
8
|
+
* - Track node states and outputs
|
|
9
|
+
* - Broadcast execution progress via WebSocket
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { AGENT_MODES } from '../utilities/constants.js';
|
|
13
|
+
|
|
14
|
+
class FlowExecutor {
|
|
15
|
+
constructor(config, logger, stateManager, agentPool, messageProcessor) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.logger = logger;
|
|
18
|
+
this.stateManager = stateManager;
|
|
19
|
+
this.agentPool = agentPool;
|
|
20
|
+
this.messageProcessor = messageProcessor;
|
|
21
|
+
|
|
22
|
+
// WebSocket manager for broadcasting progress
|
|
23
|
+
this.webSocketManager = null;
|
|
24
|
+
|
|
25
|
+
// Active flow executions
|
|
26
|
+
this.activeExecutions = new Map();
|
|
27
|
+
|
|
28
|
+
// Completion listeners per run
|
|
29
|
+
this.completionListeners = new Map();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Set WebSocket manager for real-time updates
|
|
34
|
+
* @param {Object} webSocketManager - WebSocket manager instance
|
|
35
|
+
*/
|
|
36
|
+
setWebSocketManager(webSocketManager) {
|
|
37
|
+
this.webSocketManager = webSocketManager;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Execute a flow
|
|
42
|
+
* @param {string} flowId - Flow identifier
|
|
43
|
+
* @param {Object} initialInput - Initial input data
|
|
44
|
+
* @param {string} sessionId - WebSocket session ID for broadcasts
|
|
45
|
+
* @returns {Promise<Object>} Flow run result
|
|
46
|
+
*/
|
|
47
|
+
async executeFlow(flowId, initialInput = {}, sessionId = null) {
|
|
48
|
+
// Load flow definition
|
|
49
|
+
const flow = await this.stateManager.getFlow(flowId);
|
|
50
|
+
if (!flow) {
|
|
51
|
+
throw new Error(`Flow not found: ${flowId}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Create flow run record
|
|
55
|
+
const run = await this.stateManager.createFlowRun(flowId, initialInput);
|
|
56
|
+
const runId = run.id;
|
|
57
|
+
|
|
58
|
+
this.logger.info(`Starting flow execution: ${flowId}`, {
|
|
59
|
+
runId,
|
|
60
|
+
nodeCount: flow.nodes?.length || 0,
|
|
61
|
+
edgeCount: flow.edges?.length || 0
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Track this execution
|
|
65
|
+
this.activeExecutions.set(runId, {
|
|
66
|
+
flowId,
|
|
67
|
+
flow,
|
|
68
|
+
runId,
|
|
69
|
+
sessionId,
|
|
70
|
+
status: 'running',
|
|
71
|
+
startedAt: new Date()
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Update run status to running
|
|
75
|
+
await this.stateManager.updateFlowRun(runId, { status: 'running' });
|
|
76
|
+
const startedAt = new Date().toISOString();
|
|
77
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
78
|
+
type: 'flow_run_started',
|
|
79
|
+
runId,
|
|
80
|
+
flowId,
|
|
81
|
+
status: 'running',
|
|
82
|
+
startedAt
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
// Ensure all referenced agents are loaded before execution
|
|
87
|
+
await this.ensureAgentsLoaded(flow.nodes);
|
|
88
|
+
|
|
89
|
+
// Topologically sort nodes
|
|
90
|
+
const sortedNodes = this.topologicalSort(flow.nodes, flow.edges);
|
|
91
|
+
|
|
92
|
+
if (sortedNodes.length === 0) {
|
|
93
|
+
throw new Error('Flow has no executable nodes');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Initialize execution context
|
|
97
|
+
const context = {
|
|
98
|
+
input: initialInput.userInput || initialInput.input || '',
|
|
99
|
+
nodeOutputs: {},
|
|
100
|
+
variables: { ...flow.variables },
|
|
101
|
+
sortedNodes, // Store for position tracking
|
|
102
|
+
flow // Store flow reference
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Execute nodes in order
|
|
106
|
+
for (const node of sortedNodes) {
|
|
107
|
+
// Check if execution was stopped
|
|
108
|
+
const execution = this.activeExecutions.get(runId);
|
|
109
|
+
if (!execution || execution.status === 'stopped') {
|
|
110
|
+
this.logger.info(`Flow execution stopped: ${runId}`);
|
|
111
|
+
await this.stateManager.updateFlowRun(runId, {
|
|
112
|
+
status: 'stopped',
|
|
113
|
+
completedAt: new Date().toISOString()
|
|
114
|
+
});
|
|
115
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
116
|
+
type: 'flow_run_stopped',
|
|
117
|
+
runId,
|
|
118
|
+
flowId
|
|
119
|
+
});
|
|
120
|
+
return { runId, status: 'stopped' };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Execute node
|
|
124
|
+
const nodeResult = await this.executeNode(node, context, runId, sessionId, flow);
|
|
125
|
+
|
|
126
|
+
// Store node output by node ID
|
|
127
|
+
context.nodeOutputs[node.id] = nodeResult;
|
|
128
|
+
|
|
129
|
+
// Also store by outputKey if specified (for named references like {{result}})
|
|
130
|
+
if (node.data?.outputKey) {
|
|
131
|
+
context.nodeOutputs[node.data.outputKey] = nodeResult;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Update node state in run
|
|
135
|
+
await this.updateNodeState(runId, node.id, 'completed', nodeResult);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Flow completed successfully
|
|
139
|
+
const finalOutput = this.collectFinalOutput(sortedNodes, context);
|
|
140
|
+
|
|
141
|
+
await this.stateManager.updateFlowRun(runId, {
|
|
142
|
+
status: 'completed',
|
|
143
|
+
output: finalOutput,
|
|
144
|
+
completedAt: new Date().toISOString()
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
148
|
+
type: 'flow_run_completed',
|
|
149
|
+
runId,
|
|
150
|
+
flowId,
|
|
151
|
+
output: finalOutput
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
this.activeExecutions.delete(runId);
|
|
155
|
+
|
|
156
|
+
this.logger.info(`Flow execution completed: ${flowId}`, { runId });
|
|
157
|
+
|
|
158
|
+
return { runId, status: 'completed', output: finalOutput };
|
|
159
|
+
|
|
160
|
+
} catch (error) {
|
|
161
|
+
this.logger.error(`Flow execution failed: ${flowId}`, {
|
|
162
|
+
runId,
|
|
163
|
+
error: error.message
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
await this.stateManager.updateFlowRun(runId, {
|
|
167
|
+
status: 'failed',
|
|
168
|
+
error: error.message,
|
|
169
|
+
completedAt: new Date().toISOString()
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
173
|
+
type: 'flow_run_failed',
|
|
174
|
+
runId,
|
|
175
|
+
flowId,
|
|
176
|
+
error: error.message
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
this.activeExecutions.delete(runId);
|
|
180
|
+
|
|
181
|
+
return { runId, status: 'failed', error: error.message };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Stop a flow execution
|
|
187
|
+
* @param {string} runId - Run identifier
|
|
188
|
+
* @returns {Promise<boolean>} True if stopped
|
|
189
|
+
*/
|
|
190
|
+
async stopExecution(runId) {
|
|
191
|
+
const execution = this.activeExecutions.get(runId);
|
|
192
|
+
if (!execution) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
execution.status = 'stopped';
|
|
197
|
+
|
|
198
|
+
// Clean up any completion listeners
|
|
199
|
+
this.completionListeners.delete(runId);
|
|
200
|
+
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Ensure all agents referenced in the flow are loaded
|
|
206
|
+
* Automatically loads unloaded agents from disk
|
|
207
|
+
* @param {Array} nodes - Flow nodes
|
|
208
|
+
* @returns {Promise<void>}
|
|
209
|
+
*/
|
|
210
|
+
async ensureAgentsLoaded(nodes) {
|
|
211
|
+
if (!nodes || nodes.length === 0) return;
|
|
212
|
+
|
|
213
|
+
// Extract agent IDs from agent nodes
|
|
214
|
+
const agentNodes = nodes.filter(n => n.type === 'agent' && n.data?.agentId);
|
|
215
|
+
const agentIds = [...new Set(agentNodes.map(n => n.data.agentId))];
|
|
216
|
+
|
|
217
|
+
if (agentIds.length === 0) return;
|
|
218
|
+
|
|
219
|
+
this.logger.info(`Checking ${agentIds.length} agent(s) for flow execution`);
|
|
220
|
+
|
|
221
|
+
// Get project directory from config
|
|
222
|
+
const projectDir = this.config.projectDir || process.cwd();
|
|
223
|
+
|
|
224
|
+
for (const agentId of agentIds) {
|
|
225
|
+
// Check if already loaded
|
|
226
|
+
const existingAgent = await this.agentPool.getAgent(agentId);
|
|
227
|
+
if (existingAgent) {
|
|
228
|
+
this.logger.debug(`Agent ${agentId} already loaded`);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Agent not loaded - try to load from disk
|
|
233
|
+
this.logger.info(`Loading agent from disk: ${agentId}`);
|
|
234
|
+
try {
|
|
235
|
+
const agent = await this.stateManager.importArchivedAgent(agentId, projectDir, this.agentPool);
|
|
236
|
+
this.logger.info(`Successfully loaded agent: ${agentId}`);
|
|
237
|
+
|
|
238
|
+
// Broadcast agent-loaded event so UI sidebar updates
|
|
239
|
+
if (this.webSocketManager && agent) {
|
|
240
|
+
this.webSocketManager.broadcast({
|
|
241
|
+
type: 'agent-loaded',
|
|
242
|
+
agent: {
|
|
243
|
+
id: agent.id,
|
|
244
|
+
name: agent.name,
|
|
245
|
+
status: agent.status,
|
|
246
|
+
model: agent.currentModel || agent.preferredModel,
|
|
247
|
+
capabilities: agent.capabilities
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
} catch (error) {
|
|
252
|
+
throw new Error(`Failed to load agent ${agentId}: ${error.message}. Make sure the agent exists.`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Get list of unloaded agents referenced in a flow
|
|
259
|
+
* Useful for UI to show which agents need to be loaded
|
|
260
|
+
* @param {Object} flow - Flow definition
|
|
261
|
+
* @returns {Promise<Array>} Array of { agentId, isLoaded, agentInfo }
|
|
262
|
+
*/
|
|
263
|
+
async getFlowAgentStatus(flow) {
|
|
264
|
+
if (!flow?.nodes) return [];
|
|
265
|
+
|
|
266
|
+
const agentNodes = flow.nodes.filter(n => n.type === 'agent' && n.data?.agentId);
|
|
267
|
+
const agentIds = [...new Set(agentNodes.map(n => n.data.agentId))];
|
|
268
|
+
const projectDir = this.config.projectDir || process.cwd();
|
|
269
|
+
|
|
270
|
+
const results = [];
|
|
271
|
+
for (const agentId of agentIds) {
|
|
272
|
+
const existingAgent = await this.agentPool.getAgent(agentId);
|
|
273
|
+
if (existingAgent) {
|
|
274
|
+
results.push({
|
|
275
|
+
agentId,
|
|
276
|
+
isLoaded: true,
|
|
277
|
+
name: existingAgent.name,
|
|
278
|
+
model: existingAgent.currentModel
|
|
279
|
+
});
|
|
280
|
+
} else {
|
|
281
|
+
// Try to get info from disk
|
|
282
|
+
try {
|
|
283
|
+
const metadata = await this.stateManager.getAgentMetadata(agentId, projectDir);
|
|
284
|
+
results.push({
|
|
285
|
+
agentId,
|
|
286
|
+
isLoaded: false,
|
|
287
|
+
name: metadata?.name || agentId,
|
|
288
|
+
model: metadata?.model
|
|
289
|
+
});
|
|
290
|
+
} catch {
|
|
291
|
+
results.push({
|
|
292
|
+
agentId,
|
|
293
|
+
isLoaded: false,
|
|
294
|
+
name: agentId,
|
|
295
|
+
notFound: true
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return results;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Topologically sort nodes based on edges
|
|
306
|
+
* @param {Array} nodes - Array of nodes
|
|
307
|
+
* @param {Array} edges - Array of edges
|
|
308
|
+
* @returns {Array} Sorted nodes array
|
|
309
|
+
*/
|
|
310
|
+
topologicalSort(nodes, edges) {
|
|
311
|
+
if (!nodes || nodes.length === 0) {
|
|
312
|
+
return [];
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const nodeMap = new Map(nodes.map(n => [n.id, n]));
|
|
316
|
+
const inDegree = new Map(nodes.map(n => [n.id, 0]));
|
|
317
|
+
const adjacency = new Map(nodes.map(n => [n.id, []]));
|
|
318
|
+
|
|
319
|
+
// Build adjacency list and calculate in-degrees
|
|
320
|
+
for (const edge of (edges || [])) {
|
|
321
|
+
const source = edge.source;
|
|
322
|
+
const target = edge.target;
|
|
323
|
+
|
|
324
|
+
if (adjacency.has(source) && inDegree.has(target)) {
|
|
325
|
+
adjacency.get(source).push(target);
|
|
326
|
+
inDegree.set(target, inDegree.get(target) + 1);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Find all nodes with in-degree 0 (starting nodes)
|
|
331
|
+
const queue = [];
|
|
332
|
+
for (const [nodeId, degree] of inDegree) {
|
|
333
|
+
if (degree === 0) {
|
|
334
|
+
queue.push(nodeId);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Process queue
|
|
339
|
+
const sorted = [];
|
|
340
|
+
while (queue.length > 0) {
|
|
341
|
+
const nodeId = queue.shift();
|
|
342
|
+
const node = nodeMap.get(nodeId);
|
|
343
|
+
if (node) {
|
|
344
|
+
sorted.push(node);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
for (const neighbor of adjacency.get(nodeId) || []) {
|
|
348
|
+
const newDegree = inDegree.get(neighbor) - 1;
|
|
349
|
+
inDegree.set(neighbor, newDegree);
|
|
350
|
+
if (newDegree === 0) {
|
|
351
|
+
queue.push(neighbor);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Check for cycles
|
|
357
|
+
if (sorted.length !== nodes.length) {
|
|
358
|
+
this.logger.warn('Flow contains cycles, some nodes may not execute');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return sorted;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Execute a single node
|
|
366
|
+
* @param {Object} node - Node to execute
|
|
367
|
+
* @param {Object} context - Execution context
|
|
368
|
+
* @param {string} runId - Run identifier
|
|
369
|
+
* @param {string} sessionId - Session ID for broadcasts
|
|
370
|
+
* @param {Object} flow - Flow definition
|
|
371
|
+
* @returns {Promise<Object>} Node execution result
|
|
372
|
+
*/
|
|
373
|
+
async executeNode(node, context, runId, sessionId, flow) {
|
|
374
|
+
this.logger.info(`Executing node: ${node.id}`, {
|
|
375
|
+
type: node.type,
|
|
376
|
+
label: node.data?.label
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Update node state to running
|
|
380
|
+
await this.updateNodeState(runId, node.id, 'running', null);
|
|
381
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
382
|
+
type: 'flow_node_started',
|
|
383
|
+
runId,
|
|
384
|
+
nodeId: node.id,
|
|
385
|
+
nodeType: node.type
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
let result;
|
|
389
|
+
|
|
390
|
+
try {
|
|
391
|
+
switch (node.type) {
|
|
392
|
+
case 'input':
|
|
393
|
+
result = await this.executeInputNode(node, context);
|
|
394
|
+
break;
|
|
395
|
+
case 'agent':
|
|
396
|
+
result = await this.executeAgentNode(node, context, runId, sessionId, flow);
|
|
397
|
+
break;
|
|
398
|
+
case 'output':
|
|
399
|
+
result = await this.executeOutputNode(node, context, flow);
|
|
400
|
+
break;
|
|
401
|
+
default:
|
|
402
|
+
throw new Error(`Unknown node type: ${node.type}`);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
406
|
+
type: 'flow_node_completed',
|
|
407
|
+
runId,
|
|
408
|
+
nodeId: node.id,
|
|
409
|
+
nodeType: node.type,
|
|
410
|
+
output: this.truncateOutput(result)
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
return result;
|
|
414
|
+
|
|
415
|
+
} catch (error) {
|
|
416
|
+
await this.updateNodeState(runId, node.id, 'failed', { error: error.message });
|
|
417
|
+
this.broadcastFlowUpdate(sessionId, {
|
|
418
|
+
type: 'flow_node_failed',
|
|
419
|
+
runId,
|
|
420
|
+
nodeId: node.id,
|
|
421
|
+
nodeType: node.type,
|
|
422
|
+
error: error.message
|
|
423
|
+
});
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Execute an input node
|
|
430
|
+
* @param {Object} node - Input node
|
|
431
|
+
* @param {Object} context - Execution context
|
|
432
|
+
* @returns {Promise<Object>} Input result
|
|
433
|
+
*/
|
|
434
|
+
async executeInputNode(node, context) {
|
|
435
|
+
// Apply prompt template if provided
|
|
436
|
+
const template = node.data?.promptTemplate || '{{userInput}}';
|
|
437
|
+
const output = this.applyTemplate(template, {
|
|
438
|
+
userInput: context.input,
|
|
439
|
+
...context.variables
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
return {
|
|
443
|
+
type: 'input',
|
|
444
|
+
output,
|
|
445
|
+
raw: context.input
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Execute an agent node
|
|
451
|
+
* @param {Object} node - Agent node
|
|
452
|
+
* @param {Object} context - Execution context
|
|
453
|
+
* @param {string} runId - Run identifier
|
|
454
|
+
* @param {string} sessionId - Session ID
|
|
455
|
+
* @param {Object} flow - Flow definition
|
|
456
|
+
* @returns {Promise<Object>} Agent response
|
|
457
|
+
*/
|
|
458
|
+
async executeAgentNode(node, context, runId, sessionId, flow) {
|
|
459
|
+
const agentId = node.data?.agentId;
|
|
460
|
+
if (!agentId) {
|
|
461
|
+
throw new Error(`Agent node ${node.id} has no agent assigned`);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// Get agent
|
|
465
|
+
const agent = await this.agentPool.getAgent(agentId);
|
|
466
|
+
if (!agent) {
|
|
467
|
+
throw new Error(`Agent not found: ${agentId}`);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Get input from previous nodes
|
|
471
|
+
const inputNodeIds = this.getInputNodeIds(node.id, flow.edges);
|
|
472
|
+
const previousOutput = this.collectPreviousOutput(inputNodeIds, context.nodeOutputs);
|
|
473
|
+
|
|
474
|
+
// Apply prompt template
|
|
475
|
+
const template = node.data?.promptTemplate || '{{input}}';
|
|
476
|
+
const prompt = this.applyTemplate(template, {
|
|
477
|
+
input: previousOutput,
|
|
478
|
+
previousOutput,
|
|
479
|
+
...context.variables,
|
|
480
|
+
...context.nodeOutputs
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
this.logger.info(`Sending message to agent: ${agentId}`, {
|
|
484
|
+
promptLength: prompt.length,
|
|
485
|
+
nodeId: node.id
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// Store current agent mode to restore later
|
|
489
|
+
const originalMode = agent.mode;
|
|
490
|
+
|
|
491
|
+
// Reset completion state from any previous run, then put in AGENT mode
|
|
492
|
+
agent.autonomousWorkComplete = false;
|
|
493
|
+
agent.lastCompletionSummary = null;
|
|
494
|
+
agent.lastCompletionDetails = null;
|
|
495
|
+
agent.mode = AGENT_MODES.AGENT;
|
|
496
|
+
await this.agentPool.persistAgentState(agentId);
|
|
497
|
+
|
|
498
|
+
// Clear conversation history for a fresh execution context
|
|
499
|
+
try {
|
|
500
|
+
await this.agentPool.clearConversation(agentId);
|
|
501
|
+
this.logger.info(`Cleared conversation for agent ${agentId} before flow execution`);
|
|
502
|
+
} catch (error) {
|
|
503
|
+
this.logger.warn(`Failed to clear conversation for agent ${agentId}`, { error: error.message });
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Create completion promise
|
|
507
|
+
const completionPromise = this.waitForAgentCompletion(agentId, runId);
|
|
508
|
+
|
|
509
|
+
// Build flow metadata for context injection
|
|
510
|
+
const sortedNodes = context.sortedNodes || [];
|
|
511
|
+
const nodePosition = sortedNodes.findIndex(n => n.id === node.id) + 1;
|
|
512
|
+
const flowMetadata = {
|
|
513
|
+
flowId: flow.id,
|
|
514
|
+
flowName: flow.name || 'Unnamed Flow',
|
|
515
|
+
nodeName: node.data?.label || 'Agent',
|
|
516
|
+
nodePosition: nodePosition || 1,
|
|
517
|
+
totalNodes: sortedNodes.length
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// Build previous agent data for context passing
|
|
521
|
+
const previousAgentData = this.buildPreviousAgentData(node, context, flow);
|
|
522
|
+
|
|
523
|
+
this.logger.info(`Flow context for agent ${agentId}`, {
|
|
524
|
+
flowMetadata,
|
|
525
|
+
hasPreviousAgent: !!previousAgentData,
|
|
526
|
+
previousAgentId: previousAgentData?.agentId
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
// Queue message to agent with enhanced flow context
|
|
530
|
+
await this.messageProcessor.processMessage(agentId, prompt, {
|
|
531
|
+
sessionId,
|
|
532
|
+
isFlowExecution: true,
|
|
533
|
+
flowRunId: runId,
|
|
534
|
+
flowNodeId: node.id,
|
|
535
|
+
flowMetadata,
|
|
536
|
+
previousAgentData
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
// Wait for agent to complete (via jobdone tool)
|
|
540
|
+
const completionResult = await Promise.race([
|
|
541
|
+
completionPromise,
|
|
542
|
+
this.createTimeoutPromise(this.config.flows?.nodeTimeout || 300000) // 5 min default
|
|
543
|
+
]);
|
|
544
|
+
|
|
545
|
+
if (completionResult.timeout) {
|
|
546
|
+
throw new Error(`Agent ${agentId} timed out`);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Get the agent's response (last assistant message)
|
|
550
|
+
const updatedAgent = await this.agentPool.getAgent(agentId);
|
|
551
|
+
const lastResponse = this.getLastAssistantMessage(updatedAgent);
|
|
552
|
+
|
|
553
|
+
// Extract files created during this agent's execution (from completion result or messages)
|
|
554
|
+
const filesCreated = completionResult.filesCreated || this.extractFilesFromCompletion(completionResult);
|
|
555
|
+
|
|
556
|
+
return {
|
|
557
|
+
type: 'agent',
|
|
558
|
+
agentId,
|
|
559
|
+
agentName: agent.name,
|
|
560
|
+
output: completionResult.summary || lastResponse || '',
|
|
561
|
+
details: completionResult.details,
|
|
562
|
+
filesCreated,
|
|
563
|
+
success: completionResult.success !== false
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Build previous agent data for context passing to next agent
|
|
569
|
+
* @param {Object} currentNode - Current agent node
|
|
570
|
+
* @param {Object} context - Execution context with nodeOutputs
|
|
571
|
+
* @param {Object} flow - Flow definition
|
|
572
|
+
* @returns {Object|null} Previous agent data or null if first agent
|
|
573
|
+
*/
|
|
574
|
+
buildPreviousAgentData(currentNode, context, flow) {
|
|
575
|
+
// Find the previous agent node that feeds into this one
|
|
576
|
+
const inputNodeIds = this.getInputNodeIds(currentNode.id, flow.edges);
|
|
577
|
+
|
|
578
|
+
// Look for the most recent agent node in the inputs
|
|
579
|
+
for (const inputId of inputNodeIds) {
|
|
580
|
+
const nodeOutput = context.nodeOutputs[inputId];
|
|
581
|
+
|
|
582
|
+
// Check if this is an agent node output
|
|
583
|
+
if (nodeOutput && nodeOutput.type === 'agent') {
|
|
584
|
+
return {
|
|
585
|
+
agentId: nodeOutput.agentId,
|
|
586
|
+
agentName: nodeOutput.agentName || nodeOutput.agentId,
|
|
587
|
+
summary: nodeOutput.output,
|
|
588
|
+
details: nodeOutput.details,
|
|
589
|
+
filesCreated: nodeOutput.filesCreated || [],
|
|
590
|
+
output: nodeOutput.output
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// No previous agent found (first agent in flow or only non-agent predecessors)
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Extract file paths from completion result
|
|
601
|
+
* Parses the summary/details for file path mentions
|
|
602
|
+
* @param {Object} completionResult - Job-done completion result
|
|
603
|
+
* @returns {Array<string>} Array of file paths
|
|
604
|
+
*/
|
|
605
|
+
extractFilesFromCompletion(completionResult) {
|
|
606
|
+
const files = new Set();
|
|
607
|
+
|
|
608
|
+
const textToSearch = [
|
|
609
|
+
completionResult.summary || '',
|
|
610
|
+
completionResult.details || '',
|
|
611
|
+
typeof completionResult.output === 'string' ? completionResult.output : ''
|
|
612
|
+
].join(' ');
|
|
613
|
+
|
|
614
|
+
// Common patterns for file paths
|
|
615
|
+
const patterns = [
|
|
616
|
+
/(?:created|wrote|saved|generated|modified|updated)\s+(?:file\s+)?["']?([\/\\][\w\-\.\/\\]+\.\w+)["']?/gi,
|
|
617
|
+
/(?:at|to|in)\s+["']?([\/\\][\w\-\.\/\\]+\.\w+)["']?/gi,
|
|
618
|
+
/File\s+(?:created|written|saved):\s*([\/\\][\w\-\.\/\\]+\.\w+)/gi
|
|
619
|
+
];
|
|
620
|
+
|
|
621
|
+
for (const pattern of patterns) {
|
|
622
|
+
let match;
|
|
623
|
+
while ((match = pattern.exec(textToSearch)) !== null) {
|
|
624
|
+
const path = match[1];
|
|
625
|
+
if (path && !path.includes('http') && path.length > 3) {
|
|
626
|
+
files.add(path);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
return Array.from(files);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Execute an output node
|
|
636
|
+
* @param {Object} node - Output node
|
|
637
|
+
* @param {Object} context - Execution context
|
|
638
|
+
* @param {Object} flow - Flow definition
|
|
639
|
+
* @returns {Promise<Object>} Output result
|
|
640
|
+
*/
|
|
641
|
+
async executeOutputNode(node, context, flow) {
|
|
642
|
+
// Collect all previous outputs
|
|
643
|
+
const inputNodeIds = this.getInputNodeIds(node.id, flow.edges);
|
|
644
|
+
const output = this.collectPreviousOutput(inputNodeIds, context.nodeOutputs);
|
|
645
|
+
|
|
646
|
+
// Apply output format
|
|
647
|
+
const format = node.data?.outputFormat || 'text';
|
|
648
|
+
let formattedOutput;
|
|
649
|
+
|
|
650
|
+
switch (format) {
|
|
651
|
+
case 'json':
|
|
652
|
+
formattedOutput = typeof output === 'object' ? output : { result: output };
|
|
653
|
+
break;
|
|
654
|
+
case 'markdown':
|
|
655
|
+
formattedOutput = typeof output === 'string' ? output : JSON.stringify(output, null, 2);
|
|
656
|
+
break;
|
|
657
|
+
case 'text':
|
|
658
|
+
default:
|
|
659
|
+
formattedOutput = typeof output === 'string' ? output : JSON.stringify(output);
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
return {
|
|
664
|
+
type: 'output',
|
|
665
|
+
format,
|
|
666
|
+
output: formattedOutput
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Wait for an agent to complete via jobdone tool.
|
|
672
|
+
* Completion is detected two ways:
|
|
673
|
+
* 1. Direct signal: notifyAgentCompletion() called from jobDoneTool
|
|
674
|
+
* 2. Polling fallback: checks autonomousWorkComplete flag every 2s
|
|
675
|
+
* @param {string} agentId - Agent ID
|
|
676
|
+
* @param {string} runId - Run ID
|
|
677
|
+
* @returns {Promise<Object>} Completion result
|
|
678
|
+
*/
|
|
679
|
+
waitForAgentCompletion(agentId, runId) {
|
|
680
|
+
return new Promise((resolve) => {
|
|
681
|
+
const key = `${runId}-${agentId}`;
|
|
682
|
+
let checkInterval = null;
|
|
683
|
+
|
|
684
|
+
const onComplete = (result) => {
|
|
685
|
+
if (checkInterval) clearInterval(checkInterval);
|
|
686
|
+
this.completionListeners.delete(key);
|
|
687
|
+
resolve(result);
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
// Store listener so notifyAgentCompletion() can resolve directly
|
|
691
|
+
this.completionListeners.set(key, {
|
|
692
|
+
resolve: onComplete,
|
|
693
|
+
agentId,
|
|
694
|
+
runId
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
// Polling fallback: check autonomousWorkComplete flag
|
|
698
|
+
checkInterval = setInterval(async () => {
|
|
699
|
+
try {
|
|
700
|
+
const agent = await this.agentPool.getAgent(agentId);
|
|
701
|
+
if (agent && agent.autonomousWorkComplete) {
|
|
702
|
+
onComplete({
|
|
703
|
+
completed: true,
|
|
704
|
+
summary: agent.lastCompletionSummary || '',
|
|
705
|
+
details: agent.lastCompletionDetails || null,
|
|
706
|
+
success: true
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
} catch (error) {
|
|
710
|
+
// Ignore errors during polling
|
|
711
|
+
}
|
|
712
|
+
}, 2000);
|
|
713
|
+
|
|
714
|
+
// Clean up interval on timeout
|
|
715
|
+
setTimeout(() => {
|
|
716
|
+
if (checkInterval) clearInterval(checkInterval);
|
|
717
|
+
}, this.config.flows?.nodeTimeout || 300000);
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Notify that an agent has completed its work (called from jobDoneTool).
|
|
723
|
+
* Directly resolves the completion promise instead of waiting for next poll.
|
|
724
|
+
* @param {string} agentId - Agent ID
|
|
725
|
+
* @param {Object} completionData - { summary, success, details }
|
|
726
|
+
*/
|
|
727
|
+
notifyAgentCompletion(agentId, completionData = {}) {
|
|
728
|
+
// Find any listener waiting for this agent
|
|
729
|
+
for (const [key, listener] of this.completionListeners.entries()) {
|
|
730
|
+
if (listener.agentId === agentId) {
|
|
731
|
+
this.logger.info(`Flow: Agent ${agentId} completed via direct signal`, {
|
|
732
|
+
runId: listener.runId,
|
|
733
|
+
success: completionData.success
|
|
734
|
+
});
|
|
735
|
+
listener.resolve({
|
|
736
|
+
completed: true,
|
|
737
|
+
summary: completionData.summary || '',
|
|
738
|
+
details: completionData.details || null,
|
|
739
|
+
success: completionData.success !== false
|
|
740
|
+
});
|
|
741
|
+
return true;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return false; // No listener found (agent not in a flow)
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Create a timeout promise
|
|
749
|
+
* @param {number} ms - Timeout in milliseconds
|
|
750
|
+
* @returns {Promise<Object>} Timeout result
|
|
751
|
+
*/
|
|
752
|
+
createTimeoutPromise(ms) {
|
|
753
|
+
return new Promise((resolve) => {
|
|
754
|
+
setTimeout(() => {
|
|
755
|
+
resolve({ timeout: true });
|
|
756
|
+
}, ms);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Get IDs of nodes that connect to a target node
|
|
762
|
+
* @param {string} targetNodeId - Target node ID
|
|
763
|
+
* @param {Array} edges - Flow edges
|
|
764
|
+
* @returns {Array} Source node IDs
|
|
765
|
+
*/
|
|
766
|
+
getInputNodeIds(targetNodeId, edges) {
|
|
767
|
+
return (edges || [])
|
|
768
|
+
.filter(e => e.target === targetNodeId)
|
|
769
|
+
.map(e => e.source);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Collect output from previous nodes
|
|
774
|
+
* @param {Array} nodeIds - Node IDs to collect from
|
|
775
|
+
* @param {Object} nodeOutputs - Map of node outputs
|
|
776
|
+
* @returns {string} Combined output
|
|
777
|
+
*/
|
|
778
|
+
collectPreviousOutput(nodeIds, nodeOutputs) {
|
|
779
|
+
const outputs = nodeIds
|
|
780
|
+
.map(id => nodeOutputs[id])
|
|
781
|
+
.filter(o => o)
|
|
782
|
+
.map(o => o.output || o)
|
|
783
|
+
.filter(o => o);
|
|
784
|
+
|
|
785
|
+
if (outputs.length === 0) return '';
|
|
786
|
+
if (outputs.length === 1) return outputs[0];
|
|
787
|
+
|
|
788
|
+
// Combine multiple outputs
|
|
789
|
+
return outputs.join('\n\n---\n\n');
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Collect final output from output nodes
|
|
794
|
+
* @param {Array} sortedNodes - Sorted nodes
|
|
795
|
+
* @param {Object} context - Execution context
|
|
796
|
+
* @returns {Object} Final output
|
|
797
|
+
*/
|
|
798
|
+
collectFinalOutput(sortedNodes, context) {
|
|
799
|
+
const outputNodes = sortedNodes.filter(n => n.type === 'output');
|
|
800
|
+
|
|
801
|
+
if (outputNodes.length === 0) {
|
|
802
|
+
// No output node, return last node's output
|
|
803
|
+
const lastNode = sortedNodes[sortedNodes.length - 1];
|
|
804
|
+
return context.nodeOutputs[lastNode?.id]?.output || null;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
if (outputNodes.length === 1) {
|
|
808
|
+
return context.nodeOutputs[outputNodes[0].id]?.output;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// Multiple output nodes
|
|
812
|
+
const outputs = {};
|
|
813
|
+
for (const node of outputNodes) {
|
|
814
|
+
const key = node.data?.label || node.id;
|
|
815
|
+
outputs[key] = context.nodeOutputs[node.id]?.output;
|
|
816
|
+
}
|
|
817
|
+
return outputs;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Apply template with variable substitution
|
|
822
|
+
* @param {string} template - Template string
|
|
823
|
+
* @param {Object} variables - Variables to substitute
|
|
824
|
+
* @returns {string} Processed template
|
|
825
|
+
*/
|
|
826
|
+
applyTemplate(template, variables) {
|
|
827
|
+
let result = template;
|
|
828
|
+
|
|
829
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
830
|
+
const placeholder = `{{${key}}}`;
|
|
831
|
+
const valueStr = typeof value === 'object'
|
|
832
|
+
? JSON.stringify(value)
|
|
833
|
+
: String(value || '');
|
|
834
|
+
result = result.split(placeholder).join(valueStr);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return result;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Update node state in the run record
|
|
842
|
+
* @param {string} runId - Run ID
|
|
843
|
+
* @param {string} nodeId - Node ID
|
|
844
|
+
* @param {string} status - Node status
|
|
845
|
+
* @param {Object} result - Node result
|
|
846
|
+
*/
|
|
847
|
+
async updateNodeState(runId, nodeId, status, result) {
|
|
848
|
+
const run = await this.stateManager.getFlowRun(runId);
|
|
849
|
+
if (!run) return;
|
|
850
|
+
|
|
851
|
+
const nodeStates = run.nodeStates || {};
|
|
852
|
+
nodeStates[nodeId] = {
|
|
853
|
+
status,
|
|
854
|
+
result: result ? this.truncateOutput(result) : null,
|
|
855
|
+
updatedAt: new Date().toISOString()
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
await this.stateManager.updateFlowRun(runId, { nodeStates });
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Get the last assistant message from an agent
|
|
863
|
+
* @param {Object} agent - Agent object
|
|
864
|
+
* @returns {string|null} Last assistant message content
|
|
865
|
+
*/
|
|
866
|
+
getLastAssistantMessage(agent) {
|
|
867
|
+
const messages = agent?.conversations?.full?.messages || [];
|
|
868
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
869
|
+
if (messages[i].role === 'assistant') {
|
|
870
|
+
return messages[i].content;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return null;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Truncate output for storage/transmission
|
|
878
|
+
* @param {Object} output - Output to truncate
|
|
879
|
+
* @returns {Object} Truncated output
|
|
880
|
+
*/
|
|
881
|
+
truncateOutput(output) {
|
|
882
|
+
if (typeof output === 'string' && output.length > 1000) {
|
|
883
|
+
return output.substring(0, 1000) + '... (truncated)';
|
|
884
|
+
}
|
|
885
|
+
if (typeof output === 'object') {
|
|
886
|
+
const str = JSON.stringify(output);
|
|
887
|
+
if (str.length > 1000) {
|
|
888
|
+
return { truncated: true, preview: str.substring(0, 1000) };
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return output;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Broadcast flow update via WebSocket
|
|
896
|
+
* @param {string} sessionId - Session ID (null broadcasts to all)
|
|
897
|
+
* @param {Object} data - Update data
|
|
898
|
+
*/
|
|
899
|
+
broadcastFlowUpdate(sessionId, data) {
|
|
900
|
+
if (!this.webSocketManager) return;
|
|
901
|
+
|
|
902
|
+
try {
|
|
903
|
+
// broadcastToSession with null sessionId broadcasts to all connections
|
|
904
|
+
this.webSocketManager.broadcastToSession(sessionId, {
|
|
905
|
+
type: 'flow_update',
|
|
906
|
+
data,
|
|
907
|
+
timestamp: new Date().toISOString()
|
|
908
|
+
});
|
|
909
|
+
} catch (error) {
|
|
910
|
+
this.logger.warn('Failed to broadcast flow update', { error: error.message });
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Get active executions
|
|
916
|
+
* @returns {Array} Active execution info
|
|
917
|
+
*/
|
|
918
|
+
getActiveExecutions() {
|
|
919
|
+
return Array.from(this.activeExecutions.entries()).map(([runId, exec]) => ({
|
|
920
|
+
runId,
|
|
921
|
+
flowId: exec.flowId,
|
|
922
|
+
status: exec.status,
|
|
923
|
+
startedAt: exec.startedAt
|
|
924
|
+
}));
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export default FlowExecutor;
|