using System.Text.Json; namespace NucleicBroker; /// /// The `ai.generate` seam (docs/WINDOWS_PORT.md §9.2): Phi Silica via Windows AI Foundry is /// WinRT-only, so hostd routes on-device-AI requests through this broker rather than a /// second helper process. Capability-probed: on non-Copilot+ hardware (or off-Windows) the /// provider is unavailable and hostd's Intelligence seam falls back to its heuristics — /// identical UX to a Mac without Apple Intelligence. /// public interface IAiProvider { bool IsAvailable { get; } /// Generate text for `prompt`; when `schema` is present the result must be JSON /// conforming to it (guided generation). Throws WslcError(AiUnavailable) when absent. Task GenerateAsync(string prompt, JsonElement? schema, CancellationToken ct); } /// Default provider: no on-device model. The real Foundry-backed provider lands /// with work item 16 behind the same interface. public sealed class UnavailableAiProvider : IAiProvider { public bool IsAvailable => false; public Task GenerateAsync(string prompt, JsonElement? schema, CancellationToken ct) => throw new WslcError(WslcError.AiUnavailable, "no on-device AI provider on this machine"); }