@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 31 lines 1.06 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 export const currentProject = GcpEnvironment.current.pipe(Effect.map((env) => env.project));
12 export const location = "us-central1";
13
14 export const waitUntilGone = <E extends { readonly _tag: string }, R>(
15 get: Effect.Effect<unknown, E, R>,
16 ) =>
17 get.pipe(
18 Effect.as("found" as const),
19 Effect.catchIf(
20 // BigLake answers a missing resource with 403, typed
21 // BigLakeResourceNotFound.
22 (error): error is Extract<E, { readonly _tag: "NotFound" | "BigLakeResourceNotFound" }> =>
23 error._tag === "NotFound" || error._tag === "BigLakeResourceNotFound",
24 () => Effect.succeed("gone" as const),
25 ),
26 Effect.repeat({
27 schedule: Schedule.spaced("1 second"),
28 until: (status) => status === "gone",
29 times: 10,
30 }),
31 );