|
1 | 1 | import { runner } from '@agentuity/sdk'; |
2 | 2 |
|
3 | 3 | declare global { |
4 | | - namespace NodeJS { |
5 | | - interface Process { |
6 | | - isBun: boolean; |
7 | | - } |
8 | | - } |
| 4 | + namespace NodeJS { |
| 5 | + interface Process { |
| 6 | + isBun: boolean; |
| 7 | + } |
| 8 | + } |
9 | 9 | } |
10 | 10 |
|
11 | 11 | if (!process.env.AGENTUITY_API_KEY && !process.env.AGENTUITY_SDK_KEY) { |
12 | | - console.error( |
13 | | - '\x1b[31m[ERROR] AGENTUITY_API_KEY or AGENTUITY_SDK_KEY is not set. This should have been set automatically by the Agentuity CLI or picked up from the .env file.\x1b[0m' |
14 | | - ); |
| 12 | + console.error( |
| 13 | + '\x1b[31m[ERROR] AGENTUITY_API_KEY or AGENTUITY_SDK_KEY is not set. This should have been set automatically by the Agentuity CLI or picked up from the .env file.\x1b[0m' |
| 14 | + ); |
15 | 15 |
|
16 | | - const cmd = process.env._ || ''; |
| 16 | + const cmd = process.env._ || ''; |
17 | 17 |
|
18 | | - if (cmd.endsWith('node')) { |
19 | | - console.error( |
20 | | - '\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m' |
21 | | - ); |
22 | | - } |
| 18 | + if (cmd.endsWith('node')) { |
| 19 | + console.error( |
| 20 | + '\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m' |
| 21 | + ); |
| 22 | + } |
23 | 23 |
|
24 | | - process.exit(1); |
| 24 | + process.exit(1); |
25 | 25 | } |
26 | 26 |
|
27 | 27 | if (!process.env.AGENTUITY_URL) { |
28 | | - console.warn( |
29 | | - '\x1b[31m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\x1b[0m' |
30 | | - ); |
31 | | - |
32 | | - if (process.isBun) { |
33 | | - console.warn( |
34 | | - '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `bun run start`.\x1b[0m' |
35 | | - ); |
36 | | - } else { |
37 | | - console.warn( |
38 | | - '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `npm start`.\x1b[0m' |
39 | | - ); |
40 | | - } |
| 28 | + console.warn( |
| 29 | + '\x1b[31m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\x1b[0m' |
| 30 | + ); |
| 31 | + |
| 32 | + if (process.isBun) { |
| 33 | + console.warn( |
| 34 | + '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `bun run start`.\x1b[0m' |
| 35 | + ); |
| 36 | + } else { |
| 37 | + console.warn( |
| 38 | + '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `npm start`.\x1b[0m' |
| 39 | + ); |
| 40 | + } |
41 | 41 | } |
42 | 42 |
|
43 | 43 | runner(true, import.meta.dirname).catch((err) => { |
44 | | - if (err instanceof Error) { |
45 | | - console.error(err.message); |
46 | | - console.error(err.stack); |
47 | | - } else { |
48 | | - console.error(err); |
49 | | - } |
50 | | - |
51 | | - process.exit(1); |
| 44 | + if (err instanceof Error) { |
| 45 | + console.error(err.message); |
| 46 | + console.error(err.stack); |
| 47 | + } else { |
| 48 | + console.error(err); |
| 49 | + } |
| 50 | + |
| 51 | + process.exit(1); |
52 | 52 | }); |
0 commit comments