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
| 1 | import * as Context from "effect/Context"; |
| 2 | import * as Duration from "effect/Duration"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as Layer from "effect/Layer"; |
| 5 | import { DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL } from "@t3tools/contracts"; |
| 6 | import { resolveServerBackgroundActivitySettings } from "@t3tools/shared/backgroundActivitySettings"; |
| 7 | |
| 8 | import * as ServerSettings from "../serverSettings.ts"; |
| 9 | |
| 10 | export class VcsAutomaticFetchInterval extends Context.Reference<Effect.Effect<Duration.Duration>>( |
| 11 | "t3/vcs/VcsAutomaticFetchInterval", |
| 12 | { defaultValue: () => Effect.succeed(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL) }, |
| 13 | ) {} |
| 14 | |
| 15 | export const layer = Layer.effect( |
| 16 | VcsAutomaticFetchInterval, |
| 17 | Effect.gen(function* () { |
| 18 | const serverSettings = yield* ServerSettings.ServerSettingsService; |
| 19 | return serverSettings.getSettings.pipe( |
| 20 | Effect.map( |
| 21 | (settings) => resolveServerBackgroundActivitySettings(settings).automaticGitFetchInterval, |
| 22 | ), |
| 23 | Effect.orElseSucceed(() => DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL), |
| 24 | ); |
| 25 | }), |
| 26 | ); |