@contractspec/bundle.library 3.9.2 → 3.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var nl=Object.defineProperty;var cl=(e)=>e;function ll(e,t){this[e]=cl.bind(null,t)}var sl=(e,t)=>{for(var o in t)nl(e,o,{get:t[o],enumerable:!0,configurable:!0,set:ll.bind(t,o)})};var dl=(e,t)=>()=>(e&&(t=e(e=0)),t);var xr="docs-index.manifest.json";var wi={};sl(wi,{listGeneratedDocs:()=>Ls,getGeneratedDocById:()=>Ds,getDocsIndexManifest:()=>Es});import{readFile as Ji}from"node:fs/promises";import*as So from"node:path";import{fileURLToPath as Ps}from"node:url";function As(e){if(!e)return"_common";if(e.includes("/")){let[t]=e.split("/");return t||"_common"}return"_common"}async function Zi(){if(!Qi)Qi=Ji(So.join(Ni,xr),"utf8").then((e)=>JSON.parse(e));return Qi}function Rs(e){let t=e.contentRoot??".";if(t==="../../../../../../../generated/docs")return Ts;return So.join(Ni,t)}async function en(e){let t=jr.get(e);if(t)return t;let o=Ji(So.join(Ni,e),"utf8").then((n)=>JSON.parse(n));return jr.set(e,o),o}async function Ls(){if(!Yi)Yi=(async()=>{let e=await Zi();return(await Promise.all(e.chunks.map((o)=>en(o.file)))).flat()})();return Yi}async function Es(){return Zi()}async function Ds(e){let t=await Zi(),o=As(e),n=t.chunks.find((ie)=>ie.key===o);if(!n)return null;let Ne=(await en(n.file)).find((ie)=>ie.id===e);if(!Ne||!Ne.contentPath)return null;let $e=So.join(Rs(t),Ne.contentPath);try{let ie=await Ji($e,"utf8");return{entry:Ne,content:ie}}catch{return null}}var Ni,Ts,Qi=null,Yi=null,jr;var ki=dl(()=>{Ni=So.dirname(Ps(import.meta.url)),Ts=So.join(Ni,"../../../../../../../generated/docs"),jr=new Map});var Gi=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],vi=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/libraries/cross-platform-ui",title:"Cross-platform UI",description:"Understand how the presentation runtimes, ui-kit-web, ui-kit, and design-system stay aligned across React and React Native.",section:"build",order:71,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/release-capsules",title:"Author release capsules",description:"Pair changesets with structured release capsules, generate release artifacts, and keep changelog plus docs surfaces aligned.",section:"operate",order:25,navTitle:"Release capsules",primaryNav:!0,audience:"operator",ctaMode:"reference"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function qf(e){return vi.find((t)=>t.href===e)}function pl(){return Gi.map((e)=>({...e,items:vi.filter((t)=>t.section===e.key&&t.primaryNav).sort((t,o)=>(t.order??0)-(o.order??0))}))}function ml(){return vi.filter((e)=>e.primaryNav).sort((e,t)=>Gi.findIndex((o)=>o.key===e.section)-Gi.findIndex((o)=>o.key===t.section)||(e.order??0)-(t.order??0))}function Vf(e){let t=ml(),o=t.findIndex((n)=>n.href===e);if(o<0)return{previous:null,next:null};return{previous:t[o-1]??null,next:t[o+1]??null}}function Or(){return vi.filter((e)=>e.audience==="secondary")}function Mr(){return pl().map((e)=>({...e,featured:e.items.slice(0,3)}))}import{CodeBlock as ul}from"@contractspec/lib.design-system";import No from"@contractspec/lib.ui-link";import{ArrowRight as Hi,Boxes as Br,FileSearch as gl,ShieldCheck as fl,Waypoints as hl}from"lucide-react";import{jsx as b,jsxs as ee}from"react/jsx-runtime";var yl=[{title:"One system, many surfaces",body:"Define explicit contracts once, then keep APIs, UI, data, events, and agent-facing surfaces aligned.",icon:Br},{title:"Incremental adoption",body:"Start with one endpoint, one workflow, or one unsafe module. You do not need a rewrite to begin.",icon:hl},{title:"Operator-grade controls",body:"Carry policy, auditability, migrations, tracing, and integration boundaries forward with the same system model.",icon:fl}],vl=[{title:"ContractSpec Connect",body:"Guard coding-agent edits and commands with local-first context, plan packets, patch verdicts, and review packets.",specHref:"/docs/specs/connect",guideHref:"/docs/guides/connect-in-a-repo"},{title:"Module bundles",body:"Define AI-native surfaces as typed bundle specs that resolve into auditable runtime plans.",specHref:"/docs/specs/module-bundles",guideHref:"/docs/guides/first-module-bundle"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review through governed contracts.",specHref:"/docs/specs/builder-control-plane",guideHref:"/docs/guides/host-builder-workbench"}];function bl(){let e=Mr(),t=Or().slice(0,6);return ee("div",{className:"space-y-12",children:[ee("section",{className:"space-y-6",children:[b("p",{className:"editorial-kicker",children:"OSS documentation"}),b("h1",{className:"editorial-title max-w-5xl",children:"Build AI-native systems on explicit contracts, then add Studio when you want the operating layer."}),b("p",{className:"editorial-subtitle",children:"These docs are optimized for OSS adopters first. Learn the contract model, generate and govern surfaces safely, wire integrations, and run the system in production without giving up ownership of your code."}),ee("div",{className:"flex flex-wrap gap-3",children:[ee(No,{href:"/docs/getting-started/start-here",className:"btn-primary text-sm",children:["Start with OSS ",b(Hi,{size:16})]}),b(No,{href:"/docs/studio",className:"btn-ghost text-sm",children:"See what Studio adds"})]})]}),b("section",{className:"grid gap-5 md:grid-cols-3",children:yl.map((o)=>{let n=o.icon;return ee("article",{className:"editorial-panel space-y-3",children:[ee("div",{className:"flex items-center gap-3",children:[b("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:b(n,{size:18})}),b("h2",{className:"font-semibold text-xl",children:o.title})]}),b("p",{className:"editorial-copy text-sm",children:o.body})]},o.title)})}),ee("section",{className:"space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Implemented packs"}),b("h2",{className:"editorial-panel-title",children:"Use the three higher-order systems that are already wired"}),b("p",{className:"editorial-copy text-sm",children:"These pages are the canonical landing points for agent enforcement, AI-native surface composition, and Builder authoring. Each one now has a matching practical guide."})]}),b("div",{className:"grid gap-4 lg:grid-cols-3",children:vl.map((o)=>ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{children:[b("h3",{className:"font-semibold text-xl",children:o.title}),b("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:o.body})]}),ee("div",{className:"flex flex-wrap gap-3",children:[ee(No,{href:o.specHref,className:"btn-primary text-sm",children:["Open spec page ",b(Hi,{size:16})]}),b(No,{href:o.guideHref,className:"btn-ghost text-sm",children:"Read practical guide"})]})]},o.title))})]}),ee("section",{className:"editorial-panel space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Quick start"}),b("h2",{className:"editorial-panel-title",children:"Start with one contract"}),b("p",{className:"editorial-copy text-sm",children:"Use the CLI and core libraries to define one explicit capability, generate the surface, and validate the contract boundary before you expand."})]}),b(ul,{language:"bash",filename:"docs-quick-start",code:`bun add -D contractspec
1
+ var nl=Object.defineProperty;var cl=(e)=>e;function ll(e,t){this[e]=cl.bind(null,t)}var sl=(e,t)=>{for(var o in t)nl(e,o,{get:t[o],enumerable:!0,configurable:!0,set:ll.bind(t,o)})};var dl=(e,t)=>()=>(e&&(t=e(e=0)),t);var xr="docs-index.manifest.json";var wi={};sl(wi,{listGeneratedDocs:()=>Ls,getGeneratedDocById:()=>Ds,getDocsIndexManifest:()=>Es});import{readFile as Ji}from"node:fs/promises";import*as So from"node:path";import{fileURLToPath as Ps}from"node:url";function As(e){if(!e)return"_common";if(e.includes("/")){let[t]=e.split("/");return t||"_common"}return"_common"}async function Zi(){if(!Qi)Qi=Ji(So.join(Ni,xr),"utf8").then((e)=>JSON.parse(e));return Qi}function Rs(e){let t=e.contentRoot??".";if(t==="../../../../../../../generated/docs")return Ts;return So.join(Ni,t)}async function en(e){let t=jr.get(e);if(t)return t;let o=Ji(So.join(Ni,e),"utf8").then((n)=>JSON.parse(n));return jr.set(e,o),o}async function Ls(){if(!Yi)Yi=(async()=>{let e=await Zi();return(await Promise.all(e.chunks.map((o)=>en(o.file)))).flat()})();return Yi}async function Es(){return Zi()}async function Ds(e){let t=await Zi(),o=As(e),n=t.chunks.find((ie)=>ie.key===o);if(!n)return null;let Ne=(await en(n.file)).find((ie)=>ie.id===e);if(!Ne||!Ne.contentPath)return null;let Xe=So.join(Rs(t),Ne.contentPath);try{let ie=await Ji(Xe,"utf8");return{entry:Ne,content:ie}}catch{return null}}var Ni,Ts,Qi=null,Yi=null,jr;var ki=dl(()=>{Ni=So.dirname(Ps(import.meta.url)),Ts=So.join(Ni,"../../../../../../../generated/docs"),jr=new Map});var Gi=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],vi=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/libraries/cross-platform-ui",title:"Cross-platform UI",description:"Understand how the presentation runtimes, ui-kit-web, ui-kit, and design-system stay aligned across React and React Native.",section:"build",order:71,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/release-capsules",title:"Author release capsules",description:"Pair changesets with structured release capsules, generate release artifacts, and keep changelog plus docs surfaces aligned.",section:"operate",order:25,navTitle:"Release capsules",primaryNav:!0,audience:"operator",ctaMode:"reference"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function qh(e){return vi.find((t)=>t.href===e)}function pl(){return Gi.map((e)=>({...e,items:vi.filter((t)=>t.section===e.key&&t.primaryNav).sort((t,o)=>(t.order??0)-(o.order??0))}))}function ml(){return vi.filter((e)=>e.primaryNav).sort((e,t)=>Gi.findIndex((o)=>o.key===e.section)-Gi.findIndex((o)=>o.key===t.section)||(e.order??0)-(t.order??0))}function Vh(e){let t=ml(),o=t.findIndex((n)=>n.href===e);if(o<0)return{previous:null,next:null};return{previous:t[o-1]??null,next:t[o+1]??null}}function Or(){return vi.filter((e)=>e.audience==="secondary")}function Mr(){return pl().map((e)=>({...e,featured:e.items.slice(0,3)}))}import{CodeBlock as ul}from"@contractspec/lib.design-system";import No from"@contractspec/lib.ui-link";import{ArrowRight as qi,Boxes as Br,FileSearch as gl,ShieldCheck as hl,Waypoints as fl}from"lucide-react";import{jsx as b,jsxs as ee}from"react/jsx-runtime";var yl=[{title:"One system, many surfaces",body:"Define explicit contracts once, then keep APIs, UI, data, events, and agent-facing surfaces aligned.",icon:Br},{title:"Incremental adoption",body:"Start with one endpoint, one workflow, or one unsafe module. You do not need a rewrite to begin.",icon:fl},{title:"Operator-grade controls",body:"Carry policy, auditability, migrations, tracing, and integration boundaries forward with the same system model.",icon:hl}],vl=[{title:"ContractSpec Connect",body:"Guard coding-agent edits and commands with local-first context, plan packets, patch verdicts, and review packets.",specHref:"/docs/specs/connect",guideHref:"/docs/guides/connect-in-a-repo"},{title:"Module bundles",body:"Define AI-native surfaces as typed bundle specs that resolve into auditable runtime plans.",specHref:"/docs/specs/module-bundles",guideHref:"/docs/guides/first-module-bundle"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review through governed contracts.",specHref:"/docs/specs/builder-control-plane",guideHref:"/docs/guides/host-builder-workbench"}];function bl(){let e=Mr(),t=Or().slice(0,6);return ee("div",{className:"space-y-12",children:[ee("section",{className:"space-y-6",children:[b("p",{className:"editorial-kicker",children:"OSS documentation"}),b("h1",{className:"editorial-title max-w-5xl",children:"Build AI-native systems on explicit contracts, then add Studio when you want the operating layer."}),b("p",{className:"editorial-subtitle",children:"These docs are optimized for OSS adopters first. Learn the contract model, generate and govern surfaces safely, wire integrations, and run the system in production without giving up ownership of your code."}),ee("div",{className:"flex flex-wrap gap-3",children:[ee(No,{href:"/docs/getting-started/start-here",className:"btn-primary text-sm",children:["Start with OSS ",b(qi,{size:16})]}),b(No,{href:"/docs/studio",className:"btn-ghost text-sm",children:"See what Studio adds"})]})]}),b("section",{className:"grid gap-5 md:grid-cols-3",children:yl.map((o)=>{let n=o.icon;return ee("article",{className:"editorial-panel space-y-3",children:[ee("div",{className:"flex items-center gap-3",children:[b("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:b(n,{size:18})}),b("h2",{className:"font-semibold text-xl",children:o.title})]}),b("p",{className:"editorial-copy text-sm",children:o.body})]},o.title)})}),ee("section",{className:"space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Implemented packs"}),b("h2",{className:"editorial-panel-title",children:"Use the three higher-order systems that are already wired"}),b("p",{className:"editorial-copy text-sm",children:"These pages are the canonical landing points for agent enforcement, AI-native surface composition, and Builder authoring. Each one now has a matching practical guide."})]}),b("div",{className:"grid gap-4 lg:grid-cols-3",children:vl.map((o)=>ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{children:[b("h3",{className:"font-semibold text-xl",children:o.title}),b("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:o.body})]}),ee("div",{className:"flex flex-wrap gap-3",children:[ee(No,{href:o.specHref,className:"btn-primary text-sm",children:["Open spec page ",b(qi,{size:16})]}),b(No,{href:o.guideHref,className:"btn-ghost text-sm",children:"Read practical guide"})]})]},o.title))})]}),ee("section",{className:"editorial-panel space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Quick start"}),b("h2",{className:"editorial-panel-title",children:"Start with one contract"}),b("p",{className:"editorial-copy text-sm",children:"Use the CLI and core libraries to define one explicit capability, generate the surface, and validate the contract boundary before you expand."})]}),b(ul,{language:"bash",filename:"docs-quick-start",code:`bun add -D contractspec
2
2
  bun add @contractspec/lib.contracts-spec @contractspec/lib.schema
3
3
 
4
4
  contractspec init
5
5
  contractspec create --type operation
6
6
  contractspec build src/contracts/mySpec.ts
7
- contractspec validate src/contracts/mySpec.ts`})]}),ee("section",{className:"space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Primary path"}),b("h2",{className:"editorial-panel-title",children:"Move through the system in the right order"}),b("p",{className:"editorial-copy text-sm",children:"Start with onboarding, then learn the model, then build and operate with confidence. The primary docs path is intentionally shorter than the full route inventory."})]}),b("div",{className:"grid gap-5 lg:grid-cols-2",children:e.map((o)=>ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{children:[b("p",{className:"editorial-kicker",children:o.title}),b("h3",{className:"mt-2 font-serif text-3xl tracking-[-0.03em]",children:o.title}),b("p",{className:"mt-3 text-muted-foreground text-sm leading-7",children:o.description})]}),b("div",{className:"space-y-3",children:o.featured.map((n)=>ee(No,{href:n.href,className:"flex items-start justify-between gap-4 rounded-[22px] border border-border/70 bg-background/70 p-4 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[ee("div",{children:[b("h4",{className:"font-semibold text-base",children:n.title}),b("p",{className:"mt-1 text-muted-foreground text-sm leading-6",children:n.description})]}),b(Hi,{className:"mt-1 shrink-0",size:16})]},n.href))})]},o.key))})]}),ee("section",{className:"grid gap-5 lg:grid-cols-[1.2fr_0.8fr]",children:[ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Reference and evidence"}),b("h2",{className:"editorial-panel-title",children:"Use generated docs and examples as proof, not just narrative copy"}),b("p",{className:"editorial-copy text-sm",children:"The reference index and example catalog stay close to the repo truth. Use them when you need exact public surfaces, not just the explanatory layer."})]}),ee("div",{className:"grid gap-4 md:grid-cols-2",children:[ee(No,{href:"/docs/reference",className:"docs-footer-link",children:[ee("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b(gl,{size:16}),b("span",{children:"Reference index"})]}),b("p",{className:"text-muted-foreground text-sm",children:"Search generated contract docs, versions, tags, and visibility metadata."})]}),ee(No,{href:"/docs/examples",className:"docs-footer-link",children:[ee("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b(Br,{size:16}),b("span",{children:"Examples"})]}),b("p",{className:"text-muted-foreground text-sm",children:"Browse runnable examples and follow the reference routes back to their source artifacts."})]})]})]}),ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Secondary reading"}),b("h2",{className:"editorial-panel-title",children:"Why ContractSpec"}),b("p",{className:"editorial-copy text-sm",children:"Positioning, comparisons, and philosophy remain available, but they no longer define the main docs path."})]}),b("div",{className:"flex flex-wrap gap-2",children:t.map((o)=>b(No,{href:o.href,className:"docs-chip-link",children:o.title},o.href))})]})]})]})}import ii from"@contractspec/lib.ui-link";import{ChevronRight as Nl}from"lucide-react";import{jsx as I,jsxs as at}from"react/jsx-runtime";function jf(){return at("div",{className:"space-y-8",children:[at("div",{className:"space-y-4",children:[I("h1",{className:"font-bold text-4xl",children:"MCP Adapters"}),at("p",{className:"text-muted-foreground",children:["The ",I("strong",{children:"Model Context Protocol (MCP)"})," is an open standard for connecting AI models to external tools and data sources. ContractSpec provides MCP adapters that allow you to expose your capabilities as MCP tools and consume external MCP servers as capabilities."]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Why MCP integration matters"}),I("p",{className:"text-muted-foreground",children:"AI agents need access to real-world tools and data to be useful. MCP provides a standardized way to expose these capabilities. By integrating ContractSpec with MCP, you can:"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Let AI agents invoke your ContractSpec capabilities safely and securely"}),I("li",{children:"Use external MCP servers (databases, APIs, search engines) as capability providers in your workflows"}),I("li",{children:"Build AI-powered features without writing custom integration code"}),I("li",{children:"Enforce policies on AI agent actions just like any other user"})]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Exposing capabilities as MCP tools"}),at("p",{className:"text-muted-foreground",children:["Any"," ",I(ii,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpec"})," ","can be automatically exposed as an MCP tool. ContractSpec generates:"]}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"A tool schema describing the capability's inputs, outputs, and purpose"}),I("li",{children:"An MCP server endpoint that AI agents can connect to"}),I("li",{children:"Policy enforcement ensuring agents can only invoke capabilities they're authorized to use"}),I("li",{children:"Audit logging of all agent actions for compliance and debugging"})]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Example: Exposing a capability"}),I("p",{className:"text-muted-foreground",children:"Here's how to expose ContractSpec operations as MCP tools:"}),I("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:I("pre",{children:`import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ contractspec validate src/contracts/mySpec.ts`})]}),ee("section",{className:"space-y-5",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Primary path"}),b("h2",{className:"editorial-panel-title",children:"Move through the system in the right order"}),b("p",{className:"editorial-copy text-sm",children:"Start with onboarding, then learn the model, then build and operate with confidence. The primary docs path is intentionally shorter than the full route inventory."})]}),b("div",{className:"grid gap-5 lg:grid-cols-2",children:e.map((o)=>ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{children:[b("p",{className:"editorial-kicker",children:o.title}),b("h3",{className:"mt-2 font-serif text-3xl tracking-[-0.03em]",children:o.title}),b("p",{className:"mt-3 text-muted-foreground text-sm leading-7",children:o.description})]}),b("div",{className:"space-y-3",children:o.featured.map((n)=>ee(No,{href:n.href,className:"flex items-start justify-between gap-4 rounded-[22px] border border-border/70 bg-background/70 p-4 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[ee("div",{children:[b("h4",{className:"font-semibold text-base",children:n.title}),b("p",{className:"mt-1 text-muted-foreground text-sm leading-6",children:n.description})]}),b(qi,{className:"mt-1 shrink-0",size:16})]},n.href))})]},o.key))})]}),ee("section",{className:"grid gap-5 lg:grid-cols-[1.2fr_0.8fr]",children:[ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Reference and evidence"}),b("h2",{className:"editorial-panel-title",children:"Use generated docs and examples as proof, not just narrative copy"}),b("p",{className:"editorial-copy text-sm",children:"The reference index and example catalog stay close to the repo truth. Use them when you need exact public surfaces, not just the explanatory layer."})]}),ee("div",{className:"grid gap-4 md:grid-cols-2",children:[ee(No,{href:"/docs/reference",className:"docs-footer-link",children:[ee("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b(gl,{size:16}),b("span",{children:"Reference index"})]}),b("p",{className:"text-muted-foreground text-sm",children:"Search generated contract docs, versions, tags, and visibility metadata."})]}),ee(No,{href:"/docs/examples",className:"docs-footer-link",children:[ee("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b(Br,{size:16}),b("span",{children:"Examples"})]}),b("p",{className:"text-muted-foreground text-sm",children:"Browse runnable examples and follow the reference routes back to their source artifacts."})]})]})]}),ee("article",{className:"editorial-panel space-y-4",children:[ee("div",{className:"space-y-2",children:[b("p",{className:"editorial-kicker",children:"Secondary reading"}),b("h2",{className:"editorial-panel-title",children:"Why ContractSpec"}),b("p",{className:"editorial-copy text-sm",children:"Positioning, comparisons, and philosophy remain available, but they no longer define the main docs path."})]}),b("div",{className:"flex flex-wrap gap-2",children:t.map((o)=>b(No,{href:o.href,className:"docs-chip-link",children:o.title},o.href))})]})]})]})}import ii from"@contractspec/lib.ui-link";import{ChevronRight as Nl}from"lucide-react";import{jsx as I,jsxs as at}from"react/jsx-runtime";function xh(){return at("div",{className:"space-y-8",children:[at("div",{className:"space-y-4",children:[I("h1",{className:"font-bold text-4xl",children:"MCP Adapters"}),at("p",{className:"text-muted-foreground",children:["The ",I("strong",{children:"Model Context Protocol (MCP)"})," is an open standard for connecting AI models to external tools and data sources. ContractSpec provides MCP adapters that allow you to expose your capabilities as MCP tools and consume external MCP servers as capabilities."]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Why MCP integration matters"}),I("p",{className:"text-muted-foreground",children:"AI agents need access to real-world tools and data to be useful. MCP provides a standardized way to expose these capabilities. By integrating ContractSpec with MCP, you can:"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Let AI agents invoke your ContractSpec capabilities safely and securely"}),I("li",{children:"Use external MCP servers (databases, APIs, search engines) as capability providers in your workflows"}),I("li",{children:"Build AI-powered features without writing custom integration code"}),I("li",{children:"Enforce policies on AI agent actions just like any other user"})]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Exposing capabilities as MCP tools"}),at("p",{className:"text-muted-foreground",children:["Any"," ",I(ii,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpec"})," ","can be automatically exposed as an MCP tool. ContractSpec generates:"]}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"A tool schema describing the capability's inputs, outputs, and purpose"}),I("li",{children:"An MCP server endpoint that AI agents can connect to"}),I("li",{children:"Policy enforcement ensuring agents can only invoke capabilities they're authorized to use"}),I("li",{children:"Audit logging of all agent actions for compliance and debugging"})]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Example: Exposing a capability"}),I("p",{className:"text-muted-foreground",children:"Here's how to expose ContractSpec operations as MCP tools:"}),I("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:I("pre",{children:`import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
8
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
9
  import { createMcpServer } from '@contractspec/lib.contracts-runtime-server-mcp/provider-mcp';
10
10
  import { registry, resources, prompts } from './lib/registry';
@@ -73,7 +73,7 @@ export const AIAgentRestrictions = definePolicy({
73
73
  !ctx.approvalGranted,
74
74
  },
75
75
  ],
76
- });`})})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Human-in-the-loop workflows"}),I("p",{className:"text-muted-foreground",children:"For sensitive operations, you can require human approval before an AI agent can proceed. ContractSpec provides built-in approval workflows:"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Agent requests permission to invoke a capability"}),I("li",{children:"Request is sent to designated approvers (via email, Slack, etc.)"}),I("li",{children:"Approver reviews the request and approves or denies it"}),I("li",{children:"Agent receives the decision and can proceed if approved"})]}),at("p",{className:"text-muted-foreground",children:["All approval decisions are logged in the"," ",I(ii,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit log"}),"."]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Best practices"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Start with read-only capabilities for AI agents—only grant write access when necessary."}),I("li",{children:"Use human-in-the-loop approval for any capability that modifies critical data or triggers financial transactions."}),I("li",{children:"Set rate limits to prevent runaway agents from overwhelming your system."}),I("li",{children:"Provide clear, detailed descriptions for each capability so agents know when to use them."}),I("li",{children:"Monitor agent actions closely in production and adjust policies as needed."}),I("li",{children:"Test agent integrations thoroughly with realistic scenarios before deploying."})]})]}),at("div",{className:"flex items-center gap-4 pt-4",children:[I(ii,{href:"/docs/advanced/renderers",className:"btn-ghost",children:"Previous: Custom Renderers"}),at(ii,{href:"/docs/advanced/telemetry",className:"btn-primary",children:["Next: Telemetry ",I(Nl,{size:16})]})]})]})}import wl from"@contractspec/lib.ui-link";import{jsx as Vt,jsxs as no}from"react/jsx-runtime";function oh(){return no("div",{className:"space-y-8",children:[no("div",{className:"space-y-4",children:[Vt("h1",{className:"font-bold text-4xl",children:"Overlay Editor"}),Vt("p",{className:"text-lg text-muted-foreground",children:"A Next.js app (`@contractspec/app.overlay-editor`) that lets tenant admins tweak field visibility, labels, and ordering, then sign OverlaySpecs."})]}),no("div",{className:"space-y-4",children:[Vt("h2",{className:"font-bold text-2xl",children:"Features"}),no("ul",{className:"list-disc space-y-2 pl-6",children:[Vt("li",{children:"Toggle visibility and rename labels without touching code."}),Vt("li",{children:"Move fields up/down to define the overlay order."}),Vt("li",{children:"Preview JSON output powered by `@contractspec/lib.overlay-engine`."}),Vt("li",{children:"Server action for PEM signing (Ed25519/RSA-PSS)."})]}),no("p",{children:["Project path: ",Vt("code",{children:"packages/apps/overlay-editor"})]})]}),no("div",{className:"space-y-4",children:[Vt("h2",{className:"font-bold text-2xl",children:"Provisioning flow"}),no("ol",{className:"list-decimal space-y-2 pl-6",children:[no("li",{children:["Clone the repo and run ",Vt("code",{children:"bun dev"})," inside the app."]}),Vt("li",{children:"Use the UI to craft the overlay for a tenant."}),Vt("li",{children:"Paste the tenant's PEM private key (stored in Vault/KMS)."}),Vt("li",{children:"Click “Sign overlay” to get the final JSON payload."}),Vt("li",{children:"Persist in the `Overlay` table and register with `OverlayRegistry`."})]}),no("p",{children:["See also:"," ",Vt(wl,{href:"/docs/ops/tenant-customization",className:"text-violet-400 underline",children:"Tenant customization runbook"}),"."]})]})]})}import kl from"@contractspec/lib.ui-link";import{ChevronRight as Sl}from"lucide-react";import{jsx as Ft,jsxs as Ya}from"react/jsx-runtime";function lh(){return Ya("div",{className:"space-y-8",children:[Ya("div",{className:"space-y-2",children:[Ft("h1",{className:"font-bold text-4xl",children:"Custom Renderers"}),Ft("p",{className:"text-lg text-muted-foreground",children:"ContractSpec ships with React and React Native renderers. You can build custom renderers for any framework."})]}),Ya("div",{className:"space-y-6",children:[Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Overview"}),Ya("p",{className:"text-muted-foreground",children:["The presentation runtime libraries (",Ft("code",{children:"@contractspec/lib.presentation-runtime-react"})," and",Ft("code",{children:"@contractspec/lib.presentation-runtime-react-native"}),") provide hooks and components to render ContractSpec-defined UI like workflows and data views. You can extend these or create custom implementations for other frameworks."]})]}),Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Using the React Renderer"}),Ft("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ft("pre",{children:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
76
+ });`})})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Human-in-the-loop workflows"}),I("p",{className:"text-muted-foreground",children:"For sensitive operations, you can require human approval before an AI agent can proceed. ContractSpec provides built-in approval workflows:"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Agent requests permission to invoke a capability"}),I("li",{children:"Request is sent to designated approvers (via email, Slack, etc.)"}),I("li",{children:"Approver reviews the request and approves or denies it"}),I("li",{children:"Agent receives the decision and can proceed if approved"})]}),at("p",{className:"text-muted-foreground",children:["All approval decisions are logged in the"," ",I(ii,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit log"}),"."]})]}),at("div",{className:"space-y-4",children:[I("h2",{className:"font-bold text-2xl",children:"Best practices"}),at("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[I("li",{children:"Start with read-only capabilities for AI agents—only grant write access when necessary."}),I("li",{children:"Use human-in-the-loop approval for any capability that modifies critical data or triggers financial transactions."}),I("li",{children:"Set rate limits to prevent runaway agents from overwhelming your system."}),I("li",{children:"Provide clear, detailed descriptions for each capability so agents know when to use them."}),I("li",{children:"Monitor agent actions closely in production and adjust policies as needed."}),I("li",{children:"Test agent integrations thoroughly with realistic scenarios before deploying."})]})]}),at("div",{className:"flex items-center gap-4 pt-4",children:[I(ii,{href:"/docs/advanced/renderers",className:"btn-ghost",children:"Previous: Custom Renderers"}),at(ii,{href:"/docs/advanced/telemetry",className:"btn-primary",children:["Next: Telemetry ",I(Nl,{size:16})]})]})]})}import wl from"@contractspec/lib.ui-link";import{jsx as Ht,jsxs as no}from"react/jsx-runtime";function af(){return no("div",{className:"space-y-8",children:[no("div",{className:"space-y-4",children:[Ht("h1",{className:"font-bold text-4xl",children:"Overlay Editor"}),Ht("p",{className:"text-lg text-muted-foreground",children:"A Next.js app (`@contractspec/app.overlay-editor`) that lets tenant admins tweak field visibility, labels, and ordering, then sign OverlaySpecs."})]}),no("div",{className:"space-y-4",children:[Ht("h2",{className:"font-bold text-2xl",children:"Features"}),no("ul",{className:"list-disc space-y-2 pl-6",children:[Ht("li",{children:"Toggle visibility and rename labels without touching code."}),Ht("li",{children:"Move fields up/down to define the overlay order."}),Ht("li",{children:"Preview JSON output powered by `@contractspec/lib.overlay-engine`."}),Ht("li",{children:"Server action for PEM signing (Ed25519/RSA-PSS)."})]}),no("p",{children:["Project path: ",Ht("code",{children:"packages/apps/overlay-editor"})]})]}),no("div",{className:"space-y-4",children:[Ht("h2",{className:"font-bold text-2xl",children:"Provisioning flow"}),no("ol",{className:"list-decimal space-y-2 pl-6",children:[no("li",{children:["Clone the repo and run ",Ht("code",{children:"bun dev"})," inside the app."]}),Ht("li",{children:"Use the UI to craft the overlay for a tenant."}),Ht("li",{children:"Paste the tenant's PEM private key (stored in Vault/KMS)."}),Ht("li",{children:"Click “Sign overlay” to get the final JSON payload."}),Ht("li",{children:"Persist in the `Overlay` table and register with `OverlayRegistry`."})]}),no("p",{children:["See also:"," ",Ht(wl,{href:"/docs/ops/tenant-customization",className:"text-violet-400 underline",children:"Tenant customization runbook"}),"."]})]})]})}import kl from"@contractspec/lib.ui-link";import{ChevronRight as Sl}from"lucide-react";import{jsx as Ft,jsxs as Ya}from"react/jsx-runtime";function lf(){return Ya("div",{className:"space-y-8",children:[Ya("div",{className:"space-y-2",children:[Ft("h1",{className:"font-bold text-4xl",children:"Custom Renderers"}),Ft("p",{className:"text-lg text-muted-foreground",children:"ContractSpec ships with React and React Native renderers. You can build custom renderers for any framework."})]}),Ya("div",{className:"space-y-6",children:[Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Overview"}),Ya("p",{className:"text-muted-foreground",children:["The presentation runtime libraries (",Ft("code",{children:"@contractspec/lib.presentation-runtime-react"})," and",Ft("code",{children:"@contractspec/lib.presentation-runtime-react-native"}),") provide hooks and components to render ContractSpec-defined UI like workflows and data views. You can extend these or create custom implementations for other frameworks."]})]}),Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Using the React Renderer"}),Ft("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ft("pre",{children:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
77
77
  import { MyWorkflowSpec } from './specs';
78
78
 
79
79
  export function WorkflowPage() {
@@ -88,7 +88,7 @@ export function WorkflowPage() {
88
88
  </button>
89
89
  </div>
90
90
  );
91
- }`})})]}),Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Custom Platform Support"}),Ft("p",{className:"text-muted-foreground",children:"To support a new platform (e.g., Vue, Svelte), you would:"}),Ya("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[Ya("li",{children:["Implement the core workflow state machine (from"," ",Ft("code",{children:"@contractspec/lib.presentation-runtime-core"}),")"]}),Ft("li",{children:"Create framework-specific hooks/components for step rendering"}),Ft("li",{children:"Handle validation and submission via the ContractSpec I/O schemas"})]})]}),Ft("div",{className:"flex items-center gap-4 pt-4",children:Ya(kl,{href:"/docs",className:"btn-primary",children:["Back to docs ",Ft(Sl,{size:16})]})})]})]})}import{jsx as _a,jsxs as Yo}from"react/jsx-runtime";function ph(){return Yo("div",{className:"space-y-8",children:[Yo("div",{className:"space-y-4",children:[_a("h1",{className:"font-bold text-4xl",children:"Spec Experiments"}),_a("p",{className:"text-lg text-muted-foreground",children:"Run controlled experiments on ContractSpec operations, gradually shift traffic, and roll back automatically when guardrails trip."})]}),Yo("div",{className:"space-y-3",children:[_a("h2",{className:"font-bold text-2xl",children:"Define control + variants"}),_a("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SpecExperimentRegistry } from '@contractspec/lib.growth/spec-experiments';
91
+ }`})})]}),Ya("div",{className:"space-y-3",children:[Ft("h2",{className:"font-bold text-2xl",children:"Custom Platform Support"}),Ft("p",{className:"text-muted-foreground",children:"To support a new platform (e.g., Vue, Svelte), you would:"}),Ya("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[Ya("li",{children:["Implement the core workflow state machine (from"," ",Ft("code",{children:"@contractspec/lib.presentation-runtime-core"}),")"]}),Ft("li",{children:"Create framework-specific hooks/components for step rendering"}),Ft("li",{children:"Handle validation and submission via the ContractSpec I/O schemas"})]})]}),Ft("div",{className:"flex items-center gap-4 pt-4",children:Ya(kl,{href:"/docs",className:"btn-primary",children:["Back to docs ",Ft(Sl,{size:16})]})})]})]})}import{jsx as _a,jsxs as Yo}from"react/jsx-runtime";function pf(){return Yo("div",{className:"space-y-8",children:[Yo("div",{className:"space-y-4",children:[_a("h1",{className:"font-bold text-4xl",children:"Spec Experiments"}),_a("p",{className:"text-lg text-muted-foreground",children:"Run controlled experiments on ContractSpec operations, gradually shift traffic, and roll back automatically when guardrails trip."})]}),Yo("div",{className:"space-y-3",children:[_a("h2",{className:"font-bold text-2xl",children:"Define control + variants"}),_a("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SpecExperimentRegistry } from '@contractspec/lib.growth/spec-experiments';
92
92
 
93
93
  const registry = new SpecExperimentRegistry().register({
94
94
  target: { name: 'billing.createInvoice', version: 4 },
@@ -123,7 +123,7 @@ const controller = new SpecExperimentController({
123
123
  registry,
124
124
  analyzer,
125
125
  onRollback: (target, evaluation) => notifyOps(target, evaluation.reasons),
126
- });`})]}),_a("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Deterministic bucketing",description:"ExperimentRunner reuses the same hashing logic as growth experiments—every user sticks to a variant."},{title:"Multi-stage rollouts",description:"Use `rolloutStages` to shift 1% → 10% → 50% → 100%. Guardrails trigger rollbacks automatically."}].map((e)=>Yo("div",{className:"card-subtle space-y-2 p-4",children:[_a("h3",{className:"font-semibold text-lg",children:e.title}),_a("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))})]})}import Ur from"@contractspec/lib.ui-link";import{ChevronRight as Cl}from"lucide-react";import{jsx as v,jsxs as M}from"react/jsx-runtime";function hh(){return M("div",{className:"space-y-8",children:[M("div",{className:"space-y-4",children:[v("h1",{className:"font-bold text-4xl",children:"Telemetry"}),M("p",{className:"text-muted-foreground",children:["A ",v("strong",{children:"TelemetrySpec"})," defines what metrics, logs, and traces to collect for observability. ContractSpec automatically instruments your application based on these specs, ensuring you have the visibility you need to monitor, debug, and optimize your system."]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Why telemetry matters"}),v("p",{className:"text-muted-foreground",children:"You can't fix what you can't see. Telemetry provides visibility into how your application is performing, where errors are occurring, and how users are interacting with your system. Without proper instrumentation, you're flying blind in production."}),v("p",{className:"text-muted-foreground",children:"ContractSpec takes a spec-first approach to telemetry: you declare what you want to observe, and runtime adapters instrument operations automatically. This ensures consistent, comprehensive coverage without manual effort."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Three pillars of observability"}),M("div",{className:"space-y-3",children:[M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Metrics"}),v("p",{className:"text-muted-foreground",children:"Numerical measurements collected over time. Examples: request count, error rate, latency percentiles, active users, queue depth. Metrics are cheap to collect and store, making them ideal for high-level monitoring and alerting."})]}),M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Logs"}),v("p",{className:"text-muted-foreground",children:'Timestamped text records of events. Examples: "User 123 logged in", "Payment failed for order 456", "Database connection pool exhausted". Logs provide detailed context for debugging specific issues.'})]}),M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Traces"}),v("p",{className:"text-muted-foreground",children:"Records of requests as they flow through your system. A trace shows the complete path of a request—which services it touched, how long each step took, and where errors occurred. Traces are essential for debugging distributed systems."})]})]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Example TelemetrySpec"}),v("p",{className:"text-muted-foreground",children:"Here's how telemetry is configured in TypeScript:"}),v("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:v("pre",{children:`import { defineTelemetry } from '@contractspec/lib.contracts-spec/telemetry';
126
+ });`})]}),_a("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Deterministic bucketing",description:"ExperimentRunner reuses the same hashing logic as growth experiments—every user sticks to a variant."},{title:"Multi-stage rollouts",description:"Use `rolloutStages` to shift 1% → 10% → 50% → 100%. Guardrails trigger rollbacks automatically."}].map((e)=>Yo("div",{className:"card-subtle space-y-2 p-4",children:[_a("h3",{className:"font-semibold text-lg",children:e.title}),_a("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))})]})}import Ur from"@contractspec/lib.ui-link";import{ChevronRight as Cl}from"lucide-react";import{jsx as v,jsxs as M}from"react/jsx-runtime";function ff(){return M("div",{className:"space-y-8",children:[M("div",{className:"space-y-4",children:[v("h1",{className:"font-bold text-4xl",children:"Telemetry"}),M("p",{className:"text-muted-foreground",children:["A ",v("strong",{children:"TelemetrySpec"})," defines what metrics, logs, and traces to collect for observability. ContractSpec automatically instruments your application based on these specs, ensuring you have the visibility you need to monitor, debug, and optimize your system."]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Why telemetry matters"}),v("p",{className:"text-muted-foreground",children:"You can't fix what you can't see. Telemetry provides visibility into how your application is performing, where errors are occurring, and how users are interacting with your system. Without proper instrumentation, you're flying blind in production."}),v("p",{className:"text-muted-foreground",children:"ContractSpec takes a spec-first approach to telemetry: you declare what you want to observe, and runtime adapters instrument operations automatically. This ensures consistent, comprehensive coverage without manual effort."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Three pillars of observability"}),M("div",{className:"space-y-3",children:[M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Metrics"}),v("p",{className:"text-muted-foreground",children:"Numerical measurements collected over time. Examples: request count, error rate, latency percentiles, active users, queue depth. Metrics are cheap to collect and store, making them ideal for high-level monitoring and alerting."})]}),M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Logs"}),v("p",{className:"text-muted-foreground",children:'Timestamped text records of events. Examples: "User 123 logged in", "Payment failed for order 456", "Database connection pool exhausted". Logs provide detailed context for debugging specific issues.'})]}),M("div",{children:[v("h3",{className:"font-semibold text-lg",children:"Traces"}),v("p",{className:"text-muted-foreground",children:"Records of requests as they flow through your system. A trace shows the complete path of a request—which services it touched, how long each step took, and where errors occurred. Traces are essential for debugging distributed systems."})]})]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Example TelemetrySpec"}),v("p",{className:"text-muted-foreground",children:"Here's how telemetry is configured in TypeScript:"}),v("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:v("pre",{children:`import { defineTelemetry } from '@contractspec/lib.contracts-spec/telemetry';
127
127
 
128
128
  export const OrderProcessingTelemetry = defineTelemetry({
129
129
  meta: {
@@ -168,7 +168,7 @@ export const OrderProcessingTelemetry = defineTelemetry({
168
168
  notify: ['pagerduty', 'slack'],
169
169
  },
170
170
  ],
171
- });`})})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Automatic instrumentation"}),v("p",{className:"text-muted-foreground",children:"ContractSpec automatically instruments:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"All operations"})," – Request count, latency, error rate per Command/Query"]}),M("li",{children:[v("strong",{children:"All workflows"})," – Step execution time, retry counts, compensation events"]}),M("li",{children:[v("strong",{children:"All data views"})," – Query execution time, result set size"]}),M("li",{children:[v("strong",{children:"All policy decisions"})," – Decision time, permit/deny ratio"]}),M("li",{children:[v("strong",{children:"System resources"})," – CPU, memory, disk, network usage"]})]}),v("p",{className:"text-muted-foreground",children:"You don't need to add instrumentation code manually—the runtime handles it based on your specs."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Integration with observability platforms"}),v("p",{className:"text-muted-foreground",children:"ContractSpec supports multiple observability backends:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"Prometheus"})," – For metrics collection and alerting"]}),M("li",{children:[v("strong",{children:"Grafana"})," – For dashboards and visualization"]}),M("li",{children:[v("strong",{children:"Jaeger / Tempo"})," – For distributed tracing"]}),M("li",{children:[v("strong",{children:"Loki"})," – For log aggregation"]}),M("li",{children:[v("strong",{children:"Datadog"})," – All-in-one observability platform"]}),M("li",{children:[v("strong",{children:"New Relic"})," – Application performance monitoring"]}),M("li",{children:[v("strong",{children:"Honeycomb"})," – Observability for complex systems"]})]}),v("p",{className:"text-muted-foreground",children:"You can configure multiple backends and send telemetry to all of them simultaneously."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Sampling and performance"}),v("p",{className:"text-muted-foreground",children:"Collecting telemetry has a cost—CPU, memory, network bandwidth, and storage. ContractSpec provides several mechanisms to control overhead:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"Sampling"})," – Trace only a percentage of requests (e.g., 10%)"]}),M("li",{children:[v("strong",{children:"Adaptive sampling"})," – Automatically reduce sampling rate under high load"]}),M("li",{children:[v("strong",{children:"Tail-based sampling"})," – Keep traces for failed requests, sample successful ones"]}),M("li",{children:[v("strong",{children:"Field redaction"})," – Remove sensitive data from traces and logs"]}),M("li",{children:[v("strong",{children:"Aggregation"})," – Pre-aggregate metrics before sending to reduce network traffic"]})]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Best practices"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[v("li",{children:"Start with high-level metrics (request rate, error rate, latency) and add more detailed instrumentation as needed."}),v("li",{children:"Use structured logging—log events with structured fields, not free-form text."}),v("li",{children:"Set up alerts for critical metrics so you're notified when things go wrong."}),v("li",{children:"Use traces to debug complex issues—they show the complete picture of a request."}),v("li",{children:"Redact sensitive data from logs and traces to comply with privacy regulations."}),v("li",{children:"Review dashboards regularly to understand normal behavior—this makes anomalies easier to spot."}),v("li",{children:"Use sampling to control costs, but always trace errors and slow requests."})]})]}),M("div",{className:"flex items-center gap-4 pt-4",children:[v(Ur,{href:"/docs/advanced/mcp",className:"btn-ghost",children:"Previous: MCP Adapters"}),M(Ur,{href:"/docs/comparison",className:"btn-primary",children:["Next: Comparison ",v(Cl,{size:16})]})]})]})}import{jsx as ca,jsxs as wo}from"react/jsx-runtime";function bh(){return wo("div",{className:"space-y-8",children:[wo("div",{className:"space-y-4",children:[ca("h1",{className:"font-bold text-4xl",children:"Workflow Monitoring"}),ca("p",{className:"text-lg text-muted-foreground",children:"Production workflows need robust observability. ContractSpec provides SLA monitoring, distributed tracing, and audit logging out of the box."})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"SLA Monitoring"}),wo("p",{children:["Use the ",ca("code",{children:"SLAMonitor"})," to detect when workflows or individual steps exceed their budgeted duration."]}),ca("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SLAMonitor } from '@contractspec/lib.contracts-spec/workflow/sla-monitor';
171
+ });`})})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Automatic instrumentation"}),v("p",{className:"text-muted-foreground",children:"ContractSpec automatically instruments:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"All operations"})," – Request count, latency, error rate per Command/Query"]}),M("li",{children:[v("strong",{children:"All workflows"})," – Step execution time, retry counts, compensation events"]}),M("li",{children:[v("strong",{children:"All data views"})," – Query execution time, result set size"]}),M("li",{children:[v("strong",{children:"All policy decisions"})," – Decision time, permit/deny ratio"]}),M("li",{children:[v("strong",{children:"System resources"})," – CPU, memory, disk, network usage"]})]}),v("p",{className:"text-muted-foreground",children:"You don't need to add instrumentation code manually—the runtime handles it based on your specs."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Integration with observability platforms"}),v("p",{className:"text-muted-foreground",children:"ContractSpec supports multiple observability backends:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"Prometheus"})," – For metrics collection and alerting"]}),M("li",{children:[v("strong",{children:"Grafana"})," – For dashboards and visualization"]}),M("li",{children:[v("strong",{children:"Jaeger / Tempo"})," – For distributed tracing"]}),M("li",{children:[v("strong",{children:"Loki"})," – For log aggregation"]}),M("li",{children:[v("strong",{children:"Datadog"})," – All-in-one observability platform"]}),M("li",{children:[v("strong",{children:"New Relic"})," – Application performance monitoring"]}),M("li",{children:[v("strong",{children:"Honeycomb"})," – Observability for complex systems"]})]}),v("p",{className:"text-muted-foreground",children:"You can configure multiple backends and send telemetry to all of them simultaneously."})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Sampling and performance"}),v("p",{className:"text-muted-foreground",children:"Collecting telemetry has a cost—CPU, memory, network bandwidth, and storage. ContractSpec provides several mechanisms to control overhead:"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[M("li",{children:[v("strong",{children:"Sampling"})," – Trace only a percentage of requests (e.g., 10%)"]}),M("li",{children:[v("strong",{children:"Adaptive sampling"})," – Automatically reduce sampling rate under high load"]}),M("li",{children:[v("strong",{children:"Tail-based sampling"})," – Keep traces for failed requests, sample successful ones"]}),M("li",{children:[v("strong",{children:"Field redaction"})," – Remove sensitive data from traces and logs"]}),M("li",{children:[v("strong",{children:"Aggregation"})," – Pre-aggregate metrics before sending to reduce network traffic"]})]})]}),M("div",{className:"space-y-4",children:[v("h2",{className:"font-bold text-2xl",children:"Best practices"}),M("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[v("li",{children:"Start with high-level metrics (request rate, error rate, latency) and add more detailed instrumentation as needed."}),v("li",{children:"Use structured logging—log events with structured fields, not free-form text."}),v("li",{children:"Set up alerts for critical metrics so you're notified when things go wrong."}),v("li",{children:"Use traces to debug complex issues—they show the complete picture of a request."}),v("li",{children:"Redact sensitive data from logs and traces to comply with privacy regulations."}),v("li",{children:"Review dashboards regularly to understand normal behavior—this makes anomalies easier to spot."}),v("li",{children:"Use sampling to control costs, but always trace errors and slow requests."})]})]}),M("div",{className:"flex items-center gap-4 pt-4",children:[v(Ur,{href:"/docs/advanced/mcp",className:"btn-ghost",children:"Previous: MCP Adapters"}),M(Ur,{href:"/docs/comparison",className:"btn-primary",children:["Next: Comparison ",v(Cl,{size:16})]})]})]})}import{jsx as ca,jsxs as wo}from"react/jsx-runtime";function bf(){return wo("div",{className:"space-y-8",children:[wo("div",{className:"space-y-4",children:[ca("h1",{className:"font-bold text-4xl",children:"Workflow Monitoring"}),ca("p",{className:"text-lg text-muted-foreground",children:"Production workflows need robust observability. ContractSpec provides SLA monitoring, distributed tracing, and audit logging out of the box."})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"SLA Monitoring"}),wo("p",{children:["Use the ",ca("code",{children:"SLAMonitor"})," to detect when workflows or individual steps exceed their budgeted duration."]}),ca("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SLAMonitor } from '@contractspec/lib.contracts-spec/workflow/sla-monitor';
172
172
 
173
173
  const monitor = new SLAMonitor((event, payload) => {
174
174
  if (event === 'workflow.sla_breach') {
@@ -178,7 +178,7 @@ const monitor = new SLAMonitor((event, payload) => {
178
178
  });
179
179
 
180
180
  // Check periodically
181
- monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"Telemetry & Tracing"}),ca("p",{children:"Workflows automatically generate OpenTelemetry spans for:"}),wo("ul",{className:"list-disc space-y-2 pl-6",children:[ca("li",{children:"Overall workflow execution"}),ca("li",{children:"Individual steps"}),ca("li",{children:"Retries and compensation"})]}),ca("p",{children:"Configure your OpenTelemetry exporter to send traces to Jaeger, Datadog, or Honeycomb."})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"Dashboarding"}),wo("p",{children:["You can build a custom dashboard using ",ca("code",{children:"DataViews"})," over your workflow state database. See the DataViews tutorial for how to visualize ",ca("code",{children:"WorkflowState"})," records."]})]})]})}import{CodeBlock as ri}from"@contractspec/lib.design-system";import Wr from"@contractspec/lib.ui-link";import{ChevronRight as Il}from"lucide-react";import{jsx as J,jsxs as qe}from"react/jsx-runtime";function Pl(){return qe("div",{className:"space-y-8",children:[qe("div",{className:"space-y-4",children:[J("h1",{className:"font-bold text-4xl",children:"App Configuration"}),J("p",{className:"text-muted-foreground",children:"ContractSpec uses a three-tier configuration model that separates global app definitions from tenant-specific settings and runtime resolution."})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppBlueprintSpec"}),qe("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"AppBlueprintSpec"})," is the global, versioned definition of your application. It contains no tenant-specific information and is stored in version control."]}),J(ri,{language:"typescript",code:`type AppBlueprintSpec = {
181
+ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"Telemetry & Tracing"}),ca("p",{children:"Workflows automatically generate OpenTelemetry spans for:"}),wo("ul",{className:"list-disc space-y-2 pl-6",children:[ca("li",{children:"Overall workflow execution"}),ca("li",{children:"Individual steps"}),ca("li",{children:"Retries and compensation"})]}),ca("p",{children:"Configure your OpenTelemetry exporter to send traces to Jaeger, Datadog, or Honeycomb."})]}),wo("div",{className:"space-y-4",children:[ca("h2",{className:"font-bold text-2xl",children:"Dashboarding"}),wo("p",{children:["You can build a custom dashboard using ",ca("code",{children:"DataViews"})," over your workflow state database. See the DataViews tutorial for how to visualize ",ca("code",{children:"WorkflowState"})," records."]})]})]})}import{CodeBlock as ri}from"@contractspec/lib.design-system";import Wr from"@contractspec/lib.ui-link";import{ChevronRight as Il}from"lucide-react";import{jsx as J,jsxs as Ve}from"react/jsx-runtime";function Pl(){return Ve("div",{className:"space-y-8",children:[Ve("div",{className:"space-y-4",children:[J("h1",{className:"font-bold text-4xl",children:"App Configuration"}),J("p",{className:"text-muted-foreground",children:"ContractSpec uses a three-tier configuration model that separates global app definitions from tenant-specific settings and runtime resolution."})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppBlueprintSpec"}),Ve("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"AppBlueprintSpec"})," is the global, versioned definition of your application. It contains no tenant-specific information and is stored in version control."]}),J(ri,{language:"typescript",code:`type AppBlueprintSpec = {
182
182
  id: string;
183
183
  version: string;
184
184
  name: string;
@@ -215,7 +215,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
215
215
 
216
216
  // Schema evolution
217
217
  migrations: MigrationSpec[];
218
- };`})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"TenantAppConfig"}),qe("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"TenantAppConfig"})," is the per-tenant, per-environment configuration that customizes how a specific tenant uses the app."]}),J(ri,{language:"typescript",code:`type TenantAppConfig = {
218
+ };`})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"TenantAppConfig"}),Ve("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"TenantAppConfig"})," is the per-tenant, per-environment configuration that customizes how a specific tenant uses the app."]}),J(ri,{language:"typescript",code:`type TenantAppConfig = {
219
219
  tenantId: string;
220
220
  blueprintId: string;
221
221
  blueprintVersion: string;
@@ -246,7 +246,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
246
246
  metadata: Record<string, unknown>;
247
247
  createdAt: string;
248
248
  updatedAt: string;
249
- };`})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppIntegrationBinding"}),J("p",{className:"text-muted-foreground",children:"Defines how a tenant connects specific integration instances to satisfy capabilities and workflows."}),J(ri,{language:"typescript",code:`type AppIntegrationBinding = {
249
+ };`})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppIntegrationBinding"}),J("p",{className:"text-muted-foreground",children:"Defines how a tenant connects specific integration instances to satisfy capabilities and workflows."}),J(ri,{language:"typescript",code:`type AppIntegrationBinding = {
250
250
  slotId: string; // References AppIntegrationSlot.slotId
251
251
  connectionId: string; // References IntegrationConnection.meta.id
252
252
  scope?: {
@@ -266,7 +266,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
266
266
  operations: ["payments.stripe.*"]
267
267
  },
268
268
  priority: 1
269
- }`})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppKnowledgeBinding"}),J("p",{className:"text-muted-foreground",children:"Defines which knowledge spaces a tenant's app can access and how."}),J(ri,{language:"typescript",code:`type AppKnowledgeBinding = {
269
+ }`})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"AppKnowledgeBinding"}),J("p",{className:"text-muted-foreground",children:"Defines which knowledge spaces a tenant's app can access and how."}),J(ri,{language:"typescript",code:`type AppKnowledgeBinding = {
270
270
  spaceId: string;
271
271
  enabled: boolean;
272
272
 
@@ -296,7 +296,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
296
296
  },
297
297
  allowedCategories: ["canonical", "operational"],
298
298
  sources: ["src_notion_product_docs", "src_database_schema"]
299
- }`})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"ResolvedAppConfig"}),qe("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"ResolvedAppConfig"})," is the runtime result of merging AppBlueprintSpec with TenantAppConfig. It's computed on-demand and never persisted."]}),J(ri,{language:"typescript",code:`type ResolvedAppConfig = {
299
+ }`})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"ResolvedAppConfig"}),Ve("p",{className:"text-muted-foreground",children:["The ",J("strong",{children:"ResolvedAppConfig"})," is the runtime result of merging AppBlueprintSpec with TenantAppConfig. It's computed on-demand and never persisted."]}),J(ri,{language:"typescript",code:`type ResolvedAppConfig = {
300
300
  appId: string;
301
301
  tenantId: string;
302
302
  blueprintName: string;
@@ -323,7 +323,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
323
323
  knowledge: ResolvedKnowledge[]; // [{ binding, space, sources }]
324
324
  branding: ResolvedBranding; // { appName, assets, colors, domain }
325
325
  notes?: string;
326
- };`})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"Configuration flow"}),J("p",{className:"text-muted-foreground",children:"Here's how configuration flows from definition to runtime:"}),qe("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[qe("li",{children:[J("strong",{children:"Development"})," - Define AppBlueprintSpec with required integrations and knowledge spaces"]}),qe("li",{children:[J("strong",{children:"Deployment"})," - Deploy blueprint to environment (sandbox, staging, production)"]}),qe("li",{children:[J("strong",{children:"Tenant Setup"})," - Create TenantAppConfig with specific integration connections and knowledge sources"]}),qe("li",{children:[J("strong",{children:"Runtime"})," - Resolve configuration on-demand when tenant accesses the app"]}),qe("li",{children:[J("strong",{children:"Execution"})," - Use ResolvedAppConfig to execute capabilities, workflows, and enforce policies"]})]})]}),qe("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"Best practices"}),qe("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[J("li",{children:"Keep AppBlueprintSpec environment-agnostic - no secrets or tenant-specific data"}),J("li",{children:"Use TenantAppConfig for all tenant-specific settings and connections"}),J("li",{children:"Cache ResolvedAppConfig per request to avoid repeated resolution"}),J("li",{children:"Version blueprints carefully - migrations affect all tenants"}),J("li",{children:"Test blueprint changes in sandbox before promoting to production"})]})]}),qe("div",{className:"flex items-center gap-4 pt-4",children:[J(Wr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),qe(Wr,{href:"/docs/architecture/integration-binding",className:"btn-primary",children:["Integration Binding ",J(Il,{size:16})]})]})]})}import{CodeBlock as _r}from"@contractspec/lib.design-system";import bi from"@contractspec/lib.ui-link";import{ChevronRight as Tl}from"lucide-react";import{jsx as le,jsxs as la}from"react/jsx-runtime";function Al(){return la("div",{className:"space-y-8",children:[la("div",{className:"space-y-4",children:[le("h1",{className:"font-bold text-4xl",children:"Control Plane Runtime"}),le("p",{className:"text-muted-foreground",children:"The control plane is the governance layer for agentic execution. It turns incoming intent into deterministic plans, enforces risk policy before side effects, and records replayable traces for audits."})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Canonical execution loop"}),la("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[le("li",{children:"Accept intent and create execution identity + trace context."}),le("li",{children:"Compile intent into a typed, deterministic plan DAG."}),le("li",{children:"Verify plan against policy and risk rules."}),le("li",{children:"Route into autonomous or assist mode based on verdict."}),le("li",{children:"Execute steps with idempotent keys and explicit stage events."}),le("li",{children:"Persist outcomes for replay, audits, and operator visibility."})]})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Contract surfaces (v1 baseline)"}),la("p",{className:"text-muted-foreground",children:["The runtime is contract-first. Commands, queries, events, and capabilities are explicit and versioned under",le("code",{children:" @contractspec/lib.contracts-spec"}),"."]}),le(_r,{language:"text",code:`Commands
326
+ };`})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"Configuration flow"}),J("p",{className:"text-muted-foreground",children:"Here's how configuration flows from definition to runtime:"}),Ve("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[Ve("li",{children:[J("strong",{children:"Development"})," - Define AppBlueprintSpec with required integrations and knowledge spaces"]}),Ve("li",{children:[J("strong",{children:"Deployment"})," - Deploy blueprint to environment (sandbox, staging, production)"]}),Ve("li",{children:[J("strong",{children:"Tenant Setup"})," - Create TenantAppConfig with specific integration connections and knowledge sources"]}),Ve("li",{children:[J("strong",{children:"Runtime"})," - Resolve configuration on-demand when tenant accesses the app"]}),Ve("li",{children:[J("strong",{children:"Execution"})," - Use ResolvedAppConfig to execute capabilities, workflows, and enforce policies"]})]})]}),Ve("div",{className:"space-y-4",children:[J("h2",{className:"font-bold text-2xl",children:"Best practices"}),Ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[J("li",{children:"Keep AppBlueprintSpec environment-agnostic - no secrets or tenant-specific data"}),J("li",{children:"Use TenantAppConfig for all tenant-specific settings and connections"}),J("li",{children:"Cache ResolvedAppConfig per request to avoid repeated resolution"}),J("li",{children:"Version blueprints carefully - migrations affect all tenants"}),J("li",{children:"Test blueprint changes in sandbox before promoting to production"})]})]}),Ve("div",{className:"flex items-center gap-4 pt-4",children:[J(Wr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),Ve(Wr,{href:"/docs/architecture/integration-binding",className:"btn-primary",children:["Integration Binding ",J(Il,{size:16})]})]})]})}import{CodeBlock as _r}from"@contractspec/lib.design-system";import bi from"@contractspec/lib.ui-link";import{ChevronRight as Tl}from"lucide-react";import{jsx as le,jsxs as la}from"react/jsx-runtime";function Al(){return la("div",{className:"space-y-8",children:[la("div",{className:"space-y-4",children:[le("h1",{className:"font-bold text-4xl",children:"Control Plane Runtime"}),le("p",{className:"text-muted-foreground",children:"The control plane is the governance layer for agentic execution. It turns incoming intent into deterministic plans, enforces risk policy before side effects, and records replayable traces for audits."})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Canonical execution loop"}),la("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[le("li",{children:"Accept intent and create execution identity + trace context."}),le("li",{children:"Compile intent into a typed, deterministic plan DAG."}),le("li",{children:"Verify plan against policy and risk rules."}),le("li",{children:"Route into autonomous or assist mode based on verdict."}),le("li",{children:"Execute steps with idempotent keys and explicit stage events."}),le("li",{children:"Persist outcomes for replay, audits, and operator visibility."})]})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Contract surfaces (v1 baseline)"}),la("p",{className:"text-muted-foreground",children:["The runtime is contract-first. Commands, queries, events, and capabilities are explicit and versioned under",le("code",{children:" @contractspec/lib.contracts-spec"}),"."]}),le(_r,{language:"text",code:`Commands
327
327
  - controlPlane.intent.submit
328
328
  - controlPlane.plan.compile
329
329
  - controlPlane.plan.verify
@@ -368,7 +368,7 @@ Capabilities
368
368
  contracts.test.ts
369
369
 
370
370
  packages/apps/web-landing/src/app/docs/architecture/control-plane/page.tsx
371
- implementation_plan_controle_plane.md`})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"What comes next"}),le("p",{className:"text-muted-foreground",children:"WS1 delivers the contract fabric. Next increments add planner/executor split, policy escalation, capability-bound authorization, signed skill compatibility checks, and full replay tooling."})]}),la("div",{className:"flex items-center gap-4 pt-4",children:[le(bi,{href:"/docs/architecture/integration-binding",className:"btn-ghost",children:"Previous: Integration Binding"}),la(bi,{href:"/docs/safety/auditing",className:"btn-primary",children:["Audit Logs ",le(Tl,{size:16})]})]})]})}import{CodeBlock as Jo}from"@contractspec/lib.design-system";import zr from"@contractspec/lib.ui-link";import{ChevronRight as Rl}from"lucide-react";import{jsx as B,jsxs as Ve}from"react/jsx-runtime";function Ll(){return Ve("div",{className:"space-y-8",children:[Ve("div",{className:"space-y-4",children:[B("h1",{className:"font-bold text-4xl",children:"Integration Binding"}),B("p",{className:"text-muted-foreground",children:"Integration binding connects your app's capabilities to external service providers. Each tenant can configure their own integration connections while sharing the same app blueprint."})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"How it works"}),B("p",{className:"text-muted-foreground",children:"Integration binding follows a three-layer model:"}),Ve("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[Ve("li",{children:[B("strong",{children:"IntegrationSpec"})," (global) - Defines what an integration provides"]}),Ve("li",{children:[B("strong",{children:"IntegrationConnection"})," (per-tenant) - A tenant's configured connection"]}),Ve("li",{children:[B("strong",{children:"AppIntegrationBinding"})," (per-app) - Maps named slots to concrete tenant connections"]})]})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Example: Payment processing"}),B("p",{className:"text-muted-foreground",children:"Let's walk through a complete example of binding Stripe for payments."}),Ve("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 1: Blueprint declares requirement"}),B(Jo,{language:"typescript",code:`// AppBlueprintSpec
371
+ implementation_plan_controle_plane.md`})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"What comes next"}),le("p",{className:"text-muted-foreground",children:"WS1 delivers the contract fabric. Next increments add planner/executor split, policy escalation, capability-bound authorization, signed skill compatibility checks, and full replay tooling."})]}),la("div",{className:"flex items-center gap-4 pt-4",children:[le(bi,{href:"/docs/architecture/integration-binding",className:"btn-ghost",children:"Previous: Integration Binding"}),la(bi,{href:"/docs/safety/auditing",className:"btn-primary",children:["Audit Logs ",le(Tl,{size:16})]})]})]})}import{CodeBlock as Jo}from"@contractspec/lib.design-system";import zr from"@contractspec/lib.ui-link";import{ChevronRight as Rl}from"lucide-react";import{jsx as B,jsxs as He}from"react/jsx-runtime";function Ll(){return He("div",{className:"space-y-8",children:[He("div",{className:"space-y-4",children:[B("h1",{className:"font-bold text-4xl",children:"Integration Binding"}),B("p",{className:"text-muted-foreground",children:"Integration binding connects your app's capabilities to external service providers. Each tenant can configure their own integration connections while sharing the same app blueprint."})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"How it works"}),B("p",{className:"text-muted-foreground",children:"Integration binding follows a three-layer model:"}),He("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[He("li",{children:[B("strong",{children:"IntegrationSpec"})," (global) - Defines what an integration provides"]}),He("li",{children:[B("strong",{children:"IntegrationConnection"})," (per-tenant) - A tenant's configured connection"]}),He("li",{children:[B("strong",{children:"AppIntegrationBinding"})," (per-app) - Maps named slots to concrete tenant connections"]})]})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Example: Payment processing"}),B("p",{className:"text-muted-foreground",children:"Let's walk through a complete example of binding Stripe for payments."}),He("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 1: Blueprint declares requirement"}),B(Jo,{language:"typescript",code:`// AppBlueprintSpec
372
372
  {
373
373
  meta: { name: "invoice-app", version: '1.0.0', appId: "invoice" },
374
374
  integrationSlots: [
@@ -392,7 +392,7 @@ implementation_plan_controle_plane.md`})]}),la("div",{className:"space-y-4",chil
392
392
  assets: [{ type: "logo", url: "https://cdn.acme.dev/logo.png" }],
393
393
  colorTokens: { primary: "colors.brand.primary" }
394
394
  }
395
- }`})]}),Ve("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 2: Tenant creates connection"}),B(Jo,{language:"typescript",code:`// IntegrationConnection
395
+ }`})]}),He("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 2: Tenant creates connection"}),B(Jo,{language:"typescript",code:`// IntegrationConnection
396
396
  {
397
397
  meta: {
398
398
  id: "conn_stripe_acme_prod",
@@ -412,7 +412,7 @@ implementation_plan_controle_plane.md`})]}),la("div",{className:"space-y-4",chil
412
412
  },
413
413
  secretRef: "vault://integrations/acme/conn_stripe_acme_prod",
414
414
  status: "active"
415
- }`})]}),Ve("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 3: TenantAppConfig binds connection"}),B(Jo,{language:"typescript",code:`// TenantAppConfig
415
+ }`})]}),He("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 3: TenantAppConfig binds connection"}),B(Jo,{language:"typescript",code:`// TenantAppConfig
416
416
  {
417
417
  meta: {
418
418
  tenantId: "acme-corp",
@@ -438,7 +438,7 @@ implementation_plan_controle_plane.md`})]}),la("div",{className:"space-y-4",chil
438
438
  customDomain: "billing.acme.com",
439
439
  assets: [{ type: "logo", url: "https://assets.acme.com/logo.svg" }]
440
440
  }
441
- }`})]}),Ve("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 4: Runtime resolves and executes"}),B(Jo,{language:"typescript",code:`// ResolvedAppConfig (runtime)
441
+ }`})]}),He("div",{className:"space-y-3",children:[B("h3",{className:"font-semibold text-lg",children:"Step 4: Runtime resolves and executes"}),B(Jo,{language:"typescript",code:`// ResolvedAppConfig (runtime)
442
442
  {
443
443
  integrations: {
444
444
  "payments.createPaymentIntent": {
@@ -455,7 +455,7 @@ const result = await executeCapability(
455
455
  { amount: 5000, currency: "usd" },
456
456
  resolvedConfig
457
457
  );
458
- // → Uses Stripe connection automatically`})]})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Multi-integration scenarios"}),B("p",{className:"text-muted-foreground",children:"A single app can use multiple integrations across different categories:"}),B(Jo,{language:"typescript",code:`integrations: [
458
+ // → Uses Stripe connection automatically`})]})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Multi-integration scenarios"}),B("p",{className:"text-muted-foreground",children:"A single app can use multiple integrations across different categories:"}),B(Jo,{language:"typescript",code:`integrations: [
459
459
  {
460
460
  slotId: "payments.primary",
461
461
  connectionId: "conn_stripe_prod",
@@ -481,7 +481,7 @@ const result = await executeCapability(
481
481
  workflows: ["semantic-search", "rag-query"]
482
482
  }
483
483
  }
484
- ]`})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Sandbox vs Production"}),B("p",{className:"text-muted-foreground",children:"Tenants typically maintain separate connections for sandbox and production environments:"}),B(Jo,{language:"typescript",code:`// Sandbox environment
484
+ ]`})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Sandbox vs Production"}),B("p",{className:"text-muted-foreground",children:"Tenants typically maintain separate connections for sandbox and production environments:"}),B(Jo,{language:"typescript",code:`// Sandbox environment
485
485
  {
486
486
  meta: { environment: "sandbox", status: "preview" },
487
487
  integrations: [
@@ -501,7 +501,7 @@ const result = await executeCapability(
501
501
  connectionId: "conn_stripe_acme_prod"
502
502
  }
503
503
  ]
504
- }`})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Security & validation"}),Ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[B("li",{children:"Integration connections are validated before binding - health checks ensure connectivity"}),B("li",{children:"Secrets are never stored in TenantAppConfig - only references to encrypted secrets"}),B("li",{children:"Policy Decision Point (PDP) enforces which workflows can use which integrations"}),B("li",{children:"All integration calls are audited with full request/response logging"}),B("li",{children:"Rate limiting and quotas are enforced per connection"})]})]}),Ve("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Best practices"}),Ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ve("li",{children:["Use wildcard patterns sparingly in ",B("code",{children:"allowedWorkflows"})," - be explicit about access"]}),B("li",{children:"Always maintain separate sandbox and production connections"}),B("li",{children:"Monitor integration health checks and set up alerts for failures"}),B("li",{children:"Document the purpose of each integration binding for your team"}),B("li",{children:"Test integration changes in sandbox before promoting to production"})]})]}),Ve("div",{className:"flex items-center gap-4 pt-4",children:[B(zr,{href:"/docs/architecture/app-config",className:"btn-ghost",children:"Previous: App Configuration"}),Ve(zr,{href:"/docs/architecture/knowledge-binding",className:"btn-primary",children:["Knowledge Binding ",B(Rl,{size:16})]})]})]})}import{CodeBlock as ni}from"@contractspec/lib.design-system";import Gr from"@contractspec/lib.ui-link";import{ChevronRight as El}from"lucide-react";import{jsx as d,jsxs as se}from"react/jsx-runtime";function Dl(){return se("div",{className:"space-y-8",children:[se("div",{className:"space-y-4",children:[d("h1",{className:"font-bold text-4xl",children:"Knowledge Binding"}),d("p",{className:"text-muted-foreground",children:"Knowledge binding connects your app's workflows and agents to structured knowledge spaces. This enables semantic search, RAG (Retrieval-Augmented Generation), and context-aware decision-making."})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"How it works"}),d("p",{className:"text-muted-foreground",children:"Knowledge binding follows a three-layer model:"}),se("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[se("li",{children:[d("strong",{children:"KnowledgeSpaceSpec"})," (global) - Defines a logical knowledge domain"]}),se("li",{children:[d("strong",{children:"KnowledgeSourceConfig"})," (per-tenant) - Tenant's data sources feeding spaces"]}),se("li",{children:[d("strong",{children:"AppKnowledgeBinding"})," (per-app) - Maps spaces to workflows/agents"]})]})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Example: Support agent with RAG"}),d("p",{className:"text-muted-foreground",children:"Let's build a support agent that uses canonical product documentation and operational support history."}),se("div",{className:"space-y-3",children:[d("h3",{className:"font-semibold text-lg",children:"Step 1: Blueprint declares knowledge needs"}),d(ni,{language:"typescript",code:`// AppBlueprintSpec
504
+ }`})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Security & validation"}),He("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[B("li",{children:"Integration connections are validated before binding - health checks ensure connectivity"}),B("li",{children:"Secrets are never stored in TenantAppConfig - only references to encrypted secrets"}),B("li",{children:"Policy Decision Point (PDP) enforces which workflows can use which integrations"}),B("li",{children:"All integration calls are audited with full request/response logging"}),B("li",{children:"Rate limiting and quotas are enforced per connection"})]})]}),He("div",{className:"space-y-4",children:[B("h2",{className:"font-bold text-2xl",children:"Best practices"}),He("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[He("li",{children:["Use wildcard patterns sparingly in ",B("code",{children:"allowedWorkflows"})," - be explicit about access"]}),B("li",{children:"Always maintain separate sandbox and production connections"}),B("li",{children:"Monitor integration health checks and set up alerts for failures"}),B("li",{children:"Document the purpose of each integration binding for your team"}),B("li",{children:"Test integration changes in sandbox before promoting to production"})]})]}),He("div",{className:"flex items-center gap-4 pt-4",children:[B(zr,{href:"/docs/architecture/app-config",className:"btn-ghost",children:"Previous: App Configuration"}),He(zr,{href:"/docs/architecture/knowledge-binding",className:"btn-primary",children:["Knowledge Binding ",B(Rl,{size:16})]})]})]})}import{CodeBlock as ni}from"@contractspec/lib.design-system";import Gr from"@contractspec/lib.ui-link";import{ChevronRight as El}from"lucide-react";import{jsx as d,jsxs as se}from"react/jsx-runtime";function Dl(){return se("div",{className:"space-y-8",children:[se("div",{className:"space-y-4",children:[d("h1",{className:"font-bold text-4xl",children:"Knowledge Binding"}),d("p",{className:"text-muted-foreground",children:"Knowledge binding connects your app's workflows and agents to structured knowledge spaces. This enables semantic search, RAG (Retrieval-Augmented Generation), and context-aware decision-making."})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"How it works"}),d("p",{className:"text-muted-foreground",children:"Knowledge binding follows a three-layer model:"}),se("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[se("li",{children:[d("strong",{children:"KnowledgeSpaceSpec"})," (global) - Defines a logical knowledge domain"]}),se("li",{children:[d("strong",{children:"KnowledgeSourceConfig"})," (per-tenant) - Tenant's data sources feeding spaces"]}),se("li",{children:[d("strong",{children:"AppKnowledgeBinding"})," (per-app) - Maps spaces to workflows/agents"]})]})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Example: Support agent with RAG"}),d("p",{className:"text-muted-foreground",children:"Let's build a support agent that uses canonical product documentation and operational support history."}),se("div",{className:"space-y-3",children:[d("h3",{className:"font-semibold text-lg",children:"Step 1: Blueprint declares knowledge needs"}),d(ni,{language:"typescript",code:`// AppBlueprintSpec
505
505
  {
506
506
  id: "support-app",
507
507
  version: "1.0.0",
@@ -660,17 +660,17 @@ steps:
660
660
  allowedCategories: ["operational"],
661
661
  sources: ["src_crm_data", "src_past_invoices"]
662
662
  }
663
- ]`})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Security & validation"}),se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[d("li",{children:"Knowledge sources are validated before sync - credentials and permissions checked"}),d("li",{children:"PDP enforces which workflows/agents can access which spaces"}),d("li",{children:"All knowledge queries are audited with search terms and results"}),d("li",{children:"Canonical knowledge is immutable once indexed - changes require re-sync"}),d("li",{children:"Ephemeral knowledge is automatically purged based on retention policies"})]})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Best practices"}),se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[d("li",{children:"Use canonical spaces for policy-critical decisions, operational for suggestions"}),d("li",{children:"Never allow workflows to write to canonical spaces - maintain read-only access"}),d("li",{children:"Set up monitoring for sync failures and stale knowledge sources"}),d("li",{children:"Document the purpose and trust level of each knowledge space"}),d("li",{children:"Test knowledge queries in sandbox before promoting to production"}),se("li",{children:["Use explicit ",d("code",{children:"allowedConsumers"})," - avoid wildcard access"]})]})]}),se("div",{className:"flex items-center gap-4 pt-4",children:[d(Gr,{href:"/docs/architecture/integration-binding",className:"btn-ghost",children:"Previous: Integration Binding"}),se(Gr,{href:"/docs/knowledge",className:"btn-primary",children:["Knowledge & Context ",d(El,{size:16})]})]})]})}import{CodeBlock as Ol}from"@contractspec/lib.design-system";import Hr from"@contractspec/lib.ui-link";import{ChevronRight as Ml}from"lucide-react";import{jsx as ot,jsxs as At}from"react/jsx-runtime";function Bl(){return At("div",{className:"space-y-8",children:[At("div",{className:"space-y-4",children:[ot("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy"}),ot("p",{className:"text-muted-foreground",children:"ContractSpec is designed from the ground up for multi-tenancy. Apps built with ContractSpec can serve multiple organizations (tenants) from a single deployment, while ensuring strict data isolation and configuration separation."})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),At("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[At("li",{children:[ot("strong",{children:"Tenant"}),": An organization or customer that uses your app. Each tenant has a unique ",ot("code",{children:"tenantId"}),"."]}),At("li",{children:[ot("strong",{children:"Tenant Isolation"}),": Data and configuration for one tenant is never accessible to another tenant unless explicitly shared."]}),At("li",{children:[ot("strong",{children:"Tenant Context"}),": Every request and operation runs within the context of a specific tenant."]})]})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Tenant Resolution"}),ot("p",{className:"text-muted-foreground",children:"The runtime automatically resolves the tenant context for every request based on:"}),At("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[At("li",{children:["Subdomain (e.g., ",ot("code",{children:"acme.app.com"}),")"]}),At("li",{children:["Custom Domain (e.g., ",ot("code",{children:"portal.acme.com"}),")"]}),At("li",{children:["Header (e.g., ",ot("code",{children:"x-tenant-id: acme-corp"}),")"]}),ot("li",{children:"Authentication Token (embedded tenant claim)"})]})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Configuration Isolation"}),At("p",{className:"text-muted-foreground",children:["Each tenant has its own ",ot("code",{children:"TenantAppConfig"})," which defines:"]}),ot(Ol,{language:"typescript",code:`type TenantAppConfig = {
663
+ ]`})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Security & validation"}),se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[d("li",{children:"Knowledge sources are validated before sync - credentials and permissions checked"}),d("li",{children:"PDP enforces which workflows/agents can access which spaces"}),d("li",{children:"All knowledge queries are audited with search terms and results"}),d("li",{children:"Canonical knowledge is immutable once indexed - changes require re-sync"}),d("li",{children:"Ephemeral knowledge is automatically purged based on retention policies"})]})]}),se("div",{className:"space-y-4",children:[d("h2",{className:"font-bold text-2xl",children:"Best practices"}),se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[d("li",{children:"Use canonical spaces for policy-critical decisions, operational for suggestions"}),d("li",{children:"Never allow workflows to write to canonical spaces - maintain read-only access"}),d("li",{children:"Set up monitoring for sync failures and stale knowledge sources"}),d("li",{children:"Document the purpose and trust level of each knowledge space"}),d("li",{children:"Test knowledge queries in sandbox before promoting to production"}),se("li",{children:["Use explicit ",d("code",{children:"allowedConsumers"})," - avoid wildcard access"]})]})]}),se("div",{className:"flex items-center gap-4 pt-4",children:[d(Gr,{href:"/docs/architecture/integration-binding",className:"btn-ghost",children:"Previous: Integration Binding"}),se(Gr,{href:"/docs/knowledge",className:"btn-primary",children:["Knowledge & Context ",d(El,{size:16})]})]})]})}import{CodeBlock as Ol}from"@contractspec/lib.design-system";import qr from"@contractspec/lib.ui-link";import{ChevronRight as Ml}from"lucide-react";import{jsx as ot,jsxs as At}from"react/jsx-runtime";function Bl(){return At("div",{className:"space-y-8",children:[At("div",{className:"space-y-4",children:[ot("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy"}),ot("p",{className:"text-muted-foreground",children:"ContractSpec is designed from the ground up for multi-tenancy. Apps built with ContractSpec can serve multiple organizations (tenants) from a single deployment, while ensuring strict data isolation and configuration separation."})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),At("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[At("li",{children:[ot("strong",{children:"Tenant"}),": An organization or customer that uses your app. Each tenant has a unique ",ot("code",{children:"tenantId"}),"."]}),At("li",{children:[ot("strong",{children:"Tenant Isolation"}),": Data and configuration for one tenant is never accessible to another tenant unless explicitly shared."]}),At("li",{children:[ot("strong",{children:"Tenant Context"}),": Every request and operation runs within the context of a specific tenant."]})]})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Tenant Resolution"}),ot("p",{className:"text-muted-foreground",children:"The runtime automatically resolves the tenant context for every request based on:"}),At("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[At("li",{children:["Subdomain (e.g., ",ot("code",{children:"acme.app.com"}),")"]}),At("li",{children:["Custom Domain (e.g., ",ot("code",{children:"portal.acme.com"}),")"]}),At("li",{children:["Header (e.g., ",ot("code",{children:"x-tenant-id: acme-corp"}),")"]}),ot("li",{children:"Authentication Token (embedded tenant claim)"})]})]}),At("div",{className:"space-y-4",children:[ot("h2",{className:"font-bold text-2xl",children:"Configuration Isolation"}),At("p",{className:"text-muted-foreground",children:["Each tenant has its own ",ot("code",{children:"TenantAppConfig"})," which defines:"]}),ot(Ol,{language:"typescript",code:`type TenantAppConfig = {
664
664
  tenantId: string;
665
665
  blueprintId: string;
666
666
  // ...
667
667
  integrationBindings: AppIntegrationBinding[];
668
668
  knowledgeBindings: AppKnowledgeBinding[];
669
669
  featureFlags: Record<string, boolean>;
670
- };`}),ot("p",{className:"mt-2 text-muted-foreground",children:"This allows you to customize feature flags, integration connections, and knowledge sources per tenant without changing the application code."})]}),At("div",{className:"flex items-center gap-4 pt-4",children:[ot(Hr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),At(Hr,{href:"/docs/libraries/multi-tenancy",className:"btn-primary",children:["Multi-Tenancy Library ",ot(Ml,{size:16})]})]})]})}import Zo from"@contractspec/lib.ui-link";import{jsx as Be,jsxs as Kt}from"react/jsx-runtime";var Ul=[{title:"Contracts and schemas",body:"Explicit specs define the durable boundary for behavior, data, and governance."},{title:"Bindings and configuration",body:"Apps, tenants, integrations, and knowledge sources are wired through explicit configuration instead of hidden glue."},{title:"Runtimes and generators",body:"Serve or generate aligned surfaces for API, UI, workflows, docs, and agent-facing interfaces."},{title:"Operate and observe",body:"Carry auditability, policy, tracing, migrations, and tenant isolation through the same model."}];function Wl(){return Kt("div",{className:"space-y-10",children:[Kt("div",{className:"space-y-3",children:[Be("p",{className:"editorial-kicker",children:"Build"}),Be("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The architecture keeps contracts, runtime behavior, and operations in the same system."}),Be("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is not a single runtime. It is a layered system that lets you define explicit boundaries, bind real-world configuration, and then serve or generate aligned surfaces without losing control of the output."})]}),Be("div",{className:"grid gap-4 md:grid-cols-2",children:Ul.map((e)=>Kt("article",{className:"editorial-panel space-y-3",children:[Be("h2",{className:"font-semibold text-xl",children:e.title}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),Kt("section",{className:"editorial-panel space-y-5",children:[Kt("div",{className:"space-y-2",children:[Be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"UI composition belongs in the bundle runtime layer"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"When the system needs adaptive layouts, entity workbenches, assistant slots, and safe overlays, use module bundles as the layer between the contract model and the rendered surface."})]}),Kt("div",{className:"grid gap-4 md:grid-cols-2",children:[Kt(Zo,{href:"/docs/specs/module-bundles",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Module bundles spec"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"See the typed bundle contract, resolved surface plan model, and bounded AI/runtime behavior."})]}),Kt(Zo,{href:"/docs/guides/first-module-bundle",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Build a first module bundle"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"Follow the route-to-plan-to-render path with one practical host example."})]})]})]}),Kt("section",{className:"editorial-panel space-y-5",children:[Kt("div",{className:"space-y-2",children:[Be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Follow the architecture by responsibility"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"Use the architecture pages when you need to understand how the pieces snap together in a real deployment."})]}),Kt("div",{className:"grid gap-4 md:grid-cols-2",children:[Kt(Zo,{href:"/docs/architecture/app-config",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"App configuration"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How blueprint-level and tenant-level config stay explicit and merge safely."})]}),Kt(Zo,{href:"/docs/architecture/integration-binding",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Integration binding"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How apps connect to tenant-owned integrations without leaking provider logic everywhere."})]}),Kt(Zo,{href:"/docs/architecture/knowledge-binding",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Knowledge binding"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How trusted knowledge enters the system and stays isolated by context and tenant."})]}),Kt(Zo,{href:"/docs/architecture/control-plane",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Control plane runtime"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How intent, policy, planning, and execution flow through the system runtime."})]})]})]})]})}import{jsx as T,jsxs as wt}from"react/jsx-runtime";function _l(){return wt("div",{className:"space-y-8",children:[wt("div",{className:"space-y-4",children:[T("h1",{className:"font-bold text-4xl",children:"Automation platforms"}),T("p",{className:"text-muted-foreground",children:"Automation platforms connect apps and automate tasks through triggers and actions. They serve operations and non-technical users well but stop short of generating full applications or enforcing fine-grained policies."})]}),wt("div",{className:"space-y-4",children:[T("h2",{className:"font-bold text-2xl",children:"Feature comparison"}),T("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:wt("table",{className:"w-full text-left text-sm",children:[T("thead",{className:"bg-card/50",children:wt("tr",{className:"border-border/50 border-b",children:[T("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),T("th",{className:"px-4 py-3 font-semibold",children:"Zapier"}),T("th",{className:"px-4 py-3 font-semibold",children:"Make (Integromat)"}),T("th",{className:"px-4 py-3 font-semibold",children:"n8n"}),T("th",{className:"px-4 py-3 font-semibold",children:"Pipedream"})]})}),wt("tbody",{className:"divide-y divide-border/50",children:[wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Workflow model"}),T("td",{className:"px-4 py-3 align-top",children:"Zaps: trigger + one or more actions"}),T("td",{className:"px-4 py-3 align-top",children:"Real-time visual orchestration for AI agents and automations"}),T("td",{className:"px-4 py-3 align-top",children:"Node-based workflow builder with drag-and-drop and code; build multi-step AI agents"}),T("td",{className:"px-4 py-3 align-top",children:"Workflows connect any API; Pipedream Connect SDK adds integrations quickly"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Visual builder?"}),T("td",{className:"px-4 py-3 align-top",children:"Yes (simple; web-based)."}),T("td",{className:"px-4 py-3 align-top",children:"Yes; AI-assisted editor"}),T("td",{className:"px-4 py-3 align-top",children:"Yes; visual canvas."}),T("td",{className:"px-4 py-3 align-top",children:"Code-centric editor; no visual UI builder"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Self-host?"}),T("td",{className:"px-4 py-3 align-top",children:"No (cloud only)."}),T("td",{className:"px-4 py-3 align-top",children:"Cloud only."}),T("td",{className:"px-4 py-3 align-top",children:"Yes (Docker, self-host)"}),T("td",{className:"px-4 py-3 align-top",children:"Cloud only (hosted)."})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Integrations & AI"}),T("td",{className:"px-4 py-3 align-top",children:"Connects almost 8 000 apps; limited AI features."}),T("td",{className:"px-4 py-3 align-top",children:"3 000+ pre-built apps; supports GenAI tools; GDPR/SOC2 and SSO"}),T("td",{className:"px-4 py-3 align-top",children:"Integrates LLMs; allows JS or Python code and library imports; chatbots with Slack/Teams"}),T("td",{className:"px-4 py-3 align-top",children:"MCP servers add 3 000+ APIs and 10 000+ tools to agents; AI agent builder prompts and deploys agents; SOC 2/ HIPAA/GDPR compliant"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Policy & UI generation"}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate user interfaces."}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate UIs beyond a workflow dashboard."}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; no UI builder"}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate UI."})]})]})]})})]}),wt("div",{className:"space-y-3",children:[T("h2",{className:"font-bold text-2xl",children:"Why ContractSpec differs"}),wt("ul",{className:"space-y-2 text-muted-foreground",children:[wt("li",{children:[T("strong",{children:"Full application generation"})," – ContractSpec compiles specs into back-end, events and user interfaces for both web and mobile."]}),wt("li",{children:[T("strong",{children:"Policy enforcement"})," – A built-in policy engine governs PII access and mutations across the UI."]}),wt("li",{children:[T("strong",{children:"Customisation via overlays"})," – Non-technical users can safely personalise layouts while respecting policies."]}),wt("li",{children:[T("strong",{children:"Extensible capabilities"})," – Connect to external APIs and services via capability providers while maintaining type safety."]})]}),T("p",{className:"text-muted-foreground",children:"Automation tools simplify integrations and tasks; ContractSpec goes further by generating a complete, policy-safe application around your data and processes."})]})]})}import zl from"@contractspec/lib.ui-link";import{jsx as W,jsxs as it}from"react/jsx-runtime";function Gl(){return it("div",{className:"space-y-8",children:[it("div",{className:"space-y-4",children:[W("h1",{className:"font-bold text-4xl",children:"Enterprise orchestration platforms"}),W("p",{className:"text-muted-foreground",children:"Enterprise orchestration platforms manage mission-critical workloads and integrate deeply with ERP systems. They prioritise governance, reliability and compliance, but they do not provide spec-driven app generation or per-user customisation."})]}),it("div",{className:"space-y-4",children:[W("h2",{className:"font-bold text-2xl",children:"Redwood RunMyJobs"}),it("p",{className:"text-muted-foreground",children:[W(zl,{href:"https://www.redwood.com/workload-automation/",className:"underline decoration-dotted underline-offset-4 hover:text-foreground",target:"_blank",rel:"noreferrer",children:"RunMyJobs by Redwood"})," ","is a cloud-native service orchestration and automation platform. Key attributes include:"]}),it("ul",{className:"space-y-2 text-muted-foreground",children:[it("li",{children:[W("strong",{children:"Self-service portal."})," Business users can run and customise workloads while IT ensures governance and compliance"]}),it("li",{children:[W("strong",{children:"Full-stack orchestration."})," Integrates with both SAP and non-SAP systems; Redwood is recognised as a Leader in Gartner’s Magic Quadrant for service orchestration"]}),it("li",{children:[W("strong",{children:"Observability and AI insights."})," Dashboards and AI-enhanced analytics identify bottlenecks and forecast issues"]}),it("li",{children:[W("strong",{children:"Deep SAP integration."})," Supports SAP’s latest technologies and orchestrates mission-critical business processes"]}),it("li",{children:[W("strong",{children:"Connectors & wizard."})," Provides pre-built connectors and a wizard to link on-prem and cloud systems"]})]})]}),it("div",{className:"space-y-4",children:[W("h3",{className:"font-semibold text-xl",children:"Comparison with ContractSpec"}),W("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:it("table",{className:"w-full text-left text-sm",children:[W("thead",{className:"bg-card/50",children:it("tr",{className:"border-border/50 border-b",children:[W("th",{className:"px-4 py-3 font-semibold",children:"Aspect"}),W("th",{className:"px-4 py-3 font-semibold",children:"RunMyJobs"}),W("th",{className:"px-4 py-3 font-semibold",children:"ContractSpec"})]})}),it("tbody",{className:"divide-y divide-border/50",children:[it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Target user"})}),W("td",{className:"px-4 py-3 align-top",children:"Enterprise IT and operations teams automating SAP and mission-critical workflows."}),W("td",{className:"px-4 py-3 align-top",children:"Developers, product teams and SMBs wanting to generate policy-safe apps with customisable UIs."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Workload focus"})}),W("td",{className:"px-4 py-3 align-top",children:"Service orchestration and job scheduling across ERP/legacy systems"}),W("td",{className:"px-4 py-3 align-top",children:"End-to-end application generation with back-end, UI and policies."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"User interface"})}),W("td",{className:"px-4 py-3 align-top",children:"Self-service portal to run/monitor jobs; no custom UI generation for new apps."}),W("td",{className:"px-4 py-3 align-top",children:"Generates React/React-Native UIs from specs; users can personalise layout via overlays."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Open source"})}),W("td",{className:"px-4 py-3 align-top",children:"Proprietary SaaS; enterprise agreements."}),W("td",{className:"px-4 py-3 align-top",children:"Core compiler is proprietary; SDK and certain modules may be open-source; offers hosted and on-prem options."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Policy & personalisation"})}),W("td",{className:"px-4 py-3 align-top",children:"IT controls governance; no per-user overlay concept."}),W("td",{className:"px-4 py-3 align-top",children:"Built-in policy engine and per-user overlays for safe personalisation."})]})]})]})}),W("p",{className:"text-muted-foreground",children:"Redwood RunMyJobs is designed for orchestrating enterprise workloads and SAP processes. ContractSpec targets a different problem: generating complete applications from typed specs and letting end users adapt them safely."})]})]})}import{jsx as A,jsxs as kt}from"react/jsx-runtime";function Hl(){return kt("div",{className:"space-y-8",children:[kt("div",{className:"space-y-4",children:[A("h1",{className:"font-bold text-4xl",children:"Internal-tool builders"}),A("p",{className:"text-muted-foreground",children:"Internal-tool builders let teams quickly assemble dashboards and admin panels. These platforms often provide drag-and-drop UIs and connectors to databases and APIs, but they rely on developers to write custom code for business logic and seldom enforce policies across surfaces."})]}),kt("div",{className:"space-y-4",children:[A("h2",{className:"font-bold text-2xl",children:"Feature comparison"}),A("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:kt("table",{className:"w-full text-left text-sm",children:[A("thead",{className:"bg-card/50",children:kt("tr",{className:"border-border/50 border-b",children:[A("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),A("th",{className:"px-4 py-3 font-semibold",children:"Retool"}),A("th",{className:"px-4 py-3 font-semibold",children:"Appsmith"}),A("th",{className:"px-4 py-3 font-semibold",children:"ToolJet"}),A("th",{className:"px-4 py-3 font-semibold",children:"Budibase"})]})}),kt("tbody",{className:"divide-y divide-border/50",children:[kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"UI builder"}),A("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop canvas; shape UI components easily"}),A("td",{className:"px-4 py-3 align-top",children:"Visual builder with drag-and-drop widgets"}),A("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop UI widgets (tables, charts, forms)"}),A("td",{className:"px-4 py-3 align-top",children:"Pre-built components and templates for mobile/desktop"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Custom code & logic"}),A("td",{className:"px-4 py-3 align-top",children:"Full code insertion anywhere via IDE"}),A("td",{className:"px-4 py-3 align-top",children:"Logic via JavaScript or natural-language prompts in a central IDE"}),A("td",{className:"px-4 py-3 align-top",children:"Supports business logic in JavaScript or Python queries"}),A("td",{className:"px-4 py-3 align-top",children:"Custom logic via JavaScript; plugins and external embeds"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Data connectors"}),A("td",{className:"px-4 py-3 align-top",children:"Wide support for databases and APIs (PostgreSQL, MongoDB, GraphQL, etc.)."}),A("td",{className:"px-4 py-3 align-top",children:"Connects to LLMs and databases"}),A("td",{className:"px-4 py-3 align-top",children:"Built-in database; connects to PostgreSQL, MongoDB, APIs, GraphQL, SaaS"}),A("td",{className:"px-4 py-3 align-top",children:"Connects to external databases, REST, CSV or built-in DB"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Open source & self-host"}),A("td",{className:"px-4 py-3 align-top",children:"Proprietary; cloud or on-prem subscription."}),A("td",{className:"px-4 py-3 align-top",children:"Open source (Apache-2.0); self-host or cloud."}),A("td",{className:"px-4 py-3 align-top",children:"Open source; self-host via Docker or cloud."}),A("td",{className:"px-4 py-3 align-top",children:"Open source; self-host via Docker/Kubernetes"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Policy & personalisation"}),A("td",{className:"px-4 py-3 align-top",children:"No built-in policy engine; personalisation limited to user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No typed policy engine; customisation depends on user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No policy engine; personalisation via user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No policy engine; personalisation via RBAC & SSO"})]})]})]})})]}),kt("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"ContractSpec’s differences"}),kt("ul",{className:"space-y-2 text-muted-foreground",children:[kt("li",{children:[A("strong",{children:"Typed specifications"})," produce both the API and UI. You define capabilities, data views and workflows, and the compiler generates code, forms and screens—no manual widget wiring."]}),kt("li",{children:[A("strong",{children:"Policy enforcement"})," at run time ensures PII and ABAC rules across the entire app."]}),kt("li",{children:[A("strong",{children:"Overlay personalisation"})," allows tenants and users to change layouts safely without code."]}),kt("li",{children:[A("strong",{children:"Unified mobile/web runtime"})," means you don’t need separate builders for React Native vs web."]})]}),A("p",{className:"text-muted-foreground",children:"Internal-tool builders are useful for quick dashboards. ContractSpec extends this by generating the whole stack from specs and enforcing policies throughout."})]})]})}import{jsx as U,jsxs as za}from"react/jsx-runtime";function ql(){return za("div",{className:"space-y-8",children:[za("div",{className:"space-y-4",children:[U("h1",{className:"font-bold text-4xl",children:"Comparison overview"}),U("p",{className:"text-muted-foreground",children:"ContractSpec sits at the intersection of several tool categories. To appreciate its unique offering—typed specifications for back-end, front-end, workflows and policies with a unified web/mobile runtime—this section compares it to related products."}),za("p",{className:"text-muted-foreground",children:["ContractSpec uses ",U("strong",{children:"runtime adapters"})," to serve typed"," ",U("strong",{children:"Operations"})," (Commands/Queries),"," ",U("strong",{children:"DataViews"}),", ",U("strong",{children:"Workflows"}),", and"," ",U("strong",{children:"Policies"})," as REST/GraphQL/MCP endpoints. A"," ",U("strong",{children:"policy decision point"})," governs every operation, and"," ",U("strong",{children:"OverlaySpecs"})," allow non-technical users to personalise screens safely. Few competitors offer this combination of runtime type safety, policy enforcement, and end-user customisation."]})]}),za("div",{className:"space-y-4",children:[U("h2",{className:"font-bold text-2xl",children:"Tool categories"}),U("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:za("table",{className:"w-full text-left text-sm",children:[U("thead",{className:"bg-card/50",children:za("tr",{className:"border-border/50 border-b",children:[U("th",{className:"px-4 py-3 font-semibold",children:"Category"}),U("th",{className:"px-4 py-3 font-semibold",children:"Examples"}),U("th",{className:"px-4 py-3 font-semibold",children:"What they do"}),U("th",{className:"px-4 py-3 font-semibold",children:"Limitations"})]})}),za("tbody",{className:"divide-y divide-border/50",children:[za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Workflow engines"})}),U("td",{className:"px-4 py-3 align-top",children:"Prefect, Kestra, Temporal, Airflow, Dagster, Hatchet, Windmill"}),U("td",{className:"px-4 py-3 align-top",children:"Orchestrate code or data pipelines; handle retries, scheduling and observability"}),U("td",{className:"px-4 py-3 align-top",children:"Require writing code; no automatic UI generation or policy enforcement."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Internal-tool builders"})}),U("td",{className:"px-4 py-3 align-top",children:"Retool, Appsmith, ToolJet, Budibase"}),U("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop dashboards and admin panels; connect to databases/APIs"}),U("td",{className:"px-4 py-3 align-top",children:"No typed back-end spec; limited enforcement of policies; custom code glues logic."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Automation platforms"})}),U("td",{className:"px-4 py-3 align-top",children:"Zapier, Make, n8n, Pipedream"}),U("td",{className:"px-4 py-3 align-top",children:"Connect apps via triggers and actions; visual or low-code interfaces"}),U("td",{className:"px-4 py-3 align-top",children:"Automate tasks but do not generate full apps or enforce per-field policies."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Enterprise orchestrators"})}),U("td",{className:"px-4 py-3 align-top",children:"Redwood RunMyJobs"}),U("td",{className:"px-4 py-3 align-top",children:"Automate mission-critical workloads with self-service portals and SAP integrations"}),U("td",{className:"px-4 py-3 align-top",children:"Focus on IT workloads; not built for custom app creation or per-user customisation."})]})]})]})}),U("p",{className:"text-muted-foreground",children:"Use the pages below to explore each group in detail and see how ContractSpec compares."})]})]})}import{jsx as L,jsxs as Ue}from"react/jsx-runtime";function Vl(){return Ue("div",{className:"space-y-8",children:[Ue("div",{className:"space-y-4",children:[L("h1",{className:"font-bold text-4xl",children:"Windmill"}),Ue("p",{className:"text-muted-foreground",children:["Windmill is an open-source platform that turns"," ",L("strong",{children:"scripts"})," into endpoints, workflows and UIs. It seeks to remove boilerplate by generating interfaces and workflows around existing code"]})]}),Ue("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Platform features"}),Ue("ul",{className:"space-y-3 text-muted-foreground",children:[Ue("li",{children:[L("strong",{children:"Script-driven model."})," Write scripts in TypeScript, Python, Go, PHP, Bash, C#, SQL or Rust; Windmill infers dependencies, creates lockfiles and JSON schemas, then serves minimal UIs automatically"]}),Ue("li",{children:[L("strong",{children:"Visual flow editor."})," Compose scripts into workflows with retries, error handling, loops, branching, suspending flows and approval steps"]}),Ue("li",{children:[L("strong",{children:"Low-code UI builder."})," Build dashboards and admin panels using inline scripts and trigger flows from the UI"]}),Ue("li",{children:[L("strong",{children:"Enterprise readiness."})," Features include RBAC permissions, secret management, OAuth handling, CLI/git sync, scheduling and webhooks"]}),Ue("li",{children:[L("strong",{children:"Use cases."})," Deploy scripts as webhooks or cron jobs; create “applicative workflows” combining external APIs; build ETLs and interactive dashboards"]}),Ue("li",{children:[L("strong",{children:"Open source & self-hosting."})," Windmill emphasises an open-source codebase and self-hosting options"]})]})]}),Ue("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Comparison with ContractSpec"}),L("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:Ue("table",{className:"w-full text-left text-sm",children:[L("thead",{className:"bg-card/50",children:Ue("tr",{className:"border-border/50 border-b",children:[L("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),L("th",{className:"px-4 py-3 font-semibold",children:"Windmill"}),L("th",{className:"px-4 py-3 font-semibold",children:"ContractSpec"})]})}),Ue("tbody",{className:"divide-y divide-border/50",children:[Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Entry model"})}),L("td",{className:"px-4 py-3 align-top",children:"Write scripts; platform auto-generates UI and workflows"}),L("td",{className:"px-4 py-3 align-top",children:"Define typed specs (Capabilities, DataViews, Workflows, Policies); compiler outputs back-end, front-end and forms."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Language support"})}),L("td",{className:"px-4 py-3 align-top",children:"20+ languages via embedded runtimes"}),L("td",{className:"px-4 py-3 align-top",children:"Uses TypeScript/JavaScript for providers; supports other back-ends through capability providers."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"UI generation"})}),L("td",{className:"px-4 py-3 align-top",children:"Minimal UI forms from script parameters; low-code app builder"}),L("td",{className:"px-4 py-3 align-top",children:"Generates full web and mobile UIs from specs; user layouts can be customised via signed overlays."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Policy & personalization"})}),L("td",{className:"px-4 py-3 align-top",children:"RBAC and secret management; no per-user overlay concept"}),L("td",{className:"px-4 py-3 align-top",children:"Built-in policy engine enforcing ABAC/PII on every render/mutate; overlays allow safe per-user customisation."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Open source"})}),L("td",{className:"px-4 py-3 align-top",children:"Fully open source and self-hostable"}),L("td",{className:"px-4 py-3 align-top",children:"Closed-source core (SDK is open); offers hosted and on-prem modes."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Ideal for"})}),L("td",{className:"px-4 py-3 align-top",children:"Teams wanting to expose scripts as APIs, workflows or dashboards without heavy infrastructure."}),L("td",{className:"px-4 py-3 align-top",children:"Teams needing a spec-driven platform that generates code and UI, enforces policies and lets non-technical users tailor the experience."})]})]})]})}),Ue("p",{className:"text-muted-foreground",children:["Windmill excels at converting scripts into workflows and admin panels. ContractSpec takes a ",L("strong",{children:"spec-first"})," approach, generating the entire stack and enforcing policies, making it suitable for long-lived applications that must evolve safely."]})]})]})}import{jsx as l,jsxs as rt}from"react/jsx-runtime";function Fl(){return rt("div",{className:"space-y-8",children:[rt("div",{className:"space-y-4",children:[l("h1",{className:"font-bold text-4xl",children:"Workflow engines"}),l("p",{className:"text-muted-foreground",children:"Workflow engines orchestrate long-running tasks and data pipelines. They provide retries, scheduling and visibility, but most expect developers to write code and do not generate user interfaces. Here’s how the major engines compare to ContractSpec."})]}),rt("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Key differences summary"}),l("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:rt("table",{className:"w-full text-left text-sm",children:[l("thead",{className:"bg-card/50",children:rt("tr",{className:"border-border/50 border-b",children:[l("th",{className:"px-4 py-3 font-semibold",children:"Engine"}),l("th",{className:"px-4 py-3 font-semibold",children:"Core strengths"}),l("th",{className:"px-4 py-3 font-semibold",children:"UI generation?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Policy/PII enforcement?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Self-host?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Primary use"})]})}),rt("tbody",{className:"divide-y divide-border/50",children:[rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Prefect"})}),l("td",{className:"px-4 py-3 align-top",children:"Python-native; dynamic DAGs adapt to change; annotate code without rewriting; strong observability and audit logs"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data pipelines and dynamic workflows."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Kestra"})}),l("td",{className:"px-4 py-3 align-top",children:"Declarative YAML; event-driven triggers; mix of code and no-code; write logic in Python/R/Java/Julia/Ruby; deploy anywhere"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data pipelines and hybrid orchestration."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Temporal"})}),l("td",{className:"px-4 py-3 align-top",children:"Durable execution; workflows never lose state; multi-language SDKs; automatic retries"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Durable microservice and business workflows."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Airflow"})}),l("td",{className:"px-4 py-3 align-top",children:"Open-source; define workflows as Python code; schedule and monitor via UI; extensible via custom operators"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data ETL pipelines."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Dagster"})}),l("td",{className:"px-4 py-3 align-top",children:"Data-asset model; local testing and reusable components; built-in data quality and catalog; orchestrates AI/data pipelines across multiple tools"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data/AI pipelines with strong observability."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Hatchet"})}),l("td",{className:"px-4 py-3 align-top",children:"Modern engine focused on performance and durability; tasks and workflows as code; durable functions with guardrails and retries"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"High-throughput background jobs and microservices."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Windmill"})}),l("td",{className:"px-4 py-3 align-top",children:"Multi-language scripts; auto-generates UI; integrated flow editor"}),l("td",{className:"px-4 py-3 align-top",children:"Yes (basic)"}),l("td",{className:"px-4 py-3 align-top",children:"RBAC & secrets only"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Scripts into workflows and dashboards."})]})]})]})})]}),rt("div",{className:"space-y-3",children:[l("h2",{className:"font-bold text-2xl",children:"Why ContractSpec differs"}),rt("ul",{className:"space-y-2 text-muted-foreground",children:[rt("li",{children:[l("strong",{children:"Spec-first generation"})," – Instead of writing code, you define typed specs for capabilities, data views and workflows; the compiler outputs both back-end and front-end."]}),rt("li",{children:[l("strong",{children:"Policy engine"})," – Every render and mutate passes through an ABAC/PII policy decision point."]}),rt("li",{children:[l("strong",{children:"Personalisation"})," – Signed OverlaySpecs allow tenant/user-specific UI changes without touching code."]}),rt("li",{children:[l("strong",{children:"Unified runtime"})," – React/React-Native rendering ensures consistent experiences across web and mobile."]})]}),l("p",{className:"text-muted-foreground",children:"Workflow engines are excellent for orchestrating back-end tasks. ContractSpec builds on this by serving complete applications with runtime policy enforcement and user personalisation via TypeScript specs."})]})]})}import{CodeBlock as Kl}from"@contractspec/lib.design-system";import qr from"@contractspec/lib.ui-link";import{ChevronRight as Ql}from"lucide-react";import{jsx as Qt,jsxs as Uo}from"react/jsx-runtime";function Yl(){return Uo("div",{className:"space-y-8",children:[Uo("div",{className:"space-y-3",children:[Qt("h1",{className:"font-bold text-4xl",children:"Integrations"}),Qt("p",{className:"text-lg text-muted-foreground",children:"Reference integrations show how to extend ContractSpec with real-world adapters and generators."})]}),Uo("div",{className:"card-subtle space-y-4 p-6",children:[Qt("h2",{className:"font-bold text-2xl",children:"Reference plugin"}),Qt("p",{className:"text-muted-foreground text-sm",children:"The example markdown generator plugin ships as a working reference implementation."}),Qt(Kl,{language:"bash",filename:"install-example",code:`bun add @contractspec/lib.plugin.example-generator
670
+ };`}),ot("p",{className:"mt-2 text-muted-foreground",children:"This allows you to customize feature flags, integration connections, and knowledge sources per tenant without changing the application code."})]}),At("div",{className:"flex items-center gap-4 pt-4",children:[ot(qr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),At(qr,{href:"/docs/libraries/multi-tenancy",className:"btn-primary",children:["Multi-Tenancy Library ",ot(Ml,{size:16})]})]})]})}import Zo from"@contractspec/lib.ui-link";import{jsx as Be,jsxs as Kt}from"react/jsx-runtime";var Ul=[{title:"Contracts and schemas",body:"Explicit specs define the durable boundary for behavior, data, and governance."},{title:"Bindings and configuration",body:"Apps, tenants, integrations, and knowledge sources are wired through explicit configuration instead of hidden glue."},{title:"Runtimes and generators",body:"Serve or generate aligned surfaces for API, UI, workflows, docs, and agent-facing interfaces."},{title:"Operate and observe",body:"Carry auditability, policy, tracing, migrations, and tenant isolation through the same model."}];function Wl(){return Kt("div",{className:"space-y-10",children:[Kt("div",{className:"space-y-3",children:[Be("p",{className:"editorial-kicker",children:"Build"}),Be("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The architecture keeps contracts, runtime behavior, and operations in the same system."}),Be("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is not a single runtime. It is a layered system that lets you define explicit boundaries, bind real-world configuration, and then serve or generate aligned surfaces without losing control of the output."})]}),Be("div",{className:"grid gap-4 md:grid-cols-2",children:Ul.map((e)=>Kt("article",{className:"editorial-panel space-y-3",children:[Be("h2",{className:"font-semibold text-xl",children:e.title}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),Kt("section",{className:"editorial-panel space-y-5",children:[Kt("div",{className:"space-y-2",children:[Be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"UI composition belongs in the bundle runtime layer"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"When the system needs adaptive layouts, entity workbenches, assistant slots, and safe overlays, use module bundles as the layer between the contract model and the rendered surface."})]}),Kt("div",{className:"grid gap-4 md:grid-cols-2",children:[Kt(Zo,{href:"/docs/specs/module-bundles",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Module bundles spec"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"See the typed bundle contract, resolved surface plan model, and bounded AI/runtime behavior."})]}),Kt(Zo,{href:"/docs/guides/first-module-bundle",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Build a first module bundle"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"Follow the route-to-plan-to-render path with one practical host example."})]})]})]}),Kt("section",{className:"editorial-panel space-y-5",children:[Kt("div",{className:"space-y-2",children:[Be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Follow the architecture by responsibility"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"Use the architecture pages when you need to understand how the pieces snap together in a real deployment."})]}),Kt("div",{className:"grid gap-4 md:grid-cols-2",children:[Kt(Zo,{href:"/docs/architecture/app-config",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"App configuration"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How blueprint-level and tenant-level config stay explicit and merge safely."})]}),Kt(Zo,{href:"/docs/architecture/integration-binding",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Integration binding"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How apps connect to tenant-owned integrations without leaking provider logic everywhere."})]}),Kt(Zo,{href:"/docs/architecture/knowledge-binding",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Knowledge binding"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How trusted knowledge enters the system and stays isolated by context and tenant."})]}),Kt(Zo,{href:"/docs/architecture/control-plane",className:"docs-footer-link",children:[Be("h3",{className:"font-semibold text-lg",children:"Control plane runtime"}),Be("p",{className:"text-muted-foreground text-sm leading-7",children:"How intent, policy, planning, and execution flow through the system runtime."})]})]})]})]})}import{jsx as T,jsxs as wt}from"react/jsx-runtime";function _l(){return wt("div",{className:"space-y-8",children:[wt("div",{className:"space-y-4",children:[T("h1",{className:"font-bold text-4xl",children:"Automation platforms"}),T("p",{className:"text-muted-foreground",children:"Automation platforms connect apps and automate tasks through triggers and actions. They serve operations and non-technical users well but stop short of generating full applications or enforcing fine-grained policies."})]}),wt("div",{className:"space-y-4",children:[T("h2",{className:"font-bold text-2xl",children:"Feature comparison"}),T("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:wt("table",{className:"w-full text-left text-sm",children:[T("thead",{className:"bg-card/50",children:wt("tr",{className:"border-border/50 border-b",children:[T("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),T("th",{className:"px-4 py-3 font-semibold",children:"Zapier"}),T("th",{className:"px-4 py-3 font-semibold",children:"Make (Integromat)"}),T("th",{className:"px-4 py-3 font-semibold",children:"n8n"}),T("th",{className:"px-4 py-3 font-semibold",children:"Pipedream"})]})}),wt("tbody",{className:"divide-y divide-border/50",children:[wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Workflow model"}),T("td",{className:"px-4 py-3 align-top",children:"Zaps: trigger + one or more actions"}),T("td",{className:"px-4 py-3 align-top",children:"Real-time visual orchestration for AI agents and automations"}),T("td",{className:"px-4 py-3 align-top",children:"Node-based workflow builder with drag-and-drop and code; build multi-step AI agents"}),T("td",{className:"px-4 py-3 align-top",children:"Workflows connect any API; Pipedream Connect SDK adds integrations quickly"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Visual builder?"}),T("td",{className:"px-4 py-3 align-top",children:"Yes (simple; web-based)."}),T("td",{className:"px-4 py-3 align-top",children:"Yes; AI-assisted editor"}),T("td",{className:"px-4 py-3 align-top",children:"Yes; visual canvas."}),T("td",{className:"px-4 py-3 align-top",children:"Code-centric editor; no visual UI builder"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Self-host?"}),T("td",{className:"px-4 py-3 align-top",children:"No (cloud only)."}),T("td",{className:"px-4 py-3 align-top",children:"Cloud only."}),T("td",{className:"px-4 py-3 align-top",children:"Yes (Docker, self-host)"}),T("td",{className:"px-4 py-3 align-top",children:"Cloud only (hosted)."})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Integrations & AI"}),T("td",{className:"px-4 py-3 align-top",children:"Connects almost 8 000 apps; limited AI features."}),T("td",{className:"px-4 py-3 align-top",children:"3 000+ pre-built apps; supports GenAI tools; GDPR/SOC2 and SSO"}),T("td",{className:"px-4 py-3 align-top",children:"Integrates LLMs; allows JS or Python code and library imports; chatbots with Slack/Teams"}),T("td",{className:"px-4 py-3 align-top",children:"MCP servers add 3 000+ APIs and 10 000+ tools to agents; AI agent builder prompts and deploys agents; SOC 2/ HIPAA/GDPR compliant"})]}),wt("tr",{children:[T("td",{className:"px-4 py-3 align-top font-semibold",children:"Policy & UI generation"}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate user interfaces."}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate UIs beyond a workflow dashboard."}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; no UI builder"}),T("td",{className:"px-4 py-3 align-top",children:"No policy engine; does not generate UI."})]})]})]})})]}),wt("div",{className:"space-y-3",children:[T("h2",{className:"font-bold text-2xl",children:"Why ContractSpec differs"}),wt("ul",{className:"space-y-2 text-muted-foreground",children:[wt("li",{children:[T("strong",{children:"Full application generation"})," – ContractSpec compiles specs into back-end, events and user interfaces for both web and mobile."]}),wt("li",{children:[T("strong",{children:"Policy enforcement"})," – A built-in policy engine governs PII access and mutations across the UI."]}),wt("li",{children:[T("strong",{children:"Customisation via overlays"})," – Non-technical users can safely personalise layouts while respecting policies."]}),wt("li",{children:[T("strong",{children:"Extensible capabilities"})," – Connect to external APIs and services via capability providers while maintaining type safety."]})]}),T("p",{className:"text-muted-foreground",children:"Automation tools simplify integrations and tasks; ContractSpec goes further by generating a complete, policy-safe application around your data and processes."})]})]})}import zl from"@contractspec/lib.ui-link";import{jsx as W,jsxs as it}from"react/jsx-runtime";function Gl(){return it("div",{className:"space-y-8",children:[it("div",{className:"space-y-4",children:[W("h1",{className:"font-bold text-4xl",children:"Enterprise orchestration platforms"}),W("p",{className:"text-muted-foreground",children:"Enterprise orchestration platforms manage mission-critical workloads and integrate deeply with ERP systems. They prioritise governance, reliability and compliance, but they do not provide spec-driven app generation or per-user customisation."})]}),it("div",{className:"space-y-4",children:[W("h2",{className:"font-bold text-2xl",children:"Redwood RunMyJobs"}),it("p",{className:"text-muted-foreground",children:[W(zl,{href:"https://www.redwood.com/workload-automation/",className:"underline decoration-dotted underline-offset-4 hover:text-foreground",target:"_blank",rel:"noreferrer",children:"RunMyJobs by Redwood"})," ","is a cloud-native service orchestration and automation platform. Key attributes include:"]}),it("ul",{className:"space-y-2 text-muted-foreground",children:[it("li",{children:[W("strong",{children:"Self-service portal."})," Business users can run and customise workloads while IT ensures governance and compliance"]}),it("li",{children:[W("strong",{children:"Full-stack orchestration."})," Integrates with both SAP and non-SAP systems; Redwood is recognised as a Leader in Gartner’s Magic Quadrant for service orchestration"]}),it("li",{children:[W("strong",{children:"Observability and AI insights."})," Dashboards and AI-enhanced analytics identify bottlenecks and forecast issues"]}),it("li",{children:[W("strong",{children:"Deep SAP integration."})," Supports SAP’s latest technologies and orchestrates mission-critical business processes"]}),it("li",{children:[W("strong",{children:"Connectors & wizard."})," Provides pre-built connectors and a wizard to link on-prem and cloud systems"]})]})]}),it("div",{className:"space-y-4",children:[W("h3",{className:"font-semibold text-xl",children:"Comparison with ContractSpec"}),W("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:it("table",{className:"w-full text-left text-sm",children:[W("thead",{className:"bg-card/50",children:it("tr",{className:"border-border/50 border-b",children:[W("th",{className:"px-4 py-3 font-semibold",children:"Aspect"}),W("th",{className:"px-4 py-3 font-semibold",children:"RunMyJobs"}),W("th",{className:"px-4 py-3 font-semibold",children:"ContractSpec"})]})}),it("tbody",{className:"divide-y divide-border/50",children:[it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Target user"})}),W("td",{className:"px-4 py-3 align-top",children:"Enterprise IT and operations teams automating SAP and mission-critical workflows."}),W("td",{className:"px-4 py-3 align-top",children:"Developers, product teams and SMBs wanting to generate policy-safe apps with customisable UIs."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Workload focus"})}),W("td",{className:"px-4 py-3 align-top",children:"Service orchestration and job scheduling across ERP/legacy systems"}),W("td",{className:"px-4 py-3 align-top",children:"End-to-end application generation with back-end, UI and policies."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"User interface"})}),W("td",{className:"px-4 py-3 align-top",children:"Self-service portal to run/monitor jobs; no custom UI generation for new apps."}),W("td",{className:"px-4 py-3 align-top",children:"Generates React/React-Native UIs from specs; users can personalise layout via overlays."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Open source"})}),W("td",{className:"px-4 py-3 align-top",children:"Proprietary SaaS; enterprise agreements."}),W("td",{className:"px-4 py-3 align-top",children:"Core compiler is proprietary; SDK and certain modules may be open-source; offers hosted and on-prem options."})]}),it("tr",{children:[W("td",{className:"px-4 py-3 align-top",children:W("strong",{children:"Policy & personalisation"})}),W("td",{className:"px-4 py-3 align-top",children:"IT controls governance; no per-user overlay concept."}),W("td",{className:"px-4 py-3 align-top",children:"Built-in policy engine and per-user overlays for safe personalisation."})]})]})]})}),W("p",{className:"text-muted-foreground",children:"Redwood RunMyJobs is designed for orchestrating enterprise workloads and SAP processes. ContractSpec targets a different problem: generating complete applications from typed specs and letting end users adapt them safely."})]})]})}import{jsx as A,jsxs as kt}from"react/jsx-runtime";function ql(){return kt("div",{className:"space-y-8",children:[kt("div",{className:"space-y-4",children:[A("h1",{className:"font-bold text-4xl",children:"Internal-tool builders"}),A("p",{className:"text-muted-foreground",children:"Internal-tool builders let teams quickly assemble dashboards and admin panels. These platforms often provide drag-and-drop UIs and connectors to databases and APIs, but they rely on developers to write custom code for business logic and seldom enforce policies across surfaces."})]}),kt("div",{className:"space-y-4",children:[A("h2",{className:"font-bold text-2xl",children:"Feature comparison"}),A("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:kt("table",{className:"w-full text-left text-sm",children:[A("thead",{className:"bg-card/50",children:kt("tr",{className:"border-border/50 border-b",children:[A("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),A("th",{className:"px-4 py-3 font-semibold",children:"Retool"}),A("th",{className:"px-4 py-3 font-semibold",children:"Appsmith"}),A("th",{className:"px-4 py-3 font-semibold",children:"ToolJet"}),A("th",{className:"px-4 py-3 font-semibold",children:"Budibase"})]})}),kt("tbody",{className:"divide-y divide-border/50",children:[kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"UI builder"}),A("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop canvas; shape UI components easily"}),A("td",{className:"px-4 py-3 align-top",children:"Visual builder with drag-and-drop widgets"}),A("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop UI widgets (tables, charts, forms)"}),A("td",{className:"px-4 py-3 align-top",children:"Pre-built components and templates for mobile/desktop"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Custom code & logic"}),A("td",{className:"px-4 py-3 align-top",children:"Full code insertion anywhere via IDE"}),A("td",{className:"px-4 py-3 align-top",children:"Logic via JavaScript or natural-language prompts in a central IDE"}),A("td",{className:"px-4 py-3 align-top",children:"Supports business logic in JavaScript or Python queries"}),A("td",{className:"px-4 py-3 align-top",children:"Custom logic via JavaScript; plugins and external embeds"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Data connectors"}),A("td",{className:"px-4 py-3 align-top",children:"Wide support for databases and APIs (PostgreSQL, MongoDB, GraphQL, etc.)."}),A("td",{className:"px-4 py-3 align-top",children:"Connects to LLMs and databases"}),A("td",{className:"px-4 py-3 align-top",children:"Built-in database; connects to PostgreSQL, MongoDB, APIs, GraphQL, SaaS"}),A("td",{className:"px-4 py-3 align-top",children:"Connects to external databases, REST, CSV or built-in DB"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Open source & self-host"}),A("td",{className:"px-4 py-3 align-top",children:"Proprietary; cloud or on-prem subscription."}),A("td",{className:"px-4 py-3 align-top",children:"Open source (Apache-2.0); self-host or cloud."}),A("td",{className:"px-4 py-3 align-top",children:"Open source; self-host via Docker or cloud."}),A("td",{className:"px-4 py-3 align-top",children:"Open source; self-host via Docker/Kubernetes"})]}),kt("tr",{children:[A("td",{className:"px-4 py-3 align-top font-semibold",children:"Policy & personalisation"}),A("td",{className:"px-4 py-3 align-top",children:"No built-in policy engine; personalisation limited to user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No typed policy engine; customisation depends on user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No policy engine; personalisation via user roles."}),A("td",{className:"px-4 py-3 align-top",children:"No policy engine; personalisation via RBAC & SSO"})]})]})]})})]}),kt("div",{className:"space-y-3",children:[A("h2",{className:"font-bold text-2xl",children:"ContractSpec’s differences"}),kt("ul",{className:"space-y-2 text-muted-foreground",children:[kt("li",{children:[A("strong",{children:"Typed specifications"})," produce both the API and UI. You define capabilities, data views and workflows, and the compiler generates code, forms and screens—no manual widget wiring."]}),kt("li",{children:[A("strong",{children:"Policy enforcement"})," at run time ensures PII and ABAC rules across the entire app."]}),kt("li",{children:[A("strong",{children:"Overlay personalisation"})," allows tenants and users to change layouts safely without code."]}),kt("li",{children:[A("strong",{children:"Unified mobile/web runtime"})," means you don’t need separate builders for React Native vs web."]})]}),A("p",{className:"text-muted-foreground",children:"Internal-tool builders are useful for quick dashboards. ContractSpec extends this by generating the whole stack from specs and enforcing policies throughout."})]})]})}import{jsx as U,jsxs as za}from"react/jsx-runtime";function Vl(){return za("div",{className:"space-y-8",children:[za("div",{className:"space-y-4",children:[U("h1",{className:"font-bold text-4xl",children:"Comparison overview"}),U("p",{className:"text-muted-foreground",children:"ContractSpec sits at the intersection of several tool categories. To appreciate its unique offering—typed specifications for back-end, front-end, workflows and policies with a unified web/mobile runtime—this section compares it to related products."}),za("p",{className:"text-muted-foreground",children:["ContractSpec uses ",U("strong",{children:"runtime adapters"})," to serve typed"," ",U("strong",{children:"Operations"})," (Commands/Queries),"," ",U("strong",{children:"DataViews"}),", ",U("strong",{children:"Workflows"}),", and"," ",U("strong",{children:"Policies"})," as REST/GraphQL/MCP endpoints. A"," ",U("strong",{children:"policy decision point"})," governs every operation, and"," ",U("strong",{children:"OverlaySpecs"})," allow non-technical users to personalise screens safely. Few competitors offer this combination of runtime type safety, policy enforcement, and end-user customisation."]})]}),za("div",{className:"space-y-4",children:[U("h2",{className:"font-bold text-2xl",children:"Tool categories"}),U("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:za("table",{className:"w-full text-left text-sm",children:[U("thead",{className:"bg-card/50",children:za("tr",{className:"border-border/50 border-b",children:[U("th",{className:"px-4 py-3 font-semibold",children:"Category"}),U("th",{className:"px-4 py-3 font-semibold",children:"Examples"}),U("th",{className:"px-4 py-3 font-semibold",children:"What they do"}),U("th",{className:"px-4 py-3 font-semibold",children:"Limitations"})]})}),za("tbody",{className:"divide-y divide-border/50",children:[za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Workflow engines"})}),U("td",{className:"px-4 py-3 align-top",children:"Prefect, Kestra, Temporal, Airflow, Dagster, Hatchet, Windmill"}),U("td",{className:"px-4 py-3 align-top",children:"Orchestrate code or data pipelines; handle retries, scheduling and observability"}),U("td",{className:"px-4 py-3 align-top",children:"Require writing code; no automatic UI generation or policy enforcement."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Internal-tool builders"})}),U("td",{className:"px-4 py-3 align-top",children:"Retool, Appsmith, ToolJet, Budibase"}),U("td",{className:"px-4 py-3 align-top",children:"Drag-and-drop dashboards and admin panels; connect to databases/APIs"}),U("td",{className:"px-4 py-3 align-top",children:"No typed back-end spec; limited enforcement of policies; custom code glues logic."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Automation platforms"})}),U("td",{className:"px-4 py-3 align-top",children:"Zapier, Make, n8n, Pipedream"}),U("td",{className:"px-4 py-3 align-top",children:"Connect apps via triggers and actions; visual or low-code interfaces"}),U("td",{className:"px-4 py-3 align-top",children:"Automate tasks but do not generate full apps or enforce per-field policies."})]}),za("tr",{children:[U("td",{className:"px-4 py-3 align-top",children:U("strong",{children:"Enterprise orchestrators"})}),U("td",{className:"px-4 py-3 align-top",children:"Redwood RunMyJobs"}),U("td",{className:"px-4 py-3 align-top",children:"Automate mission-critical workloads with self-service portals and SAP integrations"}),U("td",{className:"px-4 py-3 align-top",children:"Focus on IT workloads; not built for custom app creation or per-user customisation."})]})]})]})}),U("p",{className:"text-muted-foreground",children:"Use the pages below to explore each group in detail and see how ContractSpec compares."})]})]})}import{jsx as L,jsxs as Ue}from"react/jsx-runtime";function Hl(){return Ue("div",{className:"space-y-8",children:[Ue("div",{className:"space-y-4",children:[L("h1",{className:"font-bold text-4xl",children:"Windmill"}),Ue("p",{className:"text-muted-foreground",children:["Windmill is an open-source platform that turns"," ",L("strong",{children:"scripts"})," into endpoints, workflows and UIs. It seeks to remove boilerplate by generating interfaces and workflows around existing code"]})]}),Ue("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Platform features"}),Ue("ul",{className:"space-y-3 text-muted-foreground",children:[Ue("li",{children:[L("strong",{children:"Script-driven model."})," Write scripts in TypeScript, Python, Go, PHP, Bash, C#, SQL or Rust; Windmill infers dependencies, creates lockfiles and JSON schemas, then serves minimal UIs automatically"]}),Ue("li",{children:[L("strong",{children:"Visual flow editor."})," Compose scripts into workflows with retries, error handling, loops, branching, suspending flows and approval steps"]}),Ue("li",{children:[L("strong",{children:"Low-code UI builder."})," Build dashboards and admin panels using inline scripts and trigger flows from the UI"]}),Ue("li",{children:[L("strong",{children:"Enterprise readiness."})," Features include RBAC permissions, secret management, OAuth handling, CLI/git sync, scheduling and webhooks"]}),Ue("li",{children:[L("strong",{children:"Use cases."})," Deploy scripts as webhooks or cron jobs; create “applicative workflows” combining external APIs; build ETLs and interactive dashboards"]}),Ue("li",{children:[L("strong",{children:"Open source & self-hosting."})," Windmill emphasises an open-source codebase and self-hosting options"]})]})]}),Ue("div",{className:"space-y-4",children:[L("h2",{className:"font-bold text-2xl",children:"Comparison with ContractSpec"}),L("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:Ue("table",{className:"w-full text-left text-sm",children:[L("thead",{className:"bg-card/50",children:Ue("tr",{className:"border-border/50 border-b",children:[L("th",{className:"px-4 py-3 font-semibold",children:"Feature"}),L("th",{className:"px-4 py-3 font-semibold",children:"Windmill"}),L("th",{className:"px-4 py-3 font-semibold",children:"ContractSpec"})]})}),Ue("tbody",{className:"divide-y divide-border/50",children:[Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Entry model"})}),L("td",{className:"px-4 py-3 align-top",children:"Write scripts; platform auto-generates UI and workflows"}),L("td",{className:"px-4 py-3 align-top",children:"Define typed specs (Capabilities, DataViews, Workflows, Policies); compiler outputs back-end, front-end and forms."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Language support"})}),L("td",{className:"px-4 py-3 align-top",children:"20+ languages via embedded runtimes"}),L("td",{className:"px-4 py-3 align-top",children:"Uses TypeScript/JavaScript for providers; supports other back-ends through capability providers."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"UI generation"})}),L("td",{className:"px-4 py-3 align-top",children:"Minimal UI forms from script parameters; low-code app builder"}),L("td",{className:"px-4 py-3 align-top",children:"Generates full web and mobile UIs from specs; user layouts can be customised via signed overlays."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Policy & personalization"})}),L("td",{className:"px-4 py-3 align-top",children:"RBAC and secret management; no per-user overlay concept"}),L("td",{className:"px-4 py-3 align-top",children:"Built-in policy engine enforcing ABAC/PII on every render/mutate; overlays allow safe per-user customisation."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Open source"})}),L("td",{className:"px-4 py-3 align-top",children:"Fully open source and self-hostable"}),L("td",{className:"px-4 py-3 align-top",children:"Closed-source core (SDK is open); offers hosted and on-prem modes."})]}),Ue("tr",{children:[L("td",{className:"px-4 py-3 align-top",children:L("strong",{children:"Ideal for"})}),L("td",{className:"px-4 py-3 align-top",children:"Teams wanting to expose scripts as APIs, workflows or dashboards without heavy infrastructure."}),L("td",{className:"px-4 py-3 align-top",children:"Teams needing a spec-driven platform that generates code and UI, enforces policies and lets non-technical users tailor the experience."})]})]})]})}),Ue("p",{className:"text-muted-foreground",children:["Windmill excels at converting scripts into workflows and admin panels. ContractSpec takes a ",L("strong",{children:"spec-first"})," approach, generating the entire stack and enforcing policies, making it suitable for long-lived applications that must evolve safely."]})]})]})}import{jsx as l,jsxs as rt}from"react/jsx-runtime";function Fl(){return rt("div",{className:"space-y-8",children:[rt("div",{className:"space-y-4",children:[l("h1",{className:"font-bold text-4xl",children:"Workflow engines"}),l("p",{className:"text-muted-foreground",children:"Workflow engines orchestrate long-running tasks and data pipelines. They provide retries, scheduling and visibility, but most expect developers to write code and do not generate user interfaces. Here’s how the major engines compare to ContractSpec."})]}),rt("div",{className:"space-y-4",children:[l("h2",{className:"font-bold text-2xl",children:"Key differences summary"}),l("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:rt("table",{className:"w-full text-left text-sm",children:[l("thead",{className:"bg-card/50",children:rt("tr",{className:"border-border/50 border-b",children:[l("th",{className:"px-4 py-3 font-semibold",children:"Engine"}),l("th",{className:"px-4 py-3 font-semibold",children:"Core strengths"}),l("th",{className:"px-4 py-3 font-semibold",children:"UI generation?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Policy/PII enforcement?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Self-host?"}),l("th",{className:"px-4 py-3 font-semibold",children:"Primary use"})]})}),rt("tbody",{className:"divide-y divide-border/50",children:[rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Prefect"})}),l("td",{className:"px-4 py-3 align-top",children:"Python-native; dynamic DAGs adapt to change; annotate code without rewriting; strong observability and audit logs"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data pipelines and dynamic workflows."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Kestra"})}),l("td",{className:"px-4 py-3 align-top",children:"Declarative YAML; event-driven triggers; mix of code and no-code; write logic in Python/R/Java/Julia/Ruby; deploy anywhere"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data pipelines and hybrid orchestration."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Temporal"})}),l("td",{className:"px-4 py-3 align-top",children:"Durable execution; workflows never lose state; multi-language SDKs; automatic retries"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Durable microservice and business workflows."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Airflow"})}),l("td",{className:"px-4 py-3 align-top",children:"Open-source; define workflows as Python code; schedule and monitor via UI; extensible via custom operators"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data ETL pipelines."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Dagster"})}),l("td",{className:"px-4 py-3 align-top",children:"Data-asset model; local testing and reusable components; built-in data quality and catalog; orchestrates AI/data pipelines across multiple tools"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Data/AI pipelines with strong observability."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Hatchet"})}),l("td",{className:"px-4 py-3 align-top",children:"Modern engine focused on performance and durability; tasks and workflows as code; durable functions with guardrails and retries"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"No"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"High-throughput background jobs and microservices."})]}),rt("tr",{children:[l("td",{className:"px-4 py-3 align-top",children:l("strong",{children:"Windmill"})}),l("td",{className:"px-4 py-3 align-top",children:"Multi-language scripts; auto-generates UI; integrated flow editor"}),l("td",{className:"px-4 py-3 align-top",children:"Yes (basic)"}),l("td",{className:"px-4 py-3 align-top",children:"RBAC & secrets only"}),l("td",{className:"px-4 py-3 align-top",children:"Yes"}),l("td",{className:"px-4 py-3 align-top",children:"Scripts into workflows and dashboards."})]})]})]})})]}),rt("div",{className:"space-y-3",children:[l("h2",{className:"font-bold text-2xl",children:"Why ContractSpec differs"}),rt("ul",{className:"space-y-2 text-muted-foreground",children:[rt("li",{children:[l("strong",{children:"Spec-first generation"})," – Instead of writing code, you define typed specs for capabilities, data views and workflows; the compiler outputs both back-end and front-end."]}),rt("li",{children:[l("strong",{children:"Policy engine"})," – Every render and mutate passes through an ABAC/PII policy decision point."]}),rt("li",{children:[l("strong",{children:"Personalisation"})," – Signed OverlaySpecs allow tenant/user-specific UI changes without touching code."]}),rt("li",{children:[l("strong",{children:"Unified runtime"})," – React/React-Native rendering ensures consistent experiences across web and mobile."]})]}),l("p",{className:"text-muted-foreground",children:"Workflow engines are excellent for orchestrating back-end tasks. ContractSpec builds on this by serving complete applications with runtime policy enforcement and user personalisation via TypeScript specs."})]})]})}import{CodeBlock as Kl}from"@contractspec/lib.design-system";import Vr from"@contractspec/lib.ui-link";import{ChevronRight as Ql}from"lucide-react";import{jsx as Qt,jsxs as Uo}from"react/jsx-runtime";function Yl(){return Uo("div",{className:"space-y-8",children:[Uo("div",{className:"space-y-3",children:[Qt("h1",{className:"font-bold text-4xl",children:"Integrations"}),Qt("p",{className:"text-lg text-muted-foreground",children:"Reference integrations show how to extend ContractSpec with real-world adapters and generators."})]}),Uo("div",{className:"card-subtle space-y-4 p-6",children:[Qt("h2",{className:"font-bold text-2xl",children:"Reference plugin"}),Qt("p",{className:"text-muted-foreground text-sm",children:"The example markdown generator plugin ships as a working reference implementation."}),Qt(Kl,{language:"bash",filename:"install-example",code:`bun add @contractspec/lib.plugin.example-generator
671
671
 
672
672
  # Or in a workspace
673
- bun add -D @contractspec/lib.plugin.example-generator`})]}),Uo("div",{className:"card-subtle space-y-4 p-6",children:[Qt("h2",{className:"font-bold text-2xl",children:"Providers and adapters"}),Uo("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Qt("li",{children:"Payments: Stripe"}),Qt("li",{children:"Email: Postmark, Gmail"}),Qt("li",{children:"AI: OpenAI, Mistral"}),Qt("li",{children:"Voice: ElevenLabs, Mistral"}),Qt("li",{children:"Vector DB: Qdrant"}),Qt("li",{children:"Storage: GCS"})]}),Qt("p",{className:"text-muted-foreground text-sm",children:"Use provider modules as inspiration for adapter plugins."})]}),Uo("div",{className:"flex items-center gap-4 pt-4",children:[Uo(qr,{href:"/docs/ecosystem/registry",className:"btn-primary",children:["Marketplace manifest ",Qt(Ql,{size:16})]}),Qt(qr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Authoring templates"})]})]})}import{CodeBlock as qi}from"@contractspec/lib.design-system";import Vr from"@contractspec/lib.ui-link";import{ChevronRight as Jl}from"lucide-react";import{jsx as Ae,jsxs as Yt}from"react/jsx-runtime";function Zl(){return Yt("div",{className:"space-y-8",children:[Yt("div",{className:"space-y-3",children:[Ae("h1",{className:"font-bold text-4xl",children:"Cursor marketplace plugins"}),Ae("p",{className:"text-lg text-muted-foreground",children:"ContractSpec ships a focused Cursor marketplace catalog for the product and key libraries."})]}),Yt("div",{className:"card-subtle space-y-4 p-6",children:[Ae("h2",{className:"font-bold text-2xl",children:"Catalog at a glance"}),Yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Yt("li",{children:[Ae("code",{children:"contractspec"})," - Product-level workflow and release guardrails."]}),Yt("li",{children:[Ae("code",{children:"contractspec-contracts-spec"})," -",Ae("code",{children:"@contractspec/lib.contracts-spec"})," governance."]}),Yt("li",{children:[Ae("code",{children:"contractspec-contracts-integrations"})," -",Ae("code",{children:"@contractspec/lib.contracts-integrations"})," governance."]}),Yt("li",{children:[Ae("code",{children:"contractspec-ai-agent"})," -",Ae("code",{children:"@contractspec/lib.ai-agent"})," orchestration guardrails."]})]})]}),Yt("div",{className:"space-y-6",children:[Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Where plugin sources live"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Marketplace plugin artifacts are kept in a dedicated package, while the canonical reusable source lives in agentpacks under `packs/`."}),Ae(qi,{language:"text",filename:"catalog-layout",code:`packages/apps-registry/cursor-marketplace/
673
+ bun add -D @contractspec/lib.plugin.example-generator`})]}),Uo("div",{className:"card-subtle space-y-4 p-6",children:[Qt("h2",{className:"font-bold text-2xl",children:"Providers and adapters"}),Uo("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Qt("li",{children:"Payments: Stripe"}),Qt("li",{children:"Email: Postmark, Gmail"}),Qt("li",{children:"AI: OpenAI, Mistral"}),Qt("li",{children:"Voice: ElevenLabs, Mistral"}),Qt("li",{children:"Vector DB: Qdrant"}),Qt("li",{children:"Storage: GCS"})]}),Qt("p",{className:"text-muted-foreground text-sm",children:"Use provider modules as inspiration for adapter plugins."})]}),Uo("div",{className:"flex items-center gap-4 pt-4",children:[Uo(Vr,{href:"/docs/ecosystem/registry",className:"btn-primary",children:["Marketplace manifest ",Qt(Ql,{size:16})]}),Qt(Vr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Authoring templates"})]})]})}import{CodeBlock as Vi}from"@contractspec/lib.design-system";import Hr from"@contractspec/lib.ui-link";import{ChevronRight as Jl}from"lucide-react";import{jsx as Ae,jsxs as Yt}from"react/jsx-runtime";function Zl(){return Yt("div",{className:"space-y-8",children:[Yt("div",{className:"space-y-3",children:[Ae("h1",{className:"font-bold text-4xl",children:"Cursor marketplace plugins"}),Ae("p",{className:"text-lg text-muted-foreground",children:"ContractSpec ships a focused Cursor marketplace catalog for the product and key libraries."})]}),Yt("div",{className:"card-subtle space-y-4 p-6",children:[Ae("h2",{className:"font-bold text-2xl",children:"Catalog at a glance"}),Yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Yt("li",{children:[Ae("code",{children:"contractspec"})," - Product-level workflow and release guardrails."]}),Yt("li",{children:[Ae("code",{children:"contractspec-contracts-spec"})," -",Ae("code",{children:"@contractspec/lib.contracts-spec"})," governance."]}),Yt("li",{children:[Ae("code",{children:"contractspec-contracts-integrations"})," -",Ae("code",{children:"@contractspec/lib.contracts-integrations"})," governance."]}),Yt("li",{children:[Ae("code",{children:"contractspec-ai-agent"})," -",Ae("code",{children:"@contractspec/lib.ai-agent"})," orchestration guardrails."]})]})]}),Yt("div",{className:"space-y-6",children:[Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Where plugin sources live"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Marketplace plugin artifacts are kept in a dedicated package, while the canonical reusable source lives in agentpacks under `packs/`."}),Ae(Vi,{language:"text",filename:"catalog-layout",code:`packages/apps-registry/cursor-marketplace/
674
674
  .cursor-plugin/marketplace.json
675
675
  plugins/
676
676
  contractspec/
@@ -679,7 +679,7 @@ bun add -D @contractspec/lib.plugin.example-generator`})]}),Uo("div",{className:
679
679
  contractspec-ai-agent/
680
680
 
681
681
  packs/
682
- contractspec-contracts-spec/`})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Root marketplace manifest"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Cursor submission reads the catalog manifest inside the marketplace package and resolves plugin paths relative to that package."}),Ae(qi,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
682
+ contractspec-contracts-spec/`})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Root marketplace manifest"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Cursor submission reads the catalog manifest inside the marketplace package and resolves plugin paths relative to that package."}),Ae(Vi,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
683
683
  "name": "contractspec-marketplace",
684
684
  "owner": { "name": "ContractSpec Team" },
685
685
  "plugins": [
@@ -700,10 +700,10 @@ packs/
700
700
  "source": "plugins/contractspec-ai-agent"
701
701
  }
702
702
  ]
703
- }`})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Generated multi-host system"}),Ae("p",{className:"text-muted-foreground text-sm",children:"The Cursor plugin is publishable metadata only. Customer-facing Cursor, Claude Code, and Codex outputs are generated from the same pack source with hook and MCP delivery."})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Validation gate"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Validate all marketplace plugins before publishing."}),Ae(qi,{language:"bash",filename:"validate-marketplace",code:`bun run plugin:contractspec:validate
703
+ }`})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Generated multi-host system"}),Ae("p",{className:"text-muted-foreground text-sm",children:"The Cursor plugin is publishable metadata only. Customer-facing Cursor, Claude Code, and Codex outputs are generated from the same pack source with hook and MCP delivery."})]}),Yt("div",{className:"space-y-3",children:[Ae("h2",{className:"font-bold text-2xl",children:"Validation gate"}),Ae("p",{className:"text-muted-foreground text-sm",children:"Validate all marketplace plugins before publishing."}),Ae(Vi,{language:"bash",filename:"validate-marketplace",code:`bun run plugin:contractspec:validate
704
704
 
705
705
  # Optional when offline
706
- SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]})]}),Yt("div",{className:"flex items-center gap-4 pt-4",children:[Yt(Vr,{href:"/docs/ecosystem/templates",className:"btn-primary",children:["Author a plugin ",Ae(Jl,{size:16})]}),Ae(Vr,{href:"/docs/ecosystem/registry",className:"btn-ghost",children:"Manifest details"})]})]})}import{CodeBlock as Vi}from"@contractspec/lib.design-system";import Fr from"@contractspec/lib.ui-link";import{ChevronRight as $l}from"lucide-react";import{jsx as Ga,jsxs as Wo}from"react/jsx-runtime";function Xl(){return Wo("div",{className:"space-y-8",children:[Wo("div",{className:"space-y-3",children:[Ga("h1",{className:"font-bold text-4xl",children:"Marketplace manifest"}),Ga("p",{className:"text-lg text-muted-foreground",children:"ContractSpec publishes a multi-plugin Cursor marketplace catalog from a single root manifest."})]}),Wo("div",{className:"card-subtle space-y-4 p-6",children:[Ga("h2",{className:"font-bold text-2xl",children:"Root manifest shape"}),Wo("p",{className:"text-muted-foreground text-sm",children:["Cursor reads"," ",Ga("code",{children:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json"})," ","for the catalog and resolves each plugin source path from there."]}),Ga(Vi,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
706
+ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]})]}),Yt("div",{className:"flex items-center gap-4 pt-4",children:[Yt(Hr,{href:"/docs/ecosystem/templates",className:"btn-primary",children:["Author a plugin ",Ae(Jl,{size:16})]}),Ae(Hr,{href:"/docs/ecosystem/registry",className:"btn-ghost",children:"Manifest details"})]})]})}import{CodeBlock as Hi}from"@contractspec/lib.design-system";import Fr from"@contractspec/lib.ui-link";import{ChevronRight as Xl}from"lucide-react";import{jsx as Ga,jsxs as Wo}from"react/jsx-runtime";function $l(){return Wo("div",{className:"space-y-8",children:[Wo("div",{className:"space-y-3",children:[Ga("h1",{className:"font-bold text-4xl",children:"Marketplace manifest"}),Ga("p",{className:"text-lg text-muted-foreground",children:"ContractSpec publishes a multi-plugin Cursor marketplace catalog from a single root manifest."})]}),Wo("div",{className:"card-subtle space-y-4 p-6",children:[Ga("h2",{className:"font-bold text-2xl",children:"Root manifest shape"}),Wo("p",{className:"text-muted-foreground text-sm",children:["Cursor reads"," ",Ga("code",{children:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json"})," ","for the catalog and resolves each plugin source path from there."]}),Ga(Hi,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
707
707
  "name": "contractspec-marketplace",
708
708
  "owner": { "name": "ContractSpec Team" },
709
709
  "plugins": [
@@ -716,16 +716,16 @@ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]})]}),Yt("di
716
716
  "source": "plugins/contractspec-contracts-spec"
717
717
  }
718
718
  ]
719
- }`})]}),Wo("div",{className:"card-subtle space-y-4 p-6",children:[Ga("h2",{className:"font-bold text-2xl",children:"Per-plugin contract"}),Ga("p",{className:"text-muted-foreground text-sm",children:"Each plugin source must include a Cursor plugin manifest and composable assets. The publishable plugin is derived from a reusable pack and then validated here."}),Ga(Vi,{language:"text",filename:"plugin-layout",code:`plugins/<plugin-name>/
719
+ }`})]}),Wo("div",{className:"card-subtle space-y-4 p-6",children:[Ga("h2",{className:"font-bold text-2xl",children:"Per-plugin contract"}),Ga("p",{className:"text-muted-foreground text-sm",children:"Each plugin source must include a Cursor plugin manifest and composable assets. The publishable plugin is derived from a reusable pack and then validated here."}),Ga(Hi,{language:"text",filename:"plugin-layout",code:`plugins/<plugin-name>/
720
720
  .cursor-plugin/plugin.json
721
721
  rules/
722
722
  commands/
723
723
  agents/
724
724
  skills/
725
- .mcp.json`}),Ga(Vi,{language:"bash",filename:"validate-catalog",code:`bun run plugin:contractspec:validate
725
+ .mcp.json`}),Ga(Hi,{language:"bash",filename:"validate-catalog",code:`bun run plugin:contractspec:validate
726
726
 
727
727
  # Optional in offline environments
728
- SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]}),Wo("div",{className:"flex items-center gap-4 pt-4",children:[Wo(Fr,{href:"/docs/ecosystem/integrations",className:"btn-primary",children:["Integrations ",Ga($l,{size:16})]}),Ga(Fr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Plugin authoring templates"})]})]})}import xl from"@contractspec/lib.ui-link";import{jsx as Fi,jsxs as jl}from"react/jsx-runtime";function Rt({title:e="Need the operating layer on top of OSS ContractSpec?",body:t="ContractSpec Studio helps teams turn evidence into proposed spec changes, governed delivery loops, and execution-ready task packs while keeping the open contract system as the source of truth.",ctaLabel:o="See what Studio adds",href:n="https://www.contractspec.studio/docs"}){return jl("div",{className:"card-subtle space-y-3 p-6",children:[Fi("h3",{className:"font-semibold text-lg",children:e}),Fi("p",{className:"text-muted-foreground text-sm",children:t}),Fi(xl,{href:n,className:"btn-primary",children:o})]})}import{CodeBlock as Kr}from"@contractspec/lib.design-system";import Qr from"@contractspec/lib.ui-link";import{ChevronRight as es}from"lucide-react";import{jsx as Jt,jsxs as ko}from"react/jsx-runtime";function ts(){return ko("div",{className:"space-y-8",children:[ko("div",{className:"space-y-3",children:[Jt("h1",{className:"font-bold text-4xl",children:"Plugin authoring templates"}),Jt("p",{className:"text-lg text-muted-foreground",children:"Scaffold focused Cursor plugins for ContractSpec product and core libraries."})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Create a focused plugin"}),Jt("p",{className:"text-muted-foreground text-sm",children:"Start from a scoped domain and keep each plugin aligned to one product or library surface."}),Jt(Kr,{language:"bash",filename:"catalog-authoring-layout",code:`packages/apps-registry/cursor-marketplace/
728
+ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]}),Wo("div",{className:"flex items-center gap-4 pt-4",children:[Wo(Fr,{href:"/docs/ecosystem/integrations",className:"btn-primary",children:["Integrations ",Ga(Xl,{size:16})]}),Ga(Fr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Plugin authoring templates"})]})]})}import xl from"@contractspec/lib.ui-link";import{jsx as Fi,jsxs as jl}from"react/jsx-runtime";function Rt({title:e="Need the operating layer on top of OSS ContractSpec?",body:t="ContractSpec Studio helps teams turn evidence into proposed spec changes, governed delivery loops, and execution-ready task packs while keeping the open contract system as the source of truth.",ctaLabel:o="See what Studio adds",href:n="https://www.contractspec.studio/docs"}){return jl("div",{className:"card-subtle space-y-3 p-6",children:[Fi("h3",{className:"font-semibold text-lg",children:e}),Fi("p",{className:"text-muted-foreground text-sm",children:t}),Fi(xl,{href:n,className:"btn-primary",children:o})]})}import{CodeBlock as Kr}from"@contractspec/lib.design-system";import Qr from"@contractspec/lib.ui-link";import{ChevronRight as es}from"lucide-react";import{jsx as Jt,jsxs as ko}from"react/jsx-runtime";function ts(){return ko("div",{className:"space-y-8",children:[ko("div",{className:"space-y-3",children:[Jt("h1",{className:"font-bold text-4xl",children:"Plugin authoring templates"}),Jt("p",{className:"text-lg text-muted-foreground",children:"Scaffold focused Cursor plugins for ContractSpec product and core libraries."})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Create a focused plugin"}),Jt("p",{className:"text-muted-foreground text-sm",children:"Start from a scoped domain and keep each plugin aligned to one product or library surface."}),Jt(Kr,{language:"bash",filename:"catalog-authoring-layout",code:`packages/apps-registry/cursor-marketplace/
729
729
  plugins/
730
730
  <plugin-name>/
731
731
  .cursor-plugin/plugin.json
@@ -739,8 +739,8 @@ bun run plugin:contractspec:validate
739
739
  # Optional in offline environments
740
740
  SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]}),Jt(Rt,{title:"Need evidence-backed template iteration?",body:"Studio helps teams prioritize template changes from real product signals and export implementation-ready task packs."}),ko("div",{className:"flex items-center gap-4 pt-4",children:[ko(Qr,{href:"/docs/ecosystem/plugins",className:"btn-primary",children:["Marketplace plugins ",Jt(es,{size:16})]}),Jt(Qr,{href:"/docs/ecosystem/registry",className:"btn-ghost",children:"Marketplace manifest"})]})]})}import{registerDocBlocks as as}from"@contractspec/lib.contracts-spec/docs";var os=[{id:"docs.ecosystem.plugins",title:"Marketplace plugins",summary:"Focused Cursor marketplace plugins for product and core libraries.",kind:"usage",visibility:"public",route:"/docs/ecosystem/plugins",tags:["ecosystem","plugins","extensions"],body:"# Marketplace plugins\n\nContractSpec ships a focused Cursor marketplace catalog with plugins for the product and key libraries. Plugin sources live in `packages/apps-registry/cursor-marketplace/plugins/*`, while the root manifest at `.cursor-plugin/marketplace.json` drives submission."},{id:"docs.ecosystem.integrations",title:"Integrations",summary:"Reference plugins and integrations you can extend.",kind:"usage",visibility:"public",route:"/docs/ecosystem/integrations",tags:["ecosystem","integrations"],body:`# Integrations
741
741
 
742
- Reference integrations demonstrate how to extend ContractSpec with real-world plugins. Use them as starting points for your own adapters and generators.`},{id:"docs.ecosystem.templates",title:"Plugin authoring templates",summary:"Author focused plugins with a consistent marketplace-ready layout.",kind:"usage",visibility:"public",route:"/docs/ecosystem/templates",tags:["ecosystem","templates"],body:"# Plugin authoring templates\n\nCreate each plugin under `packages/apps-registry/cursor-marketplace/plugins/<plugin-name>/` and include `.cursor-plugin/plugin.json`, `rules/`, `commands/`, `agents/`, `skills/`, and `.mcp.json`."},{id:"docs.ecosystem.registry",title:"Marketplace manifest",summary:"Manage and validate root marketplace entries for all plugins.",kind:"usage",visibility:"public",route:"/docs/ecosystem/registry",tags:["ecosystem","registry"],body:"# Marketplace manifest\n\nKeep all plugin entries in `.cursor-plugin/marketplace.json` and validate them with `bun run plugin:contractspec:validate` before submission."}];as(os);import{ExampleCatalogDataView as Yr}from"@contractspec/lib.contracts-spec/docs";import{ButtonLink as Jr,DataViewList as is,StatusChip as rs}from"@contractspec/lib.design-system";import{HStack as ns,VStack as Zr}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as cs,Muted as $r}from"@contractspec/lib.ui-kit-web/ui/typography";import{buildExampleDocsHref as ls,listDiscoverableExamples as ss}from"@contractspec/module.examples";import{jsx as _o,jsxs as Ki}from"react/jsx-runtime";function ds(){let e=ss().map((o)=>{let n=o.meta.title??o.meta.key;return{id:o.meta.key,title:n,summary:o.meta.summary??o.meta.description,route:ls(o.meta.key),tags:o.meta.tags,sandboxEnabled:o.surfaces.sandbox.enabled}}).sort((o,n)=>o.title.localeCompare(n.title)),t={...Yr,view:{...Yr.view,kind:"list"}};return Ki(Zr,{gap:"xl",children:[Ki(Zr,{gap:"sm",children:[_o(cs,{children:"Examples"}),_o($r,{children:"Reference implementations for real ContractSpec surfaces. Use them to study adoption patterns, inspect generated artifacts, and validate the OSS workflow against runnable systems."})]}),_o(is,{spec:t,items:e,emptyState:_o($r,{children:"No examples available."}),renderActions:(o)=>{return Ki(ns,{gap:"xs",justify:"end",children:[o.sandboxEnabled?_o(Jr,{href:`/sandbox?template=${o.id}`,size:"sm",variant:"outline",children:"Sandbox"}):null,_o(Jr,{href:o.route,size:"sm",children:"Reference"}),o.tags?.[0]?_o(rs,{size:"sm",label:o.tags[0]}):null]})}})]})}import{buildExampleDocsHref as ps,buildExampleReferenceHref as ms,getDiscoverableExample as us,getExamplePreviewHref as gs}from"@contractspec/module.examples";var fs={"agent-console":"Primary meetup path for autonomous agents: typed tools, agent configs, run history, and execution logs in one regenerable surface.","ai-chat-assistant":"Secondary meetup path for MCP-aware assistants: reasoning, sources, suggestions, and a minimal contract-backed search tool.","data-grid-showcase":"Canonical table example for the full ContractSpec stack: declarative DataView contract, shared controller, raw web primitive, native-first primitive, and the composed design-system wrapper.","messaging-agent-actions":"Live messaging lane for the meetup: inbound Slack, WhatsApp, or Telegram messages route through fixed intents, allowlisted actions, and deterministic confirmations."},hs={"agent-console":"/docs/reference/agent-console/agent-console","ai-chat-assistant":"/docs/reference/ai-chat-assistant/assistant.search","data-grid-showcase":"/docs/reference/data-grid-showcase/data-grid-showcase","messaging-agent-actions":"/docs/reference/messaging-agent-actions/messaging.agentActions.process"};function Xr(e){let t=us(e);if(!t)return;let o=t.entrypoints.packageName.replace("@contractspec/example.",""),n=ps(e),Nt=gs(e);return{key:e,lead:fs[e]??t.meta.summary??t.meta.description??"Public ContractSpec reference example.",sandboxHref:Nt,referenceHref:hs[e]??ms(e),llmsHref:`/llms/${t.entrypoints.packageName.replace("@contractspec/","")}`,repoHref:`https://github.com/lssm-tech/contractspec/tree/main/packages/examples/${o}`,localCommands:ys(o,n,Nt)}}function ys(e,t,o){let n=[`bun run --cwd packages/examples/${e} build`,"bun run --cwd packages/apps/web-landing dev","","# Open in the browser",`# http://localhost:3000${t}`];if(o)n.push(`# http://localhost:3000${o}`);return n.join(`
743
- `)}import{ButtonLink as $o,CodeBlock as vs}from"@contractspec/lib.design-system";import bs from"@contractspec/lib.ui-link";import{getExample as Ns}from"@contractspec/module.examples";import{FileCode2 as ws,Play as ks,TerminalSquare as Ss}from"lucide-react";import{jsx as de,jsxs as sa}from"react/jsx-runtime";function Cs({exampleKey:e}){let t=Xr(e),o=Ns(e);if(!t||!o)return null;let n=o.meta.title??o.meta.key,Nt=o.meta.summary??o.meta.description??"",Ne=o.entrypoints.packageName;return sa("div",{className:"space-y-10",children:[sa("section",{className:"space-y-5",children:[de("p",{className:"editorial-kicker",children:"Meetup-ready example"}),de("h1",{className:"editorial-title max-w-5xl",children:n}),de("p",{className:"editorial-subtitle",children:t.lead}),de("p",{className:"editorial-copy max-w-4xl",children:Nt}),sa("div",{className:"flex flex-wrap gap-3",children:[t.sandboxHref?de($o,{href:t.sandboxHref,children:"Open sandbox"}):null,de($o,{href:t.referenceHref,variant:"outline",children:"Generated reference"})]})]}),sa("section",{className:"grid gap-5 lg:grid-cols-3",children:[t.sandboxHref?sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(ks,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Sandbox preview"})]}),de("p",{className:"editorial-copy text-sm",children:"Load the same public browser surface used for the prepared live demo."}),de($o,{href:t.sandboxHref,size:"sm",children:"Open preview"})]}):null,sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(ws,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Reference docs"})]}),de("p",{className:"editorial-copy text-sm",children:"Inspect the generated contract-facing material instead of relying on marketing summaries."}),de($o,{href:t.referenceHref,size:"sm",variant:"outline",children:"Open reference"})]}),sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(Ss,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Package context"})]}),de("p",{className:"editorial-copy text-sm",children:"Use the agent-facing package page for fast repo orientation, then jump to the source directory."}),de("p",{className:"rounded-[18px] border border-border/70 bg-background/75 px-4 py-3 font-mono text-sm",children:Ne}),sa("div",{className:"flex flex-wrap gap-2",children:[de($o,{href:t.llmsHref,size:"sm",variant:"outline",children:"LLMS page"}),de($o,{href:t.repoHref,size:"sm",variant:"outline",children:"GitHub source"})]})]})]}),sa("section",{className:"editorial-panel space-y-5",children:[sa("div",{className:"space-y-2",children:[de("p",{className:"editorial-kicker",children:"Talk commands"}),de("h2",{className:"editorial-panel-title",children:"Exact local commands for the meetup lane"}),de("p",{className:"editorial-copy text-sm",children:"Build the example package, then launch the web shell and open the prepared docs or sandbox route."})]}),de(vs,{language:"bash",filename:`${e}-meetup-runbook`,code:t.localCommands}),sa("p",{className:"text-muted-foreground text-sm",children:["For the full fallback order and safe live-edit workflow, use"," ",de(bs,{href:"https://github.com/lssm-tech/contractspec/blob/main/docs/meetup-agent-examples-runbook.md",children:"the meetup runbook"}),"."]})]})]})}async function Lv(){let{getDocsIndexManifest:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function tn(){let{listGeneratedDocs:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function Ev(e){let{getGeneratedDocById:t}=await Promise.resolve().then(() => (ki(),wi));return t(e)}import{CodeBlock as Si,InstallCommand as Os}from"@contractspec/lib.design-system";import an from"@contractspec/lib.ui-link";import{ChevronRight as Ms}from"lucide-react";import{jsx as re,jsxs as dt}from"react/jsx-runtime";function Bs(){return dt("div",{className:"space-y-8",children:[dt("div",{className:"space-y-2",children:[re("h1",{className:"font-bold text-4xl",children:"ContractSpec CLI"}),re("p",{className:"text-lg text-muted-foreground",children:"Command-line interface for creating, building, and validating contract specifications with AI-powered code generation."})]}),dt("div",{className:"space-y-6",children:[dt("div",{className:"space-y-3",children:[re("h2",{className:"font-bold text-2xl",children:"Installation"}),re(Os,{package:"contractspec",dev:!0})]}),dt("div",{className:"space-y-3",children:[re("h2",{className:"font-bold text-2xl",children:"Quick Start"}),re(Si,{language:"bash",code:`# Initialize project
742
+ Reference integrations demonstrate how to extend ContractSpec with real-world plugins. Use them as starting points for your own adapters and generators.`},{id:"docs.ecosystem.templates",title:"Plugin authoring templates",summary:"Author focused plugins with a consistent marketplace-ready layout.",kind:"usage",visibility:"public",route:"/docs/ecosystem/templates",tags:["ecosystem","templates"],body:"# Plugin authoring templates\n\nCreate each plugin under `packages/apps-registry/cursor-marketplace/plugins/<plugin-name>/` and include `.cursor-plugin/plugin.json`, `rules/`, `commands/`, `agents/`, `skills/`, and `.mcp.json`."},{id:"docs.ecosystem.registry",title:"Marketplace manifest",summary:"Manage and validate root marketplace entries for all plugins.",kind:"usage",visibility:"public",route:"/docs/ecosystem/registry",tags:["ecosystem","registry"],body:"# Marketplace manifest\n\nKeep all plugin entries in `.cursor-plugin/marketplace.json` and validate them with `bun run plugin:contractspec:validate` before submission."}];as(os);import{ExampleCatalogDataView as Yr}from"@contractspec/lib.contracts-spec/docs";import{ButtonLink as Jr,DataViewList as is,StatusChip as rs}from"@contractspec/lib.design-system";import{HStack as ns,VStack as Zr}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as cs,Muted as Xr}from"@contractspec/lib.ui-kit-web/ui/typography";import{buildExampleDocsHref as ls,listDiscoverableExamples as ss}from"@contractspec/module.examples/catalog";import{jsx as _o,jsxs as Ki}from"react/jsx-runtime";function ds(){let e=ss().map((o)=>{let n=o.meta.title??o.meta.key;return{id:o.meta.key,title:n,summary:o.meta.summary??o.meta.description,route:ls(o.meta.key),tags:o.meta.tags,sandboxEnabled:o.surfaces.sandbox.enabled}}).sort((o,n)=>o.title.localeCompare(n.title)),t={...Yr,view:{...Yr.view,kind:"list"}};return Ki(Zr,{gap:"xl",children:[Ki(Zr,{gap:"sm",children:[_o(cs,{children:"Examples"}),_o(Xr,{children:"Reference implementations for real ContractSpec surfaces. Use them to study adoption patterns, inspect generated artifacts, and validate the OSS workflow against runnable systems."})]}),_o(is,{spec:t,items:e,emptyState:_o(Xr,{children:"No examples available."}),renderActions:(o)=>{return Ki(ns,{gap:"xs",justify:"end",children:[o.sandboxEnabled?_o(Jr,{href:`/sandbox?template=${o.id}`,size:"sm",variant:"outline",children:"Sandbox"}):null,_o(Jr,{href:o.route,size:"sm",children:"Reference"}),o.tags?.[0]?_o(rs,{size:"sm",label:o.tags[0]}):null]})}})]})}import{buildExampleDocsHref as ps,buildExampleReferenceHref as ms,getDiscoverableExample as us,getExamplePreviewHref as gs}from"@contractspec/module.examples/catalog";var hs={"agent-console":"Primary meetup path for autonomous agents: typed tools, agent configs, run history, and execution logs in one regenerable surface.","ai-chat-assistant":"Secondary meetup path for MCP-aware assistants: reasoning, sources, suggestions, and a minimal contract-backed search tool.","data-grid-showcase":"Canonical table example for the full ContractSpec stack: declarative DataView contract, shared controller, raw web primitive, native-first primitive, and the composed design-system wrapper.","messaging-agent-actions":"Live messaging lane for the meetup: inbound Slack, WhatsApp, or Telegram messages route through fixed intents, allowlisted actions, and deterministic confirmations."},fs={"agent-console":"/docs/reference/agent-console/agent-console","ai-chat-assistant":"/docs/reference/ai-chat-assistant/assistant.search","data-grid-showcase":"/docs/reference/data-grid-showcase/data-grid-showcase","messaging-agent-actions":"/docs/reference/messaging-agent-actions/messaging.agentActions.process"};function $r(e){let t=us(e);if(!t)return;let o=t.entrypoints.packageName.replace("@contractspec/example.",""),n=ps(e),Nt=gs(e);return{key:e,lead:hs[e]??t.meta.summary??t.meta.description??"Public ContractSpec reference example.",sandboxHref:Nt,referenceHref:fs[e]??ms(e),llmsHref:`/llms/${t.entrypoints.packageName.replace("@contractspec/","")}`,repoHref:`https://github.com/lssm-tech/contractspec/tree/main/packages/examples/${o}`,localCommands:ys(o,n,Nt)}}function ys(e,t,o){let n=[`bun run --cwd packages/examples/${e} build`,"bun run --cwd packages/apps/web-landing dev","","# Open in the browser",`# http://localhost:3000${t}`];if(o)n.push(`# http://localhost:3000${o}`);return n.join(`
743
+ `)}import{ButtonLink as Xo,CodeBlock as vs}from"@contractspec/lib.design-system";import bs from"@contractspec/lib.ui-link";import{getExample as Ns}from"@contractspec/module.examples/catalog";import{FileCode2 as ws,Play as ks,TerminalSquare as Ss}from"lucide-react";import{jsx as de,jsxs as sa}from"react/jsx-runtime";function Cs({exampleKey:e}){let t=$r(e),o=Ns(e);if(!t||!o)return null;let n=o.meta.title??o.meta.key,Nt=o.meta.summary??o.meta.description??"",Ne=o.entrypoints.packageName;return sa("div",{className:"space-y-10",children:[sa("section",{className:"space-y-5",children:[de("p",{className:"editorial-kicker",children:"Meetup-ready example"}),de("h1",{className:"editorial-title max-w-5xl",children:n}),de("p",{className:"editorial-subtitle",children:t.lead}),de("p",{className:"editorial-copy max-w-4xl",children:Nt}),sa("div",{className:"flex flex-wrap gap-3",children:[t.sandboxHref?de(Xo,{href:t.sandboxHref,children:"Open sandbox"}):null,de(Xo,{href:t.referenceHref,variant:"outline",children:"Generated reference"})]})]}),sa("section",{className:"grid gap-5 lg:grid-cols-3",children:[t.sandboxHref?sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(ks,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Sandbox preview"})]}),de("p",{className:"editorial-copy text-sm",children:"Load the same public browser surface used for the prepared live demo."}),de(Xo,{href:t.sandboxHref,size:"sm",children:"Open preview"})]}):null,sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(ws,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Reference docs"})]}),de("p",{className:"editorial-copy text-sm",children:"Inspect the generated contract-facing material instead of relying on marketing summaries."}),de(Xo,{href:t.referenceHref,size:"sm",variant:"outline",children:"Open reference"})]}),sa("article",{className:"editorial-panel space-y-4",children:[sa("div",{className:"flex items-center gap-3",children:[de("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:de(Ss,{size:18})}),de("h2",{className:"font-semibold text-xl",children:"Package context"})]}),de("p",{className:"editorial-copy text-sm",children:"Use the agent-facing package page for fast repo orientation, then jump to the source directory."}),de("p",{className:"rounded-[18px] border border-border/70 bg-background/75 px-4 py-3 font-mono text-sm",children:Ne}),sa("div",{className:"flex flex-wrap gap-2",children:[de(Xo,{href:t.llmsHref,size:"sm",variant:"outline",children:"LLMS page"}),de(Xo,{href:t.repoHref,size:"sm",variant:"outline",children:"GitHub source"})]})]})]}),sa("section",{className:"editorial-panel space-y-5",children:[sa("div",{className:"space-y-2",children:[de("p",{className:"editorial-kicker",children:"Talk commands"}),de("h2",{className:"editorial-panel-title",children:"Exact local commands for the meetup lane"}),de("p",{className:"editorial-copy text-sm",children:"Build the example package, then launch the web shell and open the prepared docs or sandbox route."})]}),de(vs,{language:"bash",filename:`${e}-meetup-runbook`,code:t.localCommands}),sa("p",{className:"text-muted-foreground text-sm",children:["For the full fallback order and safe live-edit workflow, use"," ",de(bs,{href:"https://github.com/lssm-tech/contractspec/blob/main/docs/meetup-agent-examples-runbook.md",children:"the meetup runbook"}),"."]})]})]})}async function Lv(){let{getDocsIndexManifest:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function tn(){let{listGeneratedDocs:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function Ev(e){let{getGeneratedDocById:t}=await Promise.resolve().then(() => (ki(),wi));return t(e)}import{CodeBlock as Si,InstallCommand as Os}from"@contractspec/lib.design-system";import an from"@contractspec/lib.ui-link";import{ChevronRight as Ms}from"lucide-react";import{jsx as re,jsxs as dt}from"react/jsx-runtime";function Bs(){return dt("div",{className:"space-y-8",children:[dt("div",{className:"space-y-2",children:[re("h1",{className:"font-bold text-4xl",children:"ContractSpec CLI"}),re("p",{className:"text-lg text-muted-foreground",children:"Command-line interface for creating, building, and validating contract specifications with AI-powered code generation."})]}),dt("div",{className:"space-y-6",children:[dt("div",{className:"space-y-3",children:[re("h2",{className:"font-bold text-2xl",children:"Installation"}),re(Os,{package:"contractspec",dev:!0})]}),dt("div",{className:"space-y-3",children:[re("h2",{className:"font-bold text-2xl",children:"Quick Start"}),re(Si,{language:"bash",code:`# Initialize project
744
744
  contractspec onboard
745
745
  bunx contractspec init
746
746
 
@@ -765,7 +765,7 @@ contractspec validate`})]}),dt("div",{className:"space-y-4",children:[re("h2",{c
765
765
  "operations": "interactions/commands|queries",
766
766
  "events": "events"
767
767
  }
768
- }`})]})]}),dt("div",{className:"flex items-center gap-4 pt-4",children:[dt(an,{href:"/docs/getting-started/tools/vscode",className:"btn-primary",children:["Next: VS Code Extension ",re(Ms,{size:16})]}),re(an,{href:"/docs/getting-started/tools",className:"btn-ghost",children:"Back to Tools"})]})]})}import Ci from"@contractspec/lib.ui-link";import{ChevronRight as Us}from"lucide-react";import{jsx as ue,jsxs as St}from"react/jsx-runtime";function Ws(){return St("div",{className:"space-y-8",children:[St("div",{className:"space-y-2",children:[ue("h1",{className:"font-bold text-4xl",children:"Compatibility"}),ue("p",{className:"text-lg text-muted-foreground",children:"Supported runtimes, frameworks, and agent modes for ContractSpec."})]}),St("div",{className:"space-y-6",children:[St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Runtimes"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"Node.js 20+"}),ue("li",{children:"Bun 1.0+"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Frameworks"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"Next.js 14+ (App Router preferred)"}),ue("li",{children:"Bun + Elysia or compatible HTTP servers"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Package managers"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"bun (recommended)"}),ue("li",{children:"npm"}),ue("li",{children:"pnpm"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"AI agent modes"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"claude-code"}),ue("li",{children:"openai-codex"}),ue("li",{children:"cursor"}),ue("li",{children:"opencode"}),ue("li",{children:"simple (direct LLM)"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Datastores"}),ue("p",{className:"text-muted-foreground",children:"ContractSpec ships with Prisma-friendly defaults and can integrate with custom adapters for other databases."}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"PostgreSQL via Prisma"}),ue("li",{children:"Custom adapters for other SQL/NoSQL stores"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Cross-platform UI architecture"}),St("p",{className:"text-muted-foreground",children:["Need the React and React Native component compatibility story? Read"," ",ue(Ci,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the runtime and UI-layer split."]})]})]}),St("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[ue(Ci,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),ue(Ci,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),St(Ci,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",ue(Us,{size:16})]})]})]})}import{CodeBlock as $i}from"@contractspec/lib.design-system";import Xi from"@contractspec/lib.ui-link";import{ChevronRight as _s}from"lucide-react";import{jsx as Fe,jsxs as Ja}from"react/jsx-runtime";var zs=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
768
+ }`})]})]}),dt("div",{className:"flex items-center gap-4 pt-4",children:[dt(an,{href:"/docs/getting-started/tools/vscode",className:"btn-primary",children:["Next: VS Code Extension ",re(Ms,{size:16})]}),re(an,{href:"/docs/getting-started/tools",className:"btn-ghost",children:"Back to Tools"})]})]})}import Ci from"@contractspec/lib.ui-link";import{ChevronRight as Us}from"lucide-react";import{jsx as ue,jsxs as St}from"react/jsx-runtime";function Ws(){return St("div",{className:"space-y-8",children:[St("div",{className:"space-y-2",children:[ue("h1",{className:"font-bold text-4xl",children:"Compatibility"}),ue("p",{className:"text-lg text-muted-foreground",children:"Supported runtimes, frameworks, and agent modes for ContractSpec."})]}),St("div",{className:"space-y-6",children:[St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Runtimes"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"Node.js 20+"}),ue("li",{children:"Bun 1.0+"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Frameworks"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"Next.js 14+ (App Router preferred)"}),ue("li",{children:"Bun + Elysia or compatible HTTP servers"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Package managers"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"bun (recommended)"}),ue("li",{children:"npm"}),ue("li",{children:"pnpm"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"AI agent modes"}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"claude-code"}),ue("li",{children:"openai-codex"}),ue("li",{children:"cursor"}),ue("li",{children:"opencode"}),ue("li",{children:"simple (direct LLM)"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Datastores"}),ue("p",{className:"text-muted-foreground",children:"ContractSpec ships with Prisma-friendly defaults and can integrate with custom adapters for other databases."}),St("ul",{className:"space-y-2 text-muted-foreground",children:[ue("li",{children:"PostgreSQL via Prisma"}),ue("li",{children:"Custom adapters for other SQL/NoSQL stores"})]})]}),St("div",{className:"card-subtle space-y-3 p-6",children:[ue("h2",{className:"font-bold text-2xl",children:"Cross-platform UI architecture"}),St("p",{className:"text-muted-foreground",children:["Need the React and React Native component compatibility story? Read"," ",ue(Ci,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the runtime and UI-layer split."]})]})]}),St("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[ue(Ci,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),ue(Ci,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),St(Ci,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",ue(Us,{size:16})]})]})]})}import{CodeBlock as Xi}from"@contractspec/lib.design-system";import $i from"@contractspec/lib.ui-link";import{ChevronRight as _s}from"lucide-react";import{jsx as Fe,jsxs as Ja}from"react/jsx-runtime";var zs=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
769
769
  import { ListTransactions } from './list-transactions';
770
770
 
771
771
  export const TransactionHistory = defineDataView({
@@ -811,7 +811,7 @@ export const TransactionHistory = defineDataView({
811
811
  { key: 'notes', label: 'Notes', dataPath: 'notes' },
812
812
  ],
813
813
  },
814
- });`;function Gs(){return Ja("div",{className:"space-y-8",children:[Ja("div",{className:"space-y-4",children:[Fe("h1",{className:"font-bold text-4xl",children:"Display Data with DataViews"}),Fe("p",{className:"text-lg text-muted-foreground",children:"Define a filterable, sortable transaction history view that works across web and mobile without duplicating UI code."})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"1. Define the underlying query"}),Fe("p",{className:"text-muted-foreground",children:"First, create a query operation to fetch the data:"}),Fe($i,{language:"typescript",filename:"lib/specs/billing/list-transactions.ts",code:`import { defineQuery } from '@contractspec/lib.contracts-spec';
814
+ });`;function Gs(){return Ja("div",{className:"space-y-8",children:[Ja("div",{className:"space-y-4",children:[Fe("h1",{className:"font-bold text-4xl",children:"Display Data with DataViews"}),Fe("p",{className:"text-lg text-muted-foreground",children:"Define a filterable, sortable transaction history view that works across web and mobile without duplicating UI code."})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"1. Define the underlying query"}),Fe("p",{className:"text-muted-foreground",children:"First, create a query operation to fetch the data:"}),Fe(Xi,{language:"typescript",filename:"lib/specs/billing/list-transactions.ts",code:`import { defineQuery } from '@contractspec/lib.contracts-spec';
815
815
 
816
816
  export const ListTransactions = defineQuery({
817
817
  meta: {
@@ -824,7 +824,7 @@ export const ListTransactions = defineQuery({
824
824
  output: /* array of transactions */,
825
825
  },
826
826
  policy: { auth: 'user' },
827
- });`})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"2. Define the DataView spec"}),Fe("p",{className:"text-muted-foreground",children:"Wrap your query with presentation metadata:"}),Fe($i,{language:"typescript",filename:"lib/specs/billing/transaction-history.data-view.ts",code:zs}),Ja("p",{className:"text-muted-foreground text-sm",children:["The live version of this pattern is available in the canonical"," ",Fe(Xi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),"."]})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"3. Render on the frontend"}),Fe("p",{className:"text-muted-foreground",children:"Use the runtime renderer in your React or React Native app:"}),Fe($i,{language:"tsx",filename:"app/dashboard/transactions/page.tsx",code:`'use client';
827
+ });`})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"2. Define the DataView spec"}),Fe("p",{className:"text-muted-foreground",children:"Wrap your query with presentation metadata:"}),Fe(Xi,{language:"typescript",filename:"lib/specs/billing/transaction-history.data-view.ts",code:zs}),Ja("p",{className:"text-muted-foreground text-sm",children:["The live version of this pattern is available in the canonical"," ",Fe($i,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),"."]})]}),Ja("div",{className:"space-y-4",children:[Fe("h2",{className:"font-bold text-2xl",children:"3. Render on the frontend"}),Fe("p",{className:"text-muted-foreground",children:"Use the runtime renderer in your React or React Native app:"}),Fe(Xi,{language:"tsx",filename:"app/dashboard/transactions/page.tsx",code:`'use client';
828
828
 
829
829
  import { DataViewRenderer } from '@contractspec/lib.design-system';
830
830
  import { TransactionHistory } from '@/lib/specs/billing/transaction-history.data-view';
@@ -849,7 +849,7 @@ export function TransactionsPage() {
849
849
  />
850
850
  </div>
851
851
  );
852
- }`})]}),Ja("div",{className:"card-subtle space-y-4 p-6",children:[Fe("h3",{className:"font-bold",children:"Why DataViews?"}),Ja("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Fe("li",{children:"Same spec renders on web (React) and mobile (React Native)"}),Fe("li",{children:"Filters, sorting, and pagination handled automatically"}),Fe("li",{children:"Column visibility, pinning, resizing, and row expansion stay contract-driven"}),Fe("li",{children:"Format rules (currency, dates, badges) applied consistently"}),Fe("li",{children:"Export to CSV/PDF using the same spec"}),Fe("li",{children:"A/B test different layouts without touching the backend"})]})]}),Ja("div",{className:"flex items-center gap-4 pt-4",children:[Ja(Xi,{href:"/docs/libraries/data-views",className:"btn-primary",children:["DataView API Reference ",Fe(_s,{size:16})]}),Fe(Xi,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Next: Workflows"})]})]})}import{CodeBlock as Hs,InstallCommand as qs}from"@contractspec/lib.design-system";import xi from"@contractspec/lib.ui-link";import{ChevronRight as on,Code2 as Vs,Cpu as Fs,Layers as Ks,Terminal as Qs}from"lucide-react";import{jsx as pt,jsxs as Ta}from"react/jsx-runtime";function $v(){return Ta("div",{className:"space-y-8",children:[Ta("div",{className:"space-y-2",children:[pt("h1",{className:"font-bold text-4xl",children:"Developer Tools"}),pt("p",{className:"text-lg text-muted-foreground",children:"Use the OSS toolchain to define contracts, validate changes, inspect generated surfaces, and adopt the system incrementally across different environments."})]}),pt("div",{className:"grid gap-6 md:grid-cols-2",children:[{name:"CLI",href:"/docs/getting-started/tools/cli",description:"Command-line interface for spec creation, building, validation, and CI/CD integration.",icon:Qs,status:"available",highlights:["AI-powered code generation","Multiple agent modes","SARIF/JSON output"]},{name:"VS Code Extension",href:"/docs/getting-started/tools/vscode",description:"Real-time validation, scaffolding, and navigation directly in your editor.",icon:Vs,status:"available",highlights:["Specs Explorer sidebar","Watch mode","Interactive walkthroughs"]},{name:"ContractSpec Studio",href:"https://www.contractspec.studio",description:"The operating layer on top of OSS ContractSpec for teams that want evidence-backed decisions, workflow automation, and managed delivery loops.",icon:Ks,status:"available",highlights:["Evidence-to-decision loop","Compiled spec diffs and task packs","Exports to Linear, Jira, Notion, and GitHub"]},{name:"JetBrains Plugin",href:"#",description:"Full ContractSpec support for IntelliJ, WebStorm, and other JetBrains IDEs.",icon:Fs,status:"coming-soon",highlights:["Code navigation","Inline validation","Refactoring support"]}].map((t)=>{let o=t.icon,n=t.status==="coming-soon";return Ta("div",{className:`card-subtle relative space-y-4 p-6 ${n?"opacity-75":""}`,children:[n&&pt("span",{className:"absolute -top-2 right-4 rounded-full bg-violet-500/20 px-2 py-0.5 font-medium text-violet-400 text-xs",children:"Coming Soon"}),Ta("div",{className:"flex items-center gap-3",children:[pt("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-violet-500/10",children:pt(o,{className:"h-5 w-5 text-violet-400"})}),pt("h3",{className:"font-bold text-lg",children:t.name})]}),pt("p",{className:"text-muted-foreground text-sm",children:t.description}),pt("ul",{className:"space-y-1",children:t.highlights.map((Nt)=>Ta("li",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[pt("span",{className:"text-violet-400",children:"-"}),Nt]},Nt))}),!n&&Ta(xi,{href:t.href,className:"btn-ghost inline-flex items-center gap-1 text-sm",children:["Learn more ",pt(on,{size:14})]})]},t.name)})}),Ta("div",{className:"card-subtle space-y-4 p-6",children:[pt("h3",{className:"font-bold",children:"Quick Install"}),Ta("div",{className:"space-y-3",children:[Ta("div",{children:[pt("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"CLI"}),pt(qs,{package:"contractspec",dev:!0})]}),Ta("div",{children:[pt("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"VS Code Extension"}),pt(Hs,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"})]})]})]}),Ta("div",{className:"flex items-center gap-4 pt-4",children:[Ta(xi,{href:"/docs/getting-started/tools/cli",className:"btn-primary",children:["Get Started with CLI ",pt(on,{size:16})]}),pt(xi,{href:"/docs/getting-started/tools/vscode",className:"btn-ghost",children:"VS Code Extension"})]})]})}import{CodeBlock as Ii}from"@contractspec/lib.design-system";import Ys from"@contractspec/lib.ui-link";import{ChevronRight as Js}from"lucide-react";import{jsx as we,jsxs as da}from"react/jsx-runtime";function Zs(){return da("div",{className:"space-y-8",children:[da("div",{className:"space-y-2",children:[we("h1",{className:"font-bold text-4xl",children:"Your First Operation"}),we("p",{className:"text-lg text-muted-foreground",children:"Build a payment capture operation with policy enforcement in under 10 minutes."})]}),da("div",{className:"space-y-6",children:[da("div",{className:"space-y-3",children:[we("h2",{className:"font-bold text-2xl",children:"What you'll build"}),we("p",{className:"text-muted-foreground",children:"A real-world payment processing operation that validates input, enforces business rules, integrates with Stripe, and audits every transaction. This is production-ready code, not a toy example."})]}),da("div",{className:"space-y-3",children:[we("h2",{className:"font-bold text-2xl",children:"1. Define the operation spec"}),da("p",{className:"text-muted-foreground",children:["Create ",we("code",{children:"lib/specs/billing/capture-payment.ts"}),":"]}),we(Ii,{language:"typescript",filename:"lib/specs/billing/capture-payment.ts",code:`import { defineCommand } from '@contractspec/lib.contracts-spec';
852
+ }`})]}),Ja("div",{className:"card-subtle space-y-4 p-6",children:[Fe("h3",{className:"font-bold",children:"Why DataViews?"}),Ja("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Fe("li",{children:"Same spec renders on web (React) and mobile (React Native)"}),Fe("li",{children:"Filters, sorting, and pagination handled automatically"}),Fe("li",{children:"Column visibility, pinning, resizing, and row expansion stay contract-driven"}),Fe("li",{children:"Format rules (currency, dates, badges) applied consistently"}),Fe("li",{children:"Export to CSV/PDF using the same spec"}),Fe("li",{children:"A/B test different layouts without touching the backend"})]})]}),Ja("div",{className:"flex items-center gap-4 pt-4",children:[Ja($i,{href:"/docs/libraries/data-views",className:"btn-primary",children:["DataView API Reference ",Fe(_s,{size:16})]}),Fe($i,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Next: Workflows"})]})]})}import{CodeBlock as qs,InstallCommand as Vs}from"@contractspec/lib.design-system";import xi from"@contractspec/lib.ui-link";import{ChevronRight as on,Code2 as Hs,Cpu as Fs,Layers as Ks,Terminal as Qs}from"lucide-react";import{jsx as pt,jsxs as Ta}from"react/jsx-runtime";function Xv(){return Ta("div",{className:"space-y-8",children:[Ta("div",{className:"space-y-2",children:[pt("h1",{className:"font-bold text-4xl",children:"Developer Tools"}),pt("p",{className:"text-lg text-muted-foreground",children:"Use the OSS toolchain to define contracts, validate changes, inspect generated surfaces, and adopt the system incrementally across different environments."})]}),pt("div",{className:"grid gap-6 md:grid-cols-2",children:[{name:"CLI",href:"/docs/getting-started/tools/cli",description:"Command-line interface for spec creation, building, validation, and CI/CD integration.",icon:Qs,status:"available",highlights:["AI-powered code generation","Multiple agent modes","SARIF/JSON output"]},{name:"VS Code Extension",href:"/docs/getting-started/tools/vscode",description:"Real-time validation, scaffolding, and navigation directly in your editor.",icon:Hs,status:"available",highlights:["Specs Explorer sidebar","Watch mode","Interactive walkthroughs"]},{name:"ContractSpec Studio",href:"https://www.contractspec.studio",description:"The operating layer on top of OSS ContractSpec for teams that want evidence-backed decisions, workflow automation, and managed delivery loops.",icon:Ks,status:"available",highlights:["Evidence-to-decision loop","Compiled spec diffs and task packs","Exports to Linear, Jira, Notion, and GitHub"]},{name:"JetBrains Plugin",href:"#",description:"Full ContractSpec support for IntelliJ, WebStorm, and other JetBrains IDEs.",icon:Fs,status:"coming-soon",highlights:["Code navigation","Inline validation","Refactoring support"]}].map((t)=>{let o=t.icon,n=t.status==="coming-soon";return Ta("div",{className:`card-subtle relative space-y-4 p-6 ${n?"opacity-75":""}`,children:[n&&pt("span",{className:"absolute -top-2 right-4 rounded-full bg-violet-500/20 px-2 py-0.5 font-medium text-violet-400 text-xs",children:"Coming Soon"}),Ta("div",{className:"flex items-center gap-3",children:[pt("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-violet-500/10",children:pt(o,{className:"h-5 w-5 text-violet-400"})}),pt("h3",{className:"font-bold text-lg",children:t.name})]}),pt("p",{className:"text-muted-foreground text-sm",children:t.description}),pt("ul",{className:"space-y-1",children:t.highlights.map((Nt)=>Ta("li",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[pt("span",{className:"text-violet-400",children:"-"}),Nt]},Nt))}),!n&&Ta(xi,{href:t.href,className:"btn-ghost inline-flex items-center gap-1 text-sm",children:["Learn more ",pt(on,{size:14})]})]},t.name)})}),Ta("div",{className:"card-subtle space-y-4 p-6",children:[pt("h3",{className:"font-bold",children:"Quick Install"}),Ta("div",{className:"space-y-3",children:[Ta("div",{children:[pt("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"CLI"}),pt(Vs,{package:"contractspec",dev:!0})]}),Ta("div",{children:[pt("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"VS Code Extension"}),pt(qs,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"})]})]})]}),Ta("div",{className:"flex items-center gap-4 pt-4",children:[Ta(xi,{href:"/docs/getting-started/tools/cli",className:"btn-primary",children:["Get Started with CLI ",pt(on,{size:16})]}),pt(xi,{href:"/docs/getting-started/tools/vscode",className:"btn-ghost",children:"VS Code Extension"})]})]})}import{CodeBlock as Ii}from"@contractspec/lib.design-system";import Ys from"@contractspec/lib.ui-link";import{ChevronRight as Js}from"lucide-react";import{jsx as we,jsxs as da}from"react/jsx-runtime";function Zs(){return da("div",{className:"space-y-8",children:[da("div",{className:"space-y-2",children:[we("h1",{className:"font-bold text-4xl",children:"Your First Operation"}),we("p",{className:"text-lg text-muted-foreground",children:"Build a payment capture operation with policy enforcement in under 10 minutes."})]}),da("div",{className:"space-y-6",children:[da("div",{className:"space-y-3",children:[we("h2",{className:"font-bold text-2xl",children:"What you'll build"}),we("p",{className:"text-muted-foreground",children:"A real-world payment processing operation that validates input, enforces business rules, integrates with Stripe, and audits every transaction. This is production-ready code, not a toy example."})]}),da("div",{className:"space-y-3",children:[we("h2",{className:"font-bold text-2xl",children:"1. Define the operation spec"}),da("p",{className:"text-muted-foreground",children:["Create ",we("code",{children:"lib/specs/billing/capture-payment.ts"}),":"]}),we(Ii,{language:"typescript",filename:"lib/specs/billing/capture-payment.ts",code:`import { defineCommand } from '@contractspec/lib.contracts-spec';
853
853
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
854
854
 
855
855
  const CapturePaymentInput = new SchemaModel({
@@ -943,16 +943,16 @@ const handler = makeNextAppHandler(registry, async (req) => {
943
943
  return { actor: 'user', userId: session.userId, tenantId: session.tenantId };
944
944
  });
945
945
 
946
- export { handler as GET, handler as POST };`})]}),da("div",{className:"card-subtle space-y-4 p-6",children:[we("h3",{className:"font-bold",children:"What you just built:"}),da("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[da("li",{children:["Type-safe API endpoint at"," ",we("code",{children:"/api/ops/billing.capturePayment"})]}),we("li",{children:"Automatic input validation (amount must be positive, IDs required)"}),we("li",{children:"Policy enforcement—only invoice owner can pay"}),we("li",{children:"Stripe integration with error handling"}),we("li",{children:"Database transaction with audit trail"}),we("li",{children:"Same spec works with GraphQL, MCP, or webhooks"})]})]}),we("div",{className:"flex items-center gap-4 pt-4",children:da(Ys,{href:"/docs/getting-started/dataviews",className:"btn-primary",children:["Next: Display Data with DataViews ",we(Js,{size:16})]})})]})]})}import{CodeBlock as rn,InstallCommand as ji}from"@contractspec/lib.design-system";import $s from"@contractspec/lib.ui-link";import{ChevronRight as Xs}from"lucide-react";import{jsx as Ke,jsxs as Ha}from"react/jsx-runtime";function xs(){return Ha("div",{className:"space-y-8",children:[Ha("div",{className:"space-y-2",children:[Ke("h1",{className:"font-bold text-4xl",children:"Installation"}),Ke("p",{className:"text-lg text-muted-foreground",children:"Add ContractSpec to your existing Next.js or Bun project, or start fresh."})]}),Ha("div",{className:"space-y-6",children:[Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Prerequisites"}),Ha("ul",{className:"space-y-2 text-muted-foreground",children:[Ke("li",{children:"Node.js 20+ (or Bun 1.0+)"}),Ke("li",{children:"Existing Next.js app or Bun HTTP server"}),Ke("li",{children:"PostgreSQL database (for persistence)"})]})]}),Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Install Core Libraries"}),Ke("p",{className:"text-muted-foreground",children:"Add the contracts runtime and your choice of adapter:"}),Ke(ji,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"For Next.js projects"}),Ke(ji,{package:"@contractspec/lib.contracts-spec"})]}),Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"For database models"}),Ke(ji,{package:["@contractspec/app.cli-database","prisma","@prisma/client"]})]}),Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Set up your project"}),Ke("p",{className:"text-muted-foreground",children:"Initialize a new ContractSpec project structure:"}),Ke(rn,{language:"bash",filename:"installation-init",code:`bunx contractspec init
947
- # Follow the interactive prompts to configure your project`})]}),Ha("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Initialize the database"}),Ke("p",{className:"text-muted-foreground",children:"If using Prisma, set up your schema and generate the client:"}),Ke(rn,{language:"bash",filename:"installation-prisma",code:`bunx prisma init
946
+ export { handler as GET, handler as POST };`})]}),da("div",{className:"card-subtle space-y-4 p-6",children:[we("h3",{className:"font-bold",children:"What you just built:"}),da("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[da("li",{children:["Type-safe API endpoint at"," ",we("code",{children:"/api/ops/billing.capturePayment"})]}),we("li",{children:"Automatic input validation (amount must be positive, IDs required)"}),we("li",{children:"Policy enforcement—only invoice owner can pay"}),we("li",{children:"Stripe integration with error handling"}),we("li",{children:"Database transaction with audit trail"}),we("li",{children:"Same spec works with GraphQL, MCP, or webhooks"})]})]}),we("div",{className:"flex items-center gap-4 pt-4",children:da(Ys,{href:"/docs/getting-started/dataviews",className:"btn-primary",children:["Next: Display Data with DataViews ",we(Js,{size:16})]})})]})]})}import{CodeBlock as rn,InstallCommand as ji}from"@contractspec/lib.design-system";import Xs from"@contractspec/lib.ui-link";import{ChevronRight as $s}from"lucide-react";import{jsx as Ke,jsxs as qa}from"react/jsx-runtime";function xs(){return qa("div",{className:"space-y-8",children:[qa("div",{className:"space-y-2",children:[Ke("h1",{className:"font-bold text-4xl",children:"Installation"}),Ke("p",{className:"text-lg text-muted-foreground",children:"Add ContractSpec to your existing Next.js or Bun project, or start fresh."})]}),qa("div",{className:"space-y-6",children:[qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Prerequisites"}),qa("ul",{className:"space-y-2 text-muted-foreground",children:[Ke("li",{children:"Node.js 20+ (or Bun 1.0+)"}),Ke("li",{children:"Existing Next.js app or Bun HTTP server"}),Ke("li",{children:"PostgreSQL database (for persistence)"})]})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Install Core Libraries"}),Ke("p",{className:"text-muted-foreground",children:"Add the contracts runtime and your choice of adapter:"}),Ke(ji,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"For Next.js projects"}),Ke(ji,{package:"@contractspec/lib.contracts-spec"})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"For database models"}),Ke(ji,{package:["@contractspec/app.cli-database","prisma","@prisma/client"]})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Set up your project"}),Ke("p",{className:"text-muted-foreground",children:"Initialize a new ContractSpec project structure:"}),Ke(rn,{language:"bash",filename:"installation-init",code:`bunx contractspec init
947
+ # Follow the interactive prompts to configure your project`})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"Initialize the database"}),Ke("p",{className:"text-muted-foreground",children:"If using Prisma, set up your schema and generate the client:"}),Ke(rn,{language:"bash",filename:"installation-prisma",code:`bunx prisma init
948
948
  # Edit prisma/schema.prisma with your models
949
949
  bunx prisma generate
950
- bunx prisma migrate dev --name init`})]}),Ke("div",{className:"flex items-center gap-4 pt-4",children:Ha($s,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: First Operation ",Ke(Xs,{size:16})]})})]})]})}import{CodeBlock as Pi,InstallCommand as js}from"@contractspec/lib.design-system";import er from"@contractspec/lib.ui-link";import{ChevronRight as ed}from"lucide-react";import{jsx as Zt,jsxs as Za}from"react/jsx-runtime";function td(){return Za("div",{className:"space-y-8",children:[Za("div",{className:"space-y-2",children:[Zt("h1",{className:"font-bold text-4xl",children:"Start here"}),Zt("p",{className:"text-lg text-muted-foreground",children:"A fast onboarding path from install to your first generated contract."})]}),Za("div",{className:"space-y-6",children:[Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Install the CLI"}),Zt(js,{package:"contractspec",dev:!0})]}),Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Generate repo-local guidance"}),Zt(Pi,{language:"bash",filename:"start-here-onboard",code:`contractspec onboard
950
+ bunx prisma migrate dev --name init`})]}),Ke("div",{className:"flex items-center gap-4 pt-4",children:qa(Xs,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: First Operation ",Ke($s,{size:16})]})})]})]})}import{CodeBlock as Pi,InstallCommand as js}from"@contractspec/lib.design-system";import er from"@contractspec/lib.ui-link";import{ChevronRight as ed}from"lucide-react";import{jsx as Zt,jsxs as Za}from"react/jsx-runtime";function td(){return Za("div",{className:"space-y-8",children:[Za("div",{className:"space-y-2",children:[Zt("h1",{className:"font-bold text-4xl",children:"Start here"}),Zt("p",{className:"text-lg text-muted-foreground",children:"A fast onboarding path from install to your first generated contract."})]}),Za("div",{className:"space-y-6",children:[Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Install the CLI"}),Zt(js,{package:"contractspec",dev:!0})]}),Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Generate repo-local guidance"}),Zt(Pi,{language:"bash",filename:"start-here-onboard",code:`contractspec onboard
951
951
  # optional focused track
952
952
  contractspec onboard knowledge --example knowledge-canon`})]}),Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Initialize your project"}),Zt(Pi,{language:"bash",filename:"start-here-init",code:"bunx contractspec init"})]}),Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Author your first contract"}),Zt(Pi,{language:"bash",filename:"start-here-create",code:"contractspec create --type operation"})]}),Za("div",{className:"space-y-3",children:[Zt("h2",{className:"font-bold text-2xl",children:"Generate implementation"}),Zt(Pi,{language:"bash",filename:"start-here-build",code:`contractspec generate
953
- contractspec validate`})]})]}),Za("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[Za(er,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: Hello World ",Zt(ed,{size:16})]}),Zt(er,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),Zt(er,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"})]})]})}import{CodeBlock as ad}from"@contractspec/lib.design-system";import tr from"@contractspec/lib.ui-link";import{ChevronRight as od}from"lucide-react";import{jsx as Xe,jsxs as Lt}from"react/jsx-runtime";function id(){return Lt("div",{className:"space-y-8",children:[Lt("div",{className:"space-y-2",children:[Xe("h1",{className:"font-bold text-4xl",children:"Troubleshooting"}),Xe("p",{className:"text-lg text-muted-foreground",children:"Common issues and fixes when installing or generating with ContractSpec."})]}),Lt("div",{className:"space-y-6",children:[Lt("div",{className:"card-subtle space-y-3 p-6",children:[Xe("h2",{className:"font-bold text-2xl",children:"Command not found"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Xe("li",{children:"Reinstall the CLI and ensure it is in your PATH."}),Xe("li",{children:"Confirm Node.js 20+ or Bun 1.0+ is installed."})]})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[Xe("h2",{className:"font-bold text-2xl",children:"Specs not discovered"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Lt("li",{children:["Run ",Xe("code",{children:"contractspec list"})," to see discovered specs."]}),Xe("li",{children:"Verify your spec path conventions in .contractsrc.json."})]})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[Xe("h2",{className:"font-bold text-2xl",children:"Build or validate fails"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Lt("li",{children:["Run ",Xe("code",{children:"contractspec validate"})," to surface schema errors."]}),Xe("li",{children:"Check that generated files were not manually edited."})]})]}),Lt("div",{className:"space-y-3",children:[Xe("h2",{className:"font-bold text-2xl",children:"Diagnostics"}),Xe(ad,{language:"bash",filename:"troubleshooting-diagnostics",code:`contractspec --version
953
+ contractspec validate`})]})]}),Za("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[Za(er,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: Hello World ",Zt(ed,{size:16})]}),Zt(er,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),Zt(er,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"})]})]})}import{CodeBlock as ad}from"@contractspec/lib.design-system";import tr from"@contractspec/lib.ui-link";import{ChevronRight as od}from"lucide-react";import{jsx as $e,jsxs as Lt}from"react/jsx-runtime";function id(){return Lt("div",{className:"space-y-8",children:[Lt("div",{className:"space-y-2",children:[$e("h1",{className:"font-bold text-4xl",children:"Troubleshooting"}),$e("p",{className:"text-lg text-muted-foreground",children:"Common issues and fixes when installing or generating with ContractSpec."})]}),Lt("div",{className:"space-y-6",children:[Lt("div",{className:"card-subtle space-y-3 p-6",children:[$e("h2",{className:"font-bold text-2xl",children:"Command not found"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[$e("li",{children:"Reinstall the CLI and ensure it is in your PATH."}),$e("li",{children:"Confirm Node.js 20+ or Bun 1.0+ is installed."})]})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[$e("h2",{className:"font-bold text-2xl",children:"Specs not discovered"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Lt("li",{children:["Run ",$e("code",{children:"contractspec list"})," to see discovered specs."]}),$e("li",{children:"Verify your spec path conventions in .contractsrc.json."})]})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[$e("h2",{className:"font-bold text-2xl",children:"Build or validate fails"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Lt("li",{children:["Run ",$e("code",{children:"contractspec validate"})," to surface schema errors."]}),$e("li",{children:"Check that generated files were not manually edited."})]})]}),Lt("div",{className:"space-y-3",children:[$e("h2",{className:"font-bold text-2xl",children:"Diagnostics"}),$e(ad,{language:"bash",filename:"troubleshooting-diagnostics",code:`contractspec --version
954
954
  contractspec list
955
- contractspec validate src/contracts/mySpec.ts`})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[Xe("h2",{className:"font-bold text-2xl",children:"Still blocked?"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[Xe("li",{children:"Confirm compatibility requirements for runtime and framework."}),Xe("li",{children:"Re-run builds on a clean branch to isolate changes."}),Xe("li",{children:"Use a new spec and minimal adapter to validate setup."})]})]})]}),Lt("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[Xe(tr,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),Xe(tr,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"}),Lt(tr,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",Xe(od,{size:16})]})]})]})}import{CodeBlock as rd}from"@contractspec/lib.design-system";import nn from"@contractspec/lib.ui-link";import{ChevronRight as nd,ExternalLink as cd}from"lucide-react";import{jsx as u,jsxs as Z}from"react/jsx-runtime";function kb(){let e=[{category:"Core Functionality",items:["Real-time validation with instant feedback on spec errors","Build/Scaffold handlers and components from specs","Interactive spec creation wizard","Watch mode for auto-rebuild on changes","Sync all specs in workspace with one command"]},{category:"Visual Navigation",items:["Specs Explorer sidebar with organized tree view","Dependencies view to visualize spec relationships","Build Results tracking with history","Circular dependency detection"]},{category:"Comparison & Export",items:["Semantic and text diff between specs","Git comparison with baseline branches","OpenAPI 3.1 specification export"]}],t=[{name:"Create New Spec",description:"Interactive wizard to create specs"},{name:"Validate Current Spec",description:"Validate the currently open spec"},{name:"Build/Scaffold from Current Spec",description:"Generate handler/component"},{name:"Toggle Watch Mode",description:"Auto-rebuild on changes"},{name:"Sync All Specs",description:"Build all specs in workspace"},{name:"Analyze Spec Dependencies",description:"Visualize spec dependencies"},{name:"Compare Specs",description:"Semantic or text diff between specs"},{name:"Export to OpenAPI",description:"Generate OpenAPI specification"}];return Z("div",{className:"space-y-8",children:[Z("div",{className:"space-y-2",children:[u("h1",{className:"font-bold text-4xl",children:"VS Code Extension"}),u("p",{className:"text-lg text-muted-foreground",children:"Spec-first development directly in VS Code. Validate, scaffold, and explore your contract specifications with real-time feedback."})]}),Z("div",{className:"flex flex-wrap gap-3",children:[Z("a",{href:"https://marketplace.visualstudio.com/items?itemName=lssm.vscode-contractspec",target:"_blank",rel:"noopener noreferrer",className:"btn-primary inline-flex items-center gap-2",children:["Install Extension ",u(cd,{size:16})]}),u("a",{href:"vscode:extension/lssm.vscode-contractspec",className:"btn-ghost inline-flex items-center gap-2",children:"Open in VS Code"})]}),Z("div",{className:"space-y-6",children:[Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Installation"}),Z("div",{className:"space-y-2",children:[Z("p",{className:"text-muted-foreground text-sm",children:[u("strong",{children:"Option 1:"})," Install from VS Code Marketplace"]}),u(rd,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"}),Z("p",{className:"mt-4 text-muted-foreground text-sm",children:[u("strong",{children:"Option 2:"}),' Search for "ContractSpec" in VS Code Extensions (Ctrl/Cmd+Shift+X)']})]})]}),Z("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Features"}),u("div",{className:"grid gap-4 md:grid-cols-3",children:e.map((o)=>Z("div",{className:"card-subtle space-y-3 p-4",children:[u("h3",{className:"font-bold text-violet-400",children:o.category}),u("ul",{className:"space-y-2",children:o.items.map((n)=>Z("li",{className:"flex items-start gap-2 text-muted-foreground text-sm",children:[u("span",{className:"mt-1 text-violet-400",children:"-"}),u("span",{children:n})]},n))})]},o.category))})]}),Z("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Commands"}),Z("p",{className:"text-muted-foreground",children:["Access commands via Command Palette (Ctrl/Cmd+Shift+P) with prefix"," ",u("code",{children:"ContractSpec:"})]}),u("div",{className:"grid gap-3 md:grid-cols-2",children:t.map((o)=>u("div",{className:"card-subtle flex items-center gap-3 p-3",children:Z("div",{className:"flex-1",children:[u("p",{className:"font-medium font-mono text-sm",children:o.name}),u("p",{className:"text-muted-foreground text-xs",children:o.description})]})},o.name))})]}),Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Sidebar Views"}),u("p",{className:"text-muted-foreground",children:"The extension adds a ContractSpec activity bar (icon in sidebar) with three views:"}),Z("div",{className:"grid gap-4 md:grid-cols-3",children:[Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Specs Explorer"}),u("p",{className:"text-muted-foreground text-sm",children:"Browse all specs organized by type. Shows name, version, and stability. Click to open, right-click for actions."})]}),Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Dependencies"}),u("p",{className:"text-muted-foreground text-sm",children:"Visualize spec relationships. Detect circular dependencies. Navigate to referenced specs."})]}),Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Build Results"}),u("p",{className:"text-muted-foreground text-sm",children:"Track build history (last 20). Success/failure indicators. Click to open generated files."})]})]})]}),Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Getting Started"}),Z("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[u("li",{children:"Install the extension from VS Code Marketplace"}),u("li",{children:"Open a workspace with ContractSpec files (or create one)"}),u("li",{children:"Start the walkthrough: Help - Welcome - ContractSpec"}),Z("li",{children:["Create your first spec: Click ",u("strong",{children:"+"})," in Specs Explorer or run ",u("code",{children:"ContractSpec: Create New Spec"})]}),u("li",{children:"Build from it: Click the build icon in the editor title bar"})]})]}),Z("div",{className:"card-subtle space-y-4 p-6",children:[u("h3",{className:"font-bold",children:"Configuration"}),u("p",{className:"text-muted-foreground text-sm",children:"Configure the extension in VS Code Settings:"}),u("div",{className:"overflow-x-auto",children:Z("table",{className:"w-full text-muted-foreground text-sm",children:[u("thead",{children:Z("tr",{className:"border-border border-b",children:[u("th",{className:"p-2 text-left font-medium",children:"Setting"}),u("th",{className:"p-2 text-left font-medium",children:"Description"}),u("th",{className:"p-2 text-left font-medium",children:"Default"})]})}),Z("tbody",{children:[Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"validation.onSave"}),u("td",{className:"p-2",children:"Run validation on save"}),u("td",{className:"p-2",children:"true"})]}),Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"validation.onOpen"}),u("td",{className:"p-2",children:"Run validation on open"}),u("td",{className:"p-2",children:"true"})]}),Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"api.baseUrl"}),u("td",{className:"p-2",children:"Base URL for ContractSpec API"}),u("td",{className:"p-2",children:"(empty)"})]})]})]})})]})]}),Z("div",{className:"flex items-center gap-4 pt-4",children:[u(nn,{href:"/docs/getting-started/tools/cli",className:"btn-ghost",children:"Back: CLI"}),Z(nn,{href:"/docs/specs",className:"btn-primary",children:["Next: Core Concepts ",u(nd,{size:16})]})]})]})}import{registerDocBlocks as ld}from"@contractspec/lib.contracts-spec/docs";var sd=[{id:"docs.getting-started.start-here",title:"Start here",summary:"Fast onboarding path from install to first generated contract.",kind:"usage",visibility:"public",route:"/docs/getting-started/start-here",tags:["getting-started","onboarding"],body:`# Start Here
955
+ contractspec validate src/contracts/mySpec.ts`})]}),Lt("div",{className:"card-subtle space-y-3 p-6",children:[$e("h2",{className:"font-bold text-2xl",children:"Still blocked?"}),Lt("ul",{className:"space-y-2 text-muted-foreground",children:[$e("li",{children:"Confirm compatibility requirements for runtime and framework."}),$e("li",{children:"Re-run builds on a clean branch to isolate changes."}),$e("li",{children:"Use a new spec and minimal adapter to validate setup."})]})]})]}),Lt("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[$e(tr,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),$e(tr,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"}),Lt(tr,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",$e(od,{size:16})]})]})]})}import{CodeBlock as rd}from"@contractspec/lib.design-system";import nn from"@contractspec/lib.ui-link";import{ChevronRight as nd,ExternalLink as cd}from"lucide-react";import{jsx as u,jsxs as Z}from"react/jsx-runtime";function kb(){let e=[{category:"Core Functionality",items:["Real-time validation with instant feedback on spec errors","Build/Scaffold handlers and components from specs","Interactive spec creation wizard","Watch mode for auto-rebuild on changes","Sync all specs in workspace with one command"]},{category:"Visual Navigation",items:["Specs Explorer sidebar with organized tree view","Dependencies view to visualize spec relationships","Build Results tracking with history","Circular dependency detection"]},{category:"Comparison & Export",items:["Semantic and text diff between specs","Git comparison with baseline branches","OpenAPI 3.1 specification export"]}],t=[{name:"Create New Spec",description:"Interactive wizard to create specs"},{name:"Validate Current Spec",description:"Validate the currently open spec"},{name:"Build/Scaffold from Current Spec",description:"Generate handler/component"},{name:"Toggle Watch Mode",description:"Auto-rebuild on changes"},{name:"Sync All Specs",description:"Build all specs in workspace"},{name:"Analyze Spec Dependencies",description:"Visualize spec dependencies"},{name:"Compare Specs",description:"Semantic or text diff between specs"},{name:"Export to OpenAPI",description:"Generate OpenAPI specification"}];return Z("div",{className:"space-y-8",children:[Z("div",{className:"space-y-2",children:[u("h1",{className:"font-bold text-4xl",children:"VS Code Extension"}),u("p",{className:"text-lg text-muted-foreground",children:"Spec-first development directly in VS Code. Validate, scaffold, and explore your contract specifications with real-time feedback."})]}),Z("div",{className:"flex flex-wrap gap-3",children:[Z("a",{href:"https://marketplace.visualstudio.com/items?itemName=lssm.vscode-contractspec",target:"_blank",rel:"noopener noreferrer",className:"btn-primary inline-flex items-center gap-2",children:["Install Extension ",u(cd,{size:16})]}),u("a",{href:"vscode:extension/lssm.vscode-contractspec",className:"btn-ghost inline-flex items-center gap-2",children:"Open in VS Code"})]}),Z("div",{className:"space-y-6",children:[Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Installation"}),Z("div",{className:"space-y-2",children:[Z("p",{className:"text-muted-foreground text-sm",children:[u("strong",{children:"Option 1:"})," Install from VS Code Marketplace"]}),u(rd,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"}),Z("p",{className:"mt-4 text-muted-foreground text-sm",children:[u("strong",{children:"Option 2:"}),' Search for "ContractSpec" in VS Code Extensions (Ctrl/Cmd+Shift+X)']})]})]}),Z("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Features"}),u("div",{className:"grid gap-4 md:grid-cols-3",children:e.map((o)=>Z("div",{className:"card-subtle space-y-3 p-4",children:[u("h3",{className:"font-bold text-violet-400",children:o.category}),u("ul",{className:"space-y-2",children:o.items.map((n)=>Z("li",{className:"flex items-start gap-2 text-muted-foreground text-sm",children:[u("span",{className:"mt-1 text-violet-400",children:"-"}),u("span",{children:n})]},n))})]},o.category))})]}),Z("div",{className:"space-y-4",children:[u("h2",{className:"font-bold text-2xl",children:"Commands"}),Z("p",{className:"text-muted-foreground",children:["Access commands via Command Palette (Ctrl/Cmd+Shift+P) with prefix"," ",u("code",{children:"ContractSpec:"})]}),u("div",{className:"grid gap-3 md:grid-cols-2",children:t.map((o)=>u("div",{className:"card-subtle flex items-center gap-3 p-3",children:Z("div",{className:"flex-1",children:[u("p",{className:"font-medium font-mono text-sm",children:o.name}),u("p",{className:"text-muted-foreground text-xs",children:o.description})]})},o.name))})]}),Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Sidebar Views"}),u("p",{className:"text-muted-foreground",children:"The extension adds a ContractSpec activity bar (icon in sidebar) with three views:"}),Z("div",{className:"grid gap-4 md:grid-cols-3",children:[Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Specs Explorer"}),u("p",{className:"text-muted-foreground text-sm",children:"Browse all specs organized by type. Shows name, version, and stability. Click to open, right-click for actions."})]}),Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Dependencies"}),u("p",{className:"text-muted-foreground text-sm",children:"Visualize spec relationships. Detect circular dependencies. Navigate to referenced specs."})]}),Z("div",{className:"card-subtle space-y-2 p-4",children:[u("h4",{className:"font-bold",children:"Build Results"}),u("p",{className:"text-muted-foreground text-sm",children:"Track build history (last 20). Success/failure indicators. Click to open generated files."})]})]})]}),Z("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Getting Started"}),Z("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[u("li",{children:"Install the extension from VS Code Marketplace"}),u("li",{children:"Open a workspace with ContractSpec files (or create one)"}),u("li",{children:"Start the walkthrough: Help - Welcome - ContractSpec"}),Z("li",{children:["Create your first spec: Click ",u("strong",{children:"+"})," in Specs Explorer or run ",u("code",{children:"ContractSpec: Create New Spec"})]}),u("li",{children:"Build from it: Click the build icon in the editor title bar"})]})]}),Z("div",{className:"card-subtle space-y-4 p-6",children:[u("h3",{className:"font-bold",children:"Configuration"}),u("p",{className:"text-muted-foreground text-sm",children:"Configure the extension in VS Code Settings:"}),u("div",{className:"overflow-x-auto",children:Z("table",{className:"w-full text-muted-foreground text-sm",children:[u("thead",{children:Z("tr",{className:"border-border border-b",children:[u("th",{className:"p-2 text-left font-medium",children:"Setting"}),u("th",{className:"p-2 text-left font-medium",children:"Description"}),u("th",{className:"p-2 text-left font-medium",children:"Default"})]})}),Z("tbody",{children:[Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"validation.onSave"}),u("td",{className:"p-2",children:"Run validation on save"}),u("td",{className:"p-2",children:"true"})]}),Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"validation.onOpen"}),u("td",{className:"p-2",children:"Run validation on open"}),u("td",{className:"p-2",children:"true"})]}),Z("tr",{className:"border-border border-b",children:[u("td",{className:"p-2 font-mono text-xs",children:"api.baseUrl"}),u("td",{className:"p-2",children:"Base URL for ContractSpec API"}),u("td",{className:"p-2",children:"(empty)"})]})]})]})})]})]}),Z("div",{className:"flex items-center gap-4 pt-4",children:[u(nn,{href:"/docs/getting-started/tools/cli",className:"btn-ghost",children:"Back: CLI"}),Z(nn,{href:"/docs/specs",className:"btn-primary",children:["Next: Core Concepts ",u(nd,{size:16})]})]})]})}import{registerDocBlocks as ld}from"@contractspec/lib.contracts-spec/docs";var sd=[{id:"docs.getting-started.start-here",title:"Start here",summary:"Fast onboarding path from install to first generated contract.",kind:"usage",visibility:"public",route:"/docs/getting-started/start-here",tags:["getting-started","onboarding"],body:`# Start Here
956
956
 
957
957
  Get ContractSpec running quickly and generate your first contract-backed code.
958
958
 
@@ -1053,7 +1053,7 @@ ContractSpec supports modern TypeScript stacks with spec-first workflows.
1053
1053
  - Bring your own adapter for other databases
1054
1054
  `}];ld(sd);import{CodeBlock as Ti}from"@contractspec/lib.design-system";import cn from"@contractspec/lib.ui-link";import{ChevronRight as dd}from"lucide-react";import{jsx as Re,jsxs as Aa}from"react/jsx-runtime";function pd(){return Aa("div",{className:"space-y-8",children:[Aa("div",{className:"space-y-3",children:[Re("h1",{className:"font-bold text-4xl",children:"CI gating with deterministic diffs"}),Re("p",{className:"text-lg text-muted-foreground",children:"Add ContractSpec CI checks that validate specs, detect drift, and gate breaking changes before merge."})]}),Aa("div",{className:"card-subtle space-y-4 p-6",children:[Re("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Aa("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Re("li",{children:"CI workflow running ContractSpec validation and drift checks."}),Re("li",{children:"Machine-readable output for PR annotations."}),Re("li",{children:"Deterministic contract diffs in review."})]})]}),Aa("div",{className:"space-y-6",children:[Aa("div",{className:"space-y-3",children:[Re("h2",{className:"font-bold text-2xl",children:"1) Add the CI workflow"}),Re("p",{className:"text-muted-foreground text-sm",children:"Copy the template from the CLI package."}),Re(Ti,{language:"bash",filename:"ci-copy",code:"cp node_modules/@contractspec/app.cli-contractspec/templates/github-action.yml .github/workflows/contractspec.yml"}),Aa("p",{className:"text-muted-foreground text-sm",children:["Expected output: new workflow file in ",Re("code",{children:".github/workflows"}),"."]})]}),Aa("div",{className:"space-y-3",children:[Re("h2",{className:"font-bold text-2xl",children:"2) Run CI locally"}),Re(Ti,{language:"bash",filename:"ci-local",code:"contractspec ci --format json --check-drift"}),Re("p",{className:"text-muted-foreground text-sm",children:"Expected output: JSON summary including pass/fail counts and drift status (if configured)."})]}),Aa("div",{className:"space-y-3",children:[Re("h2",{className:"font-bold text-2xl",children:"3) Add a diff check"}),Re("p",{className:"text-muted-foreground text-sm",children:"Use the diff command to inspect breaking changes in PRs."}),Re(Ti,{language:"bash",filename:"ci-diff",code:"contractspec diff src/contracts/spec-v1.ts src/contracts/spec-v2.ts --breaking"}),Re("p",{className:"text-muted-foreground text-sm",children:"Expected output: deterministic diff with breaking change hints."})]}),Aa("div",{className:"card-subtle space-y-3 p-6",children:[Re("h3",{className:"font-semibold text-lg",children:"Example package"}),Re("p",{className:"text-muted-foreground text-sm",children:"The CRM pipeline example is already wired in the quickstart smoke test. Use it as a CI-ready template."}),Re(Ti,{language:"bash",filename:"crm-ci",code:`cd packages/examples/crm-pipeline
1055
1055
  bun run build
1056
- bun run validate`})]}),Re(Rt,{title:"Need continuous checks tied to outcomes?",body:"Studio closes the loop with post-change verification and learning dividends that improve future decisions."})]}),Aa("div",{className:"flex items-center gap-4 pt-4",children:[Aa(cn,{href:"/docs/guides",className:"btn-primary",children:["Back to guides ",Re(dd,{size:16})]}),Re(cn,{href:"/docs",className:"btn-ghost",children:"Docs home"})]})]})}import{CodeBlock as Xo}from"@contractspec/lib.design-system";import ln from"@contractspec/lib.ui-link";import{ChevronRight as md}from"lucide-react";import{jsx as q,jsxs as pa}from"react/jsx-runtime";var ud=[".contractspec/connect/context-pack.json",".contractspec/connect/plan-packet.json",".contractspec/connect/patch-verdict.json",".contractspec/connect/audit.ndjson",".contractspec/connect/decisions/<decisionId>/",".contractspec/adoption/catalog.json",".contractspec/adoption/overrides.json"];function gd(){return pa("div",{className:"space-y-8",children:[pa("div",{className:"space-y-3",children:[q("h1",{className:"font-bold text-4xl",children:"Use Connect in a repo"}),q("p",{className:"text-lg text-muted-foreground",children:"Put coding-agent edits and shell commands behind task-scoped context, plan compilation, verification, and local review evidence without introducing a second control plane."})]}),pa("div",{className:"card-subtle space-y-4 p-6",children:[q("h2",{className:"font-bold text-2xl",children:"What you'll build"}),pa("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[q("li",{children:"A workspace-level Connect config in `.contractsrc.json`."}),q("li",{children:"A reuse-first adoption check before new implementation work."}),q("li",{children:"A context and plan flow for one task."}),q("li",{children:"Verified file and shell mutations with local review/replay evidence."})]})]}),pa("div",{className:"space-y-6",children:[pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"1) Enable Connect"}),q("p",{className:"text-muted-foreground text-sm",children:"Start by making the safety policy explicit. Protected paths, generated paths, review thresholds, and command rules live in the workspace config, not in editor-specific hooks."}),q(Xo,{language:"json",filename:".contractsrc.json",code:`{
1056
+ bun run validate`})]}),Re(Rt,{title:"Need continuous checks tied to outcomes?",body:"Studio closes the loop with post-change verification and learning dividends that improve future decisions."})]}),Aa("div",{className:"flex items-center gap-4 pt-4",children:[Aa(cn,{href:"/docs/guides",className:"btn-primary",children:["Back to guides ",Re(dd,{size:16})]}),Re(cn,{href:"/docs",className:"btn-ghost",children:"Docs home"})]})]})}import{CodeBlock as $o}from"@contractspec/lib.design-system";import ln from"@contractspec/lib.ui-link";import{ChevronRight as md}from"lucide-react";import{jsx as V,jsxs as pa}from"react/jsx-runtime";var ud=[".contractspec/connect/context-pack.json",".contractspec/connect/plan-packet.json",".contractspec/connect/patch-verdict.json",".contractspec/connect/audit.ndjson",".contractspec/connect/decisions/<decisionId>/",".contractspec/adoption/catalog.json",".contractspec/adoption/overrides.json"];function gd(){return pa("div",{className:"space-y-8",children:[pa("div",{className:"space-y-3",children:[V("h1",{className:"font-bold text-4xl",children:"Use Connect in a repo"}),V("p",{className:"text-lg text-muted-foreground",children:"Put coding-agent edits and shell commands behind task-scoped context, plan compilation, verification, and local review evidence without introducing a second control plane."})]}),pa("div",{className:"card-subtle space-y-4 p-6",children:[V("h2",{className:"font-bold text-2xl",children:"What you'll build"}),pa("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[V("li",{children:"A workspace-level Connect config in `.contractsrc.json`."}),V("li",{children:"A reuse-first adoption check before new implementation work."}),V("li",{children:"A context and plan flow for one task."}),V("li",{children:"Verified file and shell mutations with local review/replay evidence."})]})]}),pa("div",{className:"space-y-6",children:[pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"1) Enable Connect"}),V("p",{className:"text-muted-foreground text-sm",children:"Start by making the safety policy explicit. Protected paths, generated paths, review thresholds, and command rules live in the workspace config, not in editor-specific hooks."}),V($o,{language:"json",filename:".contractsrc.json",code:`{
1057
1057
  "connect": {
1058
1058
  "enabled": true,
1059
1059
  "storage": {
@@ -1102,25 +1102,25 @@ bun run validate`})]}),Re(Rt,{title:"Need continuous checks tied to outcomes?",b
1102
1102
  }
1103
1103
  }
1104
1104
  }
1105
- }`}),q("p",{className:"text-muted-foreground text-sm",children:"Expected output: Connect has enough policy to classify writes, commands, drift, and review thresholds deterministically."})]}),pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"2) Initialize storage"}),q(Xo,{language:"bash",filename:"connect-init",code:"contractspec connect init --scope workspace"}),q("p",{className:"text-muted-foreground text-sm",children:"Expected output: `.contractsrc.json` is updated if needed and `.contractspec/connect/` is created."})]}),pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"3) Mirror the adoption catalog and resolve reuse first"}),q("p",{className:"text-muted-foreground text-sm",children:"Connect adoption is the reuse-first layer for authoring. Mirror the local catalog, then resolve the best existing surface for the family you are about to touch before you scaffold or invent anything new."}),q(Xo,{language:"bash",filename:"connect-adoption",code:`contractspec connect adoption sync --json
1105
+ }`}),V("p",{className:"text-muted-foreground text-sm",children:"Expected output: Connect has enough policy to classify writes, commands, drift, and review thresholds deterministically."})]}),pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"2) Initialize storage"}),V($o,{language:"bash",filename:"connect-init",code:"contractspec connect init --scope workspace"}),V("p",{className:"text-muted-foreground text-sm",children:"Expected output: `.contractsrc.json` is updated if needed and `.contractspec/connect/` is created."})]}),pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"3) Mirror the adoption catalog and resolve reuse first"}),V("p",{className:"text-muted-foreground text-sm",children:"Connect adoption is the reuse-first layer for authoring. Mirror the local catalog, then resolve the best existing surface for the family you are about to touch before you scaffold or invent anything new."}),V($o,{language:"bash",filename:"connect-adoption",code:`contractspec connect adoption sync --json
1106
1106
 
1107
1107
  printf '{"goal":"Prefer an existing release helper before adding a new one"}' | \\
1108
- contractspec connect adoption resolve --family sharedLibs --stdin --json`}),q("p",{className:"text-muted-foreground text-sm",children:"Expected output: a mirrored local adoption catalog plus a reuse recommendation that can point to an existing workspace package or a ContractSpec surface before the task reaches file mutation."})]}),pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"4) Project context and compile a plan"}),q("p",{className:"text-muted-foreground text-sm",children:"Use the task id as the thread that connects context, plan, verdict, and replay artifacts."}),q(Xo,{language:"bash",filename:"connect-plan",code:`contractspec connect context \\
1108
+ contractspec connect adoption resolve --family sharedLibs --stdin --json`}),V("p",{className:"text-muted-foreground text-sm",children:"Expected output: a mirrored local adoption catalog plus a reuse recommendation that can point to an existing workspace package or a ContractSpec surface before the task reaches file mutation."})]}),pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"4) Project context and compile a plan"}),V("p",{className:"text-muted-foreground text-sm",children:"Use the task id as the thread that connects context, plan, verdict, and replay artifacts."}),V($o,{language:"bash",filename:"connect-plan",code:`contractspec connect context \\
1109
1109
  --task docs-connect \\
1110
1110
  --paths packages/libs/contracts-spec/src/control-plane/contracts.ts \\
1111
1111
  --json
1112
1112
 
1113
1113
  printf '{"objective":"Document the control-plane contract surface","commands":["bun run typecheck"]}' | \\
1114
- contractspec connect plan --task docs-connect --stdin --json`}),q("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `ContextPack` and `PlanPacket` that point back to `controlPlane.intent.submit`, `controlPlane.plan.compile`, and `controlPlane.plan.verify`."})]}),pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"5) Verify file and shell mutations"}),q(Xo,{language:"bash",filename:"connect-verify",code:`printf '{"operation":"edit","path":"packages/libs/contracts-spec/src/control-plane/contracts.ts"}' | \\
1114
+ contractspec connect plan --task docs-connect --stdin --json`}),V("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `ContextPack` and `PlanPacket` that point back to `controlPlane.intent.submit`, `controlPlane.plan.compile`, and `controlPlane.plan.verify`."})]}),pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"5) Verify file and shell mutations"}),V($o,{language:"bash",filename:"connect-verify",code:`printf '{"operation":"edit","path":"packages/libs/contracts-spec/src/control-plane/contracts.ts"}' | \\
1115
1115
  contractspec connect verify --task docs-connect --tool acp.fs.access --stdin --json
1116
1116
 
1117
1117
  printf 'bun run typecheck' | \\
1118
- contractspec connect verify --task docs-connect --tool acp.terminal.exec --stdin --json`}),q("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `PatchVerdict` with `permit`, `rewrite`, `require_review`, or `deny`, plus a runtime-linked control-plane state when that linkage is available."})]}),pa("div",{className:"card-subtle space-y-3 p-6",children:[q("h3",{className:"font-semibold text-lg",children:"Artifacts to inspect"}),q("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ud.map((e)=>q("li",{children:q("code",{children:e})},e))})]}),pa("div",{className:"space-y-3",children:[q("h2",{className:"font-bold text-2xl",children:"6) Review, replay, and optional Studio sync"}),q(Xo,{language:"bash",filename:"connect-review-replay",code:`contractspec connect review list --json
1118
+ contractspec connect verify --task docs-connect --tool acp.terminal.exec --stdin --json`}),V("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `PatchVerdict` with `permit`, `rewrite`, `require_review`, or `deny`, plus a runtime-linked control-plane state when that linkage is available."})]}),pa("div",{className:"card-subtle space-y-3 p-6",children:[V("h3",{className:"font-semibold text-lg",children:"Artifacts to inspect"}),V("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ud.map((e)=>V("li",{children:V("code",{children:e})},e))})]}),pa("div",{className:"space-y-3",children:[V("h2",{className:"font-bold text-2xl",children:"6) Review, replay, and optional Studio sync"}),V($o,{language:"bash",filename:"connect-review-replay",code:`contractspec connect review list --json
1119
1119
  contractspec connect replay <decisionId> --json
1120
1120
  contractspec connect eval <decisionId> --registry ./harness-registry.ts --scenario connect.safe-refactor --json
1121
1121
 
1122
1122
  # Optional when Studio review-bridge mode is enabled
1123
- contractspec connect review sync --decision <decisionId> --json`}),q("p",{className:"text-muted-foreground text-sm",children:"Local review packets remain authoritative. Studio sync is an operator convenience layer, not a requirement for baseline OSS safety."})]})]}),pa("div",{className:"flex items-center gap-4 pt-4",children:[pa(ln,{href:"/docs/specs/connect",className:"btn-primary",children:["Back to Connect spec ",q(md,{size:16})]}),q(ln,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})}import{CodeBlock as ci}from"@contractspec/lib.design-system";import sn from"@contractspec/lib.ui-link";import{ChevronRight as fd,Globe as hd,Layers as yd,Shield as vd,Zap as bd}from"lucide-react";import{jsx as r,jsxs as V}from"react/jsx-runtime";var Nd=[{name:"Operations",factory:"defineCommand / defineQuery",description:"API endpoints with input/output schemas, validation, and policy.",icon:bd,color:"text-blue-400"},{name:"Events",factory:"defineEvent",description:"Domain events with typed payloads and PII handling.",icon:yd,color:"text-green-400"},{name:"Capabilities",factory:"defineCapability",description:"Feature groupings that link operations, events, and UIs.",icon:vd,color:"text-purple-400"},{name:"Presentations",factory:"definePresentation",description:"UI specifications for rendering data and handling interactions.",icon:hd,color:"text-orange-400"}];function wd(){return V("div",{className:"space-y-8",children:[V("div",{className:"space-y-3",children:[r("h1",{className:"font-bold text-4xl",children:"Contract Types Overview"}),r("p",{className:"text-lg text-muted-foreground",children:"Learn about the different contract types in ContractSpec and when to use each one when you are making the system boundary explicit."})]}),V("div",{className:"card-subtle space-y-4 p-6",children:[r("h2",{className:"font-bold text-2xl",children:"Core Contract Types"}),r("div",{className:"grid gap-3 md:grid-cols-2",children:Nd.map((e)=>V("div",{className:"flex items-start gap-3 rounded-lg border border-white/10 p-4",children:[r(e.icon,{className:e.color,size:20}),V("div",{className:"space-y-1",children:[r("h3",{className:"font-semibold",children:e.name}),r("p",{className:"text-muted-foreground text-xs",children:e.description}),r("code",{className:"text-violet-400 text-xs",children:e.factory})]})]},e.name))})]}),V("div",{className:"space-y-6",children:[V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"1) Operations (Commands & Queries)"}),r("p",{className:"text-muted-foreground text-sm",children:"Operations are the backbone of your API. Commands mutate state, queries read state. Both have typed input/output schemas."}),r(ci,{language:"typescript",filename:"src/contracts/user.operation.ts",code:`import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
1123
+ contractspec connect review sync --decision <decisionId> --json`}),V("p",{className:"text-muted-foreground text-sm",children:"Local review packets remain authoritative. Studio sync is an operator convenience layer, not a requirement for baseline OSS safety."})]})]}),pa("div",{className:"flex items-center gap-4 pt-4",children:[pa(ln,{href:"/docs/specs/connect",className:"btn-primary",children:["Back to Connect spec ",V(md,{size:16})]}),V(ln,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})}import{CodeBlock as ci}from"@contractspec/lib.design-system";import sn from"@contractspec/lib.ui-link";import{ChevronRight as hd,Globe as fd,Layers as yd,Shield as vd,Zap as bd}from"lucide-react";import{jsx as r,jsxs as H}from"react/jsx-runtime";var Nd=[{name:"Operations",factory:"defineCommand / defineQuery",description:"API endpoints with input/output schemas, validation, and policy.",icon:bd,color:"text-blue-400"},{name:"Events",factory:"defineEvent",description:"Domain events with typed payloads and PII handling.",icon:yd,color:"text-green-400"},{name:"Capabilities",factory:"defineCapability",description:"Feature groupings that link operations, events, and UIs.",icon:vd,color:"text-purple-400"},{name:"Presentations",factory:"definePresentation",description:"UI specifications for rendering data and handling interactions.",icon:fd,color:"text-orange-400"}];function wd(){return H("div",{className:"space-y-8",children:[H("div",{className:"space-y-3",children:[r("h1",{className:"font-bold text-4xl",children:"Contract Types Overview"}),r("p",{className:"text-lg text-muted-foreground",children:"Learn about the different contract types in ContractSpec and when to use each one when you are making the system boundary explicit."})]}),H("div",{className:"card-subtle space-y-4 p-6",children:[r("h2",{className:"font-bold text-2xl",children:"Core Contract Types"}),r("div",{className:"grid gap-3 md:grid-cols-2",children:Nd.map((e)=>H("div",{className:"flex items-start gap-3 rounded-lg border border-white/10 p-4",children:[r(e.icon,{className:e.color,size:20}),H("div",{className:"space-y-1",children:[r("h3",{className:"font-semibold",children:e.name}),r("p",{className:"text-muted-foreground text-xs",children:e.description}),r("code",{className:"text-violet-400 text-xs",children:e.factory})]})]},e.name))})]}),H("div",{className:"space-y-6",children:[H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"1) Operations (Commands & Queries)"}),r("p",{className:"text-muted-foreground text-sm",children:"Operations are the backbone of your API. Commands mutate state, queries read state. Both have typed input/output schemas."}),r(ci,{language:"typescript",filename:"src/contracts/user.operation.ts",code:`import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
1124
1124
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1125
1125
 
1126
1126
  // Command: Mutates state (creates a user)
@@ -1186,7 +1186,7 @@ export const GetUserQuery = defineQuery({
1186
1186
  }),
1187
1187
  },
1188
1188
  policy: { auth: "user" },
1189
- });`})]}),V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"2) Events"}),r("p",{className:"text-muted-foreground text-sm",children:"Events represent domain occurrences. They have typed payloads with PII field marking for compliance."}),r(ci,{language:"typescript",filename:"src/contracts/user.event.ts",code:`import { defineEvent } from "@contractspec/lib.contracts-spec";
1189
+ });`})]}),H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"2) Events"}),r("p",{className:"text-muted-foreground text-sm",children:"Events represent domain occurrences. They have typed payloads with PII field marking for compliance."}),r(ci,{language:"typescript",filename:"src/contracts/user.event.ts",code:`import { defineEvent } from "@contractspec/lib.contracts-spec";
1190
1190
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1191
1191
 
1192
1192
  export const UserCreatedEvent = defineEvent({
@@ -1227,7 +1227,7 @@ export const UserDeletedEvent = defineEvent({
1227
1227
  reason: { type: ScalarTypeEnum.String(), isOptional: true },
1228
1228
  },
1229
1229
  }),
1230
- });`})]}),V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"3) Capabilities"}),r("p",{className:"text-muted-foreground text-sm",children:"Capabilities group related operations, events, and presentations. They define feature boundaries and dependencies."}),r(ci,{language:"typescript",filename:"src/contracts/user-management.capability.ts",code:`import { defineCapability } from "@contractspec/lib.contracts-spec";
1230
+ });`})]}),H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"3) Capabilities"}),r("p",{className:"text-muted-foreground text-sm",children:"Capabilities group related operations, events, and presentations. They define feature boundaries and dependencies."}),r(ci,{language:"typescript",filename:"src/contracts/user-management.capability.ts",code:`import { defineCapability } from "@contractspec/lib.contracts-spec";
1231
1231
 
1232
1232
  export const UserManagementCapability = defineCapability({
1233
1233
  meta: {
@@ -1270,7 +1270,7 @@ export const AdminUserCapability = defineCapability({
1270
1270
  { surface: "operation", key: "user.ban", version: "1.0.0" },
1271
1271
  { surface: "operation", key: "user.impersonate", version: "1.0.0" },
1272
1272
  ],
1273
- });`})]}),V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"4) Presentations"}),r("p",{className:"text-muted-foreground text-sm",children:"Presentations define UI specifications. They link to capabilities and specify how data should be displayed."}),r(ci,{language:"typescript",filename:"src/contracts/user-list.presentation.ts",code:`import { definePresentation } from "@contractspec/lib.contracts-spec";
1273
+ });`})]}),H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"4) Presentations"}),r("p",{className:"text-muted-foreground text-sm",children:"Presentations define UI specifications. They link to capabilities and specify how data should be displayed."}),r(ci,{language:"typescript",filename:"src/contracts/user-list.presentation.ts",code:`import { definePresentation } from "@contractspec/lib.contracts-spec";
1274
1274
 
1275
1275
  export const UserListPresentation = definePresentation({
1276
1276
  meta: {
@@ -1292,7 +1292,7 @@ export const UserListPresentation = definePresentation({
1292
1292
  pagination: { defaultPageSize: 25 },
1293
1293
  search: { fields: ["name", "email"] },
1294
1294
  },
1295
- });`})]}),V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"5) Additional Contract Types"}),r("p",{className:"text-muted-foreground text-sm",children:"ContractSpec provides specialized contracts for different concerns:"}),V("div",{className:"grid gap-4 md:grid-cols-2",children:[V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Policy"}),r("code",{className:"text-violet-400 text-xs",children:"definePolicy"}),r("p",{className:"text-muted-foreground text-xs",children:"RBAC/ABAC rules, rate limits, and access control."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Workflow"}),r("code",{className:"text-violet-400 text-xs",children:"defineWorkflow"}),r("p",{className:"text-muted-foreground text-xs",children:"Multi-step processes with states, transitions, and SLAs."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Translation"}),r("code",{className:"text-violet-400 text-xs",children:"defineTranslation"}),r("p",{className:"text-muted-foreground text-xs",children:"i18n messages with ICU format and locale fallbacks."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Integration"}),r("code",{className:"text-violet-400 text-xs",children:"defineIntegration"}),r("p",{className:"text-muted-foreground text-xs",children:"External service connections and API adapters."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Form"}),r("code",{className:"text-violet-400 text-xs",children:"defineFormSpec"}),r("p",{className:"text-muted-foreground text-xs",children:"Form definitions with fields, validation, and layouts."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Data View"}),r("code",{className:"text-violet-400 text-xs",children:"defineDataView"}),r("p",{className:"text-muted-foreground text-xs",children:"Read-only data projections and aggregations."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Feature"}),r("code",{className:"text-violet-400 text-xs",children:"defineFeature"}),r("p",{className:"text-muted-foreground text-xs",children:"Feature flags and progressive rollout configurations."})]}),V("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Test"}),r("code",{className:"text-violet-400 text-xs",children:"defineTestSpec"}),r("p",{className:"text-muted-foreground text-xs",children:"Contract-driven test scenarios and fixtures."})]})]})]}),V("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"6) Registering Contracts"}),r("p",{className:"text-muted-foreground text-sm",children:"Each contract type has a registry for lookup and validation."}),r(ci,{language:"typescript",filename:"src/contracts/registry.ts",code:`import {
1295
+ });`})]}),H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"5) Additional Contract Types"}),r("p",{className:"text-muted-foreground text-sm",children:"ContractSpec provides specialized contracts for different concerns:"}),H("div",{className:"grid gap-4 md:grid-cols-2",children:[H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Policy"}),r("code",{className:"text-violet-400 text-xs",children:"definePolicy"}),r("p",{className:"text-muted-foreground text-xs",children:"RBAC/ABAC rules, rate limits, and access control."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Workflow"}),r("code",{className:"text-violet-400 text-xs",children:"defineWorkflow"}),r("p",{className:"text-muted-foreground text-xs",children:"Multi-step processes with states, transitions, and SLAs."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Translation"}),r("code",{className:"text-violet-400 text-xs",children:"defineTranslation"}),r("p",{className:"text-muted-foreground text-xs",children:"i18n messages with ICU format and locale fallbacks."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Integration"}),r("code",{className:"text-violet-400 text-xs",children:"defineIntegration"}),r("p",{className:"text-muted-foreground text-xs",children:"External service connections and API adapters."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Form"}),r("code",{className:"text-violet-400 text-xs",children:"defineFormSpec"}),r("p",{className:"text-muted-foreground text-xs",children:"Form definitions with fields, validation, and layouts."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Data View"}),r("code",{className:"text-violet-400 text-xs",children:"defineDataView"}),r("p",{className:"text-muted-foreground text-xs",children:"Read-only data projections and aggregations."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Feature"}),r("code",{className:"text-violet-400 text-xs",children:"defineFeature"}),r("p",{className:"text-muted-foreground text-xs",children:"Feature flags and progressive rollout configurations."})]}),H("div",{className:"card-subtle space-y-2 p-4",children:[r("h3",{className:"font-semibold",children:"Test"}),r("code",{className:"text-violet-400 text-xs",children:"defineTestSpec"}),r("p",{className:"text-muted-foreground text-xs",children:"Contract-driven test scenarios and fixtures."})]})]})]}),H("div",{className:"space-y-3",children:[r("h2",{className:"font-bold text-2xl",children:"6) Registering Contracts"}),r("p",{className:"text-muted-foreground text-sm",children:"Each contract type has a registry for lookup and validation."}),r(ci,{language:"typescript",filename:"src/contracts/registry.ts",code:`import {
1296
1296
  OperationSpecRegistry,
1297
1297
  installOp,
1298
1298
  } from "@contractspec/lib.contracts-spec/operations";
@@ -1322,9 +1322,9 @@ installOp(operationRegistry, GetUserQuery, async (input) => {
1322
1322
 
1323
1323
  // Register events and capabilities
1324
1324
  eventRegistry.register(UserCreatedEvent);
1325
- capabilityRegistry.register(UserManagementCapability);`})]}),V("div",{className:"card-subtle space-y-3 p-6",children:[r("h3",{className:"font-semibold text-lg",children:"Contract Type Decision Guide"}),V("table",{className:"w-full text-sm",children:[r("thead",{children:V("tr",{className:"border-white/10 border-b",children:[r("th",{className:"py-2 text-left",children:"When you need..."}),r("th",{className:"py-2 text-left",children:"Use this contract"})]})}),V("tbody",{className:"text-muted-foreground",children:[V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"An API endpoint that changes data"}),r("td",{className:"py-2",children:r("code",{children:"defineCommand"})})]}),V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"An API endpoint that reads data"}),r("td",{className:"py-2",children:r("code",{children:"defineQuery"})})]}),V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Async notification of something that happened"}),r("td",{className:"py-2",children:r("code",{children:"defineEvent"})})]}),V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Group related specs under a feature"}),r("td",{className:"py-2",children:r("code",{children:"defineCapability"})})]}),V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Define UI rendering specifications"}),r("td",{className:"py-2",children:r("code",{children:"definePresentation"})})]}),V("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Access control and rate limiting"}),r("td",{className:"py-2",children:r("code",{children:"definePolicy"})})]}),V("tr",{children:[r("td",{className:"py-2",children:"Multi-step business processes"}),r("td",{className:"py-2",children:r("code",{children:"defineWorkflow"})})]})]})]})]}),r(Rt,{title:"Need to decide which contract should change next?",body:"Studio uses evidence and focus constraints to generate decision briefs, patch intents, and execution-ready task packs."})]}),V("div",{className:"flex items-center gap-4 pt-4",children:[V(sn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next: Add your first endpoint ",r(fd,{size:16})]}),r(sn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as ar}from"@contractspec/lib.design-system";import dn from"@contractspec/lib.ui-link";import{ChevronRight as kd}from"lucide-react";import{jsx as Qe,jsxs as $t}from"react/jsx-runtime";function Sd(){return $t("div",{className:"space-y-8",children:[$t("div",{className:"space-y-3",children:[Qe("h1",{className:"font-bold text-4xl",children:"Build the docs pipeline"}),Qe("p",{className:"text-lg text-muted-foreground",children:"Generate reference docs, chunk the index, and wire the docs pages the same way this repo does."})]}),$t("div",{className:"card-subtle space-y-4 p-6",children:[Qe("h2",{className:"font-bold text-2xl",children:"What you'll build"}),$t("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Qe("li",{children:"Generated Markdown and a chunked index manifest."}),Qe("li",{children:"Reference routes powered by the docs loader."}),Qe("li",{children:"Versioned outputs you can publish per release."})]})]}),$t("div",{className:"space-y-6",children:[$t("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"1) Generate contract docs"}),Qe(ar,{language:"bash",filename:"generate-contract-docs",code:"contractspec generate"}),$t("p",{className:"text-muted-foreground text-sm",children:["Expected output: Markdown in ",Qe("code",{children:"generated/docs"}),"."]})]}),$t("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"2) Build the docs index"}),Qe(ar,{language:"bash",filename:"docs-generate",code:`bun docs:generate
1325
+ capabilityRegistry.register(UserManagementCapability);`})]}),H("div",{className:"card-subtle space-y-3 p-6",children:[r("h3",{className:"font-semibold text-lg",children:"Contract Type Decision Guide"}),H("table",{className:"w-full text-sm",children:[r("thead",{children:H("tr",{className:"border-white/10 border-b",children:[r("th",{className:"py-2 text-left",children:"When you need..."}),r("th",{className:"py-2 text-left",children:"Use this contract"})]})}),H("tbody",{className:"text-muted-foreground",children:[H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"An API endpoint that changes data"}),r("td",{className:"py-2",children:r("code",{children:"defineCommand"})})]}),H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"An API endpoint that reads data"}),r("td",{className:"py-2",children:r("code",{children:"defineQuery"})})]}),H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Async notification of something that happened"}),r("td",{className:"py-2",children:r("code",{children:"defineEvent"})})]}),H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Group related specs under a feature"}),r("td",{className:"py-2",children:r("code",{children:"defineCapability"})})]}),H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Define UI rendering specifications"}),r("td",{className:"py-2",children:r("code",{children:"definePresentation"})})]}),H("tr",{className:"border-white/5 border-b",children:[r("td",{className:"py-2",children:"Access control and rate limiting"}),r("td",{className:"py-2",children:r("code",{children:"definePolicy"})})]}),H("tr",{children:[r("td",{className:"py-2",children:"Multi-step business processes"}),r("td",{className:"py-2",children:r("code",{children:"defineWorkflow"})})]})]})]})]}),r(Rt,{title:"Need to decide which contract should change next?",body:"Studio uses evidence and focus constraints to generate decision briefs, patch intents, and execution-ready task packs."})]}),H("div",{className:"flex items-center gap-4 pt-4",children:[H(sn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next: Add your first endpoint ",r(hd,{size:16})]}),r(sn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as ar}from"@contractspec/lib.design-system";import dn from"@contractspec/lib.ui-link";import{ChevronRight as kd}from"lucide-react";import{jsx as Qe,jsxs as Xt}from"react/jsx-runtime";function Sd(){return Xt("div",{className:"space-y-8",children:[Xt("div",{className:"space-y-3",children:[Qe("h1",{className:"font-bold text-4xl",children:"Build the docs pipeline"}),Qe("p",{className:"text-lg text-muted-foreground",children:"Generate reference docs, chunk the index, and wire the docs pages the same way this repo does."})]}),Xt("div",{className:"card-subtle space-y-4 p-6",children:[Qe("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Xt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Qe("li",{children:"Generated Markdown and a chunked index manifest."}),Qe("li",{children:"Reference routes powered by the docs loader."}),Qe("li",{children:"Versioned outputs you can publish per release."})]})]}),Xt("div",{className:"space-y-6",children:[Xt("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"1) Generate contract docs"}),Qe(ar,{language:"bash",filename:"generate-contract-docs",code:"contractspec generate"}),Xt("p",{className:"text-muted-foreground text-sm",children:["Expected output: Markdown in ",Qe("code",{children:"generated/docs"}),"."]})]}),Xt("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"2) Build the docs index"}),Qe(ar,{language:"bash",filename:"docs-generate",code:`bun docs:generate
1326
1326
  # versioned output
1327
- bun docs:generate -- --version v1.0.0`}),$t("p",{className:"text-muted-foreground text-sm",children:["This writes ",Qe("code",{children:"docs-index.manifest.json"})," and chunked",Qe("code",{children:"docs-index.*.json"})," files in the generated docs bundle."]})]}),$t("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"3) Wire reference routes"}),Qe(ar,{language:"tsx",filename:"docs-reference-route",code:`import { notFound } from "next/navigation";
1327
+ bun docs:generate -- --version v1.0.0`}),Xt("p",{className:"text-muted-foreground text-sm",children:["This writes ",Qe("code",{children:"docs-index.manifest.json"})," and chunked",Qe("code",{children:"docs-index.*.json"})," files in the generated docs bundle."]})]}),Xt("div",{className:"space-y-3",children:[Qe("h2",{className:"font-bold text-2xl",children:"3) Wire reference routes"}),Qe(ar,{language:"tsx",filename:"docs-reference-route",code:`import { notFound } from "next/navigation";
1328
1328
  import {
1329
1329
  DocsReferenceIndexPage,
1330
1330
  DocsReferencePage,
@@ -1342,7 +1342,7 @@ export default async function Page({ params }: { params: { slug?: string[] } })
1342
1342
  const doc = await getGeneratedDocById(slug);
1343
1343
  if (!doc) notFound();
1344
1344
  return <DocsReferencePage entry={doc.entry} content={doc.content} />;
1345
- }`}),$t("p",{className:"text-muted-foreground text-sm",children:["Use the index page on ",Qe("code",{children:"/docs/reference"})," to render the searchable list."]})]}),$t("div",{className:"card-subtle space-y-3 p-6",children:[Qe("h3",{className:"font-semibold text-lg",children:"Repo reference"}),$t("p",{className:"text-muted-foreground text-sm",children:["This repo wires docs under"," ",Qe("code",{children:"packages/apps/web-landing/src/app/docs/reference"}),"."]})]}),Qe(Rt,{title:"Need decision-to-export automation?",body:"Studio exports evidence-backed spec changes and task packs to Linear, Jira, Notion, and GitHub."})]}),$t("div",{className:"flex items-center gap-4 pt-4",children:[$t(dn,{href:"/docs/guides/ci-contract-diff-gating",className:"btn-primary",children:["Next: CI gating ",Qe(kd,{size:16})]}),Qe(dn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as or}from"@contractspec/lib.design-system";import pn from"@contractspec/lib.ui-link";import{ChevronRight as Cd}from"lucide-react";import{jsx as he,jsxs as Ra}from"react/jsx-runtime";function Id(){return Ra("div",{className:"space-y-8",children:[Ra("div",{className:"space-y-3",children:[he("h1",{className:"font-bold text-4xl",children:"Build a first module bundle"}),he("p",{className:"text-lg text-muted-foreground",children:"Define one bundle spec, resolve it for a real route and preference profile, then render the resulting surface plan through the React host layer."})]}),Ra("div",{className:"card-subtle space-y-4 p-6",children:[he("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Ra("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[he("li",{children:"One `ModuleBundleSpec` with a route and workbench surface."}),he("li",{children:"One `ResolvedSurfacePlan` from `resolveBundle`."}),he("li",{children:"One React host using `BundleProvider` and `BundleRenderer`."})]})]}),Ra("div",{className:"space-y-6",children:[Ra("div",{className:"space-y-3",children:[he("h2",{className:"font-bold text-2xl",children:"1) Define the bundle spec"}),he("p",{className:"text-muted-foreground text-sm",children:"The bundle spec is the durable contract. It owns route selection, surface shape, layouts, data recipes, and verification coverage for all seven preference dimensions."}),he(or,{language:"typescript",filename:"src/bundles/support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
1345
+ }`}),Xt("p",{className:"text-muted-foreground text-sm",children:["Use the index page on ",Qe("code",{children:"/docs/reference"})," to render the searchable list."]})]}),Xt("div",{className:"card-subtle space-y-3 p-6",children:[Qe("h3",{className:"font-semibold text-lg",children:"Repo reference"}),Xt("p",{className:"text-muted-foreground text-sm",children:["This repo wires docs under"," ",Qe("code",{children:"packages/apps/web-landing/src/app/docs/reference"}),"."]})]}),Qe(Rt,{title:"Need decision-to-export automation?",body:"Studio exports evidence-backed spec changes and task packs to Linear, Jira, Notion, and GitHub."})]}),Xt("div",{className:"flex items-center gap-4 pt-4",children:[Xt(dn,{href:"/docs/guides/ci-contract-diff-gating",className:"btn-primary",children:["Next: CI gating ",Qe(kd,{size:16})]}),Qe(dn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as or}from"@contractspec/lib.design-system";import pn from"@contractspec/lib.ui-link";import{ChevronRight as Cd}from"lucide-react";import{jsx as fe,jsxs as Ra}from"react/jsx-runtime";function Id(){return Ra("div",{className:"space-y-8",children:[Ra("div",{className:"space-y-3",children:[fe("h1",{className:"font-bold text-4xl",children:"Build a first module bundle"}),fe("p",{className:"text-lg text-muted-foreground",children:"Define one bundle spec, resolve it for a real route and preference profile, then render the resulting surface plan through the React host layer."})]}),Ra("div",{className:"card-subtle space-y-4 p-6",children:[fe("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Ra("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[fe("li",{children:"One `ModuleBundleSpec` with a route and workbench surface."}),fe("li",{children:"One `ResolvedSurfacePlan` from `resolveBundle`."}),fe("li",{children:"One React host using `BundleProvider` and `BundleRenderer`."})]})]}),Ra("div",{className:"space-y-6",children:[Ra("div",{className:"space-y-3",children:[fe("h2",{className:"font-bold text-2xl",children:"1) Define the bundle spec"}),fe("p",{className:"text-muted-foreground text-sm",children:"The bundle spec is the durable contract. It owns route selection, surface shape, layouts, data recipes, and verification coverage for all seven preference dimensions."}),fe(or,{language:"typescript",filename:"src/bundles/support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
1346
1346
 
1347
1347
  export const SupportWorkbenchBundle = defineModuleBundle({
1348
1348
  meta: {
@@ -1384,7 +1384,7 @@ export const SupportWorkbenchBundle = defineModuleBundle({
1384
1384
  },
1385
1385
  },
1386
1386
  },
1387
- });`}),he("p",{className:"text-muted-foreground text-sm",children:"Expected output: `defineModuleBundle` validates the route, surface, and verification dimensions at runtime."})]}),Ra("div",{className:"space-y-3",children:[he("h2",{className:"font-bold text-2xl",children:"2) Resolve the plan"}),he("p",{className:"text-muted-foreground text-sm",children:"Resolve against a real route, device, and preference profile. This is where the runtime chooses the surface, layout, bindings, and audit reasons."}),he(or,{language:"typescript",filename:"src/runtime/resolve-support-workbench.ts",code:`import { resolveBundle } from "@contractspec/lib.surface-runtime/runtime/resolve-bundle";
1387
+ });`}),fe("p",{className:"text-muted-foreground text-sm",children:"Expected output: `defineModuleBundle` validates the route, surface, and verification dimensions at runtime."})]}),Ra("div",{className:"space-y-3",children:[fe("h2",{className:"font-bold text-2xl",children:"2) Resolve the plan"}),fe("p",{className:"text-muted-foreground text-sm",children:"Resolve against a real route, device, and preference profile. This is where the runtime chooses the surface, layout, bindings, and audit reasons."}),fe(or,{language:"typescript",filename:"src/runtime/resolve-support-workbench.ts",code:`import { resolveBundle } from "@contractspec/lib.surface-runtime/runtime/resolve-bundle";
1388
1388
 
1389
1389
  export const supportWorkbenchPlan = await resolveBundle(
1390
1390
  SupportWorkbenchBundle,
@@ -1408,7 +1408,7 @@ export const supportWorkbenchPlan = await resolveBundle(
1408
1408
  },
1409
1409
  capabilities: ["tickets.read", "tickets.update"],
1410
1410
  }
1411
- );`}),he("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `ResolvedSurfacePlan` with `bundleKey`, `surfaceId`, `layoutId`, `bindings`, `adaptation`, and audit reasons."})]}),Ra("div",{className:"space-y-3",children:[he("h2",{className:"font-bold text-2xl",children:"3) Render the plan"}),he("p",{className:"text-muted-foreground text-sm",children:"The host app renders the resolved plan, not the raw spec. That keeps layout selection, overlays, and AI proposals downstream of the declared bundle contract."}),he(or,{language:"tsx",filename:"src/app/support/SurfaceHost.tsx",code:`import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
1411
+ );`}),fe("p",{className:"text-muted-foreground text-sm",children:"Expected output: a `ResolvedSurfacePlan` with `bundleKey`, `surfaceId`, `layoutId`, `bindings`, `adaptation`, and audit reasons."})]}),Ra("div",{className:"space-y-3",children:[fe("h2",{className:"font-bold text-2xl",children:"3) Render the plan"}),fe("p",{className:"text-muted-foreground text-sm",children:"The host app renders the resolved plan, not the raw spec. That keeps layout selection, overlays, and AI proposals downstream of the declared bundle contract."}),fe(or,{language:"tsx",filename:"src/app/support/SurfaceHost.tsx",code:`import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
1412
1412
 
1413
1413
  export function SurfaceHost() {
1414
1414
  return (
@@ -1416,7 +1416,7 @@ export function SurfaceHost() {
1416
1416
  <BundleRenderer assistantSlotId="assistant" />
1417
1417
  </BundleProvider>
1418
1418
  );
1419
- }`}),he("p",{className:"text-muted-foreground text-sm",children:"Expected output: the route renders according to the resolved layout root and slot plan instead of bespoke page assembly."})]}),Ra("div",{className:"card-subtle space-y-3 p-6",children:[he("h3",{className:"font-semibold text-lg",children:"Verification checks"}),Ra("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[he("li",{children:"The resolved `surfaceId` matches the route you expected."}),he("li",{children:"The `layoutId` is stable for the active view and preferences."}),he("li",{children:"The plan carries audit reasons and all seven adaptation dimensions."}),he("li",{children:"Assistant or overlay work stays within declared slots."})]})]})]}),Ra("div",{className:"flex items-center gap-4 pt-4",children:[Ra(pn,{href:"/docs/specs/module-bundles",className:"btn-primary",children:["Back to module bundles ",he(Cd,{size:16})]}),he(pn,{href:"/docs/specs/overlays",className:"btn-ghost",children:"Next: overlays"})]})]})}import{CodeBlock as Ai}from"@contractspec/lib.design-system";import mn from"@contractspec/lib.ui-link";import{ChevronRight as Pd}from"lucide-react";import{jsx as Le,jsxs as ma}from"react/jsx-runtime";function Td(){return ma("div",{className:"space-y-8",children:[ma("div",{className:"space-y-3",children:[Le("h1",{className:"font-bold text-4xl",children:"Generate docs + client schemas"}),Le("p",{className:"text-lg text-muted-foreground",children:"Generate docs and OpenAPI output from ContractSpec operations to power SDKs, docs sites, and tooling."})]}),ma("div",{className:"card-subtle space-y-4 p-6",children:[Le("h2",{className:"font-bold text-2xl",children:"What you'll build"}),ma("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Le("li",{children:"Export docs from your specs."}),Le("li",{children:"Emit OpenAPI 3.1 for client SDK generation."}),Le("li",{children:"Keep outputs deterministic with CI validation."})]})]}),ma("div",{className:"space-y-6",children:[ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"1) Generate docs"}),Le("p",{className:"text-muted-foreground text-sm",children:"Use the generator to emit docs from your contracts."}),Le(Ai,{language:"bash",filename:"generate-docs",code:"contractspec generate"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output: ",Le("code",{children:"Generate X doc files in generated/docs"}),"."]})]}),ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"2) Export OpenAPI"}),Le("p",{className:"text-muted-foreground text-sm",children:"Export an OpenAPI document from your registry module."}),Le(Ai,{language:"bash",filename:"openapi-export",code:"contractspec openapi export --registry ./src/contracts/registry.ts --out ./generated/openapi.json"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output:"," ",Le("code",{children:"OpenAPI written to .../generated/openapi.json"}),"."]})]}),ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"3) Validate specs"}),Le(Ai,{language:"bash",filename:"validate-specs",code:"contractspec validate"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output: ",Le("code",{children:"Validation passed"}),"."]})]}),ma("div",{className:"card-subtle space-y-3 p-6",children:[Le("h3",{className:"font-semibold text-lg",children:"Example package"}),Le("p",{className:"text-muted-foreground text-sm",children:"The Integration Hub example provides a full registry of operations and is a good source for OpenAPI exports."}),Le(Ai,{language:"bash",filename:"integration-hub-example",code:`contractspec examples show integration-hub
1419
+ }`}),fe("p",{className:"text-muted-foreground text-sm",children:"Expected output: the route renders according to the resolved layout root and slot plan instead of bespoke page assembly."})]}),Ra("div",{className:"card-subtle space-y-3 p-6",children:[fe("h3",{className:"font-semibold text-lg",children:"Verification checks"}),Ra("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[fe("li",{children:"The resolved `surfaceId` matches the route you expected."}),fe("li",{children:"The `layoutId` is stable for the active view and preferences."}),fe("li",{children:"The plan carries audit reasons and all seven adaptation dimensions."}),fe("li",{children:"Assistant or overlay work stays within declared slots."})]})]})]}),Ra("div",{className:"flex items-center gap-4 pt-4",children:[Ra(pn,{href:"/docs/specs/module-bundles",className:"btn-primary",children:["Back to module bundles ",fe(Cd,{size:16})]}),fe(pn,{href:"/docs/specs/overlays",className:"btn-ghost",children:"Next: overlays"})]})]})}import{CodeBlock as Ai}from"@contractspec/lib.design-system";import mn from"@contractspec/lib.ui-link";import{ChevronRight as Pd}from"lucide-react";import{jsx as Le,jsxs as ma}from"react/jsx-runtime";function Td(){return ma("div",{className:"space-y-8",children:[ma("div",{className:"space-y-3",children:[Le("h1",{className:"font-bold text-4xl",children:"Generate docs + client schemas"}),Le("p",{className:"text-lg text-muted-foreground",children:"Generate docs and OpenAPI output from ContractSpec operations to power SDKs, docs sites, and tooling."})]}),ma("div",{className:"card-subtle space-y-4 p-6",children:[Le("h2",{className:"font-bold text-2xl",children:"What you'll build"}),ma("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Le("li",{children:"Export docs from your specs."}),Le("li",{children:"Emit OpenAPI 3.1 for client SDK generation."}),Le("li",{children:"Keep outputs deterministic with CI validation."})]})]}),ma("div",{className:"space-y-6",children:[ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"1) Generate docs"}),Le("p",{className:"text-muted-foreground text-sm",children:"Use the generator to emit docs from your contracts."}),Le(Ai,{language:"bash",filename:"generate-docs",code:"contractspec generate"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output: ",Le("code",{children:"Generate X doc files in generated/docs"}),"."]})]}),ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"2) Export OpenAPI"}),Le("p",{className:"text-muted-foreground text-sm",children:"Export an OpenAPI document from your registry module."}),Le(Ai,{language:"bash",filename:"openapi-export",code:"contractspec openapi export --registry ./src/contracts/registry.ts --out ./generated/openapi.json"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output:"," ",Le("code",{children:"OpenAPI written to .../generated/openapi.json"}),"."]})]}),ma("div",{className:"space-y-3",children:[Le("h2",{className:"font-bold text-2xl",children:"3) Validate specs"}),Le(Ai,{language:"bash",filename:"validate-specs",code:"contractspec validate"}),ma("p",{className:"text-muted-foreground text-sm",children:["Expected output: ",Le("code",{children:"Validation passed"}),"."]})]}),ma("div",{className:"card-subtle space-y-3 p-6",children:[Le("h3",{className:"font-semibold text-lg",children:"Example package"}),Le("p",{className:"text-muted-foreground text-sm",children:"The Integration Hub example provides a full registry of operations and is a good source for OpenAPI exports."}),Le(Ai,{language:"bash",filename:"integration-hub-example",code:`contractspec examples show integration-hub
1420
1420
 
1421
1421
  # openapi export against your registry module
1422
1422
  contractspec openapi export --registry ./src/contracts/registry.ts --out ./generated/openapi.json`})]}),Le(Rt,{title:"Want exports tied to product decisions?",body:"Studio compiles approved changes into deliverables and pushes them to your execution stack with full evidence context."})]}),ma("div",{className:"flex items-center gap-4 pt-4",children:[ma(mn,{href:"/docs/guides/docs-generation-pipeline",className:"btn-primary",children:["Next: Docs pipeline ",Le(Pd,{size:16})]}),Le(mn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as zo}from"@contractspec/lib.design-system";import un from"@contractspec/lib.ui-link";import{ChevronRight as Ad}from"lucide-react";import{jsx as D,jsxs as Et}from"react/jsx-runtime";var Rd=["builder.workspace.bootstrap","builder.channel.receiveInbound","builder.blueprint.generate","builder.plan.compile","builder.preview.create","builder.preview.runHarness","builder.export.prepare","builder.export.approve","builder.export.execute"],Ld=["local runtime trust and lease details","channel-action posture for mobile/operator follow-up","comparison posture and export readiness from the shared snapshot"];function Ed(){return Et("div",{className:"space-y-8",children:[Et("div",{className:"space-y-3",children:[D("h1",{className:"font-bold text-4xl",children:"Host the Builder workbench"}),D("p",{className:"text-lg text-muted-foreground",children:"Use the reusable Builder workbench as the desktop control surface for snapshot loading, guided authoring, preview, readiness, export, and mobile review handoff."})]}),Et("div",{className:"card-subtle space-y-4 p-6",children:[D("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Et("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[D("li",{children:"A workspace snapshot fetch path."}),D("li",{children:"A `BuilderWorkbench` host with action callbacks."}),D("li",{children:"Runtime-mode aware preview/export controls plus mobile review links."})]})]}),Et("div",{className:"space-y-6",children:[Et("div",{className:"space-y-3",children:[D("h2",{className:"font-bold text-2xl",children:"1) Fetch the workspace snapshot"}),D("p",{className:"text-muted-foreground text-sm",children:"The web shell already exposes a query path for the current Builder workspace snapshot. Your host should load it first, then refresh it after each successful command."}),D(zo,{language:"typescript",filename:"builder-workbench-controller.ts",code:`export async function fetchBuilderSnapshot(workspaceId: string) {
@@ -1633,7 +1633,7 @@ installOp(registry, GetUserQuery, async (input) => {
1633
1633
  installOp(registry, CreateUserCommand, async (input) => {
1634
1634
  const user = await db.user.create({ data: input });
1635
1635
  return { id: user.id };
1636
- });`})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"6) After importing"}),g("ol",{className:"list-decimal space-y-2 pl-5 text-muted-foreground text-sm",children:[g("li",{children:[i("strong",{children:"Review generated contracts"})," — Check the TODO placeholders and fill in descriptions, owners, and tags."]}),g("li",{children:[i("strong",{children:"Refine schemas"})," — Add proper types, validation rules, and error definitions."]}),g("li",{children:[i("strong",{children:"Run validation"})," —"," ",i("code",{children:"contractspec validate"})," to ensure contracts are valid."]}),g("li",{children:[i("strong",{children:"Register and wire handlers"})," — Connect contracts to your existing business logic."]}),g("li",{children:[i("strong",{children:"Iterate"})," — The imported contracts are a starting point. Refine them as your spec matures."]})]})]}),g("div",{className:"space-y-3",children:[g("h2",{className:"flex items-center gap-2 font-bold text-2xl",children:[i(Dd,{size:20,className:"text-yellow-400"}),"Troubleshooting"]}),g("div",{className:"space-y-4",children:[g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Framework not detected"}),g("p",{className:"text-muted-foreground text-sm",children:["Use ",i("code",{children:"--framework <name>"})," to force a specific framework. Check that your entry files follow standard patterns."]})]}),g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Missing schemas"}),g("p",{className:"text-muted-foreground text-sm",children:["Schema inference works best with explicit types. If using"," ",i("code",{children:"any"})," or dynamic types, you'll see TODO placeholders. Fill them in manually."]})]}),g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Partial imports"}),g("p",{className:"text-muted-foreground text-sm",children:["Some endpoints may not be detected if they use unconventional patterns. Use ",i("code",{children:"--analyze"})," to see what was found, then add missing contracts manually."]})]})]})]}),i(Rt,{title:"Want evidence-driven migration priorities?",body:"Studio clusters product signals into scored patterns, then proposes contract changes and execution-ready work for the highest-impact areas."})]}),g("div",{className:"flex items-center gap-4 pt-4",children:[g(gn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",i(Od,{size:16})]}),i(gn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as xo}from"@contractspec/lib.design-system";import fn from"@contractspec/lib.ui-link";import{ChevronRight as _d}from"lucide-react";import{jsx as pe,jsxs as xe}from"react/jsx-runtime";function zd(){return xe("div",{className:"space-y-8",children:[xe("div",{className:"space-y-3",children:[pe("h1",{className:"font-bold text-4xl",children:"Next.js: add one endpoint"}),pe("p",{className:"text-lg text-muted-foreground",children:"Add ContractSpec to an existing Next.js App Router project by wiring a single operation end-to-end with validation and types."})]}),xe("div",{className:"card-subtle space-y-4 p-6",children:[pe("h2",{className:"font-bold text-2xl",children:"What you'll build"}),xe("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[pe("li",{children:"One OperationSpec with SchemaModel validation."}),pe("li",{children:"A registry wiring the operation to its handler."}),pe("li",{children:"A Next.js route handler that exposes the operation."})]})]}),xe("div",{className:"space-y-6",children:[xe("div",{className:"space-y-3",children:[pe("h2",{className:"font-bold text-2xl",children:"1) Install core packages"}),pe(xo,{language:"bash",filename:"nextjs-install",code:`bun add -D contractspec
1636
+ });`})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"6) After importing"}),g("ol",{className:"list-decimal space-y-2 pl-5 text-muted-foreground text-sm",children:[g("li",{children:[i("strong",{children:"Review generated contracts"})," — Check the TODO placeholders and fill in descriptions, owners, and tags."]}),g("li",{children:[i("strong",{children:"Refine schemas"})," — Add proper types, validation rules, and error definitions."]}),g("li",{children:[i("strong",{children:"Run validation"})," —"," ",i("code",{children:"contractspec validate"})," to ensure contracts are valid."]}),g("li",{children:[i("strong",{children:"Register and wire handlers"})," — Connect contracts to your existing business logic."]}),g("li",{children:[i("strong",{children:"Iterate"})," — The imported contracts are a starting point. Refine them as your spec matures."]})]})]}),g("div",{className:"space-y-3",children:[g("h2",{className:"flex items-center gap-2 font-bold text-2xl",children:[i(Dd,{size:20,className:"text-yellow-400"}),"Troubleshooting"]}),g("div",{className:"space-y-4",children:[g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Framework not detected"}),g("p",{className:"text-muted-foreground text-sm",children:["Use ",i("code",{children:"--framework <name>"})," to force a specific framework. Check that your entry files follow standard patterns."]})]}),g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Missing schemas"}),g("p",{className:"text-muted-foreground text-sm",children:["Schema inference works best with explicit types. If using"," ",i("code",{children:"any"})," or dynamic types, you'll see TODO placeholders. Fill them in manually."]})]}),g("div",{className:"card-subtle space-y-2 p-4",children:[i("h3",{className:"font-semibold",children:"Partial imports"}),g("p",{className:"text-muted-foreground text-sm",children:["Some endpoints may not be detected if they use unconventional patterns. Use ",i("code",{children:"--analyze"})," to see what was found, then add missing contracts manually."]})]})]})]}),i(Rt,{title:"Want evidence-driven migration priorities?",body:"Studio clusters product signals into scored patterns, then proposes contract changes and execution-ready work for the highest-impact areas."})]}),g("div",{className:"flex items-center gap-4 pt-4",children:[g(gn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",i(Od,{size:16})]}),i(gn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as xo}from"@contractspec/lib.design-system";import hn from"@contractspec/lib.ui-link";import{ChevronRight as _d}from"lucide-react";import{jsx as pe,jsxs as xe}from"react/jsx-runtime";function zd(){return xe("div",{className:"space-y-8",children:[xe("div",{className:"space-y-3",children:[pe("h1",{className:"font-bold text-4xl",children:"Next.js: add one endpoint"}),pe("p",{className:"text-lg text-muted-foreground",children:"Add ContractSpec to an existing Next.js App Router project by wiring a single operation end-to-end with validation and types."})]}),xe("div",{className:"card-subtle space-y-4 p-6",children:[pe("h2",{className:"font-bold text-2xl",children:"What you'll build"}),xe("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[pe("li",{children:"One OperationSpec with SchemaModel validation."}),pe("li",{children:"A registry wiring the operation to its handler."}),pe("li",{children:"A Next.js route handler that exposes the operation."})]})]}),xe("div",{className:"space-y-6",children:[xe("div",{className:"space-y-3",children:[pe("h2",{className:"font-bold text-2xl",children:"1) Install core packages"}),pe(xo,{language:"bash",filename:"nextjs-install",code:`bun add -D contractspec
1637
1637
  bun add @contractspec/lib.contracts-spec @contractspec/lib.contracts-runtime-server-rest @contractspec/lib.schema`}),xe("p",{className:"text-muted-foreground text-sm",children:["Expected output: ",pe("code",{children:"added 3 packages"})," and a lockfile update."]})]}),xe("div",{className:"space-y-3",children:[pe("h2",{className:"font-bold text-2xl",children:"2) Define the operation spec"}),xe("p",{className:"text-muted-foreground text-sm",children:["Create ",pe("code",{children:"src/contracts/healthcheck.operation.ts"}),":"]}),pe(xo,{language:"typescript",filename:"src/contracts/healthcheck.operation.ts",code:`import { defineQuery } from "@contractspec/lib.contracts-spec/operations";
1638
1638
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1639
1639
 
@@ -1688,7 +1688,7 @@ export { handler as GET, handler as POST };`}),xe("p",{className:"text-muted-for
1688
1688
  contractspec examples show lifecycle-dashboard
1689
1689
 
1690
1690
  # Validate all example manifests in this repo
1691
- contractspec examples validate --repo-root .`})]}),pe(Rt,{title:"Want real product evidence behind endpoint changes?",body:"Studio correlates meetings, support, analytics, and code signals before compiling endpoint decisions into spec diffs."})]}),xe("div",{className:"flex items-center gap-4 pt-4",children:[xe(fn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",pe(_d,{size:16})]}),pe(fn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Ri}from"@contractspec/lib.design-system";import hn from"@contractspec/lib.ui-link";import{ChevronRight as Gd}from"lucide-react";import{jsx as ke,jsxs as ua}from"react/jsx-runtime";var Hd=["root `README.md` and generated root `AGENTS.md` inputs when contributor or operator workflow changes","the nearest package `README.md` and `AGENTS.md` for any touched public package surface","website docs and `/llms*` summaries when the release changes how users or contributors should work"];function qd(){return ua("div",{className:"space-y-8",children:[ua("div",{className:"space-y-3",children:[ke("h1",{className:"font-bold text-4xl",children:"Author release capsules"}),ke("p",{className:"text-lg text-muted-foreground",children:"Pair each publishable changeset with a structured release capsule so changelog, upgrade, and docs surfaces all read from the same release source of truth."})]}),ua("div",{className:"card-subtle space-y-4 p-6",children:[ke("h2",{className:"font-bold text-2xl",children:"What you'll build"}),ua("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ua("li",{children:["A ",ke("code",{children:".changeset/<slug>.md"})," file for package/version intent."]}),ua("li",{children:["A ",ke("code",{children:".changeset/<slug>.release.yaml"})," companion for audiences, migrations, validation, and evidence."]}),ke("li",{children:"Generated release artifacts that the website changelog and upgrade flows can consume safely."})]})]}),ua("div",{className:"space-y-6",children:[ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"1) Create the paired changeset files"}),ke("p",{className:"text-muted-foreground text-sm",children:"The Markdown file states the package bumps and reader-facing change intent. The YAML file carries the structured release metadata."}),ke(Ri,{language:"yaml",filename:".changeset/contract-dx-first-slice.release.yaml",code:`schemaVersion: "1"
1691
+ contractspec examples validate --repo-root .`})]}),pe(Rt,{title:"Want real product evidence behind endpoint changes?",body:"Studio correlates meetings, support, analytics, and code signals before compiling endpoint decisions into spec diffs."})]}),xe("div",{className:"flex items-center gap-4 pt-4",children:[xe(hn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",pe(_d,{size:16})]}),pe(hn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Ri}from"@contractspec/lib.design-system";import fn from"@contractspec/lib.ui-link";import{ChevronRight as Gd}from"lucide-react";import{jsx as ke,jsxs as ua}from"react/jsx-runtime";var qd=["root `README.md` and generated root `AGENTS.md` inputs when contributor or operator workflow changes","the nearest package `README.md` and `AGENTS.md` for any touched public package surface","website docs and `/llms*` summaries when the release changes how users or contributors should work"];function Vd(){return ua("div",{className:"space-y-8",children:[ua("div",{className:"space-y-3",children:[ke("h1",{className:"font-bold text-4xl",children:"Author release capsules"}),ke("p",{className:"text-lg text-muted-foreground",children:"Pair each publishable changeset with a structured release capsule so changelog, upgrade, and docs surfaces all read from the same release source of truth."})]}),ua("div",{className:"card-subtle space-y-4 p-6",children:[ke("h2",{className:"font-bold text-2xl",children:"What you'll build"}),ua("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ua("li",{children:["A ",ke("code",{children:".changeset/<slug>.md"})," file for package/version intent."]}),ua("li",{children:["A ",ke("code",{children:".changeset/<slug>.release.yaml"})," companion for audiences, migrations, validation, and evidence."]}),ke("li",{children:"Generated release artifacts that the website changelog and upgrade flows can consume safely."})]})]}),ua("div",{className:"space-y-6",children:[ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"1) Create the paired changeset files"}),ke("p",{className:"text-muted-foreground text-sm",children:"The Markdown file states the package bumps and reader-facing change intent. The YAML file carries the structured release metadata."}),ke(Ri,{language:"yaml",filename:".changeset/contract-dx-first-slice.release.yaml",code:`schemaVersion: "1"
1692
1692
  slug: contract-dx-first-slice
1693
1693
  summary: Improve app-config, theme, and feature authoring with explicit validation and shared setup alignment.
1694
1694
  isBreaking: false
@@ -1702,7 +1702,7 @@ validation:
1702
1702
  - "Package-level validation entrypoints now back setup, docs, and CLI authoring flows."`}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: every publishable slug has both the human-facing changeset and the structured release capsule beside it."})]}),ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"2) Use the release authoring commands instead of raw drift-prone edits"}),ke(Ri,{language:"bash",filename:"release-authoring",code:`contractspec release init --summary "Improve app-config, theme, and feature authoring"
1703
1703
 
1704
1704
  # Or revise an existing capsule with the guided flow
1705
- contractspec release edit contract-dx-first-slice`}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: the CLI scaffolds or revises the paired files with the current release schema instead of leaving maintainers to hand-roll YAML structure."})]}),ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"3) Build the generated release artifacts before consuming them"}),ke(Ri,{language:"bash",filename:"release-build",code:"contractspec release build"}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: `generated/releases/manifest.json`, `generated/releases/upgrade-manifest.json`, and the related customer/maintainer guidance files are refreshed from the release capsules."})]}),ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"4) Enforce completeness before publishing or building the changelog"}),ke(Ri,{language:"bash",filename:"release-check",code:"contractspec release check --strict"}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: missing capsules, incomplete migration guidance, or stale generated release artifacts are flagged before the website changelog or publish workflow treats the release data as canonical."})]}),ua("div",{className:"card-subtle space-y-3 p-6",children:[ke("h3",{className:"font-semibold text-lg",children:"5) Sync the public docs if workflow expectations changed"}),ke("ul",{className:"space-y-2 text-muted-foreground text-sm",children:Hd.map((e)=>ke("li",{children:e},e))})]})]}),ua("div",{className:"flex items-center gap-4 pt-4",children:[ua(hn,{href:"/docs/guides/connect-in-a-repo",className:"btn-primary",children:["Connect guide ",ke(Gd,{size:16})]}),ke(hn,{href:"/changelog",className:"btn-ghost",children:"Website changelog"})]})]})}import{CodeBlock as Li}from"@contractspec/lib.design-system";import yn from"@contractspec/lib.ui-link";import{ChevronRight as Vd}from"lucide-react";import{jsx as Ye,jsxs as Na}from"react/jsx-runtime";function Fd(){return Na("div",{className:"space-y-8",children:[Na("div",{className:"space-y-3",children:[Ye("h1",{className:"font-bold text-4xl",children:"Spec-driven validation + typing"}),Ye("p",{className:"text-lg text-muted-foreground",children:"Define a single operation with SchemaModel, generate validation, and keep your existing handler logic."})]}),Na("div",{className:"card-subtle space-y-4 p-6",children:[Ye("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Na("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Ye("li",{children:"One command spec with explicit input/output models."}),Ye("li",{children:"Validation + typing without rewriting your service layer."}),Ye("li",{children:"Clear acceptance scenarios for regression safety."})]})]}),Na("div",{className:"space-y-6",children:[Na("div",{className:"space-y-3",children:[Ye("h2",{className:"font-bold text-2xl",children:"1) Define the spec"}),Na("p",{className:"text-muted-foreground text-sm",children:["Create ",Ye("code",{children:"src/contracts/contact-create.operation.ts"}),":"]}),Ye(Li,{language:"typescript",filename:"src/contracts/contact-create.operation.ts",code:`import { defineCommand } from "@contractspec/lib.contracts-spec/operations";
1705
+ contractspec release edit contract-dx-first-slice`}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: the CLI scaffolds or revises the paired files with the current release schema instead of leaving maintainers to hand-roll YAML structure."})]}),ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"3) Build the generated release artifacts before consuming them"}),ke(Ri,{language:"bash",filename:"release-build",code:"contractspec release build"}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: `generated/releases/manifest.json`, `generated/releases/upgrade-manifest.json`, and the related customer/maintainer guidance files are refreshed from the release capsules."})]}),ua("div",{className:"space-y-3",children:[ke("h2",{className:"font-bold text-2xl",children:"4) Enforce completeness before publishing or building the changelog"}),ke(Ri,{language:"bash",filename:"release-check",code:"contractspec release check --strict"}),ke("p",{className:"text-muted-foreground text-sm",children:"Expected output: missing capsules, incomplete migration guidance, or stale generated release artifacts are flagged before the website changelog or publish workflow treats the release data as canonical."})]}),ua("div",{className:"card-subtle space-y-3 p-6",children:[ke("h3",{className:"font-semibold text-lg",children:"5) Sync the public docs if workflow expectations changed"}),ke("ul",{className:"space-y-2 text-muted-foreground text-sm",children:qd.map((e)=>ke("li",{children:e},e))})]})]}),ua("div",{className:"flex items-center gap-4 pt-4",children:[ua(fn,{href:"/docs/guides/connect-in-a-repo",className:"btn-primary",children:["Connect guide ",ke(Gd,{size:16})]}),ke(fn,{href:"/changelog",className:"btn-ghost",children:"Website changelog"})]})]})}import{CodeBlock as Li}from"@contractspec/lib.design-system";import yn from"@contractspec/lib.ui-link";import{ChevronRight as Hd}from"lucide-react";import{jsx as Ye,jsxs as Na}from"react/jsx-runtime";function Fd(){return Na("div",{className:"space-y-8",children:[Na("div",{className:"space-y-3",children:[Ye("h1",{className:"font-bold text-4xl",children:"Spec-driven validation + typing"}),Ye("p",{className:"text-lg text-muted-foreground",children:"Define a single operation with SchemaModel, generate validation, and keep your existing handler logic."})]}),Na("div",{className:"card-subtle space-y-4 p-6",children:[Ye("h2",{className:"font-bold text-2xl",children:"What you'll build"}),Na("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Ye("li",{children:"One command spec with explicit input/output models."}),Ye("li",{children:"Validation + typing without rewriting your service layer."}),Ye("li",{children:"Clear acceptance scenarios for regression safety."})]})]}),Na("div",{className:"space-y-6",children:[Na("div",{className:"space-y-3",children:[Ye("h2",{className:"font-bold text-2xl",children:"1) Define the spec"}),Na("p",{className:"text-muted-foreground text-sm",children:["Create ",Ye("code",{children:"src/contracts/contact-create.operation.ts"}),":"]}),Ye(Li,{language:"typescript",filename:"src/contracts/contact-create.operation.ts",code:`import { defineCommand } from "@contractspec/lib.contracts-spec/operations";
1706
1706
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1707
1707
 
1708
1708
  const ContactInput = new SchemaModel({
@@ -1764,7 +1764,7 @@ export const ContactCreateCommand = defineCommand({
1764
1764
  cd packages/examples/crm-pipeline
1765
1765
  bun install
1766
1766
  bun run build
1767
- bun run validate`})]}),Ye(Rt,{title:"Need validation tied to real outcomes?",body:"Studio links checks to evidence, focus decisions, and post-release verification so specs evolve with product truth."})]}),Na("div",{className:"flex items-center gap-4 pt-4",children:[Na(yn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Next: Generate docs + clients ",Ye(Vd,{size:16})]}),Ye(yn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Kd}from"@contractspec/lib.design-system";import Qd from"@contractspec/lib.ui-link";import{ArrowRight as Yd,CheckCircle2 as Jd,GitBranch as Zd}from"lucide-react";import{jsx as Dt,jsxs as wa}from"react/jsx-runtime";var $d=[{title:"Adopt one endpoint in Next.js",description:"Start inside a live app with one operation, one generated surface, and one clearly bounded change.",href:"/docs/guides/nextjs-one-endpoint",time:"25 min"},{title:"Import an existing codebase",description:"Stabilize what already exists instead of treating adoption as a rewrite project.",href:"/docs/guides/import-existing-codebases",time:"20 min"},{title:"Validation and typing",description:"Keep runtime validation and TypeScript behavior aligned from the same source definitions.",href:"/docs/guides/spec-validation-and-typing",time:"20 min"},{title:"Generate docs and clients",description:"Publish stable docs, schemas, and client-facing artifacts from the contract layer.",href:"/docs/guides/generate-docs-clients-schemas",time:"20 min"},{title:"Docs pipeline",description:"Feed generated reference material into the docs site without confusing ownership.",href:"/docs/guides/docs-generation-pipeline",time:"20 min"},{title:"Build a first module bundle",description:"Define one bundle spec, resolve a surface plan, and render it through the React host layer.",href:"/docs/guides/first-module-bundle",time:"20 min"},{title:"Host the Builder workbench",description:"Wire a Builder workspace snapshot, common commands, runtime modes, and mobile review links into the reusable host.",href:"/docs/guides/host-builder-workbench",time:"20 min"},{title:"Use Connect in a repo",description:"Enable Connect, verify agent actions locally, and inspect the resulting review and replay artifacts.",href:"/docs/guides/connect-in-a-repo",time:"15 min"},{title:"Author release capsules",description:"Pair changesets with structured release capsules and generate the artifacts that changelog and upgrade flows consume.",href:"/docs/guides/release-capsules",time:"15 min"},{title:"CI diff gating",description:"Use deterministic checks to catch drift and risky changes before they ship.",href:"/docs/guides/ci-contract-diff-gating",time:"15 min"}];function Xd(){return wa("div",{className:"space-y-10",children:[wa("div",{className:"space-y-3",children:[Dt("p",{className:"editorial-kicker",children:"Build"}),Dt("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Adoption guides for teams that want to keep their code."}),Dt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"These guides assume you are introducing ContractSpec into a real code base. Start with a narrow surface, verify the generated outputs, and expand only after the contract loop feels trustworthy."})]}),Dt("div",{className:"grid gap-4 md:grid-cols-2",children:$d.map((e)=>wa(Qd,{href:e.href,className:"editorial-panel",children:[wa("div",{className:"flex items-start justify-between gap-4",children:[wa("div",{children:[Dt("h2",{className:"font-semibold text-xl",children:e.title}),Dt("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.description})]}),Dt(Yd,{className:"mt-1 shrink-0",size:18})]}),wa("div",{className:"mt-4 flex items-center gap-2 text-muted-foreground text-xs",children:[Dt(Jd,{size:14}),wa("span",{children:["Target time: ",e.time]})]})]},e.href))}),wa("div",{className:"editorial-panel space-y-4",children:[wa("div",{className:"flex items-center gap-2 font-semibold text-[color:var(--rust)] text-sm uppercase tracking-[0.2em]",children:[Dt(Zd,{size:16}),"Working style"]}),wa("ul",{className:"editorial-list",children:[wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Run each guide in a branch or sandboxed workspace."})]}),wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Prefer one bounded surface at a time: one endpoint, one workflow, one integration, one unsafe module."})]}),wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Use the example and reference outputs to verify what changed, not just the narrative page."})]})]}),Dt(Kd,{language:"bash",filename:"guides-quickstart",code:`# list example systems
1767
+ bun run validate`})]}),Ye(Rt,{title:"Need validation tied to real outcomes?",body:"Studio links checks to evidence, focus decisions, and post-release verification so specs evolve with product truth."})]}),Na("div",{className:"flex items-center gap-4 pt-4",children:[Na(yn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Next: Generate docs + clients ",Ye(Hd,{size:16})]}),Ye(yn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Kd}from"@contractspec/lib.design-system";import Qd from"@contractspec/lib.ui-link";import{ArrowRight as Yd,CheckCircle2 as Jd,GitBranch as Zd}from"lucide-react";import{jsx as Dt,jsxs as wa}from"react/jsx-runtime";var Xd=[{title:"Adopt one endpoint in Next.js",description:"Start inside a live app with one operation, one generated surface, and one clearly bounded change.",href:"/docs/guides/nextjs-one-endpoint",time:"25 min"},{title:"Import an existing codebase",description:"Stabilize what already exists instead of treating adoption as a rewrite project.",href:"/docs/guides/import-existing-codebases",time:"20 min"},{title:"Validation and typing",description:"Keep runtime validation and TypeScript behavior aligned from the same source definitions.",href:"/docs/guides/spec-validation-and-typing",time:"20 min"},{title:"Generate docs and clients",description:"Publish stable docs, schemas, and client-facing artifacts from the contract layer.",href:"/docs/guides/generate-docs-clients-schemas",time:"20 min"},{title:"Docs pipeline",description:"Feed generated reference material into the docs site without confusing ownership.",href:"/docs/guides/docs-generation-pipeline",time:"20 min"},{title:"Build a first module bundle",description:"Define one bundle spec, resolve a surface plan, and render it through the React host layer.",href:"/docs/guides/first-module-bundle",time:"20 min"},{title:"Host the Builder workbench",description:"Wire a Builder workspace snapshot, common commands, runtime modes, and mobile review links into the reusable host.",href:"/docs/guides/host-builder-workbench",time:"20 min"},{title:"Use Connect in a repo",description:"Enable Connect, verify agent actions locally, and inspect the resulting review and replay artifacts.",href:"/docs/guides/connect-in-a-repo",time:"15 min"},{title:"Author release capsules",description:"Pair changesets with structured release capsules and generate the artifacts that changelog and upgrade flows consume.",href:"/docs/guides/release-capsules",time:"15 min"},{title:"CI diff gating",description:"Use deterministic checks to catch drift and risky changes before they ship.",href:"/docs/guides/ci-contract-diff-gating",time:"15 min"}];function $d(){return wa("div",{className:"space-y-10",children:[wa("div",{className:"space-y-3",children:[Dt("p",{className:"editorial-kicker",children:"Build"}),Dt("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Adoption guides for teams that want to keep their code."}),Dt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"These guides assume you are introducing ContractSpec into a real code base. Start with a narrow surface, verify the generated outputs, and expand only after the contract loop feels trustworthy."})]}),Dt("div",{className:"grid gap-4 md:grid-cols-2",children:Xd.map((e)=>wa(Qd,{href:e.href,className:"editorial-panel",children:[wa("div",{className:"flex items-start justify-between gap-4",children:[wa("div",{children:[Dt("h2",{className:"font-semibold text-xl",children:e.title}),Dt("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.description})]}),Dt(Yd,{className:"mt-1 shrink-0",size:18})]}),wa("div",{className:"mt-4 flex items-center gap-2 text-muted-foreground text-xs",children:[Dt(Jd,{size:14}),wa("span",{children:["Target time: ",e.time]})]})]},e.href))}),wa("div",{className:"editorial-panel space-y-4",children:[wa("div",{className:"flex items-center gap-2 font-semibold text-[color:var(--rust)] text-sm uppercase tracking-[0.2em]",children:[Dt(Zd,{size:16}),"Working style"]}),wa("ul",{className:"editorial-list",children:[wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Run each guide in a branch or sandboxed workspace."})]}),wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Prefer one bounded surface at a time: one endpoint, one workflow, one integration, one unsafe module."})]}),wa("li",{children:[Dt("span",{className:"editorial-list-marker"}),Dt("span",{children:"Use the example and reference outputs to verify what changed, not just the narrative page."})]})]}),Dt(Kd,{language:"bash",filename:"guides-quickstart",code:`# list example systems
1768
1768
  contractspec examples list
1769
1769
 
1770
1770
  # validate the examples in this workspace
@@ -1824,8 +1824,8 @@ const stripeBreaker = new CircuitBreaker({
1824
1824
 
1825
1825
  export async function createCharge(amount: number) {
1826
1826
  return stripeBreaker.execute(() => stripe.charges.create({ amount }));
1827
- }`})]})]})}import vn from"@contractspec/lib.ui-link";import{ChevronRight as tp}from"lucide-react";import{jsx as Xt,jsxs as Co}from"react/jsx-runtime";function ap(){return Co("div",{className:"space-y-8",children:[Co("div",{className:"space-y-4",children:[Xt("h1",{className:"font-bold text-4xl",children:"ElevenLabs"}),Xt("p",{className:"text-muted-foreground",children:"ElevenLabs provides state-of-the-art text-to-speech and voice cloning technology. Create natural-sounding voiceovers, audiobooks, and voice assistants."})]}),Co("div",{className:"space-y-4",children:[Xt("h2",{className:"font-bold text-2xl",children:"Setup"}),Xt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Xt("pre",{children:`# .env
1828
- ELEVENLABS_API_KEY=...`})})]}),Co("div",{className:"space-y-4",children:[Xt("h2",{className:"font-bold text-2xl",children:"Text-to-Speech"}),Xt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Xt("pre",{children:`capabilityId: elevenlabs-tts
1827
+ }`})]})]})}import vn from"@contractspec/lib.ui-link";import{ChevronRight as tp}from"lucide-react";import{jsx as $t,jsxs as Co}from"react/jsx-runtime";function ap(){return Co("div",{className:"space-y-8",children:[Co("div",{className:"space-y-4",children:[$t("h1",{className:"font-bold text-4xl",children:"ElevenLabs"}),$t("p",{className:"text-muted-foreground",children:"ElevenLabs provides state-of-the-art text-to-speech and voice cloning technology. Create natural-sounding voiceovers, audiobooks, and voice assistants."})]}),Co("div",{className:"space-y-4",children:[$t("h2",{className:"font-bold text-2xl",children:"Setup"}),$t("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:$t("pre",{children:`# .env
1828
+ ELEVENLABS_API_KEY=...`})})]}),Co("div",{className:"space-y-4",children:[$t("h2",{className:"font-bold text-2xl",children:"Text-to-Speech"}),$t("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:$t("pre",{children:`capabilityId: elevenlabs-tts
1829
1829
  provider:
1830
1830
  type: elevenlabs
1831
1831
  operation: textToSpeech
@@ -1844,7 +1844,7 @@ outputs:
1844
1844
  audioUrl:
1845
1845
  type: string
1846
1846
  audioData:
1847
- type: buffer`})})]}),Co("div",{className:"space-y-4",children:[Xt("h2",{className:"font-bold text-2xl",children:"Use cases"}),Co("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Xt("li",{children:"Generate voiceovers for videos"}),Xt("li",{children:"Create audio versions of articles"}),Xt("li",{children:"Build voice assistants"}),Xt("li",{children:"Produce audiobooks"})]})]}),Co("div",{className:"flex items-center gap-4 pt-4",children:[Xt(vn,{href:"/docs/integrations/mistral",className:"btn-ghost",children:"Previous: Mistral"}),Co(vn,{href:"/docs/integrations/qdrant",className:"btn-primary",children:["Next: Qdrant ",Xt(tp,{size:16})]})]})]})}import bn from"@contractspec/lib.ui-link";import{ChevronRight as op}from"lucide-react";import{jsx as mt,jsxs as La}from"react/jsx-runtime";function ip(){return La("div",{className:"space-y-8",children:[La("div",{className:"space-y-4",children:[mt("h1",{className:"font-bold text-4xl",children:"GitHub Messaging"}),mt("p",{className:"text-muted-foreground",children:"Use GitHub issue and pull request comments as an AI-native messaging channel with webhook verification, policy checks, and reliable outbound dispatch."})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),mt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:mt("pre",{children:`// secret payload
1847
+ type: buffer`})})]}),Co("div",{className:"space-y-4",children:[$t("h2",{className:"font-bold text-2xl",children:"Use cases"}),Co("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[$t("li",{children:"Generate voiceovers for videos"}),$t("li",{children:"Create audio versions of articles"}),$t("li",{children:"Build voice assistants"}),$t("li",{children:"Produce audiobooks"})]})]}),Co("div",{className:"flex items-center gap-4 pt-4",children:[$t(vn,{href:"/docs/integrations/mistral",className:"btn-ghost",children:"Previous: Mistral"}),Co(vn,{href:"/docs/integrations/qdrant",className:"btn-primary",children:["Next: Qdrant ",$t(tp,{size:16})]})]})]})}import bn from"@contractspec/lib.ui-link";import{ChevronRight as op}from"lucide-react";import{jsx as mt,jsxs as La}from"react/jsx-runtime";function ip(){return La("div",{className:"space-y-8",children:[La("div",{className:"space-y-4",children:[mt("h1",{className:"font-bold text-4xl",children:"GitHub Messaging"}),mt("p",{className:"text-muted-foreground",children:"Use GitHub issue and pull request comments as an AI-native messaging channel with webhook verification, policy checks, and reliable outbound dispatch."})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),mt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:mt("pre",{children:`// secret payload
1848
1848
  {
1849
1849
  "token": "ghp_...",
1850
1850
  "webhookSecret": "..."
@@ -1882,10 +1882,10 @@ outputs:
1882
1882
  properties:
1883
1883
  id: string
1884
1884
  threadId: string
1885
- snippet: string`})})]}),Io("div",{className:"space-y-4",children:[Ot("h2",{className:"font-bold text-2xl",children:"Use cases"}),Io("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ot("li",{children:"Parse support emails and create tickets"}),Ot("li",{children:"Extract attachments and process them"}),Ot("li",{children:"Build email-to-task workflows"}),Ot("li",{children:"Monitor specific email threads"})]})]}),Io("div",{className:"flex items-center gap-4 pt-4",children:[Ot(Nn,{href:"/docs/integrations/resend",className:"btn-ghost",children:"Previous: Resend"}),Io(Nn,{href:"/docs/integrations/google-calendar",className:"btn-primary",children:["Next: Google Calendar ",Ot(rp,{size:16})]})]})]})}import wn from"@contractspec/lib.ui-link";import{ChevronRight as cp}from"lucide-react";import{jsx as $a,jsxs as jo}from"react/jsx-runtime";function lp(){return jo("div",{className:"space-y-8",children:[jo("div",{className:"space-y-4",children:[$a("h1",{className:"font-bold text-4xl",children:"Google Calendar"}),$a("p",{className:"text-muted-foreground",children:"Integrate Google Calendar to schedule appointments, manage availability, and sync events with your application."})]}),jo("div",{className:"space-y-4",children:[$a("h2",{className:"font-bold text-2xl",children:"Setup"}),$a("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:$a("pre",{children:`# .env
1885
+ snippet: string`})})]}),Io("div",{className:"space-y-4",children:[Ot("h2",{className:"font-bold text-2xl",children:"Use cases"}),Io("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ot("li",{children:"Parse support emails and create tickets"}),Ot("li",{children:"Extract attachments and process them"}),Ot("li",{children:"Build email-to-task workflows"}),Ot("li",{children:"Monitor specific email threads"})]})]}),Io("div",{className:"flex items-center gap-4 pt-4",children:[Ot(Nn,{href:"/docs/integrations/resend",className:"btn-ghost",children:"Previous: Resend"}),Io(Nn,{href:"/docs/integrations/google-calendar",className:"btn-primary",children:["Next: Google Calendar ",Ot(rp,{size:16})]})]})]})}import wn from"@contractspec/lib.ui-link";import{ChevronRight as cp}from"lucide-react";import{jsx as Xa,jsxs as jo}from"react/jsx-runtime";function lp(){return jo("div",{className:"space-y-8",children:[jo("div",{className:"space-y-4",children:[Xa("h1",{className:"font-bold text-4xl",children:"Google Calendar"}),Xa("p",{className:"text-muted-foreground",children:"Integrate Google Calendar to schedule appointments, manage availability, and sync events with your application."})]}),jo("div",{className:"space-y-4",children:[Xa("h2",{className:"font-bold text-2xl",children:"Setup"}),Xa("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Xa("pre",{children:`# .env
1886
1886
  GOOGLE_CLIENT_ID=...
1887
1887
  GOOGLE_CLIENT_SECRET=...
1888
- GOOGLE_CALENDAR_ID=primary`})})]}),jo("div",{className:"space-y-4",children:[$a("h2",{className:"font-bold text-2xl",children:"Creating events"}),$a("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:$a("pre",{children:`capabilityId: calendar-create-event
1888
+ GOOGLE_CALENDAR_ID=primary`})})]}),jo("div",{className:"space-y-4",children:[Xa("h2",{className:"font-bold text-2xl",children:"Creating events"}),Xa("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Xa("pre",{children:`capabilityId: calendar-create-event
1889
1889
  provider:
1890
1890
  type: google-calendar
1891
1891
  operation: createEvent
@@ -1909,7 +1909,7 @@ outputs:
1909
1909
  eventId:
1910
1910
  type: string
1911
1911
  htmlLink:
1912
- type: string`})})]}),jo("div",{className:"flex items-center gap-4 pt-4",children:[$a(wn,{href:"/docs/integrations/gmail",className:"btn-ghost",children:"Previous: Gmail API"}),jo(wn,{href:"/docs/integrations/openai",className:"btn-primary",children:["Next: OpenAI ",$a(cp,{size:16})]})]})]})}import kn from"@contractspec/lib.ui-link";import{jsx as je,jsxs as Ea}from"react/jsx-runtime";function sp(){return Ea("div",{className:"space-y-8",children:[Ea("div",{className:"space-y-4",children:[je("h1",{className:"font-bold text-4xl",children:"Health Routing Strategy"}),je("p",{className:"text-muted-foreground",children:"Health integrations resolve providers through deterministic transport strategy order with explicit capability gating and unofficial-route controls."})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Connection config fields"}),je("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:je("pre",{children:`{
1912
+ type: string`})})]}),jo("div",{className:"flex items-center gap-4 pt-4",children:[Xa(wn,{href:"/docs/integrations/gmail",className:"btn-ghost",children:"Previous: Gmail API"}),jo(wn,{href:"/docs/integrations/openai",className:"btn-primary",children:["Next: OpenAI ",Xa(cp,{size:16})]})]})]})}import kn from"@contractspec/lib.ui-link";import{jsx as je,jsxs as Ea}from"react/jsx-runtime";function sp(){return Ea("div",{className:"space-y-8",children:[Ea("div",{className:"space-y-4",children:[je("h1",{className:"font-bold text-4xl",children:"Health Routing Strategy"}),je("p",{className:"text-muted-foreground",children:"Health integrations resolve providers through deterministic transport strategy order with explicit capability gating and unofficial-route controls."})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Connection config fields"}),je("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:je("pre",{children:`{
1913
1913
  "defaultTransport": "official-api",
1914
1914
  "strategyOrder": [
1915
1915
  "official-api",
@@ -1932,8 +1932,8 @@ outputs:
1932
1932
  "tokenExpiresAt": "2026-02-01T00:00:00.000Z",
1933
1933
  "mcpAccessToken": "...",
1934
1934
  "webhookSecret": "..."
1935
- }`})})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Routing behavior"}),Ea("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[je("li",{children:"Unsupported strategies are skipped per provider capability matrix."}),je("li",{children:"Missing credentials fail closed and fall through only when a later strategy is valid."}),Ea("li",{children:["Unofficial routes are disabled unless",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"allowUnofficial"}),"is true."]}),Ea("li",{children:["When",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"unofficialAllowList"}),"is set, only listed provider keys can route unofficially."]}),Ea("li",{children:["OAuth refresh uses",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"oauthTokenUrl"}),"with refresh/client credentials when APIs return 401."]})]})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Provider guidance"}),Ea("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[je("li",{children:"Use official APIs when available (Whoop, Oura, Strava, Fitbit)."}),je("li",{children:"Use aggregator routing for providers without stable official APIs (Garmin, MyFitnessPal, Eight Sleep, Peloton)."}),je("li",{children:"Keep unofficial automation opt-in and auditable for production."})]})]}),Ea("div",{className:"flex items-center gap-4 pt-4",children:[je(kn,{href:"/docs/integrations/whatsapp-twilio",className:"btn-ghost",children:"Previous: WhatsApp Twilio"}),je(kn,{href:"/docs/integrations",className:"btn-primary",children:"Back to Integrations"})]})]})}import Sn from"@contractspec/lib.ui-link";import{ChevronRight as dp}from"lucide-react";import{jsx as Ee,jsxs as qa}from"react/jsx-runtime";function pp(){return qa("div",{className:"space-y-8",children:[qa("div",{className:"space-y-4",children:[Ee("h1",{className:"font-bold text-4xl",children:"Mistral"}),Ee("p",{className:"text-muted-foreground",children:"Integrate Mistral models for chat, reasoning, embeddings, speech-to-text, and conversational voice workflows. ContractSpec ships first-class Mistral support across contracts, provider runtime wiring, and CLI provider selection."})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Setup"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`# .env
1936
- MISTRAL_API_KEY=...`})})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Chat and reasoning"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-chat
1935
+ }`})})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Routing behavior"}),Ea("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[je("li",{children:"Unsupported strategies are skipped per provider capability matrix."}),je("li",{children:"Missing credentials fail closed and fall through only when a later strategy is valid."}),Ea("li",{children:["Unofficial routes are disabled unless",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"allowUnofficial"}),"is true."]}),Ea("li",{children:["When",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"unofficialAllowList"}),"is set, only listed provider keys can route unofficially."]}),Ea("li",{children:["OAuth refresh uses",je("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"oauthTokenUrl"}),"with refresh/client credentials when APIs return 401."]})]})]}),Ea("div",{className:"space-y-4",children:[je("h2",{className:"font-bold text-2xl",children:"Provider guidance"}),Ea("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[je("li",{children:"Use official APIs when available (Whoop, Oura, Strava, Fitbit)."}),je("li",{children:"Use aggregator routing for providers without stable official APIs (Garmin, MyFitnessPal, Eight Sleep, Peloton)."}),je("li",{children:"Keep unofficial automation opt-in and auditable for production."})]})]}),Ea("div",{className:"flex items-center gap-4 pt-4",children:[je(kn,{href:"/docs/integrations/whatsapp-twilio",className:"btn-ghost",children:"Previous: WhatsApp Twilio"}),je(kn,{href:"/docs/integrations",className:"btn-primary",children:"Back to Integrations"})]})]})}import Sn from"@contractspec/lib.ui-link";import{ChevronRight as dp}from"lucide-react";import{jsx as Ee,jsxs as Va}from"react/jsx-runtime";function pp(){return Va("div",{className:"space-y-8",children:[Va("div",{className:"space-y-4",children:[Ee("h1",{className:"font-bold text-4xl",children:"Mistral"}),Ee("p",{className:"text-muted-foreground",children:"Integrate Mistral models for chat, reasoning, embeddings, speech-to-text, and conversational voice workflows. ContractSpec ships first-class Mistral support across contracts, provider runtime wiring, and CLI provider selection."})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Setup"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`# .env
1936
+ MISTRAL_API_KEY=...`})})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Chat and reasoning"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-chat
1937
1937
  provider:
1938
1938
  type: mistral
1939
1939
  operation: chatCompletion
@@ -1952,7 +1952,7 @@ outputs:
1952
1952
  content:
1953
1953
  type: string
1954
1954
  usage:
1955
- type: object`})})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Embeddings"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-embeddings
1955
+ type: object`})})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Embeddings"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-embeddings
1956
1956
  provider:
1957
1957
  type: mistral
1958
1958
  operation: createEmbedding
@@ -1968,7 +1968,7 @@ outputs:
1968
1968
  embedding:
1969
1969
  type: array
1970
1970
  items:
1971
- type: number`})})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Speech-to-Text (Voxtral)"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-stt
1971
+ type: number`})})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Speech-to-Text (Voxtral)"}),Ee("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ee("pre",{children:`capabilityId: mistral-stt
1972
1972
  provider:
1973
1973
  type: mistral
1974
1974
  operation: transcribe
@@ -1988,9 +1988,9 @@ outputs:
1988
1988
  segments:
1989
1989
  type: array
1990
1990
  language:
1991
- type: string`})})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Conversational voice sessions"}),Ee("p",{className:"text-muted-foreground",children:"Use the conversational provider for session-based realtime voice flows (turn handling, events, and interruption-safe streaming)."})]}),qa("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Best practices"}),qa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ee("li",{children:"Choose model families by workload: coding, reasoning, or speech"}),Ee("li",{children:"Persist session IDs for conversational continuity across turns"}),Ee("li",{children:"Capture token and latency telemetry for provider-level tuning"}),Ee("li",{children:"Set explicit fallbacks for network and rate-limit failures"})]})]}),qa("div",{className:"flex items-center gap-4 pt-4",children:[Ee(Sn,{href:"/docs/integrations/openai",className:"btn-ghost",children:"Previous: OpenAI"}),qa(Sn,{href:"/docs/integrations/elevenlabs",className:"btn-primary",children:["Next: ElevenLabs ",Ee(dp,{size:16})]})]})]})}import Cn from"@contractspec/lib.ui-link";import{ChevronRight as mp}from"lucide-react";import{jsx as We,jsxs as Xa}from"react/jsx-runtime";function up(){return Xa("div",{className:"space-y-8",children:[Xa("div",{className:"space-y-4",children:[We("h1",{className:"font-bold text-4xl",children:"OpenAI"}),We("p",{className:"text-muted-foreground",children:"Integrate OpenAI's powerful AI models for chat completion, embeddings, and speech-to-text. Build intelligent features with GPT-4, generate embeddings for semantic search, and transcribe audio with Whisper."})]}),Xa("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Setup"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`# .env
1991
+ type: string`})})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Conversational voice sessions"}),Ee("p",{className:"text-muted-foreground",children:"Use the conversational provider for session-based realtime voice flows (turn handling, events, and interruption-safe streaming)."})]}),Va("div",{className:"space-y-4",children:[Ee("h2",{className:"font-bold text-2xl",children:"Best practices"}),Va("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ee("li",{children:"Choose model families by workload: coding, reasoning, or speech"}),Ee("li",{children:"Persist session IDs for conversational continuity across turns"}),Ee("li",{children:"Capture token and latency telemetry for provider-level tuning"}),Ee("li",{children:"Set explicit fallbacks for network and rate-limit failures"})]})]}),Va("div",{className:"flex items-center gap-4 pt-4",children:[Ee(Sn,{href:"/docs/integrations/openai",className:"btn-ghost",children:"Previous: OpenAI"}),Va(Sn,{href:"/docs/integrations/elevenlabs",className:"btn-primary",children:["Next: ElevenLabs ",Ee(dp,{size:16})]})]})]})}import Cn from"@contractspec/lib.ui-link";import{ChevronRight as mp}from"lucide-react";import{jsx as We,jsxs as $a}from"react/jsx-runtime";function up(){return $a("div",{className:"space-y-8",children:[$a("div",{className:"space-y-4",children:[We("h1",{className:"font-bold text-4xl",children:"OpenAI"}),We("p",{className:"text-muted-foreground",children:"Integrate OpenAI's powerful AI models for chat completion, embeddings, and speech-to-text. Build intelligent features with GPT-4, generate embeddings for semantic search, and transcribe audio with Whisper."})]}),$a("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Setup"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`# .env
1992
1992
  OPENAI_API_KEY=sk-...
1993
- OPENAI_ORGANIZATION=org-...`})})]}),Xa("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Chat completions"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-chat
1993
+ OPENAI_ORGANIZATION=org-...`})})]}),$a("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Chat completions"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-chat
1994
1994
  provider:
1995
1995
  type: openai
1996
1996
  operation: chatCompletion
@@ -2015,7 +2015,7 @@ outputs:
2015
2015
  content:
2016
2016
  type: string
2017
2017
  usage:
2018
- type: object`})})]}),Xa("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Embeddings"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-embeddings
2018
+ type: object`})})]}),$a("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Embeddings"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-embeddings
2019
2019
  provider:
2020
2020
  type: openai
2021
2021
  operation: createEmbedding
@@ -2031,7 +2031,7 @@ outputs:
2031
2031
  embedding:
2032
2032
  type: array
2033
2033
  items:
2034
- type: number`})})]}),Xa("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Whisper (Speech-to-Text)"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-transcribe
2034
+ type: number`})})]}),$a("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Whisper (Speech-to-Text)"}),We("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:We("pre",{children:`capabilityId: openai-transcribe
2035
2035
  provider:
2036
2036
  type: openai
2037
2037
  operation: transcribe
@@ -2047,7 +2047,7 @@ outputs:
2047
2047
  text:
2048
2048
  type: string
2049
2049
  language:
2050
- type: string`})})]}),Xa("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Best practices"}),Xa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[We("li",{children:"Use streaming for real-time chat responses"}),We("li",{children:"Cache embeddings to reduce API costs"}),We("li",{children:"Implement rate limiting to avoid quota issues"}),We("li",{children:"Store conversation history for context"}),We("li",{children:"Monitor token usage and costs"})]})]}),Xa("div",{className:"flex items-center gap-4 pt-4",children:[We(Cn,{href:"/docs/integrations/google-calendar",className:"btn-ghost",children:"Previous: Google Calendar"}),Xa(Cn,{href:"/docs/integrations/mistral",className:"btn-primary",children:["Next: Mistral ",We(mp,{size:16})]})]})]})}import nr from"@contractspec/lib.ui-link";import{jsx as Mt,jsxs as co}from"react/jsx-runtime";var gp=[{title:"Models and voice",items:[{title:"OpenAI",href:"/docs/integrations/openai"},{title:"Mistral",href:"/docs/integrations/mistral"},{title:"ElevenLabs",href:"/docs/integrations/elevenlabs"}]},{title:"Messaging and product operations",items:[{title:"GitHub",href:"/docs/integrations/github"},{title:"Slack",href:"/docs/integrations/slack"},{title:"Twilio",href:"/docs/integrations/twilio"},{title:"Postmark",href:"/docs/integrations/postmark"}]},{title:"Data, storage, and retrieval",items:[{title:"Qdrant",href:"/docs/integrations/qdrant"},{title:"S3 storage",href:"/docs/integrations/s3"},{title:"Gmail",href:"/docs/integrations/gmail"},{title:"Google Calendar",href:"/docs/integrations/google-calendar"}]},{title:"Payments and external workflows",items:[{title:"Stripe",href:"/docs/integrations/stripe"},{title:"Powens",href:"/docs/integrations/powens"},{title:"Circuit breakers",href:"/docs/integrations/circuit-breakers"},{title:"Health routing",href:"/docs/integrations/health-routing"}]}];function fp(){return co("div",{className:"space-y-10",children:[co("div",{className:"space-y-3",children:[Mt("p",{className:"editorial-kicker",children:"Integrations"}),Mt("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Integrations stay explicit: spec what a provider offers, then bind it per tenant and per app."}),Mt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"The integration model keeps provider behavior out of ad hoc glue code. Define the capability contract first, configure the provider connection explicitly, then bind the integration into app workflows and runtime surfaces with clear ownership."})]}),co("div",{className:"editorial-proof-strip",children:[co("div",{className:"editorial-stat",children:[Mt("span",{className:"editorial-label",children:"Binding model"}),Mt("span",{className:"editorial-stat-value",children:"Integration spec → tenant connection → app binding"})]}),Mt("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"That separation is what makes reuse, tenant isolation, and provider swaps practical without rewriting every surface."})]}),Mt("section",{className:"editorial-panel space-y-5",children:co("div",{className:"space-y-2",children:[Mt("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Start with the model, then pick a provider"}),co("div",{className:"grid gap-4 md:grid-cols-2",children:[co(nr,{href:"/docs/integrations/spec-model",className:"docs-footer-link",children:[Mt("h3",{className:"font-semibold text-lg",children:"Integration spec model"}),Mt("p",{className:"text-muted-foreground text-sm leading-7",children:"Define what the provider offers, what configuration it needs, and how the runtime should treat it."})]}),co(nr,{href:"/docs/architecture/integration-binding",className:"docs-footer-link",children:[Mt("h3",{className:"font-semibold text-lg",children:"Integration binding"}),Mt("p",{className:"text-muted-foreground text-sm leading-7",children:"Understand how tenant connections get mapped into concrete app surfaces and workflows."})]})]})]})}),Mt("div",{className:"grid gap-5 md:grid-cols-2",children:gp.map((e)=>co("section",{className:"editorial-panel space-y-4",children:[Mt("h2",{className:"font-serif text-2xl tracking-[-0.03em]",children:e.title}),Mt("div",{className:"space-y-3",children:e.items.map((t)=>Mt(nr,{href:t.href,className:"docs-chip-link",children:t.title},t.href))})]},e.title))})]})}import In from"@contractspec/lib.ui-link";import{ChevronRight as hp}from"lucide-react";import{jsx as Q,jsxs as Ct}from"react/jsx-runtime";function yp(){return Ct("div",{className:"space-y-8",children:[Ct("div",{className:"space-y-4",children:[Q("h1",{className:"font-bold text-4xl",children:"Postmark"}),Q("p",{className:"text-muted-foreground",children:"Postmark is a transactional email service with industry-leading deliverability. Use it to send order confirmations, password resets, notifications, and other critical emails."})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Setup"}),Q("p",{className:"text-muted-foreground",children:"Add your Postmark credentials to your environment variables:"}),Q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Q("pre",{children:`# .env
2050
+ type: string`})})]}),$a("div",{className:"space-y-4",children:[We("h2",{className:"font-bold text-2xl",children:"Best practices"}),$a("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[We("li",{children:"Use streaming for real-time chat responses"}),We("li",{children:"Cache embeddings to reduce API costs"}),We("li",{children:"Implement rate limiting to avoid quota issues"}),We("li",{children:"Store conversation history for context"}),We("li",{children:"Monitor token usage and costs"})]})]}),$a("div",{className:"flex items-center gap-4 pt-4",children:[We(Cn,{href:"/docs/integrations/google-calendar",className:"btn-ghost",children:"Previous: Google Calendar"}),$a(Cn,{href:"/docs/integrations/mistral",className:"btn-primary",children:["Next: Mistral ",We(mp,{size:16})]})]})]})}import nr from"@contractspec/lib.ui-link";import{jsx as Mt,jsxs as co}from"react/jsx-runtime";var gp=[{title:"Models and voice",items:[{title:"OpenAI",href:"/docs/integrations/openai"},{title:"Mistral",href:"/docs/integrations/mistral"},{title:"ElevenLabs",href:"/docs/integrations/elevenlabs"}]},{title:"Messaging and product operations",items:[{title:"GitHub",href:"/docs/integrations/github"},{title:"Slack",href:"/docs/integrations/slack"},{title:"Twilio",href:"/docs/integrations/twilio"},{title:"Postmark",href:"/docs/integrations/postmark"}]},{title:"Data, storage, and retrieval",items:[{title:"Qdrant",href:"/docs/integrations/qdrant"},{title:"S3 storage",href:"/docs/integrations/s3"},{title:"Gmail",href:"/docs/integrations/gmail"},{title:"Google Calendar",href:"/docs/integrations/google-calendar"}]},{title:"Payments and external workflows",items:[{title:"Stripe",href:"/docs/integrations/stripe"},{title:"Powens",href:"/docs/integrations/powens"},{title:"Circuit breakers",href:"/docs/integrations/circuit-breakers"},{title:"Health routing",href:"/docs/integrations/health-routing"}]}];function hp(){return co("div",{className:"space-y-10",children:[co("div",{className:"space-y-3",children:[Mt("p",{className:"editorial-kicker",children:"Integrations"}),Mt("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Integrations stay explicit: spec what a provider offers, then bind it per tenant and per app."}),Mt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"The integration model keeps provider behavior out of ad hoc glue code. Define the capability contract first, configure the provider connection explicitly, then bind the integration into app workflows and runtime surfaces with clear ownership."})]}),co("div",{className:"editorial-proof-strip",children:[co("div",{className:"editorial-stat",children:[Mt("span",{className:"editorial-label",children:"Binding model"}),Mt("span",{className:"editorial-stat-value",children:"Integration spec → tenant connection → app binding"})]}),Mt("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"That separation is what makes reuse, tenant isolation, and provider swaps practical without rewriting every surface."})]}),Mt("section",{className:"editorial-panel space-y-5",children:co("div",{className:"space-y-2",children:[Mt("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Start with the model, then pick a provider"}),co("div",{className:"grid gap-4 md:grid-cols-2",children:[co(nr,{href:"/docs/integrations/spec-model",className:"docs-footer-link",children:[Mt("h3",{className:"font-semibold text-lg",children:"Integration spec model"}),Mt("p",{className:"text-muted-foreground text-sm leading-7",children:"Define what the provider offers, what configuration it needs, and how the runtime should treat it."})]}),co(nr,{href:"/docs/architecture/integration-binding",className:"docs-footer-link",children:[Mt("h3",{className:"font-semibold text-lg",children:"Integration binding"}),Mt("p",{className:"text-muted-foreground text-sm leading-7",children:"Understand how tenant connections get mapped into concrete app surfaces and workflows."})]})]})]})}),Mt("div",{className:"grid gap-5 md:grid-cols-2",children:gp.map((e)=>co("section",{className:"editorial-panel space-y-4",children:[Mt("h2",{className:"font-serif text-2xl tracking-[-0.03em]",children:e.title}),Mt("div",{className:"space-y-3",children:e.items.map((t)=>Mt(nr,{href:t.href,className:"docs-chip-link",children:t.title},t.href))})]},e.title))})]})}import In from"@contractspec/lib.ui-link";import{ChevronRight as fp}from"lucide-react";import{jsx as Q,jsxs as Ct}from"react/jsx-runtime";function yp(){return Ct("div",{className:"space-y-8",children:[Ct("div",{className:"space-y-4",children:[Q("h1",{className:"font-bold text-4xl",children:"Postmark"}),Q("p",{className:"text-muted-foreground",children:"Postmark is a transactional email service with industry-leading deliverability. Use it to send order confirmations, password resets, notifications, and other critical emails."})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Setup"}),Q("p",{className:"text-muted-foreground",children:"Add your Postmark credentials to your environment variables:"}),Q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Q("pre",{children:`# .env
2051
2051
  POSTMARK_API_TOKEN=...
2052
2052
  POSTMARK_FROM_EMAIL=noreply@example.com
2053
2053
  POSTMARK_FROM_NAME="Your App Name"`})}),Ct("p",{className:"text-muted-foreground text-sm",children:["Get your API token from the"," ",Q("a",{href:"https://account.postmarkapp.com/servers",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Postmark Dashboard"}),"."]})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Sending emails"}),Q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Q("pre",{children:`capabilityId: send-email
@@ -2093,7 +2093,7 @@ config:
2093
2093
  templateId: "welcome-email"
2094
2094
  templateData:
2095
2095
  user_name: \${input.userName}
2096
- login_url: "https://app.example.com/login"`})})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Webhooks"}),Q("p",{className:"text-muted-foreground",children:"Postmark can notify your app about delivery, bounces, and opens:"}),Q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Q("pre",{children:"https://your-app.com/api/webhooks/postmark"})}),Q("p",{className:"text-muted-foreground",children:"ContractSpec automatically processes these webhook events:"}),Ct("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ct("li",{children:[Q("strong",{children:"Delivery"})," – Email was successfully delivered"]}),Ct("li",{children:[Q("strong",{children:"Bounce"})," – Email bounced (hard or soft)"]}),Ct("li",{children:[Q("strong",{children:"SpamComplaint"})," – Recipient marked email as spam"]}),Ct("li",{children:[Q("strong",{children:"Open"})," – Recipient opened the email"]}),Ct("li",{children:[Q("strong",{children:"Click"})," – Recipient clicked a link"]})]})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Best practices"}),Ct("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Q("li",{children:"Use templates for consistent branding"}),Q("li",{children:"Always provide both HTML and plain text versions"}),Q("li",{children:"Monitor bounce rates and remove invalid addresses"}),Q("li",{children:"Use message streams to separate different email types"}),Q("li",{children:"Test emails in the Postmark sandbox before going live"}),Q("li",{children:"Set up DKIM and SPF records for your domain"})]})]}),Ct("div",{className:"flex items-center gap-4 pt-4",children:[Q(In,{href:"/docs/integrations/stripe",className:"btn-ghost",children:"Previous: Stripe"}),Ct(In,{href:"/docs/integrations/resend",className:"btn-primary",children:["Next: Resend ",Q(hp,{size:16})]})]})]})}import Pn from"@contractspec/lib.ui-link";import{ChevronRight as vp}from"lucide-react";import{jsx as _,jsxs as Se}from"react/jsx-runtime";function bp(){return Se("div",{className:"space-y-8",children:[Se("div",{className:"space-y-4",children:[_("h1",{className:"font-bold text-4xl",children:"Powens Open Banking"}),_("p",{className:"text-muted-foreground",children:"Powens provides read-only open banking connectivity for ContractSpec applications. The reference integration powers Pocket Family Office by synchronising household bank accounts, transactions, and balances while keeping all raw PII protected."})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Setup"}),_("p",{className:"text-muted-foreground",children:"Create a Powens BYOK project, then store the credentials in your secret manager. The ContractSpec integration expects the following fields:"}),_("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:_("pre",{children:`{
2096
+ login_url: "https://app.example.com/login"`})})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Webhooks"}),Q("p",{className:"text-muted-foreground",children:"Postmark can notify your app about delivery, bounces, and opens:"}),Q("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Q("pre",{children:"https://your-app.com/api/webhooks/postmark"})}),Q("p",{className:"text-muted-foreground",children:"ContractSpec automatically processes these webhook events:"}),Ct("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ct("li",{children:[Q("strong",{children:"Delivery"})," – Email was successfully delivered"]}),Ct("li",{children:[Q("strong",{children:"Bounce"})," – Email bounced (hard or soft)"]}),Ct("li",{children:[Q("strong",{children:"SpamComplaint"})," – Recipient marked email as spam"]}),Ct("li",{children:[Q("strong",{children:"Open"})," – Recipient opened the email"]}),Ct("li",{children:[Q("strong",{children:"Click"})," – Recipient clicked a link"]})]})]}),Ct("div",{className:"space-y-4",children:[Q("h2",{className:"font-bold text-2xl",children:"Best practices"}),Ct("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Q("li",{children:"Use templates for consistent branding"}),Q("li",{children:"Always provide both HTML and plain text versions"}),Q("li",{children:"Monitor bounce rates and remove invalid addresses"}),Q("li",{children:"Use message streams to separate different email types"}),Q("li",{children:"Test emails in the Postmark sandbox before going live"}),Q("li",{children:"Set up DKIM and SPF records for your domain"})]})]}),Ct("div",{className:"flex items-center gap-4 pt-4",children:[Q(In,{href:"/docs/integrations/stripe",className:"btn-ghost",children:"Previous: Stripe"}),Ct(In,{href:"/docs/integrations/resend",className:"btn-primary",children:["Next: Resend ",Q(fp,{size:16})]})]})]})}import Pn from"@contractspec/lib.ui-link";import{ChevronRight as vp}from"lucide-react";import{jsx as _,jsxs as Se}from"react/jsx-runtime";function bp(){return Se("div",{className:"space-y-8",children:[Se("div",{className:"space-y-4",children:[_("h1",{className:"font-bold text-4xl",children:"Powens Open Banking"}),_("p",{className:"text-muted-foreground",children:"Powens provides read-only open banking connectivity for ContractSpec applications. The reference integration powers Pocket Family Office by synchronising household bank accounts, transactions, and balances while keeping all raw PII protected."})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Setup"}),_("p",{className:"text-muted-foreground",children:"Create a Powens BYOK project, then store the credentials in your secret manager. The ContractSpec integration expects the following fields:"}),_("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:_("pre",{children:`{
2097
2097
  "clientId": "powens-client-id",
2098
2098
  "clientSecret": "powens-client-secret",
2099
2099
  "apiKey": "optional-api-key",
@@ -2646,7 +2646,7 @@ outputs:
2646
2646
  {
2647
2647
  "phoneNumberId": "120000000001",
2648
2648
  "apiVersion": "v22.0"
2649
- }`})})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Webhook endpoints"}),ka("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ka("li",{children:["Verification challenge:"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"GET /webhooks/whatsapp/meta"})]}),ka("li",{children:["Inbound messages:"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"POST /webhooks/whatsapp/meta"})]}),ka("li",{children:["Signatures are validated with"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-hub-signature-256"}),"."]})]})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Workspace mapping"}),ut("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ut("pre",{children:'CHANNEL_WORKSPACE_MAP_WHATSAPP_META={"120000000001":"workspace-acme"}'})})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Best practices"}),ka("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ut("li",{children:"Keep verify and app secrets separate from access tokens."}),ut("li",{children:"Map each phone number ID to a workspace for strict tenant routing."}),ut("li",{children:"Use Twilio WhatsApp only as fallback when you need active-passive routing."})]})]}),ka("div",{className:"flex items-center gap-4 pt-4",children:[ut(Mn,{href:"/docs/integrations/github",className:"btn-ghost",children:"Previous: GitHub Messaging"}),ka(Mn,{href:"/docs/integrations/whatsapp-twilio",className:"btn-primary",children:["Next: WhatsApp Twilio ",ut(Op,{size:16})]})]})]})}import Bn from"@contractspec/lib.ui-link";import{ChevronRight as Bp}from"lucide-react";import{jsx as gt,jsxs as fa}from"react/jsx-runtime";function Up(){return fa("div",{className:"space-y-8",children:[fa("div",{className:"space-y-4",children:[gt("h1",{className:"font-bold text-4xl",children:"WhatsApp Twilio"}),gt("p",{className:"text-muted-foreground",children:"Twilio WhatsApp support provides a durable fallback channel with signature verification and outbox-backed outbound dispatch."})]}),fa("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),gt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:gt("pre",{children:`// secret payload
2649
+ }`})})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Webhook endpoints"}),ka("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ka("li",{children:["Verification challenge:"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"GET /webhooks/whatsapp/meta"})]}),ka("li",{children:["Inbound messages:"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"POST /webhooks/whatsapp/meta"})]}),ka("li",{children:["Signatures are validated with"," ",ut("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-hub-signature-256"}),"."]})]})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Workspace mapping"}),ut("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ut("pre",{children:'CHANNEL_WORKSPACE_MAP_WHATSAPP_META={"120000000001":"workspace-acme"}'})})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Best practices"}),ka("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ut("li",{children:"Keep verify and app secrets separate from access tokens."}),ut("li",{children:"Map each phone number ID to a workspace for strict tenant routing."}),ut("li",{children:"Use Twilio WhatsApp only as fallback when you need active-passive routing."})]})]}),ka("div",{className:"flex items-center gap-4 pt-4",children:[ut(Mn,{href:"/docs/integrations/github",className:"btn-ghost",children:"Previous: GitHub Messaging"}),ka(Mn,{href:"/docs/integrations/whatsapp-twilio",className:"btn-primary",children:["Next: WhatsApp Twilio ",ut(Op,{size:16})]})]})]})}import Bn from"@contractspec/lib.ui-link";import{ChevronRight as Bp}from"lucide-react";import{jsx as gt,jsxs as ha}from"react/jsx-runtime";function Up(){return ha("div",{className:"space-y-8",children:[ha("div",{className:"space-y-4",children:[gt("h1",{className:"font-bold text-4xl",children:"WhatsApp Twilio"}),gt("p",{className:"text-muted-foreground",children:"Twilio WhatsApp support provides a durable fallback channel with signature verification and outbox-backed outbound dispatch."})]}),ha("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),gt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:gt("pre",{children:`// secret payload
2650
2650
  {
2651
2651
  "accountSid": "AC123",
2652
2652
  "authToken": "..."
@@ -2655,7 +2655,7 @@ outputs:
2655
2655
  // optional connection config
2656
2656
  {
2657
2657
  "fromNumber": "whatsapp:+15550002"
2658
- }`})})]}),fa("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Webhook ingress"}),fa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[fa("li",{children:["Inbound Twilio form payloads are accepted on"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"/webhooks/whatsapp/twilio"}),"."]}),fa("li",{children:["Signatures are validated with"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-twilio-signature"})," ","and the configured auth token."]}),fa("li",{children:["For deterministic verification, set the exact public webhook URL in"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"WHATSAPP_TWILIO_WEBHOOK_URL"}),"."]})]})]}),fa("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Workspace mapping"}),gt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:gt("pre",{children:'CHANNEL_WORKSPACE_MAP_WHATSAPP_TWILIO={"AC123":"workspace-acme"}'})})]}),fa("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Best practices"}),fa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[gt("li",{children:"Use Twilio as fallback when Meta WhatsApp is your primary route."}),gt("li",{children:"Keep account SID mapping explicit to avoid tenant misrouting."}),fa("li",{children:["Protect internal dispatch endpoints with",gt("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"CHANNEL_DISPATCH_TOKEN"}),"."]})]})]}),fa("div",{className:"flex items-center gap-4 pt-4",children:[gt(Bn,{href:"/docs/integrations/whatsapp-meta",className:"btn-ghost",children:"Previous: WhatsApp Meta"}),fa(Bn,{href:"/docs/integrations/health-routing",className:"btn-primary",children:["Next: Health Routing ",gt(Bp,{size:16})]})]})]})}var e2={title:"Contract-first API",summary:"Design APIs by writing contracts first, then generate consistent implementations across frameworks.",problems:["API drift between frontend and backend","Inconsistent error handling across endpoints","Documentation becomes outdated quickly","Manual OpenAPI maintenance is error-prone"],solutions:["Single source of truth for API contracts","Generate OpenAPI and SDKs from contracts","Type-safe request/response validation","Always-in-sync documentation"],audience:{role:"API developers",industry:"Software development",maturity:"scaleup"},callToAction:"Start with a simple operation contract",references:[{label:"Next.js One Endpoint Guide",url:"/docs/guides/nextjs-one-endpoint"},{label:"API Reference",url:"/docs/api"}]},t2={title:"Spec-driven development",summary:"Build features by writing specifications first, then generate type-safe implementations.",problems:["Feature requirements are ambiguous","Frontend and backend implementations diverge","Testing lacks clear contract definitions","Code reviews focus on style instead of behavior"],solutions:["Executable specifications as single source of truth","Generate type-safe clients from specs","Automated contract testing","Clear behavior contracts for teams"],audience:{role:"Development teams",industry:"Software engineering",maturity:"enterprise"},callToAction:"Define your first feature spec",references:[{label:"Spec Validation + Typing Guide",url:"/docs/guides/spec-validation-and-typing"},{label:"Core Contracts",url:"/docs/core-contracts"}]},a2={title:"Deterministic codegen",summary:"Regenerate code from contracts without breaking existing functionality or losing customizations.",problems:["Generated code conflicts with manual changes","Regeneration loses custom business logic","Teams avoid regeneration after customization","Code migration between versions is risky"],solutions:["Clear separation of generated vs hand-written code","Incremental regeneration with conflict detection","Protected zones for custom logic","Automatic migration paths"],audience:{role:"Platform engineers",industry:"Developer tools",maturity:"scaleup"},callToAction:"Try deterministic regeneration",references:[{label:"Generate Docs + Clients Guide",url:"/docs/guides/generate-docs-clients-schemas"},{label:"CLI Reference",url:"/docs/getting-started/cli"}]},o2={title:"Schema validation TypeScript",summary:"Generate TypeScript types from contracts and validate data at runtime with zero overhead.",problems:["Runtime type validation is boilerplate-heavy","Type definitions drift from schemas","Validation logic scattered across codebase","Poor error messages for invalid data"],solutions:["Auto-generated TypeScript from contracts","Zod schemas for runtime validation","Type-safe validation with clear errors","Single source of schema truth"],audience:{role:"TypeScript developers",industry:"Web development",maturity:"early"},callToAction:"Generate typed contracts now",references:[{label:"Type Safety Guide",url:"/docs/guides/spec-validation-and-typing"},{label:"Schema Reference",url:"/docs/schemas"}]},i2={title:"OpenAPI alternative",summary:"A spec-first approach that goes beyond OpenAPI with executable contracts and code generation.",problems:["OpenAPI is documentation-only","No type safety from OpenAPI specs","Manual SDK generation is complex","Cannot validate implementations against OpenAPI"],solutions:["Executable contracts with validation","Generate multiple outputs from one spec","Type-safe by default","Built-in testing and validation"],audience:{role:"API architects",industry:"Enterprise software",maturity:"enterprise"},callToAction:"Compare with OpenAPI approach",references:[{label:"Generate OpenAPI from Contracts",url:"/docs/guides/generate-docs-clients-schemas"},{label:"Contract vs OpenAPI",url:"/docs/comparison/openapi"}]},r2={title:"Generate client from schema",summary:"Automatically generate type-safe API clients in any language from your contracts.",problems:["Writing API clients is repetitive","Manual clients have type mismatches","Keeping clients in sync with APIs","Language-specific client maintenance"],solutions:["Generate clients for multiple languages","Type-safe request/response handling","Automatic client updates from contracts","Consistent error handling across languages"],audience:{role:"Full-stack developers",industry:"Software development",maturity:"scaleup"},callToAction:"Generate your first API client",references:[{label:"Client Generation Guide",url:"/docs/guides/generate-docs-clients-schemas"},{label:"Supported Languages",url:"/docs/integrations"}]};import{contractFirstApiBrief as si}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Wp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Un}from"@contractspec/lib.design-system";import Wn from"@contractspec/lib.ui-link";import{ChevronRight as _p}from"lucide-react";import{jsx as Ut,jsxs as po}from"react/jsx-runtime";var m2=new Wp().optimize(si);function zp(){return po("div",{className:"space-y-8",children:[po("div",{className:"space-y-3",children:[Ut("h1",{className:"font-bold text-4xl",children:si.title}),Ut("p",{className:"text-lg text-muted-foreground",children:si.summary})]}),po("div",{className:"card-subtle space-y-4 p-6",children:[Ut("h2",{className:"font-bold text-2xl",children:"Problems Solved"}),Ut("ul",{className:"space-y-2 text-muted-foreground text-sm",children:si.problems.map((e,t)=>Ut("li",{children:e},t))})]}),po("div",{className:"card-subtle space-y-4 p-6",children:[Ut("h2",{className:"font-bold text-2xl",children:"Solutions"}),Ut("ul",{className:"space-y-2 text-muted-foreground text-sm",children:si.solutions.map((e,t)=>Ut("li",{children:e},t))})]}),po("div",{className:"space-y-6",children:[po("div",{className:"space-y-3",children:[Ut("h2",{className:"font-bold text-2xl",children:"Quick Start"}),Ut("p",{className:"text-muted-foreground text-sm",children:"Define your first API contract and generate consistent implementations."}),Ut(Un,{language:"typescript",filename:"src/contracts/user-create.operation.ts",code:`import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
2658
+ }`})})]}),ha("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Webhook ingress"}),ha("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ha("li",{children:["Inbound Twilio form payloads are accepted on"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"/webhooks/whatsapp/twilio"}),"."]}),ha("li",{children:["Signatures are validated with"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-twilio-signature"})," ","and the configured auth token."]}),ha("li",{children:["For deterministic verification, set the exact public webhook URL in"," ",gt("code",{className:"rounded bg-background/50 px-2 py-1",children:"WHATSAPP_TWILIO_WEBHOOK_URL"}),"."]})]})]}),ha("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Workspace mapping"}),gt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:gt("pre",{children:'CHANNEL_WORKSPACE_MAP_WHATSAPP_TWILIO={"AC123":"workspace-acme"}'})})]}),ha("div",{className:"space-y-4",children:[gt("h2",{className:"font-bold text-2xl",children:"Best practices"}),ha("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[gt("li",{children:"Use Twilio as fallback when Meta WhatsApp is your primary route."}),gt("li",{children:"Keep account SID mapping explicit to avoid tenant misrouting."}),ha("li",{children:["Protect internal dispatch endpoints with",gt("code",{className:"ml-1 rounded bg-background/50 px-2 py-1",children:"CHANNEL_DISPATCH_TOKEN"}),"."]})]})]}),ha("div",{className:"flex items-center gap-4 pt-4",children:[gt(Bn,{href:"/docs/integrations/whatsapp-meta",className:"btn-ghost",children:"Previous: WhatsApp Meta"}),ha(Bn,{href:"/docs/integrations/health-routing",className:"btn-primary",children:["Next: Health Routing ",gt(Bp,{size:16})]})]})]})}var e2={title:"Contract-first API",summary:"Design APIs by writing contracts first, then generate consistent implementations across frameworks.",problems:["API drift between frontend and backend","Inconsistent error handling across endpoints","Documentation becomes outdated quickly","Manual OpenAPI maintenance is error-prone"],solutions:["Single source of truth for API contracts","Generate OpenAPI and SDKs from contracts","Type-safe request/response validation","Always-in-sync documentation"],audience:{role:"API developers",industry:"Software development",maturity:"scaleup"},callToAction:"Start with a simple operation contract",references:[{label:"Next.js One Endpoint Guide",url:"/docs/guides/nextjs-one-endpoint"},{label:"API Reference",url:"/docs/api"}]},t2={title:"Spec-driven development",summary:"Build features by writing specifications first, then generate type-safe implementations.",problems:["Feature requirements are ambiguous","Frontend and backend implementations diverge","Testing lacks clear contract definitions","Code reviews focus on style instead of behavior"],solutions:["Executable specifications as single source of truth","Generate type-safe clients from specs","Automated contract testing","Clear behavior contracts for teams"],audience:{role:"Development teams",industry:"Software engineering",maturity:"enterprise"},callToAction:"Define your first feature spec",references:[{label:"Spec Validation + Typing Guide",url:"/docs/guides/spec-validation-and-typing"},{label:"Core Contracts",url:"/docs/core-contracts"}]},a2={title:"Deterministic codegen",summary:"Regenerate code from contracts without breaking existing functionality or losing customizations.",problems:["Generated code conflicts with manual changes","Regeneration loses custom business logic","Teams avoid regeneration after customization","Code migration between versions is risky"],solutions:["Clear separation of generated vs hand-written code","Incremental regeneration with conflict detection","Protected zones for custom logic","Automatic migration paths"],audience:{role:"Platform engineers",industry:"Developer tools",maturity:"scaleup"},callToAction:"Try deterministic regeneration",references:[{label:"Generate Docs + Clients Guide",url:"/docs/guides/generate-docs-clients-schemas"},{label:"CLI Reference",url:"/docs/getting-started/cli"}]},o2={title:"Schema validation TypeScript",summary:"Generate TypeScript types from contracts and validate data at runtime with zero overhead.",problems:["Runtime type validation is boilerplate-heavy","Type definitions drift from schemas","Validation logic scattered across codebase","Poor error messages for invalid data"],solutions:["Auto-generated TypeScript from contracts","Zod schemas for runtime validation","Type-safe validation with clear errors","Single source of schema truth"],audience:{role:"TypeScript developers",industry:"Web development",maturity:"early"},callToAction:"Generate typed contracts now",references:[{label:"Type Safety Guide",url:"/docs/guides/spec-validation-and-typing"},{label:"Schema Reference",url:"/docs/schemas"}]},i2={title:"OpenAPI alternative",summary:"A spec-first approach that goes beyond OpenAPI with executable contracts and code generation.",problems:["OpenAPI is documentation-only","No type safety from OpenAPI specs","Manual SDK generation is complex","Cannot validate implementations against OpenAPI"],solutions:["Executable contracts with validation","Generate multiple outputs from one spec","Type-safe by default","Built-in testing and validation"],audience:{role:"API architects",industry:"Enterprise software",maturity:"enterprise"},callToAction:"Compare with OpenAPI approach",references:[{label:"Generate OpenAPI from Contracts",url:"/docs/guides/generate-docs-clients-schemas"},{label:"Contract vs OpenAPI",url:"/docs/comparison/openapi"}]},r2={title:"Generate client from schema",summary:"Automatically generate type-safe API clients in any language from your contracts.",problems:["Writing API clients is repetitive","Manual clients have type mismatches","Keeping clients in sync with APIs","Language-specific client maintenance"],solutions:["Generate clients for multiple languages","Type-safe request/response handling","Automatic client updates from contracts","Consistent error handling across languages"],audience:{role:"Full-stack developers",industry:"Software development",maturity:"scaleup"},callToAction:"Generate your first API client",references:[{label:"Client Generation Guide",url:"/docs/guides/generate-docs-clients-schemas"},{label:"Supported Languages",url:"/docs/integrations"}]};import{contractFirstApiBrief as si}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Wp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Un}from"@contractspec/lib.design-system";import Wn from"@contractspec/lib.ui-link";import{ChevronRight as _p}from"lucide-react";import{jsx as Ut,jsxs as po}from"react/jsx-runtime";var m2=new Wp().optimize(si);function zp(){return po("div",{className:"space-y-8",children:[po("div",{className:"space-y-3",children:[Ut("h1",{className:"font-bold text-4xl",children:si.title}),Ut("p",{className:"text-lg text-muted-foreground",children:si.summary})]}),po("div",{className:"card-subtle space-y-4 p-6",children:[Ut("h2",{className:"font-bold text-2xl",children:"Problems Solved"}),Ut("ul",{className:"space-y-2 text-muted-foreground text-sm",children:si.problems.map((e,t)=>Ut("li",{children:e},t))})]}),po("div",{className:"card-subtle space-y-4 p-6",children:[Ut("h2",{className:"font-bold text-2xl",children:"Solutions"}),Ut("ul",{className:"space-y-2 text-muted-foreground text-sm",children:si.solutions.map((e,t)=>Ut("li",{children:e},t))})]}),po("div",{className:"space-y-6",children:[po("div",{className:"space-y-3",children:[Ut("h2",{className:"font-bold text-2xl",children:"Quick Start"}),Ut("p",{className:"text-muted-foreground text-sm",children:"Define your first API contract and generate consistent implementations."}),Ut(Un,{language:"typescript",filename:"src/contracts/user-create.operation.ts",code:`import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
2659
2659
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2660
2660
 
2661
2661
  export const CreateUserOperation = defineOperation({
@@ -2689,7 +2689,7 @@ export const CreateUserOperation = defineOperation({
2689
2689
  tags: ['users', 'auth'],
2690
2690
  description: 'Create a new user account with email and password',
2691
2691
  },
2692
- });`})]}),po("div",{className:"space-y-3",children:[Ut("h2",{className:"font-bold text-2xl",children:"Generate OpenAPI"}),Ut("p",{className:"text-muted-foreground text-sm",children:"Export OpenAPI documentation directly from your contracts."}),Ut(Un,{language:"bash",filename:"export-openapi",code:"contractspec openapi export \\\n --registry ./src/contracts/registry.ts \\\n --out ./openapi.json"})]})]}),po("div",{className:"flex items-center gap-4 pt-4",children:[po(Wn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next.js Guide ",Ut(_p,{size:16})]}),Ut(Wn,{href:"/docs/intent/spec-driven-development",className:"btn-ghost",children:"Spec-driven Development"})]})]})}import{deterministicCodegenBrief as di}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Gp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as cr}from"@contractspec/lib.design-system";import _n from"@contractspec/lib.ui-link";import{ChevronRight as Hp}from"lucide-react";import{jsx as lt,jsxs as xa}from"react/jsx-runtime";var y2=new Gp().optimize(di);function qp(){return xa("div",{className:"space-y-8",children:[xa("div",{className:"space-y-3",children:[lt("h1",{className:"font-bold text-4xl",children:di.title}),lt("p",{className:"text-lg text-muted-foreground",children:di.summary})]}),xa("div",{className:"card-subtle space-y-4 p-6",children:[lt("h2",{className:"font-bold text-2xl",children:"Regeneration Challenges"}),lt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:di.problems.map((e,t)=>lt("li",{children:e},t))})]}),xa("div",{className:"card-subtle space-y-4 p-6",children:[lt("h2",{className:"font-bold text-2xl",children:"Deterministic Solutions"}),lt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:di.solutions.map((e,t)=>lt("li",{children:e},t))})]}),xa("div",{className:"space-y-6",children:[xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Protected Zones"}),lt("p",{className:"text-muted-foreground text-sm",children:"Separate generated code from hand-written business logic with clear boundaries."}),lt(cr,{language:"typescript",filename:"src/handlers/user-handlers.ts",code:`// Hand-written business logic (protected from regeneration)
2692
+ });`})]}),po("div",{className:"space-y-3",children:[Ut("h2",{className:"font-bold text-2xl",children:"Generate OpenAPI"}),Ut("p",{className:"text-muted-foreground text-sm",children:"Export OpenAPI documentation directly from your contracts."}),Ut(Un,{language:"bash",filename:"export-openapi",code:"contractspec openapi export \\\n --registry ./src/contracts/registry.ts \\\n --out ./openapi.json"})]})]}),po("div",{className:"flex items-center gap-4 pt-4",children:[po(Wn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next.js Guide ",Ut(_p,{size:16})]}),Ut(Wn,{href:"/docs/intent/spec-driven-development",className:"btn-ghost",children:"Spec-driven Development"})]})]})}import{deterministicCodegenBrief as di}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Gp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as cr}from"@contractspec/lib.design-system";import _n from"@contractspec/lib.ui-link";import{ChevronRight as qp}from"lucide-react";import{jsx as lt,jsxs as xa}from"react/jsx-runtime";var y2=new Gp().optimize(di);function Vp(){return xa("div",{className:"space-y-8",children:[xa("div",{className:"space-y-3",children:[lt("h1",{className:"font-bold text-4xl",children:di.title}),lt("p",{className:"text-lg text-muted-foreground",children:di.summary})]}),xa("div",{className:"card-subtle space-y-4 p-6",children:[lt("h2",{className:"font-bold text-2xl",children:"Regeneration Challenges"}),lt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:di.problems.map((e,t)=>lt("li",{children:e},t))})]}),xa("div",{className:"card-subtle space-y-4 p-6",children:[lt("h2",{className:"font-bold text-2xl",children:"Deterministic Solutions"}),lt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:di.solutions.map((e,t)=>lt("li",{children:e},t))})]}),xa("div",{className:"space-y-6",children:[xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Protected Zones"}),lt("p",{className:"text-muted-foreground text-sm",children:"Separate generated code from hand-written business logic with clear boundaries."}),lt(cr,{language:"typescript",filename:"src/handlers/user-handlers.ts",code:`// Hand-written business logic (protected from regeneration)
2693
2693
  export class UserService {
2694
2694
  async createUser(input: CreateUserInput): Promise<CreateUserOutput> {
2695
2695
  // Custom validation and business rules
@@ -2726,7 +2726,7 @@ export const createUserHandler = wrapOperationHandler(
2726
2726
  operationName: 'createUser',
2727
2727
  errorMapper: mapToStandardErrors,
2728
2728
  }
2729
- );`})]}),xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Incremental Regeneration"}),lt("p",{className:"text-muted-foreground text-sm",children:"Regenerate only what changed while preserving custom logic."}),lt(cr,{language:"bash",filename:"incremental-regen",code:"contractspec generate \\\n --incremental \\\n --preserve-zones ./src/handlers/*.ts \\\n --input ./src/contracts/ \\\n --output ./generated/"})]}),xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Conflict Detection"}),lt("p",{className:"text-muted-foreground text-sm",children:"Automatically detect and report conflicts during regeneration."}),lt(cr,{language:"bash",filename:"check-conflicts",code:"contractspec generate \\\n --check-conflicts \\\n --report-conflicts ./conflicts.json"})]})]}),xa("div",{className:"flex items-center gap-4 pt-4",children:[xa(_n,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation ",lt(Hp,{size:16})]}),lt(_n,{href:"/docs/intent/schema-validation-typescript",className:"btn-ghost",children:"Type Safety"})]})]})}import{generateClientFromSchemaBrief as pi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Vp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as ei}from"@contractspec/lib.design-system";import zn from"@contractspec/lib.ui-link";import{ChevronRight as Fp}from"lucide-react";import{jsx as ge,jsxs as xt}from"react/jsx-runtime";var A2=new Vp().optimize(pi);function Kp(){return xt("div",{className:"space-y-8",children:[xt("div",{className:"space-y-3",children:[ge("h1",{className:"font-bold text-4xl",children:pi.title}),ge("p",{className:"text-lg text-muted-foreground",children:pi.summary})]}),xt("div",{className:"card-subtle space-y-4 p-6",children:[ge("h2",{className:"font-bold text-2xl",children:"Client Development Problems"}),ge("ul",{className:"space-y-2 text-muted-foreground text-sm",children:pi.problems.map((e,t)=>ge("li",{children:e},t))})]}),xt("div",{className:"card-subtle space-y-4 p-6",children:[ge("h2",{className:"font-bold text-2xl",children:"Automated Solutions"}),ge("ul",{className:"space-y-2 text-muted-foreground text-sm",children:pi.solutions.map((e,t)=>ge("li",{children:e},t))})]}),xt("div",{className:"space-y-6",children:[xt("div",{className:"space-y-3",children:[ge("h2",{className:"font-bold text-2xl",children:"Contract Definition"}),ge("p",{className:"text-muted-foreground text-sm",children:"Define your API contract once, generate clients for any language."}),ge(ei,{language:"typescript",filename:"src/contracts/api.contract.ts",code:`import { defineContract } from '@contractspec/lib.contracts-spec';
2729
+ );`})]}),xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Incremental Regeneration"}),lt("p",{className:"text-muted-foreground text-sm",children:"Regenerate only what changed while preserving custom logic."}),lt(cr,{language:"bash",filename:"incremental-regen",code:"contractspec generate \\\n --incremental \\\n --preserve-zones ./src/handlers/*.ts \\\n --input ./src/contracts/ \\\n --output ./generated/"})]}),xa("div",{className:"space-y-3",children:[lt("h2",{className:"font-bold text-2xl",children:"Conflict Detection"}),lt("p",{className:"text-muted-foreground text-sm",children:"Automatically detect and report conflicts during regeneration."}),lt(cr,{language:"bash",filename:"check-conflicts",code:"contractspec generate \\\n --check-conflicts \\\n --report-conflicts ./conflicts.json"})]})]}),xa("div",{className:"flex items-center gap-4 pt-4",children:[xa(_n,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation ",lt(qp,{size:16})]}),lt(_n,{href:"/docs/intent/schema-validation-typescript",className:"btn-ghost",children:"Type Safety"})]})]})}import{generateClientFromSchemaBrief as pi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Hp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as ei}from"@contractspec/lib.design-system";import zn from"@contractspec/lib.ui-link";import{ChevronRight as Fp}from"lucide-react";import{jsx as ge,jsxs as xt}from"react/jsx-runtime";var A2=new Hp().optimize(pi);function Kp(){return xt("div",{className:"space-y-8",children:[xt("div",{className:"space-y-3",children:[ge("h1",{className:"font-bold text-4xl",children:pi.title}),ge("p",{className:"text-lg text-muted-foreground",children:pi.summary})]}),xt("div",{className:"card-subtle space-y-4 p-6",children:[ge("h2",{className:"font-bold text-2xl",children:"Client Development Problems"}),ge("ul",{className:"space-y-2 text-muted-foreground text-sm",children:pi.problems.map((e,t)=>ge("li",{children:e},t))})]}),xt("div",{className:"card-subtle space-y-4 p-6",children:[ge("h2",{className:"font-bold text-2xl",children:"Automated Solutions"}),ge("ul",{className:"space-y-2 text-muted-foreground text-sm",children:pi.solutions.map((e,t)=>ge("li",{children:e},t))})]}),xt("div",{className:"space-y-6",children:[xt("div",{className:"space-y-3",children:[ge("h2",{className:"font-bold text-2xl",children:"Contract Definition"}),ge("p",{className:"text-muted-foreground text-sm",children:"Define your API contract once, generate clients for any language."}),ge(ei,{language:"typescript",filename:"src/contracts/api.contract.ts",code:`import { defineContract } from '@contractspec/lib.contracts-spec';
2730
2730
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2731
2731
 
2732
2732
  export const ApiContract = defineContract({
@@ -2923,7 +2923,7 @@ const user2 = client.getUser({ id: '123' }); // Uses cached result
2923
2923
  // Request cancellation
2924
2924
  const controller = new AbortController();
2925
2925
  const promise = client.getUsers({ page: 1, signal: controller.signal });
2926
- controller.abort(); // Cancels the request`})]})]}),xt("div",{className:"flex items-center gap-4 pt-4",children:[xt(zn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation Guide ",ge(Fp,{size:16})]}),ge(zn,{href:"/docs/intent/contract-first-api",className:"btn-ghost",children:"Contract-first API"})]})]})}import{openapiAlternativeBrief as mi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Qp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Gn}from"@contractspec/lib.design-system";import Hn from"@contractspec/lib.ui-link";import{ChevronRight as Yp}from"lucide-react";import{jsx as te,jsxs as jt}from"react/jsx-runtime";var U2=new Qp().optimize(mi);function Jp(){return jt("div",{className:"space-y-8",children:[jt("div",{className:"space-y-3",children:[te("h1",{className:"font-bold text-4xl",children:mi.title}),te("p",{className:"text-lg text-muted-foreground",children:mi.summary})]}),jt("div",{className:"card-subtle space-y-4 p-6",children:[te("h2",{className:"font-bold text-2xl",children:"OpenAPI Limitations"}),te("ul",{className:"space-y-2 text-muted-foreground text-sm",children:mi.problems.map((e,t)=>te("li",{children:e},t))})]}),jt("div",{className:"card-subtle space-y-4 p-6",children:[te("h2",{className:"font-bold text-2xl",children:"ContractSpec Advantages"}),te("ul",{className:"space-y-2 text-muted-foreground text-sm",children:mi.solutions.map((e,t)=>te("li",{children:e},t))})]}),jt("div",{className:"space-y-6",children:[jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Comparison: OpenAPI vs ContractSpec"}),te("p",{className:"text-muted-foreground text-sm",children:"Key differences between OpenAPI documentation and ContractSpec executable contracts."}),jt("div",{className:"grid gap-6 md:grid-cols-2",children:[jt("div",{className:"card-subtle space-y-3 p-4",children:[te("h3",{className:"font-semibold text-lg",children:"OpenAPI"}),jt("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[te("li",{children:"• Documentation specification only"}),te("li",{children:"• No runtime validation"}),te("li",{children:"• Manual code generation"}),te("li",{children:"• Type safety requires tools"}),te("li",{children:"• Separate schemas from documentation"})]})]}),jt("div",{className:"card-subtle space-y-3 p-4",children:[te("h3",{className:"font-semibold text-lg",children:"ContractSpec"}),jt("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[te("li",{children:"• Executable contracts"}),te("li",{children:"• Built-in runtime validation"}),te("li",{children:"• Automatic code generation"}),te("li",{children:"• Type-safe by default"}),te("li",{children:"• Unified spec and implementation"})]})]})]})]}),jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Export from Contracts"}),te("p",{className:"text-muted-foreground text-sm",children:"Generate OpenAPI documentation from ContractSpec for existing tooling."}),te(Gn,{language:"bash",filename:"export-openapi",code:`# From ContractSpec contracts
2926
+ controller.abort(); // Cancels the request`})]})]}),xt("div",{className:"flex items-center gap-4 pt-4",children:[xt(zn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation Guide ",ge(Fp,{size:16})]}),ge(zn,{href:"/docs/intent/contract-first-api",className:"btn-ghost",children:"Contract-first API"})]})]})}import{openapiAlternativeBrief as mi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Qp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Gn}from"@contractspec/lib.design-system";import qn from"@contractspec/lib.ui-link";import{ChevronRight as Yp}from"lucide-react";import{jsx as te,jsxs as jt}from"react/jsx-runtime";var U2=new Qp().optimize(mi);function Jp(){return jt("div",{className:"space-y-8",children:[jt("div",{className:"space-y-3",children:[te("h1",{className:"font-bold text-4xl",children:mi.title}),te("p",{className:"text-lg text-muted-foreground",children:mi.summary})]}),jt("div",{className:"card-subtle space-y-4 p-6",children:[te("h2",{className:"font-bold text-2xl",children:"OpenAPI Limitations"}),te("ul",{className:"space-y-2 text-muted-foreground text-sm",children:mi.problems.map((e,t)=>te("li",{children:e},t))})]}),jt("div",{className:"card-subtle space-y-4 p-6",children:[te("h2",{className:"font-bold text-2xl",children:"ContractSpec Advantages"}),te("ul",{className:"space-y-2 text-muted-foreground text-sm",children:mi.solutions.map((e,t)=>te("li",{children:e},t))})]}),jt("div",{className:"space-y-6",children:[jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Comparison: OpenAPI vs ContractSpec"}),te("p",{className:"text-muted-foreground text-sm",children:"Key differences between OpenAPI documentation and ContractSpec executable contracts."}),jt("div",{className:"grid gap-6 md:grid-cols-2",children:[jt("div",{className:"card-subtle space-y-3 p-4",children:[te("h3",{className:"font-semibold text-lg",children:"OpenAPI"}),jt("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[te("li",{children:"• Documentation specification only"}),te("li",{children:"• No runtime validation"}),te("li",{children:"• Manual code generation"}),te("li",{children:"• Type safety requires tools"}),te("li",{children:"• Separate schemas from documentation"})]})]}),jt("div",{className:"card-subtle space-y-3 p-4",children:[te("h3",{className:"font-semibold text-lg",children:"ContractSpec"}),jt("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[te("li",{children:"• Executable contracts"}),te("li",{children:"• Built-in runtime validation"}),te("li",{children:"• Automatic code generation"}),te("li",{children:"• Type-safe by default"}),te("li",{children:"• Unified spec and implementation"})]})]})]})]}),jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Export from Contracts"}),te("p",{className:"text-muted-foreground text-sm",children:"Generate OpenAPI documentation from ContractSpec for existing tooling."}),te(Gn,{language:"bash",filename:"export-openapi",code:`# From ContractSpec contracts
2927
2927
  contractspec openapi export \\
2928
2928
  --registry ./src/contracts/registry.ts \\
2929
2929
  --format yaml \\
@@ -2961,7 +2961,7 @@ export const outputs = {
2961
2961
 
2962
2962
  // Type definitions
2963
2963
  types: UserApiContract.toTypescript(),
2964
- };`})]})]}),jt("div",{className:"flex items-center gap-4 pt-4",children:[jt(Hn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Generate from Contracts ",te(Yp,{size:16})]}),te(Hn,{href:"/docs/intent/generate-client-from-schema",className:"btn-ghost",children:"Client Generation"})]})]})}import{schemaValidationTypescriptBrief as ui}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Zp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as lr}from"@contractspec/lib.design-system";import qn from"@contractspec/lib.ui-link";import{ChevronRight as $p}from"lucide-react";import{jsx as st,jsxs as ja}from"react/jsx-runtime";var F2=new Zp().optimize(ui);function Xp(){return ja("div",{className:"space-y-8",children:[ja("div",{className:"space-y-3",children:[st("h1",{className:"font-bold text-4xl",children:ui.title}),st("p",{className:"text-lg text-muted-foreground",children:ui.summary})]}),ja("div",{className:"card-subtle space-y-4 p-6",children:[st("h2",{className:"font-bold text-2xl",children:"Validation Pain Points"}),st("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ui.problems.map((e,t)=>st("li",{children:e},t))})]}),ja("div",{className:"card-subtle space-y-4 p-6",children:[st("h2",{className:"font-bold text-2xl",children:"Type-safe Solutions"}),st("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ui.solutions.map((e,t)=>st("li",{children:e},t))})]}),ja("div",{className:"space-y-6",children:[ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Contract Schema"}),st("p",{className:"text-muted-foreground text-sm",children:"Define data models with automatic TypeScript generation."}),st(lr,{language:"typescript",filename:"src/contracts/user.schema.ts",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2964
+ };`})]})]}),jt("div",{className:"flex items-center gap-4 pt-4",children:[jt(qn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Generate from Contracts ",te(Yp,{size:16})]}),te(qn,{href:"/docs/intent/generate-client-from-schema",className:"btn-ghost",children:"Client Generation"})]})]})}import{schemaValidationTypescriptBrief as ui}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as Zp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as lr}from"@contractspec/lib.design-system";import Vn from"@contractspec/lib.ui-link";import{ChevronRight as Xp}from"lucide-react";import{jsx as st,jsxs as ja}from"react/jsx-runtime";var F2=new Zp().optimize(ui);function $p(){return ja("div",{className:"space-y-8",children:[ja("div",{className:"space-y-3",children:[st("h1",{className:"font-bold text-4xl",children:ui.title}),st("p",{className:"text-lg text-muted-foreground",children:ui.summary})]}),ja("div",{className:"card-subtle space-y-4 p-6",children:[st("h2",{className:"font-bold text-2xl",children:"Validation Pain Points"}),st("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ui.problems.map((e,t)=>st("li",{children:e},t))})]}),ja("div",{className:"card-subtle space-y-4 p-6",children:[st("h2",{className:"font-bold text-2xl",children:"Type-safe Solutions"}),st("ul",{className:"space-y-2 text-muted-foreground text-sm",children:ui.solutions.map((e,t)=>st("li",{children:e},t))})]}),ja("div",{className:"space-y-6",children:[ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Contract Schema"}),st("p",{className:"text-muted-foreground text-sm",children:"Define data models with automatic TypeScript generation."}),st(lr,{language:"typescript",filename:"src/contracts/user.schema.ts",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2965
2965
 
2966
2966
  export const UserSchema = new SchemaModel({
2967
2967
  type: 'object',
@@ -3056,7 +3056,7 @@ export async function createUserHandler(request: Request) {
3056
3056
 
3057
3057
  throw error;
3058
3058
  }
3059
- }`})]})]}),ja("div",{className:"flex items-center gap-4 pt-4",children:[ja(qn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",st($p,{size:16})]}),st(qn,{href:"/docs/intent/generate-client-from-schema",className:"btn-ghost",children:"Client Generation"})]})]})}import{specDrivenDevelopmentBrief as gi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as xp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Vn}from"@contractspec/lib.design-system";import Fn from"@contractspec/lib.ui-link";import{ChevronRight as jp}from"lucide-react";import{jsx as Wt,jsxs as mo}from"react/jsx-runtime";var x2=new xp().optimize(gi);function em(){return mo("div",{className:"space-y-8",children:[mo("div",{className:"space-y-3",children:[Wt("h1",{className:"font-bold text-4xl",children:gi.title}),Wt("p",{className:"text-lg text-muted-foreground",children:gi.summary})]}),mo("div",{className:"card-subtle space-y-4 p-6",children:[Wt("h2",{className:"font-bold text-2xl",children:"Why Spec-driven?"}),Wt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:gi.problems.map((e,t)=>Wt("li",{children:e},t))})]}),mo("div",{className:"card-subtle space-y-4 p-6",children:[Wt("h2",{className:"font-bold text-2xl",children:"Benefits"}),Wt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:gi.solutions.map((e,t)=>Wt("li",{children:e},t))})]}),mo("div",{className:"space-y-6",children:[mo("div",{className:"space-y-3",children:[Wt("h2",{className:"font-bold text-2xl",children:"Feature Specification Example"}),Wt("p",{className:"text-muted-foreground text-sm",children:"Define a complete feature with operations, events, and data models."}),Wt(Vn,{language:"typescript",filename:"src/contracts/user-management.feature.ts",code:`import { defineFeature } from '@contractspec/lib.contracts-spec/features';
3059
+ }`})]})]}),ja("div",{className:"flex items-center gap-4 pt-4",children:[ja(Vn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",st(Xp,{size:16})]}),st(Vn,{href:"/docs/intent/generate-client-from-schema",className:"btn-ghost",children:"Client Generation"})]})]})}import{specDrivenDevelopmentBrief as gi}from"@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";import{SeoOptimizer as xp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Hn}from"@contractspec/lib.design-system";import Fn from"@contractspec/lib.ui-link";import{ChevronRight as jp}from"lucide-react";import{jsx as Wt,jsxs as mo}from"react/jsx-runtime";var x2=new xp().optimize(gi);function em(){return mo("div",{className:"space-y-8",children:[mo("div",{className:"space-y-3",children:[Wt("h1",{className:"font-bold text-4xl",children:gi.title}),Wt("p",{className:"text-lg text-muted-foreground",children:gi.summary})]}),mo("div",{className:"card-subtle space-y-4 p-6",children:[Wt("h2",{className:"font-bold text-2xl",children:"Why Spec-driven?"}),Wt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:gi.problems.map((e,t)=>Wt("li",{children:e},t))})]}),mo("div",{className:"card-subtle space-y-4 p-6",children:[Wt("h2",{className:"font-bold text-2xl",children:"Benefits"}),Wt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:gi.solutions.map((e,t)=>Wt("li",{children:e},t))})]}),mo("div",{className:"space-y-6",children:[mo("div",{className:"space-y-3",children:[Wt("h2",{className:"font-bold text-2xl",children:"Feature Specification Example"}),Wt("p",{className:"text-muted-foreground text-sm",children:"Define a complete feature with operations, events, and data models."}),Wt(Hn,{language:"typescript",filename:"src/contracts/user-management.feature.ts",code:`import { defineFeature } from '@contractspec/lib.contracts-spec/features';
3060
3060
  import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
3061
3061
  import { defineEvent } from '@contractspec/lib.contracts-spec/events';
3062
3062
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
@@ -3128,7 +3128,7 @@ export const UserManagementFeature = defineFeature({
3128
3128
  version: '1.0.0',
3129
3129
  description: 'Complete user management with operations and events',
3130
3130
  },
3131
- });`})]}),mo("div",{className:"space-y-3",children:[Wt("h2",{className:"font-bold text-2xl",children:"Generate Type-safe Implementations"}),Wt("p",{className:"text-muted-foreground text-sm",children:"Generate validation, types, and API handlers from your feature."}),Wt(Vn,{language:"bash",filename:"generate-from-feature",code:"contractspec generate \\\n --input ./src/contracts/user-management.feature.ts \\\n --output ./generated/user-management"})]})]}),mo("div",{className:"flex items-center gap-4 pt-4",children:[mo(Fn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",Wt(jp,{size:16})]}),Wt(Fn,{href:"/docs/intent/deterministic-codegen",className:"btn-ghost",children:"Deterministic Codegen"})]})]})}import Kn from"@contractspec/lib.ui-link";import{ChevronRight as tm}from"lucide-react";import{jsx as a,jsxs as c}from"react/jsx-runtime";function am(){return c("div",{className:"space-y-8",children:[c("div",{className:"space-y-4",children:[a("h1",{className:"font-bold text-4xl",children:"Knowledge Categories"}),a("p",{className:"text-muted-foreground",children:"ContractSpec classifies knowledge into four categories based on trust level, source authority, and intended use. This classification determines how knowledge can be used in workflows, policy decisions, and agent responses."})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"The four categories"}),a("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:a("pre",{children:`type KnowledgeCategory =
3131
+ });`})]}),mo("div",{className:"space-y-3",children:[Wt("h2",{className:"font-bold text-2xl",children:"Generate Type-safe Implementations"}),Wt("p",{className:"text-muted-foreground text-sm",children:"Generate validation, types, and API handlers from your feature."}),Wt(Hn,{language:"bash",filename:"generate-from-feature",code:"contractspec generate \\\n --input ./src/contracts/user-management.feature.ts \\\n --output ./generated/user-management"})]})]}),mo("div",{className:"flex items-center gap-4 pt-4",children:[mo(Fn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",Wt(jp,{size:16})]}),Wt(Fn,{href:"/docs/intent/deterministic-codegen",className:"btn-ghost",children:"Deterministic Codegen"})]})]})}import Kn from"@contractspec/lib.ui-link";import{ChevronRight as tm}from"lucide-react";import{jsx as a,jsxs as c}from"react/jsx-runtime";function am(){return c("div",{className:"space-y-8",children:[c("div",{className:"space-y-4",children:[a("h1",{className:"font-bold text-4xl",children:"Knowledge Categories"}),a("p",{className:"text-muted-foreground",children:"ContractSpec classifies knowledge into four categories based on trust level, source authority, and intended use. This classification determines how knowledge can be used in workflows, policy decisions, and agent responses."})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"The four categories"}),a("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:a("pre",{children:`type KnowledgeCategory =
3132
3132
  | "canonical" // Internal ground truth
3133
3133
  | "operational" // Internal operational docs
3134
3134
  | "external" // Third-party reference
@@ -3380,7 +3380,7 @@ steps:
3380
3380
  Question: \${input.question}
3381
3381
  Internal: \${steps.search-internal-guides.output.results}
3382
3382
  Stripe: \${steps.search-stripe-docs.output.results}
3383
- Past: \${steps.search-past-questions.output.results}`})})]})]}),It("div",{className:"space-y-4",children:[Ge("h2",{className:"font-bold text-2xl",children:"Key patterns"}),It("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[It("li",{children:[Ge("strong",{children:"Canonical first"})," - Always search canonical spaces before operational or external"]}),It("li",{children:[Ge("strong",{children:"Category-aware prompts"})," - Tell the LLM which sources are authoritative vs reference"]}),It("li",{children:[Ge("strong",{children:"Multi-space queries"})," - Combine results from multiple spaces for richer context"]}),It("li",{children:[Ge("strong",{children:"Limit results"})," - Use appropriate limits (3-5) to avoid token overflow"]}),It("li",{children:[Ge("strong",{children:"Audit everything"})," - Log all knowledge queries for debugging and compliance"]})]})]}),It("div",{className:"flex items-center gap-4 pt-4",children:[Ge(Qn,{href:"/docs/knowledge/sources",className:"btn-ghost",children:"Previous: Sources"}),Ge(Qn,{href:"/docs/architecture/knowledge-binding",className:"btn-ghost",children:"Knowledge Binding"})]})]})}import im from"@contractspec/lib.ui-link";import{jsx as ha,jsxs as Ao}from"react/jsx-runtime";var rm=[{title:"Categories",body:"Separate canonical truth from operational notes, external material, and ephemeral working context.",href:"/docs/knowledge/categories"},{title:"Spaces",body:"Define the storage and retrieval boundary for each knowledge domain.",href:"/docs/knowledge/spaces"},{title:"Sources",body:"Connect tenant-owned sources explicitly instead of letting context leak in through prompts alone.",href:"/docs/knowledge/sources"},{title:"Examples",body:"See how support, compliance, and product systems consume trusted knowledge at runtime.",href:"/docs/knowledge/examples"}];function nm(){return Ao("div",{className:"space-y-10",children:[Ao("div",{className:"space-y-3",children:[ha("p",{className:"editorial-kicker",children:"Operate"}),ha("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Knowledge is part of the runtime, not a sidecar prompt hack."}),ha("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"When AI-native systems depend on external context, the context needs the same discipline as the rest of the stack. ContractSpec treats knowledge as typed, bounded, and governable so teams can reason about trust, isolation, and retrieval behavior."})]}),ha("section",{className:"editorial-panel space-y-5",children:Ao("div",{className:"space-y-2",children:[ha("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"How knowledge enters the system"}),Ao("ul",{className:"editorial-list",children:[Ao("li",{children:[ha("span",{className:"editorial-list-marker"}),ha("span",{children:"Define the trust category and retrieval expectations first."})]}),Ao("li",{children:[ha("span",{className:"editorial-list-marker"}),ha("span",{children:"Bind tenant-owned sources explicitly to those knowledge spaces."})]}),Ao("li",{children:[ha("span",{className:"editorial-list-marker"}),ha("span",{children:"Consume knowledge through capabilities and workflows, not through invisible prompt assumptions."})]})]})]})}),ha("div",{className:"grid gap-4 md:grid-cols-2",children:rm.map((e)=>Ao(im,{href:e.href,className:"editorial-panel",children:[ha("h2",{className:"font-semibold text-xl",children:e.title}),ha("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.href))})]})}import Yn from"@contractspec/lib.ui-link";import{ChevronRight as cm}from"lucide-react";import{jsx as s,jsxs as x}from"react/jsx-runtime";function lm(){return x("div",{className:"space-y-8",children:[x("div",{className:"space-y-4",children:[s("h1",{className:"font-bold text-4xl",children:"Knowledge Sources"}),x("p",{className:"text-muted-foreground",children:["A ",s("strong",{children:"KnowledgeSourceConfig"})," connects a tenant's data sources (Notion, Gmail, uploads, databases) to knowledge spaces. Each source is synced, chunked, embedded, and indexed according to the space's configuration."]})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"KnowledgeSourceConfig"}),s("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:s("pre",{children:`type KnowledgeSourceConfig = {
3383
+ Past: \${steps.search-past-questions.output.results}`})})]})]}),It("div",{className:"space-y-4",children:[Ge("h2",{className:"font-bold text-2xl",children:"Key patterns"}),It("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[It("li",{children:[Ge("strong",{children:"Canonical first"})," - Always search canonical spaces before operational or external"]}),It("li",{children:[Ge("strong",{children:"Category-aware prompts"})," - Tell the LLM which sources are authoritative vs reference"]}),It("li",{children:[Ge("strong",{children:"Multi-space queries"})," - Combine results from multiple spaces for richer context"]}),It("li",{children:[Ge("strong",{children:"Limit results"})," - Use appropriate limits (3-5) to avoid token overflow"]}),It("li",{children:[Ge("strong",{children:"Audit everything"})," - Log all knowledge queries for debugging and compliance"]})]})]}),It("div",{className:"flex items-center gap-4 pt-4",children:[Ge(Qn,{href:"/docs/knowledge/sources",className:"btn-ghost",children:"Previous: Sources"}),Ge(Qn,{href:"/docs/architecture/knowledge-binding",className:"btn-ghost",children:"Knowledge Binding"})]})]})}import im from"@contractspec/lib.ui-link";import{jsx as fa,jsxs as Ao}from"react/jsx-runtime";var rm=[{title:"Categories",body:"Separate canonical truth from operational notes, external material, and ephemeral working context.",href:"/docs/knowledge/categories"},{title:"Spaces",body:"Define the storage and retrieval boundary for each knowledge domain.",href:"/docs/knowledge/spaces"},{title:"Sources",body:"Connect tenant-owned sources explicitly instead of letting context leak in through prompts alone.",href:"/docs/knowledge/sources"},{title:"Examples",body:"See how support, compliance, and product systems consume trusted knowledge at runtime.",href:"/docs/knowledge/examples"}];function nm(){return Ao("div",{className:"space-y-10",children:[Ao("div",{className:"space-y-3",children:[fa("p",{className:"editorial-kicker",children:"Operate"}),fa("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Knowledge is part of the runtime, not a sidecar prompt hack."}),fa("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"When AI-native systems depend on external context, the context needs the same discipline as the rest of the stack. ContractSpec treats knowledge as typed, bounded, and governable so teams can reason about trust, isolation, and retrieval behavior."})]}),fa("section",{className:"editorial-panel space-y-5",children:Ao("div",{className:"space-y-2",children:[fa("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"How knowledge enters the system"}),Ao("ul",{className:"editorial-list",children:[Ao("li",{children:[fa("span",{className:"editorial-list-marker"}),fa("span",{children:"Define the trust category and retrieval expectations first."})]}),Ao("li",{children:[fa("span",{className:"editorial-list-marker"}),fa("span",{children:"Bind tenant-owned sources explicitly to those knowledge spaces."})]}),Ao("li",{children:[fa("span",{className:"editorial-list-marker"}),fa("span",{children:"Consume knowledge through capabilities and workflows, not through invisible prompt assumptions."})]})]})]})}),fa("div",{className:"grid gap-4 md:grid-cols-2",children:rm.map((e)=>Ao(im,{href:e.href,className:"editorial-panel",children:[fa("h2",{className:"font-semibold text-xl",children:e.title}),fa("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.href))})]})}import Yn from"@contractspec/lib.ui-link";import{ChevronRight as cm}from"lucide-react";import{jsx as s,jsxs as x}from"react/jsx-runtime";function lm(){return x("div",{className:"space-y-8",children:[x("div",{className:"space-y-4",children:[s("h1",{className:"font-bold text-4xl",children:"Knowledge Sources"}),x("p",{className:"text-muted-foreground",children:["A ",s("strong",{children:"KnowledgeSourceConfig"})," connects a tenant's data sources (Notion, Gmail, uploads, databases) to knowledge spaces. Each source is synced, chunked, embedded, and indexed according to the space's configuration."]})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"KnowledgeSourceConfig"}),s("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:s("pre",{children:`type KnowledgeSourceConfig = {
3384
3384
  id: string;
3385
3385
  tenantId: string;
3386
3386
  spaceId: string;
@@ -3514,7 +3514,7 @@ steps:
3514
3514
  indexProvider: "qdrant",
3515
3515
  vectorDimensions: 1536,
3516
3516
  retentionPolicy: { days: 1 }
3517
- }`})}),ye("p",{className:"mt-2 text-muted-foreground text-sm",children:[S("strong",{children:"Use cases:"})," Conversation continuity, intermediate calculations, session state"]})]})]})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Storage strategies"}),S("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:ye("table",{className:"w-full text-left text-sm",children:[S("thead",{className:"bg-card/50",children:ye("tr",{className:"border-border/50 border-b",children:[S("th",{className:"px-4 py-3 font-semibold",children:"Strategy"}),S("th",{className:"px-4 py-3 font-semibold",children:"Best For"}),S("th",{className:"px-4 py-3 font-semibold",children:"Providers"})]})}),ye("tbody",{className:"divide-y divide-border/50",children:[ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"vector"}),S("td",{className:"px-4 py-3",children:"Semantic search, RAG, similarity matching"}),S("td",{className:"px-4 py-3",children:"Qdrant, Pinecone, Weaviate"})]}),ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"search"}),S("td",{className:"px-4 py-3",children:"Keyword search, exact matching, filtering"}),S("td",{className:"px-4 py-3",children:"Elasticsearch, Algolia"})]}),ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"hybrid"}),S("td",{className:"px-4 py-3",children:"Combined semantic + keyword search"}),S("td",{className:"px-4 py-3",children:"Qdrant + Elasticsearch"})]})]})]})})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Best practices"}),ye("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[S("li",{children:"Choose storage strategy based on query patterns - use vector for semantic, search for exact"}),S("li",{children:"Set appropriate retention policies - canonical is permanent, ephemeral is short-lived"}),S("li",{children:"Use consistent vector dimensions across spaces that will be queried together"}),S("li",{children:"Document the intended audience and use cases for each space"}),S("li",{children:"Monitor space size and query performance - add sharding if needed"})]})]}),ye("div",{className:"flex items-center gap-4 pt-4",children:[S(Jn,{href:"/docs/knowledge/categories",className:"btn-ghost",children:"Previous: Categories"}),ye(Jn,{href:"/docs/knowledge/sources",className:"btn-primary",children:["Knowledge Sources ",S(sm,{size:16})]})]})]})}import{CodeBlock as Zn,InstallCommand as pm}from"@contractspec/lib.design-system";import $n from"@contractspec/lib.ui-link";import{ChevronRight as mm}from"lucide-react";import{jsx as Ce,jsxs as ft}from"react/jsx-runtime";function um(){return ft("div",{className:"space-y-8",children:[ft("div",{className:"space-y-4",children:[Ce("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.accessibility"}),Ce("p",{className:"text-muted-foreground",children:"Stable exports of accessibility primitives for LSSM web apps, ensuring WCAG compliance and inclusive design."})]}),ft("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Installation"}),Ce(pm,{package:"@contractspec/lib.accessibility"})]}),ft("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Exports"}),ft("ul",{className:"space-y-2 text-muted-foreground",children:[ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"SkipLink"}),": A link to skip navigation, visible on focus"]}),ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"VisuallyHidden"}),": Hide content visually but keep it for screen readers"]}),ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"SRLiveRegionProvider"}),","," ",Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"useSRLiveRegion"}),": Manage live region announcements"]}),ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"RouteAnnouncer"}),": Announce page title/path changes on navigation"]}),ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"FocusOnRouteChange"}),": Reset focus to body or main content on navigation"]}),ft("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"useReducedMotion"}),": Detect if the user prefers reduced motion"]})]})]}),ft("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Example: App Setup"}),Ce(Zn,{language:"tsx",code:`import {
3517
+ }`})}),ye("p",{className:"mt-2 text-muted-foreground text-sm",children:[S("strong",{children:"Use cases:"})," Conversation continuity, intermediate calculations, session state"]})]})]})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Storage strategies"}),S("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:ye("table",{className:"w-full text-left text-sm",children:[S("thead",{className:"bg-card/50",children:ye("tr",{className:"border-border/50 border-b",children:[S("th",{className:"px-4 py-3 font-semibold",children:"Strategy"}),S("th",{className:"px-4 py-3 font-semibold",children:"Best For"}),S("th",{className:"px-4 py-3 font-semibold",children:"Providers"})]})}),ye("tbody",{className:"divide-y divide-border/50",children:[ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"vector"}),S("td",{className:"px-4 py-3",children:"Semantic search, RAG, similarity matching"}),S("td",{className:"px-4 py-3",children:"Qdrant, Pinecone, Weaviate"})]}),ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"search"}),S("td",{className:"px-4 py-3",children:"Keyword search, exact matching, filtering"}),S("td",{className:"px-4 py-3",children:"Elasticsearch, Algolia"})]}),ye("tr",{children:[S("td",{className:"px-4 py-3 font-mono text-xs",children:"hybrid"}),S("td",{className:"px-4 py-3",children:"Combined semantic + keyword search"}),S("td",{className:"px-4 py-3",children:"Qdrant + Elasticsearch"})]})]})]})})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"Best practices"}),ye("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[S("li",{children:"Choose storage strategy based on query patterns - use vector for semantic, search for exact"}),S("li",{children:"Set appropriate retention policies - canonical is permanent, ephemeral is short-lived"}),S("li",{children:"Use consistent vector dimensions across spaces that will be queried together"}),S("li",{children:"Document the intended audience and use cases for each space"}),S("li",{children:"Monitor space size and query performance - add sharding if needed"})]})]}),ye("div",{className:"flex items-center gap-4 pt-4",children:[S(Jn,{href:"/docs/knowledge/categories",className:"btn-ghost",children:"Previous: Categories"}),ye(Jn,{href:"/docs/knowledge/sources",className:"btn-primary",children:["Knowledge Sources ",S(sm,{size:16})]})]})]})}import{CodeBlock as Zn,InstallCommand as pm}from"@contractspec/lib.design-system";import Xn from"@contractspec/lib.ui-link";import{ChevronRight as mm}from"lucide-react";import{jsx as Ce,jsxs as ht}from"react/jsx-runtime";function um(){return ht("div",{className:"space-y-8",children:[ht("div",{className:"space-y-4",children:[Ce("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.accessibility"}),Ce("p",{className:"text-muted-foreground",children:"Stable exports of accessibility primitives for LSSM web apps, ensuring WCAG compliance and inclusive design."})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Installation"}),Ce(pm,{package:"@contractspec/lib.accessibility"})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Exports"}),ht("ul",{className:"space-y-2 text-muted-foreground",children:[ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"SkipLink"}),": A link to skip navigation, visible on focus"]}),ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"VisuallyHidden"}),": Hide content visually but keep it for screen readers"]}),ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"SRLiveRegionProvider"}),","," ",Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"useSRLiveRegion"}),": Manage live region announcements"]}),ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"RouteAnnouncer"}),": Announce page title/path changes on navigation"]}),ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"FocusOnRouteChange"}),": Reset focus to body or main content on navigation"]}),ht("li",{children:[Ce("code",{className:"rounded bg-background/50 px-2 py-1",children:"useReducedMotion"}),": Detect if the user prefers reduced motion"]})]})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Example: App Setup"}),Ce(Zn,{language:"tsx",code:`import {
3518
3518
  SRLiveRegionProvider,
3519
3519
  RouteAnnouncer,
3520
3520
  SkipLink
@@ -3534,7 +3534,7 @@ export function RootLayout({ children }) {
3534
3534
  </body>
3535
3535
  </html>
3536
3536
  );
3537
- }`})]}),ft("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Example: Live Announcements"}),Ce(Zn,{language:"tsx",code:`import { useSRLiveRegion } from '@contractspec/lib.accessibility';
3537
+ }`})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Example: Live Announcements"}),Ce(Zn,{language:"tsx",code:`import { useSRLiveRegion } from '@contractspec/lib.accessibility';
3538
3538
 
3539
3539
  export function TodoList() {
3540
3540
  const { announce } = useSRLiveRegion();
@@ -3545,7 +3545,7 @@ export function TodoList() {
3545
3545
  };
3546
3546
 
3547
3547
  return <button onClick={addTodo}>Add Todo</button>;
3548
- }`})]}),ft("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"WCAG Compliance"}),ft("p",{className:"text-muted-foreground",children:["These components map directly to WCAG 2.1 Level AA requirements documented in ",Ce("code",{children:"docs/accessibility_wcag_compliance_specs.md"}),":"]}),ft("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ce("li",{children:"2.4.1 Bypass Blocks (SkipLink)"}),Ce("li",{children:"4.1.3 Status Messages (LiveRegion)"}),Ce("li",{children:"2.4.3 Focus Order (FocusOnRouteChange)"}),Ce("li",{children:"2.3.3 Animation from Interactions (useReducedMotion)"})]})]}),ft("div",{className:"flex items-center gap-4 pt-4",children:[Ce($n,{href:"/docs/libraries/design-system",className:"btn-ghost",children:"Previous: Design System"}),ft($n,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ce(mm,{size:16})]})]})]})}import{CodeBlock as Xn,InstallCommand as gm}from"@contractspec/lib.design-system";import xn from"@contractspec/lib.ui-link";import{ChevronRight as fm}from"lucide-react";import{jsx as ht,jsxs as Oa}from"react/jsx-runtime";function hm(){return Oa("div",{className:"space-y-8",children:[Oa("div",{className:"space-y-4",children:[ht("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ai-agent"}),ht("p",{className:"text-lg text-muted-foreground",children:"Define AI agents in TypeScript, run them with deterministic tool calling, capture working memory, and route low-confidence decisions to human reviewers."})]}),Oa("div",{className:"space-y-4",children:[ht("h2",{className:"font-bold text-2xl",children:"Installation"}),ht(gm,{package:"@contractspec/lib.ai-agent"})]}),Oa("div",{className:"space-y-3",children:[ht("h2",{className:"font-bold text-2xl",children:"Define & register"}),ht(Xn,{language:"typescript",code:`import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
3548
+ }`})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"WCAG Compliance"}),ht("p",{className:"text-muted-foreground",children:["These components map directly to WCAG 2.1 Level AA requirements documented in ",Ce("code",{children:"docs/accessibility_wcag_compliance_specs.md"}),":"]}),ht("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Ce("li",{children:"2.4.1 Bypass Blocks (SkipLink)"}),Ce("li",{children:"4.1.3 Status Messages (LiveRegion)"}),Ce("li",{children:"2.4.3 Focus Order (FocusOnRouteChange)"}),Ce("li",{children:"2.3.3 Animation from Interactions (useReducedMotion)"})]})]}),ht("div",{className:"flex items-center gap-4 pt-4",children:[Ce(Xn,{href:"/docs/libraries/design-system",className:"btn-ghost",children:"Previous: Design System"}),ht(Xn,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ce(mm,{size:16})]})]})]})}import{CodeBlock as $n,InstallCommand as gm}from"@contractspec/lib.design-system";import xn from"@contractspec/lib.ui-link";import{ChevronRight as hm}from"lucide-react";import{jsx as ft,jsxs as Oa}from"react/jsx-runtime";function fm(){return Oa("div",{className:"space-y-8",children:[Oa("div",{className:"space-y-4",children:[ft("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ai-agent"}),ft("p",{className:"text-lg text-muted-foreground",children:"Define AI agents in TypeScript, run them with deterministic tool calling, capture working memory, and route low-confidence decisions to human reviewers."})]}),Oa("div",{className:"space-y-4",children:[ft("h2",{className:"font-bold text-2xl",children:"Installation"}),ft(gm,{package:"@contractspec/lib.ai-agent"})]}),Oa("div",{className:"space-y-3",children:[ft("h2",{className:"font-bold text-2xl",children:"Define & register"}),ft($n,{language:"typescript",code:`import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
3549
3549
 
3550
3550
  const SupportBot = defineAgent({
3551
3551
  meta: {
@@ -3564,7 +3564,7 @@ const SupportBot = defineAgent({
3564
3564
  },
3565
3565
  });
3566
3566
 
3567
- const registry = new AgentRegistry().register(SupportBot);`})]}),Oa("div",{className:"space-y-3",children:[ht("h2",{className:"font-bold text-2xl",children:"Run with approvals"}),ht(Xn,{language:"typescript",code:`import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
3567
+ const registry = new AgentRegistry().register(SupportBot);`})]}),Oa("div",{className:"space-y-3",children:[ft("h2",{className:"font-bold text-2xl",children:"Run with approvals"}),ft($n,{language:"typescript",code:`import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
3568
3568
 
3569
3569
  const approvals = new ApprovalWorkflow();
3570
3570
  const agent = createUnifiedAgent(SupportBot, {
@@ -3574,7 +3574,7 @@ const agent = createUnifiedAgent(SupportBot, {
3574
3574
 
3575
3575
  const result = await agent.run(ticket.body);
3576
3576
  // Route low-confidence or manual-review flows through approvals when needed.
3577
- `})]}),Oa("div",{className:"space-y-3",children:[ht("h2",{className:"font-bold text-2xl",children:"What's inside"}),Oa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Oa("li",{children:[ht("code",{children:"createUnifiedAgent"}),", ",ht("code",{children:"ContractSpecAgent"}),","," ",ht("code",{children:"UnifiedAgent"})]}),ht("li",{children:"MCP, operation-backed, memory, and subagent tool adapters"}),Oa("li",{children:[ht("code",{children:"InMemoryAgentMemory"})," plus interfaces for custom stores"]}),Oa("li",{children:[ht("code",{children:"ApprovalWorkflow"})," + ",ht("code",{children:"ApprovalStore"})," for human-in-the-loop reviews"]})]})]}),Oa("div",{className:"flex items-center gap-4 pt-4",children:[ht(xn,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oa(xn,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",ht(fm,{size:16})]})]})]})}import{CodeBlock as sr,InstallCommand as ym}from"@contractspec/lib.design-system";import{jsx as eo,jsxs as ti}from"react/jsx-runtime";function vm(){return ti("div",{className:"space-y-8",children:[ti("div",{className:"space-y-4",children:[eo("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.analytics"}),eo("p",{className:"text-lg text-muted-foreground",children:"Work directly with telemetry events to understand conversion, retention, churn, and growth opportunities."})]}),ti("div",{className:"space-y-4",children:[eo("h2",{className:"font-bold text-2xl",children:"Installation"}),eo(ym,{package:"@contractspec/lib.analytics"})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Funnels in memory"}),eo(sr,{language:"typescript",code:`import { FunnelAnalyzer } from '@contractspec/lib.analytics/funnel';
3577
+ `})]}),Oa("div",{className:"space-y-3",children:[ft("h2",{className:"font-bold text-2xl",children:"What's inside"}),Oa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Oa("li",{children:[ft("code",{children:"createUnifiedAgent"}),", ",ft("code",{children:"ContractSpecAgent"}),","," ",ft("code",{children:"UnifiedAgent"})]}),ft("li",{children:"MCP, operation-backed, memory, and subagent tool adapters"}),Oa("li",{children:[ft("code",{children:"InMemoryAgentMemory"})," plus interfaces for custom stores"]}),Oa("li",{children:[ft("code",{children:"ApprovalWorkflow"})," + ",ft("code",{children:"ApprovalStore"})," for human-in-the-loop reviews"]})]})]}),Oa("div",{className:"flex items-center gap-4 pt-4",children:[ft(xn,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oa(xn,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",ft(hm,{size:16})]})]})]})}import{CodeBlock as sr,InstallCommand as ym}from"@contractspec/lib.design-system";import{jsx as eo,jsxs as ti}from"react/jsx-runtime";function vm(){return ti("div",{className:"space-y-8",children:[ti("div",{className:"space-y-4",children:[eo("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.analytics"}),eo("p",{className:"text-lg text-muted-foreground",children:"Work directly with telemetry events to understand conversion, retention, churn, and growth opportunities."})]}),ti("div",{className:"space-y-4",children:[eo("h2",{className:"font-bold text-2xl",children:"Installation"}),eo(ym,{package:"@contractspec/lib.analytics"})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Funnels in memory"}),eo(sr,{language:"typescript",code:`import { FunnelAnalyzer } from '@contractspec/lib.analytics/funnel';
3578
3578
 
3579
3579
  const analyzer = new FunnelAnalyzer();
3580
3580
  const report = analyzer.analyze(events, {
@@ -3721,7 +3721,7 @@ export function AccountSummaryHeader() {
3721
3721
  // @contractspec/lib.ui-kit/ui/stack
3722
3722
  //
3723
3723
  // On web-only pages, VStack / HStack / Box also support:
3724
- // <VStack as="section">...</VStack>`,fc=`import { DataTable as DesignSystemTable } from '@contractspec/lib.design-system';
3724
+ // <VStack as="section">...</VStack>`,hc=`import { DataTable as DesignSystemTable } from '@contractspec/lib.design-system';
3725
3725
  import { DataTable as NativeTable } from '@contractspec/lib.ui-kit/ui/data-table';
3726
3726
  import { DataTable as WebTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
3727
3727
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
@@ -3757,7 +3757,7 @@ export function ProductAccounts({ controller }) {
3757
3757
  }
3758
3758
 
3759
3759
  // If the table is spec-driven instead of hand-authored,
3760
- // swap useContractTable for useDataViewTable.`,hc="# Cross-Surface Rendering Policy\n\n- Import runtime bundler helpers from `@contractspec/lib.presentation-runtime-core` root only.\n- Use `withPresentationTurbopackAliases` for default Next.js projects.\n- Use `withPresentationWebpackAliases` only when the app explicitly opts into webpack.\n- Use `withPresentationMetroAliases` for Expo and Metro builds.\n- Prefer `@contractspec/lib.design-system` for shared product-facing surfaces.\n- Use design-system controls when a field must respect ThemeSpec component variants or TranslationSpec messages.\n- Use `@contractspec/lib.ui-kit-web` only for web-specific primitive lanes.\n- Use `@contractspec/lib.ui-kit` only for native-specific primitive lanes.\n- Keep shared layout code inside the common `VStack` / `HStack` / `Box` subset.\n- Do not use removed `withPresentationNextAliases`.\n- Treat `.tsx` / `.mobile.tsx` pairs as the standard design-system compatibility boundary.",yc="# Cross-Surface Rendering Checklist\n\n1. Configure the bundler aliases before sharing any UI code.\n2. Choose the controller layer:\n - use `useContractTable` for app-owned rows and columns\n - use `useDataViewTable` for DataViewSpec-driven tables\n3. Choose the renderer lane:\n - web primitive: `@contractspec/lib.ui-kit-web`\n - native primitive: `@contractspec/lib.ui-kit`\n - shared product surface: `@contractspec/lib.design-system`\n4. Verify mirrored `.tsx` / `.mobile.tsx` implementations where the design-system owns the surface.\n5. Wrap product surfaces in `DesignSystemThemeProvider` and `DesignSystemTranslationProvider` when ThemeSpec or TranslationSpec data is available.\n6. In shared layout code, set `gap`, `align`, `justify`, and `wrap` explicitly.\n7. Check docs and examples for root imports and current helper names before copying them into product code.";import{CodeBlock as Lo}from"@contractspec/lib.design-system";import Ei from"@contractspec/lib.ui-link";import{ChevronRight as Em}from"lucide-react";import{jsx as f,jsxs as He}from"react/jsx-runtime";function Dm(){return He("div",{className:"space-y-8",children:[He("div",{className:"space-y-4",children:[f("h1",{className:"font-bold text-4xl",children:"Cross-platform UI"}),f("p",{className:"text-lg text-muted-foreground",children:"How ContractSpec keeps React and React Native components compatible by splitting responsibility across shared runtime models, platform primitives, resolver aliases, and the composed design-system layer."})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"What cross-platform means here"}),f("p",{className:"text-muted-foreground",children:"The shared rendering story is layered: the core package owns models and resolver helpers, the React packages own hook APIs, the UI kits own raw primitives, and the design-system owns the higher-level product surfaces that pair web and mobile implementations."}),f("div",{className:"grid gap-4 md:grid-cols-2",children:ac.map((e)=>He("div",{className:"rounded-[20px] border border-border/70 p-4",children:[f("h3",{className:"font-semibold text-base",children:e.title}),f("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),f("div",{className:"grid gap-4 md:grid-cols-3",children:oc.map((e)=>He("div",{className:"card-subtle p-4",children:[f("h3",{className:"font-semibold",children:e.title}),f("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),He("div",{className:"grid gap-4 lg:grid-cols-[1.1fr_0.9fr]",children:[f("div",{className:"grid gap-4 md:grid-cols-2",children:rc.map((e)=>He("div",{className:"card-subtle p-4",children:[f("h3",{className:"font-semibold",children:e.title}),f("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),f(Lo,{language:"typescript",filename:"design-system-platform.ts",code:uc})]})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Resolver and alias setup"}),He("p",{className:"text-muted-foreground",children:["Teach the bundler what “web” and “native” mean before you try to share component code. These helpers are public from the root",f("code",{children:" @contractspec/lib.presentation-runtime-core "}),"entrypoint."]}),f("div",{className:"grid gap-4 md:grid-cols-2",children:ic.map((e)=>He("div",{className:"card-subtle p-4",children:[f("h3",{className:"font-semibold",children:e.title}),f("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),He("div",{className:"grid gap-4 xl:grid-cols-3",children:[f(Lo,{language:"typescript",filename:"next.config.mjs",code:dc}),f(Lo,{language:"typescript",filename:"next.config.mjs",code:pc}),f(Lo,{language:"javascript",filename:"metro.config.js",code:mc})]})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"How the remapping works"}),f("p",{className:"text-muted-foreground",children:"The helpers are intentionally asymmetric because Turbopack patches the Next config object, Webpack mutates a resolver config, and Metro maps modules at request time for native platforms."}),f("div",{className:"grid gap-4 xl:grid-cols-3",children:nc.map((e)=>He("div",{className:"card-subtle p-4",children:[f("h3",{className:"font-semibold",children:e.title}),f("ul",{className:"mt-2 space-y-2 text-muted-foreground text-sm leading-7",children:e.items.map((t)=>f("li",{children:t},t))})]},e.title))})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Layout primitives"}),He("p",{className:"text-muted-foreground",children:[f("code",{children:"VStack"}),", ",f("code",{children:"HStack"}),", and ",f("code",{children:"Box"})," are the closest thing to a shared layout vocabulary, but their defaults and a few props still differ across the web and native packages."]}),f("div",{className:"grid gap-4 md:grid-cols-2",children:cc.map((e)=>f("div",{className:"card-subtle p-4 text-muted-foreground text-sm leading-7",children:e},e))}),f(Lo,{language:"tsx",filename:"stack-layout.tsx",code:gc})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Rendering patterns"}),f("p",{className:"text-muted-foreground",children:"Keep the controller stable, then decide whether the final surface should be a raw web primitive, a raw native primitive, or a composed design-system wrapper."}),f(Lo,{language:"tsx",filename:"cross-platform-rendering.tsx",code:fc}),He("div",{className:"card-subtle p-4 text-muted-foreground text-sm leading-7",children:["For higher-level shared rendering, use the design-system surfaces that already ship paired implementations such as"," ",f("code",{children:"DataViewRenderer"}),", ",f("code",{children:"ListTablePage"}),", and"," ",f("code",{children:"DataTable"}),". The web and mobile files stay separate inside the package while your app imports one design-system boundary."]})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Gotchas and boundaries"}),f("ul",{className:"space-y-2 text-muted-foreground leading-7",children:lc.map((e)=>f("li",{children:e},e))})]}),He("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Customer markdown kit"}),f("p",{className:"text-muted-foreground",children:sc}),He("div",{className:"grid gap-4 xl:grid-cols-2",children:[f(Lo,{language:"markdown",filename:"cross-surface-policy.md",code:hc}),f(Lo,{language:"markdown",filename:"cross-surface-checklist.md",code:yc})]})]}),He("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[f(Ei,{href:"/docs/libraries/runtime",className:"btn-ghost",children:"Runtime libraries"}),f(Ei,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"UI Kit"}),f(Ei,{href:"/docs/libraries/ui-kit-web",className:"btn-ghost",children:"UI Kit Web"}),He(Ei,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Design System ",f(Em,{size:16})]})]})]})}import{CodeBlock as Om}from"@contractspec/lib.design-system";import vc from"@contractspec/lib.ui-link";import{ChevronRight as Mm}from"lucide-react";import{jsx as Pt,jsxs as Tt}from"react/jsx-runtime";function Bm(){return Tt("div",{className:"space-y-8",children:[Tt("div",{className:"space-y-4",children:[Pt("h1",{className:"font-bold text-4xl",children:"Data & Backend"}),Pt("p",{className:"text-muted-foreground",children:"A collection of robust, platform-agnostic libraries for building the backend infrastructure of your LSSM applications."})]}),Tt("div",{className:"space-y-4",children:[Pt("h2",{className:"font-bold text-2xl",children:"Libraries"}),Tt("div",{className:"space-y-6",children:[Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/app.cli-database"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Prisma Wrapper & CLI"}),". Provides a unified way to manage database schemas, migrations, and clients. Includes seeders and factory patterns for testing."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.bus"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Type-Safe Event Bus"}),". Decouple your architecture with typed events. Supports in-memory dispatch for monoliths and can be extended for distributed message queues (Redis, SQS)."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.logger"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"High-Performance Logging"}),". Optimized for Bun and structured JSON output. Includes plugins for ElysiaJS to log HTTP requests automatically."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.error"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Standardized Errors"}),". Use `AppError` with standard codes (NOT_FOUND, UNAUTHORIZED) to ensure consistent HTTP responses and error handling across services."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.exporter"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Data Export"}),". Generate CSV and XML files from your data. Platform-agnostic and streaming-friendly."]})]})]})]}),Tt("div",{className:"space-y-4",children:[Pt("h2",{className:"font-bold text-2xl",children:"Example: Unified Backend Flow"}),Pt(Om,{language:"typescript",code:`import { logger } from '@contractspec/lib.logger';
3760
+ // swap useContractTable for useDataViewTable.`,fc="# Cross-Surface Rendering Policy\n\n- Import runtime bundler helpers from `@contractspec/lib.presentation-runtime-core` root only.\n- Use `withPresentationTurbopackAliases` for default Next.js projects.\n- Use `withPresentationWebpackAliases` only when the app explicitly opts into webpack.\n- Use `withPresentationMetroAliases` for Expo and Metro builds.\n- Prefer `@contractspec/lib.design-system` for shared product-facing surfaces.\n- Use design-system controls when a field must respect ThemeSpec component variants or TranslationSpec messages.\n- Use `@contractspec/lib.ui-kit-web` only for web-specific primitive lanes.\n- Use `@contractspec/lib.ui-kit` only for native-specific primitive lanes.\n- Keep shared layout code inside the common `VStack` / `HStack` / `Box` subset.\n- Do not use removed `withPresentationNextAliases`.\n- Treat `.tsx` / `.mobile.tsx` pairs as the standard design-system compatibility boundary.",yc="# Cross-Surface Rendering Checklist\n\n1. Configure the bundler aliases before sharing any UI code.\n2. Choose the controller layer:\n - use `useContractTable` for app-owned rows and columns\n - use `useDataViewTable` for DataViewSpec-driven tables\n3. Choose the renderer lane:\n - web primitive: `@contractspec/lib.ui-kit-web`\n - native primitive: `@contractspec/lib.ui-kit`\n - shared product surface: `@contractspec/lib.design-system`\n4. Verify mirrored `.tsx` / `.mobile.tsx` implementations where the design-system owns the surface.\n5. Wrap product surfaces in `DesignSystemThemeProvider` and `DesignSystemTranslationProvider` when ThemeSpec or TranslationSpec data is available.\n6. In shared layout code, set `gap`, `align`, `justify`, and `wrap` explicitly.\n7. Check docs and examples for root imports and current helper names before copying them into product code.";import{CodeBlock as Lo}from"@contractspec/lib.design-system";import Ei from"@contractspec/lib.ui-link";import{ChevronRight as Em}from"lucide-react";import{jsx as h,jsxs as qe}from"react/jsx-runtime";function Dm(){return qe("div",{className:"space-y-8",children:[qe("div",{className:"space-y-4",children:[h("h1",{className:"font-bold text-4xl",children:"Cross-platform UI"}),h("p",{className:"text-lg text-muted-foreground",children:"How ContractSpec keeps React and React Native components compatible by splitting responsibility across shared runtime models, platform primitives, resolver aliases, and the composed design-system layer."})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"What cross-platform means here"}),h("p",{className:"text-muted-foreground",children:"The shared rendering story is layered: the core package owns models and resolver helpers, the React packages own hook APIs, the UI kits own raw primitives, and the design-system owns the higher-level product surfaces that pair web and mobile implementations."}),h("div",{className:"grid gap-4 md:grid-cols-2",children:ac.map((e)=>qe("div",{className:"rounded-[20px] border border-border/70 p-4",children:[h("h3",{className:"font-semibold text-base",children:e.title}),h("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),h("div",{className:"grid gap-4 md:grid-cols-3",children:oc.map((e)=>qe("div",{className:"card-subtle p-4",children:[h("h3",{className:"font-semibold",children:e.title}),h("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),qe("div",{className:"grid gap-4 lg:grid-cols-[1.1fr_0.9fr]",children:[h("div",{className:"grid gap-4 md:grid-cols-2",children:rc.map((e)=>qe("div",{className:"card-subtle p-4",children:[h("h3",{className:"font-semibold",children:e.title}),h("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),h(Lo,{language:"typescript",filename:"design-system-platform.ts",code:uc})]})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Resolver and alias setup"}),qe("p",{className:"text-muted-foreground",children:["Teach the bundler what “web” and “native” mean before you try to share component code. These helpers are public from the root",h("code",{children:" @contractspec/lib.presentation-runtime-core "}),"entrypoint."]}),h("div",{className:"grid gap-4 md:grid-cols-2",children:ic.map((e)=>qe("div",{className:"card-subtle p-4",children:[h("h3",{className:"font-semibold",children:e.title}),h("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),qe("div",{className:"grid gap-4 xl:grid-cols-3",children:[h(Lo,{language:"typescript",filename:"next.config.mjs",code:dc}),h(Lo,{language:"typescript",filename:"next.config.mjs",code:pc}),h(Lo,{language:"javascript",filename:"metro.config.js",code:mc})]})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"How the remapping works"}),h("p",{className:"text-muted-foreground",children:"The helpers are intentionally asymmetric because Turbopack patches the Next config object, Webpack mutates a resolver config, and Metro maps modules at request time for native platforms."}),h("div",{className:"grid gap-4 xl:grid-cols-3",children:nc.map((e)=>qe("div",{className:"card-subtle p-4",children:[h("h3",{className:"font-semibold",children:e.title}),h("ul",{className:"mt-2 space-y-2 text-muted-foreground text-sm leading-7",children:e.items.map((t)=>h("li",{children:t},t))})]},e.title))})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Layout primitives"}),qe("p",{className:"text-muted-foreground",children:[h("code",{children:"VStack"}),", ",h("code",{children:"HStack"}),", and ",h("code",{children:"Box"})," are the closest thing to a shared layout vocabulary, but their defaults and a few props still differ across the web and native packages."]}),h("div",{className:"grid gap-4 md:grid-cols-2",children:cc.map((e)=>h("div",{className:"card-subtle p-4 text-muted-foreground text-sm leading-7",children:e},e))}),h(Lo,{language:"tsx",filename:"stack-layout.tsx",code:gc})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Rendering patterns"}),h("p",{className:"text-muted-foreground",children:"Keep the controller stable, then decide whether the final surface should be a raw web primitive, a raw native primitive, or a composed design-system wrapper."}),h(Lo,{language:"tsx",filename:"cross-platform-rendering.tsx",code:hc}),qe("div",{className:"card-subtle p-4 text-muted-foreground text-sm leading-7",children:["For higher-level shared rendering, use the design-system surfaces that already ship paired implementations such as"," ",h("code",{children:"DataViewRenderer"}),", ",h("code",{children:"ListTablePage"}),", and"," ",h("code",{children:"DataTable"}),". The web and mobile files stay separate inside the package while your app imports one design-system boundary."]})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Gotchas and boundaries"}),h("ul",{className:"space-y-2 text-muted-foreground leading-7",children:lc.map((e)=>h("li",{children:e},e))})]}),qe("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Customer markdown kit"}),h("p",{className:"text-muted-foreground",children:sc}),qe("div",{className:"grid gap-4 xl:grid-cols-2",children:[h(Lo,{language:"markdown",filename:"cross-surface-policy.md",code:fc}),h(Lo,{language:"markdown",filename:"cross-surface-checklist.md",code:yc})]})]}),qe("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[h(Ei,{href:"/docs/libraries/runtime",className:"btn-ghost",children:"Runtime libraries"}),h(Ei,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"UI Kit"}),h(Ei,{href:"/docs/libraries/ui-kit-web",className:"btn-ghost",children:"UI Kit Web"}),qe(Ei,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Design System ",h(Em,{size:16})]})]})]})}import{CodeBlock as Om}from"@contractspec/lib.design-system";import vc from"@contractspec/lib.ui-link";import{ChevronRight as Mm}from"lucide-react";import{jsx as Pt,jsxs as Tt}from"react/jsx-runtime";function Bm(){return Tt("div",{className:"space-y-8",children:[Tt("div",{className:"space-y-4",children:[Pt("h1",{className:"font-bold text-4xl",children:"Data & Backend"}),Pt("p",{className:"text-muted-foreground",children:"A collection of robust, platform-agnostic libraries for building the backend infrastructure of your LSSM applications."})]}),Tt("div",{className:"space-y-4",children:[Pt("h2",{className:"font-bold text-2xl",children:"Libraries"}),Tt("div",{className:"space-y-6",children:[Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/app.cli-database"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Prisma Wrapper & CLI"}),". Provides a unified way to manage database schemas, migrations, and clients. Includes seeders and factory patterns for testing."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.bus"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Type-Safe Event Bus"}),". Decouple your architecture with typed events. Supports in-memory dispatch for monoliths and can be extended for distributed message queues (Redis, SQS)."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.logger"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"High-Performance Logging"}),". Optimized for Bun and structured JSON output. Includes plugins for ElysiaJS to log HTTP requests automatically."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.error"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Standardized Errors"}),". Use `AppError` with standard codes (NOT_FOUND, UNAUTHORIZED) to ensure consistent HTTP responses and error handling across services."]})]}),Tt("div",{className:"card-subtle p-6",children:[Pt("h3",{className:"font-bold text-lg",children:"@contractspec/lib.exporter"}),Tt("p",{className:"mt-2 text-muted-foreground text-sm",children:[Pt("strong",{children:"Data Export"}),". Generate CSV and XML files from your data. Platform-agnostic and streaming-friendly."]})]})]})]}),Tt("div",{className:"space-y-4",children:[Pt("h2",{className:"font-bold text-2xl",children:"Example: Unified Backend Flow"}),Pt(Om,{language:"typescript",code:`import { logger } from '@contractspec/lib.logger';
3761
3761
  import { AppError } from '@contractspec/lib.error';
3762
3762
  import { db } from '@contractspec/app.cli-database';
3763
3763
  import { EventBus } from '@contractspec/lib.bus';
@@ -3795,7 +3795,7 @@ const query = generator.generate({
3795
3795
  filters: { role: 'admin' }
3796
3796
  });
3797
3797
 
3798
- // query.input contains { skip: 0, take: 20, role: 'admin' }`})]}),_t("div",{className:"flex items-center gap-4 pt-4",children:[De(Nc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),_t(Nc,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",De(Wm,{size:16})]})]})]})}import{CodeBlock as pr,InstallCommand as zm}from"@contractspec/lib.design-system";import Di from"@contractspec/lib.ui-link";import{ChevronRight as Gm}from"lucide-react";import{jsx as C,jsxs as $}from"react/jsx-runtime";var Hm=`import { Button, DataTable } from '@contractspec/lib.design-system';
3798
+ // query.input contains { skip: 0, take: 20, role: 'admin' }`})]}),_t("div",{className:"flex items-center gap-4 pt-4",children:[De(Nc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),_t(Nc,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",De(Wm,{size:16})]})]})]})}import{CodeBlock as pr,InstallCommand as zm}from"@contractspec/lib.design-system";import Di from"@contractspec/lib.ui-link";import{ChevronRight as Gm}from"lucide-react";import{jsx as C,jsxs as X}from"react/jsx-runtime";var qm=`import { Button, DataTable } from '@contractspec/lib.design-system';
3799
3799
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
3800
3800
 
3801
3801
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -3843,7 +3843,7 @@ export function AccountHealthTable() {
3843
3843
  footer={\`Page \${controller.pageIndex + 1} of \${controller.pageCount}\`}
3844
3844
  />
3845
3845
  );
3846
- }`,qm=`import {
3846
+ }`,Vm=`import {
3847
3847
  DesignSystemThemeProvider,
3848
3848
  resolveThemeModeTokens,
3849
3849
  themeSpecToCssVariables,
@@ -3873,13 +3873,13 @@ export function TenantSurface({ children }: { children: React.ReactNode }) {
3873
3873
  {children}
3874
3874
  </DesignSystemThemeProvider>
3875
3875
  );
3876
- }`,Vm=`import { themeSpecToTailwindPreset } from '@contractspec/lib.design-system/theme';
3876
+ }`,Hm=`import { themeSpecToTailwindPreset } from '@contractspec/lib.design-system/theme';
3877
3877
  import { Select } from '@contractspec/lib.design-system/controls';
3878
3878
  import { FormDialog } from '@contractspec/lib.design-system/forms';
3879
3879
  import { HStack } from '@contractspec/lib.design-system/layout';
3880
3880
 
3881
3881
  // Root imports remain supported:
3882
- import { Button, DataTable } from '@contractspec/lib.design-system';`;function Fm(){return $("div",{className:"space-y-8",children:[$("div",{className:"space-y-4",children:[C("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.design-system"}),$("p",{className:"text-muted-foreground",children:["High-level design system components, patterns, and layouts for LSSM applications. Built on top of ",C("code",{children:"@contractspec/lib.ui-kit"}),"."]})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Installation"}),C(zm,{package:"@contractspec/lib.design-system"})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"What It Provides"}),$("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[$("li",{children:[C("strong",{children:"Composite Components"}),": Molecules and Organisms that solve common UI problems"]}),$("li",{children:[C("strong",{children:"Layouts"}),": Ready-to-use page structures for dashboards, marketing sites, and lists"]}),$("li",{children:[C("strong",{children:"Data Views"}),": Standardized renderers for lists, tables, and detail views"]}),$("li",{children:[C("strong",{children:"Forms"}),": Zod-integrated form layouts and components"]}),$("li",{children:[C("strong",{children:"Code Display"}),": Syntax-highlighted code blocks with package manager tabs"]}),$("li",{children:[C("strong",{children:"Platform Utilities"}),": Hooks for responsive and adaptive design"]}),$("li",{children:[C("strong",{children:"Theme Bridge"}),": ThemeSpec to Tailwind variables, presets, CSS text, and runtime light/dark mode"]}),$("li",{children:[C("strong",{children:"Legal Templates"}),": Compliant templates for Terms, Privacy, and GDPR"]})]})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"ThemeSpec to Tailwind"}),$("p",{className:"text-muted-foreground",children:["The theme bridge keeps ",C("code",{children:"ThemeSpec"})," as the source of truth and exposes no-generation Tailwind helpers, optional CSS text serialization, runtime CSS variables, light/dark modes, and OKLCH color pass-through."]}),C(pr,{language:"tsx",code:qm})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Focused import surfaces"}),C("p",{className:"text-muted-foreground",children:"New code can use focused subpaths for theme, controls, forms, and layout while existing root imports remain compatible."}),C(pr,{language:"tsx",code:Vm})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Data table example"}),$("p",{className:"text-muted-foreground",children:["This is the composed lane from the canonical"," ",C(Di,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". The design-system wrapper owns title, description, header actions, and the opinionated card shell on top of the raw web primitive."]}),C(pr,{language:"tsx",code:Hm})]}),$("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Key Exports"}),$("div",{className:"grid gap-4 md:grid-cols-2",children:[$("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Organisms"}),$("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"AppLayout, AppHeader, AppSidebar"}),C("li",{children:"MarketingLayout, HeroSection"}),C("li",{children:"ListCardPage, ListTablePage"})]})]}),$("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Data & Forms"}),$("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"DataTable"}),C("li",{children:"DataViewTable"}),C("li",{children:"DataViewRenderer"}),C("li",{children:"ZodForm"}),C("li",{children:"FormLayout, FormDialog"})]})]}),$("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Code Display"}),$("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"CodeBlock (syntax highlighting)"}),C("li",{children:"CommandTabs (package manager tabs)"}),C("li",{children:"InstallCommand (convenience wrapper)"}),C("li",{children:"CopyButton"})]})]}),$("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Providers"}),C("ul",{className:"space-y-1 text-muted-foreground text-sm",children:C("li",{children:"PackageManagerProvider"})})]})]})]}),$("div",{className:"card-subtle space-y-3 p-6",children:[C("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),$("p",{className:"text-muted-foreground",children:["Read"," ",C(Di,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the package split between shared runtime controllers, leaf platform primitives, and this composed design-system layer."]})]}),$("div",{className:"flex items-center gap-4 pt-4",children:[C(Di,{href:"/docs/libraries/ui-kit-web",className:"btn-ghost",children:"Previous: UI Kit Web"}),$(Di,{href:"/docs/libraries/accessibility",className:"btn-primary",children:["Next: Accessibility ",C(Gm,{size:16})]})]})]})}import{CodeBlock as mr,InstallCommand as Km}from"@contractspec/lib.design-system";import wc from"@contractspec/lib.ui-link";import{ChevronRight as Qm}from"lucide-react";import{jsx as ea,jsxs as uo}from"react/jsx-runtime";function Ym(){return uo("div",{className:"space-y-8",children:[uo("div",{className:"space-y-4",children:[ea("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.evolution"}),ea("p",{className:"text-lg text-muted-foreground",children:"Analyze production telemetry, surface anomalies, and turn them into AI-reviewed spec proposals that can be approved, rolled out, or reverted."})]}),uo("div",{className:"space-y-4",children:[ea("h2",{className:"font-bold text-2xl",children:"Installation"}),ea(Km,{package:"@contractspec/lib.evolution"})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"From telemetry to intent"}),ea(mr,{language:"typescript",code:`import { SpecAnalyzer } from '@contractspec/lib.evolution/analyzer';
3882
+ import { Button, DataTable } from '@contractspec/lib.design-system';`;function Fm(){return X("div",{className:"space-y-8",children:[X("div",{className:"space-y-4",children:[C("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.design-system"}),X("p",{className:"text-muted-foreground",children:["High-level design system components, patterns, and layouts for LSSM applications. Built on top of ",C("code",{children:"@contractspec/lib.ui-kit"}),"."]})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Installation"}),C(zm,{package:"@contractspec/lib.design-system"})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"What It Provides"}),X("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[X("li",{children:[C("strong",{children:"Composite Components"}),": Molecules and Organisms that solve common UI problems"]}),X("li",{children:[C("strong",{children:"Layouts"}),": Ready-to-use page structures for dashboards, marketing sites, and lists"]}),X("li",{children:[C("strong",{children:"Data Views"}),": Standardized renderers for lists, tables, and detail views"]}),X("li",{children:[C("strong",{children:"Forms"}),": Zod-integrated form layouts and components"]}),X("li",{children:[C("strong",{children:"Code Display"}),": Syntax-highlighted code blocks with package manager tabs"]}),X("li",{children:[C("strong",{children:"Platform Utilities"}),": Hooks for responsive and adaptive design"]}),X("li",{children:[C("strong",{children:"Theme Bridge"}),": ThemeSpec to Tailwind variables, presets, CSS text, and runtime light/dark mode"]}),X("li",{children:[C("strong",{children:"Legal Templates"}),": Compliant templates for Terms, Privacy, and GDPR"]})]})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"ThemeSpec to Tailwind"}),X("p",{className:"text-muted-foreground",children:["The theme bridge keeps ",C("code",{children:"ThemeSpec"})," as the source of truth and exposes no-generation Tailwind helpers, optional CSS text serialization, runtime CSS variables, light/dark modes, and OKLCH color pass-through."]}),C(pr,{language:"tsx",code:Vm})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Focused import surfaces"}),C("p",{className:"text-muted-foreground",children:"New code can use focused subpaths for theme, controls, forms, and layout while existing root imports remain compatible."}),C(pr,{language:"tsx",code:Hm})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Data table example"}),X("p",{className:"text-muted-foreground",children:["This is the composed lane from the canonical"," ",C(Di,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". The design-system wrapper owns title, description, header actions, and the opinionated card shell on top of the raw web primitive."]}),C(pr,{language:"tsx",code:qm})]}),X("div",{className:"space-y-4",children:[C("h2",{className:"font-bold text-2xl",children:"Key Exports"}),X("div",{className:"grid gap-4 md:grid-cols-2",children:[X("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Organisms"}),X("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"AppLayout, AppHeader, AppSidebar"}),C("li",{children:"MarketingLayout, HeroSection"}),C("li",{children:"ListCardPage, ListTablePage"})]})]}),X("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Data & Forms"}),X("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"DataTable"}),C("li",{children:"DataViewTable"}),C("li",{children:"DataViewRenderer"}),C("li",{children:"ZodForm"}),C("li",{children:"FormLayout, FormDialog"})]})]}),X("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Code Display"}),X("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[C("li",{children:"CodeBlock (syntax highlighting)"}),C("li",{children:"CommandTabs (package manager tabs)"}),C("li",{children:"InstallCommand (convenience wrapper)"}),C("li",{children:"CopyButton"})]})]}),X("div",{className:"card-subtle p-4",children:[C("h3",{className:"mb-2 font-semibold",children:"Providers"}),C("ul",{className:"space-y-1 text-muted-foreground text-sm",children:C("li",{children:"PackageManagerProvider"})})]})]})]}),X("div",{className:"card-subtle space-y-3 p-6",children:[C("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),X("p",{className:"text-muted-foreground",children:["Read"," ",C(Di,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the package split between shared runtime controllers, leaf platform primitives, and this composed design-system layer."]})]}),X("div",{className:"flex items-center gap-4 pt-4",children:[C(Di,{href:"/docs/libraries/ui-kit-web",className:"btn-ghost",children:"Previous: UI Kit Web"}),X(Di,{href:"/docs/libraries/accessibility",className:"btn-primary",children:["Next: Accessibility ",C(Gm,{size:16})]})]})]})}import{CodeBlock as mr,InstallCommand as Km}from"@contractspec/lib.design-system";import wc from"@contractspec/lib.ui-link";import{ChevronRight as Qm}from"lucide-react";import{jsx as ea,jsxs as uo}from"react/jsx-runtime";function Ym(){return uo("div",{className:"space-y-8",children:[uo("div",{className:"space-y-4",children:[ea("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.evolution"}),ea("p",{className:"text-lg text-muted-foreground",children:"Analyze production telemetry, surface anomalies, and turn them into AI-reviewed spec proposals that can be approved, rolled out, or reverted."})]}),uo("div",{className:"space-y-4",children:[ea("h2",{className:"font-bold text-2xl",children:"Installation"}),ea(Km,{package:"@contractspec/lib.evolution"})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"From telemetry to intent"}),ea(mr,{language:"typescript",code:`import { SpecAnalyzer } from '@contractspec/lib.evolution/analyzer';
3883
3883
  import { EvolutionPipeline } from '@contractspec/lib.observability';
3884
3884
 
3885
3885
  const analyzer = new SpecAnalyzer();
@@ -3919,7 +3919,7 @@ await writer.write({
3919
3919
  ...suggestion,
3920
3920
  status: 'approved',
3921
3921
  approvals: { reviewer: 'ops@contractspec', decidedAt: new Date() },
3922
- });`})]}),ea("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Approvals by default",description:"Every suggestion flows through @contractspec/lib.ai-agent's ApprovalWorkflow. Tune auto-approval thresholds per environment."},{title:"Pluggable storage",description:"Use the Prisma repository in production, in-memory for tests, or stream serialized suggestions into your own queue."}].map((e)=>uo("div",{className:"card-subtle space-y-2 p-4",children:[ea("h3",{className:"font-semibold text-lg",children:e.title}),ea("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))}),uo("div",{className:"flex items-center gap-4 pt-4",children:[ea(wc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),uo(wc,{href:"/docs/libraries/observability",className:"btn-primary",children:["Next: Observability ",ea(Qm,{size:16})]})]})]})}import{CodeBlock as Jm,InstallCommand as Zm}from"@contractspec/lib.design-system";import kc from"@contractspec/lib.ui-link";import{ChevronRight as $m}from"lucide-react";import{jsx as et,jsxs as zt}from"react/jsx-runtime";function Xm(){return zt("div",{className:"space-y-8",children:[zt("div",{className:"space-y-4",children:[et("h1",{className:"font-bold text-4xl",children:"GraphQL Libraries"}),et("p",{className:"text-muted-foreground",children:"This suite of libraries enables seamless GraphQL integration, transforming your ContractSpecs into a type-safe Pothos schema, connecting with Prisma, and enabling Apollo Federation."})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Libraries"}),zt("div",{className:"grid gap-4 md:grid-cols-1",children:[zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-core"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"The foundation. Provides a configured Pothos builder, common scalars (JSON, DateTime), and utilities for mapping ContractSpec I/O to Pothos types."})]}),zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-prisma"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"Connects Pothos to Prisma. Automatically generates GraphQL types from your Prisma schema and optimizes queries to prevent N+1 issues."})]}),zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-federation"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"Adds Apollo Federation V2 support. Allows your subgraph to define keys and entities, making it ready for a supergraph."})]})]})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Installation"}),et(Zm,{package:["@contractspec/lib.graphql-core","@contractspec/lib.graphql-prisma","@contractspec/lib.graphql-federation"]})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Usage: Building a Schema"}),et("p",{className:"text-muted-foreground",children:"Here's how to assemble a federated GraphQL schema from your specs:"}),et(Jm,{language:"typescript",code:`import { builder } from '@contractspec/lib.graphql-core';
3922
+ });`})]}),ea("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Approvals by default",description:"Every suggestion flows through @contractspec/lib.ai-agent's ApprovalWorkflow. Tune auto-approval thresholds per environment."},{title:"Pluggable storage",description:"Use the Prisma repository in production, in-memory for tests, or stream serialized suggestions into your own queue."}].map((e)=>uo("div",{className:"card-subtle space-y-2 p-4",children:[ea("h3",{className:"font-semibold text-lg",children:e.title}),ea("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))}),uo("div",{className:"flex items-center gap-4 pt-4",children:[ea(wc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),uo(wc,{href:"/docs/libraries/observability",className:"btn-primary",children:["Next: Observability ",ea(Qm,{size:16})]})]})]})}import{CodeBlock as Jm,InstallCommand as Zm}from"@contractspec/lib.design-system";import kc from"@contractspec/lib.ui-link";import{ChevronRight as Xm}from"lucide-react";import{jsx as et,jsxs as zt}from"react/jsx-runtime";function $m(){return zt("div",{className:"space-y-8",children:[zt("div",{className:"space-y-4",children:[et("h1",{className:"font-bold text-4xl",children:"GraphQL Libraries"}),et("p",{className:"text-muted-foreground",children:"This suite of libraries enables seamless GraphQL integration, transforming your ContractSpecs into a type-safe Pothos schema, connecting with Prisma, and enabling Apollo Federation."})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Libraries"}),zt("div",{className:"grid gap-4 md:grid-cols-1",children:[zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-core"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"The foundation. Provides a configured Pothos builder, common scalars (JSON, DateTime), and utilities for mapping ContractSpec I/O to Pothos types."})]}),zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-prisma"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"Connects Pothos to Prisma. Automatically generates GraphQL types from your Prisma schema and optimizes queries to prevent N+1 issues."})]}),zt("div",{className:"card-subtle p-6",children:[et("h3",{className:"font-bold text-lg",children:"@contractspec/lib.graphql-federation"}),et("p",{className:"mt-2 text-muted-foreground text-sm",children:"Adds Apollo Federation V2 support. Allows your subgraph to define keys and entities, making it ready for a supergraph."})]})]})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Installation"}),et(Zm,{package:["@contractspec/lib.graphql-core","@contractspec/lib.graphql-prisma","@contractspec/lib.graphql-federation"]})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Usage: Building a Schema"}),et("p",{className:"text-muted-foreground",children:"Here's how to assemble a federated GraphQL schema from your specs:"}),et(Jm,{language:"typescript",code:`import { builder } from '@contractspec/lib.graphql-core';
3923
3923
  import { registerContractsOnBuilder } from '@contractspec/lib.contracts-runtime-server-graphql/graphql-pothos';
3924
3924
  import { OperationSpecRegistry } from '@contractspec/lib.contracts-spec';
3925
3925
  import { MySpecs } from './specs';
@@ -3933,7 +3933,7 @@ registerContractsOnBuilder(builder, registry);
3933
3933
 
3934
3934
  // 3. Build and print schema
3935
3935
  const schema = builder.toSchema();
3936
- console.log(printSchema(schema));`})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Features"}),zt("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[zt("li",{children:[et("strong",{children:"Code-First"}),": Define schema in TypeScript (Pothos), get SDL as artifact."]}),zt("li",{children:[et("strong",{children:"Spec Integration"}),": `registerContractsOnBuilder` automatically converts Command/Query specs into Mutations/Queries."]}),zt("li",{children:[et("strong",{children:"Federation Ready"}),": Just add `provider: 'federation'` to your config."]})]})]}),zt("div",{className:"flex items-center gap-4 pt-4",children:[zt(kc,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",et($m,{size:16})]}),et(kc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Sc,InstallCommand as xm}from"@contractspec/lib.design-system";import Cc from"@contractspec/lib.ui-link";import{ChevronRight as jm}from"lucide-react";import{jsx as ao,jsxs as Ho}from"react/jsx-runtime";function eu(){return Ho("div",{className:"space-y-8",children:[Ho("div",{className:"space-y-4",children:[ao("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.growth"}),ao("p",{className:"text-lg text-muted-foreground",children:"Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."})]}),Ho("div",{className:"space-y-4",children:[ao("h2",{className:"font-bold text-2xl",children:"Installation"}),ao(xm,{package:"@contractspec/lib.growth"})]}),Ho("div",{className:"space-y-3",children:[ao("h2",{className:"font-bold text-2xl",children:"Register + assign"}),ao(Sc,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';
3936
+ console.log(printSchema(schema));`})]}),zt("div",{className:"space-y-4",children:[et("h2",{className:"font-bold text-2xl",children:"Features"}),zt("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[zt("li",{children:[et("strong",{children:"Code-First"}),": Define schema in TypeScript (Pothos), get SDL as artifact."]}),zt("li",{children:[et("strong",{children:"Spec Integration"}),": `registerContractsOnBuilder` automatically converts Command/Query specs into Mutations/Queries."]}),zt("li",{children:[et("strong",{children:"Federation Ready"}),": Just add `provider: 'federation'` to your config."]})]})]}),zt("div",{className:"flex items-center gap-4 pt-4",children:[zt(kc,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",et(Xm,{size:16})]}),et(kc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Sc,InstallCommand as xm}from"@contractspec/lib.design-system";import Cc from"@contractspec/lib.ui-link";import{ChevronRight as jm}from"lucide-react";import{jsx as ao,jsxs as qo}from"react/jsx-runtime";function eu(){return qo("div",{className:"space-y-8",children:[qo("div",{className:"space-y-4",children:[ao("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.growth"}),ao("p",{className:"text-lg text-muted-foreground",children:"Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."})]}),qo("div",{className:"space-y-4",children:[ao("h2",{className:"font-bold text-2xl",children:"Installation"}),ao(xm,{package:"@contractspec/lib.growth"})]}),qo("div",{className:"space-y-3",children:[ao("h2",{className:"font-bold text-2xl",children:"Register + assign"}),ao(Sc,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';
3937
3937
 
3938
3938
  const registry = new ExperimentRegistry().register({
3939
3939
  key: 'pricing.cta',
@@ -3947,7 +3947,7 @@ const registry = new ExperimentRegistry().register({
3947
3947
  });
3948
3948
 
3949
3949
  const runner = new ExperimentRunner();
3950
- const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`})]}),Ho("div",{className:"space-y-3",children:[ao("h2",{className:"font-bold text-2xl",children:"Track + analyze"}),ao(Sc,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
3950
+ const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`})]}),qo("div",{className:"space-y-3",children:[ao("h2",{className:"font-bold text-2xl",children:"Track + analyze"}),ao(Sc,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
3951
3951
  import { StatsEngine } from '@contractspec/lib.growth/stats';
3952
3952
 
3953
3953
  const tracker = new ExperimentTracker(new InMemoryTrackerStore());
@@ -3963,7 +3963,7 @@ await tracker.recordSample({
3963
3963
  const stats = new StatsEngine().summarize(
3964
3964
  await tracker.getSamples(assignment.experimentKey, 'demo_booked'),
3965
3965
  'demo_booked'
3966
- );`})]}),Ho("div",{className:"flex items-center gap-4 pt-4",children:[ao(Cc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Ho(Cc,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",ao(jm,{size:16})]})]})]})}import{CodeBlock as Ic,InstallCommand as tu}from"@contractspec/lib.design-system";import Pc from"@contractspec/lib.ui-link";import{ChevronRight as au}from"lucide-react";import{jsx as Ba,jsxs as go}from"react/jsx-runtime";function ou(){return go("div",{className:"space-y-8",children:[go("div",{className:"space-y-4",children:[Ba("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy Library"}),go("p",{className:"text-lg text-muted-foreground",children:["The ",Ba("code",{children:"@contractspec/lib.multi-tenancy"})," library provides the core building blocks for secure SaaS applications."]})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Installation"}),Ba(tu,{package:"@contractspec/lib.multi-tenancy"})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Prisma RLS Middleware"}),go("p",{className:"text-muted-foreground",children:["Automatically injects ",Ba("code",{children:"tenantId"})," into all queries."]}),Ba(Ic,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
3966
+ );`})]}),qo("div",{className:"flex items-center gap-4 pt-4",children:[ao(Cc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),qo(Cc,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",ao(jm,{size:16})]})]})]})}import{CodeBlock as Ic,InstallCommand as tu}from"@contractspec/lib.design-system";import Pc from"@contractspec/lib.ui-link";import{ChevronRight as au}from"lucide-react";import{jsx as Ba,jsxs as go}from"react/jsx-runtime";function ou(){return go("div",{className:"space-y-8",children:[go("div",{className:"space-y-4",children:[Ba("h1",{className:"font-bold text-4xl",children:"Multi-Tenancy Library"}),go("p",{className:"text-lg text-muted-foreground",children:["The ",Ba("code",{children:"@contractspec/lib.multi-tenancy"})," library provides the core building blocks for secure SaaS applications."]})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Installation"}),Ba(tu,{package:"@contractspec/lib.multi-tenancy"})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Prisma RLS Middleware"}),go("p",{className:"text-muted-foreground",children:["Automatically injects ",Ba("code",{children:"tenantId"})," into all queries."]}),Ba(Ic,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
3967
3967
  import { prisma } from './db';
3968
3968
  import { getTenantId } from './context';
3969
3969
 
@@ -4026,7 +4026,7 @@ const { target } = useOverlay(engine, {
4026
4026
  target: { fields },
4027
4027
  capability: 'billing.createOrder',
4028
4028
  tenantId: 'acme',
4029
- });`})]}),Eo("div",{className:"flex items-center gap-4 pt-4",children:[ya(Ac,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Eo(Ac,{href:"/docs/libraries/workflow-composer",className:"btn-primary",children:["Next: Workflow Composer ",ya(lu,{size:16})]})]})]})}import du from"@contractspec/lib.ui-link";import{ChevronRight as pu}from"lucide-react";import{jsx as Ca,jsxs as Do}from"react/jsx-runtime";var mu=[{title:"Contract and schema foundation",body:"Use these packages to define explicit contracts, schemas, and generated artifacts without inventing a new platform-specific language.",items:[{title:"@contractspec/lib.contracts-spec",description:"Define operations, events, policies, and generated surfaces in TypeScript.",href:"/docs/libraries/contracts"},{title:"@contractspec/lib.schema",description:"Share type-safe schema definitions across validation, clients, and runtime adapters.",href:"/docs/libraries/schema"}]},{title:"Runtime and surface libraries",body:"These packages execute the contract model across UI, data, observability, workflows, and generated runtime behavior.",items:[{title:"@contractspec/lib.runtime",description:"Run typed capability surfaces, execute policies, and connect runtime adapters.",href:"/docs/libraries/runtime"},{title:"@contractspec/lib.ui-kit",description:"Render shared surfaces across web and React Native without forking the contract layer.",href:"/docs/libraries/ui-kit"},{title:"@contractspec/lib.ui-kit-web",description:"Use the raw web primitive layer directly when you want the browser table, accessibility, and interaction model without the design-system shell.",href:"/docs/libraries/ui-kit-web"},{title:"@contractspec/lib.design-system",description:"Build higher-level product surfaces and documented marketing/docs primitives on top of the web and native UI packages.",href:"/docs/libraries/design-system"},{title:"Cross-platform UI",description:"See how the presentation runtimes, ui-kit-web, ui-kit, and design-system stay compatible across React and React Native.",href:"/docs/libraries/cross-platform-ui"},{title:"@contractspec/lib.data-views",description:"Generate and render list/detail style surfaces that stay aligned with data contracts.",href:"/docs/libraries/data-views"}]},{title:"Operator and system packages",body:"These packages matter once the system is live and you need governance, resilience, and observability.",items:[{title:"@contractspec/lib.observability",description:"Trace, log, and measure contract execution using the same system boundaries.",href:"/docs/libraries/observability"},{title:"@contractspec/lib.resilience",description:"Add circuit breakers, retries, and failure controls without hiding the integration model.",href:"/docs/libraries/resilience"},{title:"@contractspec/lib.multi-tenancy",description:"Keep tenant-specific config, policy, and surface resolution explicit.",href:"/docs/libraries/multi-tenancy"},{title:"@contractspec/lib.workflow-composer",description:"Compose and extend workflows without smearing orchestration concerns across apps.",href:"/docs/libraries/workflow-composer"}]}];function uu(){return Do("div",{className:"space-y-10",children:[Do("div",{className:"space-y-3",children:[Ca("p",{className:"editorial-kicker",children:"Build"}),Ca("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The OSS foundation is a library system, not a closed platform."}),Ca("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is assembled from libraries that remain useful on their own and stronger together. Start with the contract and schema foundation, then add runtime, UI, integration, and operator packages as your system grows."})]}),Do("div",{className:"editorial-proof-strip",children:[Do("div",{className:"editorial-stat",children:[Ca("span",{className:"editorial-label",children:"Layering rule"}),Ca("span",{className:"editorial-stat-value",children:"libs → bundles → apps"})]}),Ca("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Keep reusable behavior in libraries, compose it into bundle-level surfaces, and reserve app packages for concrete delivery shells."})]}),Ca("div",{className:"space-y-6",children:mu.map((e)=>Do("section",{className:"editorial-panel space-y-5",children:[Do("div",{className:"space-y-2",children:[Ca("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:e.title}),Ca("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]}),Ca("div",{className:"grid gap-4 md:grid-cols-2",children:e.items.map((t)=>Do(du,{href:t.href,className:"rounded-[24px] border border-border/75 bg-background/70 p-5 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[Ca("h3",{className:"font-semibold text-lg",children:t.title}),Ca("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:t.description}),Do("div",{className:"mt-3 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Learn more ",Ca(pu,{size:14})]})]},t.title))})]},e.title))})]})}import{CodeBlock as gr,InstallCommand as gu}from"@contractspec/lib.design-system";import Rc from"@contractspec/lib.ui-link";import{ChevronRight as fu}from"lucide-react";import{jsx as ta,jsxs as Oo}from"react/jsx-runtime";function hu(){return Oo("div",{className:"space-y-8",children:[Oo("div",{className:"space-y-4",children:[ta("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.personalization"}),ta("p",{className:"text-lg text-muted-foreground",children:"Track field/feature/workflow usage, analyze drop-offs, and convert insights into OverlaySpecs or workflow tweaks."})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Installation"}),ta(gu,{package:"@contractspec/lib.personalization"})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Tracker"}),ta("p",{className:"text-muted-foreground",children:"Buffer events per tenant/user and emit OpenTelemetry counters automatically."}),ta(gr,{language:"typescript",code:`import { createBehaviorTracker } from '@contractspec/lib.personalization';
4029
+ });`})]}),Eo("div",{className:"flex items-center gap-4 pt-4",children:[ya(Ac,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Eo(Ac,{href:"/docs/libraries/workflow-composer",className:"btn-primary",children:["Next: Workflow Composer ",ya(lu,{size:16})]})]})]})}import du from"@contractspec/lib.ui-link";import{ChevronRight as pu}from"lucide-react";import{jsx as Ca,jsxs as Do}from"react/jsx-runtime";var mu=[{title:"Contract and schema foundation",body:"Use these packages to define explicit contracts, schemas, and generated artifacts without inventing a new platform-specific language.",items:[{title:"@contractspec/lib.contracts-spec",description:"Define operations, events, policies, and generated surfaces in TypeScript.",href:"/docs/libraries/contracts"},{title:"@contractspec/lib.schema",description:"Share type-safe schema definitions across validation, clients, and runtime adapters.",href:"/docs/libraries/schema"}]},{title:"Runtime and surface libraries",body:"These packages execute the contract model across UI, data, observability, workflows, and generated runtime behavior.",items:[{title:"@contractspec/lib.runtime",description:"Run typed capability surfaces, execute policies, and connect runtime adapters.",href:"/docs/libraries/runtime"},{title:"@contractspec/lib.ui-kit",description:"Render shared surfaces across web and React Native without forking the contract layer.",href:"/docs/libraries/ui-kit"},{title:"@contractspec/lib.ui-kit-web",description:"Use the raw web primitive layer directly when you want the browser table, accessibility, and interaction model without the design-system shell.",href:"/docs/libraries/ui-kit-web"},{title:"@contractspec/lib.design-system",description:"Build higher-level product surfaces and documented marketing/docs primitives on top of the web and native UI packages.",href:"/docs/libraries/design-system"},{title:"Cross-platform UI",description:"See how the presentation runtimes, ui-kit-web, ui-kit, and design-system stay compatible across React and React Native.",href:"/docs/libraries/cross-platform-ui"},{title:"@contractspec/lib.data-views",description:"Generate and render list/detail style surfaces that stay aligned with data contracts.",href:"/docs/libraries/data-views"}]},{title:"Operator and system packages",body:"These packages matter once the system is live and you need governance, resilience, and observability.",items:[{title:"@contractspec/lib.observability",description:"Trace, log, and measure contract execution using the same system boundaries.",href:"/docs/libraries/observability"},{title:"@contractspec/lib.resilience",description:"Add circuit breakers, retries, and failure controls without hiding the integration model.",href:"/docs/libraries/resilience"},{title:"@contractspec/lib.multi-tenancy",description:"Keep tenant-specific config, policy, and surface resolution explicit.",href:"/docs/libraries/multi-tenancy"},{title:"@contractspec/lib.workflow-composer",description:"Compose and extend workflows without smearing orchestration concerns across apps.",href:"/docs/libraries/workflow-composer"}]}];function uu(){return Do("div",{className:"space-y-10",children:[Do("div",{className:"space-y-3",children:[Ca("p",{className:"editorial-kicker",children:"Build"}),Ca("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"The OSS foundation is a library system, not a closed platform."}),Ca("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is assembled from libraries that remain useful on their own and stronger together. Start with the contract and schema foundation, then add runtime, UI, integration, and operator packages as your system grows."})]}),Do("div",{className:"editorial-proof-strip",children:[Do("div",{className:"editorial-stat",children:[Ca("span",{className:"editorial-label",children:"Layering rule"}),Ca("span",{className:"editorial-stat-value",children:"libs → bundles → apps"})]}),Ca("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Keep reusable behavior in libraries, compose it into bundle-level surfaces, and reserve app packages for concrete delivery shells."})]}),Ca("div",{className:"space-y-6",children:mu.map((e)=>Do("section",{className:"editorial-panel space-y-5",children:[Do("div",{className:"space-y-2",children:[Ca("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:e.title}),Ca("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]}),Ca("div",{className:"grid gap-4 md:grid-cols-2",children:e.items.map((t)=>Do(du,{href:t.href,className:"rounded-[24px] border border-border/75 bg-background/70 p-5 transition-colors hover:border-[color:rgb(162_79_42_/_0.45)]",children:[Ca("h3",{className:"font-semibold text-lg",children:t.title}),Ca("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:t.description}),Do("div",{className:"mt-3 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Learn more ",Ca(pu,{size:14})]})]},t.title))})]},e.title))})]})}import{CodeBlock as gr,InstallCommand as gu}from"@contractspec/lib.design-system";import Rc from"@contractspec/lib.ui-link";import{ChevronRight as hu}from"lucide-react";import{jsx as ta,jsxs as Oo}from"react/jsx-runtime";function fu(){return Oo("div",{className:"space-y-8",children:[Oo("div",{className:"space-y-4",children:[ta("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.personalization"}),ta("p",{className:"text-lg text-muted-foreground",children:"Track field/feature/workflow usage, analyze drop-offs, and convert insights into OverlaySpecs or workflow tweaks."})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Installation"}),ta(gu,{package:"@contractspec/lib.personalization"})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Tracker"}),ta("p",{className:"text-muted-foreground",children:"Buffer events per tenant/user and emit OpenTelemetry counters automatically."}),ta(gr,{language:"typescript",code:`import { createBehaviorTracker } from '@contractspec/lib.personalization';
4030
4030
 
4031
4031
  const tracker = createBehaviorTracker({
4032
4032
  store,
@@ -4044,7 +4044,7 @@ const overlay = insightsToOverlaySuggestion(insights, {
4044
4044
  overlayId: 'acme-order-form',
4045
4045
  tenantId: 'acme',
4046
4046
  capability: 'billing.createOrder',
4047
- });`})]}),Oo("div",{className:"flex items-center gap-4 pt-4",children:[ta(Rc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oo(Rc,{href:"/docs/libraries/overlay-engine",className:"btn-primary",children:["Next: Overlay Engine ",ta(fu,{size:16})]})]})]})}import{CodeBlock as Lc,InstallCommand as yu}from"@contractspec/lib.design-system";import Ec from"@contractspec/lib.ui-link";import{ChevronRight as vu}from"lucide-react";import{jsx as aa,jsxs as Va}from"react/jsx-runtime";function bu(){return Va("div",{className:"space-y-8",children:[Va("div",{className:"space-y-4",children:[aa("h1",{className:"font-bold text-4xl",children:"Progressive Delivery Library"}),Va("p",{className:"text-lg text-muted-foreground",children:["The ",aa("code",{children:"@contractspec/lib.progressive-delivery"})," package helps you ship new specs with confidence: canary + blue-green strategies, metric guardrails, and rollback hooks in one place."]})]}),Va("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Installation"}),aa(yu,{package:"@contractspec/lib.progressive-delivery"})]}),Va("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Define a Strategy"}),aa(Lc,{language:"typescript",code:`import { DeploymentCoordinator, createDefaultCanaryController, TrafficShifter, RollbackManager } from '@contractspec/lib.progressive-delivery';
4047
+ });`})]}),Oo("div",{className:"flex items-center gap-4 pt-4",children:[ta(Rc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oo(Rc,{href:"/docs/libraries/overlay-engine",className:"btn-primary",children:["Next: Overlay Engine ",ta(hu,{size:16})]})]})]})}import{CodeBlock as Lc,InstallCommand as yu}from"@contractspec/lib.design-system";import Ec from"@contractspec/lib.ui-link";import{ChevronRight as vu}from"lucide-react";import{jsx as aa,jsxs as Ha}from"react/jsx-runtime";function bu(){return Ha("div",{className:"space-y-8",children:[Ha("div",{className:"space-y-4",children:[aa("h1",{className:"font-bold text-4xl",children:"Progressive Delivery Library"}),Ha("p",{className:"text-lg text-muted-foreground",children:["The ",aa("code",{children:"@contractspec/lib.progressive-delivery"})," package helps you ship new specs with confidence: canary + blue-green strategies, metric guardrails, and rollback hooks in one place."]})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Installation"}),aa(yu,{package:"@contractspec/lib.progressive-delivery"})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Define a Strategy"}),aa(Lc,{language:"typescript",code:`import { DeploymentCoordinator, createDefaultCanaryController, TrafficShifter, RollbackManager } from '@contractspec/lib.progressive-delivery';
4048
4048
 
4049
4049
  const strategy = {
4050
4050
  target: { name: 'billing.createInvoice', version: 7 },
@@ -4054,7 +4054,7 @@ const strategy = {
4054
4054
  latencyP99: 500,
4055
4055
  latencyP95: 250,
4056
4056
  },
4057
- };`})]}),Va("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Run the Coordinator"}),aa(Lc,{language:"typescript",code:`const eventBus = new DeploymentEventBus();
4057
+ };`})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Run the Coordinator"}),aa(Lc,{language:"typescript",code:`const eventBus = new DeploymentEventBus();
4058
4058
  const controller = createDefaultCanaryController(strategy, fetchMetrics, eventBus);
4059
4059
  const coordinator = new DeploymentCoordinator({
4060
4060
  strategy,
@@ -4065,7 +4065,7 @@ const coordinator = new DeploymentCoordinator({
4065
4065
  eventBus,
4066
4066
  });
4067
4067
 
4068
- const result = await coordinator.run();`}),Va("p",{className:"text-muted-foreground text-sm",children:["The coordinator emits ",aa("code",{children:"stage_started"}),","," ",aa("code",{children:"stage_failed"}),", and ",aa("code",{children:"rolled_back"})," events, making it easy to power dashboards or alerting workflows."]})]}),Va("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Blue-Green Swap"}),Va("p",{className:"text-muted-foreground text-sm",children:["Switch to ",aa("code",{children:"mode: 'blue-green'"})," to warm up the new stack in parallel and cut over once smoke tests pass. The same guardrails apply before the final swap."]})]}),Va("div",{className:"flex items-center gap-4 pt-4",children:[aa(Ec,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Va(Ec,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",aa(vu,{size:16})]})]})]})}import{CodeBlock as fr,InstallCommand as Nu}from"@contractspec/lib.design-system";import Dc from"@contractspec/lib.ui-link";import{ChevronRight as wu}from"lucide-react";import{jsx as oa,jsxs as fo}from"react/jsx-runtime";function ku(){return fo("div",{className:"space-y-8",children:[fo("div",{className:"space-y-4",children:[oa("h1",{className:"font-bold text-4xl",children:"Resilience Library"}),fo("p",{className:"text-lg text-muted-foreground",children:["The ",oa("code",{children:"@contractspec/lib.resilience"})," library provides primitives to handle failures gracefully."]})]}),fo("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Installation"}),oa(Nu,{package:"@contractspec/lib.resilience"})]}),fo("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Circuit Breaker"}),oa("p",{className:"text-muted-foreground",children:"Prevent cascading failures by stopping calls to a failing dependency."}),oa(fr,{language:"typescript",code:`import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
4068
+ const result = await coordinator.run();`}),Ha("p",{className:"text-muted-foreground text-sm",children:["The coordinator emits ",aa("code",{children:"stage_started"}),","," ",aa("code",{children:"stage_failed"}),", and ",aa("code",{children:"rolled_back"})," events, making it easy to power dashboards or alerting workflows."]})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Blue-Green Swap"}),Ha("p",{className:"text-muted-foreground text-sm",children:["Switch to ",aa("code",{children:"mode: 'blue-green'"})," to warm up the new stack in parallel and cut over once smoke tests pass. The same guardrails apply before the final swap."]})]}),Ha("div",{className:"flex items-center gap-4 pt-4",children:[aa(Ec,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Ha(Ec,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",aa(vu,{size:16})]})]})]})}import{CodeBlock as hr,InstallCommand as Nu}from"@contractspec/lib.design-system";import Dc from"@contractspec/lib.ui-link";import{ChevronRight as wu}from"lucide-react";import{jsx as oa,jsxs as ho}from"react/jsx-runtime";function ku(){return ho("div",{className:"space-y-8",children:[ho("div",{className:"space-y-4",children:[oa("h1",{className:"font-bold text-4xl",children:"Resilience Library"}),ho("p",{className:"text-lg text-muted-foreground",children:["The ",oa("code",{children:"@contractspec/lib.resilience"})," library provides primitives to handle failures gracefully."]})]}),ho("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Installation"}),oa(Nu,{package:"@contractspec/lib.resilience"})]}),ho("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Circuit Breaker"}),oa("p",{className:"text-muted-foreground",children:"Prevent cascading failures by stopping calls to a failing dependency."}),oa(hr,{language:"typescript",code:`import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
4069
4069
 
4070
4070
  const breaker = new CircuitBreaker({
4071
4071
  failureThreshold: 5,
@@ -4074,19 +4074,19 @@ const breaker = new CircuitBreaker({
4074
4074
 
4075
4075
  const result = await breaker.execute(async () => {
4076
4076
  return await fetch('https://api.stripe.com/v1/charges');
4077
- });`})]}),fo("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Retry"}),oa("p",{className:"text-muted-foreground",children:"Automatically retry transient failures with exponential backoff."}),oa(fr,{language:"typescript",code:`import { retry } from '@contractspec/lib.resilience/retry';
4077
+ });`})]}),ho("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Retry"}),oa("p",{className:"text-muted-foreground",children:"Automatically retry transient failures with exponential backoff."}),oa(hr,{language:"typescript",code:`import { retry } from '@contractspec/lib.resilience/retry';
4078
4078
 
4079
4079
  const result = await retry(
4080
4080
  async () => fetchUser(id),
4081
4081
  3, // retries
4082
4082
  1000, // initial delay
4083
4083
  true // backoff
4084
- );`})]}),fo("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Timeout & Fallback"}),oa("p",{className:"text-muted-foreground",children:"Set hard limits on execution time and provide default values on failure."}),oa(fr,{language:"typescript",code:`import { timeout, fallback } from '@contractspec/lib.resilience';
4084
+ );`})]}),ho("div",{className:"space-y-4",children:[oa("h2",{className:"font-bold text-2xl",children:"Timeout & Fallback"}),oa("p",{className:"text-muted-foreground",children:"Set hard limits on execution time and provide default values on failure."}),oa(hr,{language:"typescript",code:`import { timeout, fallback } from '@contractspec/lib.resilience';
4085
4085
 
4086
4086
  const result = await fallback(
4087
4087
  () => timeout(slowOperation, 5000),
4088
4088
  defaultValue
4089
- );`})]}),fo("div",{className:"flex items-center gap-4 pt-4",children:[oa(Dc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),fo(Dc,{href:"/docs/libraries/testing",className:"btn-primary",children:["Next: Testing ",oa(wu,{size:16})]})]})]})}import{CodeBlock as Su,InstallCommand as Cu}from"@contractspec/lib.design-system";import hr from"@contractspec/lib.ui-link";import{ChevronRight as Iu}from"lucide-react";import{jsx as Ie,jsxs as Oe}from"react/jsx-runtime";function Pu(){return Oe("div",{className:"space-y-8",children:[Oe("div",{className:"space-y-4",children:[Ie("h1",{className:"font-bold text-4xl",children:"Runtime Libraries"}),Ie("p",{className:"text-muted-foreground",children:"The presentation runtime libraries provide the engine for rendering ContractSpec-defined UIs. They handle state management, validation, step navigation, and component rendering for Workflows and DataViews."})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Installation"}),Ie(Cu,{package:"@contractspec/lib.presentation-runtime-react"})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Libraries"}),Oe("div",{className:"space-y-6",children:[Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-core"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"Framework-Agnostic Core"}),". Contains the state machines, validation logic, and navigation rules for workflows. Can be used to build renderers for any platform (Vue, Svelte, CLI)."]})]}),Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"React Bindings"}),". Hooks (`useWorkflow`) and components (`WorkflowStepper`, `WorkflowStepRenderer`) for React Web applications. Integrates with `ui-kit-web`."]})]}),Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react-native"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"React Native Bindings"}),". Optimized for mobile experiences. Handles native navigation integration and uses universal components from `ui-kit`."]})]})]})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Example: React Workflow"}),Ie(Su,{language:"tsx",code:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
4089
+ );`})]}),ho("div",{className:"flex items-center gap-4 pt-4",children:[oa(Dc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),ho(Dc,{href:"/docs/libraries/testing",className:"btn-primary",children:["Next: Testing ",oa(wu,{size:16})]})]})]})}import{CodeBlock as Su,InstallCommand as Cu}from"@contractspec/lib.design-system";import fr from"@contractspec/lib.ui-link";import{ChevronRight as Iu}from"lucide-react";import{jsx as Ie,jsxs as Oe}from"react/jsx-runtime";function Pu(){return Oe("div",{className:"space-y-8",children:[Oe("div",{className:"space-y-4",children:[Ie("h1",{className:"font-bold text-4xl",children:"Runtime Libraries"}),Ie("p",{className:"text-muted-foreground",children:"The presentation runtime libraries provide the engine for rendering ContractSpec-defined UIs. They handle state management, validation, step navigation, and component rendering for Workflows and DataViews."})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Installation"}),Ie(Cu,{package:"@contractspec/lib.presentation-runtime-react"})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Libraries"}),Oe("div",{className:"space-y-6",children:[Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-core"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"Framework-Agnostic Core"}),". Contains the state machines, validation logic, and navigation rules for workflows. Can be used to build renderers for any platform (Vue, Svelte, CLI)."]})]}),Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"React Bindings"}),". Hooks (`useWorkflow`) and components (`WorkflowStepper`, `WorkflowStepRenderer`) for React Web applications. Integrates with `ui-kit-web`."]})]}),Oe("div",{className:"card-subtle p-6",children:[Ie("h3",{className:"font-bold text-lg",children:"@contractspec/lib.presentation-runtime-react-native"}),Oe("p",{className:"mt-2 text-muted-foreground text-sm",children:[Ie("strong",{children:"React Native Bindings"}),". Optimized for mobile experiences. Handles native navigation integration and uses universal components from `ui-kit`."]})]})]})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Example: React Workflow"}),Ie(Su,{language:"tsx",code:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
4090
4090
  import { OnboardingFlow } from './specs/onboarding';
4091
4091
 
4092
4092
  export function OnboardingPage() {
@@ -4126,7 +4126,7 @@ export function OnboardingPage() {
4126
4126
  </div>
4127
4127
  </div>
4128
4128
  );
4129
- }`})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Architecture"}),Ie("p",{className:"text-muted-foreground",children:'The runtime follows a "render-loop" pattern:'}),Oe("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[Oe("li",{children:[Ie("strong",{children:"Spec"}),": Defines the flow, fields, and validation rules."]}),Oe("li",{children:[Ie("strong",{children:"Core"}),": Tracks current step, data state, and validation errors."]}),Oe("li",{children:[Ie("strong",{children:"Renderer"}),": Maps spec fields to UI components (Input, Select, etc.)."]}),Oe("li",{children:[Ie("strong",{children:"User"}),": Interacts with components, updating core state."]}),Oe("li",{children:[Ie("strong",{children:"Policy"}),": (Optional) Re-evaluates visibility on every change."]})]})]}),Oe("div",{className:"card-subtle space-y-3 p-6",children:[Ie("h2",{className:"font-bold text-2xl",children:"Related reading"}),Oe("p",{className:"text-muted-foreground",children:["For the full React and React Native layering story across runtime, primitives, and composed components, read"," ",Ie(hr,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"}),"."]})]}),Oe("div",{className:"flex items-center gap-4 pt-4",children:[Ie(hr,{href:"/docs/libraries/data-backend",className:"btn-ghost",children:"Previous: Data & Backend"}),Oe(hr,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ie(Iu,{size:16})]})]})]})}import{CodeBlock as Oc,InstallCommand as Tu}from"@contractspec/lib.design-system";import Mc from"@contractspec/lib.ui-link";import{ChevronRight as Au}from"lucide-react";import{jsx as k,jsxs as Me}from"react/jsx-runtime";function Ru(){return Me("div",{className:"space-y-8",children:[Me("div",{className:"space-y-4",children:[k("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.schema"}),k("p",{className:"text-muted-foreground",children:"A small schema dictionary to describe operation I/O once and export to Zod (runtime validation), Pothos (GraphQL type refs), and JSON Schema."})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Installation"}),k(Tu,{package:"@contractspec/lib.schema"})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Core Exports"}),Me("ul",{className:"space-y-2 text-muted-foreground",children:[Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"SchemaModel"}),": Compose fields into typed object models"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum"}),": Common scalar types (NonEmptyString, Email, DateTime, etc.)"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum"}),": Create type-safe enums"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"FieldType"}),": Wrap scalars with Zod/GraphQL/JSON Schema"]})]})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Example: Basic Schema"}),k(Oc,{language:"typescript",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
4129
+ }`})]}),Oe("div",{className:"space-y-4",children:[Ie("h2",{className:"font-bold text-2xl",children:"Architecture"}),Ie("p",{className:"text-muted-foreground",children:'The runtime follows a "render-loop" pattern:'}),Oe("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[Oe("li",{children:[Ie("strong",{children:"Spec"}),": Defines the flow, fields, and validation rules."]}),Oe("li",{children:[Ie("strong",{children:"Core"}),": Tracks current step, data state, and validation errors."]}),Oe("li",{children:[Ie("strong",{children:"Renderer"}),": Maps spec fields to UI components (Input, Select, etc.)."]}),Oe("li",{children:[Ie("strong",{children:"User"}),": Interacts with components, updating core state."]}),Oe("li",{children:[Ie("strong",{children:"Policy"}),": (Optional) Re-evaluates visibility on every change."]})]})]}),Oe("div",{className:"card-subtle space-y-3 p-6",children:[Ie("h2",{className:"font-bold text-2xl",children:"Related reading"}),Oe("p",{className:"text-muted-foreground",children:["For the full React and React Native layering story across runtime, primitives, and composed components, read"," ",Ie(fr,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"}),"."]})]}),Oe("div",{className:"flex items-center gap-4 pt-4",children:[Ie(fr,{href:"/docs/libraries/data-backend",className:"btn-ghost",children:"Previous: Data & Backend"}),Oe(fr,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ie(Iu,{size:16})]})]})]})}import{CodeBlock as Oc,InstallCommand as Tu}from"@contractspec/lib.design-system";import Mc from"@contractspec/lib.ui-link";import{ChevronRight as Au}from"lucide-react";import{jsx as k,jsxs as Me}from"react/jsx-runtime";function Ru(){return Me("div",{className:"space-y-8",children:[Me("div",{className:"space-y-4",children:[k("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.schema"}),k("p",{className:"text-muted-foreground",children:"A small schema dictionary to describe operation I/O once and export to Zod (runtime validation), Pothos (GraphQL type refs), and JSON Schema."})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Installation"}),k(Tu,{package:"@contractspec/lib.schema"})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Core Exports"}),Me("ul",{className:"space-y-2 text-muted-foreground",children:[Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"SchemaModel"}),": Compose fields into typed object models"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum"}),": Common scalar types (NonEmptyString, Email, DateTime, etc.)"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum"}),": Create type-safe enums"]}),Me("li",{children:[k("code",{className:"rounded bg-background/50 px-2 py-1",children:"FieldType"}),": Wrap scalars with Zod/GraphQL/JSON Schema"]})]})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Example: Basic Schema"}),k(Oc,{language:"typescript",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
4130
4130
 
4131
4131
  export const CreateSpotInput = new SchemaModel({
4132
4132
  name: 'CreateSpotInput',
@@ -4182,7 +4182,7 @@ const resolution = await resolver.resolve(ticket);
4182
4182
  const draft = await responder.draft(ticket, resolution, classification);`})]}),Pa("div",{className:"space-y-3",children:[ia("h2",{className:"font-bold text-2xl",children:"Expose as agent tools"}),ia(Wc,{language:"typescript",code:`import { createSupportTools } from '@contractspec/lib.support-bot/bot';
4183
4183
 
4184
4184
  const tools = createSupportTools({ resolver, classifier, responder });
4185
- // Pass these tools into your host runtime or agent adapter.`})]}),Pa("div",{className:"space-y-3",children:[ia("h2",{className:"font-bold text-2xl",children:"Included modules"}),Pa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Pa("li",{children:[ia("strong",{children:"TicketClassifier"}),": heuristics + optional LLM validation for category/priority."]}),Pa("li",{children:[ia("strong",{children:"TicketResolver"}),": RAG resolver that can plug into any knowledge retriever."]}),Pa("li",{children:[ia("strong",{children:"AutoResponder"}),": generates drafts, citations, and tone-aware copy."]}),Pa("li",{children:[ia("strong",{children:"SupportFeedbackLoop"}),": track auto-resolution rates and sentiment trends."]})]})]}),Pa("div",{className:"flex items-center gap-4 pt-4",children:[ia(_c,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Pa(_c,{href:"/docs/libraries/growth",className:"btn-primary",children:["Next: Growth ",ia(Mu,{size:16})]})]})]})}import{CodeBlock as yr,InstallCommand as Uu}from"@contractspec/lib.design-system";import zc from"@contractspec/lib.ui-link";import{ChevronRight as Wu}from"lucide-react";import{jsx as ra,jsxs as ho}from"react/jsx-runtime";function _u(){return ho("div",{className:"space-y-8",children:[ho("div",{className:"space-y-4",children:[ra("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.testing"}),ra("p",{className:"text-lg text-muted-foreground",children:"Golden tests ensure new rollouts behave exactly like the traffic that inspired them. Record requests in production, replay them locally, and ship with confidence."})]}),ho("div",{className:"space-y-4",children:[ra("h2",{className:"font-bold text-2xl",children:"Installation"}),ra(Uu,{package:"@contractspec/lib.testing"})]}),ho("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Record traffic"}),ra(yr,{language:"typescript",code:`import {
4185
+ // Pass these tools into your host runtime or agent adapter.`})]}),Pa("div",{className:"space-y-3",children:[ia("h2",{className:"font-bold text-2xl",children:"Included modules"}),Pa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Pa("li",{children:[ia("strong",{children:"TicketClassifier"}),": heuristics + optional LLM validation for category/priority."]}),Pa("li",{children:[ia("strong",{children:"TicketResolver"}),": RAG resolver that can plug into any knowledge retriever."]}),Pa("li",{children:[ia("strong",{children:"AutoResponder"}),": generates drafts, citations, and tone-aware copy."]}),Pa("li",{children:[ia("strong",{children:"SupportFeedbackLoop"}),": track auto-resolution rates and sentiment trends."]})]})]}),Pa("div",{className:"flex items-center gap-4 pt-4",children:[ia(_c,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Pa(_c,{href:"/docs/libraries/growth",className:"btn-primary",children:["Next: Growth ",ia(Mu,{size:16})]})]})]})}import{CodeBlock as yr,InstallCommand as Uu}from"@contractspec/lib.design-system";import zc from"@contractspec/lib.ui-link";import{ChevronRight as Wu}from"lucide-react";import{jsx as ra,jsxs as fo}from"react/jsx-runtime";function _u(){return fo("div",{className:"space-y-8",children:[fo("div",{className:"space-y-4",children:[ra("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.testing"}),ra("p",{className:"text-lg text-muted-foreground",children:"Golden tests ensure new rollouts behave exactly like the traffic that inspired them. Record requests in production, replay them locally, and ship with confidence."})]}),fo("div",{className:"space-y-4",children:[ra("h2",{className:"font-bold text-2xl",children:"Installation"}),ra(Uu,{package:"@contractspec/lib.testing"})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Record traffic"}),ra(yr,{language:"typescript",code:`import {
4186
4186
  TrafficRecorder,
4187
4187
  InMemoryTrafficStore,
4188
4188
  } from '@contractspec/lib.testing/recorder';
@@ -4202,7 +4202,7 @@ await recorder.record({
4202
4202
  output,
4203
4203
  success: true,
4204
4204
  tenantId: ctx.organizationId ?? undefined,
4205
- });`})]}),ho("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Generate suites"}),ra(yr,{language:"typescript",code:`import { GoldenTestGenerator } from '@contractspec/lib.testing';
4205
+ });`})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Generate suites"}),ra(yr,{language:"typescript",code:`import { GoldenTestGenerator } from '@contractspec/lib.testing';
4206
4206
 
4207
4207
  const generator = new GoldenTestGenerator();
4208
4208
  const code = generator.generate(snapshots, {
@@ -4210,7 +4210,7 @@ const code = generator.generate(snapshots, {
4210
4210
  runnerImport: './tests/run-operation',
4211
4211
  runnerFunction: 'runOrdersCommand',
4212
4212
  framework: 'vitest',
4213
- });`})]}),ho("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"CLI workflow"}),ra(yr,{language:"bash",code:"contractspec test generate \\\n --operation orders.create \\\n --output tests/orders.create.golden.test.ts \\\n --runner-import ./tests/run-operation \\\n --runner-fn runOrdersCommand \\\n --from-production \\\n --days 7 \\\n --sample-rate 0.05"})]}),ra("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Framework agnostic",description:"Vitest by default, Jest via `generateJestSuite`, or call `runGoldenTests` manually inside CI."},{title:"Sanitize & sample",description:"Scrub payloads before persistence and control sample rates per operation to stay within compliance limits."}].map((e)=>ho("div",{className:"card-subtle space-y-2 p-4",children:[ra("h3",{className:"font-semibold text-lg",children:e.title}),ra("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))}),ho("div",{className:"flex items-center gap-4 pt-4",children:[ra(zc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),ho(zc,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",ra(Wu,{size:16})]})]})]})}import{CodeBlock as zu,InstallCommand as Gu}from"@contractspec/lib.design-system";import Mi from"@contractspec/lib.ui-link";import{ChevronRight as Hu}from"lucide-react";import{jsx as z,jsxs as Pe}from"react/jsx-runtime";var qu=`import { DataTable } from '@contractspec/lib.ui-kit/ui/data-table';
4213
+ });`})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"CLI workflow"}),ra(yr,{language:"bash",code:"contractspec test generate \\\n --operation orders.create \\\n --output tests/orders.create.golden.test.ts \\\n --runner-import ./tests/run-operation \\\n --runner-fn runOrdersCommand \\\n --from-production \\\n --days 7 \\\n --sample-rate 0.05"})]}),ra("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Framework agnostic",description:"Vitest by default, Jest via `generateJestSuite`, or call `runGoldenTests` manually inside CI."},{title:"Sanitize & sample",description:"Scrub payloads before persistence and control sample rates per operation to stay within compliance limits."}].map((e)=>fo("div",{className:"card-subtle space-y-2 p-4",children:[ra("h3",{className:"font-semibold text-lg",children:e.title}),ra("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))}),fo("div",{className:"flex items-center gap-4 pt-4",children:[ra(zc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),fo(zc,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",ra(Wu,{size:16})]})]})]})}import{CodeBlock as zu,InstallCommand as Gu}from"@contractspec/lib.design-system";import Mi from"@contractspec/lib.ui-link";import{ChevronRight as qu}from"lucide-react";import{jsx as z,jsxs as Pe}from"react/jsx-runtime";var Vu=`import { DataTable } from '@contractspec/lib.ui-kit/ui/data-table';
4214
4214
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
4215
4215
 
4216
4216
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -4254,7 +4254,7 @@ export function NativeAccountGrid() {
4254
4254
  footer={\`Rows \${controller.rows.length}\`}
4255
4255
  />
4256
4256
  );
4257
- }`;function Vu(){return Pe("div",{className:"space-y-8",children:[Pe("div",{className:"space-y-4",children:[z("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit"}),Pe("p",{className:"text-muted-foreground",children:["Universal UI components for React Native and Web, built on top of",z("code",{children:"nativewind"})," and ",z("code",{children:"@rn-primitives"}),"."]})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Installation"}),z(Gu,{package:"@contractspec/lib.ui-kit"})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Key Features"}),Pe("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Pe("li",{children:[z("strong",{children:"Universal"}),": Components render natively on iOS/Android and as standard HTML on web"]}),Pe("li",{children:[z("strong",{children:"Styled with NativeWind"}),": Uses Tailwind CSS classes for styling"]}),Pe("li",{children:[z("strong",{children:"Accessible"}),": Leverages ",z("code",{children:"@rn-primitives"})," ","(Radix UI for Native)"]}),Pe("li",{children:[z("strong",{children:"Atomic Design"}),": Exports atoms, molecules, and organisms"]})]})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Data table example"}),Pe("p",{className:"text-muted-foreground",children:["The canonical"," ",z(Mi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"})," ","uses ",z("code",{children:"@contractspec/lib.ui-kit/ui/data-table"})," as the native-first primitive lane. It shares the same controller model as the web renderer while keeping the React Native / Expo surface explicit."]}),z(zu,{language:"tsx",code:qu})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Core Components"}),Pe("div",{className:"grid gap-4 md:grid-cols-3",children:[Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Form Controls"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Button"}),z("li",{children:"Input"}),z("li",{children:"Checkbox"}),z("li",{children:"Switch"}),z("li",{children:"Select"})]})]}),Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Layout"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Card"}),z("li",{children:"Stack"}),z("li",{children:"Separator"}),z("li",{children:"Sheet"})]})]}),Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Feedback"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Alert"}),z("li",{children:"Skeleton"}),z("li",{children:"Progress"}),z("li",{children:"Tooltip"})]})]})]})]}),Pe("div",{className:"card-subtle space-y-3 p-6",children:[z("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),Pe("p",{className:"text-muted-foreground",children:["Read"," ",z(Mi,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the full React and React Native compatibility model around this native-first primitive lane."]})]}),Pe("div",{className:"flex items-center gap-4 pt-4",children:[z(Mi,{href:"/docs/libraries/schema",className:"btn-ghost",children:"Previous: Schema"}),Pe(Mi,{href:"/docs/libraries/ui-kit-web",className:"btn-primary",children:["Next: UI Kit Web ",z(Hu,{size:16})]})]})]})}import{CodeBlock as Fu,InstallCommand as Ku}from"@contractspec/lib.design-system";import Bi from"@contractspec/lib.ui-link";import{ChevronRight as Qu}from"lucide-react";import{jsx as na,jsxs as Fa}from"react/jsx-runtime";var Yu=`import { DataTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
4257
+ }`;function Hu(){return Pe("div",{className:"space-y-8",children:[Pe("div",{className:"space-y-4",children:[z("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit"}),Pe("p",{className:"text-muted-foreground",children:["Universal UI components for React Native and Web, built on top of",z("code",{children:"nativewind"})," and ",z("code",{children:"@rn-primitives"}),"."]})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Installation"}),z(Gu,{package:"@contractspec/lib.ui-kit"})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Key Features"}),Pe("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Pe("li",{children:[z("strong",{children:"Universal"}),": Components render natively on iOS/Android and as standard HTML on web"]}),Pe("li",{children:[z("strong",{children:"Styled with NativeWind"}),": Uses Tailwind CSS classes for styling"]}),Pe("li",{children:[z("strong",{children:"Accessible"}),": Leverages ",z("code",{children:"@rn-primitives"})," ","(Radix UI for Native)"]}),Pe("li",{children:[z("strong",{children:"Atomic Design"}),": Exports atoms, molecules, and organisms"]})]})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Data table example"}),Pe("p",{className:"text-muted-foreground",children:["The canonical"," ",z(Mi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"})," ","uses ",z("code",{children:"@contractspec/lib.ui-kit/ui/data-table"})," as the native-first primitive lane. It shares the same controller model as the web renderer while keeping the React Native / Expo surface explicit."]}),z(zu,{language:"tsx",code:Vu})]}),Pe("div",{className:"space-y-4",children:[z("h2",{className:"font-bold text-2xl",children:"Core Components"}),Pe("div",{className:"grid gap-4 md:grid-cols-3",children:[Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Form Controls"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Button"}),z("li",{children:"Input"}),z("li",{children:"Checkbox"}),z("li",{children:"Switch"}),z("li",{children:"Select"})]})]}),Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Layout"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Card"}),z("li",{children:"Stack"}),z("li",{children:"Separator"}),z("li",{children:"Sheet"})]})]}),Pe("div",{className:"card-subtle p-4",children:[z("h3",{className:"mb-2 font-semibold",children:"Feedback"}),Pe("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[z("li",{children:"Alert"}),z("li",{children:"Skeleton"}),z("li",{children:"Progress"}),z("li",{children:"Tooltip"})]})]})]})]}),Pe("div",{className:"card-subtle space-y-3 p-6",children:[z("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),Pe("p",{className:"text-muted-foreground",children:["Read"," ",z(Mi,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the full React and React Native compatibility model around this native-first primitive lane."]})]}),Pe("div",{className:"flex items-center gap-4 pt-4",children:[z(Mi,{href:"/docs/libraries/schema",className:"btn-ghost",children:"Previous: Schema"}),Pe(Mi,{href:"/docs/libraries/ui-kit-web",className:"btn-primary",children:["Next: UI Kit Web ",z(qu,{size:16})]})]})]})}import{CodeBlock as Fu,InstallCommand as Ku}from"@contractspec/lib.design-system";import Bi from"@contractspec/lib.ui-link";import{ChevronRight as Qu}from"lucide-react";import{jsx as na,jsxs as Fa}from"react/jsx-runtime";var Yu=`import { DataTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
4258
4258
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
4259
4259
 
4260
4260
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -4299,7 +4299,7 @@ export function WebAccountGrid() {
4299
4299
  footer={\`Rows \${controller.totalItems}\`}
4300
4300
  />
4301
4301
  );
4302
- }`;function Ju(){return Fa("div",{className:"space-y-8",children:[Fa("div",{className:"space-y-4",children:[na("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit-web"}),na("p",{className:"text-muted-foreground",children:"Web-first React and Next primitives for ContractSpec. The canonical data-table example uses this package to render the raw browser table layer directly, without the design-system shell on top."})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"Installation"}),na(Ku,{package:"@contractspec/lib.ui-kit-web"})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"Data table example"}),Fa("p",{className:"text-muted-foreground",children:["This is the raw browser lane from the canonical"," ",na(Bi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". It demonstrates the primitive renderer with sorting, pagination, single selection, column visibility, column resizing, left/right pinning, row expansion, loading, and empty-state slots."]}),na(Fu,{language:"tsx",filename:"web-account-grid.tsx",code:Yu})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"What this layer owns"}),Fa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[na("li",{children:"The raw table renderer and browser interaction model."}),na("li",{children:"Pagination, column visibility menus, pin menus, resize handles, and empty/loading states."}),na("li",{children:"Accessibility helpers and other web-specific primitives that stay outside the native-first package."})]})]}),Fa("div",{className:"card-subtle space-y-3 p-6",children:[na("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),Fa("p",{className:"text-muted-foreground",children:["Read"," ",na(Bi,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the shared runtime story behind the web and native render lanes."]})]}),Fa("div",{className:"flex items-center gap-4 pt-4",children:[na(Bi,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"Previous: UI Kit"}),Fa(Bi,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Next: Design System ",na(Qu,{size:16})]})]})]})}import{CodeBlock as Gc,InstallCommand as Zu}from"@contractspec/lib.design-system";import Hc from"@contractspec/lib.ui-link";import{ChevronRight as $u}from"lucide-react";import{jsx as ro,jsxs as qo}from"react/jsx-runtime";function Xu(){return qo("div",{className:"space-y-8",children:[qo("div",{className:"space-y-4",children:[ro("h1",{className:"font-bold text-4xl",children:"Workflow Composer"}),ro("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."})]}),qo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Installation"}),ro(Zu,{package:"@contractspec/lib.workflow-composer"})]}),qo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Register extensions"}),ro(Gc,{language:"typescript",code:`const composer = new WorkflowComposer();
4302
+ }`;function Ju(){return Fa("div",{className:"space-y-8",children:[Fa("div",{className:"space-y-4",children:[na("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.ui-kit-web"}),na("p",{className:"text-muted-foreground",children:"Web-first React and Next primitives for ContractSpec. The canonical data-table example uses this package to render the raw browser table layer directly, without the design-system shell on top."})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"Installation"}),na(Ku,{package:"@contractspec/lib.ui-kit-web"})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"Data table example"}),Fa("p",{className:"text-muted-foreground",children:["This is the raw browser lane from the canonical"," ",na(Bi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),". It demonstrates the primitive renderer with sorting, pagination, single selection, column visibility, column resizing, left/right pinning, row expansion, loading, and empty-state slots."]}),na(Fu,{language:"tsx",filename:"web-account-grid.tsx",code:Yu})]}),Fa("div",{className:"space-y-4",children:[na("h2",{className:"font-bold text-2xl",children:"What this layer owns"}),Fa("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[na("li",{children:"The raw table renderer and browser interaction model."}),na("li",{children:"Pagination, column visibility menus, pin menus, resize handles, and empty/loading states."}),na("li",{children:"Accessibility helpers and other web-specific primitives that stay outside the native-first package."})]})]}),Fa("div",{className:"card-subtle space-y-3 p-6",children:[na("h2",{className:"font-bold text-2xl",children:"Where this layer fits"}),Fa("p",{className:"text-muted-foreground",children:["Read"," ",na(Bi,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the shared runtime story behind the web and native render lanes."]})]}),Fa("div",{className:"flex items-center gap-4 pt-4",children:[na(Bi,{href:"/docs/libraries/ui-kit",className:"btn-ghost",children:"Previous: UI Kit"}),Fa(Bi,{href:"/docs/libraries/design-system",className:"btn-primary",children:["Next: Design System ",na(Qu,{size:16})]})]})]})}import{CodeBlock as Gc,InstallCommand as Zu}from"@contractspec/lib.design-system";import qc from"@contractspec/lib.ui-link";import{ChevronRight as Xu}from"lucide-react";import{jsx as ro,jsxs as Vo}from"react/jsx-runtime";function $u(){return Vo("div",{className:"space-y-8",children:[Vo("div",{className:"space-y-4",children:[ro("h1",{className:"font-bold text-4xl",children:"Workflow Composer"}),ro("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."})]}),Vo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Installation"}),ro(Zu,{package:"@contractspec/lib.workflow-composer"})]}),Vo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Register extensions"}),ro(Gc,{language:"typescript",code:`const composer = new WorkflowComposer();
4303
4303
 
4304
4304
  composer.register({
4305
4305
  workflow: 'billing.invoiceApproval',
@@ -4316,12 +4316,12 @@ composer.register({
4316
4316
  },
4317
4317
  ],
4318
4318
  hiddenSteps: ['internal-audit'],
4319
- });`})]}),qo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),ro(Gc,{language:"typescript",code:`const tenantWorkflow = composer.compose({
4319
+ });`})]}),Vo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),ro(Gc,{language:"typescript",code:`const tenantWorkflow = composer.compose({
4320
4320
  base: BaseInvoiceWorkflow,
4321
4321
  tenantId: 'acme',
4322
4322
  });
4323
4323
 
4324
- workflowRunner.execute(tenantWorkflow, ctx);`})]}),qo("div",{className:"flex items-center gap-4 pt-4",children:[ro(Hc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),qo(Hc,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",ro($u,{size:16})]})]})]})}import{CodeBlock as xu,InstallCommand as ju}from"@contractspec/lib.design-system";import qc from"@contractspec/lib.ui-link";import{ChevronRight as eg}from"lucide-react";import{jsx as ae,jsxs as va}from"react/jsx-runtime";function tg(){return va("div",{className:"space-y-8",children:[va("div",{className:"space-y-4",children:[ae("h1",{className:"font-bold text-4xl",children:"Workflow Runtime Library"}),va("p",{className:"text-lg text-muted-foreground",children:["The ",ae("code",{children:"@contractspec/lib.contracts-spec/workflow"})," library provides the core ",ae("code",{children:"WorkflowRunner"})," for executing stateful, durable workflows."]})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"Installation"}),ae(ju,{package:"@contractspec/lib.contracts-spec"})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"WorkflowRunner"}),ae("p",{className:"text-muted-foreground",children:"The runner manages execution state, step transitions, retries, and compensation."}),ae(xu,{language:"typescript",code:`import { WorkflowRunner } from '@contractspec/lib.contracts-spec/workflow/runner';
4324
+ workflowRunner.execute(tenantWorkflow, ctx);`})]}),Vo("div",{className:"flex items-center gap-4 pt-4",children:[ro(qc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Vo(qc,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",ro(Xu,{size:16})]})]})]})}import{CodeBlock as xu,InstallCommand as ju}from"@contractspec/lib.design-system";import Vc from"@contractspec/lib.ui-link";import{ChevronRight as eg}from"lucide-react";import{jsx as ae,jsxs as va}from"react/jsx-runtime";function tg(){return va("div",{className:"space-y-8",children:[va("div",{className:"space-y-4",children:[ae("h1",{className:"font-bold text-4xl",children:"Workflow Runtime Library"}),va("p",{className:"text-lg text-muted-foreground",children:["The ",ae("code",{children:"@contractspec/lib.contracts-spec/workflow"})," library provides the core ",ae("code",{children:"WorkflowRunner"})," for executing stateful, durable workflows."]})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"Installation"}),ae(ju,{package:"@contractspec/lib.contracts-spec"})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"WorkflowRunner"}),ae("p",{className:"text-muted-foreground",children:"The runner manages execution state, step transitions, retries, and compensation."}),ae(xu,{language:"typescript",code:`import { WorkflowRunner } from '@contractspec/lib.contracts-spec/workflow/runner';
4325
4325
  import { InMemoryStateStore } from '@contractspec/lib.contracts-spec/workflow/adapters/memory-store';
4326
4326
  import { WorkflowRegistry } from '@contractspec/lib.contracts-spec/workflow/spec';
4327
4327
 
@@ -4341,7 +4341,7 @@ const runner = new WorkflowRunner({
4341
4341
  const workflowId = await runner.start('my.workflow', 1, { userId: '123' });
4342
4342
 
4343
4343
  // Execute next step (usually called by a worker or queue consumer)
4344
- await runner.executeStep(workflowId);`})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"State Persistence"}),va("p",{className:"text-muted-foreground",children:["The runner relies on a ",ae("code",{children:"StateStore"})," to persist workflow execution history. ContractSpec ships with:"]}),va("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[va("li",{children:[ae("code",{children:"InMemoryStateStore"})," - for testing and development."]}),va("li",{children:[ae("code",{children:"PrismaStateStore"})," - for production using Prisma ORM."]})]})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"Events"}),ae("p",{className:"text-muted-foreground",children:"The runner emits events that you can subscribe to for monitoring:"}),va("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[ae("li",{children:ae("code",{children:"workflow.started"})}),ae("li",{children:ae("code",{children:"workflow.step_completed"})}),ae("li",{children:ae("code",{children:"workflow.step_failed"})}),ae("li",{children:ae("code",{children:"workflow.step_retrying"})}),ae("li",{children:ae("code",{children:"workflow.completed"})}),ae("li",{children:ae("code",{children:"workflow.cancelled"})}),ae("li",{children:ae("code",{children:"workflow.compensation_step_completed"})})]})]}),va("div",{className:"flex items-center gap-4 pt-4",children:[ae(qc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),va(qc,{href:"/docs/libraries/data-views",className:"btn-primary",children:["Next: Data Views ",ae(eg,{size:16})]})]})]})}import{jsx as Ka,jsxs as Vo}from"react/jsx-runtime";function ag(){return Vo("div",{className:"space-y-8",children:[Vo("div",{className:"space-y-3",children:[Ka("p",{className:"editorial-kicker",children:"Why ContractSpec"}),Ka("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Open system, explicit contracts, incremental adoption."}),Ka("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec exists to make AI-native software more legible and more governable. The system should help teams express durable boundaries, keep generated surfaces aligned, and still own the code and contracts they ship."})]}),Vo("div",{className:"space-y-6",children:[Vo("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Open system, not closed platform"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"The OSS layer should remain useful on its own. Teams need explicit contracts, readable code, and outputs they can keep. Studio can sit on top of that system, but it should never be the only way to own or understand the behavior."})]}),Vo("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Contracts before surface sprawl"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"AI tooling accelerates surface creation faster than most teams can govern it. The answer is not more hidden glue. The answer is a durable contract layer that keeps API, UI, data, workflows, and operator behavior aligned."})]}),Vo("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Incremental adoption wins"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"Most teams already have a codebase. The practical path is to stabilize one boundary at a time, prove the loop, and grow from there. That is why the docs and product should lead with one module, one endpoint, one workflow, one unsafe surface at a time."})]}),Vo("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Studio should stay additive"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"The best operating product can and should exist on top of the open system. But the OSS foundation must remain strong enough that technical adopters trust it before they ever adopt Studio."})]})]})]})}import{jsx as Ze,jsxs as Mo}from"react/jsx-runtime";function og(){return Mo("div",{className:"space-y-8",children:[Mo("div",{className:"space-y-4",children:[Ze("h1",{className:"font-bold text-4xl",children:"Auto-Evolution Runbook"}),Ze("p",{className:"text-lg text-muted-foreground",children:"Configure sampling, approvals, experiments, and golden tests so your app keeps improving without regressions."})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Pipeline overview"}),Mo("ol",{className:"list-decimal space-y-2 pl-6 text-muted-foreground text-sm",children:[Ze("li",{children:"Tracing middleware emits telemetry samples with tenant/user context."}),Ze("li",{children:"IntentAggregator batches samples (15m window, configurable)."}),Ze("li",{children:"IntentDetector raises error/latency/throughput signals."}),Ze("li",{children:"SpecGenerator produces proposals with confidence scores."}),Ze("li",{children:"ApprovalWorkflow routes low-confidence suggestions to humans."}),Ze("li",{children:"SpecExperimentRegistry rolls out approved variants using guardrails."}),Ze("li",{children:"TrafficRecorder captures new traffic and GoldenTestGenerator outputs suites."})]})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Key environment variables"}),Ze("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`# Telemetry sampling
4344
+ await runner.executeStep(workflowId);`})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"State Persistence"}),va("p",{className:"text-muted-foreground",children:["The runner relies on a ",ae("code",{children:"StateStore"})," to persist workflow execution history. ContractSpec ships with:"]}),va("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[va("li",{children:[ae("code",{children:"InMemoryStateStore"})," - for testing and development."]}),va("li",{children:[ae("code",{children:"PrismaStateStore"})," - for production using Prisma ORM."]})]})]}),va("div",{className:"space-y-4",children:[ae("h2",{className:"font-bold text-2xl",children:"Events"}),ae("p",{className:"text-muted-foreground",children:"The runner emits events that you can subscribe to for monitoring:"}),va("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[ae("li",{children:ae("code",{children:"workflow.started"})}),ae("li",{children:ae("code",{children:"workflow.step_completed"})}),ae("li",{children:ae("code",{children:"workflow.step_failed"})}),ae("li",{children:ae("code",{children:"workflow.step_retrying"})}),ae("li",{children:ae("code",{children:"workflow.completed"})}),ae("li",{children:ae("code",{children:"workflow.cancelled"})}),ae("li",{children:ae("code",{children:"workflow.compensation_step_completed"})})]})]}),va("div",{className:"flex items-center gap-4 pt-4",children:[ae(Vc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),va(Vc,{href:"/docs/libraries/data-views",className:"btn-primary",children:["Next: Data Views ",ae(eg,{size:16})]})]})]})}import{jsx as Ka,jsxs as Ho}from"react/jsx-runtime";function ag(){return Ho("div",{className:"space-y-8",children:[Ho("div",{className:"space-y-3",children:[Ka("p",{className:"editorial-kicker",children:"Why ContractSpec"}),Ka("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Open system, explicit contracts, incremental adoption."}),Ka("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec exists to make AI-native software more legible and more governable. The system should help teams express durable boundaries, keep generated surfaces aligned, and still own the code and contracts they ship."})]}),Ho("div",{className:"space-y-6",children:[Ho("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Open system, not closed platform"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"The OSS layer should remain useful on its own. Teams need explicit contracts, readable code, and outputs they can keep. Studio can sit on top of that system, but it should never be the only way to own or understand the behavior."})]}),Ho("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Contracts before surface sprawl"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"AI tooling accelerates surface creation faster than most teams can govern it. The answer is not more hidden glue. The answer is a durable contract layer that keeps API, UI, data, workflows, and operator behavior aligned."})]}),Ho("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Incremental adoption wins"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"Most teams already have a codebase. The practical path is to stabilize one boundary at a time, prove the loop, and grow from there. That is why the docs and product should lead with one module, one endpoint, one workflow, one unsafe surface at a time."})]}),Ho("section",{className:"editorial-panel space-y-3",children:[Ka("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Studio should stay additive"}),Ka("p",{className:"text-muted-foreground text-sm leading-7",children:"The best operating product can and should exist on top of the open system. But the OSS foundation must remain strong enough that technical adopters trust it before they ever adopt Studio."})]})]})]})}import{jsx as Ze,jsxs as Mo}from"react/jsx-runtime";function og(){return Mo("div",{className:"space-y-8",children:[Mo("div",{className:"space-y-4",children:[Ze("h1",{className:"font-bold text-4xl",children:"Auto-Evolution Runbook"}),Ze("p",{className:"text-lg text-muted-foreground",children:"Configure sampling, approvals, experiments, and golden tests so your app keeps improving without regressions."})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Pipeline overview"}),Mo("ol",{className:"list-decimal space-y-2 pl-6 text-muted-foreground text-sm",children:[Ze("li",{children:"Tracing middleware emits telemetry samples with tenant/user context."}),Ze("li",{children:"IntentAggregator batches samples (15m window, configurable)."}),Ze("li",{children:"IntentDetector raises error/latency/throughput signals."}),Ze("li",{children:"SpecGenerator produces proposals with confidence scores."}),Ze("li",{children:"ApprovalWorkflow routes low-confidence suggestions to humans."}),Ze("li",{children:"SpecExperimentRegistry rolls out approved variants using guardrails."}),Ze("li",{children:"TrafficRecorder captures new traffic and GoldenTestGenerator outputs suites."})]})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Key environment variables"}),Ze("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`# Telemetry sampling
4345
4345
  AUTO_EVOLUTION_SAMPLE_RATE=0.02
4346
4346
  AUTO_EVOLUTION_WINDOW_MS=900000
4347
4347
 
@@ -4351,15 +4351,15 @@ AUTO_EVOLUTION_AUTO_APPROVE=0.2
4351
4351
 
4352
4352
  # Guardrails (fallback defaults)
4353
4353
  AUTO_EVOLUTION_MAX_ERROR_RATE=0.02
4354
- AUTO_EVOLUTION_MAX_P99_MS=500`})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Operations checklist"}),Mo("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground text-sm",children:[Ze("li",{children:"Review new `SpecSuggestion` records every morning (UI coming soon; Prisma view today)."}),Ze("li",{children:"Keep at least one reviewer per domain on-call for approvals."}),Ze("li",{children:"Attach `SpecExperimentAdapter.trackOutcome` to every runtime adapter."}),Ze("li",{children:"Schedule `contractspec test generate` nightly (or on deploy) to refresh golden suites."}),Ze("li",{children:"Feed `runGoldenTests` into CI to gate merges touching evolved specs."})]})]}),Ze("div",{className:"grid gap-4 md:grid-cols-3",children:[{title:"Sampling",description:"Start at 1–2% of traffic. Increase only after sanitization is verified."},{title:"Approvals",description:"High-risk ops (money, compliance) should never auto-approve. Use ApprovalWorkflow notes for audit."},{title:"On-call alerts",description:"Tie SpecExperimentController rollbacks into PagerDuty/Slack so engineers see guardrail trips immediately."}].map((e)=>Mo("div",{className:"card-subtle space-y-2 p-4",children:[Ze("h3",{className:"font-semibold text-lg",children:e.title}),Ze("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))})]})}import{jsx as Qa,jsxs as fi}from"react/jsx-runtime";function ig(){return fi("div",{className:"space-y-8",children:[fi("div",{className:"space-y-4",children:[Qa("h1",{className:"font-bold text-4xl",children:"Distributed Tracing"}),Qa("p",{className:"text-lg text-muted-foreground",children:"ContractSpec uses OpenTelemetry (OTel) for distributed tracing. This guide explains how to configure exporters and collectors."})]}),fi("div",{className:"space-y-4",children:[Qa("h2",{className:"font-bold text-2xl",children:"Configuration"}),Qa("p",{children:"Configure the OTel SDK via environment variables:"}),Qa("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`OTEL_SERVICE_NAME=my-service
4354
+ AUTO_EVOLUTION_MAX_P99_MS=500`})]}),Mo("div",{className:"space-y-3",children:[Ze("h2",{className:"font-bold text-2xl",children:"Operations checklist"}),Mo("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground text-sm",children:[Ze("li",{children:"Review new `SpecSuggestion` records every morning (UI coming soon; Prisma view today)."}),Ze("li",{children:"Keep at least one reviewer per domain on-call for approvals."}),Ze("li",{children:"Attach `SpecExperimentAdapter.trackOutcome` to every runtime adapter."}),Ze("li",{children:"Schedule `contractspec test generate` nightly (or on deploy) to refresh golden suites."}),Ze("li",{children:"Feed `runGoldenTests` into CI to gate merges touching evolved specs."})]})]}),Ze("div",{className:"grid gap-4 md:grid-cols-3",children:[{title:"Sampling",description:"Start at 1–2% of traffic. Increase only after sanitization is verified."},{title:"Approvals",description:"High-risk ops (money, compliance) should never auto-approve. Use ApprovalWorkflow notes for audit."},{title:"On-call alerts",description:"Tie SpecExperimentController rollbacks into PagerDuty/Slack so engineers see guardrail trips immediately."}].map((e)=>Mo("div",{className:"card-subtle space-y-2 p-4",children:[Ze("h3",{className:"font-semibold text-lg",children:e.title}),Ze("p",{className:"text-muted-foreground text-sm",children:e.description})]},e.title))})]})}import{jsx as Qa,jsxs as hi}from"react/jsx-runtime";function ig(){return hi("div",{className:"space-y-8",children:[hi("div",{className:"space-y-4",children:[Qa("h1",{className:"font-bold text-4xl",children:"Distributed Tracing"}),Qa("p",{className:"text-lg text-muted-foreground",children:"ContractSpec uses OpenTelemetry (OTel) for distributed tracing. This guide explains how to configure exporters and collectors."})]}),hi("div",{className:"space-y-4",children:[Qa("h2",{className:"font-bold text-2xl",children:"Configuration"}),Qa("p",{children:"Configure the OTel SDK via environment variables:"}),Qa("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`OTEL_SERVICE_NAME=my-service
4355
4355
  OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
4356
4356
  OTEL_TRACES_SAMPLER=parentbased_traceidratio
4357
- OTEL_TRACES_SAMPLER_ARG=0.1`})]}),fi("div",{className:"space-y-4",children:[Qa("h2",{className:"font-bold text-2xl",children:"Exporters"}),Qa("p",{children:"By default, the OTLP exporter is used. You can point it to:"}),fi("ul",{className:"list-disc space-y-2 pl-6",children:[Qa("li",{children:"Jaeger"}),Qa("li",{children:"Tempo (Grafana)"}),Qa("li",{children:"Honeycomb"}),Qa("li",{children:"Datadog (via OTel Collector)"})]})]})]})}import{DocsIndexDataView as rg,DocsSearchForm as ng}from"@contractspec/lib.contracts-spec/docs";import{DataViewList as cg,formRenderer as lg,StatusChip as vr}from"@contractspec/lib.design-system";import{HStack as sg,VStack as br}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as dg,Muted as Vc}from"@contractspec/lib.ui-kit-web/ui/typography";import{useMemo as Fc,useState as pg}from"react";import{jsx as Bo,jsxs as Nr}from"react/jsx-runtime";function mg(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4357
+ OTEL_TRACES_SAMPLER_ARG=0.1`})]}),hi("div",{className:"space-y-4",children:[Qa("h2",{className:"font-bold text-2xl",children:"Exporters"}),Qa("p",{children:"By default, the OTLP exporter is used. You can point it to:"}),hi("ul",{className:"list-disc space-y-2 pl-6",children:[Qa("li",{children:"Jaeger"}),Qa("li",{children:"Tempo (Grafana)"}),Qa("li",{children:"Honeycomb"}),Qa("li",{children:"Datadog (via OTel Collector)"})]})]})]})}import{DocsIndexDataView as rg,DocsSearchForm as ng}from"@contractspec/lib.contracts-spec/docs";import{DataViewList as cg,formRenderer as lg,StatusChip as vr}from"@contractspec/lib.design-system";import{HStack as sg,VStack as br}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as dg,Muted as Hc}from"@contractspec/lib.ui-kit-web/ui/typography";import{useMemo as Fc,useState as pg}from"react";import{jsx as Bo,jsxs as Nr}from"react/jsx-runtime";function mg(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4358
4358
 
4359
- `).trim()}function ug(e){let t=mg(e.summary),o=e.kind??(e.source==="generated"?"reference":void 0),n=e.visibility??(e.source==="generated"?"public":void 0);return{...e,summary:t,kind:o,visibility:n}}function gg(e,t){if(!t)return!0;return[e.title,e.summary,e.id,...e.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(t.toLowerCase())}function Kc({entries:e}){let[t,o]=pg({}),n=Fc(()=>e.map(ug),[e]),Nt=Fc(()=>{let $e=t.query?.trim()??"";return n.filter((ie)=>{if(t.kind&&ie.kind!==t.kind)return!1;if(t.visibility&&ie.visibility!==t.visibility)return!1;return gg(ie,$e)})},[t,n]),Ne=lg.render(ng,{defaultValues:{query:t.query??"",visibility:t.visibility??"",kind:t.kind??""},overrides:{onSubmitOverride:($e)=>{let ie=$e;o({query:ie.query??"",visibility:ie.visibility??"",kind:ie.kind??""})}}});return Nr(br,{gap:"xl",children:[Nr(br,{gap:"sm",children:[Bo(dg,{children:"Reference"}),Bo(Vc,{children:"Generated reference material for public contract surfaces, versions, owners, and example-backed implementations. Use this when you need the repo truth, not just the narrative docs layer."})]}),Bo(br,{gap:"sm",className:"max-w-2xl",children:Ne}),Bo(cg,{spec:rg,items:Nt,emptyState:Bo(Vc,{children:"No reference docs match your filters."}),onSelect:($e)=>{if($e.route)window.location.assign($e.route)},renderActions:($e)=>{return Nr(sg,{gap:"xs",justify:"end",children:[$e.kind?Bo(vr,{size:"sm",label:$e.kind}):null,$e.visibility?Bo(vr,{size:"sm",label:$e.visibility}):null,$e.version?Bo(vr,{size:"sm",label:`v${$e.version}`}):null]})}})]})}import{jsx as hg}from"react/jsx-runtime";async function fg(){let e=await tn();return hg(Kc,{entries:e})}var yg=/^##\s+Metadata[\s\S]*?(?=^##\s|^#\s|Z)/m;function vg(e){return e.replace(/^#\s+.*\n+/m,"").replace(yg,"")}function Qc(e){return/^#{1,4}\s+/.test(e)||/^```/.test(e)||/^\s*[-*]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)||/^>\s+/.test(e)}function Yc(e){let t=vg(e).split(/\r?\n/),o=[],n=0;while(n<t.length){let Nt=t[n]??"";if(Nt.startsWith("<!-- @generated")){n+=1;continue}let Ne=Nt.trim();if(!Ne){n+=1;continue}if(Ne.startsWith("```")){let ie=Ne.slice(3).trim(),bo=[];n+=1;while(n<t.length&&!(t[n]??"").trim().startsWith("```"))bo.push(t[n]??""),n+=1;n+=1,o.push({type:"code",language:ie||"text",code:bo.join(`
4360
- `)});continue}if(/^#{1,4}\s+/.test(Ne)){let ie=Ne.match(/^#{1,4}/)?.[0].length??2;o.push({type:"heading",level:ie,text:Ne.replace(/^#{1,4}\s+/,"")}),n+=1;continue}if(/^>\s+/.test(Ne)){let ie=[];while(n<t.length&&/^>\s+/.test((t[n]??"").trim()))ie.push((t[n]??"").trim().replace(/^>\s+/,"")),n+=1;o.push({type:"quote",text:ie.join(" ")});continue}if(/^[-*]\s+/.test(Ne)||/^\d+\.\s+/.test(Ne)){let ie=/^\d+\.\s+/.test(Ne),bo=[];while(n<t.length&&Qc((t[n]??"").trim())){let Qo=(t[n]??"").trim();if(ie&&/^\d+\.\s+/.test(Qo))bo.push(Qo.replace(/^\d+\.\s+/,""));else if(!ie&&/^[-*]\s+/.test(Qo))bo.push(Qo.replace(/^[-*]\s+/,""));else break;n+=1}o.push({type:"list",ordered:ie,items:bo});continue}let $e=[];while(n<t.length&&!Qc((t[n]??"").trim())){let ie=(t[n]??"").trim();if(!ie)break;$e.push(ie),n+=1}o.push({type:"paragraph",text:$e.join(" ")})}return o}import{CodeBlock as bg}from"@contractspec/lib.design-system";import{HStack as Ng,VStack as wr}from"@contractspec/lib.ui-kit-web/ui/stack";import{BlockQuote as wg,H2 as kg,H3 as Sg,H4 as Cg,Muted as Jc,P as Zc}from"@contractspec/lib.ui-kit-web/ui/typography";import{jsx as Ua,jsxs as Ag}from"react/jsx-runtime";var Ig=new Set(["typescript","tsx","javascript","jsx","bash","shell","json","yaml","graphql","sql","python","go","rust","css","scss","html","markdown","text"]);function Pg(e){if(!e)return"text";let t=e.toLowerCase();return Ig.has(t)?t:"text"}function Tg(e,t){if(e<=2)return Ua(kg,{children:t});if(e===3)return Ua(Sg,{children:t});return Ua(Cg,{children:t})}function $c({content:e}){let t=Yc(e);if(!t.length)return Ua(Jc,{children:"No reference content available."});return Ua(wr,{gap:"md",children:t.map((o,n)=>{switch(o.type){case"heading":return Ua(wr,{children:Tg(o.level,o.text)},n);case"paragraph":return Ua(Zc,{children:o.text},n);case"quote":return Ua(wg,{children:o.text},n);case"code":return Ua(bg,{language:Pg(o.language),code:o.code},n);case"list":return Ua(wr,{gap:"xs",children:o.items.map((Nt,Ne)=>Ag(Ng,{gap:"sm",align:"start",children:[Ua(Jc,{children:o.ordered?`${Ne+1}.`:"•"}),Ua(Zc,{className:"leading-relaxed",children:Nt})]},Ne))},n);default:return null}})})}import{ContractReferenceDataView as Ui}from"@contractspec/lib.contracts-spec/docs";import{DataViewRenderer as Rg}from"@contractspec/lib.design-system";import{VStack as Lg}from"@contractspec/lib.ui-kit-web/ui/stack";import{jsx as Xc,jsxs as Dg}from"react/jsx-runtime";function hi(e,t){return e.match(new RegExp(`- \\*\\*${t}\\*\\*: (.+)`,"i"))?.[1]?.trim()}function Eg(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4359
+ `).trim()}function ug(e){let t=mg(e.summary),o=e.kind??(e.source==="generated"?"reference":void 0),n=e.visibility??(e.source==="generated"?"public":void 0);return{...e,summary:t,kind:o,visibility:n}}function gg(e,t){if(!t)return!0;return[e.title,e.summary,e.id,...e.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(t.toLowerCase())}function Kc({entries:e}){let[t,o]=pg({}),n=Fc(()=>e.map(ug),[e]),Nt=Fc(()=>{let Xe=t.query?.trim()??"";return n.filter((ie)=>{if(t.kind&&ie.kind!==t.kind)return!1;if(t.visibility&&ie.visibility!==t.visibility)return!1;return gg(ie,Xe)})},[t,n]),Ne=lg.render(ng,{defaultValues:{query:t.query??"",visibility:t.visibility??"",kind:t.kind??""},overrides:{onSubmitOverride:(Xe)=>{let ie=Xe;o({query:ie.query??"",visibility:ie.visibility??"",kind:ie.kind??""})}}});return Nr(br,{gap:"xl",children:[Nr(br,{gap:"sm",children:[Bo(dg,{children:"Reference"}),Bo(Hc,{children:"Generated reference material for public contract surfaces, versions, owners, and example-backed implementations. Use this when you need the repo truth, not just the narrative docs layer."})]}),Bo(br,{gap:"sm",className:"max-w-2xl",children:Ne}),Bo(cg,{spec:rg,items:Nt,emptyState:Bo(Hc,{children:"No reference docs match your filters."}),onSelect:(Xe)=>{if(Xe.route)window.location.assign(Xe.route)},renderActions:(Xe)=>{return Nr(sg,{gap:"xs",justify:"end",children:[Xe.kind?Bo(vr,{size:"sm",label:Xe.kind}):null,Xe.visibility?Bo(vr,{size:"sm",label:Xe.visibility}):null,Xe.version?Bo(vr,{size:"sm",label:`v${Xe.version}`}):null]})}})]})}import{jsx as fg}from"react/jsx-runtime";async function hg(){let e=await tn();return fg(Kc,{entries:e})}var yg=/^##\s+Metadata[\s\S]*?(?=^##\s|^#\s|Z)/m;function vg(e){return e.replace(/^#\s+.*\n+/m,"").replace(yg,"")}function Qc(e){return/^#{1,4}\s+/.test(e)||/^```/.test(e)||/^\s*[-*]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)||/^>\s+/.test(e)}function Yc(e){let t=vg(e).split(/\r?\n/),o=[],n=0;while(n<t.length){let Nt=t[n]??"";if(Nt.startsWith("<!-- @generated")){n+=1;continue}let Ne=Nt.trim();if(!Ne){n+=1;continue}if(Ne.startsWith("```")){let ie=Ne.slice(3).trim(),bo=[];n+=1;while(n<t.length&&!(t[n]??"").trim().startsWith("```"))bo.push(t[n]??""),n+=1;n+=1,o.push({type:"code",language:ie||"text",code:bo.join(`
4360
+ `)});continue}if(/^#{1,4}\s+/.test(Ne)){let ie=Ne.match(/^#{1,4}/)?.[0].length??2;o.push({type:"heading",level:ie,text:Ne.replace(/^#{1,4}\s+/,"")}),n+=1;continue}if(/^>\s+/.test(Ne)){let ie=[];while(n<t.length&&/^>\s+/.test((t[n]??"").trim()))ie.push((t[n]??"").trim().replace(/^>\s+/,"")),n+=1;o.push({type:"quote",text:ie.join(" ")});continue}if(/^[-*]\s+/.test(Ne)||/^\d+\.\s+/.test(Ne)){let ie=/^\d+\.\s+/.test(Ne),bo=[];while(n<t.length&&Qc((t[n]??"").trim())){let Qo=(t[n]??"").trim();if(ie&&/^\d+\.\s+/.test(Qo))bo.push(Qo.replace(/^\d+\.\s+/,""));else if(!ie&&/^[-*]\s+/.test(Qo))bo.push(Qo.replace(/^[-*]\s+/,""));else break;n+=1}o.push({type:"list",ordered:ie,items:bo});continue}let Xe=[];while(n<t.length&&!Qc((t[n]??"").trim())){let ie=(t[n]??"").trim();if(!ie)break;Xe.push(ie),n+=1}o.push({type:"paragraph",text:Xe.join(" ")})}return o}import{CodeBlock as bg}from"@contractspec/lib.design-system";import{HStack as Ng,VStack as wr}from"@contractspec/lib.ui-kit-web/ui/stack";import{BlockQuote as wg,H2 as kg,H3 as Sg,H4 as Cg,Muted as Jc,P as Zc}from"@contractspec/lib.ui-kit-web/ui/typography";import{jsx as Ua,jsxs as Ag}from"react/jsx-runtime";var Ig=new Set(["typescript","tsx","javascript","jsx","bash","shell","json","yaml","graphql","sql","python","go","rust","css","scss","html","markdown","text"]);function Pg(e){if(!e)return"text";let t=e.toLowerCase();return Ig.has(t)?t:"text"}function Tg(e,t){if(e<=2)return Ua(kg,{children:t});if(e===3)return Ua(Sg,{children:t});return Ua(Cg,{children:t})}function Xc({content:e}){let t=Yc(e);if(!t.length)return Ua(Jc,{children:"No reference content available."});return Ua(wr,{gap:"md",children:t.map((o,n)=>{switch(o.type){case"heading":return Ua(wr,{children:Tg(o.level,o.text)},n);case"paragraph":return Ua(Zc,{children:o.text},n);case"quote":return Ua(wg,{children:o.text},n);case"code":return Ua(bg,{language:Pg(o.language),code:o.code},n);case"list":return Ua(wr,{gap:"xs",children:o.items.map((Nt,Ne)=>Ag(Ng,{gap:"sm",align:"start",children:[Ua(Jc,{children:o.ordered?`${Ne+1}.`:"•"}),Ua(Zc,{className:"leading-relaxed",children:Nt})]},Ne))},n);default:return null}})})}import{ContractReferenceDataView as Ui}from"@contractspec/lib.contracts-spec/docs";import{DataViewRenderer as Rg}from"@contractspec/lib.design-system";import{VStack as Lg}from"@contractspec/lib.ui-kit-web/ui/stack";import{jsx as $c,jsxs as Dg}from"react/jsx-runtime";function fi(e,t){return e.match(new RegExp(`- \\*\\*${t}\\*\\*: (.+)`,"i"))?.[1]?.trim()}function Eg(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4361
4361
 
4362
- `).trim()}function xc({entry:e,content:t}){let o=Eg(e.summary),n=hi(t,"Type"),Nt=hi(t,"Version")??e.version,Ne=hi(t,"Tags")?.split(",").map((zi)=>zi.trim()).filter(Boolean),$e=hi(t,"Owners")?.split(",").map((zi)=>zi.trim()).filter(Boolean),ie=hi(t,"Stability")??e.visibility,bo={reference:{key:e.title??e.id,version:Nt,type:n,title:e.title??e.id,description:o,tags:Ne??e.tags,owners:$e??e.owners,stability:ie}},Qo={...Ui,meta:{...Ui.meta,title:e.title??Ui.meta.title,description:o??Ui.meta.description}};return Dg(Lg,{gap:"xl",children:[Xc(Rg,{spec:Qo,item:bo}),Xc($c,{content:t})]})}import{jsx as Mg}from"react/jsx-runtime";function Og({entry:e,content:t}){return Mg(xc,{entry:e,content:t})}import kr from"@contractspec/lib.ui-link";import{ChevronRight as Bg}from"lucide-react";import{jsx as w,jsxs as Y}from"react/jsx-runtime";function Ug(){return Y("div",{className:"space-y-8",children:[Y("div",{className:"space-y-4",children:[w("h1",{className:"font-bold text-4xl",children:"Audit Logs"}),Y("p",{className:"text-muted-foreground",children:["An ",w("strong",{children:"audit log"})," (also called an audit trail) is a chronological record of system activities. According to"," ",w("a",{href:"https://www.sumologic.com/glossary/audit-log/",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Sumo Logic"}),', audit logs "provide a detailed record of events and changes within a system, enabling organizations to track user actions, system changes, and access to sensitive data."']})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Why audit logs matter"}),Y("div",{className:"space-y-3",children:[Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Accountability"}),w("p",{className:"text-muted-foreground",children:'Audit logs answer the question "who did what, when?" This is essential for holding users and administrators accountable for their actions. If data is deleted or modified, the audit log shows exactly who made the change.'})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Security"}),w("p",{className:"text-muted-foreground",children:"Audit logs help detect and investigate security incidents. For example, if an attacker gains unauthorized access, the logs reveal which resources they accessed and what actions they performed. This information is critical for incident response and forensics."})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Compliance"}),w("p",{className:"text-muted-foreground",children:"Many regulations (GDPR, HIPAA, SOC 2, PCI DSS) require organizations to maintain audit logs. These logs must be tamper-evident, retained for a specified period, and available for inspection by auditors."})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Debugging"}),w("p",{className:"text-muted-foreground",children:"When something goes wrong in production, audit logs provide a detailed timeline of events leading up to the failure. This makes it much easier to diagnose and fix issues."})]})]})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"What ContractSpec logs"}),w("p",{className:"text-muted-foreground",children:"ContractSpec automatically logs every significant operation, including:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"API calls"})," – Every invocation of a capability, including inputs, outputs, and the user who made the call."]}),Y("li",{children:[w("strong",{children:"Policy decisions"})," – Every decision made by the"," ",w(kr,{href:"/docs/safety/pdp",className:"text-violet-400 hover:text-violet-300",children:"Policy Decision Point"}),", including the rule that matched and the reason for the decision."]}),Y("li",{children:[w("strong",{children:"Data access"})," – Every query to a data view, including which fields were accessed and whether any were redacted."]}),Y("li",{children:[w("strong",{children:"Workflow execution"})," – Every step in a workflow, including retries, compensations, and failures."]}),Y("li",{children:[w("strong",{children:"Administrative actions"})," – Spec deployments, configuration changes, user role assignments, and other privileged operations."]}),Y("li",{children:[w("strong",{children:"Authentication events"})," – Login attempts, password resets, and session expirations."]})]})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Audit log format"}),w("p",{className:"text-muted-foreground",children:"Each audit log entry is a structured JSON object containing:"}),w("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:w("pre",{children:`{
4362
+ `).trim()}function xc({entry:e,content:t}){let o=Eg(e.summary),n=fi(t,"Type"),Nt=fi(t,"Version")??e.version,Ne=fi(t,"Tags")?.split(",").map((zi)=>zi.trim()).filter(Boolean),Xe=fi(t,"Owners")?.split(",").map((zi)=>zi.trim()).filter(Boolean),ie=fi(t,"Stability")??e.visibility,bo={reference:{key:e.title??e.id,version:Nt,type:n,title:e.title??e.id,description:o,tags:Ne??e.tags,owners:Xe??e.owners,stability:ie}},Qo={...Ui,meta:{...Ui.meta,title:e.title??Ui.meta.title,description:o??Ui.meta.description}};return Dg(Lg,{gap:"xl",children:[$c(Rg,{spec:Qo,item:bo}),$c(Xc,{content:t})]})}import{jsx as Mg}from"react/jsx-runtime";function Og({entry:e,content:t}){return Mg(xc,{entry:e,content:t})}import kr from"@contractspec/lib.ui-link";import{ChevronRight as Bg}from"lucide-react";import{jsx as w,jsxs as Y}from"react/jsx-runtime";function Ug(){return Y("div",{className:"space-y-8",children:[Y("div",{className:"space-y-4",children:[w("h1",{className:"font-bold text-4xl",children:"Audit Logs"}),Y("p",{className:"text-muted-foreground",children:["An ",w("strong",{children:"audit log"})," (also called an audit trail) is a chronological record of system activities. According to"," ",w("a",{href:"https://www.sumologic.com/glossary/audit-log/",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Sumo Logic"}),', audit logs "provide a detailed record of events and changes within a system, enabling organizations to track user actions, system changes, and access to sensitive data."']})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Why audit logs matter"}),Y("div",{className:"space-y-3",children:[Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Accountability"}),w("p",{className:"text-muted-foreground",children:'Audit logs answer the question "who did what, when?" This is essential for holding users and administrators accountable for their actions. If data is deleted or modified, the audit log shows exactly who made the change.'})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Security"}),w("p",{className:"text-muted-foreground",children:"Audit logs help detect and investigate security incidents. For example, if an attacker gains unauthorized access, the logs reveal which resources they accessed and what actions they performed. This information is critical for incident response and forensics."})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Compliance"}),w("p",{className:"text-muted-foreground",children:"Many regulations (GDPR, HIPAA, SOC 2, PCI DSS) require organizations to maintain audit logs. These logs must be tamper-evident, retained for a specified period, and available for inspection by auditors."})]}),Y("div",{children:[w("h3",{className:"font-semibold text-lg",children:"Debugging"}),w("p",{className:"text-muted-foreground",children:"When something goes wrong in production, audit logs provide a detailed timeline of events leading up to the failure. This makes it much easier to diagnose and fix issues."})]})]})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"What ContractSpec logs"}),w("p",{className:"text-muted-foreground",children:"ContractSpec automatically logs every significant operation, including:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"API calls"})," – Every invocation of a capability, including inputs, outputs, and the user who made the call."]}),Y("li",{children:[w("strong",{children:"Policy decisions"})," – Every decision made by the"," ",w(kr,{href:"/docs/safety/pdp",className:"text-violet-400 hover:text-violet-300",children:"Policy Decision Point"}),", including the rule that matched and the reason for the decision."]}),Y("li",{children:[w("strong",{children:"Data access"})," – Every query to a data view, including which fields were accessed and whether any were redacted."]}),Y("li",{children:[w("strong",{children:"Workflow execution"})," – Every step in a workflow, including retries, compensations, and failures."]}),Y("li",{children:[w("strong",{children:"Administrative actions"})," – Spec deployments, configuration changes, user role assignments, and other privileged operations."]}),Y("li",{children:[w("strong",{children:"Authentication events"})," – Login attempts, password resets, and session expirations."]})]})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Audit log format"}),w("p",{className:"text-muted-foreground",children:"Each audit log entry is a structured JSON object containing:"}),w("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:w("pre",{children:`{
4363
4363
  "timestamp": "2025-11-13T14:32:15.123Z",
4364
4364
  "eventId": "evt_abc123",
4365
4365
  "eventType": "capability.invoked",
@@ -4390,7 +4390,7 @@ OTEL_TRACES_SAMPLER_ARG=0.1`})]}),fi("div",{className:"space-y-4",children:[Qa("
4390
4390
  "ruleId": "allow-admin-transfers",
4391
4391
  "reason": "User has admin role"
4392
4392
  }
4393
- }`})})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Storage and retention"}),w("p",{className:"text-muted-foreground",children:"Audit logs are stored in a tamper-evident append-only log. Once written, entries cannot be modified or deleted. This ensures the integrity of the audit trail."}),w("p",{className:"text-muted-foreground",children:"ContractSpec supports multiple storage backends:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"Local file system"})," – For development and testing."]}),Y("li",{children:[w("strong",{children:"Cloud object storage"})," – S3, GCS, or Azure Blob Storage for production."]}),Y("li",{children:[w("strong",{children:"SIEM integration"})," – Forward logs to Splunk, Datadog, or other security information and event management systems."]})]}),w("p",{className:"text-muted-foreground",children:"You can configure retention policies to automatically archive or delete old logs after a specified period (e.g., 7 years for GDPR compliance)."})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Querying audit logs"}),w("p",{className:"text-muted-foreground",children:"ContractSpec provides a query API for searching audit logs. You can filter by:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[w("li",{children:"Time range"}),w("li",{children:"Event type"}),w("li",{children:"Actor (user ID, role, IP address)"}),w("li",{children:"Resource (capability, data view, workflow)"}),w("li",{children:"Result (success, failure, denied)"})]}),w("p",{className:"text-muted-foreground",children:'Example query: "Show all failed login attempts from IP address 203.0.113.42 in the last 24 hours."'})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Best practices"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"Review logs regularly"})," – Set up alerts for suspicious activity (e.g., repeated failed login attempts, unauthorized access attempts)."]}),Y("li",{children:[w("strong",{children:"Protect log access"})," – Only authorized personnel should be able to view audit logs. Use role-based access control to restrict access."]}),Y("li",{children:[w("strong",{children:"Retain logs long enough"})," – Check your compliance requirements and configure retention policies accordingly."]}),Y("li",{children:[w("strong",{children:"Test log integrity"})," – Periodically verify that logs have not been tampered with by checking cryptographic signatures."]})]})]}),Y("div",{className:"flex items-center gap-4 pt-4",children:[w(kr,{href:"/docs/safety/pdp",className:"btn-ghost",children:"Previous: Policy Decision Points"}),Y(kr,{href:"/docs/safety/migrations",className:"btn-primary",children:["Next: Migrations ",w(Bg,{size:16})]})]})]})}import jc from"@contractspec/lib.ui-link";import{ChevronRight as Wg}from"lucide-react";import{jsx as h,jsxs as X}from"react/jsx-runtime";function _g(){return X("div",{className:"space-y-8",children:[X("div",{className:"space-y-4",children:[h("h1",{className:"font-bold text-4xl",children:"Migrations"}),X("p",{className:"text-muted-foreground",children:["A ",h("strong",{children:"schema migration"})," (also called a database migration) is a set of incremental, reversible changes to a database schema. According to"," ",h("a",{href:"https://en.wikipedia.org/wiki/Schema_migration",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Wikipedia"}),`, schema migrations "allow the database schema to evolve as the application's requirements change, while preserving existing data."`]})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Why migrations matter"}),h("p",{className:"text-muted-foreground",children:"As your application evolves, you'll need to change your data model—adding new fields, renaming tables, changing data types, or restructuring relationships. Without a disciplined approach, these changes can lead to:"}),X("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[h("li",{children:"Data loss or corruption"}),h("li",{children:"Downtime during deployments"}),h("li",{children:"Inconsistencies between environments (dev, staging, production)"}),h("li",{children:"Difficulty rolling back failed changes"})]}),h("p",{className:"text-muted-foreground",children:"Migrations solve these problems by treating schema changes as versioned, tested, and reversible operations."})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"How MigrationSpec works"}),X("p",{className:"text-muted-foreground",children:["In ContractSpec, migrations are defined using"," ",h("strong",{children:"MigrationSpec"}),". Each migration has:"]}),X("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[X("li",{children:[h("strong",{children:"Version"}),' – A unique identifier (e.g., "2025-11-13-001") that determines the order of execution.']}),X("li",{children:[h("strong",{children:"Up function"}),` – The forward migration that applies the change (e.g., "add column 'email_verified'").`]}),X("li",{children:[h("strong",{children:"Down function"}),` – The reverse migration that undoes the change (e.g., "drop column 'email_verified'").`]}),X("li",{children:[h("strong",{children:"Dependencies"})," – Other migrations that must run before this one."]}),X("li",{children:[h("strong",{children:"Validation"}),' – Optional checks to ensure the migration succeeded (e.g., "verify all users have an email address").']})]})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Example MigrationSpec"}),h("p",{className:"text-muted-foreground",children:"Here's a migration that adds an email verification field to the users table:"}),h("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:h("pre",{children:`migrationId: add-email-verified
4393
+ }`})})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Storage and retention"}),w("p",{className:"text-muted-foreground",children:"Audit logs are stored in a tamper-evident append-only log. Once written, entries cannot be modified or deleted. This ensures the integrity of the audit trail."}),w("p",{className:"text-muted-foreground",children:"ContractSpec supports multiple storage backends:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"Local file system"})," – For development and testing."]}),Y("li",{children:[w("strong",{children:"Cloud object storage"})," – S3, GCS, or Azure Blob Storage for production."]}),Y("li",{children:[w("strong",{children:"SIEM integration"})," – Forward logs to Splunk, Datadog, or other security information and event management systems."]})]}),w("p",{className:"text-muted-foreground",children:"You can configure retention policies to automatically archive or delete old logs after a specified period (e.g., 7 years for GDPR compliance)."})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Querying audit logs"}),w("p",{className:"text-muted-foreground",children:"ContractSpec provides a query API for searching audit logs. You can filter by:"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[w("li",{children:"Time range"}),w("li",{children:"Event type"}),w("li",{children:"Actor (user ID, role, IP address)"}),w("li",{children:"Resource (capability, data view, workflow)"}),w("li",{children:"Result (success, failure, denied)"})]}),w("p",{className:"text-muted-foreground",children:'Example query: "Show all failed login attempts from IP address 203.0.113.42 in the last 24 hours."'})]}),Y("div",{className:"space-y-4",children:[w("h2",{className:"font-bold text-2xl",children:"Best practices"}),Y("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Y("li",{children:[w("strong",{children:"Review logs regularly"})," – Set up alerts for suspicious activity (e.g., repeated failed login attempts, unauthorized access attempts)."]}),Y("li",{children:[w("strong",{children:"Protect log access"})," – Only authorized personnel should be able to view audit logs. Use role-based access control to restrict access."]}),Y("li",{children:[w("strong",{children:"Retain logs long enough"})," – Check your compliance requirements and configure retention policies accordingly."]}),Y("li",{children:[w("strong",{children:"Test log integrity"})," – Periodically verify that logs have not been tampered with by checking cryptographic signatures."]})]})]}),Y("div",{className:"flex items-center gap-4 pt-4",children:[w(kr,{href:"/docs/safety/pdp",className:"btn-ghost",children:"Previous: Policy Decision Points"}),Y(kr,{href:"/docs/safety/migrations",className:"btn-primary",children:["Next: Migrations ",w(Bg,{size:16})]})]})]})}import jc from"@contractspec/lib.ui-link";import{ChevronRight as Wg}from"lucide-react";import{jsx as f,jsxs as $}from"react/jsx-runtime";function _g(){return $("div",{className:"space-y-8",children:[$("div",{className:"space-y-4",children:[f("h1",{className:"font-bold text-4xl",children:"Migrations"}),$("p",{className:"text-muted-foreground",children:["A ",f("strong",{children:"schema migration"})," (also called a database migration) is a set of incremental, reversible changes to a database schema. According to"," ",f("a",{href:"https://en.wikipedia.org/wiki/Schema_migration",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Wikipedia"}),`, schema migrations "allow the database schema to evolve as the application's requirements change, while preserving existing data."`]})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Why migrations matter"}),f("p",{className:"text-muted-foreground",children:"As your application evolves, you'll need to change your data model—adding new fields, renaming tables, changing data types, or restructuring relationships. Without a disciplined approach, these changes can lead to:"}),$("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[f("li",{children:"Data loss or corruption"}),f("li",{children:"Downtime during deployments"}),f("li",{children:"Inconsistencies between environments (dev, staging, production)"}),f("li",{children:"Difficulty rolling back failed changes"})]}),f("p",{className:"text-muted-foreground",children:"Migrations solve these problems by treating schema changes as versioned, tested, and reversible operations."})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"How MigrationSpec works"}),$("p",{className:"text-muted-foreground",children:["In ContractSpec, migrations are defined using"," ",f("strong",{children:"MigrationSpec"}),". Each migration has:"]}),$("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[$("li",{children:[f("strong",{children:"Version"}),' – A unique identifier (e.g., "2025-11-13-001") that determines the order of execution.']}),$("li",{children:[f("strong",{children:"Up function"}),` – The forward migration that applies the change (e.g., "add column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Down function"}),` – The reverse migration that undoes the change (e.g., "drop column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Dependencies"})," – Other migrations that must run before this one."]}),$("li",{children:[f("strong",{children:"Validation"}),' – Optional checks to ensure the migration succeeded (e.g., "verify all users have an email address").']})]})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Example MigrationSpec"}),f("p",{className:"text-muted-foreground",children:"Here's a migration that adds an email verification field to the users table:"}),f("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:f("pre",{children:`migrationId: add-email-verified
4394
4394
  version: 2025-11-13-001
4395
4395
  dependencies: []
4396
4396
 
@@ -4413,7 +4413,7 @@ validation:
4413
4413
  - sql: |
4414
4414
  SELECT COUNT(*) FROM users
4415
4415
  WHERE email_verified IS NULL;
4416
- expectZeroRows: true`})})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Running migrations"}),h("p",{className:"text-muted-foreground",children:"Migrations are applied automatically during deployment. The ContractSpec runtime:"}),X("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[h("li",{children:"Checks which migrations have already been applied (stored in a migrations table)."}),h("li",{children:"Identifies new migrations that need to run."}),h("li",{children:"Executes them in order, respecting dependencies."}),h("li",{children:"Runs validation checks to ensure success."}),h("li",{children:"Records the migration as applied."})]}),h("p",{className:"text-muted-foreground",children:"If a migration fails, the deployment is aborted, and the system remains in its previous state. You can then fix the migration and redeploy."})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Rolling back migrations"}),X("p",{className:"text-muted-foreground",children:["If you need to roll back a deployment, ContractSpec automatically runs the ",h("strong",{children:"down"})," functions of any migrations that were applied. This restores the database to its previous state."]}),h("p",{className:"text-muted-foreground",children:"Note that rollbacks are not always possible—for example, if you've deleted a column, you cannot recover the data unless you have a backup. For destructive changes, it's best to use a multi-step migration:"}),X("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[h("li",{children:"Add the new column (reversible)."}),h("li",{children:"Backfill data from the old column to the new column (reversible)."}),h("li",{children:"Update application code to use the new column (reversible)."}),h("li",{children:"Drop the old column (irreversible—only do this after confirming the new column works)."})]})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Best practices"}),X("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[X("li",{children:[h("strong",{children:"Test migrations locally"})," – Run them against a copy of production data to catch issues before deploying."]}),X("li",{children:[h("strong",{children:"Keep migrations small"})," – Each migration should do one thing. This makes them easier to understand and roll back."]}),X("li",{children:[h("strong",{children:"Write reversible migrations"})," – Always provide a down function, even if you don't plan to roll back."]}),X("li",{children:[h("strong",{children:"Use transactions"})," – Wrap migrations in database transactions so they either fully succeed or fully fail."]}),X("li",{children:[h("strong",{children:"Avoid destructive changes"})," – Prefer additive changes (adding columns) over destructive ones (dropping columns). If you must delete data, archive it first."]}),X("li",{children:[h("strong",{children:"Version your migrations"})," – Use timestamps or sequential numbers to ensure migrations run in the correct order."]}),X("li",{children:[h("strong",{children:"Document breaking changes"})," – If a migration requires application code changes, note this in the migration description."]})]})]}),X("div",{className:"space-y-4",children:[h("h2",{className:"font-bold text-2xl",children:"Zero-downtime migrations"}),h("p",{className:"text-muted-foreground",children:"Some migrations can cause downtime if not handled carefully. For example, adding a NOT NULL column to a large table can lock the table for minutes. To avoid this, use a multi-step approach:"}),X("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[h("li",{children:"Add the column as nullable."}),h("li",{children:"Backfill the column in batches (without locking the table)."}),h("li",{children:"Add the NOT NULL constraint once all rows are populated."})]}),h("p",{className:"text-muted-foreground",children:"ContractSpec's migration system supports this pattern by allowing you to split a logical change into multiple versioned migrations."})]}),X("div",{className:"flex items-center gap-4 pt-4",children:[h(jc,{href:"/docs/safety/auditing",className:"btn-ghost",children:"Previous: Audit Logs"}),X(jc,{href:"/docs/advanced/renderers",className:"btn-primary",children:["Next: Advanced Topics ",h(Wg,{size:16})]})]})]})}import zg from"@contractspec/lib.ui-link";import{jsx as yo,jsxs as yi}from"react/jsx-runtime";var Gg=[{title:"Spec signing",body:"Protect the integrity of what gets deployed and make changes verifiable.",href:"/docs/safety/signing"},{title:"Policy decision points",body:"Apply governance consistently across operations, data access, and generated surfaces.",href:"/docs/safety/pdp"},{title:"Audit trails",body:"Record operational and policy decisions with enough context to inspect and explain them later.",href:"/docs/safety/auditing"},{title:"Migrations",body:"Evolve data and schema boundaries without losing control of the system.",href:"/docs/safety/migrations"},{title:"Tenant isolation",body:"Keep configuration, access rules, and sensitive data bounded by tenant.",href:"/docs/safety/tenant-isolation"},{title:"Security and trust",body:"Understand the trust model, release process, and security expectations around the OSS system.",href:"/docs/safety/security-trust"}];function Hg(){return yi("div",{className:"space-y-10",children:[yi("div",{className:"space-y-3",children:[yo("p",{className:"editorial-kicker",children:"Operate"}),yo("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Safety is part of the system model, not an afterthought."}),yo("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is meant to survive real change: new generated surfaces, policy updates, migrations, integration churn, and operator handoffs. The safety layer makes those changes inspectable, reversible, and governed."})]}),yi("div",{className:"editorial-proof-strip",children:[yi("div",{className:"editorial-stat",children:[yo("span",{className:"editorial-label",children:"Operating rule"}),yo("span",{className:"editorial-stat-value",children:"explicit change beats hidden mutation"})]}),yo("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Use policies, signing, audit trails, and migrations to keep the system legible even as AI-assisted workflows accelerate change volume."})]}),yo("div",{className:"grid gap-4 md:grid-cols-2",children:Gg.map((e)=>yi(zg,{href:e.href,className:"editorial-panel",children:[yo("h2",{className:"font-semibold text-xl",children:e.title}),yo("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.href))})]})}import Sr from"@contractspec/lib.ui-link";import{ChevronRight as qg}from"lucide-react";import{jsx as R,jsxs as fe}from"react/jsx-runtime";function Vg(){return fe("div",{className:"space-y-8",children:[fe("div",{className:"space-y-4",children:[R("h1",{className:"font-bold text-4xl",children:"Policy Decision Points"}),fe("p",{className:"text-muted-foreground",children:["A ",R("strong",{children:"Policy Decision Point (PDP)"})," is a centralized component that evaluates access control policies and makes authorization decisions. According to"," ",R("a",{href:"https://www.strongdm.com/blog/policy-decision-point",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"StrongDM"}),', the PDP "receives requests for access to resources, evaluates them against policies, and returns a decision (permit or deny)."']})]}),fe("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"How the PDP works in ContractSpec"}),R("p",{className:"text-muted-foreground",children:"In ContractSpec, the PDP is invoked on every operation—whether it's rendering a UI component, executing a capability, or querying a data view. The flow is:"}),fe("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[fe("li",{children:[R("strong",{children:"Request evaluation"})," – The runtime sends a request to the PDP containing:",fe("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[R("li",{children:"The user's identity and attributes (roles, groups, location, etc.)"}),R("li",{children:"The resource being accessed (capability, field, workflow step)"}),R("li",{children:"The action being performed (read, write, execute)"}),R("li",{children:"Contextual information (time of day, device type, IP address)"})]})]}),fe("li",{children:[R("strong",{children:"Policy evaluation"})," – The PDP evaluates the request against all applicable ",R("strong",{children:"PolicySpecs"}),". These specs define rules using attribute-based access control (ABAC) and can reference:",fe("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[R("li",{children:`User attributes (e.g., "role == 'admin'")`}),R("li",{children:`Resource attributes (e.g., "field.sensitivity == 'PII'")`}),R("li",{children:'Environmental attributes (e.g., "time.hour >= 9 AND time.hour < 17")'})]})]}),fe("li",{children:[R("strong",{children:"Decision return"})," – The PDP returns one of:",fe("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[fe("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"PERMIT"})," ","– The operation is allowed."]}),fe("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"DENY"})," ","– The operation is blocked."]}),fe("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"REDACT"})," ","– The operation is allowed, but sensitive fields are masked."]})]})]}),fe("li",{children:[R("strong",{children:"Enforcement"})," – The runtime enforces the decision. If denied, the operation fails with a clear error message. If redacted, sensitive fields are replaced with placeholders."]}),fe("li",{children:[R("strong",{children:"Auditing"})," – Every PDP decision is logged to the"," ",R(Sr,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit log"}),", including the request, decision, and reasoning."]})]})]}),fe("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Example PolicySpec"}),R("p",{className:"text-muted-foreground",children:"Here's a simple policy that restricts access to PII fields:"}),R("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:R("pre",{children:`policyId: pii-access-control
4416
+ expectZeroRows: true`})})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Running migrations"}),f("p",{className:"text-muted-foreground",children:"Migrations are applied automatically during deployment. The ContractSpec runtime:"}),$("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[f("li",{children:"Checks which migrations have already been applied (stored in a migrations table)."}),f("li",{children:"Identifies new migrations that need to run."}),f("li",{children:"Executes them in order, respecting dependencies."}),f("li",{children:"Runs validation checks to ensure success."}),f("li",{children:"Records the migration as applied."})]}),f("p",{className:"text-muted-foreground",children:"If a migration fails, the deployment is aborted, and the system remains in its previous state. You can then fix the migration and redeploy."})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Rolling back migrations"}),$("p",{className:"text-muted-foreground",children:["If you need to roll back a deployment, ContractSpec automatically runs the ",f("strong",{children:"down"})," functions of any migrations that were applied. This restores the database to its previous state."]}),f("p",{className:"text-muted-foreground",children:"Note that rollbacks are not always possible—for example, if you've deleted a column, you cannot recover the data unless you have a backup. For destructive changes, it's best to use a multi-step migration:"}),$("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[f("li",{children:"Add the new column (reversible)."}),f("li",{children:"Backfill data from the old column to the new column (reversible)."}),f("li",{children:"Update application code to use the new column (reversible)."}),f("li",{children:"Drop the old column (irreversible—only do this after confirming the new column works)."})]})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Best practices"}),$("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[$("li",{children:[f("strong",{children:"Test migrations locally"})," – Run them against a copy of production data to catch issues before deploying."]}),$("li",{children:[f("strong",{children:"Keep migrations small"})," – Each migration should do one thing. This makes them easier to understand and roll back."]}),$("li",{children:[f("strong",{children:"Write reversible migrations"})," – Always provide a down function, even if you don't plan to roll back."]}),$("li",{children:[f("strong",{children:"Use transactions"})," – Wrap migrations in database transactions so they either fully succeed or fully fail."]}),$("li",{children:[f("strong",{children:"Avoid destructive changes"})," – Prefer additive changes (adding columns) over destructive ones (dropping columns). If you must delete data, archive it first."]}),$("li",{children:[f("strong",{children:"Version your migrations"})," – Use timestamps or sequential numbers to ensure migrations run in the correct order."]}),$("li",{children:[f("strong",{children:"Document breaking changes"})," – If a migration requires application code changes, note this in the migration description."]})]})]}),$("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Zero-downtime migrations"}),f("p",{className:"text-muted-foreground",children:"Some migrations can cause downtime if not handled carefully. For example, adding a NOT NULL column to a large table can lock the table for minutes. To avoid this, use a multi-step approach:"}),$("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[f("li",{children:"Add the column as nullable."}),f("li",{children:"Backfill the column in batches (without locking the table)."}),f("li",{children:"Add the NOT NULL constraint once all rows are populated."})]}),f("p",{className:"text-muted-foreground",children:"ContractSpec's migration system supports this pattern by allowing you to split a logical change into multiple versioned migrations."})]}),$("div",{className:"flex items-center gap-4 pt-4",children:[f(jc,{href:"/docs/safety/auditing",className:"btn-ghost",children:"Previous: Audit Logs"}),$(jc,{href:"/docs/advanced/renderers",className:"btn-primary",children:["Next: Advanced Topics ",f(Wg,{size:16})]})]})]})}import zg from"@contractspec/lib.ui-link";import{jsx as yo,jsxs as yi}from"react/jsx-runtime";var Gg=[{title:"Spec signing",body:"Protect the integrity of what gets deployed and make changes verifiable.",href:"/docs/safety/signing"},{title:"Policy decision points",body:"Apply governance consistently across operations, data access, and generated surfaces.",href:"/docs/safety/pdp"},{title:"Audit trails",body:"Record operational and policy decisions with enough context to inspect and explain them later.",href:"/docs/safety/auditing"},{title:"Migrations",body:"Evolve data and schema boundaries without losing control of the system.",href:"/docs/safety/migrations"},{title:"Tenant isolation",body:"Keep configuration, access rules, and sensitive data bounded by tenant.",href:"/docs/safety/tenant-isolation"},{title:"Security and trust",body:"Understand the trust model, release process, and security expectations around the OSS system.",href:"/docs/safety/security-trust"}];function qg(){return yi("div",{className:"space-y-10",children:[yi("div",{className:"space-y-3",children:[yo("p",{className:"editorial-kicker",children:"Operate"}),yo("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Safety is part of the system model, not an afterthought."}),yo("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec is meant to survive real change: new generated surfaces, policy updates, migrations, integration churn, and operator handoffs. The safety layer makes those changes inspectable, reversible, and governed."})]}),yi("div",{className:"editorial-proof-strip",children:[yi("div",{className:"editorial-stat",children:[yo("span",{className:"editorial-label",children:"Operating rule"}),yo("span",{className:"editorial-stat-value",children:"explicit change beats hidden mutation"})]}),yo("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Use policies, signing, audit trails, and migrations to keep the system legible even as AI-assisted workflows accelerate change volume."})]}),yo("div",{className:"grid gap-4 md:grid-cols-2",children:Gg.map((e)=>yi(zg,{href:e.href,className:"editorial-panel",children:[yo("h2",{className:"font-semibold text-xl",children:e.title}),yo("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body})]},e.href))})]})}import Sr from"@contractspec/lib.ui-link";import{ChevronRight as Vg}from"lucide-react";import{jsx as R,jsxs as he}from"react/jsx-runtime";function Hg(){return he("div",{className:"space-y-8",children:[he("div",{className:"space-y-4",children:[R("h1",{className:"font-bold text-4xl",children:"Policy Decision Points"}),he("p",{className:"text-muted-foreground",children:["A ",R("strong",{children:"Policy Decision Point (PDP)"})," is a centralized component that evaluates access control policies and makes authorization decisions. According to"," ",R("a",{href:"https://www.strongdm.com/blog/policy-decision-point",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"StrongDM"}),', the PDP "receives requests for access to resources, evaluates them against policies, and returns a decision (permit or deny)."']})]}),he("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"How the PDP works in ContractSpec"}),R("p",{className:"text-muted-foreground",children:"In ContractSpec, the PDP is invoked on every operation—whether it's rendering a UI component, executing a capability, or querying a data view. The flow is:"}),he("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[he("li",{children:[R("strong",{children:"Request evaluation"})," – The runtime sends a request to the PDP containing:",he("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[R("li",{children:"The user's identity and attributes (roles, groups, location, etc.)"}),R("li",{children:"The resource being accessed (capability, field, workflow step)"}),R("li",{children:"The action being performed (read, write, execute)"}),R("li",{children:"Contextual information (time of day, device type, IP address)"})]})]}),he("li",{children:[R("strong",{children:"Policy evaluation"})," – The PDP evaluates the request against all applicable ",R("strong",{children:"PolicySpecs"}),". These specs define rules using attribute-based access control (ABAC) and can reference:",he("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[R("li",{children:`User attributes (e.g., "role == 'admin'")`}),R("li",{children:`Resource attributes (e.g., "field.sensitivity == 'PII'")`}),R("li",{children:'Environmental attributes (e.g., "time.hour >= 9 AND time.hour < 17")'})]})]}),he("li",{children:[R("strong",{children:"Decision return"})," – The PDP returns one of:",he("ul",{className:"mt-2 ml-6 list-inside list-disc space-y-1",children:[he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"PERMIT"})," ","– The operation is allowed."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"DENY"})," ","– The operation is blocked."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"REDACT"})," ","– The operation is allowed, but sensitive fields are masked."]})]})]}),he("li",{children:[R("strong",{children:"Enforcement"})," – The runtime enforces the decision. If denied, the operation fails with a clear error message. If redacted, sensitive fields are replaced with placeholders."]}),he("li",{children:[R("strong",{children:"Auditing"})," – Every PDP decision is logged to the"," ",R(Sr,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit log"}),", including the request, decision, and reasoning."]})]})]}),he("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Example PolicySpec"}),R("p",{className:"text-muted-foreground",children:"Here's a simple policy that restricts access to PII fields:"}),R("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:R("pre",{children:`policyId: pii-access-control
4417
4417
  version: '1.0.0'.0.0
4418
4418
  rules:
4419
4419
  - id: allow-admin-full-access
@@ -4431,7 +4431,7 @@ rules:
4431
4431
  effect: DENY
4432
4432
  condition: |
4433
4433
  user.role NOT IN ['admin', 'support'] AND
4434
- field.sensitivity == 'PII'`})}),R("p",{className:"text-muted-foreground",children:"With this policy, admins see all data, support staff see redacted PII, and other users cannot access PII at all."})]}),fe("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Benefits of centralized decision-making"}),fe("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[fe("li",{children:[R("strong",{children:"Consistency"})," – Policies are enforced uniformly across all surfaces (API, UI, workflows)."]}),fe("li",{children:[R("strong",{children:"Auditability"})," – Every decision is logged, making it easy to trace why access was granted or denied."]}),fe("li",{children:[R("strong",{children:"Flexibility"})," – Policies can be updated without changing application code."]}),fe("li",{children:[R("strong",{children:"Security"})," – Reduces the risk of authorization bugs by removing ad-hoc checks scattered throughout the codebase."]})]})]}),fe("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Performance considerations"}),R("p",{className:"text-muted-foreground",children:"Because the PDP is invoked on every operation, performance is critical. ContractSpec optimizes this by:"}),fe("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[R("li",{children:"Caching policy decisions for identical requests"}),R("li",{children:"Compiling policies into efficient bytecode"}),R("li",{children:"Evaluating only the minimal set of rules needed for each request"}),R("li",{children:"Running the PDP in-process to avoid network latency"})]}),R("p",{className:"text-muted-foreground",children:"In practice, PDP overhead is typically less than 1ms per request."})]}),fe("div",{className:"flex items-center gap-4 pt-4",children:[R(Sr,{href:"/docs/safety/signing",className:"btn-ghost",children:"Previous: Spec Signing"}),fe(Sr,{href:"/docs/safety/auditing",className:"btn-primary",children:["Next: Audit Logs ",R(qg,{size:16})]})]})]})}import Cr from"@contractspec/lib.ui-link";import{ChevronRight as Ir}from"lucide-react";import{jsx as ne,jsxs as yt}from"react/jsx-runtime";function Fg(){return yt("div",{className:"space-y-8",children:[yt("div",{className:"space-y-4",children:[ne("h1",{className:"font-bold text-4xl",children:"Security & Trust"}),ne("p",{className:"text-muted-foreground",children:"ContractSpec focuses on deterministic, auditable software delivery. This page summarizes our security posture and trust commitments so teams can adopt with clarity."})]}),yt("div",{className:"card-subtle space-y-4 p-6",children:[ne("h2",{className:"font-bold text-2xl",children:"Security policy"}),ne("p",{className:"text-muted-foreground text-sm",children:"We publish a dedicated security policy that explains how to report vulnerabilities and how we respond."}),yt(Cr,{href:"/SECURITY.md",className:"btn-primary",children:["Read the security policy ",ne(Ir,{size:16})]})]}),yt("div",{className:"grid gap-4 md:grid-cols-2",children:[yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Release hygiene"}),ne("p",{className:"text-muted-foreground text-sm",children:"We ship with deterministic CI, changesets, and contract validation so teams can trust every release."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Changesets required for published packages."}),ne("li",{children:"CI gate for contract validation and drift detection."}),ne("li",{children:"Rollback-friendly release process."})]})]}),yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Data handling"}),ne("p",{className:"text-muted-foreground text-sm",children:"ContractSpec promotes strict data classification and policy-driven access. Specs can tag sensitive fields for enforcement."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Schema-level sensitivity tags."}),ne("li",{children:"Policy Decision Point enforcement."}),ne("li",{children:"Audit logs for operational traceability."})]})]})]}),yt("div",{className:"grid gap-4 md:grid-cols-2",children:[yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Supply chain"}),ne("p",{className:"text-muted-foreground text-sm",children:"We track dependency updates and keep the monorepo build reproducible."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Dependabot + Renovate-style updates where available."}),ne("li",{children:"Signed release artifacts planned for Studio release cycles."}),ne("li",{children:"Transparent changelogs for every package."})]})]}),yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Responsible disclosure"}),ne("p",{className:"text-muted-foreground text-sm",children:"We respond quickly to security reports and coordinate fixes before public disclosure."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Security response within 5 business days."}),ne("li",{children:"Private disclosure via security@contractspec.io."}),ne("li",{children:"Credit for researchers (with permission)."})]})]})]}),yt("div",{className:"space-y-4",children:[ne("h2",{className:"font-bold text-2xl",children:"Next steps"}),ne("p",{className:"text-muted-foreground",children:"Explore the broader safety controls or read the roadmap to see upcoming trust investments."}),yt("div",{className:"flex flex-wrap gap-4 pt-4",children:[yt(Cr,{href:"/docs/safety",className:"btn-ghost",children:["Safety overview ",ne(Ir,{size:16})]}),yt(Cr,{href:"/ROADMAP.md",className:"btn-ghost",children:["Roadmap ",ne(Ir,{size:16})]})]})]})]})}import Kg from"@contractspec/lib.ui-link";import{ChevronRight as Qg}from"lucide-react";import{jsx as Wa,jsxs as Fo}from"react/jsx-runtime";function Yg(){return Fo("div",{className:"space-y-8",children:[Fo("div",{className:"space-y-2",children:[Wa("h1",{className:"font-bold text-4xl",children:"Spec Signing"}),Wa("p",{className:"text-lg text-muted-foreground",children:"Signing ensures specs haven't been tampered with and provides an audit trail of all changes."})]}),Fo("div",{className:"space-y-6",children:[Fo("div",{className:"space-y-3",children:[Wa("h2",{className:"font-bold text-2xl",children:"How it works"}),Wa("p",{className:"text-muted-foreground",children:"Every spec is cryptographically signed before deployment. The signature proves that the spec hasn't been modified since it was signed and creates a permanent record of who deployed it and when."})]}),Fo("div",{className:"space-y-3",children:[Wa("h2",{className:"font-bold text-2xl",children:"Signing a spec"}),Wa("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Wa("pre",{children:`contractspec sign app.spec.ts --key ~/.contractspec/key.pem
4434
+ field.sensitivity == 'PII'`})}),R("p",{className:"text-muted-foreground",children:"With this policy, admins see all data, support staff see redacted PII, and other users cannot access PII at all."})]}),he("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Benefits of centralized decision-making"}),he("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[he("li",{children:[R("strong",{children:"Consistency"})," – Policies are enforced uniformly across all surfaces (API, UI, workflows)."]}),he("li",{children:[R("strong",{children:"Auditability"})," – Every decision is logged, making it easy to trace why access was granted or denied."]}),he("li",{children:[R("strong",{children:"Flexibility"})," – Policies can be updated without changing application code."]}),he("li",{children:[R("strong",{children:"Security"})," – Reduces the risk of authorization bugs by removing ad-hoc checks scattered throughout the codebase."]})]})]}),he("div",{className:"space-y-4",children:[R("h2",{className:"font-bold text-2xl",children:"Performance considerations"}),R("p",{className:"text-muted-foreground",children:"Because the PDP is invoked on every operation, performance is critical. ContractSpec optimizes this by:"}),he("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[R("li",{children:"Caching policy decisions for identical requests"}),R("li",{children:"Compiling policies into efficient bytecode"}),R("li",{children:"Evaluating only the minimal set of rules needed for each request"}),R("li",{children:"Running the PDP in-process to avoid network latency"})]}),R("p",{className:"text-muted-foreground",children:"In practice, PDP overhead is typically less than 1ms per request."})]}),he("div",{className:"flex items-center gap-4 pt-4",children:[R(Sr,{href:"/docs/safety/signing",className:"btn-ghost",children:"Previous: Spec Signing"}),he(Sr,{href:"/docs/safety/auditing",className:"btn-primary",children:["Next: Audit Logs ",R(Vg,{size:16})]})]})]})}import Cr from"@contractspec/lib.ui-link";import{ChevronRight as Ir}from"lucide-react";import{jsx as ne,jsxs as yt}from"react/jsx-runtime";function Fg(){return yt("div",{className:"space-y-8",children:[yt("div",{className:"space-y-4",children:[ne("h1",{className:"font-bold text-4xl",children:"Security & Trust"}),ne("p",{className:"text-muted-foreground",children:"ContractSpec focuses on deterministic, auditable software delivery. This page summarizes our security posture and trust commitments so teams can adopt with clarity."})]}),yt("div",{className:"card-subtle space-y-4 p-6",children:[ne("h2",{className:"font-bold text-2xl",children:"Security policy"}),ne("p",{className:"text-muted-foreground text-sm",children:"We publish a dedicated security policy that explains how to report vulnerabilities and how we respond."}),yt(Cr,{href:"/SECURITY.md",className:"btn-primary",children:["Read the security policy ",ne(Ir,{size:16})]})]}),yt("div",{className:"grid gap-4 md:grid-cols-2",children:[yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Release hygiene"}),ne("p",{className:"text-muted-foreground text-sm",children:"We ship with deterministic CI, changesets, and contract validation so teams can trust every release."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Changesets required for published packages."}),ne("li",{children:"CI gate for contract validation and drift detection."}),ne("li",{children:"Rollback-friendly release process."})]})]}),yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Data handling"}),ne("p",{className:"text-muted-foreground text-sm",children:"ContractSpec promotes strict data classification and policy-driven access. Specs can tag sensitive fields for enforcement."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Schema-level sensitivity tags."}),ne("li",{children:"Policy Decision Point enforcement."}),ne("li",{children:"Audit logs for operational traceability."})]})]})]}),yt("div",{className:"grid gap-4 md:grid-cols-2",children:[yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Supply chain"}),ne("p",{className:"text-muted-foreground text-sm",children:"We track dependency updates and keep the monorepo build reproducible."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Dependabot + Renovate-style updates where available."}),ne("li",{children:"Signed release artifacts planned for Studio release cycles."}),ne("li",{children:"Transparent changelogs for every package."})]})]}),yt("div",{className:"card-subtle space-y-3 p-6",children:[ne("h3",{className:"font-semibold text-lg",children:"Responsible disclosure"}),ne("p",{className:"text-muted-foreground text-sm",children:"We respond quickly to security reports and coordinate fixes before public disclosure."}),yt("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[ne("li",{children:"Security response within 5 business days."}),ne("li",{children:"Private disclosure via security@contractspec.io."}),ne("li",{children:"Credit for researchers (with permission)."})]})]})]}),yt("div",{className:"space-y-4",children:[ne("h2",{className:"font-bold text-2xl",children:"Next steps"}),ne("p",{className:"text-muted-foreground",children:"Explore the broader safety controls or read the roadmap to see upcoming trust investments."}),yt("div",{className:"flex flex-wrap gap-4 pt-4",children:[yt(Cr,{href:"/docs/safety",className:"btn-ghost",children:["Safety overview ",ne(Ir,{size:16})]}),yt(Cr,{href:"/ROADMAP.md",className:"btn-ghost",children:["Roadmap ",ne(Ir,{size:16})]})]})]})]})}import Kg from"@contractspec/lib.ui-link";import{ChevronRight as Qg}from"lucide-react";import{jsx as Wa,jsxs as Fo}from"react/jsx-runtime";function Yg(){return Fo("div",{className:"space-y-8",children:[Fo("div",{className:"space-y-2",children:[Wa("h1",{className:"font-bold text-4xl",children:"Spec Signing"}),Wa("p",{className:"text-lg text-muted-foreground",children:"Signing ensures specs haven't been tampered with and provides an audit trail of all changes."})]}),Fo("div",{className:"space-y-6",children:[Fo("div",{className:"space-y-3",children:[Wa("h2",{className:"font-bold text-2xl",children:"How it works"}),Wa("p",{className:"text-muted-foreground",children:"Every spec is cryptographically signed before deployment. The signature proves that the spec hasn't been modified since it was signed and creates a permanent record of who deployed it and when."})]}),Fo("div",{className:"space-y-3",children:[Wa("h2",{className:"font-bold text-2xl",children:"Signing a spec"}),Wa("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Wa("pre",{children:`contractspec sign app.spec.ts --key ~/.contractspec/key.pem
4435
4435
  contractspec deploy --signed app.spec.ts.signed`})})]}),Fo("div",{className:"space-y-3",children:[Wa("h2",{className:"font-bold text-2xl",children:"Verifying signatures"}),Wa("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Wa("pre",{children:`contractspec verify app.spec.ts.signed
4436
4436
  # Output: ✓ Signature valid
4437
4437
  # Signed by: alice@example.com
@@ -4445,7 +4445,7 @@ test('findUser query is isolated', () => {
4445
4445
  'tenant-123'
4446
4446
  );
4447
4447
  expect(isValid).toBe(true);
4448
- });`})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 3: Policy Engine"}),vo("p",{children:"The Policy Decision Point (PDP) verifies that the authenticated user actually belongs to the requested tenant before any operation logic runs."})]})]})}import{CodeBlock as Pr}from"@contractspec/lib.design-system";import el from"@contractspec/lib.ui-link";import{jsx as E,jsxs as Te}from"react/jsx-runtime";var Zg=[{title:"Managed",body:"Best when the team wants the platform to own setup, routing, readiness, API defaults, and mobile-safe operator flows."},{title:"Local",body:"Best for power users who want local-daemon registration, tenant-local execution providers, and tighter data-locality control."},{title:"Hybrid",body:"Best when some work should stay local while preview, review, export, or mobile operator flows still use managed coordination."}],$g=["Bootstrap managed, local-daemon, or hybrid presets explicitly instead of inventing provider posture ad hoc per host.","Capture prompts, files, voice, and other inbound sources into a typed workspace instead of relying on a single chat transcript.","Fuse the sources into decisions, assumptions, and blueprint updates with provenance and approval memory.","Compile authoring work into execution lanes, then route the work to explicit provider profiles and runtime targets.","Create previews, run readiness gates, and record receipts before export becomes an operator action.","Keep mobile review parity so approvals, incidents, and patch proposals can be inspected away from the desktop workbench."],Xg=["local trust and lease posture for registered local runtimes","channel-action and comparison posture data in the shared Builder snapshot","preview, readiness, export, and mobile-review state derived from the same workspace snapshot"];function xg(){return Te("div",{className:"space-y-10",children:[Te("section",{className:"space-y-3",children:[E("p",{className:"editorial-kicker",children:"Spec pack"}),E("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Builder is a governed authoring control plane, not a frontier coding agent."}),Te("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:["The implemented Builder stack sits across"," ",E("code",{children:"@contractspec/lib.builder-spec"}),","," ",E("code",{children:"@contractspec/lib.builder-runtime"}),","," ",E("code",{children:"@contractspec/lib.provider-spec"}),", and the reusable workbench/mobile modules. It orchestrates inputs, provider routing, readiness, and export decisions on top of the OSS ContractSpec foundation and the Studio operating layer."]})]}),Te("section",{className:"editorial-proof-strip",children:[Te("div",{className:"editorial-stat",children:[E("span",{className:"editorial-label",children:"What Builder owns"}),E("span",{className:"editorial-stat-value",children:"fusion, routing, readiness, export"})]}),E("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Builder delegates synthesis and coding to external execution providers. Its job is to keep those runs policy-aware, provenance-rich, and usable from both desktop and mobile operator surfaces."})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Implemented stack and entrypoints"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"You can use the type surfaces directly in code, or start from the already wired workbench and mobile review routes in the public app shell."})]}),E(Pr,{language:"text",filename:"builder-stack",code:`Packages
4448
+ });`})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 3: Policy Engine"}),vo("p",{children:"The Policy Decision Point (PDP) verifies that the authenticated user actually belongs to the requested tenant before any operation logic runs."})]})]})}import{CodeBlock as Pr}from"@contractspec/lib.design-system";import el from"@contractspec/lib.ui-link";import{jsx as E,jsxs as Te}from"react/jsx-runtime";var Zg=[{title:"Managed",body:"Best when the team wants the platform to own setup, routing, readiness, API defaults, and mobile-safe operator flows."},{title:"Local",body:"Best for power users who want local-daemon registration, tenant-local execution providers, and tighter data-locality control."},{title:"Hybrid",body:"Best when some work should stay local while preview, review, export, or mobile operator flows still use managed coordination."}],Xg=["Bootstrap managed, local-daemon, or hybrid presets explicitly instead of inventing provider posture ad hoc per host.","Capture prompts, files, voice, and other inbound sources into a typed workspace instead of relying on a single chat transcript.","Fuse the sources into decisions, assumptions, and blueprint updates with provenance and approval memory.","Compile authoring work into execution lanes, then route the work to explicit provider profiles and runtime targets.","Create previews, run readiness gates, and record receipts before export becomes an operator action.","Keep mobile review parity so approvals, incidents, and patch proposals can be inspected away from the desktop workbench."],$g=["local trust and lease posture for registered local runtimes","channel-action and comparison posture data in the shared Builder snapshot","preview, readiness, export, and mobile-review state derived from the same workspace snapshot"];function xg(){return Te("div",{className:"space-y-10",children:[Te("section",{className:"space-y-3",children:[E("p",{className:"editorial-kicker",children:"Spec pack"}),E("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Builder is a governed authoring control plane, not a frontier coding agent."}),Te("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:["The implemented Builder stack sits across"," ",E("code",{children:"@contractspec/lib.builder-spec"}),","," ",E("code",{children:"@contractspec/lib.builder-runtime"}),","," ",E("code",{children:"@contractspec/lib.provider-spec"}),", and the reusable workbench/mobile modules. It orchestrates inputs, provider routing, readiness, and export decisions on top of the OSS ContractSpec foundation and the Studio operating layer."]})]}),Te("section",{className:"editorial-proof-strip",children:[Te("div",{className:"editorial-stat",children:[E("span",{className:"editorial-label",children:"What Builder owns"}),E("span",{className:"editorial-stat-value",children:"fusion, routing, readiness, export"})]}),E("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Builder delegates synthesis and coding to external execution providers. Its job is to keep those runs policy-aware, provenance-rich, and usable from both desktop and mobile operator surfaces."})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Implemented stack and entrypoints"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"You can use the type surfaces directly in code, or start from the already wired workbench and mobile review routes in the public app shell."})]}),E(Pr,{language:"text",filename:"builder-stack",code:`Packages
4449
4449
  - @contractspec/lib.builder-spec
4450
4450
  - @contractspec/lib.builder-runtime
4451
4451
  - @contractspec/lib.provider-spec
@@ -4459,7 +4459,7 @@ Web app routes
4459
4459
  Operate API proxy
4460
4460
  - /api/operate/builder/queries/builder.workspace.snapshot
4461
4461
  - /api/operate/builder/commands/builder.blueprint.patch
4462
- - /api/operate/builder/commands/builder.export.execute`})]}),E("section",{className:"grid gap-4 md:grid-cols-3",children:Zg.map((e)=>Te("article",{className:"editorial-panel space-y-3",children:[E("h2",{className:"font-semibold text-xl",children:e.title}),E("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),Te("section",{className:"grid gap-5 lg:grid-cols-2",children:[Te("article",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Typical Builder loop"}),E("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:$g.map((e)=>E("li",{children:e},e))})]}),Te("article",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What Builder should not become"}),Te("ul",{className:"editorial-list",children:[Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a competitor to specialized coding agents such as Codex or Claude Code."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a managed-only product that traps teams away from OSS-local runtime paths."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a hidden routing layer that obscures provider provenance, receipts, or runtime mode."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a desktop-only surface. Mobile review parity is part of the control-plane contract."})]})]})]})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Workspace config carries the current Builder defaults"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"Builder setup is no longer just an app-shell concern. The shared workspace config now carries runtime mode, bootstrap preset, control plane API defaults, and local runtime registration metadata so the CLI, editors, and web shells resolve the same posture."})]}),E(Pr,{language:"json",filename:".contractsrc.json",code:`{
4462
+ - /api/operate/builder/commands/builder.export.execute`})]}),E("section",{className:"grid gap-4 md:grid-cols-3",children:Zg.map((e)=>Te("article",{className:"editorial-panel space-y-3",children:[E("h2",{className:"font-semibold text-xl",children:e.title}),E("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))}),Te("section",{className:"grid gap-5 lg:grid-cols-2",children:[Te("article",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Typical Builder loop"}),E("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:Xg.map((e)=>E("li",{children:e},e))})]}),Te("article",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What Builder should not become"}),Te("ul",{className:"editorial-list",children:[Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a competitor to specialized coding agents such as Codex or Claude Code."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a managed-only product that traps teams away from OSS-local runtime paths."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a hidden routing layer that obscures provider provenance, receipts, or runtime mode."})]}),Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:"Not a desktop-only surface. Mobile review parity is part of the control-plane contract."})]})]})]})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Workspace config carries the current Builder defaults"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"Builder setup is no longer just an app-shell concern. The shared workspace config now carries runtime mode, bootstrap preset, control plane API defaults, and local runtime registration metadata so the CLI, editors, and web shells resolve the same posture."})]}),E(Pr,{language:"json",filename:".contractsrc.json",code:`{
4463
4463
  "builder": {
4464
4464
  "enabled": true,
4465
4465
  "runtimeMode": "local",
@@ -4474,7 +4474,7 @@ Operate API proxy
4474
4474
  "providerIds": ["provider.codex", "provider.local.model"]
4475
4475
  }
4476
4476
  }
4477
- }`})]}),Te("section",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Operator posture stays visible"}),E("ul",{className:"editorial-list",children:Xg.map((e)=>Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:e})]},e))})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Use the workbench UI as the host surface"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"The reusable module already exposes the desktop workbench shell. Your host app keeps control of action wiring, runtime mode selection, and approval flows."})]}),E(Pr,{language:"tsx",filename:"BuilderWorkbenchHost.tsx",code:`import { BuilderWorkbench, useBuilderWorkbenchState } from "@contractspec/module.builder-workbench";
4477
+ }`})]}),Te("section",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Operator posture stays visible"}),E("ul",{className:"editorial-list",children:$g.map((e)=>Te("li",{children:[E("span",{className:"editorial-list-marker"}),E("span",{children:e})]},e))})]}),Te("section",{className:"editorial-panel space-y-5",children:[Te("div",{className:"space-y-2",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Use the workbench UI as the host surface"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"The reusable module already exposes the desktop workbench shell. Your host app keeps control of action wiring, runtime mode selection, and approval flows."})]}),E(Pr,{language:"tsx",filename:"BuilderWorkbenchHost.tsx",code:`import { BuilderWorkbench, useBuilderWorkbenchState } from "@contractspec/module.builder-workbench";
4478
4478
 
4479
4479
  const state = useBuilderWorkbenchState({
4480
4480
  workspace: initialSnapshot.workspace,
@@ -4492,7 +4492,7 @@ const state = useBuilderWorkbenchState({
4492
4492
  onRunReadiness={runReadiness}
4493
4493
  onExecuteExport={executeExport}
4494
4494
  selectedExportRuntimeMode="hybrid"
4495
- />;`})]}),Te("section",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Read this with the Studio bridge in mind"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"Builder is where the OSS foundation meets the richer operating layer. Use the Studio overview when you want the higher-level product posture and team workflows on top of these contracts."}),Te("div",{className:"flex flex-wrap gap-3",children:[E(el,{href:"/docs/studio",className:"btn-primary",children:"Studio overview"}),E(el,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})]})}import jg from"@contractspec/lib.ui-link";import{ChevronRight as ef}from"lucide-react";import{jsx as Ht,jsxs as ba}from"react/jsx-runtime";function tf(){return ba("div",{className:"space-y-8",children:[ba("div",{className:"space-y-2",children:[Ht("h1",{className:"font-bold text-4xl",children:"Capabilities"}),Ht("p",{className:"text-lg text-muted-foreground",children:"Capabilities are the core building block of ContractSpec. They define what your app can do."})]}),ba("div",{className:"space-y-6",children:[ba("div",{className:"space-y-3",children:[Ht("h2",{className:"font-bold text-2xl",children:"Overview"}),Ht("p",{className:"text-muted-foreground",children:"A ContractSpec (or Capability) is a typed, declarative description of an operation. It defines the operation's name, version, inputs, outputs, policies, and side effects. Runtime adapters automatically serve these as REST/GraphQL/MCP endpoints with full validation and policy enforcement."})]}),ba("div",{className:"space-y-3",children:[Ht("h2",{className:"font-bold text-2xl",children:"Defining a Command (Write)"}),Ht("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ht("pre",{children:`import { defineCommand } from '@contractspec/lib.contracts-spec';
4495
+ />;`})]}),Te("section",{className:"editorial-panel space-y-4",children:[E("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Read this with the Studio bridge in mind"}),E("p",{className:"text-muted-foreground text-sm leading-7",children:"Builder is where the OSS foundation meets the richer operating layer. Use the Studio overview when you want the higher-level product posture and team workflows on top of these contracts."}),Te("div",{className:"flex flex-wrap gap-3",children:[E(el,{href:"/docs/studio",className:"btn-primary",children:"Studio overview"}),E(el,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})]})}import jg from"@contractspec/lib.ui-link";import{ChevronRight as eh}from"lucide-react";import{jsx as qt,jsxs as ba}from"react/jsx-runtime";function th(){return ba("div",{className:"space-y-8",children:[ba("div",{className:"space-y-2",children:[qt("h1",{className:"font-bold text-4xl",children:"Capabilities"}),qt("p",{className:"text-lg text-muted-foreground",children:"Capabilities are the core building block of ContractSpec. They define what your app can do."})]}),ba("div",{className:"space-y-6",children:[ba("div",{className:"space-y-3",children:[qt("h2",{className:"font-bold text-2xl",children:"Overview"}),qt("p",{className:"text-muted-foreground",children:"A ContractSpec (or Capability) is a typed, declarative description of an operation. It defines the operation's name, version, inputs, outputs, policies, and side effects. Runtime adapters automatically serve these as REST/GraphQL/MCP endpoints with full validation and policy enforcement."})]}),ba("div",{className:"space-y-3",children:[qt("h2",{className:"font-bold text-2xl",children:"Defining a Command (Write)"}),qt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:qt("pre",{children:`import { defineCommand } from '@contractspec/lib.contracts-spec';
4496
4496
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
4497
4497
 
4498
4498
  const TransferFundsInput = new SchemaModel({
@@ -4530,7 +4530,7 @@ export const TransferFunds = defineCommand({
4530
4530
  auth: 'user',
4531
4531
  flags: ['payments_enabled'],
4532
4532
  },
4533
- });`})})]}),ba("div",{className:"space-y-3",children:[Ht("h2",{className:"font-bold text-2xl",children:"Schema Types"}),ba("p",{className:"text-muted-foreground",children:["ContractSpec uses ",Ht("code",{children:"@contractspec/lib.schema"})," for I/O definitions. This provides Zod validation, GraphQL types, and JSON Schema from a single source."]}),ba("ul",{className:"space-y-2 text-muted-foreground",children:[ba("li",{children:["•"," ",Ht("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.NonEmptyString()"})," ","- Non-empty text"]}),ba("li",{children:["•"," ",Ht("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.PositiveNumber()"})," ","- Positive numbers"]}),ba("li",{children:["•"," ",Ht("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.DateTime()"})," ","- ISO 8601 timestamps"]}),ba("li",{children:["•"," ",Ht("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.Email()"})," ","- Valid email addresses"]}),ba("li",{children:["•"," ",Ht("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum(...)"})," ","- Type-safe enums"]})]})]}),Ht("div",{className:"flex items-center gap-4 pt-4",children:ba(jg,{href:"/docs/specs/dataviews",className:"btn-primary",children:["Next: DataViews ",Ht(ef,{size:16})]})})]})]})}import{CodeBlock as af}from"@contractspec/lib.design-system";import tl from"@contractspec/lib.ui-link";import{jsx as oe,jsxs as vt}from"react/jsx-runtime";var of=[{title:"ContextPack",body:"Projects the current repo state, impacted contracts, canon packs, policy bindings, and acceptance checks into one task-scoped envelope."},{title:"PlanPacket",body:"Compiles a candidate objective into ACP-aware steps plus explicit refs back to control-plane intent, plan compile, and plan verify contracts."},{title:"PatchVerdict",body:"Classifies one file edit or shell command as permit, rewrite, require_review, or deny, with runtime-linked control-plane state when available."},{title:"ReviewPacket",body:"Persists the evidence a human needs when Connect escalates, while keeping the local artifact trail authoritative in OSS mode."}],rf=["`.contractspec/adoption/catalog.json` mirrored from the bundled ContractSpec catalog","family-aware reuse recommendations for `ui`, `contracts`, `integrations`, `runtime`, `sharedLibs`, and `solutions`","verdict thresholds that can prefer workspace reuse, ContractSpec reuse, review, or explicit denial before a new implementation starts"],nf=["Enable `connect` in `.contractsrc.json` and keep your protected, immutable, generated, and smoke-check policies explicit.","Run `contractspec connect context` and `contractspec connect plan` before risky work so the agent is operating on task-scoped evidence, not ambient repo assumptions.","Gate file and shell mutations through `contractspec connect verify` or the host hook commands instead of inventing editor-specific approval logic.","Inspect pending review packets locally first, then sync them to the Studio bridge only if your team wants centralized operator workflows.","Use replay and harness evaluation to prove whether a prior decision stayed safe when the workspace changed."],cf=["Connect is not a second control plane or a second package family.","Verdicts are projections over existing `controlPlane.*`, ACP, workspace, and harness primitives.","Studio is optional for baseline enforcement. Local artifacts remain the OSS source of truth.","Destructive commands, protected paths, drift, and unknown impact stay visible instead of being hidden behind adapter magic."];function lf(){return vt("div",{className:"space-y-10",children:[vt("section",{className:"space-y-3",children:[oe("p",{className:"editorial-kicker",children:"Spec pack"}),oe("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"ContractSpec Connect puts coding-agent actions behind explicit, local-first governance."}),oe("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"Connect is the adapter layer between agent-native actions and the existing ContractSpec stack. It reuses control-plane, ACP, workspace, knowledge, and harness primitives to explain what the agent is trying to do before a file edit or shell command lands."})]}),vt("section",{className:"editorial-proof-strip",children:[vt("div",{className:"editorial-stat",children:[oe("span",{className:"editorial-label",children:"Authoritative surfaces"}),oe("span",{className:"editorial-stat-value",children:"control plane, ACP, workspace, harness"})]}),oe("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Connect stays narrow on purpose. It projects local evidence, maps its verdicts back to runtime semantics, and leaves the canonical system contracts where they already live."})]}),vt("section",{className:"editorial-panel space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What you use in practice"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"The CLI and the workspace service already implement the pack. The main workflow is local initialization, task projection, verification, then optional review sync."})]}),oe(af,{language:"bash",filename:"contractspec-connect",code:`contractspec connect init --scope workspace
4533
+ });`})})]}),ba("div",{className:"space-y-3",children:[qt("h2",{className:"font-bold text-2xl",children:"Schema Types"}),ba("p",{className:"text-muted-foreground",children:["ContractSpec uses ",qt("code",{children:"@contractspec/lib.schema"})," for I/O definitions. This provides Zod validation, GraphQL types, and JSON Schema from a single source."]}),ba("ul",{className:"space-y-2 text-muted-foreground",children:[ba("li",{children:["•"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.NonEmptyString()"})," ","- Non-empty text"]}),ba("li",{children:["•"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.PositiveNumber()"})," ","- Positive numbers"]}),ba("li",{children:["•"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.DateTime()"})," ","- ISO 8601 timestamps"]}),ba("li",{children:["•"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.Email()"})," ","- Valid email addresses"]}),ba("li",{children:["•"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"defineEnum(...)"})," ","- Type-safe enums"]})]})]}),qt("div",{className:"flex items-center gap-4 pt-4",children:ba(jg,{href:"/docs/specs/dataviews",className:"btn-primary",children:["Next: DataViews ",qt(eh,{size:16})]})})]})]})}import{CodeBlock as ah}from"@contractspec/lib.design-system";import tl from"@contractspec/lib.ui-link";import{jsx as oe,jsxs as vt}from"react/jsx-runtime";var oh=[{title:"ContextPack",body:"Projects the current repo state, impacted contracts, canon packs, policy bindings, and acceptance checks into one task-scoped envelope."},{title:"PlanPacket",body:"Compiles a candidate objective into ACP-aware steps plus explicit refs back to control-plane intent, plan compile, and plan verify contracts."},{title:"PatchVerdict",body:"Classifies one file edit or shell command as permit, rewrite, require_review, or deny, with runtime-linked control-plane state when available."},{title:"ReviewPacket",body:"Persists the evidence a human needs when Connect escalates, while keeping the local artifact trail authoritative in OSS mode."}],ih=["`.contractspec/adoption/catalog.json` mirrored from the bundled ContractSpec catalog","family-aware reuse recommendations for `ui`, `contracts`, `integrations`, `runtime`, `sharedLibs`, and `solutions`","verdict thresholds that can prefer workspace reuse, ContractSpec reuse, review, or explicit denial before a new implementation starts"],rh=["Enable `connect` in `.contractsrc.json` and keep your protected, immutable, generated, and smoke-check policies explicit.","Run `contractspec connect context` and `contractspec connect plan` before risky work so the agent is operating on task-scoped evidence, not ambient repo assumptions.","Gate file and shell mutations through `contractspec connect verify` or the host hook commands instead of inventing editor-specific approval logic.","Inspect pending review packets locally first, then sync them to the Studio bridge only if your team wants centralized operator workflows.","Use replay and harness evaluation to prove whether a prior decision stayed safe when the workspace changed."],nh=["Connect is not a second control plane or a second package family.","Verdicts are projections over existing `controlPlane.*`, ACP, workspace, and harness primitives.","Studio is optional for baseline enforcement. Local artifacts remain the OSS source of truth.","Destructive commands, protected paths, drift, and unknown impact stay visible instead of being hidden behind adapter magic."];function ch(){return vt("div",{className:"space-y-10",children:[vt("section",{className:"space-y-3",children:[oe("p",{className:"editorial-kicker",children:"Spec pack"}),oe("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"ContractSpec Connect puts coding-agent actions behind explicit, local-first governance."}),oe("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"Connect is the adapter layer between agent-native actions and the existing ContractSpec stack. It reuses control-plane, ACP, workspace, knowledge, and harness primitives to explain what the agent is trying to do before a file edit or shell command lands."})]}),vt("section",{className:"editorial-proof-strip",children:[vt("div",{className:"editorial-stat",children:[oe("span",{className:"editorial-label",children:"Authoritative surfaces"}),oe("span",{className:"editorial-stat-value",children:"control plane, ACP, workspace, harness"})]}),oe("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Connect stays narrow on purpose. It projects local evidence, maps its verdicts back to runtime semantics, and leaves the canonical system contracts where they already live."})]}),vt("section",{className:"editorial-panel space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What you use in practice"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"The CLI and the workspace service already implement the pack. The main workflow is local initialization, task projection, verification, then optional review sync."})]}),oe(ah,{language:"bash",filename:"contractspec-connect",code:`contractspec connect init --scope workspace
4534
4534
  contractspec connect adoption sync --json
4535
4535
  printf '{"goal":"Prefer an existing release helper before adding a new one"}' | contractspec connect adoption resolve --family sharedLibs --stdin --json
4536
4536
  contractspec connect context --task refactor-docs --paths packages/libs/contracts-spec/src/control-plane/contracts.ts --json
@@ -4538,7 +4538,7 @@ printf '{"objective":"Document the control-plane contract surface","commands":["
4538
4538
  printf '{"operation":"edit","path":"packages/libs/contracts-spec/src/control-plane/contracts.ts"}' | contractspec connect verify --task refactor-docs --tool acp.fs.access --stdin --json
4539
4539
  printf 'bun run typecheck' | contractspec connect verify --task refactor-docs --tool acp.terminal.exec --stdin --json
4540
4540
  contractspec connect review list --json
4541
- contractspec connect replay <decisionId> --json`})]}),vt("section",{className:"space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"The four core artifacts"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Every Connect command is there to emit or inspect one of these reviewable objects under `.contractspec/connect/*`."})]}),oe("div",{className:"grid gap-4 md:grid-cols-2",children:of.map((e)=>vt("article",{className:"editorial-panel space-y-3",children:[oe("h3",{className:"font-semibold text-xl",children:e.title}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))})]}),vt("section",{className:"editorial-panel space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Reuse-first adoption is part of the workflow"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Connect adoption keeps reuse guidance in the same local control surface. Before a new contract family, helper, or runtime abstraction lands, Connect can mirror the bundled catalog and resolve the best reuse candidate by family."})]}),oe("ul",{className:"editorial-list",children:rf.map((e)=>vt("li",{children:[oe("span",{className:"editorial-list-marker"}),oe("span",{children:e})]},e))})]}),vt("section",{className:"grid gap-5 lg:grid-cols-2",children:[vt("article",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adopt Connect in this order"}),oe("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:nf.map((e)=>oe("li",{children:e},e))})]}),vt("article",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Boundaries that keep it trustworthy"}),oe("ul",{className:"editorial-list",children:cf.map((e)=>vt("li",{children:[oe("span",{className:"editorial-list-marker"}),oe("span",{children:e})]},e))})]})]}),vt("section",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Where Connect fits in the rest of the docs"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Read the control-plane runtime page when you want the underlying governance contracts, then use the Studio bridge only if your team wants centralized review queues on top of the OSS-local evidence path."}),vt("div",{className:"flex flex-wrap gap-3",children:[oe(tl,{href:"/docs/architecture/control-plane",className:"btn-primary",children:"Control-plane runtime"}),oe(tl,{href:"/docs/studio",className:"btn-ghost",children:"Studio bridge"})]})]})]})}import Wi from"@contractspec/lib.ui-link";import{ChevronRight as sf}from"lucide-react";import{jsx as G,jsxs as ve}from"react/jsx-runtime";var df=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
4541
+ contractspec connect replay <decisionId> --json`})]}),vt("section",{className:"space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"The four core artifacts"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Every Connect command is there to emit or inspect one of these reviewable objects under `.contractspec/connect/*`."})]}),oe("div",{className:"grid gap-4 md:grid-cols-2",children:oh.map((e)=>vt("article",{className:"editorial-panel space-y-3",children:[oe("h3",{className:"font-semibold text-xl",children:e.title}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:e.body})]},e.title))})]}),vt("section",{className:"editorial-panel space-y-5",children:[vt("div",{className:"space-y-2",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Reuse-first adoption is part of the workflow"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Connect adoption keeps reuse guidance in the same local control surface. Before a new contract family, helper, or runtime abstraction lands, Connect can mirror the bundled catalog and resolve the best reuse candidate by family."})]}),oe("ul",{className:"editorial-list",children:ih.map((e)=>vt("li",{children:[oe("span",{className:"editorial-list-marker"}),oe("span",{children:e})]},e))})]}),vt("section",{className:"grid gap-5 lg:grid-cols-2",children:[vt("article",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adopt Connect in this order"}),oe("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:rh.map((e)=>oe("li",{children:e},e))})]}),vt("article",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Boundaries that keep it trustworthy"}),oe("ul",{className:"editorial-list",children:nh.map((e)=>vt("li",{children:[oe("span",{className:"editorial-list-marker"}),oe("span",{children:e})]},e))})]})]}),vt("section",{className:"editorial-panel space-y-4",children:[oe("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Where Connect fits in the rest of the docs"}),oe("p",{className:"text-muted-foreground text-sm leading-7",children:"Read the control-plane runtime page when you want the underlying governance contracts, then use the Studio bridge only if your team wants centralized review queues on top of the OSS-local evidence path."}),vt("div",{className:"flex flex-wrap gap-3",children:[oe(tl,{href:"/docs/architecture/control-plane",className:"btn-primary",children:"Control-plane runtime"}),oe(tl,{href:"/docs/studio",className:"btn-ghost",children:"Studio bridge"})]})]})]})}import Wi from"@contractspec/lib.ui-link";import{ChevronRight as lh}from"lucide-react";import{jsx as G,jsxs as ve}from"react/jsx-runtime";var sh=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
4542
4542
  import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';
4543
4543
 
4544
4544
  export const DataGridShowcaseDataView = defineDataView({
@@ -4585,7 +4585,7 @@ export const DataGridShowcaseDataView = defineDataView({
4585
4585
  { key: 'notes', label: 'Notes', dataPath: 'notes' },
4586
4586
  ],
4587
4587
  },
4588
- });`;function pf(){return ve("div",{className:"space-y-8",children:[ve("div",{className:"space-y-4",children:[G("h1",{className:"font-bold text-4xl",children:"DataViews"}),ve("p",{className:"text-muted-foreground",children:["A ",G("strong",{children:"DataViewSpec"})," describes how data should be queried, filtered, sorted, and presented to users. Runtime adapters execute optimized database queries and serve list views, detail views, and search interfaces while respecting policy constraints."]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Core concepts"}),ve("div",{className:"space-y-3",children:[ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Data sources"}),G("p",{className:"text-muted-foreground",children:"A DataView connects to one or more data sources—databases, APIs, or other capabilities. You specify the source and the fields you want to expose."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Filtering"}),G("p",{className:"text-muted-foreground",children:`Define filters that users can apply to narrow down results. Filters can be simple (e.g., "status equals 'active'") or complex (e.g., "created within the last 30 days AND assigned to current user").`})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Sorting"}),G("p",{className:"text-muted-foreground",children:"Specify which fields can be sorted and the default sort order. ContractSpec generates efficient database queries with proper indexes."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Pagination"}),G("p",{className:"text-muted-foreground",children:"DataViews automatically support pagination to handle large datasets. You can configure page size limits and cursor-based or offset-based pagination."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Aggregations"}),G("p",{className:"text-muted-foreground",children:"Compute aggregates like counts, sums, averages, and group-by operations. These are useful for dashboards and summary views."})]})]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Example DataViewSpec"}),ve("p",{className:"text-muted-foreground",children:["Here is the canonical table contract used by the live"," ",G(Wi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),":"]}),G("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:G("pre",{children:df})}),G("p",{className:"text-muted-foreground text-sm",children:"This one contract drives the DataView lane, while the same rows and controller also feed the raw web primitive, native-first primitive, and composed design-system demos."})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Policy integration"}),ve("p",{className:"text-muted-foreground",children:["DataViews automatically enforce"," ",G(Wi,{href:"/docs/specs/policy",className:"text-violet-400 hover:text-violet-300",children:"PolicySpecs"}),". If a user doesn't have permission to see certain fields, those fields are automatically filtered out or redacted. If a user can only see their own data, the query is automatically scoped."]}),G("p",{className:"text-muted-foreground",children:"This means you define the data view once, and it works correctly for all users based on their permissions—no need to write separate queries for different roles."})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Served outputs"}),G("p",{className:"text-muted-foreground",children:"From a DataViewSpec, ContractSpec serves:"}),ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ve("li",{children:[G("strong",{children:"Database queries"})," – Optimized SQL or NoSQL queries executed at runtime"]}),ve("li",{children:[G("strong",{children:"API endpoints"})," – RESTful or GraphQL endpoints for fetching data"]}),ve("li",{children:[G("strong",{children:"UI components"})," – List views, tables, cards, and detail views"]}),ve("li",{children:[G("strong",{children:"Search interfaces"})," – Full-text search with autocomplete"]}),ve("li",{children:[G("strong",{children:"Export functions"})," – CSV, JSON, or Excel exports"]})]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Best practices"}),ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[G("li",{children:"Only expose fields that users actually need—this improves performance and security."}),G("li",{children:"Use appropriate indexes for sortable and filterable fields."}),G("li",{children:"Set reasonable pagination limits to prevent performance issues."}),G("li",{children:"Use aggregations sparingly—they can be expensive on large datasets."}),G("li",{children:"Test DataViews with realistic data volumes to ensure they perform well."})]})]}),ve("div",{className:"flex items-center gap-4 pt-4",children:[G(Wi,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Previous: Capabilities"}),ve(Wi,{href:"/docs/specs/workflows",className:"btn-primary",children:["Next: Workflows ",G(sf,{size:16})]})]})]})}import{CodeBlock as al}from"@contractspec/lib.design-system";import ol from"@contractspec/lib.ui-link";import{jsx as j,jsxs as tt}from"react/jsx-runtime";var mf=["declared routes, surfaces, layouts, slots, actions, and data recipes","entity registries and field renderers for relation-heavy workbenches","preference-aware adaptation across guidance, density, data depth, control, media, pace, and narrative","auditable overlays and bounded AI patch proposals instead of free-form JSX generation"],uf=["Define one `ModuleBundleSpec` with `defineModuleBundle` and keep the route and surface map explicit.","Resolve the bundle with `resolveBundle` for a real user, route, device, and preference profile.","Render the plan through `BundleProvider` and `BundleRenderer` so the UI stays downstream of the resolved spec.","Add overlays, policy hooks, planner proposals, and telemetry only after the base route resolves cleanly.","Pilot one dense domain first, such as a PM or operations workbench, before expanding the abstraction across the app."];function gf(){return tt("div",{className:"space-y-10",children:[tt("section",{className:"space-y-3",children:[j("p",{className:"editorial-kicker",children:"Spec pack"}),j("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Module bundles turn surface composition into a typed ContractSpec runtime instead of a pile of bespoke page code."}),tt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:["The implemented package is"," ",j("code",{children:"@contractspec/lib.surface-runtime"}),". It lets you define a bundle spec once, resolve it into a personalized surface plan, then render that plan through React without letting AI or per-route custom code bypass the declared system boundary."]})]}),tt("section",{className:"editorial-proof-strip",children:[tt("div",{className:"editorial-stat",children:[j("span",{className:"editorial-label",children:"Runtime promise"}),j("span",{className:"editorial-stat-value",children:"bundle spec → resolved surface plan"})]}),j("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"The bundle spec owns what can render, where it can render, which preferences matter, and how overlays and AI proposals stay bounded."})]}),j("section",{className:"grid gap-4 md:grid-cols-2",children:mf.map((e)=>tt("article",{className:"editorial-panel space-y-3",children:[j("h2",{className:"font-semibold text-xl",children:"Bundle capability"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:e})]},e))}),tt("section",{className:"editorial-panel space-y-5",children:[tt("div",{className:"space-y-2",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"1) Define the bundle"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"Start with a typed route and one surface. The runtime validates that you declared routes, surfaces, and verification coverage for all seven preference dimensions."})]}),j(al,{language:"typescript",filename:"support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
4588
+ });`;function dh(){return ve("div",{className:"space-y-8",children:[ve("div",{className:"space-y-4",children:[G("h1",{className:"font-bold text-4xl",children:"DataViews"}),ve("p",{className:"text-muted-foreground",children:["A ",G("strong",{children:"DataViewSpec"})," describes how data should be queried, filtered, sorted, and presented to users. Runtime adapters execute optimized database queries and serve list views, detail views, and search interfaces while respecting policy constraints."]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Core concepts"}),ve("div",{className:"space-y-3",children:[ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Data sources"}),G("p",{className:"text-muted-foreground",children:"A DataView connects to one or more data sources—databases, APIs, or other capabilities. You specify the source and the fields you want to expose."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Filtering"}),G("p",{className:"text-muted-foreground",children:`Define filters that users can apply to narrow down results. Filters can be simple (e.g., "status equals 'active'") or complex (e.g., "created within the last 30 days AND assigned to current user").`})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Sorting"}),G("p",{className:"text-muted-foreground",children:"Specify which fields can be sorted and the default sort order. ContractSpec generates efficient database queries with proper indexes."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Pagination"}),G("p",{className:"text-muted-foreground",children:"DataViews automatically support pagination to handle large datasets. You can configure page size limits and cursor-based or offset-based pagination."})]}),ve("div",{children:[G("h3",{className:"font-semibold text-lg",children:"Aggregations"}),G("p",{className:"text-muted-foreground",children:"Compute aggregates like counts, sums, averages, and group-by operations. These are useful for dashboards and summary views."})]})]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Example DataViewSpec"}),ve("p",{className:"text-muted-foreground",children:["Here is the canonical table contract used by the live"," ",G(Wi,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Data Grid Showcase"}),":"]}),G("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:G("pre",{children:sh})}),G("p",{className:"text-muted-foreground text-sm",children:"This one contract drives the DataView lane, while the same rows and controller also feed the raw web primitive, native-first primitive, and composed design-system demos."})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Policy integration"}),ve("p",{className:"text-muted-foreground",children:["DataViews automatically enforce"," ",G(Wi,{href:"/docs/specs/policy",className:"text-violet-400 hover:text-violet-300",children:"PolicySpecs"}),". If a user doesn't have permission to see certain fields, those fields are automatically filtered out or redacted. If a user can only see their own data, the query is automatically scoped."]}),G("p",{className:"text-muted-foreground",children:"This means you define the data view once, and it works correctly for all users based on their permissions—no need to write separate queries for different roles."})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Served outputs"}),G("p",{className:"text-muted-foreground",children:"From a DataViewSpec, ContractSpec serves:"}),ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ve("li",{children:[G("strong",{children:"Database queries"})," – Optimized SQL or NoSQL queries executed at runtime"]}),ve("li",{children:[G("strong",{children:"API endpoints"})," – RESTful or GraphQL endpoints for fetching data"]}),ve("li",{children:[G("strong",{children:"UI components"})," – List views, tables, cards, and detail views"]}),ve("li",{children:[G("strong",{children:"Search interfaces"})," – Full-text search with autocomplete"]}),ve("li",{children:[G("strong",{children:"Export functions"})," – CSV, JSON, or Excel exports"]})]})]}),ve("div",{className:"space-y-4",children:[G("h2",{className:"font-bold text-2xl",children:"Best practices"}),ve("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[G("li",{children:"Only expose fields that users actually need—this improves performance and security."}),G("li",{children:"Use appropriate indexes for sortable and filterable fields."}),G("li",{children:"Set reasonable pagination limits to prevent performance issues."}),G("li",{children:"Use aggregations sparingly—they can be expensive on large datasets."}),G("li",{children:"Test DataViews with realistic data volumes to ensure they perform well."})]})]}),ve("div",{className:"flex items-center gap-4 pt-4",children:[G(Wi,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Previous: Capabilities"}),ve(Wi,{href:"/docs/specs/workflows",className:"btn-primary",children:["Next: Workflows ",G(lh,{size:16})]})]})]})}import{CodeBlock as al}from"@contractspec/lib.design-system";import ol from"@contractspec/lib.ui-link";import{jsx as j,jsxs as tt}from"react/jsx-runtime";var ph=["declared routes, surfaces, layouts, slots, actions, and data recipes","entity registries and field renderers for relation-heavy workbenches","preference-aware adaptation across guidance, density, data depth, control, media, pace, and narrative","auditable overlays and bounded AI patch proposals instead of free-form JSX generation"],mh=["Define one `ModuleBundleSpec` with `defineModuleBundle` and keep the route and surface map explicit.","Resolve the bundle with `resolveBundle` for a real user, route, device, and preference profile.","Render the plan through `BundleProvider` and `BundleRenderer` so the UI stays downstream of the resolved spec.","Add overlays, policy hooks, planner proposals, and telemetry only after the base route resolves cleanly.","Pilot one dense domain first, such as a PM or operations workbench, before expanding the abstraction across the app."];function uh(){return tt("div",{className:"space-y-10",children:[tt("section",{className:"space-y-3",children:[j("p",{className:"editorial-kicker",children:"Spec pack"}),j("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Module bundles turn surface composition into a typed ContractSpec runtime instead of a pile of bespoke page code."}),tt("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:["The implemented package is"," ",j("code",{children:"@contractspec/lib.surface-runtime"}),". It lets you define a bundle spec once, resolve it into a personalized surface plan, then render that plan through React without letting AI or per-route custom code bypass the declared system boundary."]})]}),tt("section",{className:"editorial-proof-strip",children:[tt("div",{className:"editorial-stat",children:[j("span",{className:"editorial-label",children:"Runtime promise"}),j("span",{className:"editorial-stat-value",children:"bundle spec → resolved surface plan"})]}),j("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"The bundle spec owns what can render, where it can render, which preferences matter, and how overlays and AI proposals stay bounded."})]}),j("section",{className:"grid gap-4 md:grid-cols-2",children:ph.map((e)=>tt("article",{className:"editorial-panel space-y-3",children:[j("h2",{className:"font-semibold text-xl",children:"Bundle capability"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:e})]},e))}),tt("section",{className:"editorial-panel space-y-5",children:[tt("div",{className:"space-y-2",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"1) Define the bundle"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"Start with a typed route and one surface. The runtime validates that you declared routes, surfaces, and verification coverage for all seven preference dimensions."})]}),j(al,{language:"typescript",filename:"support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
4589
4589
 
4590
4590
  export const SupportWorkbenchBundle = defineModuleBundle({
4591
4591
  meta: {
@@ -4650,7 +4650,7 @@ export function SurfaceHost() {
4650
4650
  <BundleRenderer assistantSlotId="assistant" />
4651
4651
  </BundleProvider>
4652
4652
  );
4653
- }`})]}),tt("section",{className:"grid gap-5 lg:grid-cols-2",children:[tt("article",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adoption loop"}),j("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:uf.map((e)=>j("li",{children:e},e))})]}),tt("article",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Guardrails that matter"}),tt("ul",{className:"editorial-list",children:[tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Do not stuff this behavior back into `lib.ui-kit`."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Do not let AI invent undeclared components or mutate raw DOM state."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Keep third-party UI libraries behind adapter subpaths only."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Every surface still needs explicit verification coverage for the seven preference dimensions."})]})]})]})]}),tt("section",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Continue with overlays and runtime architecture"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"Once the bundle resolves deterministically, move into safe customization and the wider architecture that surrounds it."}),tt("div",{className:"flex flex-wrap gap-3",children:[j(ol,{href:"/docs/specs/overlays",className:"btn-primary",children:"Overlays"}),j(ol,{href:"/docs/architecture",className:"btn-ghost",children:"Architecture overview"})]})]})]})}import ai from"@contractspec/lib.ui-link";import{ChevronRight as ff}from"lucide-react";import{jsx as y,jsxs as O}from"react/jsx-runtime";function hf(){return O("div",{className:"space-y-8",children:[O("div",{className:"space-y-4",children:[y("h1",{className:"font-bold text-4xl",children:"Overlays"}),O("p",{className:"text-muted-foreground",children:["An ",y("strong",{children:"OverlaySpec"})," allows tenants or users to customize UI layouts and field visibility without modifying the underlying application code. Overlays are cryptographically signed to ensure they respect policy boundaries and cannot introduce security vulnerabilities."]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Why overlays matter"}),y("p",{className:"text-muted-foreground",children:"Different users have different needs. A power user might want to see all available fields and actions, while a casual user prefers a simplified interface. A tenant in a multi-tenant application might want to brand the UI or hide features they don't use."}),y("p",{className:"text-muted-foreground",children:"Traditional approaches require either building multiple UIs or adding complex configuration logic throughout the codebase. OverlaySpecs provide a safer, more maintainable solution: users can customize their experience, but only within the bounds allowed by the underlying specs and policies."})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"What overlays can do"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Hide or show fields"})," – Remove fields from forms or detail views (but only if the user has permission to see them in the first place)"]}),O("li",{children:[y("strong",{children:"Reorder fields"})," – Change the order in which fields appear"]}),O("li",{children:[y("strong",{children:"Rename labels"})," – Use different terminology that's more familiar to the user"]}),O("li",{children:[y("strong",{children:"Change layouts"})," – Switch between list, grid, or card views"]}),O("li",{children:[y("strong",{children:"Add help text"})," – Provide context-specific guidance"]}),O("li",{children:[y("strong",{children:"Set default values"})," – Pre-fill forms with tenant-specific defaults"]}),O("li",{children:[y("strong",{children:"Apply branding"})," – Customize colors, logos, and styling (within approved themes)"]})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Example OverlaySpec"}),y("p",{className:"text-muted-foreground",children:"Here's an overlay that customizes an order form:"}),y("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:y("pre",{children:`overlayId: acme-order-form
4653
+ }`})]}),tt("section",{className:"grid gap-5 lg:grid-cols-2",children:[tt("article",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adoption loop"}),j("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground text-sm leading-7",children:mh.map((e)=>j("li",{children:e},e))})]}),tt("article",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Guardrails that matter"}),tt("ul",{className:"editorial-list",children:[tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Do not stuff this behavior back into `lib.ui-kit`."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Do not let AI invent undeclared components or mutate raw DOM state."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Keep third-party UI libraries behind adapter subpaths only."})]}),tt("li",{children:[j("span",{className:"editorial-list-marker"}),j("span",{children:"Every surface still needs explicit verification coverage for the seven preference dimensions."})]})]})]})]}),tt("section",{className:"editorial-panel space-y-4",children:[j("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Continue with overlays and runtime architecture"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"Once the bundle resolves deterministically, move into safe customization and the wider architecture that surrounds it."}),tt("div",{className:"flex flex-wrap gap-3",children:[j(ol,{href:"/docs/specs/overlays",className:"btn-primary",children:"Overlays"}),j(ol,{href:"/docs/architecture",className:"btn-ghost",children:"Architecture overview"})]})]})]})}import ai from"@contractspec/lib.ui-link";import{ChevronRight as gh}from"lucide-react";import{jsx as y,jsxs as O}from"react/jsx-runtime";function hh(){return O("div",{className:"space-y-8",children:[O("div",{className:"space-y-4",children:[y("h1",{className:"font-bold text-4xl",children:"Overlays"}),O("p",{className:"text-muted-foreground",children:["An ",y("strong",{children:"OverlaySpec"})," allows tenants or users to customize UI layouts and field visibility without modifying the underlying application code. Overlays are cryptographically signed to ensure they respect policy boundaries and cannot introduce security vulnerabilities."]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Why overlays matter"}),y("p",{className:"text-muted-foreground",children:"Different users have different needs. A power user might want to see all available fields and actions, while a casual user prefers a simplified interface. A tenant in a multi-tenant application might want to brand the UI or hide features they don't use."}),y("p",{className:"text-muted-foreground",children:"Traditional approaches require either building multiple UIs or adding complex configuration logic throughout the codebase. OverlaySpecs provide a safer, more maintainable solution: users can customize their experience, but only within the bounds allowed by the underlying specs and policies."})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"What overlays can do"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Hide or show fields"})," – Remove fields from forms or detail views (but only if the user has permission to see them in the first place)"]}),O("li",{children:[y("strong",{children:"Reorder fields"})," – Change the order in which fields appear"]}),O("li",{children:[y("strong",{children:"Rename labels"})," – Use different terminology that's more familiar to the user"]}),O("li",{children:[y("strong",{children:"Change layouts"})," – Switch between list, grid, or card views"]}),O("li",{children:[y("strong",{children:"Add help text"})," – Provide context-specific guidance"]}),O("li",{children:[y("strong",{children:"Set default values"})," – Pre-fill forms with tenant-specific defaults"]}),O("li",{children:[y("strong",{children:"Apply branding"})," – Customize colors, logos, and styling (within approved themes)"]})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Example OverlaySpec"}),y("p",{className:"text-muted-foreground",children:"Here's an overlay that customizes an order form:"}),y("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:y("pre",{children:`overlayId: acme-order-form
4654
4654
  version: '1.0.0'.0.0
4655
4655
  appliesTo:
4656
4656
  capability: createOrder
@@ -4687,7 +4687,7 @@ modifications:
4687
4687
  signature:
4688
4688
  algorithm: EdDSA
4689
4689
  publicKey: "acme-corp-overlay-key"
4690
- signature: "base64-encoded-signature"`})})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Safety guarantees"}),y("p",{className:"text-muted-foreground",children:"Overlays are powerful, but they must not compromise security or data integrity. ContractSpec enforces several guarantees:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Overlays cannot grant new permissions"})," – They can only hide or rearrange what the user is already allowed to see"]}),O("li",{children:[y("strong",{children:"Overlays cannot bypass validation"})," – Field types, constraints, and business rules from the underlying spec still apply"]}),O("li",{children:[y("strong",{children:"Overlays must be signed"})," – Only authorized parties (typically tenant admins) can create overlays"]}),O("li",{children:[y("strong",{children:"Overlays are versioned"})," – Changes to overlays are tracked and can be rolled back"]}),O("li",{children:[y("strong",{children:"Overlays are audited"})," – Every overlay application is logged"]})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Creating overlays"}),y("p",{className:"text-muted-foreground",children:"Overlays can be created through:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Visual editor"})," – A drag-and-drop interface for non-technical users"]}),O("li",{children:[y("strong",{children:"TypeScript/JSON"})," – For developers who prefer code"]}),O("li",{children:[y("strong",{children:"API"})," – Programmatically create overlays for automation"]})]}),y("p",{className:"text-muted-foreground",children:"Once created, overlays must be signed using a private key. The corresponding public key is registered with ContractSpec, which verifies the signature before applying the overlay."}),O("p",{className:"text-muted-foreground",children:["See"," ",y(ai,{href:"/docs/libraries/overlay-engine",className:"text-violet-400 underline",children:"Overlay Engine docs"})," ","and the"," ",y(ai,{href:"/docs/advanced/overlay-editor",className:"text-violet-400 underline",children:"Overlay Editor guide"})," ","for end-to-end workflows."]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Overlay scope"}),y("p",{className:"text-muted-foreground",children:"Overlays can be scoped to:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Tenant"})," – All users in a tenant see the same overlay"]}),O("li",{children:[y("strong",{children:"User"})," – Individual users can have personal overlays"]}),O("li",{children:[y("strong",{children:"Role"})," – All users with a specific role see the overlay"]}),O("li",{children:[y("strong",{children:"Device"})," – Different overlays for mobile vs desktop"]})]}),y("p",{className:"text-muted-foreground",children:"If multiple overlays apply to the same user, they are merged in order of specificity (user overlays override role overlays, which override tenant overlays)."})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Best practices"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[y("li",{children:"Start with the default UI and only create overlays when users request specific changes."}),y("li",{children:"Document why each overlay modification was made—this helps when reviewing or updating overlays."}),y("li",{children:"Test overlays thoroughly to ensure they don't break workflows or confuse users."}),y("li",{children:"Use tenant-level overlays for organizational customizations and user-level overlays for personal preferences."}),y("li",{children:"Regularly review overlays to remove ones that are no longer needed."}),y("li",{children:"Protect overlay signing keys carefully—they control what customizations are allowed."})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Where overlays fit in the runtime"}),y("p",{className:"text-muted-foreground",children:"Overlays are safest when they sit on top of a declared bundle surface instead of ad hoc page code. Use the module-bundles docs first, then apply overlays as auditable customization on top of the resolved surface plan."}),O("div",{className:"flex flex-wrap gap-3",children:[y(ai,{href:"/docs/specs/module-bundles",className:"btn-primary",children:"Module bundles"}),y(ai,{href:"/docs/guides/first-module-bundle",className:"btn-ghost",children:"Build a first module bundle"})]})]}),O("div",{className:"flex items-center gap-4 pt-4",children:[y(ai,{href:"/docs/specs/policy",className:"btn-ghost",children:"Previous: Policy"}),O(ai,{href:"/docs/safety",className:"btn-primary",children:["Next: Safety ",y(ff,{size:16})]})]})]})}import il from"@contractspec/lib.ui-link";import{ChevronRight as rl}from"lucide-react";import{jsx as me,jsxs as bt}from"react/jsx-runtime";var yf=[{title:"Capabilities",body:"Model operations, events, and presentations as explicit system behavior.",href:"/docs/specs/capabilities"},{title:"Data views",body:"Describe query, filtering, and presentation behavior from the same source model.",href:"/docs/specs/dataviews"},{title:"Workflows",body:"Coordinate multi-step execution, retries, monitoring, and hand-offs.",href:"/docs/specs/workflows"},{title:"Policy",body:"Carry governance and access rules through every generated and runtime-served surface.",href:"/docs/specs/policy"},{title:"Overlays",body:"Customize generated surfaces safely instead of forking them permanently.",href:"/docs/specs/overlays"},{title:"Safety and migration",body:"Keep change safe with signing, audits, rollbacks, and explicit migration behavior.",href:"/docs/safety"}],vf=[{title:"Module bundles",body:"Define typed surface bundles that resolve into auditable runtime plans instead of hand-built page logic.",href:"/docs/specs/module-bundles"},{title:"ContractSpec Connect",body:"Put coding-agent edits and commands behind local-first context, verification, replay, and review artifacts.",href:"/docs/specs/connect"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review on top of OSS and Studio.",href:"/docs/specs/builder-control-plane"}];function bf(){return bt("div",{className:"space-y-10",children:[bt("div",{className:"space-y-3",children:[me("p",{className:"editorial-kicker",children:"Core model"}),me("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Contracts are the durable system boundary."}),me("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec uses explicit TypeScript specs to describe behavior before it spreads across APIs, UI, data models, events, and operator flows. The goal is not to hide implementation. The goal is to make the system boundary explicit enough that generation, validation, runtime enforcement, and regeneration can stay coherent."})]}),bt("div",{className:"editorial-proof-strip",children:[bt("div",{className:"editorial-stat",children:[me("span",{className:"editorial-label",children:"System promise"}),me("span",{className:"editorial-stat-value",children:"one contract → many surfaces"})]}),me("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Use the contract layer to keep surface behavior aligned, then let runtimes and generators do the repetitive work without inventing a closed platform."})]}),me("section",{className:"editorial-panel space-y-5",children:bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What the contract layer owns"}),bt("ul",{className:"editorial-list",children:[bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Behavior: operations, events, presentations, workflows."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Validation: input, output, and schema boundaries."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Governance: policy, auditability, and migration rules."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Surface alignment: generated or served behavior across API, UI, data, and agent-facing interfaces."})]})]})]})}),bt("section",{className:"space-y-5",children:[bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Specification types"}),me("p",{className:"text-muted-foreground text-sm leading-7",children:"You can adopt the model one part at a time. Not every system needs every spec type on day one."})]}),me("div",{className:"grid gap-4 md:grid-cols-2",children:yf.map((e)=>bt(il,{href:e.href,className:"editorial-panel",children:[me("h3",{className:"font-semibold text-xl",children:e.title}),me("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body}),bt("div",{className:"mt-4 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Open section ",me(rl,{size:14})]})]},e.title))})]}),bt("section",{className:"space-y-5",children:[bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Implemented spec packs"}),me("p",{className:"text-muted-foreground text-sm leading-7",children:"These packs combine multiple contract surfaces into higher-order systems you can use directly today: agent enforcement, AI-native surface runtime, and governed Builder authoring."})]}),me("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:vf.map((e)=>bt(il,{href:e.href,className:"editorial-panel",children:[me("h3",{className:"font-semibold text-xl",children:e.title}),me("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body}),bt("div",{className:"mt-4 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Open pack ",me(rl,{size:14})]})]},e.title))})]})]})}import oi from"@contractspec/lib.ui-link";import{ChevronRight as Nf}from"lucide-react";import{jsx as m,jsxs as H}from"react/jsx-runtime";function wf(){return H("div",{className:"space-y-8",children:[H("div",{className:"space-y-4",children:[m("h1",{className:"font-bold text-4xl",children:"Policy"}),H("p",{className:"text-muted-foreground",children:["A ",m("strong",{children:"PolicySpec"})," defines who can do what, when, and under what conditions. ContractSpec uses attribute-based access control (ABAC) to enforce policies across your entire application—from API endpoints to UI components."]})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Why policies matter"}),m("p",{className:"text-muted-foreground",children:"Traditional access control relies on roles (RBAC), which can become unwieldy as applications grow. ABAC is more flexible—it evaluates policies based on attributes of the user, resource, action, and context."}),H("p",{className:"text-muted-foreground",children:["ContractSpec's policy engine ensures that access control is consistent across all surfaces. You don't have to remember to add authorization checks in every API endpoint or UI component—the"," ",m(oi,{href:"/docs/safety/pdp",className:"text-violet-400 hover:text-violet-300",children:"Policy Decision Point"})," ","enforces policies automatically."]})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Policy structure"}),m("p",{className:"text-muted-foreground",children:"A PolicySpec contains one or more rules. Each rule has:"}),H("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[H("li",{children:[m("strong",{children:"Effect"})," – PERMIT, DENY, or REDACT"]}),H("li",{children:[m("strong",{children:"Condition"})," – A boolean expression that determines when the rule applies"]}),H("li",{children:[m("strong",{children:"Scope"})," – Which resources, actions, or fields the rule applies to"]}),H("li",{children:[m("strong",{children:"Priority"})," – Rules are evaluated in priority order; the first matching rule wins"]})]})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Example PolicySpec"}),m("p",{className:"text-muted-foreground",children:"Here's a policy that controls access to customer data in TypeScript:"}),m("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:m("pre",{children:`import { definePolicy } from '@contractspec/lib.contracts-spec';
4690
+ signature: "base64-encoded-signature"`})})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Safety guarantees"}),y("p",{className:"text-muted-foreground",children:"Overlays are powerful, but they must not compromise security or data integrity. ContractSpec enforces several guarantees:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Overlays cannot grant new permissions"})," – They can only hide or rearrange what the user is already allowed to see"]}),O("li",{children:[y("strong",{children:"Overlays cannot bypass validation"})," – Field types, constraints, and business rules from the underlying spec still apply"]}),O("li",{children:[y("strong",{children:"Overlays must be signed"})," – Only authorized parties (typically tenant admins) can create overlays"]}),O("li",{children:[y("strong",{children:"Overlays are versioned"})," – Changes to overlays are tracked and can be rolled back"]}),O("li",{children:[y("strong",{children:"Overlays are audited"})," – Every overlay application is logged"]})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Creating overlays"}),y("p",{className:"text-muted-foreground",children:"Overlays can be created through:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Visual editor"})," – A drag-and-drop interface for non-technical users"]}),O("li",{children:[y("strong",{children:"TypeScript/JSON"})," – For developers who prefer code"]}),O("li",{children:[y("strong",{children:"API"})," – Programmatically create overlays for automation"]})]}),y("p",{className:"text-muted-foreground",children:"Once created, overlays must be signed using a private key. The corresponding public key is registered with ContractSpec, which verifies the signature before applying the overlay."}),O("p",{className:"text-muted-foreground",children:["See"," ",y(ai,{href:"/docs/libraries/overlay-engine",className:"text-violet-400 underline",children:"Overlay Engine docs"})," ","and the"," ",y(ai,{href:"/docs/advanced/overlay-editor",className:"text-violet-400 underline",children:"Overlay Editor guide"})," ","for end-to-end workflows."]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Overlay scope"}),y("p",{className:"text-muted-foreground",children:"Overlays can be scoped to:"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[O("li",{children:[y("strong",{children:"Tenant"})," – All users in a tenant see the same overlay"]}),O("li",{children:[y("strong",{children:"User"})," – Individual users can have personal overlays"]}),O("li",{children:[y("strong",{children:"Role"})," – All users with a specific role see the overlay"]}),O("li",{children:[y("strong",{children:"Device"})," – Different overlays for mobile vs desktop"]})]}),y("p",{className:"text-muted-foreground",children:"If multiple overlays apply to the same user, they are merged in order of specificity (user overlays override role overlays, which override tenant overlays)."})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Best practices"}),O("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[y("li",{children:"Start with the default UI and only create overlays when users request specific changes."}),y("li",{children:"Document why each overlay modification was made—this helps when reviewing or updating overlays."}),y("li",{children:"Test overlays thoroughly to ensure they don't break workflows or confuse users."}),y("li",{children:"Use tenant-level overlays for organizational customizations and user-level overlays for personal preferences."}),y("li",{children:"Regularly review overlays to remove ones that are no longer needed."}),y("li",{children:"Protect overlay signing keys carefully—they control what customizations are allowed."})]})]}),O("div",{className:"space-y-4",children:[y("h2",{className:"font-bold text-2xl",children:"Where overlays fit in the runtime"}),y("p",{className:"text-muted-foreground",children:"Overlays are safest when they sit on top of a declared bundle surface instead of ad hoc page code. Use the module-bundles docs first, then apply overlays as auditable customization on top of the resolved surface plan."}),O("div",{className:"flex flex-wrap gap-3",children:[y(ai,{href:"/docs/specs/module-bundles",className:"btn-primary",children:"Module bundles"}),y(ai,{href:"/docs/guides/first-module-bundle",className:"btn-ghost",children:"Build a first module bundle"})]})]}),O("div",{className:"flex items-center gap-4 pt-4",children:[y(ai,{href:"/docs/specs/policy",className:"btn-ghost",children:"Previous: Policy"}),O(ai,{href:"/docs/safety",className:"btn-primary",children:["Next: Safety ",y(gh,{size:16})]})]})]})}import il from"@contractspec/lib.ui-link";import{ChevronRight as rl}from"lucide-react";import{jsx as me,jsxs as bt}from"react/jsx-runtime";var fh=[{title:"Capabilities",body:"Model operations, events, and presentations as explicit system behavior.",href:"/docs/specs/capabilities"},{title:"Data views",body:"Describe query, filtering, and presentation behavior from the same source model.",href:"/docs/specs/dataviews"},{title:"Workflows",body:"Coordinate multi-step execution, retries, monitoring, and hand-offs.",href:"/docs/specs/workflows"},{title:"Policy",body:"Carry governance and access rules through every generated and runtime-served surface.",href:"/docs/specs/policy"},{title:"Overlays",body:"Customize generated surfaces safely instead of forking them permanently.",href:"/docs/specs/overlays"},{title:"Safety and migration",body:"Keep change safe with signing, audits, rollbacks, and explicit migration behavior.",href:"/docs/safety"}],yh=[{title:"Module bundles",body:"Define typed surface bundles that resolve into auditable runtime plans instead of hand-built page logic.",href:"/docs/specs/module-bundles"},{title:"ContractSpec Connect",body:"Put coding-agent edits and commands behind local-first context, verification, replay, and review artifacts.",href:"/docs/specs/connect"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review on top of OSS and Studio.",href:"/docs/specs/builder-control-plane"}];function vh(){return bt("div",{className:"space-y-10",children:[bt("div",{className:"space-y-3",children:[me("p",{className:"editorial-kicker",children:"Core model"}),me("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Contracts are the durable system boundary."}),me("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"ContractSpec uses explicit TypeScript specs to describe behavior before it spreads across APIs, UI, data models, events, and operator flows. The goal is not to hide implementation. The goal is to make the system boundary explicit enough that generation, validation, runtime enforcement, and regeneration can stay coherent."})]}),bt("div",{className:"editorial-proof-strip",children:[bt("div",{className:"editorial-stat",children:[me("span",{className:"editorial-label",children:"System promise"}),me("span",{className:"editorial-stat-value",children:"one contract → many surfaces"})]}),me("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Use the contract layer to keep surface behavior aligned, then let runtimes and generators do the repetitive work without inventing a closed platform."})]}),me("section",{className:"editorial-panel space-y-5",children:bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What the contract layer owns"}),bt("ul",{className:"editorial-list",children:[bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Behavior: operations, events, presentations, workflows."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Validation: input, output, and schema boundaries."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Governance: policy, auditability, and migration rules."})]}),bt("li",{children:[me("span",{className:"editorial-list-marker"}),me("span",{children:"Surface alignment: generated or served behavior across API, UI, data, and agent-facing interfaces."})]})]})]})}),bt("section",{className:"space-y-5",children:[bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Specification types"}),me("p",{className:"text-muted-foreground text-sm leading-7",children:"You can adopt the model one part at a time. Not every system needs every spec type on day one."})]}),me("div",{className:"grid gap-4 md:grid-cols-2",children:fh.map((e)=>bt(il,{href:e.href,className:"editorial-panel",children:[me("h3",{className:"font-semibold text-xl",children:e.title}),me("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body}),bt("div",{className:"mt-4 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Open section ",me(rl,{size:14})]})]},e.title))})]}),bt("section",{className:"space-y-5",children:[bt("div",{className:"space-y-2",children:[me("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Implemented spec packs"}),me("p",{className:"text-muted-foreground text-sm leading-7",children:"These packs combine multiple contract surfaces into higher-order systems you can use directly today: agent enforcement, AI-native surface runtime, and governed Builder authoring."})]}),me("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:yh.map((e)=>bt(il,{href:e.href,className:"editorial-panel",children:[me("h3",{className:"font-semibold text-xl",children:e.title}),me("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:e.body}),bt("div",{className:"mt-4 flex items-center gap-2 text-[color:var(--rust)] text-sm",children:["Open pack ",me(rl,{size:14})]})]},e.title))})]})]})}import oi from"@contractspec/lib.ui-link";import{ChevronRight as bh}from"lucide-react";import{jsx as m,jsxs as q}from"react/jsx-runtime";function Nh(){return q("div",{className:"space-y-8",children:[q("div",{className:"space-y-4",children:[m("h1",{className:"font-bold text-4xl",children:"Policy"}),q("p",{className:"text-muted-foreground",children:["A ",m("strong",{children:"PolicySpec"})," defines who can do what, when, and under what conditions. ContractSpec uses attribute-based access control (ABAC) to enforce policies across your entire application—from API endpoints to UI components."]})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Why policies matter"}),m("p",{className:"text-muted-foreground",children:"Traditional access control relies on roles (RBAC), which can become unwieldy as applications grow. ABAC is more flexible—it evaluates policies based on attributes of the user, resource, action, and context."}),q("p",{className:"text-muted-foreground",children:["ContractSpec's policy engine ensures that access control is consistent across all surfaces. You don't have to remember to add authorization checks in every API endpoint or UI component—the"," ",m(oi,{href:"/docs/safety/pdp",className:"text-violet-400 hover:text-violet-300",children:"Policy Decision Point"})," ","enforces policies automatically."]})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Policy structure"}),m("p",{className:"text-muted-foreground",children:"A PolicySpec contains one or more rules. Each rule has:"}),q("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[q("li",{children:[m("strong",{children:"Effect"})," – PERMIT, DENY, or REDACT"]}),q("li",{children:[m("strong",{children:"Condition"})," – A boolean expression that determines when the rule applies"]}),q("li",{children:[m("strong",{children:"Scope"})," – Which resources, actions, or fields the rule applies to"]}),q("li",{children:[m("strong",{children:"Priority"})," – Rules are evaluated in priority order; the first matching rule wins"]})]})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Example PolicySpec"}),m("p",{className:"text-muted-foreground",children:"Here's a policy that controls access to customer data in TypeScript:"}),m("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:m("pre",{children:`import { definePolicy } from '@contractspec/lib.contracts-spec';
4691
4691
 
4692
4692
  export const CustomerDataAccess = definePolicy({
4693
4693
  meta: {
@@ -4729,7 +4729,7 @@ export const CustomerDataAccess = definePolicy({
4729
4729
  redactFields: ['creditCard', 'ssn', 'bankAccount'],
4730
4730
  },
4731
4731
  ],
4732
- });`})})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Attributes"}),m("p",{className:"text-muted-foreground",children:"Policy conditions can reference attributes from four categories:"}),H("div",{className:"space-y-3",children:[H("div",{children:[m("h3",{className:"font-semibold text-lg",children:"User attributes"}),H("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.id"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.role"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.groups"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.department"}),", custom attributes"]})]}),H("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Resource attributes"}),H("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.type"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.owner"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.sensitivity"}),", custom attributes"]})]}),H("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Action attributes"}),H("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"action"})," ","(read, write, delete, execute, export, etc.)"]})]}),H("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Context attributes"}),H("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"time.hour"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"time.dayOfWeek"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"request.ipAddress"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"request.userAgent"})]})]})]})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Data classification"}),H("p",{className:"text-muted-foreground",children:["You can tag fields with sensitivity levels in your"," ",m(oi,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpecs"})," ","and"," ",m(oi,{href:"/docs/specs/dataviews",className:"text-violet-400 hover:text-violet-300",children:"DataViewSpecs"}),":"]}),m("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:m("pre",{children:`fields:
4732
+ });`})})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Attributes"}),m("p",{className:"text-muted-foreground",children:"Policy conditions can reference attributes from four categories:"}),q("div",{className:"space-y-3",children:[q("div",{children:[m("h3",{className:"font-semibold text-lg",children:"User attributes"}),q("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.id"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.role"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.groups"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"user.department"}),", custom attributes"]})]}),q("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Resource attributes"}),q("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.type"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.owner"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"resource.sensitivity"}),", custom attributes"]})]}),q("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Action attributes"}),q("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"action"})," ","(read, write, delete, execute, export, etc.)"]})]}),q("div",{children:[m("h3",{className:"font-semibold text-lg",children:"Context attributes"}),q("p",{className:"text-muted-foreground",children:[m("code",{className:"rounded bg-background/50 px-2 py-1",children:"time.hour"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"time.dayOfWeek"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"request.ipAddress"}),","," ",m("code",{className:"rounded bg-background/50 px-2 py-1",children:"request.userAgent"})]})]})]})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Data classification"}),q("p",{className:"text-muted-foreground",children:["You can tag fields with sensitivity levels in your"," ",m(oi,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpecs"})," ","and"," ",m(oi,{href:"/docs/specs/dataviews",className:"text-violet-400 hover:text-violet-300",children:"DataViewSpecs"}),":"]}),m("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:m("pre",{children:`fields:
4733
4733
  - name: email
4734
4734
  type: string
4735
4735
  sensitivity: PII
@@ -4742,7 +4742,7 @@ export const CustomerDataAccess = definePolicy({
4742
4742
  sensitivity: PHI
4743
4743
  - name: salary
4744
4744
  type: number
4745
- sensitivity: confidential`})}),m("p",{className:"text-muted-foreground",children:'Policies can then reference these tags to enforce blanket rules like "support staff cannot see PII" or "PHI can only be accessed from approved IP addresses."'})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Testing policies"}),m("p",{className:"text-muted-foreground",children:"ContractSpec provides tools for testing policies before deployment:"}),H("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[H("li",{children:[m("strong",{children:"Policy simulator"})," – Test how policies evaluate for different users and scenarios"]}),H("li",{children:[m("strong",{children:"Coverage analysis"})," – Identify resources or actions that aren't covered by any policy"]}),H("li",{children:[m("strong",{children:"Conflict detection"})," – Find rules that might conflict or produce unexpected results"]}),H("li",{children:[m("strong",{children:"Audit mode"})," – Run policies in audit-only mode to see what would be blocked without actually blocking it"]})]})]}),H("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Best practices"}),H("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[m("li",{children:"Start with a deny-by-default policy—explicitly permit what should be allowed."}),m("li",{children:"Use clear, descriptive rule IDs that explain what the rule does."}),m("li",{children:"Set priorities carefully to ensure rules are evaluated in the right order."}),m("li",{children:"Test policies thoroughly with realistic user scenarios before deploying."}),H("li",{children:["Monitor policy decisions in production using"," ",m(oi,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit logs"}),"."]}),m("li",{children:"Review and update policies regularly as your application and requirements evolve."})]})]}),H("div",{className:"flex items-center gap-4 pt-4",children:[m(oi,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Previous: Workflows"}),H(oi,{href:"/docs/specs/overlays",className:"btn-primary",children:["Next: Overlays ",m(Nf,{size:16})]})]})]})}import Tr from"@contractspec/lib.ui-link";import{ChevronRight as kf}from"lucide-react";import{jsx as P,jsxs as ce}from"react/jsx-runtime";function Sf(){return ce("div",{className:"space-y-8",children:[ce("div",{className:"space-y-4",children:[P("h1",{className:"font-bold text-4xl",children:"Workflows"}),ce("p",{className:"text-muted-foreground",children:["A ",P("strong",{children:"WorkflowSpec"})," orchestrates multi-step processes. It defines the sequence of operations, handles failures with retries and compensation, and provides observability into long-running tasks."]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Core concepts"}),ce("div",{className:"space-y-3",children:[ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Identifiers"}),ce("p",{className:"text-muted-foreground",children:["Each workflow has a unique"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"workflowId"})," ","and a"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"version"}),". This allows you to run multiple versions of the same workflow simultaneously during migrations or A/B tests."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Steps"}),ce("p",{className:"text-muted-foreground",children:["A workflow is composed of ",P("strong",{children:"steps"}),". Each step invokes a"," ",P(Tr,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpec"}),", passes inputs, and receives outputs. Steps can run sequentially or in parallel."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Transitions"}),ce("p",{className:"text-muted-foreground",children:[P("strong",{children:"Transitions"}),' define the flow between steps. They can be conditional (e.g., "if payment succeeds, go to step 3; otherwise, go to step 5") or unconditional.']})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Retries"}),P("p",{className:"text-muted-foreground",children:"If a step fails, the workflow can retry it with exponential backoff. You specify the maximum number of retries and the backoff strategy in the spec."})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Compensation"}),ce("p",{className:"text-muted-foreground",children:["When a workflow fails partway through,"," ",P("strong",{children:"compensation"})," steps undo the effects of completed steps (e.g., refunding a payment, releasing a reservation). This ensures consistency even in failure scenarios."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"SLAs"}),P("p",{className:"text-muted-foreground",children:"You can define Service Level Agreements (SLAs) for each step or the entire workflow. If a step exceeds its SLA, the system can trigger alerts or escalations."})]})]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Example WorkflowSpec (TypeScript)"}),P("p",{className:"text-muted-foreground",children:"Here's a simplified example of a payment workflow in TypeScript:"}),ce("p",{className:"text-muted-foreground text-sm",children:["For Vercel Workflow and other VM-evaluated runtimes, author workflow specs from"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"@contractspec/lib.contracts-spec/workflow/spec"})," ","rather than the broad workflow barrel."]}),P("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:P("pre",{children:`import { defineWorkflow } from '@contractspec/lib.contracts-spec/workflow/spec';
4745
+ sensitivity: confidential`})}),m("p",{className:"text-muted-foreground",children:'Policies can then reference these tags to enforce blanket rules like "support staff cannot see PII" or "PHI can only be accessed from approved IP addresses."'})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Testing policies"}),m("p",{className:"text-muted-foreground",children:"ContractSpec provides tools for testing policies before deployment:"}),q("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[q("li",{children:[m("strong",{children:"Policy simulator"})," – Test how policies evaluate for different users and scenarios"]}),q("li",{children:[m("strong",{children:"Coverage analysis"})," – Identify resources or actions that aren't covered by any policy"]}),q("li",{children:[m("strong",{children:"Conflict detection"})," – Find rules that might conflict or produce unexpected results"]}),q("li",{children:[m("strong",{children:"Audit mode"})," – Run policies in audit-only mode to see what would be blocked without actually blocking it"]})]})]}),q("div",{className:"space-y-4",children:[m("h2",{className:"font-bold text-2xl",children:"Best practices"}),q("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[m("li",{children:"Start with a deny-by-default policy—explicitly permit what should be allowed."}),m("li",{children:"Use clear, descriptive rule IDs that explain what the rule does."}),m("li",{children:"Set priorities carefully to ensure rules are evaluated in the right order."}),m("li",{children:"Test policies thoroughly with realistic user scenarios before deploying."}),q("li",{children:["Monitor policy decisions in production using"," ",m(oi,{href:"/docs/safety/auditing",className:"text-violet-400 hover:text-violet-300",children:"audit logs"}),"."]}),m("li",{children:"Review and update policies regularly as your application and requirements evolve."})]})]}),q("div",{className:"flex items-center gap-4 pt-4",children:[m(oi,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Previous: Workflows"}),q(oi,{href:"/docs/specs/overlays",className:"btn-primary",children:["Next: Overlays ",m(bh,{size:16})]})]})]})}import Tr from"@contractspec/lib.ui-link";import{ChevronRight as wh}from"lucide-react";import{jsx as P,jsxs as ce}from"react/jsx-runtime";function kh(){return ce("div",{className:"space-y-8",children:[ce("div",{className:"space-y-4",children:[P("h1",{className:"font-bold text-4xl",children:"Workflows"}),ce("p",{className:"text-muted-foreground",children:["A ",P("strong",{children:"WorkflowSpec"})," orchestrates multi-step processes. It defines the sequence of operations, handles failures with retries and compensation, and provides observability into long-running tasks."]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Core concepts"}),ce("div",{className:"space-y-3",children:[ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Identifiers"}),ce("p",{className:"text-muted-foreground",children:["Each workflow has a unique"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"workflowId"})," ","and a"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"version"}),". This allows you to run multiple versions of the same workflow simultaneously during migrations or A/B tests."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Steps"}),ce("p",{className:"text-muted-foreground",children:["A workflow is composed of ",P("strong",{children:"steps"}),". Each step invokes a"," ",P(Tr,{href:"/docs/specs/capabilities",className:"text-violet-400 hover:text-violet-300",children:"CapabilitySpec"}),", passes inputs, and receives outputs. Steps can run sequentially or in parallel."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Transitions"}),ce("p",{className:"text-muted-foreground",children:[P("strong",{children:"Transitions"}),' define the flow between steps. They can be conditional (e.g., "if payment succeeds, go to step 3; otherwise, go to step 5") or unconditional.']})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Retries"}),P("p",{className:"text-muted-foreground",children:"If a step fails, the workflow can retry it with exponential backoff. You specify the maximum number of retries and the backoff strategy in the spec."})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"Compensation"}),ce("p",{className:"text-muted-foreground",children:["When a workflow fails partway through,"," ",P("strong",{children:"compensation"})," steps undo the effects of completed steps (e.g., refunding a payment, releasing a reservation). This ensures consistency even in failure scenarios."]})]}),ce("div",{children:[P("h3",{className:"font-semibold text-lg",children:"SLAs"}),P("p",{className:"text-muted-foreground",children:"You can define Service Level Agreements (SLAs) for each step or the entire workflow. If a step exceeds its SLA, the system can trigger alerts or escalations."})]})]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Example WorkflowSpec (TypeScript)"}),P("p",{className:"text-muted-foreground",children:"Here's a simplified example of a payment workflow in TypeScript:"}),ce("p",{className:"text-muted-foreground text-sm",children:["For Vercel Workflow and other VM-evaluated runtimes, author workflow specs from"," ",P("code",{className:"rounded bg-background/50 px-2 py-1",children:"@contractspec/lib.contracts-spec/workflow/spec"})," ","rather than the broad workflow barrel."]}),P("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:P("pre",{children:`import { defineWorkflow } from '@contractspec/lib.contracts-spec/workflow/spec';
4746
4746
  import { ValidatePaymentMethod, ChargePayment, SendEmail } from './specs';
4747
4747
 
4748
4748
  export const PaymentFlow = defineWorkflow({
@@ -4794,4 +4794,4 @@ export const PaymentFlow = defineWorkflow({
4794
4794
  maxDuration: 30000, // milliseconds
4795
4795
  alertOnBreach: true,
4796
4796
  },
4797
- });`})})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Triggers"}),P("p",{className:"text-muted-foreground",children:"Workflows can be triggered in several ways:"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ce("li",{children:[P("strong",{children:"Manual invocation"})," – A user or system calls the workflow via an API endpoint."]}),ce("li",{children:[P("strong",{children:"Event-driven"})," – The workflow starts automatically when a specific event occurs (e.g., a new order is created)."]}),ce("li",{children:[P("strong",{children:"Scheduled"})," – The workflow runs on a cron schedule (e.g., nightly batch processing)."]}),ce("li",{children:[P("strong",{children:"Chained"})," – One workflow can invoke another as a step."]})]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Monitoring and versioning"}),P("p",{className:"text-muted-foreground",children:"ContractSpec automatically instruments workflows with telemetry. You can view:"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[P("li",{children:"Real-time execution status for each step"}),P("li",{children:"Historical run data and success/failure rates"}),P("li",{children:"Latency distributions and SLA compliance"}),P("li",{children:"Compensation events and retry attempts"})]}),P("p",{className:"text-muted-foreground",children:"When you update a workflow, you increment its version. Running workflows continue on their original version, while new invocations use the latest version. This allows safe, zero-downtime deployments."})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Best practices"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[P("li",{children:"Keep steps idempotent – they should be safe to retry without side effects."}),P("li",{children:"Define compensation for any step that modifies external state."}),P("li",{children:"Use meaningful step IDs that describe the operation."}),P("li",{children:"Set realistic SLAs and monitor them in production."}),P("li",{children:"Test failure scenarios locally before deploying."})]})]}),ce("div",{className:"flex items-center gap-4 pt-4",children:[P(Tr,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Previous: Capabilities"}),ce(Tr,{href:"/docs/safety",className:"btn-primary",children:["Next: Safety Features ",P(kf,{size:16})]})]})]})}import Cf from"@contractspec/lib.ui-link";import{jsx as Ar,jsxs as Pf}from"react/jsx-runtime";function If(){return Pf("main",{className:"space-y-6 py-12",children:[Ar("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Ar("p",{className:"text-muted-foreground text-sm",children:"Security and BYOK guidance now lives in the Studio app docs."}),Ar(Cf,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Tf from"@contractspec/lib.ui-link";import{jsx as Rr,jsxs as Rf}from"react/jsx-runtime";function Af(){return Rf("main",{className:"space-y-6 py-12",children:[Rr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Rr("p",{className:"text-muted-foreground text-sm",children:"Deployment guidance now lives in the Studio app docs."}),Rr(Tf,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Lf from"@contractspec/lib.ui-link";import{jsx as Lr,jsxs as Df}from"react/jsx-runtime";function Ef(){return Df("main",{className:"space-y-6 py-12",children:[Lr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Lr("p",{className:"text-muted-foreground text-sm",children:"The latest getting-started guide now lives in the Studio app docs."}),Lr(Lf,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Of from"@contractspec/lib.ui-link";import{jsx as Er,jsxs as Bf}from"react/jsx-runtime";function Mf(){return Bf("main",{className:"space-y-6 py-12",children:[Er("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Er("p",{className:"text-muted-foreground text-sm",children:"Integration guides now live in the Studio app docs."}),Er(Of,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import _i from"@contractspec/lib.ui-link";import{jsx as be,jsxs as qt}from"react/jsx-runtime";var Uf=["decision workflows that turn product evidence into proposed spec changes","governed execution loops and task packs on top of the OSS contract layer","operator surfaces for teams that need a managed workflow instead of raw building blocks","deeper product-facing workflows that sit above the open system without replacing it"];function Wf(){return qt("main",{className:"space-y-10",children:[qt("section",{className:"space-y-3",children:[be("p",{className:"editorial-kicker",children:"Studio bridge"}),be("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Studio is the operating layer built on top of OSS ContractSpec."}),be("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"Start with the open system first: contracts, generated surfaces, runtimes, integrations, and safe regeneration. Move to Studio when a team wants the product-facing workflow, decision loop, and managed operator surface on top of that foundation."})]}),qt("section",{className:"editorial-proof-strip",children:[qt("div",{className:"editorial-stat",children:[be("span",{className:"editorial-label",children:"What stays open"}),be("span",{className:"editorial-stat-value",children:"contracts, code, generated surfaces"})]}),be("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Studio is additive. It does not replace the OSS source of truth or ask teams to abandon their contract layer."})]}),qt("section",{className:"grid gap-4 md:grid-cols-2",children:[qt("article",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Start with OSS when you need:"}),qt("ul",{className:"editorial-list",children:[qt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"explicit contracts and generated surfaces you still own"})]}),qt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"incremental adoption inside an existing codebase"})]}),qt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"runtime governance, integrations, and safe regeneration without a managed operating product"})]})]})]}),qt("article",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adopt Studio when you need:"}),be("ul",{className:"editorial-list",children:Uf.map((e)=>qt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:e})]},e))})]})]}),qt("section",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Builder is the governed authoring layer"}),be("p",{className:"text-muted-foreground text-sm leading-7",children:"If your team wants a concrete authoring control plane on top of the OSS foundation, start with the Builder control-plane docs and the workbench host guide before you dive into the larger Studio product surface."}),qt("div",{className:"flex flex-wrap gap-3",children:[be(_i,{href:"/docs/specs/builder-control-plane",className:"btn-primary",children:"Builder control plane"}),be(_i,{href:"/docs/guides/host-builder-workbench",className:"btn-ghost",children:"Host the Builder workbench"})]})]}),qt("section",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Go to the Studio product docs for the full product surface"}),be("p",{className:"text-muted-foreground text-sm leading-7",children:"The OSS site keeps this section intentionally short. Deep Studio product guidance belongs in the Studio app docs."}),qt("div",{className:"flex flex-wrap gap-3",children:[be(_i,{href:"https://www.contractspec.studio",className:"btn-primary",children:"Open Studio"}),be(_i,{href:"https://www.contractspec.studio/docs",className:"btn-ghost",children:"Read Studio docs"})]})]})]})}import _f from"@contractspec/lib.ui-link";import{jsx as Dr,jsxs as Gf}from"react/jsx-runtime";function zf(){return Gf("main",{className:"space-y-6 py-12",children:[Dr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Dr("p",{className:"text-muted-foreground text-sm",children:"Visual builder documentation now lives in the Studio app docs."}),Dr(_f,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}export{tn as listGeneratedDocs,Or as getSecondaryDocsPages,ml as getPrimaryDocsTraversal,pl as getPrimaryDocsSections,Ev as getGeneratedDocById,qf as getDocsPageByHref,Vf as getDocsNextPrevious,Lv as getDocsIndexManifest,Mr as getDocsHomeSections,kb as VSCodeExtensionPage,id as TroubleshootingPage,zf as StudioVisualBuilderPage,Wf as StudioOverviewPage,Mf as StudioIntegrationsPage,Ef as StudioGettingStartedPage,Af as StudioDeploymentsPage,If as StudioBYOKPage,td as StartHerePage,Sf as SpecsWorkflowsPage,wf as SpecsPolicyPage,bf as SpecsOverviewPage,hf as SpecsOverlaysPage,gf as SpecsModuleBundlesPage,pf as SpecsDataViewsPage,lf as SpecsConnectPage,tf as SpecsCapabilitiesPage,xg as SpecsBuilderControlPlanePage,em as SpecDrivenDevelopmentPage,Xp as SchemaValidationTypescriptPage,Jg as SafetyTenantIsolationPage,Yg as SafetySigningPage,Fg as SafetySecurityTrustPage,Vg as SafetyPDPPage,Hg as SafetyOverviewPage,_g as SafetyMigrationsPage,Ug as SafetyAuditingPage,ig as OpsDistributedTracingPage,og as OpsAutoEvolutionPage,Jp as OpenapiAlternativePage,ag as ManifestoPage,tg as LibrariesWorkflowsPage,Xu as LibrariesWorkflowComposerPage,Ju as LibrariesUIKitWebPage,Vu as LibrariesUIKitPage,_u as LibrariesTestingPage,Bu as LibrariesSupportBotPage,Ru as LibrariesSchemaPage,Du as LibrariesSLOPage,Pu as LibrariesRuntimePage,ku as LibrariesResiliencePage,bu as LibrariesProgressiveDeliveryPage,hu as LibrariesPersonalizationPage,uu as LibrariesOverviewPage,su as LibrariesOverlayEnginePage,nu as LibrariesObservabilityPage,ou as LibrariesMultiTenancyPage,eu as LibrariesGrowthPage,Xm as LibrariesGraphQLPage,Ym as LibrariesEvolutionPage,Fm as LibrariesDesignSystemPage,_m as LibrariesDataViewsPage,Bm as LibrariesDataBackendPage,Dm as LibrariesCrossPlatformUIPage,Lm as LibrariesCostTrackingPage,Tm as LibrariesContractsPage,km as LibrariesContentGenPage,vm as LibrariesAnalyticsPage,hm as LibrariesAiAgentPage,um as LibrariesAccessibilityPage,dm as KnowledgeSpacesPage,lm as KnowledgeSourcesPage,nm as KnowledgeOverviewPage,om as KnowledgeExamplesPage,am as KnowledgeCategoriesPage,Up as IntegrationsWhatsappTwilioPage,Mp as IntegrationsWhatsappMetaPage,Dp as IntegrationsTwilioPage,Ep as IntegrationsStripePage,Rp as IntegrationsSpecModelPage,Tp as IntegrationsSlackPage,Ip as IntegrationsS3Page,Sp as IntegrationsResendPage,wp as IntegrationsQdrantPage,bp as IntegrationsPowensPage,yp as IntegrationsPostmarkPage,fp as IntegrationsOverviewPage,up as IntegrationsOpenAIPage,pp as IntegrationsMistralPage,sp as IntegrationsHealthRoutingPage,lp as IntegrationsGoogleCalendarPage,np as IntegrationsGmailPage,ip as IntegrationsGithubPage,ap as IntegrationsElevenLabsPage,ep as IntegrationsCircuitBreakersPage,xs as InstallationPage,Zs as HelloWorldPage,Xd as GuidesIndexPage,Fd as GuideSpecValidationTypingPage,qd as GuideReleaseCapsulesPage,zd as GuideNextjsOneEndpointPage,Wd as GuideImportExistingCodebasesPage,Ed as GuideHostBuilderWorkbenchPage,Td as GuideGenerateDocsClientsSchemasPage,Id as GuideFirstModuleBundlePage,Sd as GuideDocsPipelinePage,wd as GuideContractTypesPage,gd as GuideConnectInRepoPage,pd as GuideCIDiffGatingPage,Kp as GenerateClientFromSchemaPage,Cs as ExampleShowcasePage,ts as EcosystemTemplatesPage,Xl as EcosystemRegistryPage,Zl as EcosystemPluginsPage,Yl as EcosystemIntegrationsPage,Og as DocsReferencePage,fg as DocsReferenceIndexPage,bl as DocsIndexPage,ds as DocsExamplesPage,$v as DeveloperToolsPage,qp as DeterministicCodegenPage,Gs as DataViewTutorialPage,Gi as DOCS_PRIMARY_SECTIONS,vi as DOCS_PAGES,zp as ContractFirstApiPage,Ws as CompatibilityPage,Fl as ComparisonWorkflowEnginesPage,Vl as ComparisonWindmillPage,ql as ComparisonOverviewPage,Hl as ComparisonInternalToolBuildersPage,Gl as ComparisonEnterprisePlatformsPage,_l as ComparisonAutomationPlatformsPage,Bs as CLIPage,Wl as ArchitectureOverviewPage,Bl as ArchitectureMultiTenancyPage,Dl as ArchitectureKnowledgeBindingPage,Ll as ArchitectureIntegrationBindingPage,Al as ArchitectureControlPlanePage,Pl as ArchitectureAppConfigPage,bh as AdvancedWorkflowMonitoringPage,hh as AdvancedTelemetryPage,ph as AdvancedSpecExperimentsPage,lh as AdvancedRenderersPage,oh as AdvancedOverlayEditorPage,jf as AdvancedMCPPage};
4797
+ });`})})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Triggers"}),P("p",{className:"text-muted-foreground",children:"Workflows can be triggered in several ways:"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ce("li",{children:[P("strong",{children:"Manual invocation"})," – A user or system calls the workflow via an API endpoint."]}),ce("li",{children:[P("strong",{children:"Event-driven"})," – The workflow starts automatically when a specific event occurs (e.g., a new order is created)."]}),ce("li",{children:[P("strong",{children:"Scheduled"})," – The workflow runs on a cron schedule (e.g., nightly batch processing)."]}),ce("li",{children:[P("strong",{children:"Chained"})," – One workflow can invoke another as a step."]})]})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Monitoring and versioning"}),P("p",{className:"text-muted-foreground",children:"ContractSpec automatically instruments workflows with telemetry. You can view:"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[P("li",{children:"Real-time execution status for each step"}),P("li",{children:"Historical run data and success/failure rates"}),P("li",{children:"Latency distributions and SLA compliance"}),P("li",{children:"Compensation events and retry attempts"})]}),P("p",{className:"text-muted-foreground",children:"When you update a workflow, you increment its version. Running workflows continue on their original version, while new invocations use the latest version. This allows safe, zero-downtime deployments."})]}),ce("div",{className:"space-y-4",children:[P("h2",{className:"font-bold text-2xl",children:"Best practices"}),ce("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[P("li",{children:"Keep steps idempotent – they should be safe to retry without side effects."}),P("li",{children:"Define compensation for any step that modifies external state."}),P("li",{children:"Use meaningful step IDs that describe the operation."}),P("li",{children:"Set realistic SLAs and monitor them in production."}),P("li",{children:"Test failure scenarios locally before deploying."})]})]}),ce("div",{className:"flex items-center gap-4 pt-4",children:[P(Tr,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Previous: Capabilities"}),ce(Tr,{href:"/docs/safety",className:"btn-primary",children:["Next: Safety Features ",P(wh,{size:16})]})]})]})}import Sh from"@contractspec/lib.ui-link";import{jsx as Ar,jsxs as Ih}from"react/jsx-runtime";function Ch(){return Ih("main",{className:"space-y-6 py-12",children:[Ar("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Ar("p",{className:"text-muted-foreground text-sm",children:"Security and BYOK guidance now lives in the Studio app docs."}),Ar(Sh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Ph from"@contractspec/lib.ui-link";import{jsx as Rr,jsxs as Ah}from"react/jsx-runtime";function Th(){return Ah("main",{className:"space-y-6 py-12",children:[Rr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Rr("p",{className:"text-muted-foreground text-sm",children:"Deployment guidance now lives in the Studio app docs."}),Rr(Ph,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Rh from"@contractspec/lib.ui-link";import{jsx as Lr,jsxs as Eh}from"react/jsx-runtime";function Lh(){return Eh("main",{className:"space-y-6 py-12",children:[Lr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Lr("p",{className:"text-muted-foreground text-sm",children:"The latest getting-started guide now lives in the Studio app docs."}),Lr(Rh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Dh from"@contractspec/lib.ui-link";import{jsx as Er,jsxs as Mh}from"react/jsx-runtime";function Oh(){return Mh("main",{className:"space-y-6 py-12",children:[Er("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Er("p",{className:"text-muted-foreground text-sm",children:"Integration guides now live in the Studio app docs."}),Er(Dh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import _i from"@contractspec/lib.ui-link";import{jsx as be,jsxs as Vt}from"react/jsx-runtime";var Bh=["decision workflows that turn product evidence into proposed spec changes","governed execution loops and task packs on top of the OSS contract layer","operator surfaces for teams that need a managed workflow instead of raw building blocks","deeper product-facing workflows that sit above the open system without replacing it"];function Uh(){return Vt("main",{className:"space-y-10",children:[Vt("section",{className:"space-y-3",children:[be("p",{className:"editorial-kicker",children:"Studio bridge"}),be("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Studio is the operating layer built on top of OSS ContractSpec."}),be("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"Start with the open system first: contracts, generated surfaces, runtimes, integrations, and safe regeneration. Move to Studio when a team wants the product-facing workflow, decision loop, and managed operator surface on top of that foundation."})]}),Vt("section",{className:"editorial-proof-strip",children:[Vt("div",{className:"editorial-stat",children:[be("span",{className:"editorial-label",children:"What stays open"}),be("span",{className:"editorial-stat-value",children:"contracts, code, generated surfaces"})]}),be("p",{className:"max-w-2xl text-muted-foreground text-sm leading-7",children:"Studio is additive. It does not replace the OSS source of truth or ask teams to abandon their contract layer."})]}),Vt("section",{className:"grid gap-4 md:grid-cols-2",children:[Vt("article",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Start with OSS when you need:"}),Vt("ul",{className:"editorial-list",children:[Vt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"explicit contracts and generated surfaces you still own"})]}),Vt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"incremental adoption inside an existing codebase"})]}),Vt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:"runtime governance, integrations, and safe regeneration without a managed operating product"})]})]})]}),Vt("article",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Adopt Studio when you need:"}),be("ul",{className:"editorial-list",children:Bh.map((e)=>Vt("li",{children:[be("span",{className:"editorial-list-marker"}),be("span",{children:e})]},e))})]})]}),Vt("section",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Builder is the governed authoring layer"}),be("p",{className:"text-muted-foreground text-sm leading-7",children:"If your team wants a concrete authoring control plane on top of the OSS foundation, start with the Builder control-plane docs and the workbench host guide before you dive into the larger Studio product surface."}),Vt("div",{className:"flex flex-wrap gap-3",children:[be(_i,{href:"/docs/specs/builder-control-plane",className:"btn-primary",children:"Builder control plane"}),be(_i,{href:"/docs/guides/host-builder-workbench",className:"btn-ghost",children:"Host the Builder workbench"})]})]}),Vt("section",{className:"editorial-panel space-y-4",children:[be("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Go to the Studio product docs for the full product surface"}),be("p",{className:"text-muted-foreground text-sm leading-7",children:"The OSS site keeps this section intentionally short. Deep Studio product guidance belongs in the Studio app docs."}),Vt("div",{className:"flex flex-wrap gap-3",children:[be(_i,{href:"https://www.contractspec.studio",className:"btn-primary",children:"Open Studio"}),be(_i,{href:"https://www.contractspec.studio/docs",className:"btn-ghost",children:"Read Studio docs"})]})]})]})}import Wh from"@contractspec/lib.ui-link";import{jsx as Dr,jsxs as zh}from"react/jsx-runtime";function _h(){return zh("main",{className:"space-y-6 py-12",children:[Dr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Dr("p",{className:"text-muted-foreground text-sm",children:"Visual builder documentation now lives in the Studio app docs."}),Dr(Wh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}export{tn as listGeneratedDocs,Or as getSecondaryDocsPages,ml as getPrimaryDocsTraversal,pl as getPrimaryDocsSections,Ev as getGeneratedDocById,qh as getDocsPageByHref,Vh as getDocsNextPrevious,Lv as getDocsIndexManifest,Mr as getDocsHomeSections,kb as VSCodeExtensionPage,id as TroubleshootingPage,_h as StudioVisualBuilderPage,Uh as StudioOverviewPage,Oh as StudioIntegrationsPage,Lh as StudioGettingStartedPage,Th as StudioDeploymentsPage,Ch as StudioBYOKPage,td as StartHerePage,kh as SpecsWorkflowsPage,Nh as SpecsPolicyPage,vh as SpecsOverviewPage,hh as SpecsOverlaysPage,uh as SpecsModuleBundlesPage,dh as SpecsDataViewsPage,ch as SpecsConnectPage,th as SpecsCapabilitiesPage,xg as SpecsBuilderControlPlanePage,em as SpecDrivenDevelopmentPage,$p as SchemaValidationTypescriptPage,Jg as SafetyTenantIsolationPage,Yg as SafetySigningPage,Fg as SafetySecurityTrustPage,Hg as SafetyPDPPage,qg as SafetyOverviewPage,_g as SafetyMigrationsPage,Ug as SafetyAuditingPage,ig as OpsDistributedTracingPage,og as OpsAutoEvolutionPage,Jp as OpenapiAlternativePage,ag as ManifestoPage,tg as LibrariesWorkflowsPage,$u as LibrariesWorkflowComposerPage,Ju as LibrariesUIKitWebPage,Hu as LibrariesUIKitPage,_u as LibrariesTestingPage,Bu as LibrariesSupportBotPage,Ru as LibrariesSchemaPage,Du as LibrariesSLOPage,Pu as LibrariesRuntimePage,ku as LibrariesResiliencePage,bu as LibrariesProgressiveDeliveryPage,fu as LibrariesPersonalizationPage,uu as LibrariesOverviewPage,su as LibrariesOverlayEnginePage,nu as LibrariesObservabilityPage,ou as LibrariesMultiTenancyPage,eu as LibrariesGrowthPage,$m as LibrariesGraphQLPage,Ym as LibrariesEvolutionPage,Fm as LibrariesDesignSystemPage,_m as LibrariesDataViewsPage,Bm as LibrariesDataBackendPage,Dm as LibrariesCrossPlatformUIPage,Lm as LibrariesCostTrackingPage,Tm as LibrariesContractsPage,km as LibrariesContentGenPage,vm as LibrariesAnalyticsPage,fm as LibrariesAiAgentPage,um as LibrariesAccessibilityPage,dm as KnowledgeSpacesPage,lm as KnowledgeSourcesPage,nm as KnowledgeOverviewPage,om as KnowledgeExamplesPage,am as KnowledgeCategoriesPage,Up as IntegrationsWhatsappTwilioPage,Mp as IntegrationsWhatsappMetaPage,Dp as IntegrationsTwilioPage,Ep as IntegrationsStripePage,Rp as IntegrationsSpecModelPage,Tp as IntegrationsSlackPage,Ip as IntegrationsS3Page,Sp as IntegrationsResendPage,wp as IntegrationsQdrantPage,bp as IntegrationsPowensPage,yp as IntegrationsPostmarkPage,hp as IntegrationsOverviewPage,up as IntegrationsOpenAIPage,pp as IntegrationsMistralPage,sp as IntegrationsHealthRoutingPage,lp as IntegrationsGoogleCalendarPage,np as IntegrationsGmailPage,ip as IntegrationsGithubPage,ap as IntegrationsElevenLabsPage,ep as IntegrationsCircuitBreakersPage,xs as InstallationPage,Zs as HelloWorldPage,$d as GuidesIndexPage,Fd as GuideSpecValidationTypingPage,Vd as GuideReleaseCapsulesPage,zd as GuideNextjsOneEndpointPage,Wd as GuideImportExistingCodebasesPage,Ed as GuideHostBuilderWorkbenchPage,Td as GuideGenerateDocsClientsSchemasPage,Id as GuideFirstModuleBundlePage,Sd as GuideDocsPipelinePage,wd as GuideContractTypesPage,gd as GuideConnectInRepoPage,pd as GuideCIDiffGatingPage,Kp as GenerateClientFromSchemaPage,Cs as ExampleShowcasePage,ts as EcosystemTemplatesPage,$l as EcosystemRegistryPage,Zl as EcosystemPluginsPage,Yl as EcosystemIntegrationsPage,Og as DocsReferencePage,hg as DocsReferenceIndexPage,bl as DocsIndexPage,ds as DocsExamplesPage,Xv as DeveloperToolsPage,Vp as DeterministicCodegenPage,Gs as DataViewTutorialPage,Gi as DOCS_PRIMARY_SECTIONS,vi as DOCS_PAGES,zp as ContractFirstApiPage,Ws as CompatibilityPage,Fl as ComparisonWorkflowEnginesPage,Hl as ComparisonWindmillPage,Vl as ComparisonOverviewPage,ql as ComparisonInternalToolBuildersPage,Gl as ComparisonEnterprisePlatformsPage,_l as ComparisonAutomationPlatformsPage,Bs as CLIPage,Wl as ArchitectureOverviewPage,Bl as ArchitectureMultiTenancyPage,Dl as ArchitectureKnowledgeBindingPage,Ll as ArchitectureIntegrationBindingPage,Al as ArchitectureControlPlanePage,Pl as ArchitectureAppConfigPage,bf as AdvancedWorkflowMonitoringPage,ff as AdvancedTelemetryPage,pf as AdvancedSpecExperimentsPage,lf as AdvancedRenderersPage,af as AdvancedOverlayEditorPage,xh as AdvancedMCPPage};