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
| 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 | |
| 13 | /** The testing profile's own service account, derived from the configured project. */ |
| 14 | export const testServiceAccount = currentProject.pipe( |
| 15 | Effect.map((project) => `alchemy-testing@${project}.iam.gserviceaccount.com`), |
| 16 | ); |
| 17 | |
| 18 | export const waitUntilGone = <E extends { readonly _tag: string }, R>( |
| 19 | get: Effect.Effect<unknown, E, R>, |
| 20 | ) => |
| 21 | get.pipe( |
| 22 | Effect.as("found" as const), |
| 23 | Effect.catchIf( |
| 24 | (error) => error._tag === "NotFound", |
| 25 | () => Effect.succeed("gone" as const), |
| 26 | ), |
| 27 | Effect.repeat({ |
| 28 | schedule: Schedule.spaced("1 second"), |
| 29 | until: (status) => status === "gone", |
| 30 | times: 10, |
| 31 | }), |
| 32 | ); |