namespace w4c_workflows.Services; /// Describes an executable language in the (extensible) runtime registry. public sealed record LanguageInfo(string Id, string DisplayName, string DefaultFunction, string Extension); /// /// The set of languages the engine can execute. This is the single source of /// truth for YAML validation and the GET /api/languages endpoint; the /// worker maps each to an executor in step 7. /// public class LanguageRegistry { private readonly IReadOnlyList _languages; public LanguageRegistry() { _languages = new[] { new LanguageInfo("shell", "Shell", "main", ".sh"), new LanguageInfo("javascript", "JavaScript", "handler", ".js"), new LanguageInfo("typescript", "TypeScript", "handler", ".ts"), new LanguageInfo("csharp", "C#", "Main", ".cs"), new LanguageInfo("python", "Python", "main", ".py"), new LanguageInfo("agent", "Agent", "run", ""), }; } public IReadOnlyList All => _languages; public bool IsKnown(string id) => _languages.Any(l => l.Id == id); public LanguageInfo? Get(string id) => _languages.FirstOrDefault(l => l.Id == id); }