/** Bind a resolved, static module set to a mechanism-specific executable catalog. */ export function resolveToolcraftModuleBindings( modules: readonly Readonly<{ id: Id; }>[], catalog: Readonly>, ): readonly Readonly<{ moduleId: Id; binding: Binding; }>[] { const seen = new Set(); return Object.freeze(modules.map(({ id }) => { if (seen.has(id)) throw new Error(`Duplicate module binding "${id}".`); if (!Object.hasOwn(catalog, id)) throw new Error(`Missing runtime binding for module "${id}".`); seen.add(id); return Object.freeze({ moduleId: id, binding: catalog[id] }); })); }