Open History to see the last commit
1import { Connection } from "@t3tools/client-runtime/connection";
2import { shellSnapshotLoaderLayer } from "@t3tools/client-runtime/state/shell";
3import {
4 boundedThreadSnapshotLoaderLayer,
5 threadHistoryControllerLayer,
6} from "@t3tools/client-runtime/state/threads";
7import { pullRequestDiffLoaderLayer } from "@t3tools/client-runtime/state/pull-requests";
8import * as Layer from "effect/Layer";
9import { Atom } from "effect/unstable/reactivity";
10
11import { runtimeContextLayer } from "../lib/runtime";
12import {
13 backgroundActivityObserverLayer,
14 backgroundActivityReporterLayer,
15} from "../lib/backgroundActivityReporter";
16import { connectionPlatformLayer } from "./platform";
17
18const providedConnectionPlatformLayer = connectionPlatformLayer.pipe(
19 Layer.provide(runtimeContextLayer),
20);
21
22const snapshotLoaderLayer = Layer.mergeAll(
23 boundedThreadSnapshotLoaderLayer,
24 shellSnapshotLoaderLayer,
25 threadHistoryControllerLayer,
26 pullRequestDiffLoaderLayer,
27);
28
29type ConnectionLayerSource =
30 | typeof Connection.layer
31 | typeof snapshotLoaderLayer
32 | typeof runtimeContextLayer
33 | typeof connectionPlatformLayer
34 | typeof backgroundActivityObserverLayer
35 | typeof backgroundActivityReporterLayer;
36
37const providedClientConnectionLayer = Layer.merge(Connection.layer, snapshotLoaderLayer).pipe(
38 Layer.provideMerge(
39 Layer.mergeAll(
40 runtimeContextLayer,
41 providedConnectionPlatformLayer,
42 backgroundActivityObserverLayer,
43 ),
44 ),
45);
46
47const connectionLayer = backgroundActivityReporterLayer.pipe(
48 Layer.provideMerge(providedClientConnectionLayer),
49);
50
51export const connectionAtomRuntime: Atom.AtomRuntime<
52 Layer.Success<ConnectionLayerSource>,
53 Layer.Error<ConnectionLayerSource>
54> = Atom.runtime(connectionLayer);