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

next
ts 19 lines 644 Bytes
Raw
1 import { Effect, FileSystem, Path } from 'effect';
2 import * as constants from 'src/constants';
3 import { APP_CONFIG } from 'src/config';
4 import { NodeOs } from 'src/services/node-os';
5
6 // Helper to create cache directory
7 export const setupCacheDir = Effect.gen(function* () {
8 const fs = yield* FileSystem.FileSystem;
9 const path = yield* Path.Path;
10 const os = yield* NodeOs;
11
12 const cacheDir =
13 (yield* APP_CONFIG.CACHE_DIR) ?? path.join(os.homedir, constants.USER_COMPOSIO_DIR);
14
15 // Ensure cache directory exists
16 yield* fs.makeDirectory(cacheDir, { recursive: true }).pipe(Effect.catch(() => Effect.void));
17
18 return cacheDir;
19 });