The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { ProviderDriverKind, ServerProviderCompatibilityAdvisory } from "@t3tools/contracts"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | |
| 4 | /** Rates a detected provider version against the host's compatibility policy. */ |
| 5 | export type ProviderCompatibilityLookup = ( |
| 6 | driver: ProviderDriverKind, |
| 7 | version: string, |
| 8 | ) => Effect.Effect<ServerProviderCompatibilityAdvisory | undefined>; |
| 9 | |
| 10 | export const noCompatibilityPolicy: ProviderCompatibilityLookup = () => Effect.undefined; |
| 11 | |
| 12 | /** The one message for a version the policy rates `broken`; `action` names how it is updated. */ |
| 13 | export function brokenVersionDetail(input: { |
| 14 | readonly name: string; |
| 15 | readonly version: string; |
| 16 | readonly advisory: ServerProviderCompatibilityAdvisory | undefined; |
| 17 | readonly action?: string; |
| 18 | }): string | undefined { |
| 19 | if (input.advisory?.status !== "broken") return undefined; |
| 20 | const target = |
| 21 | input.advisory.recommendedVersion ?? input.advisory.recommendedRange ?? "a newer version"; |
| 22 | return `${input.name} ${input.version} does not work with this T3 Code release. ${input.action ?? `Update ${input.name}`} to ${target}, then retry.`; |
| 23 | } |