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 type { |
| 2 | ProviderUsageLimitsUpdate, |
| 3 | ServerProvider, |
| 4 | ServerSettingsError, |
| 5 | } from "@t3tools/contracts"; |
| 6 | import type * as Effect from "effect/Effect"; |
| 7 | import type * as Stream from "effect/Stream"; |
| 8 | import type { ProviderMaintenanceCapabilities } from "./maintenance.ts"; |
| 9 | |
| 10 | /** authLabel names the plan, for drivers whose usage report carries it. */ |
| 11 | export type ProviderUsageLimitsReport = ProviderUsageLimitsUpdate & { |
| 12 | readonly checkedAt: string; |
| 13 | readonly authLabel?: string; |
| 14 | /** A full reading replaces sparse windows and clears a previous probe failure. */ |
| 15 | readonly complete?: boolean; |
| 16 | }; |
| 17 | |
| 18 | export interface ManagedServerProvider { |
| 19 | /** Cached; pass { fresh: true } before executing updates. */ |
| 20 | readonly resolveMaintenance: (options?: { |
| 21 | readonly fresh?: boolean; |
| 22 | }) => Effect.Effect<ProviderMaintenanceCapabilities>; |
| 23 | readonly getSnapshot: Effect.Effect<ServerProvider>; |
| 24 | /** True while getSnapshot still returns the placeholder from before the first completed check. */ |
| 25 | readonly isAwaitingFirstCheck?: Effect.Effect<boolean>; |
| 26 | readonly refresh: Effect.Effect<ServerProvider>; |
| 27 | readonly refreshUsage?: Effect.Effect<void, ServerSettingsError>; |
| 28 | readonly streamChanges: Stream.Stream<ServerProvider>; |
| 29 | /** Merge windows by ID and set any authLabel; an update with no window leaves the snapshot untouched. */ |
| 30 | readonly applyUsageLimits: (update: ProviderUsageLimitsReport) => Effect.Effect<void>; |
| 31 | } |