@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 04:45 UTC

next
ts 43 lines 1.14 KB
Raw
1 /**
2 * Runs the fake backend on its own, for poking at the CLI by hand:
3 *
4 * bun ts/e2e-tests/cli/fake-backend/src/main.ts
5 *
6 * Prints the environment to give the binary and logs each request it receives.
7 * Pass a path to also write the Dashboard certificate there, for
8 * `NODE_EXTRA_CA_CERTS`.
9 */
10
11 import { writeFileSync } from 'node:fs';
12 import { startFakeComposio } from './server';
13
14 const fake = await startFakeComposio();
15 const certificatePath = process.argv[2];
16 if (certificatePath) writeFileSync(certificatePath, fake.caCert);
17 console.log(
18 Object.entries(fake.cliEnv())
19 .map(([name, value]) => `${name}=${value}`)
20 .join('\n')
21 );
22
23 let seen = 0;
24 setInterval(() => {
25 for (const entry of fake.journal.since(seen)) {
26 console.log(
27 JSON.stringify({
28 role: entry.role,
29 request: `${entry.method} ${entry.path}`,
30 query: entry.query,
31 route: entry.route,
32 key: entry.keyClass,
33 org: entry.orgId,
34 project: entry.project,
35 via: entry.projectFrom,
36 user: entry.userId,
37 status: entry.status,
38 body: entry.body,
39 })
40 );
41 }
42 seen = fake.journal.mark();
43 }, 100);