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,388 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools Management - Smoke Tests
|
|
3
|
+
* Verifies that tools management modules can be imported and basic functionality works
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, test, expect } from '@jest/globals';
|
|
7
|
+
|
|
8
|
+
describe('Tools Management - Imports', () => {
|
|
9
|
+
test('useTools hook can be imported', async () => {
|
|
10
|
+
const { useTools } = await import('../../state/useTools.js');
|
|
11
|
+
|
|
12
|
+
expect(useTools).toBeDefined();
|
|
13
|
+
expect(typeof useTools).toBe('function');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('useTools is default export', async () => {
|
|
17
|
+
const module = await import('../../state/useTools.js');
|
|
18
|
+
|
|
19
|
+
expect(module.default).toBeDefined();
|
|
20
|
+
expect(typeof module.default).toBe('function');
|
|
21
|
+
expect(module.default).toBe(module.useTools);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('Tools Management - Constants', () => {
|
|
26
|
+
test('TOOL_CATEGORY constants are defined', async () => {
|
|
27
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
28
|
+
|
|
29
|
+
expect(TOOL_CATEGORY).toBeDefined();
|
|
30
|
+
expect(TOOL_CATEGORY.SYSTEM).toBeDefined();
|
|
31
|
+
expect(TOOL_CATEGORY.AUTOMATION).toBeDefined();
|
|
32
|
+
expect(TOOL_CATEGORY.ANALYSIS).toBeDefined();
|
|
33
|
+
expect(TOOL_CATEGORY.UTILITY).toBeDefined();
|
|
34
|
+
expect(TOOL_CATEGORY.COLLABORATION).toBeDefined();
|
|
35
|
+
expect(TOOL_CATEGORY.AI).toBeDefined();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('TOOL_CATEGORY values are lowercase', async () => {
|
|
39
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
40
|
+
|
|
41
|
+
expect(TOOL_CATEGORY.SYSTEM).toBe(TOOL_CATEGORY.SYSTEM.toLowerCase());
|
|
42
|
+
expect(TOOL_CATEGORY.AUTOMATION).toBe(TOOL_CATEGORY.AUTOMATION.toLowerCase());
|
|
43
|
+
expect(TOOL_CATEGORY.ANALYSIS).toBe(TOOL_CATEGORY.ANALYSIS.toLowerCase());
|
|
44
|
+
expect(TOOL_CATEGORY.UTILITY).toBe(TOOL_CATEGORY.UTILITY.toLowerCase());
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Tools API endpoint is defined', async () => {
|
|
48
|
+
const { API_ENDPOINTS } = await import('../../config/constants.js');
|
|
49
|
+
|
|
50
|
+
expect(API_ENDPOINTS.TOOLS).toBeDefined();
|
|
51
|
+
expect(API_ENDPOINTS.TOOLS).toBe('/api/tools');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('Orchestrator endpoint is used for tool operations', async () => {
|
|
55
|
+
const { API_ENDPOINTS } = await import('../../config/constants.js');
|
|
56
|
+
|
|
57
|
+
expect(API_ENDPOINTS.ORCHESTRATOR).toBeDefined();
|
|
58
|
+
expect(API_ENDPOINTS.ORCHESTRATOR).toBe('/api/orchestrator');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('Tools Management - Integration', () => {
|
|
63
|
+
test('useTools hook integrates with Session and MessageRouter', async () => {
|
|
64
|
+
const { useTools } = await import('../../state/useTools.js');
|
|
65
|
+
const { SessionManager } = await import('../../api/session.js');
|
|
66
|
+
const { MessageRouter } = await import('../../api/messageRouter.js');
|
|
67
|
+
const { WebSocketManager } = await import('../../api/websocket.js');
|
|
68
|
+
|
|
69
|
+
// Create dependencies
|
|
70
|
+
const sessionManager = new SessionManager('localhost', 8080);
|
|
71
|
+
const wsManager = new WebSocketManager('localhost', 8080);
|
|
72
|
+
const messageRouter = new MessageRouter(wsManager);
|
|
73
|
+
|
|
74
|
+
// Verify all components exist
|
|
75
|
+
expect(sessionManager).toBeDefined();
|
|
76
|
+
expect(messageRouter).toBeDefined();
|
|
77
|
+
|
|
78
|
+
// useTools expects these as parameters (including currentAgentId)
|
|
79
|
+
// (we can't actually call the hook outside React, but we verify the interface)
|
|
80
|
+
expect(typeof useTools).toBe('function');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('Full tools management stack can be imported together', async () => {
|
|
84
|
+
const [
|
|
85
|
+
constantsModule,
|
|
86
|
+
sessionModule,
|
|
87
|
+
websocketModule,
|
|
88
|
+
routerModule,
|
|
89
|
+
toolsModule,
|
|
90
|
+
] = await Promise.all([
|
|
91
|
+
import('../../config/constants.js'),
|
|
92
|
+
import('../../api/session.js'),
|
|
93
|
+
import('../../api/websocket.js'),
|
|
94
|
+
import('../../api/messageRouter.js'),
|
|
95
|
+
import('../../state/useTools.js'),
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
// Verify all modules loaded
|
|
99
|
+
expect(constantsModule.TOOL_CATEGORY).toBeDefined();
|
|
100
|
+
expect(constantsModule.API_ENDPOINTS).toBeDefined();
|
|
101
|
+
expect(sessionModule.SessionManager).toBeDefined();
|
|
102
|
+
expect(websocketModule.WebSocketManager).toBeDefined();
|
|
103
|
+
expect(routerModule.MessageRouter).toBeDefined();
|
|
104
|
+
expect(toolsModule.useTools).toBeDefined();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('Tools Management - API Endpoints Validation', () => {
|
|
109
|
+
test('Tools endpoint follows RESTful pattern', async () => {
|
|
110
|
+
const { API_ENDPOINTS } = await import('../../config/constants.js');
|
|
111
|
+
|
|
112
|
+
// Verify endpoint path
|
|
113
|
+
expect(API_ENDPOINTS.TOOLS).toMatch(/^\/api\//);
|
|
114
|
+
expect(API_ENDPOINTS.TOOLS).toBe('/api/tools');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('Tool operations use orchestrator endpoint', async () => {
|
|
118
|
+
const { API_ENDPOINTS } = await import('../../config/constants.js');
|
|
119
|
+
|
|
120
|
+
// Tool execution, enable/disable use orchestrator
|
|
121
|
+
expect(API_ENDPOINTS.ORCHESTRATOR).toBeDefined();
|
|
122
|
+
expect(API_ENDPOINTS.ORCHESTRATOR).toBe('/api/orchestrator');
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('Tools Management - Hook Interface Verification', () => {
|
|
127
|
+
test('useTools returns expected interface shape', async () => {
|
|
128
|
+
const { useTools } = await import('../../state/useTools.js');
|
|
129
|
+
|
|
130
|
+
// We can verify the function signature
|
|
131
|
+
expect(useTools.length).toBe(3); // sessionManager, messageRouter, currentAgentId
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('Tools Management - Constants Validation', () => {
|
|
136
|
+
test('TOOL_CATEGORY includes all major categories', async () => {
|
|
137
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
138
|
+
|
|
139
|
+
const categories = Object.keys(TOOL_CATEGORY);
|
|
140
|
+
expect(categories).toContain('SYSTEM');
|
|
141
|
+
expect(categories).toContain('AUTOMATION');
|
|
142
|
+
expect(categories).toContain('ANALYSIS');
|
|
143
|
+
expect(categories).toContain('UTILITY');
|
|
144
|
+
expect(categories).toContain('COLLABORATION');
|
|
145
|
+
expect(categories).toContain('AI');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('TOOL_CATEGORY values match expected format', async () => {
|
|
149
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
150
|
+
|
|
151
|
+
// Values should be lowercase
|
|
152
|
+
expect(TOOL_CATEGORY.SYSTEM).toMatch(/^[a-z_]+$/);
|
|
153
|
+
expect(TOOL_CATEGORY.AUTOMATION).toMatch(/^[a-z_]+$/);
|
|
154
|
+
expect(TOOL_CATEGORY.ANALYSIS).toMatch(/^[a-z_]+$/);
|
|
155
|
+
expect(TOOL_CATEGORY.UTILITY).toMatch(/^[a-z_]+$/);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe('Tools Management - WebSocket Event Handlers', () => {
|
|
160
|
+
test('MessageRouter has tool event handlers registered', async () => {
|
|
161
|
+
const { MessageRouter } = await import('../../api/messageRouter.js');
|
|
162
|
+
const { WebSocketManager } = await import('../../api/websocket.js');
|
|
163
|
+
|
|
164
|
+
const wsManager = new WebSocketManager('localhost', 8080);
|
|
165
|
+
const router = new MessageRouter(wsManager);
|
|
166
|
+
|
|
167
|
+
// Verify tool event handlers are registered
|
|
168
|
+
// These would be registered by the useTools hook when mounted
|
|
169
|
+
expect(router.hasHandler).toBeDefined();
|
|
170
|
+
expect(typeof router.hasHandler).toBe('function');
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe('Tools Management - Tool Categorization', () => {
|
|
175
|
+
test('TOOL_CATEGORY can be used to filter tools by category', async () => {
|
|
176
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
177
|
+
|
|
178
|
+
// Mock tool list
|
|
179
|
+
const mockTools = [
|
|
180
|
+
{ name: 'execute_command', category: TOOL_CATEGORY.SYSTEM },
|
|
181
|
+
{ name: 'terminal', category: TOOL_CATEGORY.SYSTEM },
|
|
182
|
+
{ name: 'analyze_code', category: TOOL_CATEGORY.ANALYSIS },
|
|
183
|
+
{ name: 'web_search', category: TOOL_CATEGORY.UTILITY },
|
|
184
|
+
{ name: 'ai_assistant', category: TOOL_CATEGORY.AI },
|
|
185
|
+
];
|
|
186
|
+
|
|
187
|
+
// Filter by category
|
|
188
|
+
const systemTools = mockTools.filter(t => t.category === TOOL_CATEGORY.SYSTEM);
|
|
189
|
+
const analysisTools = mockTools.filter(t => t.category === TOOL_CATEGORY.ANALYSIS);
|
|
190
|
+
const utilityTools = mockTools.filter(t => t.category === TOOL_CATEGORY.UTILITY);
|
|
191
|
+
const aiTools = mockTools.filter(t => t.category === TOOL_CATEGORY.AI);
|
|
192
|
+
|
|
193
|
+
expect(systemTools.length).toBe(2);
|
|
194
|
+
expect(analysisTools.length).toBe(1);
|
|
195
|
+
expect(utilityTools.length).toBe(1);
|
|
196
|
+
expect(aiTools.length).toBe(1);
|
|
197
|
+
|
|
198
|
+
expect(systemTools[0].name).toBe('execute_command');
|
|
199
|
+
expect(analysisTools[0].name).toBe('analyze_code');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('Tools Management - Tool Search', () => {
|
|
204
|
+
test('Tool search should work with name and description', async () => {
|
|
205
|
+
// Mock tool list
|
|
206
|
+
const mockTools = [
|
|
207
|
+
{ name: 'read_file', description: 'Read contents of a file' },
|
|
208
|
+
{ name: 'write_file', description: 'Write data to a file' },
|
|
209
|
+
{ name: 'analyze_code', description: 'Perform static code analysis' },
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
// Search by name
|
|
213
|
+
const searchByName = (query) => {
|
|
214
|
+
const lowerQuery = query.toLowerCase();
|
|
215
|
+
return mockTools.filter(t =>
|
|
216
|
+
t.name?.toLowerCase().includes(lowerQuery) ||
|
|
217
|
+
t.description?.toLowerCase().includes(lowerQuery)
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const fileTools = searchByName('file');
|
|
222
|
+
expect(fileTools.length).toBe(2);
|
|
223
|
+
expect(fileTools.map(t => t.name)).toContain('read_file');
|
|
224
|
+
expect(fileTools.map(t => t.name)).toContain('write_file');
|
|
225
|
+
|
|
226
|
+
const analyzeTools = searchByName('analyze');
|
|
227
|
+
expect(analyzeTools.length).toBe(1);
|
|
228
|
+
expect(analyzeTools[0].name).toBe('analyze_code');
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('Tools Management - Execution State Tracking', () => {
|
|
233
|
+
test('Execution state can track multiple tools', async () => {
|
|
234
|
+
// Mock execution tracking
|
|
235
|
+
const executingTools = new Set();
|
|
236
|
+
|
|
237
|
+
// Start execution
|
|
238
|
+
executingTools.add('read_file');
|
|
239
|
+
executingTools.add('analyze_code');
|
|
240
|
+
|
|
241
|
+
expect(executingTools.has('read_file')).toBe(true);
|
|
242
|
+
expect(executingTools.has('analyze_code')).toBe(true);
|
|
243
|
+
expect(executingTools.size).toBe(2);
|
|
244
|
+
|
|
245
|
+
// Complete execution
|
|
246
|
+
executingTools.delete('read_file');
|
|
247
|
+
|
|
248
|
+
expect(executingTools.has('read_file')).toBe(false);
|
|
249
|
+
expect(executingTools.has('analyze_code')).toBe(true);
|
|
250
|
+
expect(executingTools.size).toBe(1);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test('Tool results can be stored by execution ID', async () => {
|
|
254
|
+
// Mock tool results storage
|
|
255
|
+
const toolResults = new Map();
|
|
256
|
+
|
|
257
|
+
// Store results
|
|
258
|
+
toolResults.set('exec-1', { success: true, data: 'file contents' });
|
|
259
|
+
toolResults.set('exec-2', { success: true, data: { issues: [] } });
|
|
260
|
+
|
|
261
|
+
expect(toolResults.get('exec-1')).toBeDefined();
|
|
262
|
+
expect(toolResults.get('exec-1').success).toBe(true);
|
|
263
|
+
expect(toolResults.get('exec-1').data).toBe('file contents');
|
|
264
|
+
|
|
265
|
+
expect(toolResults.get('exec-2')).toBeDefined();
|
|
266
|
+
expect(toolResults.get('exec-2').data.issues).toEqual([]);
|
|
267
|
+
|
|
268
|
+
expect(toolResults.size).toBe(2);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
describe('Tools Management - Tool Caching', () => {
|
|
273
|
+
test('Tool cache supports TTL-based caching', async () => {
|
|
274
|
+
const CACHE_TTL = 600000; // 10 minutes
|
|
275
|
+
|
|
276
|
+
// Mock cache
|
|
277
|
+
let toolsCache = null;
|
|
278
|
+
let toolsCacheTimestamp = 0;
|
|
279
|
+
|
|
280
|
+
// Initial fetch
|
|
281
|
+
const mockTools = [{ name: 'read_file' }];
|
|
282
|
+
toolsCache = mockTools;
|
|
283
|
+
toolsCacheTimestamp = Date.now();
|
|
284
|
+
|
|
285
|
+
// Check cache validity
|
|
286
|
+
const now = Date.now();
|
|
287
|
+
const isCacheValid = (now - toolsCacheTimestamp) < CACHE_TTL;
|
|
288
|
+
|
|
289
|
+
expect(isCacheValid).toBe(true);
|
|
290
|
+
expect(toolsCache).toBe(mockTools);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
test('Tool cache expires after TTL', async () => {
|
|
294
|
+
const CACHE_TTL = 100; // 100ms for testing
|
|
295
|
+
|
|
296
|
+
// Mock cache
|
|
297
|
+
let toolsCache = null;
|
|
298
|
+
let toolsCacheTimestamp = 0;
|
|
299
|
+
|
|
300
|
+
// Initial fetch
|
|
301
|
+
const mockTools = [{ name: 'read_file' }];
|
|
302
|
+
toolsCache = mockTools;
|
|
303
|
+
toolsCacheTimestamp = Date.now();
|
|
304
|
+
|
|
305
|
+
// Wait for cache to expire
|
|
306
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
307
|
+
|
|
308
|
+
// Check cache validity
|
|
309
|
+
const now = Date.now();
|
|
310
|
+
const isCacheValid = (now - toolsCacheTimestamp) < CACHE_TTL;
|
|
311
|
+
|
|
312
|
+
expect(isCacheValid).toBe(false);
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
describe('Tools Management - Tool Filtering', () => {
|
|
317
|
+
test('Tools can be filtered by multiple criteria', async () => {
|
|
318
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
319
|
+
|
|
320
|
+
// Mock tool list
|
|
321
|
+
const mockTools = [
|
|
322
|
+
{ name: 'execute_command', category: TOOL_CATEGORY.SYSTEM, enabled: true },
|
|
323
|
+
{ name: 'terminal', category: TOOL_CATEGORY.SYSTEM, enabled: false },
|
|
324
|
+
{ name: 'analyze_code', category: TOOL_CATEGORY.ANALYSIS, enabled: true },
|
|
325
|
+
];
|
|
326
|
+
|
|
327
|
+
// Filter by category and enabled status
|
|
328
|
+
const filterTools = (criteria) => {
|
|
329
|
+
let filtered = [...mockTools];
|
|
330
|
+
|
|
331
|
+
if (criteria.category) {
|
|
332
|
+
filtered = filtered.filter(t => t.category === criteria.category);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (criteria.enabled !== undefined) {
|
|
336
|
+
filtered = filtered.filter(t => t.enabled === criteria.enabled);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return filtered;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// Filter: system tools only
|
|
343
|
+
const systemTools = filterTools({ category: TOOL_CATEGORY.SYSTEM });
|
|
344
|
+
expect(systemTools.length).toBe(2);
|
|
345
|
+
|
|
346
|
+
// Filter: enabled tools only
|
|
347
|
+
const enabledTools = filterTools({ enabled: true });
|
|
348
|
+
expect(enabledTools.length).toBe(2);
|
|
349
|
+
|
|
350
|
+
// Filter: enabled system tools
|
|
351
|
+
const enabledSystemTools = filterTools({
|
|
352
|
+
category: TOOL_CATEGORY.SYSTEM,
|
|
353
|
+
enabled: true,
|
|
354
|
+
});
|
|
355
|
+
expect(enabledSystemTools.length).toBe(1);
|
|
356
|
+
expect(enabledSystemTools[0].name).toBe('execute_command');
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
describe('Tools Management - Category Counts', () => {
|
|
361
|
+
test('Category counts can be calculated', async () => {
|
|
362
|
+
const { TOOL_CATEGORY } = await import('../../config/constants.js');
|
|
363
|
+
|
|
364
|
+
// Mock tool list
|
|
365
|
+
const mockTools = [
|
|
366
|
+
{ name: 'execute_command', category: TOOL_CATEGORY.SYSTEM },
|
|
367
|
+
{ name: 'terminal', category: TOOL_CATEGORY.SYSTEM },
|
|
368
|
+
{ name: 'analyze_code', category: TOOL_CATEGORY.ANALYSIS },
|
|
369
|
+
{ name: 'web_search', category: TOOL_CATEGORY.UTILITY },
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
// Calculate counts
|
|
373
|
+
const getCategoryCounts = (tools) => {
|
|
374
|
+
const counts = {};
|
|
375
|
+
for (const category of Object.values(TOOL_CATEGORY)) {
|
|
376
|
+
counts[category] = tools.filter(t => t.category === category).length;
|
|
377
|
+
}
|
|
378
|
+
return counts;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
const counts = getCategoryCounts(mockTools);
|
|
382
|
+
|
|
383
|
+
expect(counts[TOOL_CATEGORY.SYSTEM]).toBe(2);
|
|
384
|
+
expect(counts[TOOL_CATEGORY.ANALYSIS]).toBe(1);
|
|
385
|
+
expect(counts[TOOL_CATEGORY.UTILITY]).toBe(1);
|
|
386
|
+
expect(counts[TOOL_CATEGORY.AUTOMATION]).toBe(0);
|
|
387
|
+
});
|
|
388
|
+
});
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client
|
|
3
|
+
* Unified HTTP request mechanism for all backend communication
|
|
4
|
+
* Handles authentication, headers, and error handling consistently
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ERROR_MESSAGE } from '../config/constants.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* API Client Class
|
|
11
|
+
* Centralized HTTP client with automatic authentication
|
|
12
|
+
*/
|
|
13
|
+
export class ApiClient {
|
|
14
|
+
constructor(baseUrl, apiKey = null) {
|
|
15
|
+
this.baseUrl = baseUrl;
|
|
16
|
+
this.apiKey = apiKey;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set or update the API key
|
|
21
|
+
*/
|
|
22
|
+
setApiKey(apiKey) {
|
|
23
|
+
this.apiKey = apiKey;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the current API key
|
|
28
|
+
*/
|
|
29
|
+
getApiKey() {
|
|
30
|
+
return this.apiKey;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Clear the API key
|
|
35
|
+
*/
|
|
36
|
+
clearApiKey() {
|
|
37
|
+
this.apiKey = null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Build request headers
|
|
42
|
+
* Automatically includes Authorization header if API key is set
|
|
43
|
+
*/
|
|
44
|
+
buildHeaders(additionalHeaders = {}) {
|
|
45
|
+
const headers = {
|
|
46
|
+
'Content-Type': 'application/json',
|
|
47
|
+
...additionalHeaders,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Add Authorization header if API key is available
|
|
51
|
+
if (this.apiKey) {
|
|
52
|
+
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return headers;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Make HTTP request
|
|
60
|
+
* @param {string} method - HTTP method (GET, POST, PUT, DELETE, etc.)
|
|
61
|
+
* @param {string} endpoint - API endpoint path
|
|
62
|
+
* @param {object} options - Request options
|
|
63
|
+
* @param {object} options.body - Request body (for POST, PUT, PATCH)
|
|
64
|
+
* @param {object} options.headers - Additional headers
|
|
65
|
+
* @param {object} options.query - Query parameters
|
|
66
|
+
* @returns {Promise<object>} Response data
|
|
67
|
+
*/
|
|
68
|
+
async request(method, endpoint, options = {}) {
|
|
69
|
+
const { body = null, headers = {}, query = null } = options;
|
|
70
|
+
|
|
71
|
+
// Build URL with query parameters
|
|
72
|
+
let url = `${this.baseUrl}${endpoint}`;
|
|
73
|
+
if (query) {
|
|
74
|
+
const queryString = new URLSearchParams(query).toString();
|
|
75
|
+
url += `?${queryString}`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Build request options
|
|
79
|
+
const requestOptions = {
|
|
80
|
+
method,
|
|
81
|
+
headers: this.buildHeaders(headers),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Add body for POST, PUT, PATCH
|
|
85
|
+
if (body && ['POST', 'PUT', 'PATCH'].includes(method.toUpperCase())) {
|
|
86
|
+
requestOptions.body = JSON.stringify(body);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const response = await fetch(url, requestOptions);
|
|
91
|
+
|
|
92
|
+
// Parse JSON response
|
|
93
|
+
const data = await response.json().catch(() => ({}));
|
|
94
|
+
|
|
95
|
+
// Check if response is OK
|
|
96
|
+
if (!response.ok) {
|
|
97
|
+
const error = new Error(data.error || `HTTP ${response.status}: ${response.statusText}`);
|
|
98
|
+
error.status = response.status;
|
|
99
|
+
error.response = data;
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return data;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
// Network errors
|
|
106
|
+
if (error.message.includes('fetch') || error.name === 'TypeError') {
|
|
107
|
+
const networkError = new Error(`${ERROR_MESSAGE.NETWORK_ERROR}: ${error.message}`);
|
|
108
|
+
networkError.originalError = error;
|
|
109
|
+
throw networkError;
|
|
110
|
+
}
|
|
111
|
+
// Re-throw API errors
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* GET request
|
|
118
|
+
*/
|
|
119
|
+
async get(endpoint, options = {}) {
|
|
120
|
+
return this.request('GET', endpoint, options);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* POST request
|
|
125
|
+
*/
|
|
126
|
+
async post(endpoint, body = null, options = {}) {
|
|
127
|
+
return this.request('POST', endpoint, { ...options, body });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* PUT request
|
|
132
|
+
*/
|
|
133
|
+
async put(endpoint, body = null, options = {}) {
|
|
134
|
+
return this.request('PUT', endpoint, { ...options, body });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* PATCH request
|
|
139
|
+
*/
|
|
140
|
+
async patch(endpoint, body = null, options = {}) {
|
|
141
|
+
return this.request('PATCH', endpoint, { ...options, body });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* DELETE request
|
|
146
|
+
*/
|
|
147
|
+
async delete(endpoint, options = {}) {
|
|
148
|
+
return this.request('DELETE', endpoint, options);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Make streaming HTTP request (Server-Sent Events)
|
|
153
|
+
* @param {string} endpoint - API endpoint path
|
|
154
|
+
* @param {object} body - Request body
|
|
155
|
+
* @param {object} options - Request options
|
|
156
|
+
* @param {function} options.onChunk - Callback for each text chunk
|
|
157
|
+
* @param {function} options.onDone - Callback when stream completes
|
|
158
|
+
* @param {function} options.onError - Callback for errors
|
|
159
|
+
* @returns {Promise<object>} Final response data
|
|
160
|
+
*/
|
|
161
|
+
async streamRequest(endpoint, body = {}, options = {}) {
|
|
162
|
+
const { onChunk, onDone, onError, headers = {} } = options;
|
|
163
|
+
|
|
164
|
+
let url = `${this.baseUrl}${endpoint}`;
|
|
165
|
+
|
|
166
|
+
const requestOptions = {
|
|
167
|
+
method: 'POST',
|
|
168
|
+
headers: {
|
|
169
|
+
...this.buildHeaders(headers),
|
|
170
|
+
'Accept': 'text/event-stream'
|
|
171
|
+
},
|
|
172
|
+
body: JSON.stringify({ ...body, stream: true })
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
const response = await fetch(url, requestOptions);
|
|
177
|
+
|
|
178
|
+
if (!response.ok) {
|
|
179
|
+
const errorText = await response.text();
|
|
180
|
+
const error = new Error(`HTTP ${response.status}: ${errorText}`);
|
|
181
|
+
error.status = response.status;
|
|
182
|
+
if (onError) onError(error);
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Check if we actually got a stream
|
|
187
|
+
const contentType = response.headers.get('content-type');
|
|
188
|
+
if (!contentType?.includes('text/event-stream')) {
|
|
189
|
+
// Not a stream, parse as regular JSON
|
|
190
|
+
const data = await response.json();
|
|
191
|
+
if (onChunk && data.content) {
|
|
192
|
+
onChunk(data.content);
|
|
193
|
+
}
|
|
194
|
+
if (onDone) onDone(data);
|
|
195
|
+
return data;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Validate response body before reading stream
|
|
199
|
+
if (!response.body) {
|
|
200
|
+
const textContent = await response.text().catch(() => '');
|
|
201
|
+
if (onChunk && textContent) onChunk(textContent);
|
|
202
|
+
const fallbackResult = { content: textContent, model: body?.model, finishReason: 'stop' };
|
|
203
|
+
if (onDone) onDone(fallbackResult);
|
|
204
|
+
return fallbackResult;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Process SSE stream
|
|
208
|
+
const reader = response.body.getReader();
|
|
209
|
+
const decoder = new TextDecoder();
|
|
210
|
+
let fullContent = '';
|
|
211
|
+
let finalData = null;
|
|
212
|
+
|
|
213
|
+
while (true) {
|
|
214
|
+
const { done, value } = await reader.read();
|
|
215
|
+
|
|
216
|
+
if (done) {
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const text = decoder.decode(value, { stream: true });
|
|
221
|
+
const lines = text.split('\n');
|
|
222
|
+
|
|
223
|
+
for (const line of lines) {
|
|
224
|
+
if (line.startsWith('data: ')) {
|
|
225
|
+
const data = line.slice(6).trim();
|
|
226
|
+
|
|
227
|
+
if (data === '[DONE]') {
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
const parsed = JSON.parse(data);
|
|
233
|
+
|
|
234
|
+
if (parsed.type === 'chunk' && parsed.content) {
|
|
235
|
+
fullContent += parsed.content;
|
|
236
|
+
if (onChunk) {
|
|
237
|
+
onChunk(parsed.content);
|
|
238
|
+
}
|
|
239
|
+
} else if (parsed.type === 'done') {
|
|
240
|
+
finalData = {
|
|
241
|
+
content: parsed.content || fullContent,
|
|
242
|
+
usage: parsed.usage,
|
|
243
|
+
model: parsed.model,
|
|
244
|
+
finishReason: parsed.finishReason
|
|
245
|
+
};
|
|
246
|
+
} else if (parsed.type === 'error') {
|
|
247
|
+
const error = new Error(parsed.error);
|
|
248
|
+
error.code = parsed.code;
|
|
249
|
+
if (onError) onError(error);
|
|
250
|
+
throw error;
|
|
251
|
+
}
|
|
252
|
+
} catch (parseError) {
|
|
253
|
+
// Skip unparseable lines, but don't throw
|
|
254
|
+
if (parseError.message && !parseError.code) {
|
|
255
|
+
// Only skip JSON parse errors, not our custom errors
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
throw parseError;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Final callback with complete data
|
|
265
|
+
if (onDone) {
|
|
266
|
+
onDone(finalData || { content: fullContent });
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return finalData || { content: fullContent };
|
|
270
|
+
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if (error.message.includes('fetch') || error.name === 'TypeError') {
|
|
273
|
+
const networkError = new Error(`${ERROR_MESSAGE.NETWORK_ERROR}: ${error.message}`);
|
|
274
|
+
networkError.originalError = error;
|
|
275
|
+
if (onError) onError(networkError);
|
|
276
|
+
throw networkError;
|
|
277
|
+
}
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* POST request with streaming response
|
|
284
|
+
* Convenience method for streaming chat completions
|
|
285
|
+
*/
|
|
286
|
+
async postStream(endpoint, body = null, options = {}) {
|
|
287
|
+
return this.streamRequest(endpoint, body, options);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Create an API client instance
|
|
293
|
+
*/
|
|
294
|
+
export function createApiClient(host = 'localhost', port = 8080, apiKey = null) {
|
|
295
|
+
const baseUrl = `http://${host}:${port}`;
|
|
296
|
+
return new ApiClient(baseUrl, apiKey);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export default ApiClient;
|