i-am-bee / bee-agent-framework

The framework for building scalable agentic applications.
https://i-am-bee.github.io/bee-agent-framework/
Apache License 2.0
1.13k stars 110 forks source link

Building yields existing errors #197

Open TechcodexIO opened 3 days ago

TechcodexIO commented 3 days ago

Curious if this codebase has been built recently from a fresh repo clone? Performing a "yarn build" results in:

$ yarn clean && yarn ts:check && NODE_OPTIONS='--max-old-space-size=8192' tsup && cp -r src/adapters/ibm-vllm/proto dist/adapters/ibm-vllm $ rimraf dist $ tsc --noEmit && tsc -p tsconfig.examples.json --noEmit src/tools/base.test.ts:353:13 - error TS2454: Variable 'description' is used before being assigned.

353 description,


src/tools/base.test.ts:368:13 - error TS2454: Variable 'inputSchema' is used before being assigned.

368             inputSchema,

src/tools/base.test.ts:382:13 - error TS2454: Variable 'name' is used before being assigned.

382 name,


src/tools/database/elasticsearch.ts:39:8 - error TS2307: Cannot find module '@elastic/elasticsearch/lib/api/types.js' or its corresponding type declarations.

39 } from "@elastic/elasticsearch/lib/api/types.js";

tsup.config.ts:2:25 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

2 import packageJson from "./package.json";


tsup.config.ts:6:22 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

6 import tsConfig from "./tsconfig.json";

vitest.config.ts:3:25 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

3 import packageJson from "./package.json";



Found 7 errors in 4 files.

Errors  Files
     3  src/tools/base.test.ts:353
     1  src/tools/database/elasticsearch.ts:39
     2  tsup.config.ts:2
     1  vitest.config.ts:3
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Tomas2D commented 3 days ago

I was not able to reproduce it. I did the following steps.

git clone https://github.com/i-am-bee/bee-agent-framework
cd bee-agent-framework
nvm use
yarn install
corepack enable
yarn install
yarn build
tonxxd commented 1 day ago

Same for me, was able to run it in the past but now git clone nvm use yarn install branch + changes git commit

yarn run v1.22.17
$ tsc --noEmit && tsc -p tsconfig.examples.json --noEmit
src/agents/bee/runners/default/runner.ts:62:15 - error TS2322: Type 'string' is not assignable to type 'never'.

62               regex: parserRegex.source,
                 ~~~~~

src/llms/base.test.ts:196:41 - error TS2322: Type 'string' is not assignable to type 'never'.

196       await generate(["a"], { guided: { regex: /.+/.source } });
                                            ~~~~~

src/llms/base.test.ts:198:41 - error TS2322: Type 'string' is not assignable to type 'never'.

198       await generate(["a"], { guided: { regex: /.+/.source } });
                                            ~~~~~

src/llms/drivers/json.ts:62:13 - error TS2416: Property 'guided' in type 'JsonDriver<TGenerateOptions>' is not assignable to the same property in base type 'BaseDriver<TGenerateOptions>'.
  Type '(schema: SchemaObject) => { readonly json: SchemaObject; }' is not assignable to type '(schema: SchemaObject) => (Without<(Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), { ...; }> & { ...; }...'.
    Type '{ readonly json: SchemaObject; }' is not assignable to type '(Without<(Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { regex?: string | undefined; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), { ...; }> & { ...; }) |...'.
      Type '{ readonly json: SchemaObject; }' is not assignable to type 'Without<{ whitespace_pattern?: string | undefined; }, (Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), {...'.
        Property 'whitespace_pattern' is missing in type '{ readonly json: SchemaObject; }' but required in type 'Without<{ whitespace_pattern?: string | undefined; }, (Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), {...'.

62   protected guided(schema: SchemaObject) {
               ~~~~~~

src/llms/drivers/typescript.ts:54:13 - error TS2416: Property 'guided' in type 'TypescriptDriver<TGenerateOptions>' is not assignable to the same property in base type 'BaseDriver<TGenerateOptions>'.
  Type '(schema: SchemaObject) => { readonly json: SchemaObject; }' is not assignable to type '(schema: SchemaObject) => (Without<(Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), { ...; }> & { ...; }...'.
    Type '{ readonly json: SchemaObject; }' is not assignable to type '(Without<(Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { regex?: string | undefined; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), { ...; }> & { ...; }) |...'.
      Type '{ readonly json: SchemaObject; }' is not assignable to type 'Without<{ whitespace_pattern?: string | undefined; }, (Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), {...'.
        Property 'whitespace_pattern' is missing in type '{ readonly json: SchemaObject; }' but required in type 'Without<{ whitespace_pattern?: string | undefined; }, (Without<(Without<(Without<(Without<{ json?: string | Record<string, any> | undefined; }, { regex?: string | undefined; }> & { ...; }) | (Without<...> & { ...; }), { ...; }> & { ...; }) | (Without<...> & ((Without<...> & { ...; }) | (Without<...> & { ...; }))), {...'.

54   protected guided(schema: SchemaObject) {
               ~~~~~~

src/tools/base.test.ts:353:13 - error TS2454: Variable 'description' is used before being assigned.

353             description,
                ~~~~~~~~~~~

src/tools/base.test.ts:368:13 - error TS2454: Variable 'inputSchema' is used before being assigned.

368             inputSchema,
                ~~~~~~~~~~~

src/tools/base.test.ts:382:13 - error TS2454: Variable 'name' is used before being assigned.

382             name,
                ~~~~

src/tools/database/elasticsearch.ts:39:8 - error TS2307: Cannot find module '@elastic/elasticsearch/lib/api/types.js' or its corresponding type declarations.

39 } from "@elastic/elasticsearch/lib/api/types.js";
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tsup.config.ts:2:25 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

2 import packageJson from "./package.json";
                          ~~~~~~~~~~~~~~~~

tsup.config.ts:6:22 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

6 import tsConfig from "./tsconfig.json";
                       ~~~~~~~~~~~~~~~~~

vitest.config.ts:3:25 - error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'NodeNext'.

3 import packageJson from "./package.json";
                          ~~~~~~~~~~~~~~~~

Found 12 errors in 8 files.

Errors  Files
     1  src/agents/bee/runners/default/runner.ts:62
     2  src/llms/base.test.ts:196
     1  src/llms/drivers/json.ts:62
     1  src/llms/drivers/typescript.ts:54
     3  src/tools/base.test.ts:353
     1  src/tools/database/elasticsearch.ts:39
     2  tsup.config.ts:2
     1  vitest.config.ts:3
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky - pre-commit script failed (code 2)
Tomas2D commented 1 day ago

Got it. One should use yarn install --immutable to prevent updating packages. I updated the docs and related packages. Both ways should now work.

Please verify and let me know.