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 10 lines 472 Bytes
Raw
1 import { Context, Effect } from 'effect';
2
3 /**
4 * Captures the given services from the current context, for a layer whose methods provide them
5 * later. Only those services: providing the whole context would also replace the caller's
6 * `ConfigProvider`.
7 */
8 export const captureServices = <const S extends ReadonlyArray<Context.Key<unknown, unknown>>>(
9 ...services: S
10 ) => Effect.map(Effect.context<Context.Service.Identifier<S[number]>>(), Context.pick(...services));