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

ProviderCommandReactor.ts

42 lines1.4 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 * as Context from "effect/Context";
10import type * as Effect from "effect/Effect";
11import type * as Scope from "effect/Scope";
12​
13/**
14 * ProviderCommandReactorShape - Service API for provider command reactors.
15 */
16export interface ProviderCommandReactorShape {
17 /**
18 * Start reacting to provider-intent orchestration domain events.
19 *
20 * The returned effect must be run in a scope so all worker fibers can be
21 * finalized on shutdown.
22 * It subscribes before returning. Event handling waits for server activation.
23 *
24 * Filters orchestration domain events to provider-intent types before
25 * processing.
26 */
27 readonly start: () => Effect.Effect<void, never, Scope.Scope>;
28​
29 /**
30 * Resolves when the internal processing queue is empty and idle.
31 * Intended for test use to replace timing-sensitive sleeps.
32 */
33 readonly drain: Effect.Effect<void>;
35​
36/**
37 * ProviderCommandReactor - Service tag for provider command reaction workers.
38 */
39export class ProviderCommandReactor extends Context.Service<
40 ProviderCommandReactor,
41 ProviderCommandReactorShape
42>()("t3/orchestration/Services/ProviderCommandReactor") {}