Open History to see the last commit
1/**
2 * ProviderRuntimeIngestionService - Provider runtime ingestion service interface.
3 *
4 * Owns background workers that consume provider runtime streams and emit
5 * orchestration commands/events.
6 *
7 * @module ProviderRuntimeIngestionService
8 */
9import { ServiceMap } from "effect";
10import type { Effect, Scope } from "effect";
11
12/**
13 * ProviderRuntimeIngestionShape - Service API for runtime ingestion lifecycle.
14 */
15export interface ProviderRuntimeIngestionShape {
16 /**
17 * Start ingesting provider runtime events into orchestration commands.
18 *
19 * The returned effect must be run in a scope so all worker fibers can be
20 * finalized on shutdown.
21 *
22 * Uses an internal queue and continues after non-interrupt failures by
23 * logging warnings.
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>;
32}
33
34/**
35 * ProviderRuntimeIngestionService - Service tag for runtime ingestion workers.
36 */
37export class ProviderRuntimeIngestionService extends ServiceMap.Service<
38 ProviderRuntimeIngestionService,
39 ProviderRuntimeIngestionShape
40>()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {}