@open-wa/runtime-core 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +67 -0
- package/README.md +21 -0
- package/dist/index.cjs +568 -0
- package/dist/index.d.cts +341 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +341 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +530 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema, Stream } from "effect";
|
|
2
|
+
import { HttpApi, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
+
import { Rpc } from "effect/unstable/rpc";
|
|
4
|
+
//#region src/errors.d.ts
|
|
5
|
+
declare const RuntimeCapabilityError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly _tag: "RuntimeCapabilityError";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
export declare class RuntimeCapabilityError extends RuntimeCapabilityError_base<{
|
|
9
|
+
readonly capability: RuntimeCapability;
|
|
10
|
+
readonly runtime: RuntimeKind;
|
|
11
|
+
readonly detail: string;
|
|
12
|
+
}> {}
|
|
13
|
+
declare const QueueOverloadedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
14
|
+
readonly _tag: "QueueOverloadedError";
|
|
15
|
+
} & Readonly<A>;
|
|
16
|
+
export declare class QueueOverloadedError extends QueueOverloadedError_base<{
|
|
17
|
+
readonly queue: string;
|
|
18
|
+
readonly capacity: number;
|
|
19
|
+
}> {}
|
|
20
|
+
declare const QueueClosedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
21
|
+
readonly _tag: "QueueClosedError";
|
|
22
|
+
} & Readonly<A>;
|
|
23
|
+
export declare class QueueClosedError extends QueueClosedError_base<{
|
|
24
|
+
readonly queue: string;
|
|
25
|
+
}> {}
|
|
26
|
+
declare const TaskTimeoutError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
27
|
+
readonly _tag: "TaskTimeoutError";
|
|
28
|
+
} & Readonly<A>;
|
|
29
|
+
export declare class TaskTimeoutError extends TaskTimeoutError_base<{
|
|
30
|
+
readonly queue: string;
|
|
31
|
+
readonly timeoutMs: number;
|
|
32
|
+
}> {}
|
|
33
|
+
declare const TaskExecutionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
34
|
+
readonly _tag: "TaskExecutionError";
|
|
35
|
+
} & Readonly<A>;
|
|
36
|
+
export declare class TaskExecutionError extends TaskExecutionError_base<{
|
|
37
|
+
readonly queue: string;
|
|
38
|
+
readonly cause: unknown;
|
|
39
|
+
}> {}
|
|
40
|
+
declare const StartupGraphError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
41
|
+
readonly _tag: "StartupGraphError";
|
|
42
|
+
} & Readonly<A>;
|
|
43
|
+
export declare class StartupGraphError extends StartupGraphError_base<{
|
|
44
|
+
readonly detail: string;
|
|
45
|
+
readonly nodes: ReadonlyArray<string>;
|
|
46
|
+
}> {}
|
|
47
|
+
declare const SandboxPolicyError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
48
|
+
readonly _tag: "SandboxPolicyError";
|
|
49
|
+
} & Readonly<A>;
|
|
50
|
+
export declare class SandboxPolicyError extends SandboxPolicyError_base<{
|
|
51
|
+
readonly detail: string;
|
|
52
|
+
readonly field?: string;
|
|
53
|
+
}> {}
|
|
54
|
+
declare const SandboxExecutionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
55
|
+
readonly _tag: "SandboxExecutionError";
|
|
56
|
+
} & Readonly<A>;
|
|
57
|
+
export declare class SandboxExecutionError extends SandboxExecutionError_base<{
|
|
58
|
+
readonly chatId: string;
|
|
59
|
+
readonly isolation: string;
|
|
60
|
+
readonly cause: unknown;
|
|
61
|
+
}> {}
|
|
62
|
+
declare const SessionAdmissionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
63
|
+
readonly _tag: "SessionAdmissionError";
|
|
64
|
+
} & Readonly<A>;
|
|
65
|
+
export declare class SessionAdmissionError extends SessionAdmissionError_base<{
|
|
66
|
+
readonly requestedMemoryMb: number;
|
|
67
|
+
readonly availableMemoryMb: number;
|
|
68
|
+
}> {}
|
|
69
|
+
export type RuntimeKind = 'node' | 'bun' | 'browser' | 'edge' | 'test';
|
|
70
|
+
export type RuntimeCapability = 'browser-client' | 'chromium-launch' | 'filesystem' | 'process' | 'web-fetch' | 'worker-bindings';
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/effect-spikes.d.ts
|
|
73
|
+
export declare const RuntimeHealthSchema: Schema.Struct<{
|
|
74
|
+
readonly sessionId: Schema.String;
|
|
75
|
+
readonly state: Schema.Literals<readonly ["STARTING", "AUTHENTICATING", "READY", "DISCONNECTED", "STOPPED"]>;
|
|
76
|
+
readonly ready: Schema.Boolean;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const RuntimeEventSchema: Schema.Struct<{
|
|
79
|
+
readonly event: Schema.String;
|
|
80
|
+
readonly sessionId: Schema.String;
|
|
81
|
+
readonly timestamp: Schema.Number;
|
|
82
|
+
readonly payload: Schema.Unknown;
|
|
83
|
+
}>;
|
|
84
|
+
export declare const OpenWaHttpApi: HttpApi.HttpApi<"openwa", HttpApiGroup.HttpApiGroup<"runtime", HttpApiEndpoint.HttpApiEndpoint<"health", "GET", "/health", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
85
|
+
readonly sessionId: Schema.String;
|
|
86
|
+
readonly state: Schema.Literals<readonly ["STARTING", "AUTHENTICATING", "READY", "DISCONNECTED", "STOPPED"]>;
|
|
87
|
+
readonly ready: Schema.Boolean;
|
|
88
|
+
}>>, never, never, never>, false>>;
|
|
89
|
+
export declare const OpenWaAskRpc: Rpc.Rpc<"openwa.ask", Schema.Struct<{
|
|
90
|
+
method: Schema.String;
|
|
91
|
+
args: Schema.$Array<Schema.Unknown>;
|
|
92
|
+
}>, Schema.Unknown, Schema.Never, never, never>;
|
|
93
|
+
export declare const decodeRuntimeEvent: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<Schema.Struct.ReadonlySide<{
|
|
94
|
+
readonly event: Schema.String;
|
|
95
|
+
readonly sessionId: Schema.String;
|
|
96
|
+
readonly timestamp: Schema.Number;
|
|
97
|
+
readonly payload: Schema.Unknown;
|
|
98
|
+
}, "Type">, Schema.SchemaError, never>;
|
|
99
|
+
export declare const makeBoundedEventPipeline: <A>(capacity: number) => Effect.Effect<{
|
|
100
|
+
readonly publish: (event: A) => Effect.Effect<boolean, never, never>;
|
|
101
|
+
readonly events: Stream.Stream<A, never, never>;
|
|
102
|
+
readonly shutdown: Effect.Effect<void, never, never>;
|
|
103
|
+
}, never, never>;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/services.d.ts
|
|
106
|
+
export interface RuntimeCapabilitiesShape {
|
|
107
|
+
readonly runtime: RuntimeKind;
|
|
108
|
+
readonly supported: ReadonlySet<RuntimeCapability>;
|
|
109
|
+
readonly has: (capability: RuntimeCapability) => boolean;
|
|
110
|
+
readonly require: (capability: RuntimeCapability) => Effect.Effect<void, RuntimeCapabilityError>;
|
|
111
|
+
}
|
|
112
|
+
export declare const RuntimeCapabilities: Context.Service<RuntimeCapabilitiesShape, RuntimeCapabilitiesShape>;
|
|
113
|
+
export interface BrowserDriverShape {
|
|
114
|
+
readonly launch: (options?: unknown) => Effect.Effect<unknown, unknown>;
|
|
115
|
+
}
|
|
116
|
+
export declare const BrowserDriver: Context.Service<BrowserDriverShape, BrowserDriverShape>;
|
|
117
|
+
export interface BrowserSessionShape {
|
|
118
|
+
readonly page: unknown;
|
|
119
|
+
readonly close: Effect.Effect<void>;
|
|
120
|
+
}
|
|
121
|
+
export declare const BrowserSession: Context.Service<BrowserSessionShape, BrowserSessionShape>;
|
|
122
|
+
export interface PatchSourceShape<Artifact = unknown> {
|
|
123
|
+
readonly preload: Effect.Effect<Artifact, unknown>;
|
|
124
|
+
}
|
|
125
|
+
export declare const PatchSource: Context.Service<PatchSourceShape<unknown>, PatchSourceShape<unknown>>;
|
|
126
|
+
export interface LicenseServiceShape<Artifact = unknown, Identity = unknown> {
|
|
127
|
+
readonly preflight: Effect.Effect<Artifact | null, unknown>;
|
|
128
|
+
readonly validate: (identity: Identity, artifact: Artifact | null) => Effect.Effect<Artifact | null, unknown>;
|
|
129
|
+
}
|
|
130
|
+
export declare const LicenseService: Context.Service<LicenseServiceShape<unknown, unknown>, LicenseServiceShape<unknown, unknown>>;
|
|
131
|
+
export interface SessionStoreShape {
|
|
132
|
+
readonly get: (key: string) => Effect.Effect<unknown, unknown>;
|
|
133
|
+
readonly set: (key: string, value: unknown) => Effect.Effect<void, unknown>;
|
|
134
|
+
readonly remove: (key: string) => Effect.Effect<void, unknown>;
|
|
135
|
+
}
|
|
136
|
+
export declare const SessionStore: Context.Service<SessionStoreShape, SessionStoreShape>;
|
|
137
|
+
export interface PluginRegistryShape {
|
|
138
|
+
readonly names: Effect.Effect<ReadonlyArray<string>>;
|
|
139
|
+
readonly close: Effect.Effect<void>;
|
|
140
|
+
}
|
|
141
|
+
export declare const PluginRegistry: Context.Service<PluginRegistryShape, PluginRegistryShape>;
|
|
142
|
+
export interface ChatExecutorShape {
|
|
143
|
+
readonly execute: (chatId: string, source: string, input?: unknown) => Effect.Effect<unknown, unknown>;
|
|
144
|
+
readonly closeChat: (chatId: string) => Effect.Effect<void>;
|
|
145
|
+
}
|
|
146
|
+
export declare const ChatExecutor: Context.Service<ChatExecutorShape, ChatExecutorShape>;
|
|
147
|
+
export interface SessionAdmissionLease {
|
|
148
|
+
readonly memoryMb: number;
|
|
149
|
+
readonly release: Effect.Effect<void>;
|
|
150
|
+
}
|
|
151
|
+
export interface SessionAdmissionShape {
|
|
152
|
+
readonly acquire: (memoryMb: number) => Effect.Effect<SessionAdmissionLease, SessionAdmissionError>;
|
|
153
|
+
readonly snapshot: Effect.Effect<{
|
|
154
|
+
readonly capacityMemoryMb: number;
|
|
155
|
+
readonly availableMemoryMb: number;
|
|
156
|
+
readonly activeSessions: number;
|
|
157
|
+
}>;
|
|
158
|
+
}
|
|
159
|
+
export declare const SessionAdmission: Context.Service<SessionAdmissionShape, SessionAdmissionShape>;
|
|
160
|
+
export interface RuntimeObservabilityShape {
|
|
161
|
+
readonly increment: (metric: RuntimeMetric, value?: number, attributes?: Readonly<Record<string, string | number | boolean>>) => Effect.Effect<void>;
|
|
162
|
+
readonly gauge: (metric: RuntimeMetric, value: number, attributes?: Readonly<Record<string, string | number | boolean>>) => Effect.Effect<void>;
|
|
163
|
+
readonly snapshot: Effect.Effect<Readonly<Record<string, number>>>;
|
|
164
|
+
readonly recordCause: (scope: string, cause: unknown, attributes?: Readonly<Record<string, string | number | boolean>>) => Effect.Effect<void>;
|
|
165
|
+
readonly causes: Effect.Effect<ReadonlyArray<RuntimeCauseRecord>>;
|
|
166
|
+
}
|
|
167
|
+
export interface SerializedRuntimeCause {
|
|
168
|
+
readonly name: string;
|
|
169
|
+
readonly message: string;
|
|
170
|
+
readonly stack?: string;
|
|
171
|
+
readonly cause?: SerializedRuntimeCause;
|
|
172
|
+
readonly errors?: ReadonlyArray<SerializedRuntimeCause>;
|
|
173
|
+
}
|
|
174
|
+
export interface RuntimeCauseRecord {
|
|
175
|
+
readonly scope: string;
|
|
176
|
+
readonly recordedAt: number;
|
|
177
|
+
readonly attributes?: Readonly<Record<string, string | number | boolean>>;
|
|
178
|
+
readonly cause: SerializedRuntimeCause;
|
|
179
|
+
}
|
|
180
|
+
export type RuntimeMetric = 'active_fibers' | 'cause_failures' | 'queue_active' | 'queue_depth' | 'queue_drops' | 'queue_failures' | 'rate_decisions' | 'retry_decisions' | 'session_browser_memory_mb' | 'startup_phase_ms' | 'startup_critical_path_ms';
|
|
181
|
+
export declare const RuntimeObservability: Context.Service<RuntimeObservabilityShape, RuntimeObservabilityShape>;
|
|
182
|
+
export declare const serviceLayer: <I, S>(key: Context.Key<I, S>, service: S) => Layer.Layer<I, never, never>;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/observability.d.ts
|
|
185
|
+
export declare const makeInMemoryObservability: () => RuntimeObservabilityShape;
|
|
186
|
+
export declare const InMemoryObservabilityLayer: Layer.Layer<RuntimeObservabilityShape, never, never>;
|
|
187
|
+
export declare const queueMetricsObserver: (observability: RuntimeObservabilityShape) => (metrics: {
|
|
188
|
+
readonly name: string;
|
|
189
|
+
readonly depth: number;
|
|
190
|
+
readonly active: number;
|
|
191
|
+
readonly dropped: number;
|
|
192
|
+
readonly failed: number;
|
|
193
|
+
readonly rateLimited: number;
|
|
194
|
+
}) => void;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/runtime-capabilities.d.ts
|
|
197
|
+
export declare const makeRuntimeCapabilities: (runtime: RuntimeKind, capabilities: Iterable<RuntimeCapability>) => RuntimeCapabilitiesShape;
|
|
198
|
+
export declare const runtimeCapabilitiesLayer: (runtime: RuntimeKind, capabilities: Iterable<RuntimeCapability>) => Layer.Layer<RuntimeCapabilitiesShape, never, never>;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/sandbox.d.ts
|
|
201
|
+
export type SandboxIsolation = 'worker' | 'process' | 'container';
|
|
202
|
+
export interface ChatSandboxPolicy {
|
|
203
|
+
readonly chats: boolean;
|
|
204
|
+
readonly isolation: SandboxIsolation;
|
|
205
|
+
readonly timeoutMs: number;
|
|
206
|
+
readonly idleTimeoutMs: number;
|
|
207
|
+
readonly memoryMb: number;
|
|
208
|
+
readonly concurrency: number;
|
|
209
|
+
readonly filesystem: 'none' | 'read-only' | 'workspace';
|
|
210
|
+
readonly network: 'none' | 'allowlist';
|
|
211
|
+
readonly networkAllowlist: ReadonlyArray<string>;
|
|
212
|
+
readonly env: 'none' | ReadonlyArray<string>;
|
|
213
|
+
readonly capabilities: ReadonlyArray<string>;
|
|
214
|
+
}
|
|
215
|
+
export declare const defaultChatSandboxPolicy: ChatSandboxPolicy;
|
|
216
|
+
export type SandboxCapabilityHandler = (...args: ReadonlyArray<unknown>) => unknown | Promise<unknown>;
|
|
217
|
+
export type SandboxCapabilityHandlers = Readonly<Record<string, SandboxCapabilityHandler>>;
|
|
218
|
+
export interface SandboxRequest {
|
|
219
|
+
readonly chatId: string;
|
|
220
|
+
readonly source: string;
|
|
221
|
+
readonly input?: unknown;
|
|
222
|
+
readonly policy: ChatSandboxPolicy;
|
|
223
|
+
/** Parent-owned capability implementations. Functions never enter the sandbox. */
|
|
224
|
+
readonly capabilityHandlers?: SandboxCapabilityHandlers;
|
|
225
|
+
}
|
|
226
|
+
export interface ExecutionSandboxShape {
|
|
227
|
+
readonly execute: (request: SandboxRequest) => Effect.Effect<unknown, SandboxExecutionError>;
|
|
228
|
+
readonly closeChat: (chatId: string) => Effect.Effect<void>;
|
|
229
|
+
readonly close: Effect.Effect<void>;
|
|
230
|
+
}
|
|
231
|
+
export declare const ExecutionSandbox: Context.Service<ExecutionSandboxShape, ExecutionSandboxShape>;
|
|
232
|
+
/** Cause capture only. This function does not provide a security boundary. */
|
|
233
|
+
export declare const captureSandboxCause: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, import("effect/Cause").Cause<E>, R>;
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/scoped-task-queue.d.ts
|
|
236
|
+
export type QueueOverloadStrategy = 'backpressure' | 'dropping';
|
|
237
|
+
export interface QueueRateLimit {
|
|
238
|
+
readonly limit: number;
|
|
239
|
+
readonly intervalMs: number;
|
|
240
|
+
}
|
|
241
|
+
export interface TaskQueuePolicy {
|
|
242
|
+
readonly name: string;
|
|
243
|
+
readonly capacity: number;
|
|
244
|
+
readonly concurrency: number;
|
|
245
|
+
readonly overload: QueueOverloadStrategy;
|
|
246
|
+
readonly ordering: 'fifo';
|
|
247
|
+
readonly timeoutMs?: number;
|
|
248
|
+
readonly rate?: QueueRateLimit;
|
|
249
|
+
readonly observe?: (metrics: TaskQueueMetrics) => void;
|
|
250
|
+
}
|
|
251
|
+
export interface TaskQueueMetrics {
|
|
252
|
+
readonly name: string;
|
|
253
|
+
readonly capacity: number;
|
|
254
|
+
readonly depth: number;
|
|
255
|
+
readonly active: number;
|
|
256
|
+
readonly completed: number;
|
|
257
|
+
readonly failed: number;
|
|
258
|
+
readonly dropped: number;
|
|
259
|
+
readonly rateLimited: number;
|
|
260
|
+
readonly closed: boolean;
|
|
261
|
+
}
|
|
262
|
+
export declare class ScopedTaskQueue {
|
|
263
|
+
readonly policy: TaskQueuePolicy;
|
|
264
|
+
private readonly queue;
|
|
265
|
+
private readonly scope;
|
|
266
|
+
private readonly activeTasks;
|
|
267
|
+
private readonly metricsState;
|
|
268
|
+
private rateWindowStartedAt;
|
|
269
|
+
private rateWindowCount;
|
|
270
|
+
private constructor();
|
|
271
|
+
static make(policy: Omit<TaskQueuePolicy, 'ordering'> & {
|
|
272
|
+
readonly ordering?: 'fifo';
|
|
273
|
+
}): Promise<ScopedTaskQueue>;
|
|
274
|
+
submit<A>(operation: () => Promise<A> | A, label?: string): Promise<A>;
|
|
275
|
+
metrics(): TaskQueueMetrics;
|
|
276
|
+
close(): Promise<void>;
|
|
277
|
+
waitForIdle(): Promise<void>;
|
|
278
|
+
private worker;
|
|
279
|
+
private reserveRatePermit;
|
|
280
|
+
private notifyObserver;
|
|
281
|
+
}
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/session-admission.d.ts
|
|
284
|
+
export interface SessionAdmissionOptions {
|
|
285
|
+
readonly memoryCapacityMb: number;
|
|
286
|
+
readonly maxConcurrentLaunches: number;
|
|
287
|
+
readonly observability?: RuntimeObservabilityShape;
|
|
288
|
+
}
|
|
289
|
+
export declare const makeSessionAdmission: (options: SessionAdmissionOptions) => Effect.Effect<SessionAdmissionShape>;
|
|
290
|
+
export declare const sessionAdmissionLayer: (options: SessionAdmissionOptions) => Layer.Layer<SessionAdmissionShape, never, never>;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/session-scope.d.ts
|
|
293
|
+
export type SessionFinalizerReason = 'auth-timeout' | 'browser-crash' | 'failure' | 'interruption' | 'normal-stop' | 'plugin-failure' | 'signal' | 'startup-failure';
|
|
294
|
+
export declare class SessionScope {
|
|
295
|
+
private readonly scope;
|
|
296
|
+
private readonly observability?;
|
|
297
|
+
private readonly metricAttributes;
|
|
298
|
+
private readonly finalizerNames;
|
|
299
|
+
private closed;
|
|
300
|
+
private activeFibers;
|
|
301
|
+
private constructor();
|
|
302
|
+
static make(options?: {
|
|
303
|
+
readonly observability?: RuntimeObservabilityShape;
|
|
304
|
+
readonly metricAttributes?: Readonly<Record<string, string | number | boolean>>;
|
|
305
|
+
}): Promise<SessionScope>;
|
|
306
|
+
addFinalizer(name: string, finalizer: () => void | Promise<void>): Promise<() => void>;
|
|
307
|
+
snapshot(): {
|
|
308
|
+
readonly closed: boolean;
|
|
309
|
+
readonly finalizers: readonly string[];
|
|
310
|
+
};
|
|
311
|
+
fork<A, E>(effect: Effect.Effect<A, E>): Promise<void>;
|
|
312
|
+
close(reason?: SessionFinalizerReason): Promise<void>;
|
|
313
|
+
private publishActiveFibers;
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/startup-graph.d.ts
|
|
317
|
+
export interface StartupNode<A = unknown> {
|
|
318
|
+
readonly id: string;
|
|
319
|
+
readonly dependsOn?: ReadonlyArray<string>;
|
|
320
|
+
readonly optional?: boolean;
|
|
321
|
+
readonly run: (completed: ReadonlyMap<string, unknown>) => Effect.Effect<A, unknown>;
|
|
322
|
+
}
|
|
323
|
+
export interface StartupNodeResult {
|
|
324
|
+
readonly id: string;
|
|
325
|
+
readonly durationMs: number;
|
|
326
|
+
readonly optional: boolean;
|
|
327
|
+
readonly result: unknown;
|
|
328
|
+
}
|
|
329
|
+
export interface StartupGraphResult {
|
|
330
|
+
readonly values: ReadonlyMap<string, unknown>;
|
|
331
|
+
readonly phases: ReadonlyArray<StartupNodeResult>;
|
|
332
|
+
readonly criticalPathMs: number;
|
|
333
|
+
}
|
|
334
|
+
export declare const validateStartupGraph: (nodes: ReadonlyArray<StartupNode>) => Effect.Effect<void, StartupGraphError>;
|
|
335
|
+
export declare const runStartupGraph: (nodes: ReadonlyArray<StartupNode>, options?: {
|
|
336
|
+
readonly concurrency?: number;
|
|
337
|
+
readonly onPhase?: (phase: StartupNodeResult) => void;
|
|
338
|
+
readonly onComplete?: (result: StartupGraphResult) => void;
|
|
339
|
+
}) => Effect.Effect<StartupGraphResult, unknown>;
|
|
340
|
+
//#endregion
|
|
341
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/effect-spikes.ts","../src/services.ts","../src/observability.ts","../src/runtime-capabilities.ts","../src/sandbox.ts","../src/scoped-task-queue.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