@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, 06:00 UTC

main
ts 33 lines 1.15 KB
Raw
1 import { GcpEnvironment } from "@alchemy.run/gcp/Environment";
2 import * as Effect from "effect/Effect";
3 import { MinimumLogLevel } from "effect/References";
4 import * as Schedule from "effect/Schedule";
5
6 export const logLevel = Effect.provideService(
7 MinimumLogLevel,
8 process.env.DEBUG ? "Debug" : "Info",
9 );
10
11 // The Cloud Number Registry API is not enabled in the testing project. Set
12 // GCP_TEST_CLOUD_NUMBER_REGISTRY=1 on a project where it is.
13 export const entitled = !!process.env.GCP_TEST_CLOUD_NUMBER_REGISTRY;
14 export const runLifecycle = entitled && !process.env.FAST;
15
16 export const currentProject = GcpEnvironment.current.pipe(Effect.map((env) => env.project));
17 export const location = "global";
18
19 export const waitUntilGone = <E extends { readonly _tag: string }, R>(
20 get: Effect.Effect<unknown, E, R>,
21 ) =>
22 get.pipe(
23 Effect.as("found" as const),
24 Effect.catchIf(
25 (error): error is Extract<E, { readonly _tag: "NotFound" }> => error._tag === "NotFound",
26 () => Effect.succeed("gone" as const),
27 ),
28 Effect.repeat({
29 schedule: Schedule.spaced("2 seconds"),
30 until: (status) => status === "gone",
31 times: 10,
32 }),
33 );