import{CodeBlock as a,InstallCommand as i}from"@contractspec/lib.design-system";import t from"@contractspec/lib.ui-link";import{ChevronRight as l}from"lucide-react";import{jsx as e,jsxs as o}from"react/jsx-runtime";function s(){return o("div",{className:"space-y-8",children:[o("div",{className:"space-y-4",children:[e("h1",{className:"font-bold text-4xl",children:"Workflow Composer"}),e("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.workflow-composer` injects tenant-/role-/device-specific steps into base WorkflowSpecs and keeps transitions valid."})]}),o("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),e(i,{package:"@contractspec/lib.workflow-composer"})]}),o("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Register extensions"}),e(a,{language:"typescript",code:`const composer = new WorkflowComposer();

composer.register({
  workflow: 'billing.invoiceApproval',
  tenantId: 'acme',
  customSteps: [
    {
      after: 'validate-invoice',
      inject: {
        id: 'acme-legal',
        type: 'human',
        label: 'ACME Legal Review',
      },
      transitionTo: 'final-approval',
    },
  ],
  hiddenSteps: ['internal-audit'],
});`})]}),o("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),e(a,{language:"typescript",code:`const tenantWorkflow = composer.compose({
  base: BaseInvoiceWorkflow,
  tenantId: 'acme',
});

workflowRunner.execute(tenantWorkflow, ctx);`})]}),o("div",{className:"flex items-center gap-4 pt-4",children:[e(t,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),o(t,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",e(l,{size:16})]})]})]})}export{s as LibrariesWorkflowComposerPage};
