@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 35 lines 762 Bytes
Raw
1 import { Stack } from "alchemy/Stack";
2 import * as State from "alchemy/State";
3 import * as Layer from "effect/Layer";
4
5 export const state = (resources: Record<string, State.ResourceState> = {}) =>
6 Layer.effect(
7 State.State,
8 Stack.useSync((stack) =>
9 State.InMemoryService({
10 [stack.name]: {
11 [stack.stage]: resources,
12 },
13 }),
14 ),
15 );
16
17 export const defaultState = (
18 resources: Record<string, State.ResourceState> = {},
19 other?: {
20 [stack: string]: {
21 [stage: string]: {
22 [resourceId: string]: State.ResourceState;
23 };
24 };
25 },
26 ) =>
27 Layer.succeed(
28 State.State,
29 State.InMemoryService({
30 ["test-app"]: {
31 ["test-stage"]: resources,
32 },
33 ...other,
34 }),
35 );