1import type { ThreadId } from "@t3tools/contracts";
2import * as KeyedLock from "@t3tools/shared/KeyedLock";
3import * as Context from "effect/Context";
4import * as Layer from "effect/Layer";
5
6/** Shared by thread commands and project deletion so both plan against current thread state. */
7export class ThreadCommandExecutor extends Context.Service<
8 ThreadCommandExecutor,
9 KeyedLock.KeyedLock<ThreadId>
10>()("t3/orchestration-v2/ThreadCommandExecutor") {}
11
12export const layer = Layer.effect(ThreadCommandExecutor, KeyedLock.make<ThreadId>());