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
package/src/index.js
ADDED
|
@@ -0,0 +1,972 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loxia Autopilot One - Main Application Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* - Initialize all system components
|
|
6
|
+
* - Setup dependency injection
|
|
7
|
+
* - Start interface handlers
|
|
8
|
+
* - Handle graceful shutdown
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
import { exec } from 'child_process';
|
|
14
|
+
import { createLogger } from './utilities/logger.js';
|
|
15
|
+
import { createConfigManager } from './utilities/configManager.js';
|
|
16
|
+
import Orchestrator from './core/orchestrator.js';
|
|
17
|
+
import AgentPool from './core/agentPool.js';
|
|
18
|
+
import MessageProcessor from './core/messageProcessor.js';
|
|
19
|
+
import AgentScheduler from './core/agentScheduler.js';
|
|
20
|
+
import ContextManager from './core/contextManager.js';
|
|
21
|
+
import StateManager from './core/stateManager.js';
|
|
22
|
+
import AIService from './services/aiService.js';
|
|
23
|
+
import BudgetService from './services/budgetService.js';
|
|
24
|
+
import ErrorHandler from './services/errorHandler.js';
|
|
25
|
+
import BenchmarkService from './services/benchmarkService.js';
|
|
26
|
+
import ModelRouterService from './services/modelRouterService.js';
|
|
27
|
+
import ModelsService from './services/modelsService.js';
|
|
28
|
+
import ApiKeyManager from './services/apiKeyManager.js';
|
|
29
|
+
import { getCredentialVault } from './services/credentialVault.js';
|
|
30
|
+
import FileAttachmentService from './services/fileAttachmentService.js';
|
|
31
|
+
import { ToolsRegistry } from './tools/baseTool.js';
|
|
32
|
+
import AgentDelayTool from './tools/agentDelayTool.js';
|
|
33
|
+
import TerminalTool from './tools/terminalTool.js';
|
|
34
|
+
import FileSystemTool from './tools/fileSystemTool.js';
|
|
35
|
+
// BrowserTool is DEPRECATED - use WebTool instead
|
|
36
|
+
// import BrowserTool from './tools/browserTool.js';
|
|
37
|
+
import JobDoneTool from './tools/jobDoneTool.js';
|
|
38
|
+
import AgentCommunicationTool from './tools/agentCommunicationTool.js';
|
|
39
|
+
import TaskManagerTool from './tools/taskManagerTool.js';
|
|
40
|
+
import ImportAnalyzerTool from './tools/importAnalyzerTool.js';
|
|
41
|
+
import DependencyResolverTool from './tools/dependencyResolverTool.js';
|
|
42
|
+
import ImageTool from './tools/imageTool.js';
|
|
43
|
+
// TODO: Re-enable video generation once Sora replacement is available
|
|
44
|
+
// import VideoTool from './tools/videoTool.js';
|
|
45
|
+
import StaticAnalysisTool from './tools/staticAnalysisTool.js';
|
|
46
|
+
import CloneDetectionTool from './tools/cloneDetectionTool.js';
|
|
47
|
+
import FileTreeTool from './tools/fileTreeTool.js';
|
|
48
|
+
import FileContentReplaceTool from './tools/fileContentReplaceTool.js';
|
|
49
|
+
import SeekTool from './tools/seekTool.js';
|
|
50
|
+
import WebTool from './tools/webTool.js';
|
|
51
|
+
import VisualEditorTool from './tools/visualEditorTool.js';
|
|
52
|
+
import PdfTool from './tools/pdfTool.js';
|
|
53
|
+
import HelpTool from './tools/helpTool.js';
|
|
54
|
+
import DocxTool from './tools/docxTool.js';
|
|
55
|
+
import ExcelTool from './tools/excelTool.js';
|
|
56
|
+
import MemoryTool from './tools/memoryTool.js';
|
|
57
|
+
import SkillsTool from './tools/skillsTool.js';
|
|
58
|
+
import VisionTool from './tools/visionTool.js';
|
|
59
|
+
import UserPromptTool from './tools/userPromptTool.js';
|
|
60
|
+
import CodeMapTool from './tools/codeMapTool.js';
|
|
61
|
+
import WhatsAppTool from './tools/whatsappTool.js';
|
|
62
|
+
import ScheduleService from './services/scheduleService.js';
|
|
63
|
+
import AsyncToolManager from './tools/asyncToolManager.js';
|
|
64
|
+
import WebServer from './interfaces/webServer.js';
|
|
65
|
+
|
|
66
|
+
import {
|
|
67
|
+
SYSTEM_VERSION,
|
|
68
|
+
INTERFACE_TYPES
|
|
69
|
+
} from './utilities/constants.js';
|
|
70
|
+
import {
|
|
71
|
+
getUserDataDir,
|
|
72
|
+
ensureUserDataDirs,
|
|
73
|
+
migrateFromOldLocation,
|
|
74
|
+
getLegacyDataPaths
|
|
75
|
+
} from './utilities/userDataDir.js';
|
|
76
|
+
|
|
77
|
+
class LoxiaApplication {
|
|
78
|
+
constructor() {
|
|
79
|
+
this.logger = null;
|
|
80
|
+
this.config = null;
|
|
81
|
+
this.orchestrator = null;
|
|
82
|
+
this.interfaces = new Map();
|
|
83
|
+
this.isShuttingDown = false;
|
|
84
|
+
|
|
85
|
+
// Bind shutdown handler
|
|
86
|
+
this.shutdown = this.shutdown.bind(this);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Initialize the application
|
|
91
|
+
* @param {Object} options - Initialization options
|
|
92
|
+
* @returns {Promise<void>}
|
|
93
|
+
*/
|
|
94
|
+
async initialize(options = {}) {
|
|
95
|
+
try {
|
|
96
|
+
console.log(`🚀 Starting Loxia Autopilot One v${SYSTEM_VERSION}`);
|
|
97
|
+
|
|
98
|
+
// Initialize configuration
|
|
99
|
+
await this.initializeConfig(options);
|
|
100
|
+
|
|
101
|
+
// Initialize logging
|
|
102
|
+
await this.initializeLogging();
|
|
103
|
+
|
|
104
|
+
this.logger.info('Loxia Autopilot One starting up', {
|
|
105
|
+
version: SYSTEM_VERSION,
|
|
106
|
+
nodeVersion: process.version,
|
|
107
|
+
platform: process.platform,
|
|
108
|
+
projectDir: options.projectDir || process.cwd()
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// IMPORTANT: Initialize persistent user data directory and migrate legacy data
|
|
112
|
+
// This ensures user data (agents, conversations, settings) survives npm updates
|
|
113
|
+
await this.initializeUserDataDirectory();
|
|
114
|
+
|
|
115
|
+
// Initialize core components
|
|
116
|
+
await this.initializeCoreComponents();
|
|
117
|
+
|
|
118
|
+
// Initialize tools
|
|
119
|
+
await this.initializeTools();
|
|
120
|
+
|
|
121
|
+
this.logger.info('Starting interface initialization...');
|
|
122
|
+
|
|
123
|
+
// Initialize interfaces
|
|
124
|
+
await this.initializeInterfaces(options);
|
|
125
|
+
|
|
126
|
+
this.logger.info('Interface initialization completed');
|
|
127
|
+
|
|
128
|
+
// Setup shutdown handlers
|
|
129
|
+
this.setupShutdownHandlers();
|
|
130
|
+
|
|
131
|
+
this.logger.info('Loxia Autopilot One startup complete');
|
|
132
|
+
console.log('✅ Loxia Autopilot One is ready!');
|
|
133
|
+
|
|
134
|
+
} catch (error) {
|
|
135
|
+
console.error('❌ Failed to initialize Loxia Autopilot One:', error.message);
|
|
136
|
+
if (this.logger) {
|
|
137
|
+
this.logger.error('Application initialization failed', {
|
|
138
|
+
error: error.message,
|
|
139
|
+
stack: error.stack
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Initialize configuration management
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
async initializeConfig(options) {
|
|
151
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
152
|
+
const __dirname = path.dirname(__filename);
|
|
153
|
+
|
|
154
|
+
const configPaths = [
|
|
155
|
+
path.join(__dirname, '../config/default.json'),
|
|
156
|
+
...(options.configPaths || [])
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
this.configManager = createConfigManager({
|
|
160
|
+
configPaths,
|
|
161
|
+
envPrefix: 'LOXIA'
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
this.config = await this.configManager.loadConfig();
|
|
165
|
+
|
|
166
|
+
// Enable config watching if requested
|
|
167
|
+
if (options.watchConfig) {
|
|
168
|
+
await this.configManager.watchConfig(true);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Initialize logging system
|
|
174
|
+
* @private
|
|
175
|
+
*/
|
|
176
|
+
async initializeLogging() {
|
|
177
|
+
const loggingConfig = this.config.logging || {};
|
|
178
|
+
|
|
179
|
+
this.logger = createLogger({
|
|
180
|
+
level: loggingConfig.level || 'info',
|
|
181
|
+
outputs: loggingConfig.outputs || ['console'],
|
|
182
|
+
colors: loggingConfig.colors !== false,
|
|
183
|
+
timestamp: loggingConfig.timestamp !== false,
|
|
184
|
+
logFile: loggingConfig.logFile,
|
|
185
|
+
maxFileSize: loggingConfig.maxFileSize,
|
|
186
|
+
maxFiles: loggingConfig.maxFiles
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
await this.logger.initialize();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Initialize persistent user data directory and migrate legacy data
|
|
194
|
+
* This ensures user data survives npm package updates
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
async initializeUserDataDirectory() {
|
|
198
|
+
try {
|
|
199
|
+
// Create user data directory structure
|
|
200
|
+
const paths = await ensureUserDataDirs();
|
|
201
|
+
const userDataDir = getUserDataDir();
|
|
202
|
+
|
|
203
|
+
this.logger.info('User data directory initialized', {
|
|
204
|
+
location: userDataDir,
|
|
205
|
+
platform: process.platform
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Check for legacy data and migrate if needed
|
|
209
|
+
const legacyPaths = getLegacyDataPaths();
|
|
210
|
+
for (const legacyPath of legacyPaths) {
|
|
211
|
+
try {
|
|
212
|
+
const result = await migrateFromOldLocation(legacyPath, {
|
|
213
|
+
dryRun: false,
|
|
214
|
+
logger: this.logger
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (result.migrated.length > 0) {
|
|
218
|
+
this.logger.info('Successfully migrated data from legacy location', {
|
|
219
|
+
from: legacyPath,
|
|
220
|
+
migratedCount: result.migrated.length
|
|
221
|
+
});
|
|
222
|
+
console.log(`📦 Migrated ${result.migrated.length} items from legacy location to ${userDataDir}`);
|
|
223
|
+
}
|
|
224
|
+
} catch (migrationError) {
|
|
225
|
+
// Non-fatal: log and continue
|
|
226
|
+
this.logger.warn('Failed to migrate from legacy location', {
|
|
227
|
+
legacyPath,
|
|
228
|
+
error: migrationError.message
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
} catch (error) {
|
|
234
|
+
this.logger.error('Failed to initialize user data directory', {
|
|
235
|
+
error: error.message
|
|
236
|
+
});
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Initialize core system components
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
async initializeCoreComponents() {
|
|
246
|
+
this.logger.info('Initializing core components...');
|
|
247
|
+
|
|
248
|
+
// State Manager
|
|
249
|
+
this.stateManager = new StateManager(this.config, this.logger);
|
|
250
|
+
|
|
251
|
+
// File Attachment Service
|
|
252
|
+
this.fileAttachmentService = new FileAttachmentService(this.config, this.logger);
|
|
253
|
+
await this.fileAttachmentService.initialize();
|
|
254
|
+
|
|
255
|
+
// Context Manager
|
|
256
|
+
this.contextManager = new ContextManager(this.config, this.logger);
|
|
257
|
+
|
|
258
|
+
// Tools Registry and Async Tool Manager
|
|
259
|
+
this.toolsRegistry = new ToolsRegistry(this.logger);
|
|
260
|
+
this.asyncToolManager = new AsyncToolManager(this.config, this.logger);
|
|
261
|
+
|
|
262
|
+
// Agent Pool (with tools registry for prompt enhancement)
|
|
263
|
+
this.agentPool = new AgentPool(
|
|
264
|
+
this.config,
|
|
265
|
+
this.logger,
|
|
266
|
+
this.stateManager,
|
|
267
|
+
this.contextManager,
|
|
268
|
+
this.toolsRegistry
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
// Initialize Budget Service and Error Handler
|
|
272
|
+
this.budgetService = new BudgetService(this.config, this.logger);
|
|
273
|
+
this.errorHandler = new ErrorHandler(this.config, this.logger);
|
|
274
|
+
|
|
275
|
+
// API Key Manager
|
|
276
|
+
this.apiKeyManager = new ApiKeyManager(this.logger);
|
|
277
|
+
await this.apiKeyManager.initialize(); // Load persisted keys
|
|
278
|
+
|
|
279
|
+
// Credential Vault for secure website credential management
|
|
280
|
+
this.credentialVault = getCredentialVault(this.logger);
|
|
281
|
+
await this.credentialVault.initialize(); // Load persisted credentials
|
|
282
|
+
|
|
283
|
+
// WhatsApp Service (optional — requires whatsapp-web.js)
|
|
284
|
+
try {
|
|
285
|
+
const { default: WhatsAppService } = await import('./services/whatsappService.js');
|
|
286
|
+
this.whatsappService = new WhatsAppService(this.logger);
|
|
287
|
+
this.logger.info('WhatsApp service initialized');
|
|
288
|
+
} catch (e) {
|
|
289
|
+
this.whatsappService = null;
|
|
290
|
+
this.logger.info('WhatsApp service unavailable (whatsapp-web.js not installed)', { error: e.message });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Telegram Service (optional — requires node-telegram-bot-api)
|
|
294
|
+
try {
|
|
295
|
+
const { getTelegramService } = await import('./services/telegramService.js');
|
|
296
|
+
this.telegramService = getTelegramService(this.logger);
|
|
297
|
+
this.logger.info('Telegram service initialized');
|
|
298
|
+
} catch (e) {
|
|
299
|
+
this.telegramService = null;
|
|
300
|
+
this.logger.info('Telegram service unavailable', { error: e.message });
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Schedule Service
|
|
304
|
+
this.scheduleService = new ScheduleService(this.logger);
|
|
305
|
+
await this.scheduleService.initialize();
|
|
306
|
+
|
|
307
|
+
// AI Service
|
|
308
|
+
this.aiService = new AIService(
|
|
309
|
+
this.config,
|
|
310
|
+
this.logger,
|
|
311
|
+
this.budgetService,
|
|
312
|
+
this.errorHandler
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
// Set API Key Manager reference in AI Service
|
|
316
|
+
this.aiService.setApiKeyManager(this.apiKeyManager);
|
|
317
|
+
|
|
318
|
+
// Set Agent Pool reference in AI Service
|
|
319
|
+
this.aiService.setAgentPool(this.agentPool);
|
|
320
|
+
|
|
321
|
+
// Initialize Model Routing Services
|
|
322
|
+
this.benchmarkService = new BenchmarkService(this.config, this.logger);
|
|
323
|
+
this.modelsService = new ModelsService(this.config, this.logger);
|
|
324
|
+
this.modelRouterService = new ModelRouterService(
|
|
325
|
+
this.config,
|
|
326
|
+
this.logger,
|
|
327
|
+
this.benchmarkService,
|
|
328
|
+
this.aiService
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
// Set API Key Manager reference in ModelsService
|
|
332
|
+
this.modelsService.setApiKeyManager(this.apiKeyManager);
|
|
333
|
+
|
|
334
|
+
// Set ModelsService reference in AI Service (for model suggestions on errors)
|
|
335
|
+
this.aiService.setModelsService(this.modelsService);
|
|
336
|
+
|
|
337
|
+
// Set ModelsService reference in BudgetService (for dynamic pricing lookup)
|
|
338
|
+
this.budgetService.setModelsService(this.modelsService);
|
|
339
|
+
|
|
340
|
+
// Initialize services
|
|
341
|
+
await this.benchmarkService.initialize();
|
|
342
|
+
await this.modelsService.initialize();
|
|
343
|
+
|
|
344
|
+
// Message Processor
|
|
345
|
+
this.messageProcessor = new MessageProcessor(
|
|
346
|
+
this.config,
|
|
347
|
+
this.logger,
|
|
348
|
+
this.toolsRegistry,
|
|
349
|
+
this.agentPool,
|
|
350
|
+
this.contextManager,
|
|
351
|
+
this.aiService,
|
|
352
|
+
this.modelRouterService,
|
|
353
|
+
this.modelsService
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
// Agent Scheduler - NEW ARCHITECTURE
|
|
357
|
+
this.agentScheduler = new AgentScheduler(
|
|
358
|
+
this.agentPool,
|
|
359
|
+
this.messageProcessor,
|
|
360
|
+
this.aiService,
|
|
361
|
+
this.logger,
|
|
362
|
+
null, // webSocketManager will be set later
|
|
363
|
+
this.modelRouterService,
|
|
364
|
+
this.modelsService
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
// Note: Scheduler will be started after WebSocketManager is initialized
|
|
368
|
+
|
|
369
|
+
// Orchestrator
|
|
370
|
+
this.orchestrator = new Orchestrator(
|
|
371
|
+
this.config,
|
|
372
|
+
this.logger,
|
|
373
|
+
this.agentPool,
|
|
374
|
+
this.messageProcessor,
|
|
375
|
+
this.aiService,
|
|
376
|
+
this.stateManager
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
// Set cross-references between components
|
|
380
|
+
this.messageProcessor.orchestrator = this.orchestrator;
|
|
381
|
+
this.messageProcessor.setScheduler(this.agentScheduler);
|
|
382
|
+
this.agentPool.setMessageProcessor(this.messageProcessor);
|
|
383
|
+
this.agentPool.setScheduler(this.agentScheduler);
|
|
384
|
+
this.agentPool.setFileAttachmentService(this.fileAttachmentService);
|
|
385
|
+
|
|
386
|
+
// Attach FileAttachmentService to orchestrator for webServer access
|
|
387
|
+
this.orchestrator.fileAttachmentService = this.fileAttachmentService;
|
|
388
|
+
|
|
389
|
+
// Wire ScheduleService dependencies
|
|
390
|
+
this.scheduleService.setAgentPool(this.agentPool);
|
|
391
|
+
this.scheduleService.setMessageProcessor(this.messageProcessor);
|
|
392
|
+
this.scheduleService.setOrchestrator(this.orchestrator);
|
|
393
|
+
|
|
394
|
+
this.logger.info('Core components initialized');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Initialize tools system
|
|
399
|
+
* @private
|
|
400
|
+
*/
|
|
401
|
+
async initializeTools() {
|
|
402
|
+
this.logger.info('Initializing tools...');
|
|
403
|
+
|
|
404
|
+
// Register Agent Delay Tool
|
|
405
|
+
await this.toolsRegistry.registerTool(AgentDelayTool);
|
|
406
|
+
|
|
407
|
+
// Register Terminal Tool
|
|
408
|
+
await this.toolsRegistry.registerTool(TerminalTool);
|
|
409
|
+
|
|
410
|
+
// Register File System Tool
|
|
411
|
+
await this.toolsRegistry.registerTool(FileSystemTool);
|
|
412
|
+
|
|
413
|
+
// Register Job Done Tool
|
|
414
|
+
await this.toolsRegistry.registerTool(JobDoneTool);
|
|
415
|
+
|
|
416
|
+
// Register Agent Communication Tool
|
|
417
|
+
await this.toolsRegistry.registerTool(AgentCommunicationTool);
|
|
418
|
+
|
|
419
|
+
// Register Task Manager Tool
|
|
420
|
+
await this.toolsRegistry.registerTool(TaskManagerTool);
|
|
421
|
+
|
|
422
|
+
// Register Import Analyzer Tool
|
|
423
|
+
await this.toolsRegistry.registerTool(ImportAnalyzerTool);
|
|
424
|
+
|
|
425
|
+
// Register Dependency Resolver Tool
|
|
426
|
+
await this.toolsRegistry.registerTool(DependencyResolverTool);
|
|
427
|
+
|
|
428
|
+
// Register Image Generation Tool
|
|
429
|
+
await this.toolsRegistry.registerTool(ImageTool);
|
|
430
|
+
|
|
431
|
+
// Register Video Generation Tool
|
|
432
|
+
// TODO: Re-enable video generation once Sora replacement is available
|
|
433
|
+
// await this.toolsRegistry.registerTool(VideoTool);
|
|
434
|
+
|
|
435
|
+
// Register Static Analysis Tool
|
|
436
|
+
await this.toolsRegistry.registerTool(StaticAnalysisTool);
|
|
437
|
+
|
|
438
|
+
// Register Clone Detection Tool
|
|
439
|
+
await this.toolsRegistry.registerTool(CloneDetectionTool);
|
|
440
|
+
|
|
441
|
+
// Register File Tree Tool
|
|
442
|
+
await this.toolsRegistry.registerTool(FileTreeTool);
|
|
443
|
+
|
|
444
|
+
// Register File Content Replace Tool
|
|
445
|
+
await this.toolsRegistry.registerTool(FileContentReplaceTool);
|
|
446
|
+
|
|
447
|
+
// Register Seek Tool
|
|
448
|
+
await this.toolsRegistry.registerTool(SeekTool);
|
|
449
|
+
|
|
450
|
+
// Register Web Tool
|
|
451
|
+
await this.toolsRegistry.registerTool(WebTool);
|
|
452
|
+
|
|
453
|
+
// Register Visual Editor Tool
|
|
454
|
+
await this.toolsRegistry.registerTool(VisualEditorTool);
|
|
455
|
+
|
|
456
|
+
// Register PDF Tool
|
|
457
|
+
await this.toolsRegistry.registerTool(PdfTool);
|
|
458
|
+
|
|
459
|
+
// Register Help Tool (two-layer tool description system)
|
|
460
|
+
await this.toolsRegistry.registerTool(HelpTool);
|
|
461
|
+
|
|
462
|
+
// Register Document (DOCX) Tool
|
|
463
|
+
await this.toolsRegistry.registerTool(DocxTool);
|
|
464
|
+
|
|
465
|
+
// Register Spreadsheet (Excel) Tool
|
|
466
|
+
await this.toolsRegistry.registerTool(ExcelTool);
|
|
467
|
+
|
|
468
|
+
// Register Memory Tool
|
|
469
|
+
await this.toolsRegistry.registerTool(MemoryTool);
|
|
470
|
+
await this.toolsRegistry.registerTool(SkillsTool);
|
|
471
|
+
await this.toolsRegistry.registerTool(VisionTool);
|
|
472
|
+
|
|
473
|
+
// Register User Prompt Tool
|
|
474
|
+
await this.toolsRegistry.registerTool(UserPromptTool);
|
|
475
|
+
|
|
476
|
+
// Register Code Map Tool
|
|
477
|
+
await this.toolsRegistry.registerTool(CodeMapTool);
|
|
478
|
+
|
|
479
|
+
// Register WhatsApp Tool
|
|
480
|
+
await this.toolsRegistry.registerTool(WhatsAppTool);
|
|
481
|
+
|
|
482
|
+
// Set ToolsRegistry dependency for HelpTool (two-layer tool description system)
|
|
483
|
+
const helpTool = this.toolsRegistry.getTool('help');
|
|
484
|
+
if (helpTool && typeof helpTool.setToolsRegistry === 'function') {
|
|
485
|
+
helpTool.setToolsRegistry(this.toolsRegistry);
|
|
486
|
+
this.logger.info('ToolsRegistry set for Help Tool');
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// NOTE: BrowserTool is DEPRECATED as of December 2024
|
|
490
|
+
// Use WebTool (toolId: "web") for all browser automation tasks
|
|
491
|
+
// The Browser tool registration has been removed - WebTool provides
|
|
492
|
+
// equivalent functionality with better architecture (singleton browser instance)
|
|
493
|
+
|
|
494
|
+
// Set AgentPool dependency for AgentDelayTool
|
|
495
|
+
const agentDelayTool = this.toolsRegistry.getTool('agentdelay');
|
|
496
|
+
if (agentDelayTool && typeof agentDelayTool.setAgentPool === 'function') {
|
|
497
|
+
agentDelayTool.setAgentPool(this.agentPool);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// Set AgentPool dependency for JobDoneTool
|
|
501
|
+
const jobDoneTool = this.toolsRegistry.getTool('jobdone');
|
|
502
|
+
if (jobDoneTool && typeof jobDoneTool.setAgentPool === 'function') {
|
|
503
|
+
jobDoneTool.setAgentPool(this.agentPool);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Set AgentPool and Scheduler dependencies for TaskManagerTool
|
|
507
|
+
const taskManagerTool = this.toolsRegistry.getTool('taskmanager');
|
|
508
|
+
if (taskManagerTool && typeof taskManagerTool.setAgentPool === 'function') {
|
|
509
|
+
taskManagerTool.setAgentPool(this.agentPool);
|
|
510
|
+
}
|
|
511
|
+
if (taskManagerTool && typeof taskManagerTool.setScheduler === 'function') {
|
|
512
|
+
taskManagerTool.setScheduler(this.scheduler);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Note: AgentCommunicationTool receives agentPool through execution context
|
|
516
|
+
// No need to set it directly as it's passed in the context parameter
|
|
517
|
+
const agentCommTool = this.toolsRegistry.getTool('agentcommunication');
|
|
518
|
+
if (agentCommTool) {
|
|
519
|
+
this.logger.info('Agent Communication Tool registered successfully');
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Set AIService dependency for ImageTool
|
|
523
|
+
const imageTool = this.toolsRegistry.getTool('image-gen');
|
|
524
|
+
if (imageTool && typeof imageTool.setAIService === 'function') {
|
|
525
|
+
imageTool.setAIService(this.aiService);
|
|
526
|
+
this.logger.info('AIService set for Image Generation Tool');
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// Set AgentPool dependency for ImageTool (for conversation history persistence)
|
|
530
|
+
if (imageTool && typeof imageTool.setAgentPool === 'function') {
|
|
531
|
+
imageTool.setAgentPool(this.agentPool);
|
|
532
|
+
this.logger.info('AgentPool set for Image Generation Tool');
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// Set dependencies for VisionTool
|
|
536
|
+
const visionTool = this.toolsRegistry.getTool('vision');
|
|
537
|
+
if (visionTool && typeof visionTool.setAIService === 'function') {
|
|
538
|
+
visionTool.setAIService(this.aiService);
|
|
539
|
+
if (this.modelsService) visionTool.setModelsService(this.modelsService);
|
|
540
|
+
if (this.agentPool) visionTool.setAgentPool(this.agentPool);
|
|
541
|
+
this.logger.info('Dependencies set for Vision Tool');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// TODO: Re-enable video generation once Sora replacement is available
|
|
545
|
+
// const videoTool = this.toolsRegistry.getTool('video-gen');
|
|
546
|
+
// if (videoTool && typeof videoTool.setAIService === 'function') {
|
|
547
|
+
// videoTool.setAIService(this.aiService);
|
|
548
|
+
// this.logger.info('AIService set for Video Generation Tool');
|
|
549
|
+
// }
|
|
550
|
+
// if (videoTool && typeof videoTool.setAgentPool === 'function') {
|
|
551
|
+
// videoTool.setAgentPool(this.agentPool);
|
|
552
|
+
// this.logger.info('AgentPool set for Video Generation Tool');
|
|
553
|
+
// }
|
|
554
|
+
|
|
555
|
+
// Set WhatsApp Service dependency for WhatsApp Tool
|
|
556
|
+
const whatsappTool = this.toolsRegistry.getTool('whatsapp');
|
|
557
|
+
if (whatsappTool && typeof whatsappTool.setWhatsAppService === 'function') {
|
|
558
|
+
whatsappTool.setWhatsAppService(this.whatsappService);
|
|
559
|
+
this.logger.info('WhatsAppService set for WhatsApp Tool');
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const toolCapabilities = this.toolsRegistry.getToolCapabilities();
|
|
563
|
+
this.logger.info('Tools initialized', {
|
|
564
|
+
toolCount: Object.keys(toolCapabilities).length,
|
|
565
|
+
enabledTools: Object.keys(toolCapabilities).filter(id => toolCapabilities[id].capabilities.enabled),
|
|
566
|
+
registeredTools: this.toolsRegistry.listTools()
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// Log tool descriptions for debugging
|
|
570
|
+
if (this.logger.level === 'debug') {
|
|
571
|
+
for (const [toolId, tool] of Object.entries(toolCapabilities)) {
|
|
572
|
+
this.logger.debug(`Tool ${toolId} capabilities`, tool.capabilities);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Initialize interface handlers
|
|
579
|
+
* @private
|
|
580
|
+
*/
|
|
581
|
+
async initializeInterfaces(options) {
|
|
582
|
+
this.logger.info('Initializing interfaces...');
|
|
583
|
+
|
|
584
|
+
const interfaceConfig = this.config.interfaces || {};
|
|
585
|
+
const uiMode = process.env.LOXIA_UI_MODE || 'cli'; // Default to old CLI
|
|
586
|
+
|
|
587
|
+
// CLI Interface - Load old readline CLI (unless terminal UI mode is specified)
|
|
588
|
+
// NOTE: Terminal UI mode runs as a separate WebSocket client, not in the main process
|
|
589
|
+
if (interfaceConfig.cli?.enabled !== false && uiMode !== 'terminal') {
|
|
590
|
+
// Use old CLI (readline-based)
|
|
591
|
+
this.logger.info('Loading CLI (readline)...');
|
|
592
|
+
const { default: CLIInterface } = await import('./interfaces/cli.js');
|
|
593
|
+
const cliInterface = new CLIInterface(
|
|
594
|
+
this.orchestrator,
|
|
595
|
+
this.logger,
|
|
596
|
+
interfaceConfig.cli || {}
|
|
597
|
+
);
|
|
598
|
+
|
|
599
|
+
await cliInterface.initialize();
|
|
600
|
+
this.interfaces.set(INTERFACE_TYPES.CLI, cliInterface);
|
|
601
|
+
|
|
602
|
+
this.logger.info('CLI interface initialized');
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// If terminal UI mode, skip CLI - Terminal UI will connect as WebSocket client
|
|
606
|
+
if (uiMode === 'terminal') {
|
|
607
|
+
this.logger.info('Terminal UI mode: Server-only startup (Terminal UI will connect as WebSocket client)');
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// Web Interface - now implemented
|
|
611
|
+
if (interfaceConfig.web?.enabled !== false) {
|
|
612
|
+
// Read port from environment variables (set by CLI) or use config defaults
|
|
613
|
+
const webPort = parseInt(process.env.LOXIA_PORT || process.env.PORT, 10) || 8080;
|
|
614
|
+
// Use env var, then config, then 127.0.0.1 (avoid 'localhost' due to IPv6 issues)
|
|
615
|
+
const webHost = process.env.LOXIA_HOST || interfaceConfig.web?.host || '127.0.0.1';
|
|
616
|
+
|
|
617
|
+
const webConfig = {
|
|
618
|
+
...interfaceConfig.web,
|
|
619
|
+
port: webPort,
|
|
620
|
+
host: webHost,
|
|
621
|
+
backend: this.config.backend
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const webServer = new WebServer(
|
|
625
|
+
this.orchestrator,
|
|
626
|
+
this.logger,
|
|
627
|
+
webConfig
|
|
628
|
+
);
|
|
629
|
+
|
|
630
|
+
// Pass toolsRegistry to webServer for the /api/tools endpoint
|
|
631
|
+
webServer.toolsRegistry = this.toolsRegistry;
|
|
632
|
+
|
|
633
|
+
// Set API Key Manager reference in Web Server
|
|
634
|
+
webServer.setApiKeyManager(this.apiKeyManager);
|
|
635
|
+
|
|
636
|
+
// Set Credential Vault reference in Web Server
|
|
637
|
+
webServer.setCredentialVault(this.credentialVault);
|
|
638
|
+
|
|
639
|
+
// Set WhatsApp Service reference in Web Server
|
|
640
|
+
if (this.whatsappService) {
|
|
641
|
+
webServer.setWhatsAppService(this.whatsappService);
|
|
642
|
+
this.whatsappService.setWebSocketManager(webServer);
|
|
643
|
+
// Auto-reconnect if a previous session exists (non-blocking)
|
|
644
|
+
this.whatsappService.autoReconnect().catch(e =>
|
|
645
|
+
this.logger.warn('WhatsApp auto-reconnect failed', { error: e.message })
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// Set Telegram Service references
|
|
650
|
+
if (this.telegramService) {
|
|
651
|
+
webServer.setTelegramService(this.telegramService);
|
|
652
|
+
this.telegramService.setOrchestrator(this.orchestrator);
|
|
653
|
+
this.telegramService.setAgentPool(this.agentPool);
|
|
654
|
+
this.telegramService.setWebSocketManager(webServer);
|
|
655
|
+
if (this.flowExecutor) this.telegramService.setFlowExecutor(this.flowExecutor);
|
|
656
|
+
// Auto-connect if token exists in config (non-blocking)
|
|
657
|
+
this.telegramService.autoConnect().catch(e =>
|
|
658
|
+
this.logger.warn('Telegram auto-connect failed', { error: e.message })
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
await webServer.initialize();
|
|
663
|
+
this.interfaces.set(INTERFACE_TYPES.WEB, webServer);
|
|
664
|
+
|
|
665
|
+
// Attach WebServer to orchestrator for MessageProcessor broadcasting
|
|
666
|
+
this.orchestrator.webServer = webServer;
|
|
667
|
+
|
|
668
|
+
// Connect MessageProcessor to WebServer for real-time updates
|
|
669
|
+
this.messageProcessor.setWebSocketManager(webServer);
|
|
670
|
+
|
|
671
|
+
// Connect AgentScheduler to WebServer for real-time updates
|
|
672
|
+
this.agentScheduler.webSocketManager = webServer;
|
|
673
|
+
|
|
674
|
+
// Start the scheduler now that WebSocketManager is available
|
|
675
|
+
this.agentScheduler.start();
|
|
676
|
+
this.logger.info('Agent Scheduler started with WebSocket integration');
|
|
677
|
+
|
|
678
|
+
// Wire ScheduleService to WebServer and FlowExecutor
|
|
679
|
+
webServer.setScheduleService(this.scheduleService);
|
|
680
|
+
this.scheduleService.setWebSocketManager(webServer);
|
|
681
|
+
if (webServer.flowExecutor) {
|
|
682
|
+
this.scheduleService.setFlowExecutor(webServer.flowExecutor);
|
|
683
|
+
}
|
|
684
|
+
this.scheduleService.start();
|
|
685
|
+
this.logger.info('ScheduleService started with WebSocket integration');
|
|
686
|
+
|
|
687
|
+
// Set global reference for tools that need to broadcast
|
|
688
|
+
global.loxiaWebServer = webServer;
|
|
689
|
+
|
|
690
|
+
// Connect JobDoneTool to WebServer for broadcasting mode changes
|
|
691
|
+
const jobDoneTool = this.toolsRegistry.getTool('jobdone');
|
|
692
|
+
if (jobDoneTool && typeof jobDoneTool.setWebSocketManager === 'function') {
|
|
693
|
+
jobDoneTool.setWebSocketManager(webServer);
|
|
694
|
+
this.logger.info('WebSocketManager set for JobDone Tool');
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Connect UserPromptTool to WebServer and AgentPool for user prompting
|
|
698
|
+
const userPromptTool = this.toolsRegistry.getTool('userprompt');
|
|
699
|
+
if (userPromptTool) {
|
|
700
|
+
if (typeof userPromptTool.setWebSocketManager === 'function') {
|
|
701
|
+
userPromptTool.setWebSocketManager(webServer);
|
|
702
|
+
}
|
|
703
|
+
if (typeof userPromptTool.setAgentPool === 'function') {
|
|
704
|
+
userPromptTool.setAgentPool(this.agentPool);
|
|
705
|
+
}
|
|
706
|
+
this.logger.info('Dependencies set for UserPrompt Tool');
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
const status = webServer.getStatus();
|
|
710
|
+
this.logger.info('Web interface initialized', { url: status.url });
|
|
711
|
+
console.log(`🌐 Server running at ${status.url}`);
|
|
712
|
+
console.log(`📱 Web UI available at: ${status.url}`);
|
|
713
|
+
|
|
714
|
+
// Auto-open browser (replace 0.0.0.0 with localhost for browsable URL)
|
|
715
|
+
const url = status.url.replace('0.0.0.0', 'localhost');
|
|
716
|
+
const platform = process.platform;
|
|
717
|
+
const openCmd = platform === 'win32' ? `start "" "${url}"`
|
|
718
|
+
: platform === 'darwin' ? `open "${url}"`
|
|
719
|
+
: `xdg-open "${url}"`;
|
|
720
|
+
exec(openCmd, (err) => {
|
|
721
|
+
if (err) this.logger.debug('Could not auto-open browser', { error: err.message });
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// VSCode Extension Interface (placeholder)
|
|
726
|
+
if (interfaceConfig.vscode?.enabled === true) {
|
|
727
|
+
this.logger.info('VSCode interface configured but not implemented yet');
|
|
728
|
+
// TODO: Initialize VSCode extension interface
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Setup graceful shutdown handlers
|
|
734
|
+
* @private
|
|
735
|
+
*/
|
|
736
|
+
setupShutdownHandlers() {
|
|
737
|
+
// Handle SIGINT (Ctrl+C)
|
|
738
|
+
process.on('SIGINT', async () => {
|
|
739
|
+
console.log('\n📋 Received SIGINT, shutting down gracefully...');
|
|
740
|
+
await this.shutdown();
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
// Handle SIGTERM
|
|
744
|
+
process.on('SIGTERM', async () => {
|
|
745
|
+
console.log('\n📋 Received SIGTERM, shutting down gracefully...');
|
|
746
|
+
await this.shutdown();
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
// Handle uncaught exceptions
|
|
750
|
+
process.on('uncaughtException', async (error) => {
|
|
751
|
+
console.error('❌ Uncaught exception:', error);
|
|
752
|
+
if (this.logger) {
|
|
753
|
+
this.logger.error('Uncaught exception', {
|
|
754
|
+
error: error.message,
|
|
755
|
+
stack: error.stack
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
await this.shutdown();
|
|
760
|
+
process.exit(1);
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
// Handle unhandled promise rejections
|
|
764
|
+
process.on('unhandledRejection', async (reason, promise) => {
|
|
765
|
+
const reasonMessage = reason?.message || String(reason);
|
|
766
|
+
|
|
767
|
+
// List of known non-critical rejections that shouldn't crash the server
|
|
768
|
+
const nonCriticalPatterns = [
|
|
769
|
+
'Credential request cancelled',
|
|
770
|
+
'Credential request timed out',
|
|
771
|
+
'Target closed',
|
|
772
|
+
'Session closed',
|
|
773
|
+
'Protocol error',
|
|
774
|
+
'Navigation timeout',
|
|
775
|
+
'net::ERR_',
|
|
776
|
+
'Requesting main frame too early',
|
|
777
|
+
'Connection closed'
|
|
778
|
+
];
|
|
779
|
+
|
|
780
|
+
const isNonCritical = nonCriticalPatterns.some(pattern =>
|
|
781
|
+
reasonMessage.includes(pattern)
|
|
782
|
+
);
|
|
783
|
+
|
|
784
|
+
if (isNonCritical) {
|
|
785
|
+
console.warn('⚠️ Non-critical promise rejection (server continues):', reasonMessage);
|
|
786
|
+
if (this.logger) {
|
|
787
|
+
this.logger.warn('Non-critical promise rejection', {
|
|
788
|
+
reason: reasonMessage,
|
|
789
|
+
promise: promise.toString()
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
return; // Don't crash for non-critical errors
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
console.error('❌ Unhandled promise rejection:', reason);
|
|
796
|
+
if (this.logger) {
|
|
797
|
+
this.logger.error('Unhandled promise rejection', {
|
|
798
|
+
reason: reasonMessage,
|
|
799
|
+
promise: promise.toString()
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
await this.shutdown();
|
|
804
|
+
process.exit(1);
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Gracefully shutdown the application
|
|
810
|
+
* @returns {Promise<void>}
|
|
811
|
+
*/
|
|
812
|
+
async shutdown() {
|
|
813
|
+
if (this.isShuttingDown) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
this.isShuttingDown = true;
|
|
818
|
+
|
|
819
|
+
// Force-exit safety net: if graceful shutdown hangs, kill the process after 10s
|
|
820
|
+
const forceExitTimer = setTimeout(() => {
|
|
821
|
+
console.error('⚠️ Graceful shutdown timed out after 10s — forcing exit');
|
|
822
|
+
process.exit(1);
|
|
823
|
+
}, 10000);
|
|
824
|
+
forceExitTimer.unref(); // Don't let this timer keep the process alive on its own
|
|
825
|
+
|
|
826
|
+
try {
|
|
827
|
+
console.log('🛑 Shutting down Loxia Autopilot One...');
|
|
828
|
+
|
|
829
|
+
if (this.logger) {
|
|
830
|
+
this.logger.info('Application shutdown initiated');
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// Stop schedule service first
|
|
834
|
+
if (this.scheduleService) {
|
|
835
|
+
this.scheduleService.stop();
|
|
836
|
+
this.logger?.info('Schedule service stopped');
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// Stop agent scheduler (prevents new work from starting mid-shutdown)
|
|
840
|
+
if (this.agentScheduler) {
|
|
841
|
+
this.agentScheduler.stop();
|
|
842
|
+
this.logger?.info('Agent scheduler stopped');
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// Cancel any pending model fetch retries
|
|
846
|
+
if (this.modelsService?._cancelRetry) {
|
|
847
|
+
this.modelsService._cancelRetry();
|
|
848
|
+
this.logger?.info('Models service retries cancelled');
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// Close Puppeteer browsers (webTool, browserTool) — they hold DevTools ports
|
|
852
|
+
if (this.toolsRegistry) {
|
|
853
|
+
for (const toolId of ['web', 'browser']) {
|
|
854
|
+
try {
|
|
855
|
+
const tool = this.toolsRegistry.getTool(toolId);
|
|
856
|
+
if (tool?.cleanup) {
|
|
857
|
+
await tool.cleanup();
|
|
858
|
+
this.logger?.info(`${toolId} tool cleanup complete`);
|
|
859
|
+
}
|
|
860
|
+
} catch (error) {
|
|
861
|
+
this.logger?.warn(`Failed to cleanup ${toolId} tool`, { error: error.message });
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// Shutdown interfaces (web server, visual editor, WS connections)
|
|
867
|
+
for (const [type, interface_] of this.interfaces) {
|
|
868
|
+
try {
|
|
869
|
+
if (interface_.shutdown) {
|
|
870
|
+
await interface_.shutdown();
|
|
871
|
+
}
|
|
872
|
+
this.logger?.info(`${type} interface shutdown complete`);
|
|
873
|
+
} catch (error) {
|
|
874
|
+
console.error(`Failed to shutdown ${type} interface:`, error.message);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// Shutdown async tool manager
|
|
879
|
+
if (this.asyncToolManager) {
|
|
880
|
+
await this.asyncToolManager.shutdown();
|
|
881
|
+
this.logger?.info('Async tool manager shutdown complete');
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// Shutdown orchestrator (persists agent states)
|
|
885
|
+
if (this.orchestrator) {
|
|
886
|
+
await this.orchestrator.shutdown();
|
|
887
|
+
this.logger?.info('Orchestrator shutdown complete');
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// Cleanup configuration manager
|
|
891
|
+
if (this.configManager) {
|
|
892
|
+
this.configManager.cleanup();
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// Close logger
|
|
896
|
+
if (this.logger) {
|
|
897
|
+
await this.logger.close();
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
console.log('✅ Loxia Autopilot One shutdown complete');
|
|
901
|
+
|
|
902
|
+
} catch (error) {
|
|
903
|
+
console.error('❌ Error during shutdown:', error.message);
|
|
904
|
+
} finally {
|
|
905
|
+
process.exit(0);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Get application status
|
|
911
|
+
* @returns {Object} Application status
|
|
912
|
+
*/
|
|
913
|
+
getStatus() {
|
|
914
|
+
return {
|
|
915
|
+
version: SYSTEM_VERSION,
|
|
916
|
+
uptime: process.uptime(),
|
|
917
|
+
memoryUsage: process.memoryUsage(),
|
|
918
|
+
interfaces: Array.from(this.interfaces.keys()),
|
|
919
|
+
isShuttingDown: this.isShuttingDown
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Main application entry point
|
|
926
|
+
*/
|
|
927
|
+
async function main() {
|
|
928
|
+
const app = new LoxiaApplication();
|
|
929
|
+
|
|
930
|
+
// Parse command line arguments
|
|
931
|
+
const args = process.argv.slice(2);
|
|
932
|
+
const options = {
|
|
933
|
+
projectDir: process.cwd(),
|
|
934
|
+
watchConfig: args.includes('--watch-config'),
|
|
935
|
+
configPaths: []
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// Parse --port and --host from argv so they work when running index.js directly
|
|
939
|
+
// (bin/cli.js sets these as env vars, but npm start / node src/index.js bypasses cli.js)
|
|
940
|
+
for (let i = 0; i < args.length; i++) {
|
|
941
|
+
if (args[i] === '--port' && args[i + 1]) {
|
|
942
|
+
process.env.LOXIA_PORT = args[i + 1];
|
|
943
|
+
}
|
|
944
|
+
if (args[i] === '--host' && args[i + 1]) {
|
|
945
|
+
process.env.LOXIA_HOST = args[i + 1];
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// Look for custom config file
|
|
950
|
+
const configIndex = args.indexOf('--config');
|
|
951
|
+
if (configIndex !== -1 && args[configIndex + 1]) {
|
|
952
|
+
options.configPaths.push(args[configIndex + 1]);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
await app.initialize(options);
|
|
956
|
+
|
|
957
|
+
// Keep the application running
|
|
958
|
+
return app;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// Start the application if this file is run directly
|
|
962
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
963
|
+
if (process.argv[1] === __filename) {
|
|
964
|
+
console.log('🚀 Starting Loxia Autopilot One...');
|
|
965
|
+
main().catch(error => {
|
|
966
|
+
console.error('❌ Failed to start Loxia Autopilot One:', error.message);
|
|
967
|
+
console.error('Stack trace:', error.stack);
|
|
968
|
+
process.exit(1);
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
export { LoxiaApplication, main };
|