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,1175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file tools/visualEditorTool.js
|
|
3
|
+
* @description Tool for visual editor integration - allows agents to interact
|
|
4
|
+
* with user's web application visually and receive element selections with
|
|
5
|
+
* source code locations.
|
|
6
|
+
*
|
|
7
|
+
* Phase 1: Basic actions (get-context, set-app-url, get-status)
|
|
8
|
+
* Phase 5: Full actions (highlight, scroll-to, get-source, reload, set-mode)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { BaseTool } from './baseTool.js';
|
|
12
|
+
import { getVisualEditorBridge, InstanceStatus } from '../services/visualEditorBridge.js';
|
|
13
|
+
import { getVisualEditorServer, getVisualEditorPort, getVisualEditorBaseUrl } from '../services/visualEditorServer.js';
|
|
14
|
+
import { getPortTracker } from '../services/portTracker.js';
|
|
15
|
+
import { getProjectDetector, PROJECT_TYPES } from '../services/projectDetector.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Supported actions for the Visual Editor Tool
|
|
19
|
+
*/
|
|
20
|
+
const ACTIONS = {
|
|
21
|
+
GET_CONTEXT: 'get-context',
|
|
22
|
+
SET_APP_URL: 'set-app-url',
|
|
23
|
+
GET_STATUS: 'get-status',
|
|
24
|
+
CLEAR_CONTEXT: 'clear-context',
|
|
25
|
+
// Server management actions
|
|
26
|
+
START_SERVER: 'start-server', // Start dev server for project
|
|
27
|
+
SERVE_STATIC: 'serve-static', // Serve static files directly
|
|
28
|
+
DETECT_PROJECT: 'detect-project', // Detect project type
|
|
29
|
+
// UI control actions
|
|
30
|
+
OPEN_EDITOR: 'open-editor', // Open visual editor in UI with specified URL
|
|
31
|
+
// Phase 5 actions
|
|
32
|
+
HIGHLIGHT: 'highlight',
|
|
33
|
+
SCROLL_TO: 'scroll-to',
|
|
34
|
+
GET_SOURCE: 'get-source',
|
|
35
|
+
RELOAD: 'reload',
|
|
36
|
+
SET_MODE: 'set-mode'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* VisualEditorTool - Interact with user's web application visually
|
|
41
|
+
*/
|
|
42
|
+
export class VisualEditorTool extends BaseTool {
|
|
43
|
+
constructor(config = {}, logger = null) {
|
|
44
|
+
super(config, logger);
|
|
45
|
+
|
|
46
|
+
// Override tool ID
|
|
47
|
+
this.id = 'visual-editor';
|
|
48
|
+
|
|
49
|
+
// Tool properties
|
|
50
|
+
this.isAsync = false;
|
|
51
|
+
this.requiresProject = false;
|
|
52
|
+
|
|
53
|
+
// Bridge instance (lazy loaded)
|
|
54
|
+
this._bridge = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get bridge instance (lazy load)
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
_getBridge() {
|
|
62
|
+
if (!this._bridge) {
|
|
63
|
+
this._bridge = getVisualEditorBridge();
|
|
64
|
+
}
|
|
65
|
+
return this._bridge;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get tool description for agent system prompt
|
|
70
|
+
* @returns {string} Formatted tool description
|
|
71
|
+
*/
|
|
72
|
+
getDescription() {
|
|
73
|
+
return `Tool: Visual Editor - Interact with the user's web application visually.
|
|
74
|
+
|
|
75
|
+
**PURPOSE:** Allow users to visually select elements in their app preview.
|
|
76
|
+
You receive context about selected elements including source code location.
|
|
77
|
+
|
|
78
|
+
**COMPLETE WORKFLOW - When user wants to visually edit their app:**
|
|
79
|
+
|
|
80
|
+
1. **If app is NOT running yet:**
|
|
81
|
+
- Use \`detect-project\` to identify project type
|
|
82
|
+
- Use \`serve-static\` (for HTML) or start dev server via Terminal tool
|
|
83
|
+
|
|
84
|
+
2. **Open the Visual Editor UI:**
|
|
85
|
+
- Use \`open-editor\` with the app URL to show the visual editor to the user
|
|
86
|
+
- This opens the preview panel in the UI automatically
|
|
87
|
+
|
|
88
|
+
3. **User clicks elements in the preview**
|
|
89
|
+
- You automatically receive element context in messages
|
|
90
|
+
|
|
91
|
+
**ACTIONS:**
|
|
92
|
+
|
|
93
|
+
**open-editor** - Open visual editor UI with app URL (RECOMMENDED after starting server)
|
|
94
|
+
\`\`\`json
|
|
95
|
+
{
|
|
96
|
+
"toolId": "visual-editor",
|
|
97
|
+
"action": "open-editor",
|
|
98
|
+
"parameters": {
|
|
99
|
+
"url": "http://localhost:3000"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
\`\`\`
|
|
103
|
+
This opens the visual editor panel in the user's UI and loads your app for visual selection.
|
|
104
|
+
|
|
105
|
+
**detect-project** - Detect project type and get server suggestions
|
|
106
|
+
\`\`\`json
|
|
107
|
+
{
|
|
108
|
+
"toolId": "visual-editor",
|
|
109
|
+
"action": "detect-project"
|
|
110
|
+
}
|
|
111
|
+
\`\`\`
|
|
112
|
+
Returns: projectType, framework, serverCommand, defaultPort
|
|
113
|
+
|
|
114
|
+
**serve-static** - Serve static HTML files directly (no external server needed)
|
|
115
|
+
\`\`\`json
|
|
116
|
+
{
|
|
117
|
+
"toolId": "visual-editor",
|
|
118
|
+
"action": "serve-static",
|
|
119
|
+
"parameters": {
|
|
120
|
+
"directory": "public" // Optional: subdirectory to serve, defaults to project root
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
\`\`\`
|
|
124
|
+
Returns: url (e.g., http://localhost:4000/)
|
|
125
|
+
|
|
126
|
+
**set-app-url** - Configure the app URL for visual editing
|
|
127
|
+
\`\`\`json
|
|
128
|
+
{
|
|
129
|
+
"toolId": "visual-editor",
|
|
130
|
+
"action": "set-app-url",
|
|
131
|
+
"parameters": {
|
|
132
|
+
"url": "http://localhost:3000"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
**get-context** - Get current visual selection (if any)
|
|
138
|
+
\`\`\`json
|
|
139
|
+
{
|
|
140
|
+
"toolId": "visual-editor",
|
|
141
|
+
"action": "get-context"
|
|
142
|
+
}
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
**get-status** - Get visual editor instance status
|
|
146
|
+
\`\`\`json
|
|
147
|
+
{
|
|
148
|
+
"toolId": "visual-editor",
|
|
149
|
+
"action": "get-status"
|
|
150
|
+
}
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
**clear-context** - Clear the current visual selection
|
|
154
|
+
\`\`\`json
|
|
155
|
+
{
|
|
156
|
+
"toolId": "visual-editor",
|
|
157
|
+
"action": "clear-context"
|
|
158
|
+
}
|
|
159
|
+
\`\`\`
|
|
160
|
+
|
|
161
|
+
**AUTOMATIC CONTEXT INJECTION:**
|
|
162
|
+
When user selects an element, you receive visual context automatically:
|
|
163
|
+
\`\`\`
|
|
164
|
+
[VISUAL CONTEXT - User selected element]
|
|
165
|
+
Element: <button class="btn-primary">
|
|
166
|
+
Source: src/components/Form.tsx:42 (Component: SubmitButton)
|
|
167
|
+
Code:
|
|
168
|
+
41│ return (
|
|
169
|
+
► 42│ <button className="btn-primary">Submit</button>
|
|
170
|
+
43│ );
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
**WORKFLOW EXAMPLE:**
|
|
174
|
+
1. User: "Let me visually edit the app"
|
|
175
|
+
2. Agent: detect-project → React (Vite)
|
|
176
|
+
3. Agent: Terminal → npm run dev (starts on port 5173)
|
|
177
|
+
4. Agent: open-editor → url: http://localhost:5173 (opens UI panel)
|
|
178
|
+
5. Agent: "Visual editor ready! Click any element to select it."
|
|
179
|
+
6. User clicks element → context injected automatically
|
|
180
|
+
7. Agent: Uses filesystem tool to edit the source file
|
|
181
|
+
|
|
182
|
+
**TIPS:**
|
|
183
|
+
- For static HTML: Use \`serve-static\` then \`open-editor\`
|
|
184
|
+
- For React/Vue/Next.js: Start dev server via Terminal, then \`open-editor\`
|
|
185
|
+
- Always use \`open-editor\` to show the preview UI to the user
|
|
186
|
+
- Always acknowledge visual context when user selects element
|
|
187
|
+
- Use source location (file:line) to make targeted code changes`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get supported actions
|
|
192
|
+
* @returns {Array<string>} Supported action names
|
|
193
|
+
*/
|
|
194
|
+
getSupportedActions() {
|
|
195
|
+
return Object.values(ACTIONS);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Get required parameters
|
|
200
|
+
* @returns {Array<string>} Required parameter names
|
|
201
|
+
*/
|
|
202
|
+
getRequiredParameters() {
|
|
203
|
+
return ['action'];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Parse parameters from tool command content
|
|
208
|
+
* @param {string|Object} content - Raw content or parsed object
|
|
209
|
+
* @returns {Object} Parsed parameters
|
|
210
|
+
*/
|
|
211
|
+
parseParameters(content) {
|
|
212
|
+
// Handle JSON format
|
|
213
|
+
if (typeof content === 'object' && content !== null) {
|
|
214
|
+
return this._parseJSONParams(content);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Handle string format
|
|
218
|
+
if (typeof content === 'string') {
|
|
219
|
+
const trimmed = content.trim();
|
|
220
|
+
|
|
221
|
+
// Try to parse as JSON
|
|
222
|
+
if (trimmed.startsWith('{')) {
|
|
223
|
+
try {
|
|
224
|
+
const parsed = JSON.parse(trimmed);
|
|
225
|
+
return this._parseJSONParams(parsed);
|
|
226
|
+
} catch (err) {
|
|
227
|
+
// Fall through to XML parsing
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Parse as XML
|
|
232
|
+
return this._parseXMLParams(content);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
throw new Error('Invalid parameter format');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Parse JSON parameters
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
_parseJSONParams(obj) {
|
|
243
|
+
// Handle parameters wrapper
|
|
244
|
+
if (obj.parameters) {
|
|
245
|
+
return {
|
|
246
|
+
action: obj.action || ACTIONS.GET_CONTEXT,
|
|
247
|
+
...obj.parameters
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
action: obj.action || ACTIONS.GET_CONTEXT,
|
|
253
|
+
url: obj.url,
|
|
254
|
+
selector: obj.selector,
|
|
255
|
+
mode: obj.mode,
|
|
256
|
+
projectRoot: obj.projectRoot
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Parse XML parameters
|
|
262
|
+
* @private
|
|
263
|
+
*/
|
|
264
|
+
_parseXMLParams(content) {
|
|
265
|
+
const extractTag = (tag) => {
|
|
266
|
+
const regex = new RegExp(`<${tag}>([\\s\\S]*?)<\\/${tag}>`, 'i');
|
|
267
|
+
const match = regex.exec(content);
|
|
268
|
+
return match ? match[1].trim() : null;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
action: extractTag('action') || ACTIONS.GET_CONTEXT,
|
|
273
|
+
url: extractTag('url'),
|
|
274
|
+
selector: extractTag('selector'),
|
|
275
|
+
mode: extractTag('mode'),
|
|
276
|
+
projectRoot: extractTag('project-root') || extractTag('projectRoot')
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Validate parameters
|
|
282
|
+
* @param {Object} params - Parameters to validate
|
|
283
|
+
* @returns {Object} Validation result
|
|
284
|
+
*/
|
|
285
|
+
customValidateParameters(params) {
|
|
286
|
+
// Validate action
|
|
287
|
+
if (!Object.values(ACTIONS).includes(params.action)) {
|
|
288
|
+
return {
|
|
289
|
+
valid: false,
|
|
290
|
+
error: `Invalid action: ${params.action}. Valid actions: ${Object.values(ACTIONS).join(', ')}`
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Validate action-specific parameters
|
|
295
|
+
if (params.action === ACTIONS.SET_APP_URL && !params.url) {
|
|
296
|
+
return {
|
|
297
|
+
valid: false,
|
|
298
|
+
error: 'URL is required for set-app-url action'
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Phase 5 actions validation (placeholder)
|
|
303
|
+
if ([ACTIONS.HIGHLIGHT, ACTIONS.SCROLL_TO, ACTIONS.GET_SOURCE].includes(params.action)) {
|
|
304
|
+
if (!params.selector) {
|
|
305
|
+
return {
|
|
306
|
+
valid: false,
|
|
307
|
+
error: `Selector is required for ${params.action} action`
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return { valid: true };
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Execute tool with parsed parameters
|
|
317
|
+
* @param {Object|string} params - Parsed parameters or raw content
|
|
318
|
+
* @param {Object} context - Execution context
|
|
319
|
+
* @returns {Promise<Object>} Execution result
|
|
320
|
+
*/
|
|
321
|
+
async execute(params, context = {}) {
|
|
322
|
+
try {
|
|
323
|
+
const { agentId } = context;
|
|
324
|
+
|
|
325
|
+
// Auto-parse if string
|
|
326
|
+
if (typeof params === 'string') {
|
|
327
|
+
params = this.parseParameters(params);
|
|
328
|
+
} else if (typeof params === 'object' && params !== null && !params.action) {
|
|
329
|
+
params = this.parseParameters(params);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Get bridge
|
|
333
|
+
const bridge = this._getBridge();
|
|
334
|
+
|
|
335
|
+
// Check if bridge is enabled
|
|
336
|
+
if (!bridge.isEnabled()) {
|
|
337
|
+
return {
|
|
338
|
+
success: false,
|
|
339
|
+
error: 'Visual editor is disabled. Enable it in configuration.'
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Validate
|
|
344
|
+
const validation = this.customValidateParameters(params);
|
|
345
|
+
if (!validation.valid) {
|
|
346
|
+
return {
|
|
347
|
+
success: false,
|
|
348
|
+
error: validation.error
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Route to action handler
|
|
353
|
+
switch (params.action) {
|
|
354
|
+
case ACTIONS.GET_CONTEXT:
|
|
355
|
+
return this._handleGetContext(bridge, agentId);
|
|
356
|
+
|
|
357
|
+
case ACTIONS.SET_APP_URL:
|
|
358
|
+
return this._handleSetAppUrl(bridge, agentId, params);
|
|
359
|
+
|
|
360
|
+
case ACTIONS.GET_STATUS:
|
|
361
|
+
return this._handleGetStatus(bridge, agentId);
|
|
362
|
+
|
|
363
|
+
case ACTIONS.CLEAR_CONTEXT:
|
|
364
|
+
return this._handleClearContext(bridge, agentId);
|
|
365
|
+
|
|
366
|
+
// Server management actions
|
|
367
|
+
case ACTIONS.DETECT_PROJECT:
|
|
368
|
+
return this._handleDetectProject(context);
|
|
369
|
+
|
|
370
|
+
case ACTIONS.SERVE_STATIC:
|
|
371
|
+
return this._handleServeStatic(bridge, agentId, params, context);
|
|
372
|
+
|
|
373
|
+
case ACTIONS.START_SERVER:
|
|
374
|
+
return this._handleStartServer(bridge, agentId, params, context);
|
|
375
|
+
|
|
376
|
+
// UI control actions
|
|
377
|
+
case ACTIONS.OPEN_EDITOR:
|
|
378
|
+
return this._handleOpenEditor(bridge, agentId, params, context);
|
|
379
|
+
|
|
380
|
+
// Phase 5 actions - full editor control
|
|
381
|
+
case ACTIONS.HIGHLIGHT:
|
|
382
|
+
return this._handleHighlight(bridge, agentId, params);
|
|
383
|
+
|
|
384
|
+
case ACTIONS.SCROLL_TO:
|
|
385
|
+
return this._handleScrollTo(bridge, agentId, params);
|
|
386
|
+
|
|
387
|
+
case ACTIONS.GET_SOURCE:
|
|
388
|
+
return this._handleGetSource(bridge, agentId, params);
|
|
389
|
+
|
|
390
|
+
case ACTIONS.RELOAD:
|
|
391
|
+
return this._handleReload(bridge, agentId);
|
|
392
|
+
|
|
393
|
+
case ACTIONS.SET_MODE:
|
|
394
|
+
return this._handleSetMode(bridge, agentId, params);
|
|
395
|
+
|
|
396
|
+
default:
|
|
397
|
+
return {
|
|
398
|
+
success: false,
|
|
399
|
+
error: `Unknown action: ${params.action}`
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
} catch (error) {
|
|
404
|
+
this.logger?.error('Visual editor tool error:', error);
|
|
405
|
+
return {
|
|
406
|
+
success: false,
|
|
407
|
+
error: error.message
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Handle get-context action
|
|
414
|
+
* @private
|
|
415
|
+
*/
|
|
416
|
+
_handleGetContext(bridge, agentId) {
|
|
417
|
+
if (!agentId) {
|
|
418
|
+
return {
|
|
419
|
+
success: false,
|
|
420
|
+
error: 'Agent ID is required to get visual context'
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const context = bridge.getVisualContext(agentId);
|
|
425
|
+
|
|
426
|
+
if (!context) {
|
|
427
|
+
return {
|
|
428
|
+
success: true,
|
|
429
|
+
hasContext: false,
|
|
430
|
+
message: 'No visual selection. User can select an element in Visual Mode.'
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Format context for agent consumption
|
|
435
|
+
return {
|
|
436
|
+
success: true,
|
|
437
|
+
hasContext: true,
|
|
438
|
+
context: {
|
|
439
|
+
selector: context.selector,
|
|
440
|
+
tagName: context.tagName,
|
|
441
|
+
text: context.text,
|
|
442
|
+
attributes: context.attributes,
|
|
443
|
+
sourceHint: context.sourceHint,
|
|
444
|
+
receivedAt: context.receivedAt
|
|
445
|
+
},
|
|
446
|
+
formatted: this._formatContextForAgent(context)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Handle set-app-url action
|
|
452
|
+
* @private
|
|
453
|
+
*/
|
|
454
|
+
async _handleSetAppUrl(bridge, agentId, params) {
|
|
455
|
+
if (!agentId) {
|
|
456
|
+
return {
|
|
457
|
+
success: false,
|
|
458
|
+
error: 'Agent ID is required to set app URL'
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Validate URL format
|
|
463
|
+
try {
|
|
464
|
+
new URL(params.url);
|
|
465
|
+
} catch {
|
|
466
|
+
return {
|
|
467
|
+
success: false,
|
|
468
|
+
error: `Invalid URL format: ${params.url}`
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Get or create instance
|
|
473
|
+
const instance = await bridge.getInstance(agentId, {
|
|
474
|
+
appUrl: params.url,
|
|
475
|
+
projectRoot: params.projectRoot
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
success: true,
|
|
480
|
+
message: `App URL configured: ${params.url}`,
|
|
481
|
+
instance: {
|
|
482
|
+
agentId: instance.agentId,
|
|
483
|
+
appUrl: instance.appUrl,
|
|
484
|
+
projectRoot: instance.projectRoot,
|
|
485
|
+
status: instance.status
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Handle get-status action
|
|
492
|
+
* @private
|
|
493
|
+
*/
|
|
494
|
+
_handleGetStatus(bridge, agentId) {
|
|
495
|
+
if (!agentId) {
|
|
496
|
+
// Return global status
|
|
497
|
+
const instances = bridge.listInstances();
|
|
498
|
+
return {
|
|
499
|
+
success: true,
|
|
500
|
+
instanceCount: instances.length,
|
|
501
|
+
maxInstances: bridge.maxInstances,
|
|
502
|
+
instances: instances.map(inst => ({
|
|
503
|
+
agentId: inst.agentId,
|
|
504
|
+
status: inst.status,
|
|
505
|
+
appUrl: inst.appUrl,
|
|
506
|
+
hasContext: inst.hasContext,
|
|
507
|
+
idleMs: inst.idleMs
|
|
508
|
+
}))
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const status = bridge.getStatus(agentId);
|
|
513
|
+
|
|
514
|
+
if (!status.exists) {
|
|
515
|
+
return {
|
|
516
|
+
success: true,
|
|
517
|
+
exists: false,
|
|
518
|
+
message: 'No visual editor instance for this agent. Use set-app-url to configure.'
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
return {
|
|
523
|
+
success: true,
|
|
524
|
+
exists: true,
|
|
525
|
+
status: status.status,
|
|
526
|
+
appUrl: status.appUrl,
|
|
527
|
+
projectRoot: status.projectRoot,
|
|
528
|
+
editorUrl: status.editorUrl,
|
|
529
|
+
hasVisualContext: status.hasVisualContext,
|
|
530
|
+
subscriberCount: status.subscriberCount,
|
|
531
|
+
idleMs: status.idleMs,
|
|
532
|
+
error: status.error
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Handle clear-context action
|
|
538
|
+
* @private
|
|
539
|
+
*/
|
|
540
|
+
_handleClearContext(bridge, agentId) {
|
|
541
|
+
if (!agentId) {
|
|
542
|
+
return {
|
|
543
|
+
success: false,
|
|
544
|
+
error: 'Agent ID is required to clear visual context'
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const cleared = bridge.clearVisualContext(agentId);
|
|
549
|
+
|
|
550
|
+
return {
|
|
551
|
+
success: true,
|
|
552
|
+
cleared,
|
|
553
|
+
message: cleared
|
|
554
|
+
? 'Visual context cleared'
|
|
555
|
+
: 'No visual context to clear'
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// === Server Management Action Handlers ===
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Handle detect-project action
|
|
563
|
+
* @private
|
|
564
|
+
*/
|
|
565
|
+
async _handleDetectProject(context) {
|
|
566
|
+
const projectRoot = context.projectRoot || context.workingDirectory;
|
|
567
|
+
|
|
568
|
+
if (!projectRoot) {
|
|
569
|
+
return {
|
|
570
|
+
success: false,
|
|
571
|
+
error: 'No project directory available. Set projectRoot in context.'
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const detector = getProjectDetector();
|
|
576
|
+
const detection = await detector.detect(projectRoot);
|
|
577
|
+
|
|
578
|
+
if (detection.error) {
|
|
579
|
+
return {
|
|
580
|
+
success: false,
|
|
581
|
+
error: detection.error
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
const serverInfo = detector.getSuggestedServerCommand(detection);
|
|
586
|
+
|
|
587
|
+
return {
|
|
588
|
+
success: true,
|
|
589
|
+
projectDir: projectRoot,
|
|
590
|
+
projectType: detection.projectType,
|
|
591
|
+
framework: detection.framework,
|
|
592
|
+
isStatic: detection.isStatic,
|
|
593
|
+
entryPoints: detection.entryPoints,
|
|
594
|
+
serverCommand: serverInfo.command,
|
|
595
|
+
defaultPort: serverInfo.port,
|
|
596
|
+
availableScripts: detection.availableScripts,
|
|
597
|
+
confidence: detection.confidence,
|
|
598
|
+
message: detection.isStatic
|
|
599
|
+
? `Static HTML project detected. Use 'serve-static' action to preview.`
|
|
600
|
+
: `${detection.framework || detection.projectType} project detected. Run "${serverInfo.command}" to start server.`
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Handle serve-static action - serve static files via Visual Editor Server
|
|
606
|
+
* @private
|
|
607
|
+
*/
|
|
608
|
+
async _handleServeStatic(bridge, agentId, params, context) {
|
|
609
|
+
const projectRoot = context.projectRoot || context.workingDirectory;
|
|
610
|
+
|
|
611
|
+
if (!projectRoot) {
|
|
612
|
+
return {
|
|
613
|
+
success: false,
|
|
614
|
+
error: 'No project directory available'
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Get Visual Editor Server
|
|
619
|
+
const server = getVisualEditorServer();
|
|
620
|
+
|
|
621
|
+
// Start server if not running
|
|
622
|
+
if (!server.isRunning) {
|
|
623
|
+
await server.start();
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// Determine directory to serve
|
|
627
|
+
const directory = params.directory || '';
|
|
628
|
+
const fullPath = directory ? `${projectRoot}/${directory}` : projectRoot;
|
|
629
|
+
|
|
630
|
+
// Register static directory with the server
|
|
631
|
+
server.registerStaticDir(agentId, fullPath);
|
|
632
|
+
|
|
633
|
+
// Generate URL for static files using configurable port
|
|
634
|
+
const baseUrl = getVisualEditorBaseUrl();
|
|
635
|
+
const staticUrl = `${baseUrl}/static/${agentId}/`;
|
|
636
|
+
|
|
637
|
+
// Also set as app URL for the visual editor
|
|
638
|
+
if (agentId) {
|
|
639
|
+
const instance = await bridge.getInstance(agentId, {
|
|
640
|
+
appUrl: staticUrl,
|
|
641
|
+
projectRoot
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
bridge.updateStatus(agentId, instance.status, {
|
|
645
|
+
editorUrl: `${baseUrl}?agentId=${agentId}&appUrl=${encodeURIComponent(staticUrl)}`
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return {
|
|
650
|
+
success: true,
|
|
651
|
+
url: staticUrl,
|
|
652
|
+
directory: fullPath,
|
|
653
|
+
message: `Static files served at ${staticUrl}. Visual Mode ready.`,
|
|
654
|
+
editorUrl: `${baseUrl}?agentId=${agentId}&appUrl=${encodeURIComponent(staticUrl)}`
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Handle start-server action - provides server command info
|
|
660
|
+
* (Actual server start should be done via Terminal tool)
|
|
661
|
+
* @private
|
|
662
|
+
*/
|
|
663
|
+
async _handleStartServer(bridge, agentId, params, context) {
|
|
664
|
+
const projectRoot = context.projectRoot || context.workingDirectory;
|
|
665
|
+
|
|
666
|
+
if (!projectRoot) {
|
|
667
|
+
return {
|
|
668
|
+
success: false,
|
|
669
|
+
error: 'No project directory available'
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Detect project
|
|
674
|
+
const detector = getProjectDetector();
|
|
675
|
+
const detection = await detector.detect(projectRoot);
|
|
676
|
+
|
|
677
|
+
// Get port tracker
|
|
678
|
+
const portTracker = getPortTracker();
|
|
679
|
+
const preferredPort = params.port || detection.defaultPort;
|
|
680
|
+
|
|
681
|
+
// Find available port
|
|
682
|
+
const availablePort = await portTracker.findAvailablePort(
|
|
683
|
+
preferredPort,
|
|
684
|
+
preferredPort + 100
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
if (!availablePort) {
|
|
688
|
+
return {
|
|
689
|
+
success: false,
|
|
690
|
+
error: `No available ports in range ${preferredPort}-${preferredPort + 100}`
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Get command with port
|
|
695
|
+
const serverInfo = detector.getSuggestedServerCommand(detection, availablePort);
|
|
696
|
+
|
|
697
|
+
return {
|
|
698
|
+
success: true,
|
|
699
|
+
projectType: detection.projectType,
|
|
700
|
+
framework: detection.framework,
|
|
701
|
+
command: serverInfo.command,
|
|
702
|
+
port: availablePort,
|
|
703
|
+
expectedUrl: `http://localhost:${availablePort}`,
|
|
704
|
+
instructions: `
|
|
705
|
+
To start the server:
|
|
706
|
+
1. Use Terminal tool: ${serverInfo.command}
|
|
707
|
+
2. Wait for server to start
|
|
708
|
+
3. Use set-app-url with: http://localhost:${availablePort}
|
|
709
|
+
|
|
710
|
+
Or for static HTML, use 'serve-static' action instead.
|
|
711
|
+
`.trim()
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// === UI Control Action Handlers ===
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Handle open-editor action - opens visual editor UI with specified app URL
|
|
719
|
+
* Broadcasts a message to the web-ui to enable visual editor mode
|
|
720
|
+
* @private
|
|
721
|
+
*/
|
|
722
|
+
async _handleOpenEditor(bridge, agentId, params, context) {
|
|
723
|
+
if (!agentId) {
|
|
724
|
+
return {
|
|
725
|
+
success: false,
|
|
726
|
+
error: 'Agent ID is required to open visual editor'
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Validate URL format
|
|
731
|
+
const appUrl = params.url;
|
|
732
|
+
if (!appUrl) {
|
|
733
|
+
return {
|
|
734
|
+
success: false,
|
|
735
|
+
error: 'URL parameter is required. Provide the URL of your running app (e.g., http://localhost:3000)'
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
try {
|
|
740
|
+
new URL(appUrl);
|
|
741
|
+
} catch {
|
|
742
|
+
return {
|
|
743
|
+
success: false,
|
|
744
|
+
error: `Invalid URL format: ${appUrl}`
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// Verify the target app is reachable and scan for errors
|
|
749
|
+
let pageWarnings = [];
|
|
750
|
+
try {
|
|
751
|
+
const controller = new AbortController();
|
|
752
|
+
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
|
753
|
+
const response = await fetch(appUrl, {
|
|
754
|
+
method: 'GET',
|
|
755
|
+
signal: controller.signal,
|
|
756
|
+
redirect: 'follow'
|
|
757
|
+
});
|
|
758
|
+
clearTimeout(timeoutId);
|
|
759
|
+
|
|
760
|
+
if (!response.ok && response.status >= 500) {
|
|
761
|
+
return {
|
|
762
|
+
success: false,
|
|
763
|
+
error: `Target app returned HTTP ${response.status} at ${appUrl}. Make sure the app is running and accessible.`
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// Scan response body for common error patterns
|
|
768
|
+
const contentType = response.headers.get('content-type') || '';
|
|
769
|
+
if (contentType.includes('text/html') || contentType.includes('text/plain')) {
|
|
770
|
+
const body = await response.text();
|
|
771
|
+
const bodyLower = body.toLowerCase();
|
|
772
|
+
const bodySnippet = body.slice(0, 4000); // Limit scan size
|
|
773
|
+
|
|
774
|
+
// Common build/runtime error patterns
|
|
775
|
+
const errorPatterns = [
|
|
776
|
+
{ pattern: /Module not found|Cannot find module/i, msg: 'Module not found error detected' },
|
|
777
|
+
{ pattern: /SyntaxError|Unexpected token/i, msg: 'JavaScript syntax error detected' },
|
|
778
|
+
{ pattern: /TypeError|ReferenceError|RangeError/i, msg: 'JavaScript runtime error detected' },
|
|
779
|
+
{ pattern: /ENOENT|EACCES|EADDRINUSE/i, msg: 'Node.js filesystem/port error detected' },
|
|
780
|
+
{ pattern: /Cannot GET|Cannot POST|Not Found/i, msg: 'Route not found (404-like page)' },
|
|
781
|
+
{ pattern: /Compilation failed|Build failed|Failed to compile/i, msg: 'Build/compilation error detected' },
|
|
782
|
+
{ pattern: /Error: |ERROR |error occurred/i, msg: 'Error message found in page content' },
|
|
783
|
+
{ pattern: /<pre class="error">/i, msg: 'Error overlay detected (dev server error page)' },
|
|
784
|
+
{ pattern: /vite-error-overlay|react-error-overlay|nextjs-portal/i, msg: 'Framework error overlay detected' },
|
|
785
|
+
];
|
|
786
|
+
|
|
787
|
+
for (const { pattern, msg } of errorPatterns) {
|
|
788
|
+
const match = bodySnippet.match(pattern);
|
|
789
|
+
if (match) {
|
|
790
|
+
// Extract surrounding context (up to 150 chars around the match)
|
|
791
|
+
const idx = bodySnippet.indexOf(match[0]);
|
|
792
|
+
const start = Math.max(0, idx - 50);
|
|
793
|
+
const end = Math.min(bodySnippet.length, idx + match[0].length + 100);
|
|
794
|
+
const context = bodySnippet.slice(start, end)
|
|
795
|
+
.replace(/<[^>]+>/g, ' ') // Strip HTML tags
|
|
796
|
+
.replace(/\s+/g, ' ') // Collapse whitespace
|
|
797
|
+
.trim();
|
|
798
|
+
pageWarnings.push(`${msg}: ...${context}...`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Check if page is essentially empty (broken build output)
|
|
803
|
+
const textContent = body.replace(/<[^>]+>/g, '').trim();
|
|
804
|
+
if (textContent.length < 10 && !body.includes('<script')) {
|
|
805
|
+
pageWarnings.push('Page appears empty (no content or scripts). The app may not have built correctly.');
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
} catch (fetchErr) {
|
|
809
|
+
const isAbort = fetchErr.name === 'AbortError';
|
|
810
|
+
return {
|
|
811
|
+
success: false,
|
|
812
|
+
error: isAbort
|
|
813
|
+
? `Target app at ${appUrl} did not respond within 5 seconds. Make sure the dev server is running.`
|
|
814
|
+
: `Cannot reach ${appUrl}: ${fetchErr.message}. Start the dev server first, then retry open-editor.`
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Ensure visual editor server is running (no-op if already started at boot)
|
|
819
|
+
const server = getVisualEditorServer();
|
|
820
|
+
if (!server.isRunning) {
|
|
821
|
+
await server.start();
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// Get or create instance
|
|
825
|
+
const instance = await bridge.getInstance(agentId, {
|
|
826
|
+
appUrl,
|
|
827
|
+
projectRoot: context.projectRoot || context.workingDirectory
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// Generate editor URL using configurable port
|
|
831
|
+
const baseUrl = getVisualEditorBaseUrl();
|
|
832
|
+
const editorUrl = `${baseUrl}?agentId=${agentId}&appUrl=${encodeURIComponent(appUrl)}`;
|
|
833
|
+
|
|
834
|
+
// Update instance status
|
|
835
|
+
bridge.updateStatus(agentId, instance.status, {
|
|
836
|
+
editorUrl
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
// Broadcast to web-ui to open visual editor
|
|
840
|
+
this._broadcastOpenEditor(context, {
|
|
841
|
+
agentId,
|
|
842
|
+
appUrl,
|
|
843
|
+
editorUrl,
|
|
844
|
+
sessionId: context.sessionId
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
const result = {
|
|
848
|
+
success: true,
|
|
849
|
+
message: `Visual Editor opening with ${appUrl}. The preview panel will appear in the UI.`,
|
|
850
|
+
appUrl,
|
|
851
|
+
editorUrl,
|
|
852
|
+
instructions: 'Click elements in the preview to select them. You will receive context automatically.'
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
if (pageWarnings.length > 0) {
|
|
856
|
+
result.warnings = pageWarnings;
|
|
857
|
+
result.message += `\n\nWarnings detected on page:\n${pageWarnings.map(w => ` - ${w}`).join('\n')}`;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
return result;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Broadcast open-editor command to web-ui
|
|
865
|
+
* @private
|
|
866
|
+
*/
|
|
867
|
+
_broadcastOpenEditor(context, data) {
|
|
868
|
+
const message = {
|
|
869
|
+
type: 'visual_editor_open',
|
|
870
|
+
data: {
|
|
871
|
+
agentId: data.agentId,
|
|
872
|
+
appUrl: data.appUrl,
|
|
873
|
+
editorUrl: data.editorUrl
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// Method 1: Through agentPool messageProcessor
|
|
878
|
+
if (context.agentPool?.messageProcessor?.orchestrator?.webServer) {
|
|
879
|
+
context.agentPool.messageProcessor.orchestrator.webServer.broadcastToSession(
|
|
880
|
+
context.sessionId || 'web-session',
|
|
881
|
+
message
|
|
882
|
+
);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Method 2: Direct orchestrator access
|
|
887
|
+
if (context.orchestrator?.webServer) {
|
|
888
|
+
context.orchestrator.webServer.broadcastToSession(
|
|
889
|
+
context.sessionId || 'web-session',
|
|
890
|
+
message
|
|
891
|
+
);
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// Method 3: Global reference fallback
|
|
896
|
+
if (global.loxiaWebServer) {
|
|
897
|
+
global.loxiaWebServer.broadcastToSession(
|
|
898
|
+
context.sessionId || 'web-session',
|
|
899
|
+
message
|
|
900
|
+
);
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
this.logger?.warn('[VisualEditorTool] Could not broadcast open-editor command - no webServer access');
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// === Phase 5 Action Handlers ===
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Handle highlight action - highlight element in preview
|
|
911
|
+
* @private
|
|
912
|
+
*/
|
|
913
|
+
_handleHighlight(bridge, agentId, params) {
|
|
914
|
+
if (!agentId) {
|
|
915
|
+
return {
|
|
916
|
+
success: false,
|
|
917
|
+
error: 'Agent ID is required for highlight action'
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// Check if connected
|
|
922
|
+
if (!bridge.isConnected(agentId)) {
|
|
923
|
+
return {
|
|
924
|
+
success: false,
|
|
925
|
+
error: 'Not connected to visual editor. Start the editor first.',
|
|
926
|
+
hint: 'Use set-app-url to configure and connect to the visual editor'
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const duration = params.duration || 2000;
|
|
931
|
+
const sent = bridge.highlightElement(agentId, params.selector, duration);
|
|
932
|
+
|
|
933
|
+
return {
|
|
934
|
+
success: sent,
|
|
935
|
+
message: sent
|
|
936
|
+
? `Highlighting "${params.selector}" for ${duration}ms`
|
|
937
|
+
: 'Failed to send highlight command',
|
|
938
|
+
selector: params.selector,
|
|
939
|
+
duration
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Handle scroll-to action - scroll to element in preview
|
|
945
|
+
* @private
|
|
946
|
+
*/
|
|
947
|
+
_handleScrollTo(bridge, agentId, params) {
|
|
948
|
+
if (!agentId) {
|
|
949
|
+
return {
|
|
950
|
+
success: false,
|
|
951
|
+
error: 'Agent ID is required for scroll-to action'
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
if (!bridge.isConnected(agentId)) {
|
|
956
|
+
return {
|
|
957
|
+
success: false,
|
|
958
|
+
error: 'Not connected to visual editor. Start the editor first.'
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
const sent = bridge.scrollToElement(agentId, params.selector);
|
|
963
|
+
|
|
964
|
+
return {
|
|
965
|
+
success: sent,
|
|
966
|
+
message: sent
|
|
967
|
+
? `Scrolling to "${params.selector}"`
|
|
968
|
+
: 'Failed to send scroll command',
|
|
969
|
+
selector: params.selector
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Handle get-source action - get source code for selector
|
|
975
|
+
* @private
|
|
976
|
+
*/
|
|
977
|
+
async _handleGetSource(bridge, agentId, params) {
|
|
978
|
+
if (!agentId) {
|
|
979
|
+
return {
|
|
980
|
+
success: false,
|
|
981
|
+
error: 'Agent ID is required for get-source action'
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// Get visual context for the selector
|
|
986
|
+
const context = bridge.getVisualContext(agentId);
|
|
987
|
+
|
|
988
|
+
// If we have context with source hint, return it
|
|
989
|
+
if (context && context.sourceHint) {
|
|
990
|
+
const { file, line, component, codeSnippet, confidence } = context.sourceHint;
|
|
991
|
+
|
|
992
|
+
return {
|
|
993
|
+
success: true,
|
|
994
|
+
selector: params.selector,
|
|
995
|
+
source: {
|
|
996
|
+
file,
|
|
997
|
+
line,
|
|
998
|
+
component,
|
|
999
|
+
codeSnippet,
|
|
1000
|
+
confidence
|
|
1001
|
+
},
|
|
1002
|
+
message: file
|
|
1003
|
+
? `Source: ${file}:${line}${component ? ` (${component})` : ''}`
|
|
1004
|
+
: 'Source location available in context'
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// No source hint available
|
|
1009
|
+
return {
|
|
1010
|
+
success: true,
|
|
1011
|
+
selector: params.selector,
|
|
1012
|
+
source: null,
|
|
1013
|
+
message: 'No source information available for this selector. Try selecting the element in Visual Mode first.'
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Handle reload action - reload the preview
|
|
1019
|
+
* @private
|
|
1020
|
+
*/
|
|
1021
|
+
_handleReload(bridge, agentId) {
|
|
1022
|
+
if (!agentId) {
|
|
1023
|
+
return {
|
|
1024
|
+
success: false,
|
|
1025
|
+
error: 'Agent ID is required for reload action'
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (!bridge.isConnected(agentId)) {
|
|
1030
|
+
return {
|
|
1031
|
+
success: false,
|
|
1032
|
+
error: 'Not connected to visual editor. Start the editor first.'
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const sent = bridge.reloadPreview(agentId);
|
|
1037
|
+
|
|
1038
|
+
return {
|
|
1039
|
+
success: sent,
|
|
1040
|
+
message: sent
|
|
1041
|
+
? 'Preview reload requested'
|
|
1042
|
+
: 'Failed to send reload command'
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Handle set-mode action - switch editor mode
|
|
1048
|
+
* @private
|
|
1049
|
+
*/
|
|
1050
|
+
_handleSetMode(bridge, agentId, params) {
|
|
1051
|
+
if (!agentId) {
|
|
1052
|
+
return {
|
|
1053
|
+
success: false,
|
|
1054
|
+
error: 'Agent ID is required for set-mode action'
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
if (!bridge.isConnected(agentId)) {
|
|
1059
|
+
return {
|
|
1060
|
+
success: false,
|
|
1061
|
+
error: 'Not connected to visual editor. Start the editor first.'
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
const mode = params.mode;
|
|
1066
|
+
if (!['edit', 'preview'].includes(mode)) {
|
|
1067
|
+
return {
|
|
1068
|
+
success: false,
|
|
1069
|
+
error: `Invalid mode: ${mode}. Must be 'edit' or 'preview'`
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const sent = bridge.setEditorMode(agentId, mode);
|
|
1074
|
+
|
|
1075
|
+
return {
|
|
1076
|
+
success: sent,
|
|
1077
|
+
message: sent
|
|
1078
|
+
? `Editor mode set to '${mode}'`
|
|
1079
|
+
: 'Failed to send mode command',
|
|
1080
|
+
mode
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Format visual context for agent consumption
|
|
1086
|
+
* @private
|
|
1087
|
+
*/
|
|
1088
|
+
_formatContextForAgent(context) {
|
|
1089
|
+
let formatted = `[VISUAL CONTEXT - User selected element]\n`;
|
|
1090
|
+
formatted += `Element: <${context.tagName}`;
|
|
1091
|
+
|
|
1092
|
+
// Add key attributes
|
|
1093
|
+
if (context.attributes?.class) {
|
|
1094
|
+
formatted += ` class="${context.attributes.class}"`;
|
|
1095
|
+
}
|
|
1096
|
+
if (context.attributes?.id) {
|
|
1097
|
+
formatted += ` id="${context.attributes.id}"`;
|
|
1098
|
+
}
|
|
1099
|
+
formatted += '>\n';
|
|
1100
|
+
|
|
1101
|
+
// Add CSS selector for precise targeting
|
|
1102
|
+
if (context.selector) {
|
|
1103
|
+
formatted += `Selector: ${context.selector}\n`;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
// Add text content if available
|
|
1107
|
+
if (context.text) {
|
|
1108
|
+
const truncated = context.text.length > 50
|
|
1109
|
+
? context.text.substring(0, 50) + '...'
|
|
1110
|
+
: context.text;
|
|
1111
|
+
formatted += `Text: "${truncated}"\n`;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
// Add source hint if available
|
|
1115
|
+
if (context.sourceHint) {
|
|
1116
|
+
const { file, fullPath, line, component, confidence } = context.sourceHint;
|
|
1117
|
+
|
|
1118
|
+
// Use file path if available, fallback to fullPath
|
|
1119
|
+
const filePath = file || fullPath;
|
|
1120
|
+
|
|
1121
|
+
if (filePath) {
|
|
1122
|
+
formatted += `Source: ${filePath}`;
|
|
1123
|
+
if (line) {
|
|
1124
|
+
formatted += `:${line}`;
|
|
1125
|
+
}
|
|
1126
|
+
if (component) {
|
|
1127
|
+
formatted += ` (Component: ${component})`;
|
|
1128
|
+
}
|
|
1129
|
+
if (confidence === 'low') {
|
|
1130
|
+
formatted += ' [VERIFY - low confidence]';
|
|
1131
|
+
}
|
|
1132
|
+
formatted += '\n';
|
|
1133
|
+
} else if (component) {
|
|
1134
|
+
// Even without file path, component name is useful
|
|
1135
|
+
formatted += `Component: ${component}`;
|
|
1136
|
+
if (confidence === 'low') {
|
|
1137
|
+
formatted += ' [source file unknown]';
|
|
1138
|
+
}
|
|
1139
|
+
formatted += '\n';
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// Add code snippet if available
|
|
1143
|
+
if (context.sourceHint.codeSnippet) {
|
|
1144
|
+
formatted += 'Code:\n';
|
|
1145
|
+
formatted += context.sourceHint.codeSnippet;
|
|
1146
|
+
formatted += '\n';
|
|
1147
|
+
}
|
|
1148
|
+
} else {
|
|
1149
|
+
// No React source info - indicate this is likely vanilla HTML/CSS
|
|
1150
|
+
formatted += `Note: No React source mapping available (plain HTML element)\n`;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
return formatted;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* Inject visual context into user message
|
|
1158
|
+
* Called by messageProcessor when visual context exists
|
|
1159
|
+
* @param {string} userMessage - Original user message
|
|
1160
|
+
* @param {Object} context - Visual context
|
|
1161
|
+
* @returns {string} Enhanced message with visual context
|
|
1162
|
+
*/
|
|
1163
|
+
static injectContextIntoMessage(userMessage, visualContext) {
|
|
1164
|
+
if (!visualContext) {
|
|
1165
|
+
return userMessage;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
const tool = new VisualEditorTool();
|
|
1169
|
+
const formatted = tool._formatContextForAgent(visualContext);
|
|
1170
|
+
|
|
1171
|
+
return `${formatted}\n[USER MESSAGE]\n${userMessage}`;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
export default VisualEditorTool;
|