Files
t3code/apps/server/src/orchestration/Services/ProviderCommandReactor.ts
T
2026-03-10 15:54:34 -07:00

41 lines
1.2 KiB
TypeScript

/**
* ProviderCommandReactor - Provider command reaction service interface.
*
* Owns background workers that react to orchestration intent events and
* dispatch provider-side command execution.
*
* @module ProviderCommandReactor
*/
import { ServiceMap } from "effect";
import type { Effect, Scope } from "effect";
/**
* ProviderCommandReactorShape - Service API for provider command reactors.
*/
export interface ProviderCommandReactorShape {
/**
* Start reacting to provider-intent orchestration domain events.
*
* The returned effect must be run in a scope so all worker fibers can be
* finalized on shutdown.
*
* Filters orchestration domain events to provider-intent types before
* processing.
*/
readonly start: Effect.Effect<void, never, Scope.Scope>;
/**
* Resolves when the internal processing queue is empty and idle.
* Intended for test use to replace timing-sensitive sleeps.
*/
readonly drain: Effect.Effect<void>;
}
/**
* ProviderCommandReactor - Service tag for provider command reaction workers.
*/
export class ProviderCommandReactor extends ServiceMap.Service<
ProviderCommandReactor,
ProviderCommandReactorShape
>()("t3/orchestration/Services/ProviderCommandReactor") {}