import { ProviderDriverKind, ProviderInstanceId, type ProviderInstanceEnvironment, } from "@t3tools/contracts"; import * as Schema from "effect/Schema"; import type * as Effect from "effect/Effect"; import type * as Scope from "effect/Scope"; import type { ProviderAdapterV2Shape } from "./ProviderAdapter.ts"; export class ProviderAdapterDriverCreateError extends Schema.TaggedErrorClass()( "ProviderAdapterDriverCreateError", { driver: ProviderDriverKind, instanceId: ProviderInstanceId, detail: Schema.String, cause: Schema.optional(Schema.Defect()), }, ) { override get message(): string { return `Failed to create orchestration-v2 provider adapter ${this.instanceId} (${this.driver}): ${this.detail}`; } } export interface ProviderAdapterDriverCreateInput { readonly instanceId: ProviderInstanceId; readonly displayName: string | undefined; readonly accentColor?: string | undefined; readonly environment: ProviderInstanceEnvironment; readonly enabled: boolean; readonly config: Config; } export interface ProviderAdapterDriver { readonly driverKind: ProviderDriverKind; readonly configSchema: Schema.Codec; readonly defaultConfig: () => Config; readonly create: ( input: ProviderAdapterDriverCreateInput, ) => Effect.Effect; } export type AnyProviderAdapterDriver = ProviderAdapterDriver;