Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ProviderCommandReactor.ts

40 lines1.2 KB

1/**
2 * ProviderCommandReactor - Provider command reaction service interface.
3 *
4 * Owns background workers that react to orchestration intent events and
5 * dispatch provider-side command execution.
6 *
7 * @module ProviderCommandReactor
8 */
9import { ServiceMap } from "effect";
10import type { Effect, Scope } from "effect";
11​
12/**
13 * ProviderCommandReactorShape - Service API for provider command reactors.
14 */
15export interface ProviderCommandReactorShape {
16 /**
17 * Start reacting to provider-intent orchestration domain events.
18 *
19 * The returned effect must be run in a scope so all worker fibers can be
20 * finalized on shutdown.
21 *
22 * Filters orchestration domain events to provider-intent types before
23 * processing.
24 */
25 readonly start: Effect.Effect<void, never, Scope.Scope>;
26​
27 /**
28 * Resolves when the internal processing queue is empty and idle.
29 * Intended for test use to replace timing-sensitive sleeps.
30 */
31 readonly drain: Effect.Effect<void>;
33​
34/**
35 * ProviderCommandReactor - Service tag for provider command reaction workers.
36 */
37export class ProviderCommandReactor extends ServiceMap.Service<
38 ProviderCommandReactor,
39 ProviderCommandReactorShape
40>()("t3/orchestration/Services/ProviderCommandReactor") {}