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
| 1 | // eslint-disable-next-line no-restricted-imports -- This Effect service is the sole node:os boundary for CLI source. |
| 2 | import os from 'node:os'; |
| 3 | import { Context, Layer } from 'effect'; |
| 4 | |
| 5 | export interface NodeOsShape { |
| 6 | readonly homedir: string; |
| 7 | readonly tmpdir: string; |
| 8 | readonly platform: NodeJS.Platform; |
| 9 | readonly arch: string; |
| 10 | } |
| 11 | |
| 12 | // Injectable operating-system details for testing purposes. |
| 13 | export class NodeOs extends Context.Service<NodeOs, NodeOsShape>()('services/NodeOs') { |
| 14 | static readonly Default: Layer.Layer<NodeOs> = Layer.sync(NodeOs, () => ({ |
| 15 | homedir: os.homedir(), |
| 16 | tmpdir: os.tmpdir(), |
| 17 | platform: os.platform(), |
| 18 | arch: os.arch(), |
| 19 | })); |
| 20 | } |
| 21 | |
| 22 | export const defaultNodeOs = ({ |
| 23 | homedir, |
| 24 | tmpdir = os.tmpdir(), |
| 25 | }: { |
| 26 | homedir: string; |
| 27 | tmpdir?: string; |
| 28 | }): NodeOsShape => NodeOs.of({ homedir, tmpdir, platform: os.platform(), arch: os.arch() }); |