import { createLogger } from "../../lib/logger/index.js";
const logger = createLogger("workflows");
const codeWorkflowRegistry = /* @__PURE__ */ new Map();
function registerCodeWorkflowEntries(workflows) {
  for (const wf of workflows) {
    if (codeWorkflowRegistry.has(wf.workflowId)) {
      const existing = codeWorkflowRegistry.get(wf.workflowId);
      if (existing !== wf && existing?.moduleId !== wf.moduleId) {
        logger.warn("Duplicate code workflow ID \u2014 overwriting", { workflowId: wf.workflowId, moduleId: wf.moduleId });
      }
    }
    codeWorkflowRegistry.set(wf.workflowId, wf);
  }
}
function getCodeWorkflow(workflowId) {
  return codeWorkflowRegistry.get(workflowId);
}
function getAllCodeWorkflows() {
  return Array.from(codeWorkflowRegistry.values());
}
function isCodeWorkflow(workflowId) {
  return codeWorkflowRegistry.has(workflowId);
}
function clearCodeWorkflowRegistry() {
  codeWorkflowRegistry.clear();
}
export {
  clearCodeWorkflowRegistry,
  getAllCodeWorkflows,
  getCodeWorkflow,
  isCodeWorkflow,
  registerCodeWorkflowEntries
};
//# sourceMappingURL=code-registry.js.map
