@contractspec/bundle.library 3.9.4 → 3.9.5

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.
Files changed (106) hide show
  1. package/.turbo/turbo-build.log +9 -6
  2. package/CHANGELOG.md +39 -0
  3. package/dist/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -4
  4. package/dist/components/docs/advanced/index.js +10 -10
  5. package/dist/components/docs/index.js +168 -168
  6. package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.content.d.ts +3 -3
  7. package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.content.js +2 -2
  8. package/dist/components/docs/libraries/LibrariesCrossPlatformUIPage.js +2 -2
  9. package/dist/components/docs/libraries/index.js +2 -2
  10. package/dist/index.js +179 -179
  11. package/dist/node/components/docs/advanced/AdvancedSpecExperimentsPage.js +4 -4
  12. package/dist/node/components/docs/advanced/index.js +10 -10
  13. package/dist/node/components/docs/index.js +168 -168
  14. package/dist/node/components/docs/libraries/LibrariesCrossPlatformUIPage.content.js +2 -2
  15. package/dist/node/components/docs/libraries/LibrariesCrossPlatformUIPage.js +2 -2
  16. package/dist/node/components/docs/libraries/index.js +2 -2
  17. package/dist/node/index.js +179 -179
  18. package/package.json +24 -24
  19. package/src/components/docs/advanced/AdvancedSpecExperimentsPage.tsx +22 -14
  20. package/src/components/docs/generated/docs-index._common.json +1699 -2008
  21. package/src/components/docs/generated/docs-index.agent-console.json +377 -377
  22. package/src/components/docs/generated/docs-index.ai-chat-assistant.json +17 -17
  23. package/src/components/docs/generated/docs-index.ai-chat.json +105 -105
  24. package/src/components/docs/generated/docs-index.ai-support-bot.json +9 -9
  25. package/src/components/docs/generated/docs-index.analytics-dashboard.json +169 -169
  26. package/src/components/docs/generated/docs-index.app-config.json +137 -137
  27. package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +17 -17
  28. package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +33 -33
  29. package/src/components/docs/generated/docs-index.audit-trail.json +49 -49
  30. package/src/components/docs/generated/docs-index.calendar-google.json +9 -9
  31. package/src/components/docs/generated/docs-index.content-generation.json +9 -9
  32. package/src/components/docs/generated/docs-index.control-plane.json +17 -17
  33. package/src/components/docs/generated/docs-index.crm-pipeline.json +161 -161
  34. package/src/components/docs/generated/docs-index.data-grid-showcase.json +25 -25
  35. package/src/components/docs/generated/docs-index.defineExample.json +9 -9
  36. package/src/components/docs/generated/docs-index.email-gmail.json +9 -9
  37. package/src/components/docs/generated/docs-index.feature-flags.json +217 -217
  38. package/src/components/docs/generated/docs-index.files.json +177 -177
  39. package/src/components/docs/generated/docs-index.generated.ts +20 -20
  40. package/src/components/docs/generated/docs-index.harness-lab.json +9 -9
  41. package/src/components/docs/generated/docs-index.health.json +97 -97
  42. package/src/components/docs/generated/docs-index.identity-rbac.json +313 -313
  43. package/src/components/docs/generated/docs-index.in-app-docs.json +9 -9
  44. package/src/components/docs/generated/docs-index.integration-hub.json +265 -265
  45. package/src/components/docs/generated/docs-index.integration-posthog.json +9 -9
  46. package/src/components/docs/generated/docs-index.integration-stripe.json +9 -9
  47. package/src/components/docs/generated/docs-index.integration-supabase.json +9 -9
  48. package/src/components/docs/generated/docs-index.jobs.json +137 -137
  49. package/src/components/docs/generated/docs-index.kb-update-pipeline.json +129 -129
  50. package/src/components/docs/generated/docs-index.knowledge-canon.json +9 -9
  51. package/src/components/docs/generated/docs-index.learning-journey-ambient-coach.json +9 -9
  52. package/src/components/docs/generated/docs-index.learning-journey-crm-onboarding.json +49 -49
  53. package/src/components/docs/generated/docs-index.learning-journey-duo-drills.json +9 -9
  54. package/src/components/docs/generated/docs-index.learning-journey-platform-tour.json +49 -49
  55. package/src/components/docs/generated/docs-index.learning-journey-quest-challenges.json +9 -9
  56. package/src/components/docs/generated/docs-index.learning-journey-registry.json +33 -33
  57. package/src/components/docs/generated/docs-index.learning-journey-studio-onboarding.json +49 -49
  58. package/src/components/docs/generated/docs-index.learning-journey-ui-coaching.json +9 -9
  59. package/src/components/docs/generated/docs-index.learning-journey-ui-gamified.json +9 -9
  60. package/src/components/docs/generated/docs-index.learning-journey-ui-onboarding.json +9 -9
  61. package/src/components/docs/generated/docs-index.learning-journey-ui-shared.json +9 -9
  62. package/src/components/docs/generated/docs-index.learning-journey.json +241 -241
  63. package/src/components/docs/generated/docs-index.learning-patterns.json +9 -9
  64. package/src/components/docs/generated/docs-index.lifecycle-cli.json +9 -9
  65. package/src/components/docs/generated/docs-index.lifecycle-dashboard.json +9 -9
  66. package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +65 -65
  67. package/src/components/docs/generated/docs-index.marketplace.json +337 -337
  68. package/src/components/docs/generated/docs-index.meeting-recorder-providers.json +9 -9
  69. package/src/components/docs/generated/docs-index.meeting-recorder.json +49 -49
  70. package/src/components/docs/generated/docs-index.messaging-agent-actions.json +17 -17
  71. package/src/components/docs/generated/docs-index.metrics.json +201 -201
  72. package/src/components/docs/generated/docs-index.minimal.json +17 -17
  73. package/src/components/docs/generated/docs-index.mobile-demo-landing.json +41 -41
  74. package/src/components/docs/generated/docs-index.notifications.json +65 -65
  75. package/src/components/docs/generated/docs-index.openbanking-powens.json +9 -9
  76. package/src/components/docs/generated/docs-index.openbanking.json +65 -65
  77. package/src/components/docs/generated/docs-index.opencode-cli.json +17 -17
  78. package/src/components/docs/generated/docs-index.personalization.json +9 -9
  79. package/src/components/docs/generated/docs-index.platform-acp.json +137 -137
  80. package/src/components/docs/generated/docs-index.platform-agent.json +201 -201
  81. package/src/components/docs/generated/docs-index.platform-context.json +121 -121
  82. package/src/components/docs/generated/docs-index.platform-control-plane.json +321 -321
  83. package/src/components/docs/generated/docs-index.platform-database.json +89 -89
  84. package/src/components/docs/generated/docs-index.platform-docs.json +161 -161
  85. package/src/components/docs/generated/docs-index.platform-harness.json +177 -177
  86. package/src/components/docs/generated/docs-index.platform-integrations.json +329 -329
  87. package/src/components/docs/generated/docs-index.platform-knowledge.json +57 -57
  88. package/src/components/docs/generated/docs-index.platform-provider-ranking.json +217 -217
  89. package/src/components/docs/generated/docs-index.pocket-family-office.json +129 -129
  90. package/src/components/docs/generated/docs-index.policy-safe-knowledge-assistant.json +9 -9
  91. package/src/components/docs/generated/docs-index.product-intent.json +9 -9
  92. package/src/components/docs/generated/docs-index.project-management-sync.json +9 -9
  93. package/src/components/docs/generated/docs-index.saas-boilerplate.json +209 -209
  94. package/src/components/docs/generated/docs-index.service-business-os.json +193 -193
  95. package/src/components/docs/generated/docs-index.team-hub.json +185 -185
  96. package/src/components/docs/generated/docs-index.unknown.json +521 -521
  97. package/src/components/docs/generated/docs-index.versioned-knowledge-base.json +81 -81
  98. package/src/components/docs/generated/docs-index.video-api-showcase.json +33 -33
  99. package/src/components/docs/generated/docs-index.video-docs-terminal.json +9 -9
  100. package/src/components/docs/generated/docs-index.video-marketing-clip.json +9 -9
  101. package/src/components/docs/generated/docs-index.visualization-showcase.json +17 -17
  102. package/src/components/docs/generated/docs-index.voice-providers.json +9 -9
  103. package/src/components/docs/generated/docs-index.wealth-snapshot.json +153 -153
  104. package/src/components/docs/generated/docs-index.workflow-system.json +433 -433
  105. package/src/components/docs/generated/docs-index.workspace-cli.json +9 -9
  106. package/src/components/docs/libraries/LibrariesCrossPlatformUIPage.content.ts +3 -3
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- 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"fs/promises";import*as So from"path";import{fileURLToPath as Ps}from"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
+ var sl=Object.defineProperty;var dl=(e)=>e;function pl(e,t){this[e]=dl.bind(null,t)}var ml=(e,t)=>{for(var o in t)sl(e,o,{get:t[o],enumerable:!0,configurable:!0,set:pl.bind(t,o)})};var ul=(e,t)=>()=>(e&&(t=e(e=0)),t);var tn="docs-index.manifest.json";var wi={};ml(wi,{listGeneratedDocs:()=>Bs,getGeneratedDocById:()=>Ws,getDocsIndexManifest:()=>Us});import{readFile as Xi}from"fs/promises";import*as So from"path";import{fileURLToPath as Es}from"url";function Os(e){if(!e)return"_common";if(e.includes("/")){let[t]=e.split("/");return t||"_common"}return"_common"}async function $i(){if(!Ji)Ji=Xi(So.join(Ni,tn),"utf8").then((e)=>JSON.parse(e));return Ji}function Ms(e){let t=e.contentRoot??".";if(t==="../../../../../../../generated/docs")return Ds;return So.join(Ni,t)}async function on(e){let t=an.get(e);if(t)return t;let o=Xi(So.join(Ni,e),"utf8").then((n)=>JSON.parse(n));return an.set(e,o),o}async function Bs(){if(!Zi)Zi=(async()=>{let e=await $i();return(await Promise.all(e.chunks.map((o)=>on(o.file)))).flat()})();return Zi}async function Us(){return $i()}async function Ws(e){let t=await $i(),o=Os(e),n=t.chunks.find((ie)=>ie.key===o);if(!n)return null;let Ne=(await on(n.file)).find((ie)=>ie.id===e);if(!Ne||!Ne.contentPath)return null;let Xe=So.join(Ms(t),Ne.contentPath);try{let ie=await Xi(Xe,"utf8");return{entry:Ne,content:ie}}catch{return null}}var Ni,Ds,Ji=null,Zi=null,an;var ki=ul(()=>{Ni=So.dirname(Es(import.meta.url)),Ds=So.join(Ni,"../../../../../../../generated/docs"),an=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 gl(){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 hl(){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 Yh(e){let t=hl(),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 Br(){return vi.filter((e)=>e.audience==="secondary")}function Ur(){return gl().map((e)=>({...e,featured:e.items.slice(0,3)}))}import{CodeBlock as fl}from"@contractspec/lib.design-system";import No from"@contractspec/lib.ui-link";import{ArrowRight as qi,Boxes as Wr,FileSearch as yl,ShieldCheck as vl,Waypoints as bl}from"lucide-react";import{jsx as b,jsxs as ee}from"react/jsx-runtime";var Nl=[{title:"One system, many surfaces",body:"Define explicit contracts once, then keep APIs, UI, data, events, and agent-facing surfaces aligned.",icon:Wr},{title:"Incremental adoption",body:"Start with one endpoint, one workflow, or one unsafe module. You do not need a rewrite to begin.",icon:bl},{title:"Operator-grade controls",body:"Carry policy, auditability, migrations, tracing, and integration boundaries forward with the same system model.",icon:vl}],wl=[{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 kl(){let e=Ur(),t=Br().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:Nl.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:wl.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(fl,{language:"bash",filename:"docs-quick-start",code:`bun add -D contractspec
3
3
  bun add @contractspec/lib.contracts-spec @contractspec/lib.schema
4
4
 
5
5
  contractspec init
6
6
  contractspec create --type operation
7
7
  contractspec build src/contracts/mySpec.ts
8
- 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
+ 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(yl,{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(Wr,{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 Sl}from"lucide-react";import{jsx as I,jsxs as at}from"react/jsx-runtime";function of(){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';
9
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
10
  import { createMcpServer } from '@contractspec/lib.contracts-runtime-server-mcp/provider-mcp';
11
11
  import { registry, resources, prompts } from './lib/registry';
@@ -74,7 +74,7 @@ export const AIAgentRestrictions = definePolicy({
74
74
  !ctx.approvalGranted,
75
75
  },
76
76
  ],
77
- });`})})]}),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\u2014only 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 \u201CSign overlay\u201D 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
+ });`})})]}),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\u2014only 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(Sl,{size:16})]})]})]})}import Cl from"@contractspec/lib.ui-link";import{jsx as Ht,jsxs as no}from"react/jsx-runtime";function lf(){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 \u201CSign overlay\u201D to get the final JSON payload."}),Ht("li",{children:"Persist in the `Overlay` table and register with `OverlayRegistry`."})]}),no("p",{children:["See also:"," ",Ht(Cl,{href:"/docs/ops/tenant-customization",className:"text-violet-400 underline",children:"Tenant customization runbook"}),"."]})]})]})}import Il from"@contractspec/lib.ui-link";import{ChevronRight as Pl}from"lucide-react";import{jsx as Ft,jsxs as Ya}from"react/jsx-runtime";function uf(){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';
78
78
  import { MyWorkflowSpec } from './specs';
79
79
 
80
80
  export function WorkflowPage() {
@@ -89,7 +89,7 @@ export function WorkflowPage() {
89
89
  </button>
90
90
  </div>
91
91
  );
92
- }`})})]}),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
+ }`})})]}),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(Il,{href:"/docs",className:"btn-primary",children:["Back to docs ",Ft(Pl,{size:16})]})})]})]})}import{Code as Vi,H1 as Tl,H2 as Hi,H3 as Al,P as _r}from"@contractspec/lib.design-system/components/typography";import{jsx as _a,jsxs as Yo}from"react/jsx-runtime";function yf(){return Yo("div",{className:"space-y-8",children:[Yo("div",{className:"space-y-4",children:[_a(Tl,{className:"font-bold text-4xl",children:"Spec Experiments"}),_a(_r,{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(Hi,{className:"font-bold text-2xl",children:"Define control + variants"}),_a(Vi,{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { SpecExperimentRegistry } from '@contractspec/lib.growth/spec-experiments';
93
93
 
94
94
  const registry = new SpecExperimentRegistry().register({
95
95
  target: { name: 'billing.createInvoice', version: 4 },
@@ -109,12 +109,12 @@ const registry = new SpecExperimentRegistry().register({
109
109
  ],
110
110
  rolloutStages: [0.01, 0.1, 0.5, 1],
111
111
  guardrails: { errorRateThreshold: 0.02, latencyP99ThresholdMs: 500 },
112
- });`})]}),Yo("div",{className:"space-y-3",children:[_a("h2",{className:"font-bold text-2xl",children:"Attach to runtime"}),_a("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { createSpecVariantResolver } from '@contractspec/lib.growth/spec-experiments';
112
+ });`})]}),Yo("div",{className:"space-y-3",children:[_a(Hi,{className:"font-bold text-2xl",children:"Attach to runtime"}),_a(Vi,{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { createSpecVariantResolver } from '@contractspec/lib.growth/spec-experiments';
113
113
 
114
114
  adapterContext.specVariantResolver = createSpecVariantResolver({
115
115
  adapter,
116
116
  resolveUserId: (ctx) => ctx.userId ?? ctx.organizationId ?? 'anon',
117
- });`})]}),Yo("div",{className:"space-y-3",children:[_a("h2",{className:"font-bold text-2xl",children:"Track outcomes + auto-rollback"}),_a("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import {
117
+ });`})]}),Yo("div",{className:"space-y-3",children:[_a(Hi,{className:"font-bold text-2xl",children:"Track outcomes + auto-rollback"}),_a(Vi,{className:"rounded-lg border bg-muted p-4 text-sm",children:`import {
118
118
  SpecExperimentAnalyzer,
119
119
  SpecExperimentController,
120
120
  } from '@contractspec/lib.growth/spec-experiments';
@@ -124,7 +124,7 @@ const controller = new SpecExperimentController({
124
124
  registry,
125
125
  analyzer,
126
126
  onRollback: (target, evaluation) => notifyOps(target, evaluation.reasons),
127
- });`})]}),_a("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Deterministic bucketing",description:"ExperimentRunner reuses the same hashing logic as growth experiments\u2014every user sticks to a variant."},{title:"Multi-stage rollouts",description:"Use `rolloutStages` to shift 1% \u2192 10% \u2192 50% \u2192 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\u2014which 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
+ });`})]}),_a("div",{className:"grid gap-4 md:grid-cols-2",children:[{title:"Deterministic bucketing",description:"ExperimentRunner reuses the same hashing logic as growth experiments\u2014every user sticks to a variant."},{title:"Multi-stage rollouts",description:"Use `rolloutStages` to shift 1% \u2192 10% \u2192 50% \u2192 100%. Guardrails trigger rollbacks automatically."}].map((e)=>Yo("div",{className:"card-subtle space-y-2 p-4",children:[_a(Al,{className:"font-semibold text-lg",children:e.title}),_a(_r,{className:"text-muted-foreground text-sm",children:e.description})]},e.title))})]})}import zr from"@contractspec/lib.ui-link";import{ChevronRight as Rl}from"lucide-react";import{jsx as v,jsxs as M}from"react/jsx-runtime";function kf(){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\u2014which 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';
128
128
 
129
129
  export const OrderProcessingTelemetry = defineTelemetry({
130
130
  meta: {
@@ -169,7 +169,7 @@ export const OrderProcessingTelemetry = defineTelemetry({
169
169
  notify: ['pagerduty', 'slack'],
170
170
  },
171
171
  ],
172
- });`})})]}),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"})," \u2013 Request count, latency, error rate per Command/Query"]}),M("li",{children:[v("strong",{children:"All workflows"})," \u2013 Step execution time, retry counts, compensation events"]}),M("li",{children:[v("strong",{children:"All data views"})," \u2013 Query execution time, result set size"]}),M("li",{children:[v("strong",{children:"All policy decisions"})," \u2013 Decision time, permit/deny ratio"]}),M("li",{children:[v("strong",{children:"System resources"})," \u2013 CPU, memory, disk, network usage"]})]}),v("p",{className:"text-muted-foreground",children:"You don't need to add instrumentation code manually\u2014the 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"})," \u2013 For metrics collection and alerting"]}),M("li",{children:[v("strong",{children:"Grafana"})," \u2013 For dashboards and visualization"]}),M("li",{children:[v("strong",{children:"Jaeger / Tempo"})," \u2013 For distributed tracing"]}),M("li",{children:[v("strong",{children:"Loki"})," \u2013 For log aggregation"]}),M("li",{children:[v("strong",{children:"Datadog"})," \u2013 All-in-one observability platform"]}),M("li",{children:[v("strong",{children:"New Relic"})," \u2013 Application performance monitoring"]}),M("li",{children:[v("strong",{children:"Honeycomb"})," \u2013 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\u2014CPU, 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"})," \u2013 Trace only a percentage of requests (e.g., 10%)"]}),M("li",{children:[v("strong",{children:"Adaptive sampling"})," \u2013 Automatically reduce sampling rate under high load"]}),M("li",{children:[v("strong",{children:"Tail-based sampling"})," \u2013 Keep traces for failed requests, sample successful ones"]}),M("li",{children:[v("strong",{children:"Field redaction"})," \u2013 Remove sensitive data from traces and logs"]}),M("li",{children:[v("strong",{children:"Aggregation"})," \u2013 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\u2014log 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\u2014they 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\u2014this 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
+ });`})})]}),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"})," \u2013 Request count, latency, error rate per Command/Query"]}),M("li",{children:[v("strong",{children:"All workflows"})," \u2013 Step execution time, retry counts, compensation events"]}),M("li",{children:[v("strong",{children:"All data views"})," \u2013 Query execution time, result set size"]}),M("li",{children:[v("strong",{children:"All policy decisions"})," \u2013 Decision time, permit/deny ratio"]}),M("li",{children:[v("strong",{children:"System resources"})," \u2013 CPU, memory, disk, network usage"]})]}),v("p",{className:"text-muted-foreground",children:"You don't need to add instrumentation code manually\u2014the 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"})," \u2013 For metrics collection and alerting"]}),M("li",{children:[v("strong",{children:"Grafana"})," \u2013 For dashboards and visualization"]}),M("li",{children:[v("strong",{children:"Jaeger / Tempo"})," \u2013 For distributed tracing"]}),M("li",{children:[v("strong",{children:"Loki"})," \u2013 For log aggregation"]}),M("li",{children:[v("strong",{children:"Datadog"})," \u2013 All-in-one observability platform"]}),M("li",{children:[v("strong",{children:"New Relic"})," \u2013 Application performance monitoring"]}),M("li",{children:[v("strong",{children:"Honeycomb"})," \u2013 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\u2014CPU, 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"})," \u2013 Trace only a percentage of requests (e.g., 10%)"]}),M("li",{children:[v("strong",{children:"Adaptive sampling"})," \u2013 Automatically reduce sampling rate under high load"]}),M("li",{children:[v("strong",{children:"Tail-based sampling"})," \u2013 Keep traces for failed requests, sample successful ones"]}),M("li",{children:[v("strong",{children:"Field redaction"})," \u2013 Remove sensitive data from traces and logs"]}),M("li",{children:[v("strong",{children:"Aggregation"})," \u2013 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\u2014log 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\u2014they 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\u2014this 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(zr,{href:"/docs/advanced/mcp",className:"btn-ghost",children:"Previous: MCP Adapters"}),M(zr,{href:"/docs/comparison",className:"btn-primary",children:["Next: Comparison ",v(Rl,{size:16})]})]})]})}import{jsx as ca,jsxs as wo}from"react/jsx-runtime";function If(){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';
173
173
 
174
174
  const monitor = new SLAMonitor((event, payload) => {
175
175
  if (event === 'workflow.sla_breach') {
@@ -179,7 +179,7 @@ const monitor = new SLAMonitor((event, payload) => {
179
179
  });
180
180
 
181
181
  // Check periodically
182
- 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
+ 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 Gr from"@contractspec/lib.ui-link";import{ChevronRight as Ll}from"lucide-react";import{jsx as J,jsxs as Ve}from"react/jsx-runtime";function El(){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 = {
183
183
  id: string;
184
184
  version: string;
185
185
  name: string;
@@ -324,7 +324,7 @@ monitor.check(currentState, workflowSpec);`})]}),wo("div",{className:"space-y-4"
324
324
  knowledge: ResolvedKnowledge[]; // [{ binding, space, sources }]
325
325
  branding: ResolvedBranding; // { appName, assets, colors, domain }
326
326
  notes?: string;
327
- };`})]}),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
+ };`})]}),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(Gr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),Ve(Gr,{href:"/docs/architecture/integration-binding",className:"btn-primary",children:["Integration Binding ",J(Ll,{size:16})]})]})]})}import{CodeBlock as qr}from"@contractspec/lib.design-system";import bi from"@contractspec/lib.ui-link";import{ChevronRight as Dl}from"lucide-react";import{jsx as le,jsxs as la}from"react/jsx-runtime";function Ol(){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(qr,{language:"text",code:`Commands
328
328
  - controlPlane.intent.submit
329
329
  - controlPlane.plan.compile
330
330
  - controlPlane.plan.verify
@@ -360,7 +360,7 @@ Capabilities
360
360
  - control-plane.approval
361
361
  - control-plane.audit
362
362
  - control-plane.skill-registry
363
- - control-plane.channel-runtime`})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Policy and safety posture"}),la("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[le("li",{children:"No side-effect action executes unless it comes from a compiled plan."}),le("li",{children:"High-risk actions are blocked from autonomous mode in v1."}),le("li",{children:"Approval commands provide explicit human-in-the-loop transitions."}),le("li",{children:"Skill installation is modeled as governance-controlled operations."}),le("li",{children:"Trace queries expose policy rationale and step outcomes for replay."})]})]}),la("section",{className:"editorial-panel space-y-4",children:[le("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Apply the runtime locally with Connect"}),le("p",{className:"text-muted-foreground text-sm leading-7",children:"The control plane defines the governance contracts. Connect is the local adapter that turns those contracts into task-scoped context, plan, verification, review, and replay flows for coding agents."}),la("div",{className:"flex flex-wrap gap-3",children:[le(bi,{href:"/docs/specs/connect",className:"btn-primary",children:"Connect spec"}),le(bi,{href:"/docs/guides/connect-in-a-repo",className:"btn-ghost",children:"Use Connect in a repo"})]})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Implementation map"}),le(_r,{language:"text",code:`packages/libs/contracts-spec/src/control-plane/
363
+ - control-plane.channel-runtime`})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Policy and safety posture"}),la("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[le("li",{children:"No side-effect action executes unless it comes from a compiled plan."}),le("li",{children:"High-risk actions are blocked from autonomous mode in v1."}),le("li",{children:"Approval commands provide explicit human-in-the-loop transitions."}),le("li",{children:"Skill installation is modeled as governance-controlled operations."}),le("li",{children:"Trace queries expose policy rationale and step outcomes for replay."})]})]}),la("section",{className:"editorial-panel space-y-4",children:[le("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"Apply the runtime locally with Connect"}),le("p",{className:"text-muted-foreground text-sm leading-7",children:"The control plane defines the governance contracts. Connect is the local adapter that turns those contracts into task-scoped context, plan, verification, review, and replay flows for coding agents."}),la("div",{className:"flex flex-wrap gap-3",children:[le(bi,{href:"/docs/specs/connect",className:"btn-primary",children:"Connect spec"}),le(bi,{href:"/docs/guides/connect-in-a-repo",className:"btn-ghost",children:"Use Connect in a repo"})]})]}),la("div",{className:"space-y-4",children:[le("h2",{className:"font-bold text-2xl",children:"Implementation map"}),le(qr,{language:"text",code:`packages/libs/contracts-spec/src/control-plane/
364
364
  commands/
365
365
  queries/
366
366
  events/
@@ -369,7 +369,7 @@ Capabilities
369
369
  contracts.test.ts
370
370
 
371
371
  packages/apps/web-landing/src/app/docs/architecture/control-plane/page.tsx
372
- 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
+ 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(Dl,{size:16})]})]})]})}import{CodeBlock as Jo}from"@contractspec/lib.design-system";import Vr from"@contractspec/lib.ui-link";import{ChevronRight as Ml}from"lucide-react";import{jsx as B,jsxs as He}from"react/jsx-runtime";function Bl(){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
373
373
  {
374
374
  meta: { name: "invoice-app", version: '1.0.0', appId: "invoice" },
375
375
  integrationSlots: [
@@ -502,7 +502,7 @@ const result = await executeCapability(
502
502
  connectionId: "conn_stripe_acme_prod"
503
503
  }
504
504
  ]
505
- }`})]}),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
+ }`})]}),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(Vr,{href:"/docs/architecture/app-config",className:"btn-ghost",children:"Previous: App Configuration"}),He(Vr,{href:"/docs/architecture/knowledge-binding",className:"btn-primary",children:["Knowledge Binding ",B(Ml,{size:16})]})]})]})}import{CodeBlock as ni}from"@contractspec/lib.design-system";import Hr from"@contractspec/lib.ui-link";import{ChevronRight as Ul}from"lucide-react";import{jsx as d,jsxs as se}from"react/jsx-runtime";function Wl(){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
506
506
  {
507
507
  id: "support-app",
508
508
  version: "1.0.0",
@@ -661,17 +661,17 @@ steps:
661
661
  allowedCategories: ["operational"],
662
662
  sources: ["src_crm_data", "src_past_invoices"]
663
663
  }
664
- ]`})]}),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
+ ]`})]}),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(Hr,{href:"/docs/architecture/integration-binding",className:"btn-ghost",children:"Previous: Integration Binding"}),se(Hr,{href:"/docs/knowledge",className:"btn-primary",children:["Knowledge & Context ",d(Ul,{size:16})]})]})]})}import{CodeBlock as _l}from"@contractspec/lib.design-system";import Fr from"@contractspec/lib.ui-link";import{ChevronRight as zl}from"lucide-react";import{jsx as ot,jsxs as At}from"react/jsx-runtime";function Gl(){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(_l,{language:"typescript",code:`type TenantAppConfig = {
665
665
  tenantId: string;
666
666
  blueprintId: string;
667
667
  // ...
668
668
  integrationBindings: AppIntegrationBinding[];
669
669
  knowledgeBindings: AppKnowledgeBinding[];
670
670
  featureFlags: Record<string, boolean>;
671
- };`}),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"})," \u2013 ContractSpec compiles specs into back-end, events and user interfaces for both web and mobile."]}),wt("li",{children:[T("strong",{children:"Policy enforcement"})," \u2013 A built-in policy engine governs PII access and mutations across the UI."]}),wt("li",{children:[T("strong",{children:"Customisation via overlays"})," \u2013 Non-technical users can safely personalise layouts while respecting policies."]}),wt("li",{children:[T("strong",{children:"Extensible capabilities"})," \u2013 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\u2019s 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\u2019s 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\u2019s 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\u2014no 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\u2019t 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\u2014typed specifications for back-end, front-end, workflows and policies with a unified web/mobile runtime\u2014this 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 \u201Capplicative workflows\u201D 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\u2019s 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"})," \u2013 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"})," \u2013 Every render and mutate passes through an ABAC/PII policy decision point."]}),rt("li",{children:[l("strong",{children:"Personalisation"})," \u2013 Signed OverlaySpecs allow tenant/user-specific UI changes without touching code."]}),rt("li",{children:[l("strong",{children:"Unified runtime"})," \u2013 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
+ };`}),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(Fr,{href:"/docs/architecture",className:"btn-ghost",children:"Back to Architecture"}),At(Fr,{href:"/docs/libraries/multi-tenancy",className:"btn-primary",children:["Multi-Tenancy Library ",ot(zl,{size:16})]})]})]})}import Zo from"@contractspec/lib.ui-link";import{jsx as Be,jsxs as Kt}from"react/jsx-runtime";var ql=[{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 Vl(){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:ql.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 Hl(){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"})," \u2013 ContractSpec compiles specs into back-end, events and user interfaces for both web and mobile."]}),wt("li",{children:[T("strong",{children:"Policy enforcement"})," \u2013 A built-in policy engine governs PII access and mutations across the UI."]}),wt("li",{children:[T("strong",{children:"Customisation via overlays"})," \u2013 Non-technical users can safely personalise layouts while respecting policies."]}),wt("li",{children:[T("strong",{children:"Extensible capabilities"})," \u2013 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 Fl from"@contractspec/lib.ui-link";import{jsx as W,jsxs as it}from"react/jsx-runtime";function Kl(){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(Fl,{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\u2019s 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\u2019s 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\u2019s 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\u2014no 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\u2019t 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 Yl(){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\u2014typed specifications for back-end, front-end, workflows and policies with a unified web/mobile runtime\u2014this 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 Jl(){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 \u201Capplicative workflows\u201D 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 Zl(){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\u2019s 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"})," \u2013 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"})," \u2013 Every render and mutate passes through an ABAC/PII policy decision point."]}),rt("li",{children:[l("strong",{children:"Personalisation"})," \u2013 Signed OverlaySpecs allow tenant/user-specific UI changes without touching code."]}),rt("li",{children:[l("strong",{children:"Unified runtime"})," \u2013 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 Xl}from"@contractspec/lib.design-system";import Kr from"@contractspec/lib.ui-link";import{ChevronRight as $l}from"lucide-react";import{jsx as Qt,jsxs as Uo}from"react/jsx-runtime";function xl(){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(Xl,{language:"bash",filename:"install-example",code:`bun add @contractspec/lib.plugin.example-generator
672
672
 
673
673
  # Or in a workspace
674
- 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
+ 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(Kr,{href:"/docs/ecosystem/registry",className:"btn-primary",children:["Marketplace manifest ",Qt($l,{size:16})]}),Qt(Kr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Authoring templates"})]})]})}import{CodeBlock as Fi}from"@contractspec/lib.design-system";import Qr from"@contractspec/lib.ui-link";import{ChevronRight as jl}from"lucide-react";import{jsx as Ae,jsxs as Yt}from"react/jsx-runtime";function es(){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(Fi,{language:"text",filename:"catalog-layout",code:`packages/apps-registry/cursor-marketplace/
675
675
  .cursor-plugin/marketplace.json
676
676
  plugins/
677
677
  contractspec/
@@ -680,7 +680,7 @@ bun add -D @contractspec/lib.plugin.example-generator`})]}),Uo("div",{className:
680
680
  contractspec-ai-agent/
681
681
 
682
682
  packs/
683
- 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
+ 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(Fi,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
684
684
  "name": "contractspec-marketplace",
685
685
  "owner": { "name": "ContractSpec Team" },
686
686
  "plugins": [
@@ -701,10 +701,10 @@ packs/
701
701
  "source": "plugins/contractspec-ai-agent"
702
702
  }
703
703
  ]
704
- }`})]}),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
+ }`})]}),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(Fi,{language:"bash",filename:"validate-marketplace",code:`bun run plugin:contractspec:validate
705
705
 
706
706
  # Optional when offline
707
- 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
+ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]})]}),Yt("div",{className:"flex items-center gap-4 pt-4",children:[Yt(Qr,{href:"/docs/ecosystem/templates",className:"btn-primary",children:["Author a plugin ",Ae(jl,{size:16})]}),Ae(Qr,{href:"/docs/ecosystem/registry",className:"btn-ghost",children:"Manifest details"})]})]})}import{CodeBlock as Ki}from"@contractspec/lib.design-system";import Yr from"@contractspec/lib.ui-link";import{ChevronRight as ts}from"lucide-react";import{jsx as Ga,jsxs as Wo}from"react/jsx-runtime";function as(){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(Ki,{language:"json",filename:"packages/apps-registry/cursor-marketplace/.cursor-plugin/marketplace.json",code:`{
708
708
  "name": "contractspec-marketplace",
709
709
  "owner": { "name": "ContractSpec Team" },
710
710
  "plugins": [
@@ -717,16 +717,16 @@ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]})]}),Yt("di
717
717
  "source": "plugins/contractspec-contracts-spec"
718
718
  }
719
719
  ]
720
- }`})]}),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
+ }`})]}),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(Ki,{language:"text",filename:"plugin-layout",code:`plugins/<plugin-name>/
721
721
  .cursor-plugin/plugin.json
722
722
  rules/
723
723
  commands/
724
724
  agents/
725
725
  skills/
726
- .mcp.json`}),Ga(Hi,{language:"bash",filename:"validate-catalog",code:`bun run plugin:contractspec:validate
726
+ .mcp.json`}),Ga(Ki,{language:"bash",filename:"validate-catalog",code:`bun run plugin:contractspec:validate
727
727
 
728
728
  # Optional in offline environments
729
- 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
+ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]}),Wo("div",{className:"flex items-center gap-4 pt-4",children:[Wo(Yr,{href:"/docs/ecosystem/integrations",className:"btn-primary",children:["Integrations ",Ga(ts,{size:16})]}),Ga(Yr,{href:"/docs/ecosystem/templates",className:"btn-ghost",children:"Plugin authoring templates"})]})]})}import os from"@contractspec/lib.ui-link";import{jsx as Qi,jsxs as is}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 is("div",{className:"card-subtle space-y-3 p-6",children:[Qi("h3",{className:"font-semibold text-lg",children:e}),Qi("p",{className:"text-muted-foreground text-sm",children:t}),Qi(os,{href:n,className:"btn-primary",children:o})]})}import{CodeBlock as Jr}from"@contractspec/lib.design-system";import Zr from"@contractspec/lib.ui-link";import{ChevronRight as rs}from"lucide-react";import{jsx as Jt,jsxs as ko}from"react/jsx-runtime";function ns(){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(Jr,{language:"bash",filename:"catalog-authoring-layout",code:`packages/apps-registry/cursor-marketplace/
730
730
  plugins/
731
731
  <plugin-name>/
732
732
  .cursor-plugin/plugin.json
@@ -734,14 +734,14 @@ SKIP_PLUGIN_NETWORK_CHECK=1 bun run plugin:contractspec:validate`})]}),Wo("div",
734
734
  commands/
735
735
  agents/
736
736
  skills/
737
- .mcp.json`})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Template outputs"}),ko("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Jt("li",{children:".cursor-plugin/plugin.json with plugin metadata and paths"}),Jt("li",{children:"rules/, commands/, agents/, and skills/ content directories"}),Jt("li",{children:".mcp.json with all MCP server declarations used by the plugin"}),Jt("li",{children:"README.md describing scope and governance boundaries"})]})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Validate before submission"}),Jt(Kr,{language:"bash",filename:"validate-marketplace-catalog",code:`# Validate all plugins referenced by root marketplace manifest
737
+ .mcp.json`})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Template outputs"}),ko("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[Jt("li",{children:".cursor-plugin/plugin.json with plugin metadata and paths"}),Jt("li",{children:"rules/, commands/, agents/, and skills/ content directories"}),Jt("li",{children:".mcp.json with all MCP server declarations used by the plugin"}),Jt("li",{children:"README.md describing scope and governance boundaries"})]})]}),ko("div",{className:"card-subtle space-y-4 p-6",children:[Jt("h2",{className:"font-bold text-2xl",children:"Validate before submission"}),Jt(Jr,{language:"bash",filename:"validate-marketplace-catalog",code:`# Validate all plugins referenced by root marketplace manifest
738
738
  bun run plugin:contractspec:validate
739
739
 
740
740
  # Optional in offline environments
741
- 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
+ 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(Zr,{href:"/docs/ecosystem/plugins",className:"btn-primary",children:["Marketplace plugins ",Jt(rs,{size:16})]}),Jt(Zr,{href:"/docs/ecosystem/registry",className:"btn-ghost",children:"Marketplace manifest"})]})]})}import{registerDocBlocks as cs}from"@contractspec/lib.contracts-spec/docs";var ls=[{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
742
742
 
743
- 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(`
744
- `)}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
743
+ 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."}];cs(ls);import{ExampleCatalogDataView as Xr}from"@contractspec/lib.contracts-spec/docs";import{ButtonLink as $r,DataViewList as ss,StatusChip as ds}from"@contractspec/lib.design-system";import{HStack as ps,VStack as xr}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as ms,Muted as jr}from"@contractspec/lib.ui-kit-web/ui/typography";import{buildExampleDocsHref as us,listDiscoverableExamples as gs}from"@contractspec/module.examples/catalog";import{jsx as _o,jsxs as Yi}from"react/jsx-runtime";function hs(){let e=gs().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:us(o.meta.key),tags:o.meta.tags,sandboxEnabled:o.surfaces.sandbox.enabled}}).sort((o,n)=>o.title.localeCompare(n.title)),t={...Xr,view:{...Xr.view,kind:"list"}};return Yi(xr,{gap:"xl",children:[Yi(xr,{gap:"sm",children:[_o(ms,{children:"Examples"}),_o(jr,{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(ss,{spec:t,items:e,emptyState:_o(jr,{children:"No examples available."}),renderActions:(o)=>{return Yi(ps,{gap:"xs",justify:"end",children:[o.sandboxEnabled?_o($r,{href:`/sandbox?template=${o.id}`,size:"sm",variant:"outline",children:"Sandbox"}):null,_o($r,{href:o.route,size:"sm",children:"Reference"}),o.tags?.[0]?_o(ds,{size:"sm",label:o.tags[0]}):null]})}})]})}import{buildExampleDocsHref as fs,buildExampleReferenceHref as ys,getDiscoverableExample as vs,getExamplePreviewHref as bs}from"@contractspec/module.examples/catalog";var Ns={"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."},ws={"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 en(e){let t=vs(e);if(!t)return;let o=t.entrypoints.packageName.replace("@contractspec/example.",""),n=fs(e),Nt=bs(e);return{key:e,lead:Ns[e]??t.meta.summary??t.meta.description??"Public ContractSpec reference example.",sandboxHref:Nt,referenceHref:ws[e]??ys(e),llmsHref:`/llms/${t.entrypoints.packageName.replace("@contractspec/","")}`,repoHref:`https://github.com/lssm-tech/contractspec/tree/main/packages/examples/${o}`,localCommands:ks(o,n,Nt)}}function ks(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(`
744
+ `)}import{ButtonLink as Xo,CodeBlock as Ss}from"@contractspec/lib.design-system";import Cs from"@contractspec/lib.ui-link";import{getExample as Is}from"@contractspec/module.examples/catalog";import{FileCode2 as Ps,Play as Ts,TerminalSquare as As}from"lucide-react";import{jsx as de,jsxs as sa}from"react/jsx-runtime";function Rs({exampleKey:e}){let t=en(e),o=Is(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(Ts,{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(Ps,{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(As,{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(Ss,{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(Cs,{href:"https://github.com/lssm-tech/contractspec/blob/main/docs/meetup-agent-examples-runbook.md",children:"the meetup runbook"}),"."]})]})]})}async function Uv(){let{getDocsIndexManifest:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function rn(){let{listGeneratedDocs:e}=await Promise.resolve().then(() => (ki(),wi));return e()}async function Wv(e){let{getGeneratedDocById:t}=await Promise.resolve().then(() => (ki(),wi));return t(e)}import{CodeBlock as Si,InstallCommand as _s}from"@contractspec/lib.design-system";import nn from"@contractspec/lib.ui-link";import{ChevronRight as zs}from"lucide-react";import{jsx as re,jsxs as dt}from"react/jsx-runtime";function Gs(){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(_s,{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
745
745
  contractspec onboard
746
746
  bunx contractspec init
747
747
 
@@ -766,7 +766,7 @@ contractspec validate`})]}),dt("div",{className:"space-y-4",children:[re("h2",{c
766
766
  "operations": "interactions/commands|queries",
767
767
  "events": "events"
768
768
  }
769
- }`})]})]}),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
+ }`})]})]}),dt("div",{className:"flex items-center gap-4 pt-4",children:[dt(nn,{href:"/docs/getting-started/tools/vscode",className:"btn-primary",children:["Next: VS Code Extension ",re(zs,{size:16})]}),re(nn,{href:"/docs/getting-started/tools",className:"btn-ghost",children:"Back to Tools"})]})]})}import Ci from"@contractspec/lib.ui-link";import{ChevronRight as qs}from"lucide-react";import{jsx as ue,jsxs as St}from"react/jsx-runtime";function Vs(){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(qs,{size:16})]})]})]})}import{CodeBlock as xi}from"@contractspec/lib.design-system";import ji from"@contractspec/lib.ui-link";import{ChevronRight as Hs}from"lucide-react";import{jsx as Fe,jsxs as Ja}from"react/jsx-runtime";var Fs=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
770
770
  import { ListTransactions } from './list-transactions';
771
771
 
772
772
  export const TransactionHistory = defineDataView({
@@ -812,7 +812,7 @@ export const TransactionHistory = defineDataView({
812
812
  { key: 'notes', label: 'Notes', dataPath: 'notes' },
813
813
  ],
814
814
  },
815
- });`;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
+ });`;function Ks(){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';
816
816
 
817
817
  export const ListTransactions = defineQuery({
818
818
  meta: {
@@ -825,7 +825,7 @@ export const ListTransactions = defineQuery({
825
825
  output: /* array of transactions */,
826
826
  },
827
827
  policy: { auth: 'user' },
828
- });`})]}),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
+ });`})]}),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:Fs}),Ja("p",{className:"text-muted-foreground text-sm",children:["The live version of this pattern is available in the canonical"," ",Fe(ji,{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';
829
829
 
830
830
  import { DataViewRenderer } from '@contractspec/lib.design-system';
831
831
  import { TransactionHistory } from '@/lib/specs/billing/transaction-history.data-view';
@@ -850,7 +850,7 @@ export function TransactionsPage() {
850
850
  />
851
851
  </div>
852
852
  );
853
- }`})]}),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
+ }`})]}),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(ji,{href:"/docs/libraries/data-views",className:"btn-primary",children:["DataView API Reference ",Fe(Hs,{size:16})]}),Fe(ji,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Next: Workflows"})]})]})}import{CodeBlock as Qs,InstallCommand as Ys}from"@contractspec/lib.design-system";import er from"@contractspec/lib.ui-link";import{ChevronRight as cn,Code2 as Js,Cpu as Zs,Layers as Xs,Terminal as $s}from"lucide-react";import{jsx as pt,jsxs as Ta}from"react/jsx-runtime";function ab(){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:$s,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:Js,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:Xs,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:Zs,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(er,{href:t.href,className:"btn-ghost inline-flex items-center gap-1 text-sm",children:["Learn more ",pt(cn,{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(Ys,{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(er,{href:"/docs/getting-started/tools/cli",className:"btn-primary",children:["Get Started with CLI ",pt(cn,{size:16})]}),pt(er,{href:"/docs/getting-started/tools/vscode",className:"btn-ghost",children:"VS Code Extension"})]})]})}import{CodeBlock as Ii}from"@contractspec/lib.design-system";import xs from"@contractspec/lib.ui-link";import{ChevronRight as js}from"lucide-react";import{jsx as we,jsxs as da}from"react/jsx-runtime";function ed(){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';
854
854
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
855
855
 
856
856
  const CapturePaymentInput = new SchemaModel({
@@ -944,16 +944,16 @@ const handler = makeNextAppHandler(registry, async (req) => {
944
944
  return { actor: 'user', userId: session.userId, tenantId: session.tenantId };
945
945
  });
946
946
 
947
- 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\u2014only 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
948
- # 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
947
+ 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\u2014only 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(xs,{href:"/docs/getting-started/dataviews",className:"btn-primary",children:["Next: Display Data with DataViews ",we(js,{size:16})]})})]})]})}import{CodeBlock as ln,InstallCommand as tr}from"@contractspec/lib.design-system";import td from"@contractspec/lib.ui-link";import{ChevronRight as ad}from"lucide-react";import{jsx as Ke,jsxs as qa}from"react/jsx-runtime";function od(){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(tr,{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(tr,{package:"@contractspec/lib.contracts-spec"})]}),qa("div",{className:"space-y-3",children:[Ke("h2",{className:"font-bold text-2xl",children:"For database models"}),Ke(tr,{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(ln,{language:"bash",filename:"installation-init",code:`bunx contractspec init
948
+ # 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(ln,{language:"bash",filename:"installation-prisma",code:`bunx prisma init
949
949
  # Edit prisma/schema.prisma with your models
950
950
  bunx prisma generate
951
- 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
+ bunx prisma migrate dev --name init`})]}),Ke("div",{className:"flex items-center gap-4 pt-4",children:qa(td,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: First Operation ",Ke(ad,{size:16})]})})]})]})}import{CodeBlock as Pi,InstallCommand as id}from"@contractspec/lib.design-system";import ar from"@contractspec/lib.ui-link";import{ChevronRight as rd}from"lucide-react";import{jsx as Zt,jsxs as Za}from"react/jsx-runtime";function nd(){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(id,{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
952
952
  # optional focused track
953
953
  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
954
- 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
+ contractspec validate`})]})]}),Za("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[Za(ar,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: Hello World ",Zt(rd,{size:16})]}),Zt(ar,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),Zt(ar,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"})]})]})}import{CodeBlock as cd}from"@contractspec/lib.design-system";import or from"@contractspec/lib.ui-link";import{ChevronRight as ld}from"lucide-react";import{jsx as $e,jsxs as Lt}from"react/jsx-runtime";function sd(){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(cd,{language:"bash",filename:"troubleshooting-diagnostics",code:`contractspec --version
955
955
  contractspec list
956
- 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
+ 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(or,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),$e(or,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"}),Lt(or,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",$e(ld,{size:16})]})]})]})}import{CodeBlock as dd}from"@contractspec/lib.design-system";import sn from"@contractspec/lib.ui-link";import{ChevronRight as pd,ExternalLink as md}from"lucide-react";import{jsx as u,jsxs as Z}from"react/jsx-runtime";function Ab(){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(md,{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(dd,{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(sn,{href:"/docs/getting-started/tools/cli",className:"btn-ghost",children:"Back: CLI"}),Z(sn,{href:"/docs/specs",className:"btn-primary",children:["Next: Core Concepts ",u(pd,{size:16})]})]})]})}import{registerDocBlocks as ud}from"@contractspec/lib.contracts-spec/docs";var gd=[{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
957
957
 
958
958
  Get ContractSpec running quickly and generate your first contract-backed code.
959
959
 
@@ -1052,9 +1052,9 @@ ContractSpec supports modern TypeScript stacks with spec-first workflows.
1052
1052
 
1053
1053
  - PostgreSQL via Prisma
1054
1054
  - Bring your own adapter for other databases
1055
- `}];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
+ `}];ud(gd);import{CodeBlock as Ti}from"@contractspec/lib.design-system";import dn from"@contractspec/lib.ui-link";import{ChevronRight as hd}from"lucide-react";import{jsx as Re,jsxs as Aa}from"react/jsx-runtime";function fd(){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
1056
1056
  bun run build
1057
- 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
+ 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(dn,{href:"/docs/guides",className:"btn-primary",children:["Back to guides ",Re(hd,{size:16})]}),Re(dn,{href:"/docs",className:"btn-ghost",children:"Docs home"})]})]})}import{CodeBlock as $o}from"@contractspec/lib.design-system";import pn from"@contractspec/lib.ui-link";import{ChevronRight as yd}from"lucide-react";import{jsx as V,jsxs as pa}from"react/jsx-runtime";var vd=[".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 bd(){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:`{
1058
1058
  "connect": {
1059
1059
  "enabled": true,
1060
1060
  "storage": {
@@ -1116,12 +1116,12 @@ printf '{"objective":"Document the control-plane contract surface","commands":["
1116
1116
  contractspec connect verify --task docs-connect --tool acp.fs.access --stdin --json
1117
1117
 
1118
1118
  printf 'bun run typecheck' | \\
1119
- 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
+ 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:vd.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
1120
1120
  contractspec connect replay <decisionId> --json
1121
1121
  contractspec connect eval <decisionId> --registry ./harness-registry.ts --scenario connect.safe-refactor --json
1122
1122
 
1123
1123
  # Optional when Studio review-bridge mode is enabled
1124
- 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
+ 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(pn,{href:"/docs/specs/connect",className:"btn-primary",children:["Back to Connect spec ",V(yd,{size:16})]}),V(pn,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})}import{CodeBlock as ci}from"@contractspec/lib.design-system";import mn from"@contractspec/lib.ui-link";import{ChevronRight as Nd,Globe as wd,Layers as kd,Shield as Sd,Zap as Cd}from"lucide-react";import{jsx as r,jsxs as H}from"react/jsx-runtime";var Id=[{name:"Operations",factory:"defineCommand / defineQuery",description:"API endpoints with input/output schemas, validation, and policy.",icon:Cd,color:"text-blue-400"},{name:"Events",factory:"defineEvent",description:"Domain events with typed payloads and PII handling.",icon:kd,color:"text-green-400"},{name:"Capabilities",factory:"defineCapability",description:"Feature groupings that link operations, events, and UIs.",icon:Sd,color:"text-purple-400"},{name:"Presentations",factory:"definePresentation",description:"UI specifications for rendering data and handling interactions.",icon:wd,color:"text-orange-400"}];function Pd(){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:Id.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";
1125
1125
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1126
1126
 
1127
1127
  // Command: Mutates state (creates a user)
@@ -1323,9 +1323,9 @@ installOp(operationRegistry, GetUserQuery, async (input) => {
1323
1323
 
1324
1324
  // Register events and capabilities
1325
1325
  eventRegistry.register(UserCreatedEvent);
1326
- 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
+ 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(mn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next: Add your first endpoint ",r(Nd,{size:16})]}),r(mn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as ir}from"@contractspec/lib.design-system";import un from"@contractspec/lib.ui-link";import{ChevronRight as Td}from"lucide-react";import{jsx as Qe,jsxs as Xt}from"react/jsx-runtime";function Ad(){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(ir,{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(ir,{language:"bash",filename:"docs-generate",code:`bun docs:generate
1327
1327
  # versioned output
1328
- 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
+ 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(ir,{language:"tsx",filename:"docs-reference-route",code:`import { notFound } from "next/navigation";
1329
1329
  import {
1330
1330
  DocsReferenceIndexPage,
1331
1331
  DocsReferencePage,
@@ -1343,7 +1343,7 @@ export default async function Page({ params }: { params: { slug?: string[] } })
1343
1343
  const doc = await getGeneratedDocById(slug);
1344
1344
  if (!doc) notFound();
1345
1345
  return <DocsReferencePage entry={doc.entry} content={doc.content} />;
1346
- }`}),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
+ }`}),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(un,{href:"/docs/guides/ci-contract-diff-gating",className:"btn-primary",children:["Next: CI gating ",Qe(Td,{size:16})]}),Qe(un,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as rr}from"@contractspec/lib.design-system";import gn from"@contractspec/lib.ui-link";import{ChevronRight as Rd}from"lucide-react";import{jsx as fe,jsxs as Ra}from"react/jsx-runtime";function Ld(){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(rr,{language:"typescript",filename:"src/bundles/support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
1347
1347
 
1348
1348
  export const SupportWorkbenchBundle = defineModuleBundle({
1349
1349
  meta: {
@@ -1385,7 +1385,7 @@ export const SupportWorkbenchBundle = defineModuleBundle({
1385
1385
  },
1386
1386
  },
1387
1387
  },
1388
- });`}),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
+ });`}),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(rr,{language:"typescript",filename:"src/runtime/resolve-support-workbench.ts",code:`import { resolveBundle } from "@contractspec/lib.surface-runtime/runtime/resolve-bundle";
1389
1389
 
1390
1390
  export const supportWorkbenchPlan = await resolveBundle(
1391
1391
  SupportWorkbenchBundle,
@@ -1409,7 +1409,7 @@ export const supportWorkbenchPlan = await resolveBundle(
1409
1409
  },
1410
1410
  capabilities: ["tickets.read", "tickets.update"],
1411
1411
  }
1412
- );`}),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
+ );`}),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(rr,{language:"tsx",filename:"src/app/support/SurfaceHost.tsx",code:`import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
1413
1413
 
1414
1414
  export function SurfaceHost() {
1415
1415
  return (
@@ -1417,10 +1417,10 @@ export function SurfaceHost() {
1417
1417
  <BundleRenderer assistantSlotId="assistant" />
1418
1418
  </BundleProvider>
1419
1419
  );
1420
- }`}),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
+ }`}),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(gn,{href:"/docs/specs/module-bundles",className:"btn-primary",children:["Back to module bundles ",fe(Rd,{size:16})]}),fe(gn,{href:"/docs/specs/overlays",className:"btn-ghost",children:"Next: overlays"})]})]})}import{CodeBlock as Ai}from"@contractspec/lib.design-system";import hn from"@contractspec/lib.ui-link";import{ChevronRight as Ed}from"lucide-react";import{jsx as Le,jsxs as ma}from"react/jsx-runtime";function Dd(){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
1421
1421
 
1422
1422
  # openapi export against your registry module
1423
- 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) {
1423
+ 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(hn,{href:"/docs/guides/docs-generation-pipeline",className:"btn-primary",children:["Next: Docs pipeline ",Le(Ed,{size:16})]}),Le(hn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as zo}from"@contractspec/lib.design-system";import fn from"@contractspec/lib.ui-link";import{ChevronRight as Od}from"lucide-react";import{jsx as D,jsxs as Et}from"react/jsx-runtime";var Md=["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"],Bd=["local runtime trust and lease details","channel-action posture for mobile/operator follow-up","comparison posture and export readiness from the shared snapshot"];function Ud(){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) {
1424
1424
  const response = await fetch(
1425
1425
  \`/api/operate/builder/queries/builder.workspace.snapshot?workspaceId=\${encodeURIComponent(workspaceId)}\`,
1426
1426
  { cache: "no-store" }
@@ -1489,7 +1489,7 @@ async function runAction(commandKey: string, payload?: Record<string, unknown>)
1489
1489
  preset: "managed_mvp",
1490
1490
  includeLocalHelperProvider: true,
1491
1491
  },
1492
- });`})]}),Et("div",{className:"card-subtle space-y-3 p-6",children:[D("h3",{className:"font-semibold text-lg",children:"Common command keys"}),D("ul",{className:"space-y-2 text-muted-foreground text-sm",children:Rd.map((e)=>D("li",{children:D("code",{children:e})},e))})]}),Et("div",{className:"card-subtle space-y-3 p-6",children:[D("h3",{className:"font-semibold text-lg",children:"Snapshot-backed operator details"}),D("ul",{className:"space-y-2 text-muted-foreground text-sm",children:Ld.map((e)=>D("li",{children:e},e))})]}),Et("div",{className:"space-y-3",children:[D("h2",{className:"font-bold text-2xl",children:"5) Keep runtime mode explicit"}),D("p",{className:"text-muted-foreground text-sm",children:"Preview and export flows are runtime-mode aware. The host chooses between `managed`, `local`, and `hybrid` and passes that choice into preview or export commands instead of hiding it behind provider selection heuristics."}),D(zo,{language:"typescript",filename:"runtime-mode",code:`const [selectedExportRuntimeMode, setSelectedExportRuntimeMode] =
1492
+ });`})]}),Et("div",{className:"card-subtle space-y-3 p-6",children:[D("h3",{className:"font-semibold text-lg",children:"Common command keys"}),D("ul",{className:"space-y-2 text-muted-foreground text-sm",children:Md.map((e)=>D("li",{children:D("code",{children:e})},e))})]}),Et("div",{className:"card-subtle space-y-3 p-6",children:[D("h3",{className:"font-semibold text-lg",children:"Snapshot-backed operator details"}),D("ul",{className:"space-y-2 text-muted-foreground text-sm",children:Bd.map((e)=>D("li",{children:e},e))})]}),Et("div",{className:"space-y-3",children:[D("h2",{className:"font-bold text-2xl",children:"5) Keep runtime mode explicit"}),D("p",{className:"text-muted-foreground text-sm",children:"Preview and export flows are runtime-mode aware. The host chooses between `managed`, `local`, and `hybrid` and passes that choice into preview or export commands instead of hiding it behind provider selection heuristics."}),D(zo,{language:"typescript",filename:"runtime-mode",code:`const [selectedExportRuntimeMode, setSelectedExportRuntimeMode] =
1493
1493
  React.useState(resolveBuilderExportRuntimeMode(initialSnapshot));
1494
1494
 
1495
1495
  await executeBuilderCommand({
@@ -1503,14 +1503,14 @@ await executeBuilderCommand({
1503
1503
  cardId: string
1504
1504
  ) {
1505
1505
  return \`/operate/builder/workspaces/\${encodeURIComponent(workspaceId)}/mobile-review/\${encodeURIComponent(cardId)}\`;
1506
- }`}),D("p",{className:"text-muted-foreground text-sm",children:"Expected output: the same Builder workspace state stays visible from desktop workbench and mobile review surfaces."})]}),Et("div",{className:"space-y-3",children:[D("h2",{className:"font-bold text-2xl",children:"7) Keep Connect adjacent, not embedded"}),D("p",{className:"text-muted-foreground text-sm",children:"Builder owns the authoring control plane. When Builder delegates into coding repositories, enable Connect in those target workspaces for context packs, mutation verification, replay, and review packets, but do not replace Builder contracts with Connect artifacts."}),D(zo,{language:"bash",filename:"connect-init.sh",code:"contractspec connect init --scope workspace"})]})]}),Et("div",{className:"flex items-center gap-4 pt-4",children:[Et(un,{href:"/docs/specs/builder-control-plane",className:"btn-primary",children:["Back to Builder control plane ",D(Ad,{size:16})]}),D(un,{href:"/docs/studio",className:"btn-ghost",children:"Studio overview"})]})]})}import{CodeBlock as Go}from"@contractspec/lib.design-system";import gn from"@contractspec/lib.ui-link";import{AlertCircle as Dd,ChevronRight as Od,FileCode as Md,Scan as ir,Settings as Bd}from"lucide-react";import{jsx as i,jsxs as g}from"react/jsx-runtime";var Ud=[{name:"NestJS",flag:"nestjs",description:"Controllers, decorators, DTOs"},{name:"Express",flag:"express",description:"Router methods, middleware"},{name:"Fastify",flag:"fastify",description:"Route definitions, schemas"},{name:"Hono",flag:"hono",description:"Route handlers, validators"},{name:"Elysia",flag:"elysia",description:"Type-safe routes, schemas"},{name:"tRPC",flag:"trpc",description:"Procedure definitions"},{name:"Next.js",flag:"next-api",description:"API routes (app/api, pages/api)"}];function Wd(){return g("div",{className:"space-y-8",children:[g("div",{className:"space-y-3",children:[i("h1",{className:"font-bold text-4xl",children:"Import Existing Codebases"}),i("p",{className:"text-lg text-muted-foreground",children:"Convert your existing API endpoints into ContractSpec contracts. Auto-detect frameworks, extract schemas, and generate explicit contract definitions from your code."})]}),g("div",{className:"card-subtle space-y-4 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"What you'll learn"}),g("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[i("li",{children:"How to import existing API endpoints as ContractSpec contracts."}),i("li",{children:"Framework-specific patterns and auto-detection."}),i("li",{children:"Customizing imports with scopes, dry-run, and output options."}),i("li",{children:"Registering imported contracts and adding handlers."})]})]}),g("div",{className:"space-y-6",children:[g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"Why import existing code?"}),i("p",{className:"text-muted-foreground text-sm",children:"Instead of writing contracts from scratch, the import command extracts endpoint patterns from your existing codebase. This gives you:"}),g("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground text-sm",children:[i("li",{children:"Instant spec coverage for existing APIs"}),i("li",{children:"Type-safe schemas derived from your existing types"}),i("li",{children:"A foundation to iterate and refine contracts"}),i("li",{children:"Gradual adoption without rewriting code"})]})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"Supported frameworks"}),i("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:Ud.map((e)=>g("div",{className:"flex items-start gap-3 rounded-lg border border-white/10 p-4",children:[i(Md,{className:"text-violet-400",size:18}),g("div",{className:"space-y-1",children:[i("h3",{className:"font-semibold",children:e.name}),i("p",{className:"text-muted-foreground text-xs",children:e.description}),g("code",{className:"text-violet-400 text-xs",children:["--framework ",e.flag]})]})]},e.flag))})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"1) Quick start"}),i("p",{className:"text-muted-foreground text-sm",children:"Run the import command to auto-detect your framework and extract endpoints:"}),i(Go,{language:"bash",filename:"import-quickstart",code:`# Auto-detect framework and import all endpoints
1506
+ }`}),D("p",{className:"text-muted-foreground text-sm",children:"Expected output: the same Builder workspace state stays visible from desktop workbench and mobile review surfaces."})]}),Et("div",{className:"space-y-3",children:[D("h2",{className:"font-bold text-2xl",children:"7) Keep Connect adjacent, not embedded"}),D("p",{className:"text-muted-foreground text-sm",children:"Builder owns the authoring control plane. When Builder delegates into coding repositories, enable Connect in those target workspaces for context packs, mutation verification, replay, and review packets, but do not replace Builder contracts with Connect artifacts."}),D(zo,{language:"bash",filename:"connect-init.sh",code:"contractspec connect init --scope workspace"})]})]}),Et("div",{className:"flex items-center gap-4 pt-4",children:[Et(fn,{href:"/docs/specs/builder-control-plane",className:"btn-primary",children:["Back to Builder control plane ",D(Od,{size:16})]}),D(fn,{href:"/docs/studio",className:"btn-ghost",children:"Studio overview"})]})]})}import{CodeBlock as Go}from"@contractspec/lib.design-system";import yn from"@contractspec/lib.ui-link";import{AlertCircle as Wd,ChevronRight as _d,FileCode as zd,Scan as nr,Settings as Gd}from"lucide-react";import{jsx as i,jsxs as g}from"react/jsx-runtime";var qd=[{name:"NestJS",flag:"nestjs",description:"Controllers, decorators, DTOs"},{name:"Express",flag:"express",description:"Router methods, middleware"},{name:"Fastify",flag:"fastify",description:"Route definitions, schemas"},{name:"Hono",flag:"hono",description:"Route handlers, validators"},{name:"Elysia",flag:"elysia",description:"Type-safe routes, schemas"},{name:"tRPC",flag:"trpc",description:"Procedure definitions"},{name:"Next.js",flag:"next-api",description:"API routes (app/api, pages/api)"}];function Vd(){return g("div",{className:"space-y-8",children:[g("div",{className:"space-y-3",children:[i("h1",{className:"font-bold text-4xl",children:"Import Existing Codebases"}),i("p",{className:"text-lg text-muted-foreground",children:"Convert your existing API endpoints into ContractSpec contracts. Auto-detect frameworks, extract schemas, and generate explicit contract definitions from your code."})]}),g("div",{className:"card-subtle space-y-4 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"What you'll learn"}),g("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[i("li",{children:"How to import existing API endpoints as ContractSpec contracts."}),i("li",{children:"Framework-specific patterns and auto-detection."}),i("li",{children:"Customizing imports with scopes, dry-run, and output options."}),i("li",{children:"Registering imported contracts and adding handlers."})]})]}),g("div",{className:"space-y-6",children:[g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"Why import existing code?"}),i("p",{className:"text-muted-foreground text-sm",children:"Instead of writing contracts from scratch, the import command extracts endpoint patterns from your existing codebase. This gives you:"}),g("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground text-sm",children:[i("li",{children:"Instant spec coverage for existing APIs"}),i("li",{children:"Type-safe schemas derived from your existing types"}),i("li",{children:"A foundation to iterate and refine contracts"}),i("li",{children:"Gradual adoption without rewriting code"})]})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"Supported frameworks"}),i("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:qd.map((e)=>g("div",{className:"flex items-start gap-3 rounded-lg border border-white/10 p-4",children:[i(zd,{className:"text-violet-400",size:18}),g("div",{className:"space-y-1",children:[i("h3",{className:"font-semibold",children:e.name}),i("p",{className:"text-muted-foreground text-xs",children:e.description}),g("code",{className:"text-violet-400 text-xs",children:["--framework ",e.flag]})]})]},e.flag))})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"1) Quick start"}),i("p",{className:"text-muted-foreground text-sm",children:"Run the import command to auto-detect your framework and extract endpoints:"}),i(Go,{language:"bash",filename:"import-quickstart",code:`# Auto-detect framework and import all endpoints
1507
1507
  contractspec import ./src
1508
1508
 
1509
1509
  # Preview what would be imported (dry-run)
1510
1510
  contractspec import ./src --dry-run
1511
1511
 
1512
1512
  # Force a specific framework
1513
- contractspec import ./src --framework nestjs`}),i("p",{className:"text-muted-foreground text-sm",children:"Expected output: A summary of endpoints found, schemas extracted, and files generated."})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"2) Framework-specific patterns"}),i("p",{className:"text-muted-foreground text-sm",children:"The import command recognizes these patterns in each framework:"})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(ir,{size:18,className:"text-blue-400"}),"NestJS"]}),i(Go,{language:"typescript",filename:"src/users/users.controller.ts (before)",code:`@Controller('users')
1513
+ contractspec import ./src --framework nestjs`}),i("p",{className:"text-muted-foreground text-sm",children:"Expected output: A summary of endpoints found, schemas extracted, and files generated."})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"2) Framework-specific patterns"}),i("p",{className:"text-muted-foreground text-sm",children:"The import command recognizes these patterns in each framework:"})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(nr,{size:18,className:"text-blue-400"}),"NestJS"]}),i(Go,{language:"typescript",filename:"src/users/users.controller.ts (before)",code:`@Controller('users')
1514
1514
  export class UsersController {
1515
1515
  @Get(':id')
1516
1516
  async getUser(@Param('id') id: string): Promise<UserDto> {
@@ -1522,7 +1522,7 @@ export class UsersController {
1522
1522
  async createUser(@Body() dto: CreateUserDto): Promise<UserDto> {
1523
1523
  return this.usersService.create(dto);
1524
1524
  }
1525
- }`}),g("p",{className:"text-muted-foreground text-sm",children:["Detected: ",i("code",{children:"@Controller"}),", ",i("code",{children:"@Get"}),","," ",i("code",{children:"@Post"}),", ",i("code",{children:"@Body"}),", ",i("code",{children:"@Param"}),","," ",i("code",{children:"@UseGuards"})," decorators."]})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(ir,{size:18,className:"text-green-400"}),"Express"]}),i(Go,{language:"typescript",filename:"src/routes/users.ts (before)",code:`const router = express.Router();
1525
+ }`}),g("p",{className:"text-muted-foreground text-sm",children:["Detected: ",i("code",{children:"@Controller"}),", ",i("code",{children:"@Get"}),","," ",i("code",{children:"@Post"}),", ",i("code",{children:"@Body"}),", ",i("code",{children:"@Param"}),","," ",i("code",{children:"@UseGuards"})," decorators."]})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(nr,{size:18,className:"text-green-400"}),"Express"]}),i(Go,{language:"typescript",filename:"src/routes/users.ts (before)",code:`const router = express.Router();
1526
1526
 
1527
1527
  router.get('/users/:id', async (req, res) => {
1528
1528
  const user = await getUserById(req.params.id);
@@ -1532,7 +1532,7 @@ router.get('/users/:id', async (req, res) => {
1532
1532
  router.post('/users', validateBody(CreateUserSchema), async (req, res) => {
1533
1533
  const user = await createUser(req.body);
1534
1534
  res.status(201).json(user);
1535
- });`}),g("p",{className:"text-muted-foreground text-sm",children:["Detected: ",i("code",{children:"router.get"}),", ",i("code",{children:"router.post"}),", validation middleware, Zod schemas."]})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(ir,{size:18,className:"text-purple-400"}),"Next.js API Routes"]}),i(Go,{language:"typescript",filename:"app/api/users/[id]/route.ts (before)",code:`export async function GET(
1535
+ });`}),g("p",{className:"text-muted-foreground text-sm",children:["Detected: ",i("code",{children:"router.get"}),", ",i("code",{children:"router.post"}),", validation middleware, Zod schemas."]})]}),g("div",{className:"space-y-3",children:[g("h3",{className:"flex items-center gap-2 font-semibold text-xl",children:[i(nr,{size:18,className:"text-purple-400"}),"Next.js API Routes"]}),i(Go,{language:"typescript",filename:"app/api/users/[id]/route.ts (before)",code:`export async function GET(
1536
1536
  request: Request,
1537
1537
  { params }: { params: { id: string } }
1538
1538
  ) {
@@ -1604,7 +1604,7 @@ export const CreateUserCommand = defineCommand({
1604
1604
  transport: {
1605
1605
  rest: { method: "POST", path: "/users" },
1606
1606
  },
1607
- });`})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"4) Customizing imports"}),g("div",{className:"flex items-center gap-2",children:[i(Bd,{size:18,className:"text-violet-400"}),i("h3",{className:"font-semibold text-lg",children:"Available options"})]}),i("div",{className:"overflow-x-auto",children:g("table",{className:"w-full text-sm",children:[i("thead",{children:g("tr",{className:"border-white/10 border-b",children:[i("th",{className:"py-2 pr-4 text-left",children:"Option"}),i("th",{className:"py-2 pr-4 text-left",children:"Description"}),i("th",{className:"py-2 text-left",children:"Example"})]})}),g("tbody",{className:"text-muted-foreground",children:[g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--scope"})}),i("td",{className:"py-2 pr-4",children:"Limit to specific directories"}),i("td",{className:"py-2",children:i("code",{children:"--scope src/users src/auth"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--framework"})}),i("td",{className:"py-2 pr-4",children:"Force a specific framework"}),i("td",{className:"py-2",children:i("code",{children:"--framework express"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--output"})}),i("td",{className:"py-2 pr-4",children:"Output directory"}),i("td",{className:"py-2",children:i("code",{children:"--output ./contracts"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--dry-run"})}),i("td",{className:"py-2 pr-4",children:"Preview without writing files"}),i("td",{className:"py-2",children:i("code",{children:"--dry-run"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--analyze"})}),i("td",{className:"py-2 pr-4",children:"Analysis only, no code generation"}),i("td",{className:"py-2",children:i("code",{children:"--analyze"})})]}),g("tr",{children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--json"})}),i("td",{className:"py-2 pr-4",children:"Output as JSON for scripting"}),i("td",{className:"py-2",children:i("code",{children:"--json"})})]})]})]})}),i(Go,{language:"bash",filename:"import-options",code:`# Import only specific modules
1607
+ });`})]}),g("div",{className:"space-y-3",children:[i("h2",{className:"font-bold text-2xl",children:"4) Customizing imports"}),g("div",{className:"flex items-center gap-2",children:[i(Gd,{size:18,className:"text-violet-400"}),i("h3",{className:"font-semibold text-lg",children:"Available options"})]}),i("div",{className:"overflow-x-auto",children:g("table",{className:"w-full text-sm",children:[i("thead",{children:g("tr",{className:"border-white/10 border-b",children:[i("th",{className:"py-2 pr-4 text-left",children:"Option"}),i("th",{className:"py-2 pr-4 text-left",children:"Description"}),i("th",{className:"py-2 text-left",children:"Example"})]})}),g("tbody",{className:"text-muted-foreground",children:[g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--scope"})}),i("td",{className:"py-2 pr-4",children:"Limit to specific directories"}),i("td",{className:"py-2",children:i("code",{children:"--scope src/users src/auth"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--framework"})}),i("td",{className:"py-2 pr-4",children:"Force a specific framework"}),i("td",{className:"py-2",children:i("code",{children:"--framework express"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--output"})}),i("td",{className:"py-2 pr-4",children:"Output directory"}),i("td",{className:"py-2",children:i("code",{children:"--output ./contracts"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--dry-run"})}),i("td",{className:"py-2 pr-4",children:"Preview without writing files"}),i("td",{className:"py-2",children:i("code",{children:"--dry-run"})})]}),g("tr",{className:"border-white/5 border-b",children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--analyze"})}),i("td",{className:"py-2 pr-4",children:"Analysis only, no code generation"}),i("td",{className:"py-2",children:i("code",{children:"--analyze"})})]}),g("tr",{children:[i("td",{className:"py-2 pr-4",children:i("code",{children:"--json"})}),i("td",{className:"py-2 pr-4",children:"Output as JSON for scripting"}),i("td",{className:"py-2",children:i("code",{children:"--json"})})]})]})]})}),i(Go,{language:"bash",filename:"import-options",code:`# Import only specific modules
1608
1608
  contractspec import ./src --scope src/users src/orders
1609
1609
 
1610
1610
  # Preview with analysis
@@ -1634,7 +1634,7 @@ installOp(registry, GetUserQuery, async (input) => {
1634
1634
  installOp(registry, CreateUserCommand, async (input) => {
1635
1635
  const user = await db.user.create({ data: input });
1636
1636
  return { id: user.id };
1637
- });`})]}),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"})," \u2014 Check the TODO placeholders and fill in descriptions, owners, and tags."]}),g("li",{children:[i("strong",{children:"Refine schemas"})," \u2014 Add proper types, validation rules, and error definitions."]}),g("li",{children:[i("strong",{children:"Run validation"})," \u2014"," ",i("code",{children:"contractspec validate"})," to ensure contracts are valid."]}),g("li",{children:[i("strong",{children:"Register and wire handlers"})," \u2014 Connect contracts to your existing business logic."]}),g("li",{children:[i("strong",{children:"Iterate"})," \u2014 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
+ });`})]}),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"})," \u2014 Check the TODO placeholders and fill in descriptions, owners, and tags."]}),g("li",{children:[i("strong",{children:"Refine schemas"})," \u2014 Add proper types, validation rules, and error definitions."]}),g("li",{children:[i("strong",{children:"Run validation"})," \u2014"," ",i("code",{children:"contractspec validate"})," to ensure contracts are valid."]}),g("li",{children:[i("strong",{children:"Register and wire handlers"})," \u2014 Connect contracts to your existing business logic."]}),g("li",{children:[i("strong",{children:"Iterate"})," \u2014 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(Wd,{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(yn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",i(_d,{size:16})]}),i(yn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as xo}from"@contractspec/lib.design-system";import vn from"@contractspec/lib.ui-link";import{ChevronRight as Hd}from"lucide-react";import{jsx as pe,jsxs as xe}from"react/jsx-runtime";function Fd(){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
1638
1638
  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";
1639
1639
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1640
1640
 
@@ -1689,7 +1689,7 @@ export { handler as GET, handler as POST };`}),xe("p",{className:"text-muted-for
1689
1689
  contractspec examples show lifecycle-dashboard
1690
1690
 
1691
1691
  # Validate all example manifests in this repo
1692
- 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
+ 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(vn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Next: Spec validation + typing ",pe(Hd,{size:16})]}),pe(vn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Ri}from"@contractspec/lib.design-system";import bn from"@contractspec/lib.ui-link";import{ChevronRight as Kd}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 Yd(){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"
1693
1693
  slug: contract-dx-first-slice
1694
1694
  summary: Improve app-config, theme, and feature authoring with explicit validation and shared setup alignment.
1695
1695
  isBreaking: false
@@ -1703,7 +1703,7 @@ validation:
1703
1703
  - "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"
1704
1704
 
1705
1705
  # Or revise an existing capsule with the guided flow
1706
- 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
+ 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(bn,{href:"/docs/guides/connect-in-a-repo",className:"btn-primary",children:["Connect guide ",ke(Kd,{size:16})]}),ke(bn,{href:"/changelog",className:"btn-ghost",children:"Website changelog"})]})]})}import{CodeBlock as Li}from"@contractspec/lib.design-system";import Nn from"@contractspec/lib.ui-link";import{ChevronRight as Jd}from"lucide-react";import{jsx as Ye,jsxs as Na}from"react/jsx-runtime";function Zd(){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";
1707
1707
  import { SchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
1708
1708
 
1709
1709
  const ContactInput = new SchemaModel({
@@ -1765,11 +1765,11 @@ export const ContactCreateCommand = defineCommand({
1765
1765
  cd packages/examples/crm-pipeline
1766
1766
  bun install
1767
1767
  bun run build
1768
- 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
+ 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(Nn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Next: Generate docs + clients ",Ye(Jd,{size:16})]}),Ye(Nn,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}import{CodeBlock as Xd}from"@contractspec/lib.design-system";import $d from"@contractspec/lib.ui-link";import{ArrowRight as xd,CheckCircle2 as jd,GitBranch as ep}from"lucide-react";import{jsx as Dt,jsxs as wa}from"react/jsx-runtime";var tp=[{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 ap(){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:tp.map((e)=>wa($d,{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(xd,{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(ep,{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(Xd,{language:"bash",filename:"guides-quickstart",code:`# list example systems
1769
1769
  contractspec examples list
1770
1770
 
1771
1771
  # validate the examples in this workspace
1772
- contractspec examples validate --repo-root .`})]})]})}import{registerDocBlocks as xd}from"@contractspec/lib.contracts-spec/docs";var jd=[{id:"docs.guides.index",title:"Guides",summary:"Hands-on guides for adopting ContractSpec in real workflows.",kind:"goal",visibility:"public",route:"/docs/guides",tags:["guides","adoption"],body:`# Guides
1772
+ contractspec examples validate --repo-root .`})]})]})}import{registerDocBlocks as op}from"@contractspec/lib.contracts-spec/docs";var ip=[{id:"docs.guides.index",title:"Guides",summary:"Hands-on guides for adopting ContractSpec in real workflows.",kind:"goal",visibility:"public",route:"/docs/guides",tags:["guides","adoption"],body:`# Guides
1773
1773
 
1774
1774
  Hands-on, runnable guides that map to real adoption scenarios. Each guide includes commands, expected output, and a CI-verified example package.`},{id:"docs.guides.nextjs-one-endpoint",title:"Next.js one endpoint",summary:"Add ContractSpec to an existing Next.js app with one endpoint.",kind:"usage",visibility:"public",route:"/docs/guides/nextjs-one-endpoint",tags:["guides","nextjs","operations"],body:`# Add ContractSpec to a Next.js app (one endpoint)
1775
1775
 
@@ -1815,7 +1815,7 @@ bun docs:generate -- --version v1.0.0
1815
1815
 
1816
1816
  Use the generated manifest and chunks under \`docs-index.manifest.json\` and \`docs-index.*.json\` to load the index at runtime.`},{id:"docs.guides.ci-contract-diff-gating",title:"CI gating for contract diffs",summary:"Gate changes with deterministic diffs and CI checks.",kind:"usage",visibility:"public",route:"/docs/guides/ci-contract-diff-gating",tags:["guides","ci","diff"],body:`# CI gating with deterministic diffs
1817
1817
 
1818
- Run ContractSpec CI checks to detect drift and breaking changes before merge.`}];xd(jd);import{jsx as li,jsxs as rr}from"react/jsx-runtime";function ep(){return rr("div",{className:"space-y-8",children:[rr("div",{className:"space-y-4",children:[li("h1",{className:"font-bold text-4xl",children:"Integration Circuit Breakers"}),li("p",{className:"text-lg text-muted-foreground",children:"External APIs are the most common source of instability. Wrap every integration call in a circuit breaker to protect your system."})]}),rr("div",{className:"space-y-4",children:[li("h2",{className:"font-bold text-2xl",children:"Pattern"}),li("p",{children:"Create a dedicated circuit breaker instance for each external service. This ensures that a failure in Stripe doesn't trigger the circuit breaker for Twilio."}),li("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`// integrations/stripe.ts
1818
+ Run ContractSpec CI checks to detect drift and breaking changes before merge.`}];op(ip);import{jsx as li,jsxs as cr}from"react/jsx-runtime";function rp(){return cr("div",{className:"space-y-8",children:[cr("div",{className:"space-y-4",children:[li("h1",{className:"font-bold text-4xl",children:"Integration Circuit Breakers"}),li("p",{className:"text-lg text-muted-foreground",children:"External APIs are the most common source of instability. Wrap every integration call in a circuit breaker to protect your system."})]}),cr("div",{className:"space-y-4",children:[li("h2",{className:"font-bold text-2xl",children:"Pattern"}),li("p",{children:"Create a dedicated circuit breaker instance for each external service. This ensures that a failure in Stripe doesn't trigger the circuit breaker for Twilio."}),li("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`// integrations/stripe.ts
1819
1819
  import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
1820
1820
 
1821
1821
  const stripeBreaker = new CircuitBreaker({
@@ -1825,7 +1825,7 @@ const stripeBreaker = new CircuitBreaker({
1825
1825
 
1826
1826
  export async function createCharge(amount: number) {
1827
1827
  return stripeBreaker.execute(() => stripe.charges.create({ amount }));
1828
- }`})]})]})}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
+ }`})]})]})}import wn from"@contractspec/lib.ui-link";import{ChevronRight as np}from"lucide-react";import{jsx as $t,jsxs as Co}from"react/jsx-runtime";function cp(){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
1829
1829
  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
1830
1830
  provider:
1831
1831
  type: elevenlabs
@@ -1845,7 +1845,7 @@ outputs:
1845
1845
  audioUrl:
1846
1846
  type: string
1847
1847
  audioData:
1848
- 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
+ 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(wn,{href:"/docs/integrations/mistral",className:"btn-ghost",children:"Previous: Mistral"}),Co(wn,{href:"/docs/integrations/qdrant",className:"btn-primary",children:["Next: Qdrant ",$t(np,{size:16})]})]})]})}import kn from"@contractspec/lib.ui-link";import{ChevronRight as lp}from"lucide-react";import{jsx as mt,jsxs as La}from"react/jsx-runtime";function sp(){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
1849
1849
  {
1850
1850
  "token": "ghp_...",
1851
1851
  "webhookSecret": "..."
@@ -1859,7 +1859,7 @@ outputs:
1859
1859
  }`})})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Webhook ingress"}),La("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[La("li",{children:["Inbound GitHub events are accepted on"," ",mt("code",{className:"rounded bg-background/50 px-2 py-1",children:"/webhooks/github/events"}),"."]}),La("li",{children:["Signatures are checked using"," ",mt("code",{className:"rounded bg-background/50 px-2 py-1",children:"x-hub-signature-256"})," ","and the configured webhook secret."]}),mt("li",{children:"Current normalization focuses on issue comment workflows and durable comment dispatch."})]})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Workspace mapping"}),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:`CHANNEL_WORKSPACE_MAP_GITHUB={"lssm-tech/contractspec":"workspace-acme"}
1860
1860
 
1861
1861
  # Optional dev fallback (off by default)
1862
- CHANNEL_ALLOW_UNMAPPED_WORKSPACE=0`})})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Best practices"}),La("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[mt("li",{children:"Use a least-privileged token scoped for comment operations."}),mt("li",{children:"Route repositories explicitly with workspace maps in multi-tenant environments."}),mt("li",{children:"Keep dispatch endpoints protected with token or bearer auth."})]})]}),La("div",{className:"flex items-center gap-4 pt-4",children:[mt(bn,{href:"/docs/integrations/slack",className:"btn-ghost",children:"Previous: Slack Messaging"}),La(bn,{href:"/docs/integrations/whatsapp-meta",className:"btn-primary",children:["Next: WhatsApp Meta ",mt(op,{size:16})]})]})]})}import Nn from"@contractspec/lib.ui-link";import{ChevronRight as rp}from"lucide-react";import{jsx as Ot,jsxs as Io}from"react/jsx-runtime";function np(){return Io("div",{className:"space-y-8",children:[Io("div",{className:"space-y-4",children:[Ot("h1",{className:"font-bold text-4xl",children:"Gmail API"}),Ot("p",{className:"text-muted-foreground",children:"The Gmail API integration allows you to read inbound emails, manage threads, and build email-based workflows. Perfect for support tickets, email parsing, and automated responses."})]}),Io("div",{className:"space-y-4",children:[Ot("h2",{className:"font-bold text-2xl",children:"Setup"}),Ot("p",{className:"text-muted-foreground",children:"Configure OAuth 2.0 credentials in Google Cloud Console:"}),Ot("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ot("pre",{children:`# .env
1862
+ CHANNEL_ALLOW_UNMAPPED_WORKSPACE=0`})})]}),La("div",{className:"space-y-4",children:[mt("h2",{className:"font-bold text-2xl",children:"Best practices"}),La("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[mt("li",{children:"Use a least-privileged token scoped for comment operations."}),mt("li",{children:"Route repositories explicitly with workspace maps in multi-tenant environments."}),mt("li",{children:"Keep dispatch endpoints protected with token or bearer auth."})]})]}),La("div",{className:"flex items-center gap-4 pt-4",children:[mt(kn,{href:"/docs/integrations/slack",className:"btn-ghost",children:"Previous: Slack Messaging"}),La(kn,{href:"/docs/integrations/whatsapp-meta",className:"btn-primary",children:["Next: WhatsApp Meta ",mt(lp,{size:16})]})]})]})}import Sn from"@contractspec/lib.ui-link";import{ChevronRight as dp}from"lucide-react";import{jsx as Ot,jsxs as Io}from"react/jsx-runtime";function pp(){return Io("div",{className:"space-y-8",children:[Io("div",{className:"space-y-4",children:[Ot("h1",{className:"font-bold text-4xl",children:"Gmail API"}),Ot("p",{className:"text-muted-foreground",children:"The Gmail API integration allows you to read inbound emails, manage threads, and build email-based workflows. Perfect for support tickets, email parsing, and automated responses."})]}),Io("div",{className:"space-y-4",children:[Ot("h2",{className:"font-bold text-2xl",children:"Setup"}),Ot("p",{className:"text-muted-foreground",children:"Configure OAuth 2.0 credentials in Google Cloud Console:"}),Ot("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ot("pre",{children:`# .env
1863
1863
  GOOGLE_CLIENT_ID=...
1864
1864
  GOOGLE_CLIENT_SECRET=...
1865
1865
  GOOGLE_REDIRECT_URI=https://your-app.com/auth/google/callback`})})]}),Io("div",{className:"space-y-4",children:[Ot("h2",{className:"font-bold text-2xl",children:"Reading emails"}),Ot("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ot("pre",{children:`capabilityId: gmail-list-messages
@@ -1883,7 +1883,7 @@ outputs:
1883
1883
  properties:
1884
1884
  id: string
1885
1885
  threadId: string
1886
- 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
+ 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(Sn,{href:"/docs/integrations/resend",className:"btn-ghost",children:"Previous: Resend"}),Io(Sn,{href:"/docs/integrations/google-calendar",className:"btn-primary",children:["Next: Google Calendar ",Ot(dp,{size:16})]})]})]})}import Cn from"@contractspec/lib.ui-link";import{ChevronRight as mp}from"lucide-react";import{jsx as Xa,jsxs as jo}from"react/jsx-runtime";function up(){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
1887
1887
  GOOGLE_CLIENT_ID=...
1888
1888
  GOOGLE_CLIENT_SECRET=...
1889
1889
  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
@@ -1910,7 +1910,7 @@ outputs:
1910
1910
  eventId:
1911
1911
  type: string
1912
1912
  htmlLink:
1913
- 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
+ type: string`})})]}),jo("div",{className:"flex items-center gap-4 pt-4",children:[Xa(Cn,{href:"/docs/integrations/gmail",className:"btn-ghost",children:"Previous: Gmail API"}),jo(Cn,{href:"/docs/integrations/openai",className:"btn-primary",children:["Next: OpenAI ",Xa(mp,{size:16})]})]})]})}import In from"@contractspec/lib.ui-link";import{jsx as je,jsxs as Ea}from"react/jsx-runtime";function gp(){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:`{
1914
1914
  "defaultTransport": "official-api",
1915
1915
  "strategyOrder": [
1916
1916
  "official-api",
@@ -1933,7 +1933,7 @@ outputs:
1933
1933
  "tokenExpiresAt": "2026-02-01T00:00:00.000Z",
1934
1934
  "mcpAccessToken": "...",
1935
1935
  "webhookSecret": "..."
1936
- }`})})]}),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
+ }`})})]}),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(In,{href:"/docs/integrations/whatsapp-twilio",className:"btn-ghost",children:"Previous: WhatsApp Twilio"}),je(In,{href:"/docs/integrations",className:"btn-primary",children:"Back to Integrations"})]})]})}import Pn from"@contractspec/lib.ui-link";import{ChevronRight as hp}from"lucide-react";import{jsx as Ee,jsxs as Va}from"react/jsx-runtime";function fp(){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
1937
1937
  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
1938
1938
  provider:
1939
1939
  type: mistral
@@ -1989,7 +1989,7 @@ outputs:
1989
1989
  segments:
1990
1990
  type: array
1991
1991
  language:
1992
- 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
+ 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(Pn,{href:"/docs/integrations/openai",className:"btn-ghost",children:"Previous: OpenAI"}),Va(Pn,{href:"/docs/integrations/elevenlabs",className:"btn-primary",children:["Next: ElevenLabs ",Ee(hp,{size:16})]})]})]})}import Tn from"@contractspec/lib.ui-link";import{ChevronRight as yp}from"lucide-react";import{jsx as We,jsxs as $a}from"react/jsx-runtime";function vp(){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
1993
1993
  OPENAI_API_KEY=sk-...
1994
1994
  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
1995
1995
  provider:
@@ -2048,7 +2048,7 @@ outputs:
2048
2048
  text:
2049
2049
  type: string
2050
2050
  language:
2051
- 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 \u2192 tenant connection \u2192 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
+ 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(Tn,{href:"/docs/integrations/google-calendar",className:"btn-ghost",children:"Previous: Google Calendar"}),$a(Tn,{href:"/docs/integrations/mistral",className:"btn-primary",children:["Next: Mistral ",We(yp,{size:16})]})]})]})}import lr from"@contractspec/lib.ui-link";import{jsx as Mt,jsxs as co}from"react/jsx-runtime";var bp=[{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 Np(){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 \u2192 tenant connection \u2192 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(lr,{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(lr,{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:bp.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(lr,{href:t.href,className:"docs-chip-link",children:t.title},t.href))})]},e.title))})]})}import An from"@contractspec/lib.ui-link";import{ChevronRight as wp}from"lucide-react";import{jsx as Q,jsxs as Ct}from"react/jsx-runtime";function kp(){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
2052
2052
  POSTMARK_API_TOKEN=...
2053
2053
  POSTMARK_FROM_EMAIL=noreply@example.com
2054
2054
  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
@@ -2094,7 +2094,7 @@ config:
2094
2094
  templateId: "welcome-email"
2095
2095
  templateData:
2096
2096
  user_name: \${input.userName}
2097
- 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"})," \u2013 Email was successfully delivered"]}),Ct("li",{children:[Q("strong",{children:"Bounce"})," \u2013 Email bounced (hard or soft)"]}),Ct("li",{children:[Q("strong",{children:"SpamComplaint"})," \u2013 Recipient marked email as spam"]}),Ct("li",{children:[Q("strong",{children:"Open"})," \u2013 Recipient opened the email"]}),Ct("li",{children:[Q("strong",{children:"Click"})," \u2013 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
+ 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"})," \u2013 Email was successfully delivered"]}),Ct("li",{children:[Q("strong",{children:"Bounce"})," \u2013 Email bounced (hard or soft)"]}),Ct("li",{children:[Q("strong",{children:"SpamComplaint"})," \u2013 Recipient marked email as spam"]}),Ct("li",{children:[Q("strong",{children:"Open"})," \u2013 Recipient opened the email"]}),Ct("li",{children:[Q("strong",{children:"Click"})," \u2013 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(An,{href:"/docs/integrations/stripe",className:"btn-ghost",children:"Previous: Stripe"}),Ct(An,{href:"/docs/integrations/resend",className:"btn-primary",children:["Next: Resend ",Q(wp,{size:16})]})]})]})}import Rn from"@contractspec/lib.ui-link";import{ChevronRight as Sp}from"lucide-react";import{jsx as _,jsxs as Se}from"react/jsx-runtime";function Cp(){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:`{
2098
2098
  "clientId": "powens-client-id",
2099
2099
  "clientSecret": "powens-client-secret",
2100
2100
  "apiKey": "optional-api-key",
@@ -2149,7 +2149,7 @@ inputs:
2149
2149
  outputs:
2150
2150
  balances:
2151
2151
  type: AccountBalanceRecord[]
2152
- description: "Current/available balances with timestamps"`})})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Primary workflows"}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Account sync"}),Se("p",{className:"text-muted-foreground",children:["The workflow"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-accounts"})," ","refreshes account metadata, then surfaces canonical records to other automations."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Transaction sync"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-transactions"})," ","ingests incremental transactions for each linked account and stores them in the canonical ledger."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Balance refresh"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.refresh-openbanking-balances"})," ","retrieves current and available balances to power dashboards and anomaly detection."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Derived financial overview"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.generate-openbanking-overview"})," ","aggregates balances, category breakdowns, and cashflow trends into the ",_("code",{children:"knowledge.financial-overview"})," space. Only derived summaries are exposed to LLMs."]})]})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Telemetry & guardrails"}),Se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Se("li",{children:["Telemetry events such as"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.accounts.synced"})," ","and"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.transactions.synced"})," ","are emitted automatically with tenant, slot, and config metadata."]}),Se("li",{children:["Guard helpers ensure the"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"primaryOpenBanking"})," ","slot is bound and healthy before workflows execute."]}),Se("li",{children:["PII fields (IBAN, counterparty names, descriptions) are redacted via"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"redactOpenBankingTelemetryPayload"})," ","before logging or sending telemetry."]})]})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Best practices"}),Se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[_("li",{children:"Use BYOK credentials per tenant to avoid cross-tenant exposure."}),_("li",{children:"Store only canonical entities (BankAccountRecord, BankTransactionRecord). Never persist raw Powens payloads or customer PII in logs."}),_("li",{children:"Run the transaction sync on a schedule appropriate for banking SLAs (e.g. every 15 minutes for cashflow dashboards)."}),_("li",{children:"Pair ledger updates with derived summaries to feed the knowledge layer instead of exposing raw transactions to agents."}),Se("li",{children:["Monitor telemetry for"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.*.sync_failed"})," ","events to detect credential issues early."]})]})]}),Se("div",{className:"flex items-center gap-4 pt-4",children:[_(Pn,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),Se(Pn,{href:"/docs/integrations/stripe",className:"btn-primary",children:["Next: Stripe ",_(vp,{size:16})]})]})]})}import Tn from"@contractspec/lib.ui-link";import{ChevronRight as Np}from"lucide-react";import{jsx as Bt,jsxs as Po}from"react/jsx-runtime";function wp(){return Po("div",{className:"space-y-8",children:[Po("div",{className:"space-y-4",children:[Bt("h1",{className:"font-bold text-4xl",children:"Qdrant"}),Bt("p",{className:"text-muted-foreground",children:"Qdrant is a high-performance vector database for semantic search, recommendations, and RAG (Retrieval-Augmented Generation) applications."})]}),Po("div",{className:"space-y-4",children:[Bt("h2",{className:"font-bold text-2xl",children:"Setup"}),Bt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Bt("pre",{children:`# .env
2152
+ description: "Current/available balances with timestamps"`})})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Primary workflows"}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Account sync"}),Se("p",{className:"text-muted-foreground",children:["The workflow"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-accounts"})," ","refreshes account metadata, then surfaces canonical records to other automations."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Transaction sync"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.sync-openbanking-transactions"})," ","ingests incremental transactions for each linked account and stores them in the canonical ledger."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Balance refresh"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.refresh-openbanking-balances"})," ","retrieves current and available balances to power dashboards and anomaly detection."]})]}),Se("div",{className:"space-y-3",children:[_("h3",{className:"font-semibold text-lg",children:"Derived financial overview"}),Se("p",{className:"text-muted-foreground",children:[_("code",{className:"rounded bg-background/50 px-2 py-1",children:"pfo.workflow.generate-openbanking-overview"})," ","aggregates balances, category breakdowns, and cashflow trends into the ",_("code",{children:"knowledge.financial-overview"})," space. Only derived summaries are exposed to LLMs."]})]})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Telemetry & guardrails"}),Se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Se("li",{children:["Telemetry events such as"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.accounts.synced"})," ","and"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.transactions.synced"})," ","are emitted automatically with tenant, slot, and config metadata."]}),Se("li",{children:["Guard helpers ensure the"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"primaryOpenBanking"})," ","slot is bound and healthy before workflows execute."]}),Se("li",{children:["PII fields (IBAN, counterparty names, descriptions) are redacted via"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"redactOpenBankingTelemetryPayload"})," ","before logging or sending telemetry."]})]})]}),Se("div",{className:"space-y-4",children:[_("h2",{className:"font-bold text-2xl",children:"Best practices"}),Se("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[_("li",{children:"Use BYOK credentials per tenant to avoid cross-tenant exposure."}),_("li",{children:"Store only canonical entities (BankAccountRecord, BankTransactionRecord). Never persist raw Powens payloads or customer PII in logs."}),_("li",{children:"Run the transaction sync on a schedule appropriate for banking SLAs (e.g. every 15 minutes for cashflow dashboards)."}),_("li",{children:"Pair ledger updates with derived summaries to feed the knowledge layer instead of exposing raw transactions to agents."}),Se("li",{children:["Monitor telemetry for"," ",_("code",{className:"rounded bg-background/50 px-2 py-1",children:"openbanking.*.sync_failed"})," ","events to detect credential issues early."]})]})]}),Se("div",{className:"flex items-center gap-4 pt-4",children:[_(Rn,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),Se(Rn,{href:"/docs/integrations/stripe",className:"btn-primary",children:["Next: Stripe ",_(Sp,{size:16})]})]})]})}import Ln from"@contractspec/lib.ui-link";import{ChevronRight as Ip}from"lucide-react";import{jsx as Bt,jsxs as Po}from"react/jsx-runtime";function Pp(){return Po("div",{className:"space-y-8",children:[Po("div",{className:"space-y-4",children:[Bt("h1",{className:"font-bold text-4xl",children:"Qdrant"}),Bt("p",{className:"text-muted-foreground",children:"Qdrant is a high-performance vector database for semantic search, recommendations, and RAG (Retrieval-Augmented Generation) applications."})]}),Po("div",{className:"space-y-4",children:[Bt("h2",{className:"font-bold text-2xl",children:"Setup"}),Bt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Bt("pre",{children:`# .env
2153
2153
  QDRANT_URL=https://...
2154
2154
  QDRANT_API_KEY=...
2155
2155
  QDRANT_COLLECTION=documents`})})]}),Po("div",{className:"space-y-4",children:[Bt("h2",{className:"font-bold text-2xl",children:"Storing vectors"}),Bt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Bt("pre",{children:`capabilityId: qdrant-upsert
@@ -2220,7 +2220,7 @@ steps:
2220
2220
  - role: "user"
2221
2221
  content: |
2222
2222
  Context: \${steps.search-documents.output.results}
2223
- Question: \${input.query}`})})]}),Po("div",{className:"flex items-center gap-4 pt-4",children:[Bt(Tn,{href:"/docs/integrations/elevenlabs",className:"btn-ghost",children:"Previous: ElevenLabs"}),Po(Tn,{href:"/docs/integrations/s3",className:"btn-primary",children:["Next: S3 Storage ",Bt(Np,{size:16})]})]})]})}import An from"@contractspec/lib.ui-link";import{ChevronRight as kp}from"lucide-react";import{jsx as ga,jsxs as To}from"react/jsx-runtime";function Sp(){return To("div",{className:"space-y-8",children:[To("div",{className:"space-y-4",children:[ga("h1",{className:"font-bold text-4xl",children:"Resend"}),ga("p",{className:"text-muted-foreground",children:"Resend is a modern email API built for developers. It provides a simple, reliable way to send transactional emails with React Email templates."})]}),To("div",{className:"space-y-4",children:[ga("h2",{className:"font-bold text-2xl",children:"Setup"}),ga("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ga("pre",{children:`# .env
2223
+ Question: \${input.query}`})})]}),Po("div",{className:"flex items-center gap-4 pt-4",children:[Bt(Ln,{href:"/docs/integrations/elevenlabs",className:"btn-ghost",children:"Previous: ElevenLabs"}),Po(Ln,{href:"/docs/integrations/s3",className:"btn-primary",children:["Next: S3 Storage ",Bt(Ip,{size:16})]})]})]})}import En from"@contractspec/lib.ui-link";import{ChevronRight as Tp}from"lucide-react";import{jsx as ga,jsxs as To}from"react/jsx-runtime";function Ap(){return To("div",{className:"space-y-8",children:[To("div",{className:"space-y-4",children:[ga("h1",{className:"font-bold text-4xl",children:"Resend"}),ga("p",{className:"text-muted-foreground",children:"Resend is a modern email API built for developers. It provides a simple, reliable way to send transactional emails with React Email templates."})]}),To("div",{className:"space-y-4",children:[ga("h2",{className:"font-bold text-2xl",children:"Setup"}),ga("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ga("pre",{children:`# .env
2224
2224
  RESEND_API_KEY=re_...
2225
2225
  RESEND_FROM_EMAIL=onboarding@resend.dev`})})]}),To("div",{className:"space-y-4",children:[ga("h2",{className:"font-bold text-2xl",children:"Sending emails"}),ga("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ga("pre",{children:`capabilityId: resend-send-email
2226
2226
  provider:
@@ -2243,7 +2243,7 @@ inputs:
2243
2243
 
2244
2244
  outputs:
2245
2245
  id:
2246
- type: string`})})]}),To("div",{className:"space-y-4",children:[ga("h2",{className:"font-bold text-2xl",children:"Best practices"}),To("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ga("li",{children:"Use React Email for type-safe templates"}),ga("li",{children:"Verify your domain for better deliverability"}),ga("li",{children:"Monitor email analytics in the Resend dashboard"})]})]}),To("div",{className:"flex items-center gap-4 pt-4",children:[ga(An,{href:"/docs/integrations/postmark",className:"btn-ghost",children:"Previous: Postmark"}),To(An,{href:"/docs/integrations/gmail",className:"btn-primary",children:["Next: Gmail API ",ga(kp,{size:16})]})]})]})}import Rn from"@contractspec/lib.ui-link";import{ChevronRight as Cp}from"lucide-react";import{jsx as nt,jsxs as lo}from"react/jsx-runtime";function Ip(){return lo("div",{className:"space-y-8",children:[lo("div",{className:"space-y-4",children:[nt("h1",{className:"font-bold text-4xl",children:"S3-Compatible Storage"}),nt("p",{className:"text-muted-foreground",children:"Store files, images, and documents using any S3-compatible object storage service including AWS S3, Scaleway Object Storage, MinIO, DigitalOcean Spaces, and more."})]}),lo("div",{className:"space-y-4",children:[nt("h2",{className:"font-bold text-2xl",children:"Setup"}),nt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:nt("pre",{children:`# .env
2246
+ type: string`})})]}),To("div",{className:"space-y-4",children:[ga("h2",{className:"font-bold text-2xl",children:"Best practices"}),To("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ga("li",{children:"Use React Email for type-safe templates"}),ga("li",{children:"Verify your domain for better deliverability"}),ga("li",{children:"Monitor email analytics in the Resend dashboard"})]})]}),To("div",{className:"flex items-center gap-4 pt-4",children:[ga(En,{href:"/docs/integrations/postmark",className:"btn-ghost",children:"Previous: Postmark"}),To(En,{href:"/docs/integrations/gmail",className:"btn-primary",children:["Next: Gmail API ",ga(Tp,{size:16})]})]})]})}import Dn from"@contractspec/lib.ui-link";import{ChevronRight as Rp}from"lucide-react";import{jsx as nt,jsxs as lo}from"react/jsx-runtime";function Lp(){return lo("div",{className:"space-y-8",children:[lo("div",{className:"space-y-4",children:[nt("h1",{className:"font-bold text-4xl",children:"S3-Compatible Storage"}),nt("p",{className:"text-muted-foreground",children:"Store files, images, and documents using any S3-compatible object storage service including AWS S3, Scaleway Object Storage, MinIO, DigitalOcean Spaces, and more."})]}),lo("div",{className:"space-y-4",children:[nt("h2",{className:"font-bold text-2xl",children:"Setup"}),nt("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:nt("pre",{children:`# .env
2247
2247
  S3_ENDPOINT=https://s3.fr-par.scw.cloud
2248
2248
  S3_ACCESS_KEY_ID=...
2249
2249
  S3_SECRET_ACCESS_KEY=...
@@ -2285,7 +2285,7 @@ inputs:
2285
2285
 
2286
2286
  outputs:
2287
2287
  url:
2288
- type: string`})})]}),lo("div",{className:"space-y-4",children:[nt("h2",{className:"font-bold text-2xl",children:"Best practices"}),lo("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[nt("li",{children:"Use presigned URLs for secure, temporary access"}),nt("li",{children:"Set appropriate CORS policies for browser uploads"}),nt("li",{children:"Enable versioning for important files"}),nt("li",{children:"Use lifecycle policies to archive old files"}),nt("li",{children:"Organize files with a clear key structure"})]})]}),lo("div",{className:"flex items-center gap-4 pt-4",children:[nt(Rn,{href:"/docs/integrations/qdrant",className:"btn-ghost",children:"Previous: Qdrant"}),lo(Rn,{href:"/docs/integrations/twilio",className:"btn-primary",children:["Next: Twilio ",nt(Cp,{size:16})]})]})]})}import Ln from"@contractspec/lib.ui-link";import{ChevronRight as Pp}from"lucide-react";import{jsx as ct,jsxs as Da}from"react/jsx-runtime";function Tp(){return Da("div",{className:"space-y-8",children:[Da("div",{className:"space-y-4",children:[ct("h1",{className:"font-bold text-4xl",children:"Slack Messaging"}),ct("p",{className:"text-muted-foreground",children:"ContractSpec supports signed Slack event ingestion and outbox-backed outbound replies through the channel runtime."})]}),Da("div",{className:"space-y-4",children:[ct("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),ct("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ct("pre",{children:`// secret payload
2288
+ type: string`})})]}),lo("div",{className:"space-y-4",children:[nt("h2",{className:"font-bold text-2xl",children:"Best practices"}),lo("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[nt("li",{children:"Use presigned URLs for secure, temporary access"}),nt("li",{children:"Set appropriate CORS policies for browser uploads"}),nt("li",{children:"Enable versioning for important files"}),nt("li",{children:"Use lifecycle policies to archive old files"}),nt("li",{children:"Organize files with a clear key structure"})]})]}),lo("div",{className:"flex items-center gap-4 pt-4",children:[nt(Dn,{href:"/docs/integrations/qdrant",className:"btn-ghost",children:"Previous: Qdrant"}),lo(Dn,{href:"/docs/integrations/twilio",className:"btn-primary",children:["Next: Twilio ",nt(Rp,{size:16})]})]})]})}import On from"@contractspec/lib.ui-link";import{ChevronRight as Ep}from"lucide-react";import{jsx as ct,jsxs as Da}from"react/jsx-runtime";function Dp(){return Da("div",{className:"space-y-8",children:[Da("div",{className:"space-y-4",children:[ct("h1",{className:"font-bold text-4xl",children:"Slack Messaging"}),ct("p",{className:"text-muted-foreground",children:"ContractSpec supports signed Slack event ingestion and outbox-backed outbound replies through the channel runtime."})]}),Da("div",{className:"space-y-4",children:[ct("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),ct("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:ct("pre",{children:`// secret payload
2289
2289
  {
2290
2290
  "botToken": "xoxb-...",
2291
2291
  "signingSecret": "..."
@@ -2303,7 +2303,7 @@ CHANNEL_DISPATCH_TOKEN=...
2303
2303
 
2304
2304
  # Optional scheduler
2305
2305
  CHANNEL_DISPATCH_INTERVAL_MS=120000
2306
- CHANNEL_DISPATCH_RUN_ON_START=1`})})]}),Da("div",{className:"space-y-4",children:[ct("h2",{className:"font-bold text-2xl",children:"Best practices"}),Da("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ct("li",{children:"Keep bot tokens and signing secrets in a managed secret provider."}),ct("li",{children:"Use workspace mapping to prevent cross-tenant event leakage."}),ct("li",{children:"Keep dispatch asynchronous so webhook handlers stay fast and reliable."}),ct("li",{children:"Monitor telemetry for ingest, decision, outbox, and dispatch stages."})]})]}),Da("div",{className:"flex items-center gap-4 pt-4",children:[ct(Ln,{href:"/docs/integrations/twilio",className:"btn-ghost",children:"Previous: Twilio SMS"}),Da(Ln,{href:"/docs/integrations/github",className:"btn-primary",children:["Next: GitHub Messaging ",ct(Pp,{size:16})]})]})]})}import En from"@contractspec/lib.ui-link";import{ChevronRight as Ap}from"lucide-react";import{jsx as N,jsxs as _e}from"react/jsx-runtime";function Rp(){return _e("div",{className:"space-y-8",children:[_e("div",{className:"space-y-4",children:[N("h1",{className:"font-bold text-4xl",children:"Integration Spec Model"}),N("p",{className:"text-muted-foreground",children:"Integrations in ContractSpec are defined through typed specifications that declare capabilities, configuration requirements, and connection details. This page covers IntegrationSpec and IntegrationConnection."})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"IntegrationSpec"}),_e("p",{className:"text-muted-foreground",children:["The ",N("strong",{children:"IntegrationSpec"})," is a global definition of an integration provider. It declares what the integration provides and what it requires."]}),N("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:N("pre",{children:`type IntegrationSpec = {
2306
+ CHANNEL_DISPATCH_RUN_ON_START=1`})})]}),Da("div",{className:"space-y-4",children:[ct("h2",{className:"font-bold text-2xl",children:"Best practices"}),Da("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[ct("li",{children:"Keep bot tokens and signing secrets in a managed secret provider."}),ct("li",{children:"Use workspace mapping to prevent cross-tenant event leakage."}),ct("li",{children:"Keep dispatch asynchronous so webhook handlers stay fast and reliable."}),ct("li",{children:"Monitor telemetry for ingest, decision, outbox, and dispatch stages."})]})]}),Da("div",{className:"flex items-center gap-4 pt-4",children:[ct(On,{href:"/docs/integrations/twilio",className:"btn-ghost",children:"Previous: Twilio SMS"}),Da(On,{href:"/docs/integrations/github",className:"btn-primary",children:["Next: GitHub Messaging ",ct(Ep,{size:16})]})]})]})}import Mn from"@contractspec/lib.ui-link";import{ChevronRight as Op}from"lucide-react";import{jsx as N,jsxs as _e}from"react/jsx-runtime";function Mp(){return _e("div",{className:"space-y-8",children:[_e("div",{className:"space-y-4",children:[N("h1",{className:"font-bold text-4xl",children:"Integration Spec Model"}),N("p",{className:"text-muted-foreground",children:"Integrations in ContractSpec are defined through typed specifications that declare capabilities, configuration requirements, and connection details. This page covers IntegrationSpec and IntegrationConnection."})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"IntegrationSpec"}),_e("p",{className:"text-muted-foreground",children:["The ",N("strong",{children:"IntegrationSpec"})," is a global definition of an integration provider. It declares what the integration provides and what it requires."]}),N("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:N("pre",{children:`type IntegrationSpec = {
2307
2307
  id: string;
2308
2308
  label: string;
2309
2309
  description: string;
@@ -2513,7 +2513,7 @@ CHANNEL_DISPATCH_RUN_ON_START=1`})})]}),Da("div",{className:"space-y-4",children
2513
2513
  "clientSecret": "...",
2514
2514
  "tokenExpiresAt": "2026-02-01T00:00:00.000Z",
2515
2515
  "mcpAccessToken": "..."
2516
- }`})})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Health checks"}),N("p",{className:"text-muted-foreground",children:"IntegrationConnections are periodically health-checked to ensure they remain valid:"}),_e("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[_e("li",{children:[N("strong",{children:"API key validation"})," - Test that credentials are still valid"]}),_e("li",{children:[N("strong",{children:"Connectivity check"})," - Verify network access to the provider"]}),_e("li",{children:[N("strong",{children:"Permission verification"})," - Ensure required scopes are granted"]}),_e("li",{children:[N("strong",{children:"Webhook validation"})," - Test webhook endpoint reachability"]})]}),N("p",{className:"text-muted-foreground",children:'Failed health checks update the connection status to "error" and trigger alerts.'})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Secret management"}),N("p",{className:"text-muted-foreground",children:"Secrets (API keys, tokens) are never stored in plaintext:"}),_e("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[N("li",{children:"User provides secrets through secure UI or API"}),N("li",{children:"Secrets are encrypted using tenant-specific keys"}),N("li",{children:"Encrypted secrets are stored in secure vault (e.g., AWS Secrets Manager)"}),N("li",{children:"IntegrationConnection stores only a reference (secretRef)"}),N("li",{children:"At runtime, secrets are decrypted on-demand and never logged"})]})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Best practices"}),_e("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[N("li",{children:"Always maintain separate sandbox and production connections"}),N("li",{children:"Use descriptive connection IDs that include tenant and environment"}),N("li",{children:"Monitor health check status and set up alerts for failures"}),N("li",{children:"Rotate secrets regularly and update secretRef accordingly"}),N("li",{children:"Document the purpose and ownership of each connection"}),N("li",{children:"Test connections in sandbox before enabling in production"})]})]}),_e("div",{className:"flex items-center gap-4 pt-4",children:[N(En,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),_e(En,{href:"/docs/architecture/integration-binding",className:"btn-primary",children:["Integration Binding ",N(Ap,{size:16})]})]})]})}import Dn from"@contractspec/lib.ui-link";import{ChevronRight as Lp}from"lucide-react";import{jsx as p,jsxs as ze}from"react/jsx-runtime";function Ep(){return ze("div",{className:"space-y-8",children:[ze("div",{className:"space-y-4",children:[p("h1",{className:"font-bold text-4xl",children:"Stripe"}),p("p",{className:"text-muted-foreground",children:"The Stripe integration enables payment processing, subscription management, and invoicing in your ContractSpec applications. All Stripe operations are type-safe, policy-enforced, and automatically logged."})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Setup"}),p("p",{className:"text-muted-foreground",children:"Add your Stripe credentials to your environment variables:"}),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:`# .env
2516
+ }`})})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Health checks"}),N("p",{className:"text-muted-foreground",children:"IntegrationConnections are periodically health-checked to ensure they remain valid:"}),_e("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[_e("li",{children:[N("strong",{children:"API key validation"})," - Test that credentials are still valid"]}),_e("li",{children:[N("strong",{children:"Connectivity check"})," - Verify network access to the provider"]}),_e("li",{children:[N("strong",{children:"Permission verification"})," - Ensure required scopes are granted"]}),_e("li",{children:[N("strong",{children:"Webhook validation"})," - Test webhook endpoint reachability"]})]}),N("p",{className:"text-muted-foreground",children:'Failed health checks update the connection status to "error" and trigger alerts.'})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Secret management"}),N("p",{className:"text-muted-foreground",children:"Secrets (API keys, tokens) are never stored in plaintext:"}),_e("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[N("li",{children:"User provides secrets through secure UI or API"}),N("li",{children:"Secrets are encrypted using tenant-specific keys"}),N("li",{children:"Encrypted secrets are stored in secure vault (e.g., AWS Secrets Manager)"}),N("li",{children:"IntegrationConnection stores only a reference (secretRef)"}),N("li",{children:"At runtime, secrets are decrypted on-demand and never logged"})]})]}),_e("div",{className:"space-y-4",children:[N("h2",{className:"font-bold text-2xl",children:"Best practices"}),_e("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[N("li",{children:"Always maintain separate sandbox and production connections"}),N("li",{children:"Use descriptive connection IDs that include tenant and environment"}),N("li",{children:"Monitor health check status and set up alerts for failures"}),N("li",{children:"Rotate secrets regularly and update secretRef accordingly"}),N("li",{children:"Document the purpose and ownership of each connection"}),N("li",{children:"Test connections in sandbox before enabling in production"})]})]}),_e("div",{className:"flex items-center gap-4 pt-4",children:[N(Mn,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),_e(Mn,{href:"/docs/architecture/integration-binding",className:"btn-primary",children:["Integration Binding ",N(Op,{size:16})]})]})]})}import Bn from"@contractspec/lib.ui-link";import{ChevronRight as Bp}from"lucide-react";import{jsx as p,jsxs as ze}from"react/jsx-runtime";function Up(){return ze("div",{className:"space-y-8",children:[ze("div",{className:"space-y-4",children:[p("h1",{className:"font-bold text-4xl",children:"Stripe"}),p("p",{className:"text-muted-foreground",children:"The Stripe integration enables payment processing, subscription management, and invoicing in your ContractSpec applications. All Stripe operations are type-safe, policy-enforced, and automatically logged."})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Setup"}),p("p",{className:"text-muted-foreground",children:"Add your Stripe credentials to your environment variables:"}),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:`# .env
2517
2517
  STRIPE_SECRET_KEY=sk_test_...
2518
2518
  STRIPE_PUBLISHABLE_KEY=pk_test_...
2519
2519
  STRIPE_WEBHOOK_SECRET=whsec_...`})}),ze("p",{className:"text-muted-foreground text-sm",children:["Get your API keys from the"," ",p("a",{href:"https://dashboard.stripe.com/apikeys",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Stripe Dashboard"}),"."]})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Available capabilities"}),ze("div",{className:"space-y-3",children:[p("h3",{className:"font-semibold text-lg",children:"Payment Intents"}),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:`capabilityId: stripe-create-payment-intent
@@ -2616,7 +2616,7 @@ steps:
2616
2616
  to: "admin@example.com"
2617
2617
  template: "payment-error"
2618
2618
  data:
2619
- error: \${error.message}`})})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Testing"}),p("p",{className:"text-muted-foreground",children:"Use Stripe's test cards for development:"}),p("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:ze("table",{className:"w-full text-left text-sm",children:[p("thead",{className:"bg-card/50",children:ze("tr",{className:"border-border/50 border-b",children:[p("th",{className:"px-4 py-3 font-semibold",children:"Card Number"}),p("th",{className:"px-4 py-3 font-semibold",children:"Scenario"})]})}),ze("tbody",{className:"divide-y divide-border/50",children:[ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4242 4242 4242 4242"}),p("td",{className:"px-4 py-3",children:"Successful payment"})]}),ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4000 0000 0000 9995"}),p("td",{className:"px-4 py-3",children:"Insufficient funds"})]}),ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4000 0000 0000 0002"}),p("td",{className:"px-4 py-3",children:"Card declined"})]})]})]})})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Best practices"}),ze("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[p("li",{children:"Always use test mode during development"}),p("li",{children:"Verify webhook signatures to prevent fraud"}),p("li",{children:"Handle idempotency for payment operations"}),p("li",{children:"Store customer IDs for recurring payments"}),p("li",{children:"Use metadata to link Stripe objects to your application records"}),p("li",{children:"Monitor failed payments and retry logic"})]})]}),ze("div",{className:"flex items-center gap-4 pt-4",children:[p(Dn,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),ze(Dn,{href:"/docs/integrations/postmark",className:"btn-primary",children:["Next: Postmark ",p(Lp,{size:16})]})]})]})}import On from"@contractspec/lib.ui-link";import{jsx as Je,jsxs as so}from"react/jsx-runtime";function Dp(){return so("div",{className:"space-y-8",children:[so("div",{className:"space-y-4",children:[Je("h1",{className:"font-bold text-4xl",children:"Twilio"}),Je("p",{className:"text-muted-foreground",children:"Send SMS notifications, alerts, and two-factor authentication codes using Twilio's reliable messaging platform."})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Setup"}),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:`# .env
2619
+ error: \${error.message}`})})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Testing"}),p("p",{className:"text-muted-foreground",children:"Use Stripe's test cards for development:"}),p("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:ze("table",{className:"w-full text-left text-sm",children:[p("thead",{className:"bg-card/50",children:ze("tr",{className:"border-border/50 border-b",children:[p("th",{className:"px-4 py-3 font-semibold",children:"Card Number"}),p("th",{className:"px-4 py-3 font-semibold",children:"Scenario"})]})}),ze("tbody",{className:"divide-y divide-border/50",children:[ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4242 4242 4242 4242"}),p("td",{className:"px-4 py-3",children:"Successful payment"})]}),ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4000 0000 0000 9995"}),p("td",{className:"px-4 py-3",children:"Insufficient funds"})]}),ze("tr",{children:[p("td",{className:"px-4 py-3 font-mono",children:"4000 0000 0000 0002"}),p("td",{className:"px-4 py-3",children:"Card declined"})]})]})]})})]}),ze("div",{className:"space-y-4",children:[p("h2",{className:"font-bold text-2xl",children:"Best practices"}),ze("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[p("li",{children:"Always use test mode during development"}),p("li",{children:"Verify webhook signatures to prevent fraud"}),p("li",{children:"Handle idempotency for payment operations"}),p("li",{children:"Store customer IDs for recurring payments"}),p("li",{children:"Use metadata to link Stripe objects to your application records"}),p("li",{children:"Monitor failed payments and retry logic"})]})]}),ze("div",{className:"flex items-center gap-4 pt-4",children:[p(Bn,{href:"/docs/integrations",className:"btn-ghost",children:"Back to Integrations"}),ze(Bn,{href:"/docs/integrations/postmark",className:"btn-primary",children:["Next: Postmark ",p(Bp,{size:16})]})]})]})}import Un from"@contractspec/lib.ui-link";import{jsx as Je,jsxs as so}from"react/jsx-runtime";function Wp(){return so("div",{className:"space-y-8",children:[so("div",{className:"space-y-4",children:[Je("h1",{className:"font-bold text-4xl",children:"Twilio"}),Je("p",{className:"text-muted-foreground",children:"Send SMS notifications, alerts, and two-factor authentication codes using Twilio's reliable messaging platform."})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Setup"}),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:`# .env
2620
2620
  TWILIO_ACCOUNT_SID=...
2621
2621
  TWILIO_AUTH_TOKEN=...
2622
2622
  TWILIO_PHONE_NUMBER=+1234567890`})})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Sending SMS"}),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:`capabilityId: twilio-send-sms
@@ -2636,7 +2636,7 @@ outputs:
2636
2636
  messageSid:
2637
2637
  type: string
2638
2638
  status:
2639
- type: string`})})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Use cases"}),so("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Je("li",{children:"Order confirmations and shipping updates"}),Je("li",{children:"Two-factor authentication codes"}),Je("li",{children:"Appointment reminders"}),Je("li",{children:"Alert notifications"})]})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Best practices"}),so("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Je("li",{children:"Always use E.164 format for phone numbers (+1234567890)"}),Je("li",{children:"Keep messages under 160 characters to avoid splitting"}),Je("li",{children:"Implement rate limiting to prevent spam"}),Je("li",{children:"Handle delivery failures gracefully"}),Je("li",{children:"Respect opt-out requests"})]})]}),so("div",{className:"flex items-center gap-4 pt-4",children:[Je(On,{href:"/docs/integrations/s3",className:"btn-ghost",children:"Previous: S3 Storage"}),Je(On,{href:"/docs/integrations/slack",className:"btn-primary",children:"Next: Slack Messaging"})]})]})}import Mn from"@contractspec/lib.ui-link";import{ChevronRight as Op}from"lucide-react";import{jsx as ut,jsxs as ka}from"react/jsx-runtime";function Mp(){return ka("div",{className:"space-y-8",children:[ka("div",{className:"space-y-4",children:[ut("h1",{className:"font-bold text-4xl",children:"WhatsApp Meta"}),ut("p",{className:"text-muted-foreground",children:"Meta WhatsApp is the primary WhatsApp channel for ContractSpec's messaging runtime, with signed webhook verification and reliable outbound delivery."})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),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:`// secret payload
2639
+ type: string`})})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Use cases"}),so("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Je("li",{children:"Order confirmations and shipping updates"}),Je("li",{children:"Two-factor authentication codes"}),Je("li",{children:"Appointment reminders"}),Je("li",{children:"Alert notifications"})]})]}),so("div",{className:"space-y-4",children:[Je("h2",{className:"font-bold text-2xl",children:"Best practices"}),so("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Je("li",{children:"Always use E.164 format for phone numbers (+1234567890)"}),Je("li",{children:"Keep messages under 160 characters to avoid splitting"}),Je("li",{children:"Implement rate limiting to prevent spam"}),Je("li",{children:"Handle delivery failures gracefully"}),Je("li",{children:"Respect opt-out requests"})]})]}),so("div",{className:"flex items-center gap-4 pt-4",children:[Je(Un,{href:"/docs/integrations/s3",className:"btn-ghost",children:"Previous: S3 Storage"}),Je(Un,{href:"/docs/integrations/slack",className:"btn-primary",children:"Next: Slack Messaging"})]})]})}import Wn from"@contractspec/lib.ui-link";import{ChevronRight as _p}from"lucide-react";import{jsx as ut,jsxs as ka}from"react/jsx-runtime";function zp(){return ka("div",{className:"space-y-8",children:[ka("div",{className:"space-y-4",children:[ut("h1",{className:"font-bold text-4xl",children:"WhatsApp Meta"}),ut("p",{className:"text-muted-foreground",children:"Meta WhatsApp is the primary WhatsApp channel for ContractSpec's messaging runtime, with signed webhook verification and reliable outbound delivery."})]}),ka("div",{className:"space-y-4",children:[ut("h2",{className:"font-bold text-2xl",children:"Required secrets and config"}),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:`// secret payload
2640
2640
  {
2641
2641
  "accessToken": "...",
2642
2642
  "appSecret": "...",
@@ -2647,7 +2647,7 @@ outputs:
2647
2647
  {
2648
2648
  "phoneNumberId": "120000000001",
2649
2649
  "apiVersion": "v22.0"
2650
- }`})})]}),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
+ }`})})]}),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(Wn,{href:"/docs/integrations/github",className:"btn-ghost",children:"Previous: GitHub Messaging"}),ka(Wn,{href:"/docs/integrations/whatsapp-twilio",className:"btn-primary",children:["Next: WhatsApp Twilio ",ut(_p,{size:16})]})]})]})}import _n from"@contractspec/lib.ui-link";import{ChevronRight as Gp}from"lucide-react";import{jsx as gt,jsxs as ha}from"react/jsx-runtime";function qp(){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
2651
2651
  {
2652
2652
  "accountSid": "AC123",
2653
2653
  "authToken": "..."
@@ -2656,7 +2656,7 @@ outputs:
2656
2656
  // optional connection config
2657
2657
  {
2658
2658
  "fromNumber": "whatsapp:+15550002"
2659
- }`})})]}),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
+ }`})})]}),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(_n,{href:"/docs/integrations/whatsapp-meta",className:"btn-ghost",children:"Previous: WhatsApp Meta"}),ha(_n,{href:"/docs/integrations/health-routing",className:"btn-primary",children:["Next: Health Routing ",gt(Gp,{size:16})]})]})]})}var n2={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"}]},c2={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"}]},l2={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"}]},s2={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"}]},d2={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"}]},p2={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 Vp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as zn}from"@contractspec/lib.design-system";import Gn from"@contractspec/lib.ui-link";import{ChevronRight as Hp}from"lucide-react";import{jsx as Ut,jsxs as po}from"react/jsx-runtime";var v2=new Vp().optimize(si);function Fp(){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(zn,{language:"typescript",filename:"src/contracts/user-create.operation.ts",code:`import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
2660
2660
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2661
2661
 
2662
2662
  export const CreateUserOperation = defineOperation({
@@ -2690,7 +2690,7 @@ export const CreateUserOperation = defineOperation({
2690
2690
  tags: ['users', 'auth'],
2691
2691
  description: 'Create a new user account with email and password',
2692
2692
  },
2693
- });`})]}),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
+ });`})]}),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(zn,{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(Gn,{href:"/docs/guides/nextjs-one-endpoint",className:"btn-primary",children:["Next.js Guide ",Ut(Hp,{size:16})]}),Ut(Gn,{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 Kp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as sr}from"@contractspec/lib.design-system";import qn from"@contractspec/lib.ui-link";import{ChevronRight as Qp}from"lucide-react";import{jsx as lt,jsxs as xa}from"react/jsx-runtime";var S2=new Kp().optimize(di);function Yp(){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(sr,{language:"typescript",filename:"src/handlers/user-handlers.ts",code:`// Hand-written business logic (protected from regeneration)
2694
2694
  export class UserService {
2695
2695
  async createUser(input: CreateUserInput): Promise<CreateUserOutput> {
2696
2696
  // Custom validation and business rules
@@ -2727,7 +2727,7 @@ export const createUserHandler = wrapOperationHandler(
2727
2727
  operationName: 'createUser',
2728
2728
  errorMapper: mapToStandardErrors,
2729
2729
  }
2730
- );`})]}),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
+ );`})]}),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(sr,{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(sr,{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(qn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation ",lt(Qp,{size:16})]}),lt(qn,{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 Jp}from"@contractspec/lib.content-gen/seo";import{CodeBlock as ei}from"@contractspec/lib.design-system";import Vn from"@contractspec/lib.ui-link";import{ChevronRight as Zp}from"lucide-react";import{jsx as ge,jsxs as xt}from"react/jsx-runtime";var M2=new Jp().optimize(pi);function Xp(){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';
2731
2731
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2732
2732
 
2733
2733
  export const ApiContract = defineContract({
@@ -2924,7 +2924,7 @@ const user2 = client.getUser({ id: '123' }); // Uses cached result
2924
2924
  // Request cancellation
2925
2925
  const controller = new AbortController();
2926
2926
  const promise = client.getUsers({ page: 1, signal: controller.signal });
2927
- 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:"\u2022 Documentation specification only"}),te("li",{children:"\u2022 No runtime validation"}),te("li",{children:"\u2022 Manual code generation"}),te("li",{children:"\u2022 Type safety requires tools"}),te("li",{children:"\u2022 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:"\u2022 Executable contracts"}),te("li",{children:"\u2022 Built-in runtime validation"}),te("li",{children:"\u2022 Automatic code generation"}),te("li",{children:"\u2022 Type-safe by default"}),te("li",{children:"\u2022 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
+ controller.abort(); // Cancels the request`})]})]}),xt("div",{className:"flex items-center gap-4 pt-4",children:[xt(Vn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Client Generation Guide ",ge(Zp,{size:16})]}),ge(Vn,{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 $p}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 xp}from"lucide-react";import{jsx as te,jsxs as jt}from"react/jsx-runtime";var V2=new $p().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:"\u2022 Documentation specification only"}),te("li",{children:"\u2022 No runtime validation"}),te("li",{children:"\u2022 Manual code generation"}),te("li",{children:"\u2022 Type safety requires tools"}),te("li",{children:"\u2022 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:"\u2022 Executable contracts"}),te("li",{children:"\u2022 Built-in runtime validation"}),te("li",{children:"\u2022 Automatic code generation"}),te("li",{children:"\u2022 Type-safe by default"}),te("li",{children:"\u2022 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(Hn,{language:"bash",filename:"export-openapi",code:`# From ContractSpec contracts
2928
2928
  contractspec openapi export \\
2929
2929
  --registry ./src/contracts/registry.ts \\
2930
2930
  --format yaml \\
@@ -2932,7 +2932,7 @@ contractspec openapi export \\
2932
2932
 
2933
2933
  # Compare: Manual OpenAPI vs Generated
2934
2934
  # Manual: Write OpenAPI by hand, maintain separately
2935
- # Generated: Single source of truth, always in sync`})]}),jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Beyond Documentation"}),te("p",{className:"text-muted-foreground text-sm",children:"ContractSpec provides more than just API documentation."}),te(Gn,{language:"typescript",filename:"multi-output-example.ts",code:`// One contract, multiple outputs
2935
+ # Generated: Single source of truth, always in sync`})]}),jt("div",{className:"space-y-3",children:[te("h2",{className:"font-bold text-2xl",children:"Beyond Documentation"}),te("p",{className:"text-muted-foreground text-sm",children:"ContractSpec provides more than just API documentation."}),te(Hn,{language:"typescript",filename:"multi-output-example.ts",code:`// One contract, multiple outputs
2936
2936
  import { UserApiContract } from './contracts/user-api.contract';
2937
2937
 
2938
2938
  // Generated outputs
@@ -2962,7 +2962,7 @@ export const outputs = {
2962
2962
 
2963
2963
  // Type definitions
2964
2964
  types: UserApiContract.toTypescript(),
2965
- };`})]})]}),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
+ };`})]})]}),jt("div",{className:"flex items-center gap-4 pt-4",children:[jt(Fn,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:["Generate from Contracts ",te(xp,{size:16})]}),te(Fn,{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 em}from"@contractspec/lib.content-gen/seo";import{CodeBlock as dr}from"@contractspec/lib.design-system";import Kn from"@contractspec/lib.ui-link";import{ChevronRight as tm}from"lucide-react";import{jsx as st,jsxs as ja}from"react/jsx-runtime";var X2=new em().optimize(ui);function am(){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(dr,{language:"typescript",filename:"src/contracts/user.schema.ts",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
2966
2966
 
2967
2967
  export const UserSchema = new SchemaModel({
2968
2968
  type: 'object',
@@ -3004,7 +3004,7 @@ export const UserSchema = new SchemaModel({
3004
3004
  name: 'User',
3005
3005
  description: 'User account information',
3006
3006
  },
3007
- });`})]}),ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Generated Types"}),st("p",{className:"text-muted-foreground text-sm",children:"TypeScript types are automatically generated with proper validation."}),st(lr,{language:"typescript",filename:"generated/types/user.ts",code:`// Auto-generated from UserSchema
3007
+ });`})]}),ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Generated Types"}),st("p",{className:"text-muted-foreground text-sm",children:"TypeScript types are automatically generated with proper validation."}),st(dr,{language:"typescript",filename:"generated/types/user.ts",code:`// Auto-generated from UserSchema
3008
3008
  export interface User {
3009
3009
  id: string;
3010
3010
  email: string;
@@ -3029,7 +3029,7 @@ export function validateUser(data: unknown): User {
3029
3029
 
3030
3030
  export function isUser(data: unknown): data is User {
3031
3031
  return UserSchemaZod.safeParse(data).success;
3032
- }`})]}),ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Runtime Validation"}),st("p",{className:"text-muted-foreground text-sm",children:"Use generated validation in your API handlers with zero boilerplate."}),st(lr,{language:"typescript",filename:"src/handlers/user-handler.ts",code:`import { validateUser } from '../generated/types/user';
3032
+ }`})]}),ja("div",{className:"space-y-3",children:[st("h2",{className:"font-bold text-2xl",children:"Runtime Validation"}),st("p",{className:"text-muted-foreground text-sm",children:"Use generated validation in your API handlers with zero boilerplate."}),st(dr,{language:"typescript",filename:"src/handlers/user-handler.ts",code:`import { validateUser } from '../generated/types/user';
3033
3033
 
3034
3034
  export async function createUserHandler(request: Request) {
3035
3035
  try {
@@ -3057,7 +3057,7 @@ export async function createUserHandler(request: Request) {
3057
3057
 
3058
3058
  throw error;
3059
3059
  }
3060
- }`})]})]}),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
+ }`})]})]}),ja("div",{className:"flex items-center gap-4 pt-4",children:[ja(Kn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",st(tm,{size:16})]}),st(Kn,{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 om}from"@contractspec/lib.content-gen/seo";import{CodeBlock as Qn}from"@contractspec/lib.design-system";import Yn from"@contractspec/lib.ui-link";import{ChevronRight as im}from"lucide-react";import{jsx as Wt,jsxs as mo}from"react/jsx-runtime";var iS=new om().optimize(gi);function rm(){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(Qn,{language:"typescript",filename:"src/contracts/user-management.feature.ts",code:`import { defineFeature } from '@contractspec/lib.contracts-spec/features';
3061
3061
  import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
3062
3062
  import { defineEvent } from '@contractspec/lib.contracts-spec/events';
3063
3063
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
@@ -3129,7 +3129,7 @@ export const UserManagementFeature = defineFeature({
3129
3129
  version: '1.0.0',
3130
3130
  description: 'Complete user management with operations and events',
3131
3131
  },
3132
- });`})]}),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
+ });`})]}),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(Qn,{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(Yn,{href:"/docs/guides/spec-validation-and-typing",className:"btn-primary",children:["Type Safety Guide ",Wt(im,{size:16})]}),Wt(Yn,{href:"/docs/intent/deterministic-codegen",className:"btn-ghost",children:"Deterministic Codegen"})]})]})}import Jn from"@contractspec/lib.ui-link";import{ChevronRight as nm}from"lucide-react";import{jsx as a,jsxs as c}from"react/jsx-runtime";function cm(){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 =
3133
3133
  | "canonical" // Internal ground truth
3134
3134
  | "operational" // Internal operational docs
3135
3135
  | "external" // Third-party reference
@@ -3213,7 +3213,7 @@ export const UserManagementFeature = defineFeature({
3213
3213
  "session:user-uploads",
3214
3214
  "session:form-drafts"
3215
3215
  ]
3216
- }`})})]}),a("div",{className:"card-subtle border-red-500/30 bg-red-500/10 p-3",children:c("p",{className:"text-red-300 text-sm",children:[a("strong",{children:"\u26A0\uFE0F Critical:"})," Ephemeral knowledge is never used for policy decisions, compliance checks, or any authoritative purpose."]})})]})]})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Category comparison"}),a("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:c("table",{className:"w-full text-left text-sm",children:[a("thead",{className:"bg-card/50",children:c("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:"Canonical"}),a("th",{className:"px-4 py-3 font-semibold",children:"Operational"}),a("th",{className:"px-4 py-3 font-semibold",children:"External"}),a("th",{className:"px-4 py-3 font-semibold",children:"Ephemeral"})]})}),c("tbody",{className:"divide-y divide-border/50",children:[c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Trust Level"}),a("td",{className:"px-4 py-3",children:"Highest"}),a("td",{className:"px-4 py-3",children:"High"}),a("td",{className:"px-4 py-3",children:"Medium"}),a("td",{className:"px-4 py-3",children:"Low"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Policy Impact"}),a("td",{className:"px-4 py-3",children:"\u2705 Can drive decisions"}),a("td",{className:"px-4 py-3",children:"\u26A0\uFE0F Can inform"}),a("td",{className:"px-4 py-3",children:"\u274C Reference only"}),a("td",{className:"px-4 py-3",children:"\u274C Never used"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Mutability"}),a("td",{className:"px-4 py-3",children:"Immutable"}),a("td",{className:"px-4 py-3",children:"Mutable"}),a("td",{className:"px-4 py-3",children:"Mutable"}),a("td",{className:"px-4 py-3",children:"Temporary"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Retention"}),a("td",{className:"px-4 py-3",children:"Permanent"}),a("td",{className:"px-4 py-3",children:"Long-term"}),a("td",{className:"px-4 py-3",children:"Long-term"}),a("td",{className:"px-4 py-3",children:"Short-term"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Audit Level"}),a("td",{className:"px-4 py-3",children:"Full audit"}),a("td",{className:"px-4 py-3",children:"Full audit"}),a("td",{className:"px-4 py-3",children:"Basic audit"}),a("td",{className:"px-4 py-3",children:"Minimal audit"})]})]})]})})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Best practices"}),c("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[a("li",{children:"Use canonical for anything that affects policy, pricing, or compliance"}),a("li",{children:"Use operational for context that helps but doesn't dictate decisions"}),a("li",{children:"Use external for reference material that's helpful but not authoritative"}),a("li",{children:"Use ephemeral for temporary working memory that shouldn't persist"}),a("li",{children:"Never mix categories in a single knowledge space - keep them separate"}),a("li",{children:"Document the category and purpose of each knowledge space clearly"})]})]}),c("div",{className:"flex items-center gap-4 pt-4",children:[a(Kn,{href:"/docs/knowledge",className:"btn-ghost",children:"Back to Knowledge"}),c(Kn,{href:"/docs/knowledge/spaces",className:"btn-primary",children:["Knowledge Spaces ",a(tm,{size:16})]})]})]})}import Qn from"@contractspec/lib.ui-link";import{jsx as Ge,jsxs as It}from"react/jsx-runtime";function om(){return It("div",{className:"space-y-8",children:[It("div",{className:"space-y-4",children:[Ge("h1",{className:"font-bold text-4xl",children:"Knowledge Examples"}),Ge("p",{className:"text-muted-foreground",children:"Real-world examples of how different applications use knowledge spaces to power intelligent workflows and agents."})]}),It("div",{className:"space-y-6",children:[It("div",{className:"space-y-4",children:[Ge("h2",{className:"font-bold text-2xl",children:"Example 1: ArtisanOS Support Agent"}),It("p",{className:"text-muted-foreground",children:[Ge("strong",{children:"Context:"})," ArtisanOS needs a support agent that can answer product questions using official documentation and learn from past support tickets."]}),Ge("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ge("pre",{children:`// Knowledge spaces
3216
+ }`})})]}),a("div",{className:"card-subtle border-red-500/30 bg-red-500/10 p-3",children:c("p",{className:"text-red-300 text-sm",children:[a("strong",{children:"\u26A0\uFE0F Critical:"})," Ephemeral knowledge is never used for policy decisions, compliance checks, or any authoritative purpose."]})})]})]})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Category comparison"}),a("div",{className:"overflow-x-auto rounded-lg border border-border/50",children:c("table",{className:"w-full text-left text-sm",children:[a("thead",{className:"bg-card/50",children:c("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:"Canonical"}),a("th",{className:"px-4 py-3 font-semibold",children:"Operational"}),a("th",{className:"px-4 py-3 font-semibold",children:"External"}),a("th",{className:"px-4 py-3 font-semibold",children:"Ephemeral"})]})}),c("tbody",{className:"divide-y divide-border/50",children:[c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Trust Level"}),a("td",{className:"px-4 py-3",children:"Highest"}),a("td",{className:"px-4 py-3",children:"High"}),a("td",{className:"px-4 py-3",children:"Medium"}),a("td",{className:"px-4 py-3",children:"Low"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Policy Impact"}),a("td",{className:"px-4 py-3",children:"\u2705 Can drive decisions"}),a("td",{className:"px-4 py-3",children:"\u26A0\uFE0F Can inform"}),a("td",{className:"px-4 py-3",children:"\u274C Reference only"}),a("td",{className:"px-4 py-3",children:"\u274C Never used"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Mutability"}),a("td",{className:"px-4 py-3",children:"Immutable"}),a("td",{className:"px-4 py-3",children:"Mutable"}),a("td",{className:"px-4 py-3",children:"Mutable"}),a("td",{className:"px-4 py-3",children:"Temporary"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Retention"}),a("td",{className:"px-4 py-3",children:"Permanent"}),a("td",{className:"px-4 py-3",children:"Long-term"}),a("td",{className:"px-4 py-3",children:"Long-term"}),a("td",{className:"px-4 py-3",children:"Short-term"})]}),c("tr",{children:[a("td",{className:"px-4 py-3 font-semibold",children:"Audit Level"}),a("td",{className:"px-4 py-3",children:"Full audit"}),a("td",{className:"px-4 py-3",children:"Full audit"}),a("td",{className:"px-4 py-3",children:"Basic audit"}),a("td",{className:"px-4 py-3",children:"Minimal audit"})]})]})]})})]}),c("div",{className:"space-y-4",children:[a("h2",{className:"font-bold text-2xl",children:"Best practices"}),c("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[a("li",{children:"Use canonical for anything that affects policy, pricing, or compliance"}),a("li",{children:"Use operational for context that helps but doesn't dictate decisions"}),a("li",{children:"Use external for reference material that's helpful but not authoritative"}),a("li",{children:"Use ephemeral for temporary working memory that shouldn't persist"}),a("li",{children:"Never mix categories in a single knowledge space - keep them separate"}),a("li",{children:"Document the category and purpose of each knowledge space clearly"})]})]}),c("div",{className:"flex items-center gap-4 pt-4",children:[a(Jn,{href:"/docs/knowledge",className:"btn-ghost",children:"Back to Knowledge"}),c(Jn,{href:"/docs/knowledge/spaces",className:"btn-primary",children:["Knowledge Spaces ",a(nm,{size:16})]})]})]})}import Zn from"@contractspec/lib.ui-link";import{jsx as Ge,jsxs as It}from"react/jsx-runtime";function lm(){return It("div",{className:"space-y-8",children:[It("div",{className:"space-y-4",children:[Ge("h1",{className:"font-bold text-4xl",children:"Knowledge Examples"}),Ge("p",{className:"text-muted-foreground",children:"Real-world examples of how different applications use knowledge spaces to power intelligent workflows and agents."})]}),It("div",{className:"space-y-6",children:[It("div",{className:"space-y-4",children:[Ge("h2",{className:"font-bold text-2xl",children:"Example 1: ArtisanOS Support Agent"}),It("p",{className:"text-muted-foreground",children:[Ge("strong",{children:"Context:"})," ArtisanOS needs a support agent that can answer product questions using official documentation and learn from past support tickets."]}),Ge("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:Ge("pre",{children:`// Knowledge spaces
3217
3217
  knowledgeSpaces: [
3218
3218
  {
3219
3219
  id: "product-canon",
@@ -3381,7 +3381,7 @@ steps:
3381
3381
  Question: \${input.question}
3382
3382
  Internal: \${steps.search-internal-guides.output.results}
3383
3383
  Stripe: \${steps.search-stripe-docs.output.results}
3384
- 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
+ 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(Zn,{href:"/docs/knowledge/sources",className:"btn-ghost",children:"Previous: Sources"}),Ge(Zn,{href:"/docs/architecture/knowledge-binding",className:"btn-ghost",children:"Knowledge Binding"})]})]})}import sm from"@contractspec/lib.ui-link";import{jsx as fa,jsxs as Ao}from"react/jsx-runtime";var dm=[{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 pm(){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:dm.map((e)=>Ao(sm,{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 Xn from"@contractspec/lib.ui-link";import{ChevronRight as mm}from"lucide-react";import{jsx as s,jsxs as x}from"react/jsx-runtime";function um(){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 = {
3385
3385
  id: string;
3386
3386
  tenantId: string;
3387
3387
  spaceId: string;
@@ -3451,7 +3451,7 @@ steps:
3451
3451
  syncPolicy: { manual: true }
3452
3452
  }
3453
3453
  ]
3454
- }`})})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"Processing pipeline"}),s("p",{className:"text-muted-foreground",children:"When a source is synced, ContractSpec processes it through several stages:"}),x("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[x("li",{children:[s("strong",{children:"Fetch"})," - Retrieve content from source (API, database, file)"]}),x("li",{children:[s("strong",{children:"Parse"})," - Extract text from documents (PDF, Word, HTML)"]}),x("li",{children:[s("strong",{children:"Chunk"})," - Split into semantic chunks (paragraphs, sections)"]}),x("li",{children:[s("strong",{children:"Embed"})," - Generate vector embeddings (OpenAI, Cohere)"]}),x("li",{children:[s("strong",{children:"Index"})," - Store in vector database (Qdrant) or search engine"]}),x("li",{children:[s("strong",{children:"Audit"})," - Log sync operation and results"]})]})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"Best practices"}),x("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[s("li",{children:"Use webhooks for real-time sources (Notion, Gmail) to minimize latency"}),s("li",{children:"Set appropriate sync intervals - hourly for active docs, daily for stable content"}),s("li",{children:"Monitor sync failures and set up alerts for critical sources"}),s("li",{children:"Test sources in sandbox before enabling in production"}),s("li",{children:"Document the purpose and ownership of each source for your team"}),s("li",{children:"Use manual sync for sensitive or infrequently updated content"})]})]}),x("div",{className:"flex items-center gap-4 pt-4",children:[s(Yn,{href:"/docs/knowledge/spaces",className:"btn-ghost",children:"Previous: Spaces"}),x(Yn,{href:"/docs/knowledge/examples",className:"btn-primary",children:["Examples ",s(cm,{size:16})]})]})]})}import Jn from"@contractspec/lib.ui-link";import{ChevronRight as sm}from"lucide-react";import{jsx as S,jsxs as ye}from"react/jsx-runtime";function dm(){return ye("div",{className:"space-y-8",children:[ye("div",{className:"space-y-4",children:[S("h1",{className:"font-bold text-4xl",children:"Knowledge Spaces"}),ye("p",{className:"text-muted-foreground",children:["A ",S("strong",{children:"KnowledgeSpaceSpec"})," defines a logical domain of knowledge with a specific category, storage strategy, and intended audience. Spaces are defined globally and populated per-tenant through knowledge sources."]})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"KnowledgeSpaceSpec"}),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 KnowledgeSpaceSpec = {
3454
+ }`})})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"Processing pipeline"}),s("p",{className:"text-muted-foreground",children:"When a source is synced, ContractSpec processes it through several stages:"}),x("ol",{className:"list-inside list-decimal space-y-3 text-muted-foreground",children:[x("li",{children:[s("strong",{children:"Fetch"})," - Retrieve content from source (API, database, file)"]}),x("li",{children:[s("strong",{children:"Parse"})," - Extract text from documents (PDF, Word, HTML)"]}),x("li",{children:[s("strong",{children:"Chunk"})," - Split into semantic chunks (paragraphs, sections)"]}),x("li",{children:[s("strong",{children:"Embed"})," - Generate vector embeddings (OpenAI, Cohere)"]}),x("li",{children:[s("strong",{children:"Index"})," - Store in vector database (Qdrant) or search engine"]}),x("li",{children:[s("strong",{children:"Audit"})," - Log sync operation and results"]})]})]}),x("div",{className:"space-y-4",children:[s("h2",{className:"font-bold text-2xl",children:"Best practices"}),x("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[s("li",{children:"Use webhooks for real-time sources (Notion, Gmail) to minimize latency"}),s("li",{children:"Set appropriate sync intervals - hourly for active docs, daily for stable content"}),s("li",{children:"Monitor sync failures and set up alerts for critical sources"}),s("li",{children:"Test sources in sandbox before enabling in production"}),s("li",{children:"Document the purpose and ownership of each source for your team"}),s("li",{children:"Use manual sync for sensitive or infrequently updated content"})]})]}),x("div",{className:"flex items-center gap-4 pt-4",children:[s(Xn,{href:"/docs/knowledge/spaces",className:"btn-ghost",children:"Previous: Spaces"}),x(Xn,{href:"/docs/knowledge/examples",className:"btn-primary",children:["Examples ",s(mm,{size:16})]})]})]})}import $n from"@contractspec/lib.ui-link";import{ChevronRight as gm}from"lucide-react";import{jsx as S,jsxs as ye}from"react/jsx-runtime";function hm(){return ye("div",{className:"space-y-8",children:[ye("div",{className:"space-y-4",children:[S("h1",{className:"font-bold text-4xl",children:"Knowledge Spaces"}),ye("p",{className:"text-muted-foreground",children:["A ",S("strong",{children:"KnowledgeSpaceSpec"})," defines a logical domain of knowledge with a specific category, storage strategy, and intended audience. Spaces are defined globally and populated per-tenant through knowledge sources."]})]}),ye("div",{className:"space-y-4",children:[S("h2",{className:"font-bold text-2xl",children:"KnowledgeSpaceSpec"}),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 KnowledgeSpaceSpec = {
3455
3455
  id: string;
3456
3456
  label: string;
3457
3457
  description: string;
@@ -3515,7 +3515,7 @@ steps:
3515
3515
  indexProvider: "qdrant",
3516
3516
  vectorDimensions: 1536,
3517
3517
  retentionPolicy: { days: 1 }
3518
- }`})}),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
+ }`})}),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($n,{href:"/docs/knowledge/categories",className:"btn-ghost",children:"Previous: Categories"}),ye($n,{href:"/docs/knowledge/sources",className:"btn-primary",children:["Knowledge Sources ",S(gm,{size:16})]})]})]})}import{CodeBlock as xn,InstallCommand as fm}from"@contractspec/lib.design-system";import jn from"@contractspec/lib.ui-link";import{ChevronRight as ym}from"lucide-react";import{jsx as Ce,jsxs as ht}from"react/jsx-runtime";function vm(){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(fm,{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(xn,{language:"tsx",code:`import {
3519
3519
  SRLiveRegionProvider,
3520
3520
  RouteAnnouncer,
3521
3521
  SkipLink
@@ -3535,7 +3535,7 @@ export function RootLayout({ children }) {
3535
3535
  </body>
3536
3536
  </html>
3537
3537
  );
3538
- }`})]}),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
+ }`})]}),ht("div",{className:"space-y-4",children:[Ce("h2",{className:"font-bold text-2xl",children:"Example: Live Announcements"}),Ce(xn,{language:"tsx",code:`import { useSRLiveRegion } from '@contractspec/lib.accessibility';
3539
3539
 
3540
3540
  export function TodoList() {
3541
3541
  const { announce } = useSRLiveRegion();
@@ -3546,7 +3546,7 @@ export function TodoList() {
3546
3546
  };
3547
3547
 
3548
3548
  return <button onClick={addTodo}>Add Todo</button>;
3549
- }`})]}),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
+ }`})]}),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(jn,{href:"/docs/libraries/design-system",className:"btn-ghost",children:"Previous: Design System"}),ht(jn,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ce(ym,{size:16})]})]})]})}import{CodeBlock as ec,InstallCommand as bm}from"@contractspec/lib.design-system";import tc from"@contractspec/lib.ui-link";import{ChevronRight as Nm}from"lucide-react";import{jsx as ft,jsxs as Oa}from"react/jsx-runtime";function wm(){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(bm,{package:"@contractspec/lib.ai-agent"})]}),Oa("div",{className:"space-y-3",children:[ft("h2",{className:"font-bold text-2xl",children:"Define & register"}),ft(ec,{language:"typescript",code:`import { defineAgent, AgentRegistry } from '@contractspec/lib.contracts-spec/agent';
3550
3550
 
3551
3551
  const SupportBot = defineAgent({
3552
3552
  meta: {
@@ -3565,7 +3565,7 @@ const SupportBot = defineAgent({
3565
3565
  },
3566
3566
  });
3567
3567
 
3568
- 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
+ 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(ec,{language:"typescript",code:`import { createUnifiedAgent, ApprovalWorkflow } from '@contractspec/lib.ai-agent';
3569
3569
 
3570
3570
  const approvals = new ApprovalWorkflow();
3571
3571
  const agent = createUnifiedAgent(SupportBot, {
@@ -3575,7 +3575,7 @@ const agent = createUnifiedAgent(SupportBot, {
3575
3575
 
3576
3576
  const result = await agent.run(ticket.body);
3577
3577
  // Route low-confidence or manual-review flows through approvals when needed.
3578
- `})]}),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
+ `})]}),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(tc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oa(tc,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",ft(Nm,{size:16})]})]})]})}import{CodeBlock as pr,InstallCommand as km}from"@contractspec/lib.design-system";import{jsx as eo,jsxs as ti}from"react/jsx-runtime";function Sm(){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(km,{package:"@contractspec/lib.analytics"})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Funnels in memory"}),eo(pr,{language:"typescript",code:`import { FunnelAnalyzer } from '@contractspec/lib.analytics/funnel';
3579
3579
 
3580
3580
  const analyzer = new FunnelAnalyzer();
3581
3581
  const report = analyzer.analyze(events, {
@@ -3585,16 +3585,16 @@ const report = analyzer.analyze(events, {
3585
3585
  { id: 'submit', eventName: 'signup.submit' },
3586
3586
  { id: 'verified', eventName: 'account.verified' },
3587
3587
  ],
3588
- });`})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Cohorts & churn"}),eo(sr,{language:"typescript",code:`import { CohortTracker } from '@contractspec/lib.analytics/cohort';
3588
+ });`})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Cohorts & churn"}),eo(pr,{language:"typescript",code:`import { CohortTracker } from '@contractspec/lib.analytics/cohort';
3589
3589
  import { ChurnPredictor } from '@contractspec/lib.analytics/churn';
3590
3590
 
3591
3591
  const cohorts = new CohortTracker().analyze(events, { bucket: 'week', periods: 8 });
3592
- const churn = new ChurnPredictor().score(events);`})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Growth hypotheses"}),eo(sr,{language:"typescript",code:`import { GrowthHypothesisGenerator } from '@contractspec/lib.analytics/growth';
3592
+ const churn = new ChurnPredictor().score(events);`})]}),ti("div",{className:"space-y-3",children:[eo("h2",{className:"font-bold text-2xl",children:"Growth hypotheses"}),eo(pr,{language:"typescript",code:`import { GrowthHypothesisGenerator } from '@contractspec/lib.analytics/growth';
3593
3593
 
3594
3594
  const ideas = new GrowthHypothesisGenerator().generate([
3595
3595
  { name: 'Activation rate', current: 0.42, previous: 0.55, target: 0.6 },
3596
3596
  { name: 'Expansion ARPU', current: 1.2, previous: 0.9 },
3597
- ]);`})]})]})}import{CodeBlock as bm,InstallCommand as Nm}from"@contractspec/lib.design-system";import jn from"@contractspec/lib.ui-link";import{ChevronRight as wm}from"lucide-react";import{jsx as Sa,jsxs as Ro}from"react/jsx-runtime";function km(){return Ro("div",{className:"space-y-8",children:[Ro("div",{className:"space-y-4",children:[Sa("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.content-gen"}),Sa("p",{className:"text-lg text-muted-foreground",children:"Feed a single ContentBrief and produce cohesive marketing assets without touching a CMS."})]}),Ro("div",{className:"space-y-4",children:[Sa("h2",{className:"font-bold text-2xl",children:"Installation"}),Sa(Nm,{package:"@contractspec/lib.content-gen"})]}),Ro("div",{className:"space-y-3",children:[Sa("h2",{className:"font-bold text-2xl",children:"One brief, many assets"}),Sa(bm,{language:"typescript",code:`import {
3597
+ ]);`})]})]})}import{CodeBlock as Cm,InstallCommand as Im}from"@contractspec/lib.design-system";import ac from"@contractspec/lib.ui-link";import{ChevronRight as Pm}from"lucide-react";import{jsx as Sa,jsxs as Ro}from"react/jsx-runtime";function Tm(){return Ro("div",{className:"space-y-8",children:[Ro("div",{className:"space-y-4",children:[Sa("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.content-gen"}),Sa("p",{className:"text-lg text-muted-foreground",children:"Feed a single ContentBrief and produce cohesive marketing assets without touching a CMS."})]}),Ro("div",{className:"space-y-4",children:[Sa("h2",{className:"font-bold text-2xl",children:"Installation"}),Sa(Im,{package:"@contractspec/lib.content-gen"})]}),Ro("div",{className:"space-y-3",children:[Sa("h2",{className:"font-bold text-2xl",children:"One brief, many assets"}),Sa(Cm,{language:"typescript",code:`import {
3598
3598
  BlogGenerator,
3599
3599
  LandingPageGenerator,
3600
3600
  EmailCampaignGenerator,
@@ -3614,7 +3614,7 @@ const blog = await new BlogGenerator().generate(brief);
3614
3614
  const landing = await new LandingPageGenerator().generate(brief);
3615
3615
  const email = await new EmailCampaignGenerator().generate({ brief, variant: 'announcement' });
3616
3616
  const social = await new SocialPostGenerator().generate(brief);
3617
- const seo = new SeoOptimizer().optimize(brief);`})]}),Ro("div",{className:"space-y-3",children:[Sa("h2",{className:"font-bold text-2xl",children:"When to use"}),Ro("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Sa("li",{children:"Ship landing page refreshes whenever specs change."}),Sa("li",{children:"Automate release emails + nurture sequences per vertical."}),Sa("li",{children:"Create social snippets that stay on-message with the same brief."}),Sa("li",{children:"Generate SEO metadata + Schema.org markup alongside content."})]})]}),Ro("div",{className:"flex items-center gap-4 pt-4",children:[Sa(jn,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Ro(jn,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",Sa(wm,{size:16})]})]})]})}import{CodeBlock as Sm,InstallCommand as Cm}from"@contractspec/lib.design-system";import dr from"@contractspec/lib.ui-link";import{ChevronRight as Im}from"lucide-react";import{jsx as F,jsxs as K}from"react/jsx-runtime";var Pm=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
3617
+ const seo = new SeoOptimizer().optimize(brief);`})]}),Ro("div",{className:"space-y-3",children:[Sa("h2",{className:"font-bold text-2xl",children:"When to use"}),Ro("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[Sa("li",{children:"Ship landing page refreshes whenever specs change."}),Sa("li",{children:"Automate release emails + nurture sequences per vertical."}),Sa("li",{children:"Create social snippets that stay on-message with the same brief."}),Sa("li",{children:"Generate SEO metadata + Schema.org markup alongside content."})]})]}),Ro("div",{className:"flex items-center gap-4 pt-4",children:[Sa(ac,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Ro(ac,{href:"/docs/libraries/support-bot",className:"btn-primary",children:["Next: Support Bot ",Sa(Pm,{size:16})]})]})]})}import{CodeBlock as Am,InstallCommand as Rm}from"@contractspec/lib.design-system";import mr from"@contractspec/lib.ui-link";import{ChevronRight as Lm}from"lucide-react";import{jsx as F,jsxs as K}from"react/jsx-runtime";var Em=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
3618
3618
  import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';
3619
3619
 
3620
3620
  export const DataGridShowcaseDataView = defineDataView({
@@ -3661,7 +3661,7 @@ export const DataGridShowcaseDataView = defineDataView({
3661
3661
  { key: 'notes', label: 'Notes', dataPath: 'notes' },
3662
3662
  ],
3663
3663
  },
3664
- });`;function Tm(){return K("div",{className:"space-y-8",children:[K("div",{className:"space-y-4",children:[F("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.contracts-spec"}),F("p",{className:"text-lg text-muted-foreground",children:"The core library for defining what your application can do. Unified specifications for Operations, Events, Presentations, and Features."})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Installation"}),F(Cm,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"What lives where"}),K("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-spec"})," (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-runtime-client-react"}),": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-runtime-server-rest"}),": HTTP/MCP adapters, registries, integrations (Node-only)."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.schema"}),": Schema dictionary (SchemaModel, FieldType) for I/O definitions."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Data table contract example"}),K("p",{className:"text-muted-foreground",children:["The canonical account-grid example starts here in"," ",F("code",{children:"@contractspec/lib.contracts-spec"}),". The contract declares table execution mode, selection, pinning, resizing, row expansion, and initial state before any renderer is chosen."]}),F(Sm,{language:"typescript",code:Pm}),K("p",{className:"text-muted-foreground text-sm",children:["See the live version in"," ",F(dr,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"/docs/examples/data-grid-showcase"}),"."]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),K("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"OperationSpec"}),": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."]}),K("li",{children:[F("strong",{children:"OperationSpecRegistry"}),": Registry of specs + handlers. Use ",F("code",{className:"font-mono text-xs",children:"installOp"})," ","to attach a handler."]}),K("li",{children:[F("strong",{children:"CapabilitySpec"}),": Canonical capability declaration (requires/provides)."]}),K("li",{children:[F("strong",{children:"PolicySpec"}),": Declarative policy rules (ABAC/ReBAC, rate limits)."]}),K("li",{children:[F("strong",{children:"TelemetrySpec"}),": Analytics definitions and privacy levels."]}),K("li",{children:[F("strong",{children:"PresentationSpec (V2)"}),": Describes how data is rendered (Web Components, Markdown, Data)."]}),K("li",{children:[F("strong",{children:"DataViewSpec"}),": Declarative list, table, grid, and detail contracts that the table showcase uses as its canonical account-grid example."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Lifecycle"}),K("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"Define"})," the spec (I/O via SchemaModel or Zod)."]}),K("li",{children:[F("strong",{children:"Register"})," it:"," ",F("code",{className:"font-mono text-xs",children:"installOp(registry, spec, handler)"}),"."]}),K("li",{children:[F("strong",{children:"Expose"})," it via an adapter (REST, GraphQL, MCP)."]}),K("li",{children:[F("strong",{children:"Validate"})," at runtime automatically."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Adapters"}),K("ul",{className:"space-y-2 text-muted-foreground",children:[K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/rest-next-app"}),": Next.js App Router adapter"]}),K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/provider-mcp"}),": Model Context Protocol (MCP) for AI agents"]}),K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/graphql-pothos"}),": GraphQL schema generator"]})]})]}),K("div",{className:"flex items-center gap-4 pt-4",children:[K(dr,{href:"/docs/libraries/schema",className:"btn-primary",children:["Next: Schema ",F(Im,{size:16})]}),F(dr,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Core Concepts"})]})]})}import{CodeBlock as ec,InstallCommand as Am}from"@contractspec/lib.design-system";import tc from"@contractspec/lib.ui-link";import{ChevronRight as Rm}from"lucide-react";import{jsx as Ma,jsxs as to}from"react/jsx-runtime";function Lm(){return to("div",{className:"space-y-8",children:[to("div",{className:"space-y-4",children:[Ma("h1",{className:"font-bold text-4xl",children:"Cost Tracking Library"}),to("p",{className:"text-lg text-muted-foreground",children:[Ma("code",{children:"@contractspec/lib.cost-tracking"})," transforms raw telemetry into dollars: DB/API/compute costs per operation, budget alerts per tenant, and actionable optimization tips."]})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Installation"}),Ma(Am,{package:"@contractspec/lib.cost-tracking"})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Record Samples"}),Ma(ec,{language:"typescript",code:`const tracker = new CostTracker();
3664
+ });`;function Dm(){return K("div",{className:"space-y-8",children:[K("div",{className:"space-y-4",children:[F("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.contracts-spec"}),F("p",{className:"text-lg text-muted-foreground",children:"The core library for defining what your application can do. Unified specifications for Operations, Events, Presentations, and Features."})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Installation"}),F(Rm,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.schema"]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"What lives where"}),K("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-spec"})," (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-runtime-client-react"}),": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.contracts-runtime-server-rest"}),": HTTP/MCP adapters, registries, integrations (Node-only)."]}),K("li",{children:[F("strong",{children:"@contractspec/lib.schema"}),": Schema dictionary (SchemaModel, FieldType) for I/O definitions."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Data table contract example"}),K("p",{className:"text-muted-foreground",children:["The canonical account-grid example starts here in"," ",F("code",{children:"@contractspec/lib.contracts-spec"}),". The contract declares table execution mode, selection, pinning, resizing, row expansion, and initial state before any renderer is chosen."]}),F(Am,{language:"typescript",code:Em}),K("p",{className:"text-muted-foreground text-sm",children:["See the live version in"," ",F(mr,{href:"/docs/examples/data-grid-showcase",className:"text-[color:var(--rust)] underline underline-offset-4",children:"/docs/examples/data-grid-showcase"}),"."]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Core Concepts"}),K("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"OperationSpec"}),": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."]}),K("li",{children:[F("strong",{children:"OperationSpecRegistry"}),": Registry of specs + handlers. Use ",F("code",{className:"font-mono text-xs",children:"installOp"})," ","to attach a handler."]}),K("li",{children:[F("strong",{children:"CapabilitySpec"}),": Canonical capability declaration (requires/provides)."]}),K("li",{children:[F("strong",{children:"PolicySpec"}),": Declarative policy rules (ABAC/ReBAC, rate limits)."]}),K("li",{children:[F("strong",{children:"TelemetrySpec"}),": Analytics definitions and privacy levels."]}),K("li",{children:[F("strong",{children:"PresentationSpec (V2)"}),": Describes how data is rendered (Web Components, Markdown, Data)."]}),K("li",{children:[F("strong",{children:"DataViewSpec"}),": Declarative list, table, grid, and detail contracts that the table showcase uses as its canonical account-grid example."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Lifecycle"}),K("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[K("li",{children:[F("strong",{children:"Define"})," the spec (I/O via SchemaModel or Zod)."]}),K("li",{children:[F("strong",{children:"Register"})," it:"," ",F("code",{className:"font-mono text-xs",children:"installOp(registry, spec, handler)"}),"."]}),K("li",{children:[F("strong",{children:"Expose"})," it via an adapter (REST, GraphQL, MCP)."]}),K("li",{children:[F("strong",{children:"Validate"})," at runtime automatically."]})]})]}),K("div",{className:"space-y-4",children:[F("h2",{className:"font-bold text-2xl",children:"Adapters"}),K("ul",{className:"space-y-2 text-muted-foreground",children:[K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/rest-next-app"}),": Next.js App Router adapter"]}),K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/provider-mcp"}),": Model Context Protocol (MCP) for AI agents"]}),K("li",{children:[F("code",{className:"rounded bg-background/50 px-2 py-1",children:"server/graphql-pothos"}),": GraphQL schema generator"]})]})]}),K("div",{className:"flex items-center gap-4 pt-4",children:[K(mr,{href:"/docs/libraries/schema",className:"btn-primary",children:["Next: Schema ",F(Lm,{size:16})]}),F(mr,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Core Concepts"})]})]})}import{CodeBlock as oc,InstallCommand as Om}from"@contractspec/lib.design-system";import ic from"@contractspec/lib.ui-link";import{ChevronRight as Mm}from"lucide-react";import{jsx as Ma,jsxs as to}from"react/jsx-runtime";function Bm(){return to("div",{className:"space-y-8",children:[to("div",{className:"space-y-4",children:[Ma("h1",{className:"font-bold text-4xl",children:"Cost Tracking Library"}),to("p",{className:"text-lg text-muted-foreground",children:[Ma("code",{children:"@contractspec/lib.cost-tracking"})," transforms raw telemetry into dollars: DB/API/compute costs per operation, budget alerts per tenant, and actionable optimization tips."]})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Installation"}),Ma(Om,{package:"@contractspec/lib.cost-tracking"})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Record Samples"}),Ma(oc,{language:"typescript",code:`const tracker = new CostTracker();
3665
3665
  tracker.recordSample({
3666
3666
  operation: 'orders.list',
3667
3667
  tenantId: 'acme',
@@ -3669,12 +3669,12 @@ tracker.recordSample({
3669
3669
  dbWrites: 4,
3670
3670
  computeMs: 180,
3671
3671
  externalCalls: [{ provider: 'stripe', cost: 0.02 }],
3672
- });`})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Budget Alerts"}),Ma(ec,{language:"typescript",code:`const budgets = new BudgetAlertManager({
3672
+ });`})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Budget Alerts"}),Ma(oc,{language:"typescript",code:`const budgets = new BudgetAlertManager({
3673
3673
  budgets: [{ tenantId: 'acme', monthlyLimit: 150 }],
3674
3674
  onAlert: ({ tenantId, total }) => notifyFinance(tenantId, total),
3675
3675
  });
3676
3676
 
3677
- tracker.getTotals({ tenantId: 'acme' }).forEach((summary) => budgets.track(summary));`})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Optimization Suggestions"}),to("p",{className:"text-muted-foreground text-sm",children:["Feed summaries into ",Ma("code",{children:"OptimizationRecommender"})," to surface N+1 queries, compute-heavy steps, or expensive external calls. Store the generated suggestions in the new Prisma model to power Ops playbooks."]})]}),to("div",{className:"flex items-center gap-4 pt-4",children:[Ma(tc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),to(tc,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",Ma(Rm,{size:16})]})]})]})}var ac=[{title:"@contractspec/lib.presentation-runtime-core",body:"Shared state, table models, workflow logic, visualization helpers, and the alias helpers consumed by web and native builds."},{title:"@contractspec/lib.presentation-runtime-react",body:"React-facing hooks such as useContractTable, useDataViewTable, and useWorkflow. This is the shared hook surface most product code starts from."},{title:"@contractspec/lib.presentation-runtime-react-native",body:"Native entrypoint for mobile apps. It re-exports the shared table and data-view hooks so the controller API stays aligned with the React package."},{title:"@contractspec/lib.ui-kit-web",body:"Browser-first primitives and accessibility helpers. Reach for this layer when you want direct control over the web renderer."},{title:"@contractspec/lib.ui-kit",body:"Native-first primitives for Expo and React Native. Reach for this layer when the render surface should stay mobile-native."},{title:"@contractspec/lib.design-system",body:"Composed components, ThemeSpec/TranslationSpec-aware controls, token helpers, and paired web/mobile implementations that sit on top of both UI kits."}],oc=[{title:"useContractTable",body:"Use this when your rows and column definitions already live in product code and you want one headless controller for sorting, pagination, selection, visibility, pinning, sizing, and expansion."},{title:"useDataViewTable",body:"Use this when the table should stay driven by a DataViewSpec instead of hand-authored columns. It adapts the spec to the same generic controller model."},{title:"Native re-export boundary",body:"On native apps, import the same hook names from @contractspec/lib.presentation-runtime-react-native when you want the import path itself to signal a mobile boundary."}],ic=[{title:"Next.js / Turbopack",body:"Use withPresentationTurbopackAliases as the default path in current Next.js apps. It patches nextConfig.turbopack instead of mutating a webpack config object."},{title:"Next.js / Webpack fallback",body:"Use withPresentationWebpackAliases only when a Next.js app explicitly opts back into webpack via the CLI flags."},{title:"Expo / Metro",body:"Use withPresentationMetroAliases on Metro when native platforms should resolve web ui-kit /ui imports and the shared React runtime root to native implementations."}],rc=[{title:"withPlatformUI",body:"Use this lightweight adapter when a design-system surface needs one object that carries the current platform, tokens, and breakpoints."},{title:"mapTokensForPlatform",body:"Use this when resolved tokens need to be mapped into platform-specific token shapes before the final renderer consumes them."}],nc=[{title:"What Webpack remaps",items:["@contractspec/lib.ui-kit -> @contractspec/lib.ui-kit-web","@contractspec/lib.presentation-runtime-react-native -> @contractspec/lib.presentation-runtime-react","Prepends .web.js, .web.jsx, .web.ts, and .web.tsx to webpack resolve.extensions"]},{title:"What Turbopack remaps",items:["@contractspec/lib.ui-kit -> @contractspec/lib.ui-kit-web","@contractspec/lib.presentation-runtime-react-native -> @contractspec/lib.presentation-runtime-react","Initializes or merges turbopack.resolveExtensions with a web-first extension list"]},{title:"What Metro remaps",items:["@contractspec/lib.ui-kit-web/ui/* -> @contractspec/lib.ui-kit/ui/* on ios/android/native/mobile","Root @contractspec/lib.presentation-runtime-react -> @contractspec/lib.presentation-runtime-react-native","Enables package exports and expands platform resolution ordering"]}],cc=["Set gap, align, justify, and wrap explicitly in shared code because defaults are not identical between web and native.","Shared-safe subset: VStack, HStack, and Box with className, gap, align, justify, and wrap.","Web-only feature: as lets stack primitives emit semantic elements such as section, header, main, or article.","Native-only extras: spacing, width, and padding exist on the native stack primitives and should stay out of shared renderer code.","HStack and Box reverse-wrap tokens differ: wrapReverse on web, reverse on native. Prefer nowrap or wrap in shared code.","Box defaults to nowrap on web and wrap on native, so shared code should set wrap intentionally."],lc=["withPresentationNextAliases no longer exists. Use withPresentationTurbopackAliases for the default Next.js path or withPresentationWebpackAliases for explicit webpack fallback.","Prefer root runtime imports when alias helpers matter. Metro remaps the root @contractspec/lib.presentation-runtime-react package, not arbitrary deep hook subpaths.","Metro only rewrites @contractspec/lib.ui-kit-web/ui/* imports. Router-specific web packages and other web-only helpers still need platform-aware imports.","presentation-runtime-core is headless. It owns models and config helpers, not rendered React components.","design-system compatibility comes from paired .tsx / .mobile.tsx implementations and token helpers such as withPlatformUI and mapTokensForPlatform.","Form controls should come from @contractspec/lib.design-system when product code needs ThemeSpec or TranslationSpec support.","Stack primitives are similar across platforms, but the prop surface is not identical. Stay inside the common subset for shared renderers.","Alias helpers solve module resolution only. They do not replace app-level monorepo watchFolders, Expo Router setup, or other Next configuration."],sc="Copy these markdown snippets into your own AGENTS.md, LLM guide, README, or engineering playbook when you want to enforce the same cross-surface rules across customer projects.",dc=`import { withPresentationTurbopackAliases } from '@contractspec/lib.presentation-runtime-core';
3677
+ tracker.getTotals({ tenantId: 'acme' }).forEach((summary) => budgets.track(summary));`})]}),to("div",{className:"space-y-4",children:[Ma("h2",{className:"font-bold text-2xl",children:"Optimization Suggestions"}),to("p",{className:"text-muted-foreground text-sm",children:["Feed summaries into ",Ma("code",{children:"OptimizationRecommender"})," to surface N+1 queries, compute-heavy steps, or expensive external calls. Store the generated suggestions in the new Prisma model to power Ops playbooks."]})]}),to("div",{className:"flex items-center gap-4 pt-4",children:[Ma(ic,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),to(ic,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",Ma(Mm,{size:16})]})]})]})}var rc=[{title:"@contractspec/lib.presentation-runtime-core",body:"Shared state, table models, workflow logic, visualization helpers, and the alias helpers consumed by web and native builds."},{title:"@contractspec/lib.presentation-runtime-react",body:"React-facing hooks such as useContractTable, useDataViewTable, and useWorkflow. This is the shared hook surface most product code starts from."},{title:"@contractspec/lib.presentation-runtime-react-native",body:"Native entrypoint for mobile apps. It re-exports the shared table and data-view hooks so the controller API stays aligned with the React package."},{title:"@contractspec/lib.ui-kit-web",body:"Browser-first primitives and accessibility helpers. Reach for this layer when you want direct control over the web renderer."},{title:"@contractspec/lib.ui-kit",body:"Native-first primitives for Expo and React Native. Reach for this layer when the render surface should stay mobile-native."},{title:"@contractspec/lib.design-system",body:"Composed components, ThemeSpec/TranslationSpec-aware controls, token helpers, and paired web/mobile implementations that sit on top of both UI kits."}],nc=[{title:"useContractTable",body:"Use this when your rows and column definitions already live in product code and you want one headless controller for sorting, pagination, selection, visibility, pinning, sizing, and expansion."},{title:"useDataViewTable",body:"Use this when the table should stay driven by a DataViewSpec instead of hand-authored columns. It adapts the spec to the same generic controller model."},{title:"Native re-export boundary",body:"On native apps, import the same hook names from @contractspec/lib.presentation-runtime-react-native when you want the import path itself to signal a mobile boundary."}],cc=[{title:"Next.js / Turbopack",body:"Use withPresentationTurbopackAliases as the default path in current Next.js apps. It patches nextConfig.turbopack instead of mutating a webpack config object."},{title:"Next.js / Webpack fallback",body:"Use withPresentationWebpackAliases only when a Next.js app explicitly opts back into webpack via the CLI flags."},{title:"Expo / Metro",body:"Use withPresentationMetroAliases on Metro when native platforms should resolve web ui-kit /ui imports and the shared React runtime root to native implementations."}],lc=[{title:"withPlatformUI",body:"Use this lightweight adapter when a design-system surface needs one object that carries the current platform, tokens, and breakpoints."},{title:"mapTokensForPlatform",body:"Use this when resolved tokens need to be mapped into platform-specific token shapes before the final renderer consumes them."}],sc=[{title:"What Webpack remaps",items:["@contractspec/lib.ui-kit -> @contractspec/lib.ui-kit-web","@contractspec/lib.presentation-runtime-react-native -> @contractspec/lib.presentation-runtime-react","Prepends .web.js, .web.jsx, .web.ts, and .web.tsx to webpack resolve.extensions"]},{title:"What Turbopack remaps",items:["@contractspec/lib.ui-kit -> @contractspec/lib.ui-kit-web","@contractspec/lib.presentation-runtime-react-native -> @contractspec/lib.presentation-runtime-react","Initializes or merges turbopack.resolveExtensions with a web-first extension list"]},{title:"What Metro remaps",items:["@contractspec/lib.ui-kit-web/ui/* -> @contractspec/lib.ui-kit/ui/* on ios/android/native/mobile","Root @contractspec/lib.presentation-runtime-react -> @contractspec/lib.presentation-runtime-react-native","Enables package exports and expands platform resolution ordering"]}],dc=["Set gap, align, justify, and wrap explicitly in shared code because defaults are not identical between web and native.","Shared-safe subset: VStack, HStack, and Box with className, gap, align, justify, and wrap.","Web-only feature: as lets stack primitives emit semantic elements such as section, header, main, or article.","Native-only extras: spacing, width, and padding exist on the native stack primitives and should stay out of shared renderer code.","HStack and Box reverse-wrap tokens differ: wrapReverse on web, reverse on native. Prefer nowrap or wrap in shared code.","Box defaults to nowrap on web and wrap on native, so shared code should set wrap intentionally."],pc=["withPresentationNextAliases no longer exists. Use withPresentationTurbopackAliases for the default Next.js path or withPresentationWebpackAliases for explicit webpack fallback.","Prefer root runtime imports when alias helpers matter. Metro remaps the root @contractspec/lib.presentation-runtime-react package, not arbitrary deep hook subpaths.","Metro only rewrites @contractspec/lib.ui-kit-web/ui/* imports. Router-specific web packages and other web-only helpers still need platform-aware imports.","presentation-runtime-core is headless. It owns models and config helpers, not rendered React components.","design-system compatibility comes from paired .tsx / .native.tsx implementations and token helpers such as withPlatformUI and mapTokensForPlatform.","Form controls should come from @contractspec/lib.design-system when product code needs ThemeSpec or TranslationSpec support.","Stack primitives are similar across platforms, but the prop surface is not identical. Stay inside the common subset for shared renderers.","Alias helpers solve module resolution only. They do not replace app-level monorepo watchFolders, Expo Router setup, or other Next configuration."],mc="Copy these markdown snippets into your own AGENTS.md, LLM guide, README, or engineering playbook when you want to enforce the same cross-surface rules across customer projects.",uc=`import { withPresentationTurbopackAliases } from '@contractspec/lib.presentation-runtime-core';
3678
3678
 
3679
3679
  /** @type {import('next').NextConfig} */
3680
3680
  const nextConfig = withPresentationTurbopackAliases({
@@ -3685,14 +3685,14 @@ const nextConfig = withPresentationTurbopackAliases({
3685
3685
  },
3686
3686
  });
3687
3687
 
3688
- export default nextConfig;`,pc=`import { withPresentationWebpackAliases } from '@contractspec/lib.presentation-runtime-core';
3688
+ export default nextConfig;`,gc=`import { withPresentationWebpackAliases } from '@contractspec/lib.presentation-runtime-core';
3689
3689
 
3690
3690
  /** @type {import('next').NextConfig} */
3691
3691
  const nextConfig = {
3692
3692
  webpack: (config) => withPresentationWebpackAliases(config),
3693
3693
  };
3694
3694
 
3695
- export default nextConfig;`,mc=`const { getDefaultConfig } = require('expo/metro-config');
3695
+ export default nextConfig;`,hc=`const { getDefaultConfig } = require('expo/metro-config');
3696
3696
  const {
3697
3697
  withPresentationMetroAliases,
3698
3698
  } = require('@contractspec/lib.presentation-runtime-core');
@@ -3700,8 +3700,8 @@ const {
3700
3700
  const projectRoot = __dirname;
3701
3701
  const config = getDefaultConfig(projectRoot);
3702
3702
 
3703
- module.exports = withPresentationMetroAliases(config);`,uc=["import {"," defaultTokens,"," mapTokensForPlatform,"," withPlatformUI,","} from '@contractspec/lib.design-system';","","const nativeTokens = mapTokensForPlatform('native', defaultTokens);","","const ui = withPlatformUI({"," tokens: defaultTokens,"," platform: 'web',","});","","// ui is a lightweight config object for design-system consumers.","// nativeTokens is the mapped token shape for a native renderer."].join(`
3704
- `),gc=`import { Box, HStack, VStack } from '@contractspec/lib.ui-kit-web/ui/stack';
3703
+ module.exports = withPresentationMetroAliases(config);`,fc=["import {"," defaultTokens,"," mapTokensForPlatform,"," withPlatformUI,","} from '@contractspec/lib.design-system';","","const nativeTokens = mapTokensForPlatform('native', defaultTokens);","","const ui = withPlatformUI({"," tokens: defaultTokens,"," platform: 'web',","});","","// ui is a lightweight config object for design-system consumers.","// nativeTokens is the mapped token shape for a native renderer."].join(`
3704
+ `),yc=`import { Box, HStack, VStack } from '@contractspec/lib.ui-kit-web/ui/stack';
3705
3705
 
3706
3706
  export function AccountSummaryHeader() {
3707
3707
  return (
@@ -3722,7 +3722,7 @@ export function AccountSummaryHeader() {
3722
3722
  // @contractspec/lib.ui-kit/ui/stack
3723
3723
  //
3724
3724
  // On web-only pages, VStack / HStack / Box also support:
3725
- // <VStack as="section">...</VStack>`,hc=`import { DataTable as DesignSystemTable } from '@contractspec/lib.design-system';
3725
+ // <VStack as="section">...</VStack>`,vc=`import { DataTable as DesignSystemTable } from '@contractspec/lib.design-system';
3726
3726
  import { DataTable as NativeTable } from '@contractspec/lib.ui-kit/ui/data-table';
3727
3727
  import { DataTable as WebTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
3728
3728
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
@@ -3758,7 +3758,7 @@ export function ProductAccounts({ controller }) {
3758
3758
  }
3759
3759
 
3760
3760
  // If the table is spec-driven instead of hand-authored,
3761
- // 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 \u201Cweb\u201D and \u201Cnative\u201D 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
+ // swap useContractTable for useDataViewTable.`,bc="# 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` / `.native.tsx` pairs as the standard design-system compatibility boundary.",Nc="# 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` / `.native.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 Um}from"lucide-react";import{jsx as h,jsxs as qe}from"react/jsx-runtime";function Wm(){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:rc.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:nc.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:lc.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:fc})]})]}),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 \u201Cweb\u201D and \u201Cnative\u201D 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:cc.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:uc}),h(Lo,{language:"typescript",filename:"next.config.mjs",code:gc}),h(Lo,{language:"javascript",filename:"metro.config.js",code:hc})]})]}),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:sc.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:dc.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:yc})]}),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:vc}),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:pc.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:mc}),qe("div",{className:"grid gap-4 xl:grid-cols-2",children:[h(Lo,{language:"markdown",filename:"cross-surface-policy.md",code:bc}),h(Lo,{language:"markdown",filename:"cross-surface-checklist.md",code:Nc})]})]}),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(Um,{size:16})]})]})]})}import{CodeBlock as _m}from"@contractspec/lib.design-system";import wc from"@contractspec/lib.ui-link";import{ChevronRight as zm}from"lucide-react";import{jsx as Pt,jsxs as Tt}from"react/jsx-runtime";function Gm(){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(_m,{language:"typescript",code:`import { logger } from '@contractspec/lib.logger';
3762
3762
  import { AppError } from '@contractspec/lib.error';
3763
3763
  import { db } from '@contractspec/app.cli-database';
3764
3764
  import { EventBus } from '@contractspec/lib.bus';
@@ -3776,7 +3776,7 @@ export async function createUser(email: string) {
3776
3776
  await EventBus.publish('user.created', { userId: user.id });
3777
3777
 
3778
3778
  return user;
3779
- }`})]}),Tt("div",{className:"flex items-center gap-4 pt-4",children:[Tt(vc,{href:"/docs/libraries/runtime",className:"btn-primary",children:["Next: Runtime ",Pt(Mm,{size:16})]}),Pt(vc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as bc,InstallCommand as Um}from"@contractspec/lib.design-system";import Nc from"@contractspec/lib.ui-link";import{ChevronRight as Wm}from"lucide-react";import{jsx as De,jsxs as _t}from"react/jsx-runtime";function _m(){return _t("div",{className:"space-y-8",children:[_t("div",{className:"space-y-4",children:[De("h1",{className:"font-bold text-4xl",children:"DataViews Runtime Library"}),_t("p",{className:"text-lg text-muted-foreground",children:["The ",De("code",{children:"@contractspec/lib.contracts-spec/data-views"})," and"," ",De("code",{children:"@contractspec/lib.design-system"})," libraries provide the runtime logic and UI components to render DataViews in your application."]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"Installation"}),De(Um,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.design-system"]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"DataViewRenderer"}),De("p",{className:"text-muted-foreground",children:"The primary component for rendering any DataView. It automatically selects the correct layout (List, Table, Grid, Detail) based on the spec."}),De(bc,{language:"tsx",code:`import { DataViewRenderer } from '@contractspec/lib.design-system';
3779
+ }`})]}),Tt("div",{className:"flex items-center gap-4 pt-4",children:[Tt(wc,{href:"/docs/libraries/runtime",className:"btn-primary",children:["Next: Runtime ",Pt(zm,{size:16})]}),Pt(wc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as kc,InstallCommand as qm}from"@contractspec/lib.design-system";import Sc from"@contractspec/lib.ui-link";import{ChevronRight as Vm}from"lucide-react";import{jsx as De,jsxs as _t}from"react/jsx-runtime";function Hm(){return _t("div",{className:"space-y-8",children:[_t("div",{className:"space-y-4",children:[De("h1",{className:"font-bold text-4xl",children:"DataViews Runtime Library"}),_t("p",{className:"text-lg text-muted-foreground",children:["The ",De("code",{children:"@contractspec/lib.contracts-spec/data-views"})," and"," ",De("code",{children:"@contractspec/lib.design-system"})," libraries provide the runtime logic and UI components to render DataViews in your application."]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"Installation"}),De(qm,{package:["@contractspec/lib.contracts-spec","@contractspec/lib.design-system"]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"DataViewRenderer"}),De("p",{className:"text-muted-foreground",children:"The primary component for rendering any DataView. It automatically selects the correct layout (List, Table, Grid, Detail) based on the spec."}),De(kc,{language:"tsx",code:`import { DataViewRenderer } from '@contractspec/lib.design-system';
3780
3780
  import { MyUserList } from './specs/users.data-view';
3781
3781
 
3782
3782
  export function UserPage() {
@@ -3788,7 +3788,7 @@ export function UserPage() {
3788
3788
  onPageChange={(page) => fetchPage(page)}
3789
3789
  />
3790
3790
  );
3791
- }`}),De("h3",{className:"font-semibold text-xl",children:"Props"}),_t("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[_t("li",{children:[De("code",{children:"spec"}),": The DataViewSpec definition."]}),_t("li",{children:[De("code",{children:"items"}),": Array of data items to render."]}),_t("li",{children:[De("code",{children:"filters"}),": Current filter state object."]}),_t("li",{children:[De("code",{children:"onFilterChange"}),": Callback when filters change."]}),_t("li",{children:[De("code",{children:"pagination"}),": Object with ",De("code",{children:"page"}),","," ",De("code",{children:"pageSize"}),", ",De("code",{children:"total"}),"."]}),_t("li",{children:[De("code",{children:"onPageChange"}),": Callback when page changes."]})]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"Query Generation"}),_t("p",{className:"text-muted-foreground",children:["The ",De("code",{children:"DataViewQueryGenerator"})," utility helps translate DataView parameters (filters, sorting, pagination) into query arguments for your backend."]}),De(bc,{language:"typescript",code:`import { DataViewQueryGenerator } from '@contractspec/lib.contracts-spec/data-views/query-generator';
3791
+ }`}),De("h3",{className:"font-semibold text-xl",children:"Props"}),_t("ul",{className:"list-disc space-y-2 pl-6 text-muted-foreground",children:[_t("li",{children:[De("code",{children:"spec"}),": The DataViewSpec definition."]}),_t("li",{children:[De("code",{children:"items"}),": Array of data items to render."]}),_t("li",{children:[De("code",{children:"filters"}),": Current filter state object."]}),_t("li",{children:[De("code",{children:"onFilterChange"}),": Callback when filters change."]}),_t("li",{children:[De("code",{children:"pagination"}),": Object with ",De("code",{children:"page"}),","," ",De("code",{children:"pageSize"}),", ",De("code",{children:"total"}),"."]}),_t("li",{children:[De("code",{children:"onPageChange"}),": Callback when page changes."]})]})]}),_t("div",{className:"space-y-4",children:[De("h2",{className:"font-bold text-2xl",children:"Query Generation"}),_t("p",{className:"text-muted-foreground",children:["The ",De("code",{children:"DataViewQueryGenerator"})," utility helps translate DataView parameters (filters, sorting, pagination) into query arguments for your backend."]}),De(kc,{language:"typescript",code:`import { DataViewQueryGenerator } from '@contractspec/lib.contracts-spec/data-views/query-generator';
3792
3792
 
3793
3793
  const generator = new DataViewQueryGenerator(MyUserList);
3794
3794
  const query = generator.generate({
@@ -3796,7 +3796,7 @@ const query = generator.generate({
3796
3796
  filters: { role: 'admin' }
3797
3797
  });
3798
3798
 
3799
- // 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
+ // query.input contains { skip: 0, take: 20, role: 'admin' }`})]}),_t("div",{className:"flex items-center gap-4 pt-4",children:[De(Sc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),_t(Sc,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",De(Vm,{size:16})]})]})]})}import{CodeBlock as ur,InstallCommand as Fm}from"@contractspec/lib.design-system";import Di from"@contractspec/lib.ui-link";import{ChevronRight as Km}from"lucide-react";import{jsx as C,jsxs as X}from"react/jsx-runtime";var Qm=`import { Button, DataTable } from '@contractspec/lib.design-system';
3800
3800
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
3801
3801
 
3802
3802
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -3844,7 +3844,7 @@ export function AccountHealthTable() {
3844
3844
  footer={\`Page \${controller.pageIndex + 1} of \${controller.pageCount}\`}
3845
3845
  />
3846
3846
  );
3847
- }`,Vm=`import {
3847
+ }`,Ym=`import {
3848
3848
  DesignSystemThemeProvider,
3849
3849
  resolveThemeModeTokens,
3850
3850
  themeSpecToCssVariables,
@@ -3874,13 +3874,13 @@ export function TenantSurface({ children }: { children: React.ReactNode }) {
3874
3874
  {children}
3875
3875
  </DesignSystemThemeProvider>
3876
3876
  );
3877
- }`,Hm=`import { themeSpecToTailwindPreset } from '@contractspec/lib.design-system/theme';
3877
+ }`,Jm=`import { themeSpecToTailwindPreset } from '@contractspec/lib.design-system/theme';
3878
3878
  import { Select } from '@contractspec/lib.design-system/controls';
3879
3879
  import { FormDialog } from '@contractspec/lib.design-system/forms';
3880
3880
  import { HStack } from '@contractspec/lib.design-system/layout';
3881
3881
 
3882
3882
  // Root imports remain supported:
3883
- 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
+ import { Button, DataTable } from '@contractspec/lib.design-system';`;function Zm(){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(Fm,{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(ur,{language:"tsx",code:Ym})]}),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(ur,{language:"tsx",code:Jm})]}),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(ur,{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(Km,{size:16})]})]})]})}import{CodeBlock as gr,InstallCommand as Xm}from"@contractspec/lib.design-system";import Cc from"@contractspec/lib.ui-link";import{ChevronRight as $m}from"lucide-react";import{jsx as ea,jsxs as uo}from"react/jsx-runtime";function xm(){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(Xm,{package:"@contractspec/lib.evolution"})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"From telemetry to intent"}),ea(gr,{language:"typescript",code:`import { SpecAnalyzer } from '@contractspec/lib.evolution/analyzer';
3884
3884
  import { EvolutionPipeline } from '@contractspec/lib.observability';
3885
3885
 
3886
3886
  const analyzer = new SpecAnalyzer();
@@ -3895,7 +3895,7 @@ pipeline.ingest({
3895
3895
  success: false,
3896
3896
  timestamp: new Date(),
3897
3897
  errorCode: 'VALIDATION_FAILED',
3898
- });`})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"Generate & approve suggestions"}),ea(mr,{language:"typescript",code:`import {
3898
+ });`})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"Generate & approve suggestions"}),ea(gr,{language:"typescript",code:`import {
3899
3899
  SpecGenerator,
3900
3900
  SpecSuggestionOrchestrator,
3901
3901
  InMemorySpecSuggestionRepository,
@@ -3909,7 +3909,7 @@ const suggestion = generator.generateFromIntent(intentPattern, {
3909
3909
  summary: 'Add PO number requirement for acme.corp',
3910
3910
  });
3911
3911
 
3912
- await orchestrator.submit(suggestion, sessionState);`})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"Write approved specs back to git"}),ea(mr,{language:"typescript",code:`import { FileSystemSuggestionWriter } from '@contractspec/lib.evolution/approval';
3912
+ await orchestrator.submit(suggestion, sessionState);`})]}),uo("div",{className:"space-y-3",children:[ea("h2",{className:"font-bold text-2xl",children:"Write approved specs back to git"}),ea(gr,{language:"typescript",code:`import { FileSystemSuggestionWriter } from '@contractspec/lib.evolution/approval';
3913
3913
 
3914
3914
  const writer = new FileSystemSuggestionWriter({
3915
3915
  outputDir:
@@ -3920,7 +3920,7 @@ await writer.write({
3920
3920
  ...suggestion,
3921
3921
  status: 'approved',
3922
3922
  approvals: { reviewer: 'ops@contractspec', decidedAt: new Date() },
3923
- });`})]}),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
+ });`})]}),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(Cc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),uo(Cc,{href:"/docs/libraries/observability",className:"btn-primary",children:["Next: Observability ",ea($m,{size:16})]})]})]})}import{CodeBlock as jm,InstallCommand as eu}from"@contractspec/lib.design-system";import Ic from"@contractspec/lib.ui-link";import{ChevronRight as tu}from"lucide-react";import{jsx as et,jsxs as zt}from"react/jsx-runtime";function au(){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(eu,{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';
3924
3924
  import { registerContractsOnBuilder } from '@contractspec/lib.contracts-runtime-server-graphql/graphql-pothos';
3925
3925
  import { OperationSpecRegistry } from '@contractspec/lib.contracts-spec';
3926
3926
  import { MySpecs } from './specs';
@@ -3934,7 +3934,7 @@ registerContractsOnBuilder(builder, registry);
3934
3934
 
3935
3935
  // 3. Build and print schema
3936
3936
  const schema = builder.toSchema();
3937
- 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
+ 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(Ic,{href:"/docs/libraries/data-backend",className:"btn-primary",children:["Next: Data & Backend ",et(tu,{size:16})]}),et(Ic,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"})]})]})}import{CodeBlock as Pc,InstallCommand as ou}from"@contractspec/lib.design-system";import Tc from"@contractspec/lib.ui-link";import{ChevronRight as iu}from"lucide-react";import{jsx as ao,jsxs as qo}from"react/jsx-runtime";function ru(){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(ou,{package:"@contractspec/lib.growth"})]}),qo("div",{className:"space-y-3",children:[ao("h2",{className:"font-bold text-2xl",children:"Register + assign"}),ao(Pc,{language:"typescript",code:`import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';
3938
3938
 
3939
3939
  const registry = new ExperimentRegistry().register({
3940
3940
  key: 'pricing.cta',
@@ -3948,7 +3948,7 @@ const registry = new ExperimentRegistry().register({
3948
3948
  });
3949
3949
 
3950
3950
  const runner = new ExperimentRunner();
3951
- 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
+ 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(Pc,{language:"typescript",code:`import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
3952
3952
  import { StatsEngine } from '@contractspec/lib.growth/stats';
3953
3953
 
3954
3954
  const tracker = new ExperimentTracker(new InMemoryTrackerStore());
@@ -3964,11 +3964,11 @@ await tracker.recordSample({
3964
3964
  const stats = new StatsEngine().summarize(
3965
3965
  await tracker.getSamples(assignment.experimentKey, 'demo_booked'),
3966
3966
  'demo_booked'
3967
- );`})]}),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
+ );`})]}),qo("div",{className:"flex items-center gap-4 pt-4",children:[ao(Tc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),qo(Tc,{href:"/docs/libraries/analytics",className:"btn-primary",children:["Next: Analytics ",ao(iu,{size:16})]})]})]})}import{CodeBlock as Ac,InstallCommand as nu}from"@contractspec/lib.design-system";import Rc from"@contractspec/lib.ui-link";import{ChevronRight as cu}from"lucide-react";import{jsx as Ba,jsxs as go}from"react/jsx-runtime";function lu(){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(nu,{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(Ac,{language:"typescript",code:`import { createRlsMiddleware } from '@contractspec/lib.multi-tenancy/rls';
3968
3968
  import { prisma } from './db';
3969
3969
  import { getTenantId } from './context';
3970
3970
 
3971
- prisma.$use(createRlsMiddleware(() => getTenantId()));`})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Provisioning Service"}),Ba("p",{className:"text-muted-foreground",children:"Automates the creation of new tenants, including database setup and default user creation."}),Ba(Ic,{language:"typescript",code:`import { TenantProvisioningService } from '@contractspec/lib.multi-tenancy/provisioning';
3971
+ prisma.$use(createRlsMiddleware(() => getTenantId()));`})]}),go("div",{className:"space-y-4",children:[Ba("h2",{className:"font-bold text-2xl",children:"Provisioning Service"}),Ba("p",{className:"text-muted-foreground",children:"Automates the creation of new tenants, including database setup and default user creation."}),Ba(Ac,{language:"typescript",code:`import { TenantProvisioningService } from '@contractspec/lib.multi-tenancy/provisioning';
3972
3972
 
3973
3973
  const service = new TenantProvisioningService({ db: prisma });
3974
3974
  await service.provision({
@@ -3976,7 +3976,7 @@ await service.provision({
3976
3976
  name: 'Acme Corp',
3977
3977
  slug: 'acme',
3978
3978
  ownerEmail: 'admin@acme.com'
3979
- });`})]}),go("div",{className:"flex items-center gap-4 pt-4",children:[Ba(Pc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),go(Pc,{href:"/docs/libraries/progressive-delivery",className:"btn-primary",children:["Next: Progressive Delivery ",Ba(au,{size:16})]})]})]})}import{CodeBlock as Oi,InstallCommand as iu}from"@contractspec/lib.design-system";import Tc from"@contractspec/lib.ui-link";import{ChevronRight as ru}from"lucide-react";import{jsx as Gt,jsxs as oo}from"react/jsx-runtime";function nu(){return oo("div",{className:"space-y-8",children:[oo("div",{className:"space-y-4",children:[Gt("h1",{className:"font-bold text-4xl",children:"Observability Library"}),oo("p",{className:"text-lg text-muted-foreground",children:["The ",Gt("code",{children:"@contractspec/lib.observability"})," library provides a thin wrapper around OpenTelemetry to simplify instrumentation."]})]}),oo("div",{className:"space-y-4",children:[Gt("h2",{className:"font-bold text-2xl",children:"Installation"}),Gt(iu,{package:"@contractspec/lib.observability"})]}),oo("div",{className:"space-y-4",children:[Gt("h2",{className:"font-bold text-2xl",children:"Tracing"}),Gt(Oi,{language:"typescript",code:`import { traceAsync, traceSync } from '@contractspec/lib.observability/tracing';
3979
+ });`})]}),go("div",{className:"flex items-center gap-4 pt-4",children:[Ba(Rc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),go(Rc,{href:"/docs/libraries/progressive-delivery",className:"btn-primary",children:["Next: Progressive Delivery ",Ba(cu,{size:16})]})]})]})}import{CodeBlock as Oi,InstallCommand as su}from"@contractspec/lib.design-system";import Lc from"@contractspec/lib.ui-link";import{ChevronRight as du}from"lucide-react";import{jsx as Gt,jsxs as oo}from"react/jsx-runtime";function pu(){return oo("div",{className:"space-y-8",children:[oo("div",{className:"space-y-4",children:[Gt("h1",{className:"font-bold text-4xl",children:"Observability Library"}),oo("p",{className:"text-lg text-muted-foreground",children:["The ",Gt("code",{children:"@contractspec/lib.observability"})," library provides a thin wrapper around OpenTelemetry to simplify instrumentation."]})]}),oo("div",{className:"space-y-4",children:[Gt("h2",{className:"font-bold text-2xl",children:"Installation"}),Gt(su,{package:"@contractspec/lib.observability"})]}),oo("div",{className:"space-y-4",children:[Gt("h2",{className:"font-bold text-2xl",children:"Tracing"}),Gt(Oi,{language:"typescript",code:`import { traceAsync, traceSync } from '@contractspec/lib.observability/tracing';
3980
3980
 
3981
3981
  await traceAsync('process_order', async (span) => {
3982
3982
  span.setAttribute('order_id', order.id);
@@ -3999,7 +3999,7 @@ const signals = detector.evaluate(point);
3999
3999
  signals.forEach((signal) => {
4000
4000
  const analysis = analyzer.analyze(signal, recentDeployments);
4001
4001
  alertManager.notify(signal, analysis);
4002
- });`})]}),oo("div",{className:"flex items-center gap-4 pt-4",children:[Gt(Tc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),oo(Tc,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",Gt(ru,{size:16})]})]})]})}import{CodeBlock as ur,InstallCommand as cu}from"@contractspec/lib.design-system";import Ac from"@contractspec/lib.ui-link";import{ChevronRight as lu}from"lucide-react";import{jsx as ya,jsxs as Eo}from"react/jsx-runtime";function su(){return Eo("div",{className:"space-y-8",children:[Eo("div",{className:"space-y-4",children:[ya("h1",{className:"font-bold text-4xl",children:"Overlay Engine"}),ya("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.overlay-engine` keeps OverlaySpecs typed, signed, and auditable across tenants, roles, users, and devices."})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Installation"}),ya(cu,{package:"@contractspec/lib.overlay-engine"})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Define + Sign"}),ya(ur,{language:"typescript",code:`import { defineOverlay } from '@contractspec/lib.overlay-engine/spec';
4002
+ });`})]}),oo("div",{className:"flex items-center gap-4 pt-4",children:[Gt(Lc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),oo(Lc,{href:"/docs/libraries/slo",className:"btn-primary",children:["Next: SLO ",Gt(du,{size:16})]})]})]})}import{CodeBlock as hr,InstallCommand as mu}from"@contractspec/lib.design-system";import Ec from"@contractspec/lib.ui-link";import{ChevronRight as uu}from"lucide-react";import{jsx as ya,jsxs as Eo}from"react/jsx-runtime";function gu(){return Eo("div",{className:"space-y-8",children:[Eo("div",{className:"space-y-4",children:[ya("h1",{className:"font-bold text-4xl",children:"Overlay Engine"}),ya("p",{className:"text-lg text-muted-foreground",children:"`@contractspec/lib.overlay-engine` keeps OverlaySpecs typed, signed, and auditable across tenants, roles, users, and devices."})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Installation"}),ya(mu,{package:"@contractspec/lib.overlay-engine"})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Define + Sign"}),ya(hr,{language:"typescript",code:`import { defineOverlay } from '@contractspec/lib.overlay-engine/spec';
4003
4003
  import { signOverlay } from '@contractspec/lib.overlay-engine/signer';
4004
4004
 
4005
4005
  const overlay = defineOverlay({
@@ -4009,7 +4009,7 @@ const overlay = defineOverlay({
4009
4009
  modifications: [{ type: 'hideField', field: 'internalNotes' }],
4010
4010
  });
4011
4011
 
4012
- const signed = await signOverlay(overlay, privateKeyPem);`})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Runtime"}),ya("p",{className:"text-muted-foreground",children:"`OverlayRegistry` stores signed overlays with specificity scoring. `OverlayEngine` merges modifications and emits audit events."}),ya(ur,{language:"typescript",code:`const registry = new OverlayRegistry();
4012
+ const signed = await signOverlay(overlay, privateKeyPem);`})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"Runtime"}),ya("p",{className:"text-muted-foreground",children:"`OverlayRegistry` stores signed overlays with specificity scoring. `OverlayEngine` merges modifications and emits audit events."}),ya(hr,{language:"typescript",code:`const registry = new OverlayRegistry();
4013
4013
  registry.register(signed);
4014
4014
 
4015
4015
  const engine = new OverlayEngine({
@@ -4021,13 +4021,13 @@ const result = engine.apply({
4021
4021
  target: { fields },
4022
4022
  capability: 'billing.createOrder',
4023
4023
  tenantId: 'acme',
4024
- });`})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"React Hooks"}),ya("p",{className:"text-muted-foreground",children:"Render overlays in React/React Native via `useOverlay`."}),ya(ur,{language:"typescript",code:`import { useOverlay } from '@contractspec/lib.overlay-engine/react';
4024
+ });`})]}),Eo("div",{className:"space-y-4",children:[ya("h2",{className:"font-bold text-2xl",children:"React Hooks"}),ya("p",{className:"text-muted-foreground",children:"Render overlays in React/React Native via `useOverlay`."}),ya(hr,{language:"typescript",code:`import { useOverlay } from '@contractspec/lib.overlay-engine/react';
4025
4025
 
4026
4026
  const { target } = useOverlay(engine, {
4027
4027
  target: { fields },
4028
4028
  capability: 'billing.createOrder',
4029
4029
  tenantId: 'acme',
4030
- });`})]}),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 \u2192 bundles \u2192 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
+ });`})]}),Eo("div",{className:"flex items-center gap-4 pt-4",children:[ya(Ec,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Eo(Ec,{href:"/docs/libraries/workflow-composer",className:"btn-primary",children:["Next: Workflow Composer ",ya(uu,{size:16})]})]})]})}import hu from"@contractspec/lib.ui-link";import{ChevronRight as fu}from"lucide-react";import{jsx as Ca,jsxs as Do}from"react/jsx-runtime";var yu=[{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 vu(){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 \u2192 bundles \u2192 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:yu.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(hu,{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(fu,{size:14})]})]},t.title))})]},e.title))})]})}import{CodeBlock as fr,InstallCommand as bu}from"@contractspec/lib.design-system";import Dc from"@contractspec/lib.ui-link";import{ChevronRight as Nu}from"lucide-react";import{jsx as ta,jsxs as Oo}from"react/jsx-runtime";function wu(){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(bu,{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(fr,{language:"typescript",code:`import { createBehaviorTracker } from '@contractspec/lib.personalization';
4031
4031
 
4032
4032
  const tracker = createBehaviorTracker({
4033
4033
  store,
@@ -4035,17 +4035,17 @@ const tracker = createBehaviorTracker({
4035
4035
  });
4036
4036
 
4037
4037
  tracker.trackFieldAccess({ operation: 'billing.createOrder', field: 'items' });
4038
- tracker.trackWorkflowStep({ workflow: 'invoice', step: 'review', status: 'entered' });`})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Analyzer"}),ta("p",{className:"text-muted-foreground",children:"Summarize events and highlight unused UI, frequent fields, and workflow bottlenecks."}),ta(gr,{language:"typescript",code:`import { BehaviorAnalyzer } from '@contractspec/lib.personalization/analyzer';
4038
+ tracker.trackWorkflowStep({ workflow: 'invoice', step: 'review', status: 'entered' });`})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Analyzer"}),ta("p",{className:"text-muted-foreground",children:"Summarize events and highlight unused UI, frequent fields, and workflow bottlenecks."}),ta(fr,{language:"typescript",code:`import { BehaviorAnalyzer } from '@contractspec/lib.personalization/analyzer';
4039
4039
 
4040
4040
  const analyzer = new BehaviorAnalyzer(store);
4041
4041
  const insights = await analyzer.analyze({ tenantId: 'acme', userId: 'ops-42' });
4042
- // { unusedFields: ['internalNotes'], workflowBottlenecks: [...] }`})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Adapter"}),ta("p",{className:"text-muted-foreground",children:"Convert insights into overlays or workflow extension hints."}),ta(gr,{language:"typescript",code:`import { insightsToOverlaySuggestion } from '@contractspec/lib.personalization/adapter';
4042
+ // { unusedFields: ['internalNotes'], workflowBottlenecks: [...] }`})]}),Oo("div",{className:"space-y-4",children:[ta("h2",{className:"font-bold text-2xl",children:"Adapter"}),ta("p",{className:"text-muted-foreground",children:"Convert insights into overlays or workflow extension hints."}),ta(fr,{language:"typescript",code:`import { insightsToOverlaySuggestion } from '@contractspec/lib.personalization/adapter';
4043
4043
 
4044
4044
  const overlay = insightsToOverlaySuggestion(insights, {
4045
4045
  overlayId: 'acme-order-form',
4046
4046
  tenantId: 'acme',
4047
4047
  capability: 'billing.createOrder',
4048
- });`})]}),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
+ });`})]}),Oo("div",{className:"flex items-center gap-4 pt-4",children:[ta(Dc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Oo(Dc,{href:"/docs/libraries/overlay-engine",className:"btn-primary",children:["Next: Overlay Engine ",ta(Nu,{size:16})]})]})]})}import{CodeBlock as Oc,InstallCommand as ku}from"@contractspec/lib.design-system";import Mc from"@contractspec/lib.ui-link";import{ChevronRight as Su}from"lucide-react";import{jsx as aa,jsxs as Ha}from"react/jsx-runtime";function Cu(){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(ku,{package:"@contractspec/lib.progressive-delivery"})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Define a Strategy"}),aa(Oc,{language:"typescript",code:`import { DeploymentCoordinator, createDefaultCanaryController, TrafficShifter, RollbackManager } from '@contractspec/lib.progressive-delivery';
4049
4049
 
4050
4050
  const strategy = {
4051
4051
  target: { name: 'billing.createInvoice', version: 7 },
@@ -4055,7 +4055,7 @@ const strategy = {
4055
4055
  latencyP99: 500,
4056
4056
  latencyP95: 250,
4057
4057
  },
4058
- };`})]}),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
+ };`})]}),Ha("div",{className:"space-y-4",children:[aa("h2",{className:"font-bold text-2xl",children:"Run the Coordinator"}),aa(Oc,{language:"typescript",code:`const eventBus = new DeploymentEventBus();
4059
4059
  const controller = createDefaultCanaryController(strategy, fetchMetrics, eventBus);
4060
4060
  const coordinator = new DeploymentCoordinator({
4061
4061
  strategy,
@@ -4066,7 +4066,7 @@ const coordinator = new DeploymentCoordinator({
4066
4066
  eventBus,
4067
4067
  });
4068
4068
 
4069
- 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
+ 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(Mc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Ha(Mc,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",aa(Su,{size:16})]})]})]})}import{CodeBlock as yr,InstallCommand as Iu}from"@contractspec/lib.design-system";import Bc from"@contractspec/lib.ui-link";import{ChevronRight as Pu}from"lucide-react";import{jsx as oa,jsxs as ho}from"react/jsx-runtime";function Tu(){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(Iu,{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(yr,{language:"typescript",code:`import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';
4070
4070
 
4071
4071
  const breaker = new CircuitBreaker({
4072
4072
  failureThreshold: 5,
@@ -4075,19 +4075,19 @@ const breaker = new CircuitBreaker({
4075
4075
 
4076
4076
  const result = await breaker.execute(async () => {
4077
4077
  return await fetch('https://api.stripe.com/v1/charges');
4078
- });`})]}),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
+ });`})]}),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(yr,{language:"typescript",code:`import { retry } from '@contractspec/lib.resilience/retry';
4079
4079
 
4080
4080
  const result = await retry(
4081
4081
  async () => fetchUser(id),
4082
4082
  3, // retries
4083
4083
  1000, // initial delay
4084
4084
  true // backoff
4085
- );`})]}),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
+ );`})]}),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(yr,{language:"typescript",code:`import { timeout, fallback } from '@contractspec/lib.resilience';
4086
4086
 
4087
4087
  const result = await fallback(
4088
4088
  () => timeout(slowOperation, 5000),
4089
4089
  defaultValue
4090
- );`})]}),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
+ );`})]}),ho("div",{className:"flex items-center gap-4 pt-4",children:[oa(Bc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),ho(Bc,{href:"/docs/libraries/testing",className:"btn-primary",children:["Next: Testing ",oa(Pu,{size:16})]})]})]})}import{CodeBlock as Au,InstallCommand as Ru}from"@contractspec/lib.design-system";import vr from"@contractspec/lib.ui-link";import{ChevronRight as Lu}from"lucide-react";import{jsx as Ie,jsxs as Oe}from"react/jsx-runtime";function Eu(){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(Ru,{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(Au,{language:"tsx",code:`import { useWorkflow, WorkflowStepRenderer } from '@contractspec/lib.presentation-runtime-react';
4091
4091
  import { OnboardingFlow } from './specs/onboarding';
4092
4092
 
4093
4093
  export function OnboardingPage() {
@@ -4127,7 +4127,7 @@ export function OnboardingPage() {
4127
4127
  </div>
4128
4128
  </div>
4129
4129
  );
4130
- }`})]}),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
+ }`})]}),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(vr,{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(vr,{href:"/docs/libraries/data-backend",className:"btn-ghost",children:"Previous: Data & Backend"}),Oe(vr,{href:"/docs/libraries",className:"btn-primary",children:["Back to Libraries ",Ie(Lu,{size:16})]})]})]})}import{CodeBlock as Uc,InstallCommand as Du}from"@contractspec/lib.design-system";import Wc from"@contractspec/lib.ui-link";import{ChevronRight as Ou}from"lucide-react";import{jsx as k,jsxs as Me}from"react/jsx-runtime";function Mu(){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(Du,{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(Uc,{language:"typescript",code:`import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
4131
4131
 
4132
4132
  export const CreateSpotInput = new SchemaModel({
4133
4133
  name: 'CreateSpotInput',
@@ -4145,7 +4145,7 @@ const zodSchema = CreateSpotInput.getZod();
4145
4145
  const pothosName = CreateSpotInput.getPothosInput();
4146
4146
 
4147
4147
  // Get JSON Schema
4148
- const jsonSchema = CreateSpotInput.getJsonSchema();`})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Example: Enums"}),k(Oc,{language:"typescript",code:`import { defineEnum, SchemaModel } from '@contractspec/lib.schema';
4148
+ const jsonSchema = CreateSpotInput.getJsonSchema();`})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Example: Enums"}),k(Uc,{language:"typescript",code:`import { defineEnum, SchemaModel } from '@contractspec/lib.schema';
4149
4149
 
4150
4150
  const Weekday = defineEnum('Weekday', [
4151
4151
  'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
@@ -4160,19 +4160,19 @@ const RecurrenceRule = new SchemaModel({
4160
4160
  },
4161
4161
  byWeekday: { type: Weekday, isOptional: true, isArray: true },
4162
4162
  },
4163
- });`})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Available Scalars"}),Me("div",{className:"grid gap-4 md:grid-cols-2",children:[Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Strings"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"NonEmptyString()"})}),k("li",{children:k("code",{children:"Email()"})}),k("li",{children:k("code",{children:"PhoneNumber()"})}),k("li",{children:k("code",{children:"CountryCode()"})}),k("li",{children:k("code",{children:"Locale()"})}),k("li",{children:k("code",{children:"TimeZone()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Numbers"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"PositiveNumber()"})}),k("li",{children:k("code",{children:"Latitude()"})}),k("li",{children:k("code",{children:"Longitude()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Dates & Times"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"Date()"})}),k("li",{children:k("code",{children:"DateTime()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Generic"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"String()"})}),k("li",{children:k("code",{children:"JSON()"})})]})]})]})]}),Me("div",{className:"flex items-center gap-4 pt-4",children:[k(Mc,{href:"/docs/libraries/contracts",className:"btn-ghost",children:"Previous: Contracts"}),Me(Mc,{href:"/docs/libraries/ui-kit",className:"btn-primary",children:["Next: UI Kit ",k(Au,{size:16})]})]})]})}import{CodeBlock as Bc,InstallCommand as Lu}from"@contractspec/lib.design-system";import Uc from"@contractspec/lib.ui-link";import{ChevronRight as Eu}from"lucide-react";import{jsx as Ia,jsxs as io}from"react/jsx-runtime";function Du(){return io("div",{className:"space-y-8",children:[io("div",{className:"space-y-4",children:[Ia("h1",{className:"font-bold text-4xl",children:"SLO Library"}),io("p",{className:"text-lg text-muted-foreground",children:[Ia("code",{children:"@contractspec/lib.slo"})," keeps service level objectives front and center\u2014declarative definitions, rolling snapshots, burn-rate math, and automated incidents."]})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Installation"}),Ia(Lu,{package:"@contractspec/lib.slo"})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Define Targets"}),Ia(Bc,{language:"typescript",code:`const definition: SLODefinition = {
4163
+ });`})]}),Me("div",{className:"space-y-4",children:[k("h2",{className:"font-bold text-2xl",children:"Available Scalars"}),Me("div",{className:"grid gap-4 md:grid-cols-2",children:[Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Strings"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"NonEmptyString()"})}),k("li",{children:k("code",{children:"Email()"})}),k("li",{children:k("code",{children:"PhoneNumber()"})}),k("li",{children:k("code",{children:"CountryCode()"})}),k("li",{children:k("code",{children:"Locale()"})}),k("li",{children:k("code",{children:"TimeZone()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Numbers"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"PositiveNumber()"})}),k("li",{children:k("code",{children:"Latitude()"})}),k("li",{children:k("code",{children:"Longitude()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Dates & Times"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"Date()"})}),k("li",{children:k("code",{children:"DateTime()"})})]})]}),Me("div",{className:"card-subtle p-4",children:[k("h3",{className:"mb-2 font-semibold",children:"Generic"}),Me("ul",{className:"space-y-1 text-muted-foreground text-sm",children:[k("li",{children:k("code",{children:"String()"})}),k("li",{children:k("code",{children:"JSON()"})})]})]})]})]}),Me("div",{className:"flex items-center gap-4 pt-4",children:[k(Wc,{href:"/docs/libraries/contracts",className:"btn-ghost",children:"Previous: Contracts"}),Me(Wc,{href:"/docs/libraries/ui-kit",className:"btn-primary",children:["Next: UI Kit ",k(Ou,{size:16})]})]})]})}import{CodeBlock as _c,InstallCommand as Bu}from"@contractspec/lib.design-system";import zc from"@contractspec/lib.ui-link";import{ChevronRight as Uu}from"lucide-react";import{jsx as Ia,jsxs as io}from"react/jsx-runtime";function Wu(){return io("div",{className:"space-y-8",children:[io("div",{className:"space-y-4",children:[Ia("h1",{className:"font-bold text-4xl",children:"SLO Library"}),io("p",{className:"text-lg text-muted-foreground",children:[Ia("code",{children:"@contractspec/lib.slo"})," keeps service level objectives front and center\u2014declarative definitions, rolling snapshots, burn-rate math, and automated incidents."]})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Installation"}),Ia(Bu,{package:"@contractspec/lib.slo"})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Define Targets"}),Ia(_c,{language:"typescript",code:`const definition: SLODefinition = {
4164
4164
  id: 'billing.createInvoice.availability',
4165
4165
  targetAvailability: 0.999,
4166
4166
  latencyP99TargetMs: 500,
4167
4167
  rollingWindowMs: 7 * 24 * 60 * 60 * 1000,
4168
4168
  alerts: { fastBurnThreshold: 14, slowBurnThreshold: 6 },
4169
- };`})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Monitor Burn Rate"}),Ia(Bc,{language:"typescript",code:`const monitor = new SLOMonitor({ definition, incidentManager });
4169
+ };`})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"Monitor Burn Rate"}),Ia(_c,{language:"typescript",code:`const monitor = new SLOMonitor({ definition, incidentManager });
4170
4170
  const { snapshot, burnRate } = monitor.recordWindow({
4171
4171
  good: 12500,
4172
4172
  bad: 3,
4173
4173
  latencyP99: 420,
4174
4174
  latencyP95: 210,
4175
- });`}),io("p",{className:"text-muted-foreground text-sm",children:["When burn rate exceeds the configured thresholds the monitor calls your",Ia("code",{children:"IncidentManager"}),", providing the snapshot that triggered the alert."]})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"History & Reporting"}),Ia("p",{className:"text-muted-foreground text-sm",children:"`SLOTracker.getHistory()` returns the latest snapshots so dashboards can show trends without hitting a warehouse. Prisma models persist everything for long-term audits."})]}),io("div",{className:"flex items-center gap-4 pt-4",children:[Ia(Uc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),io(Uc,{href:"/docs/libraries/cost-tracking",className:"btn-primary",children:["Next: Cost Tracking ",Ia(Eu,{size:16})]})]})]})}import{CodeBlock as Wc,InstallCommand as Ou}from"@contractspec/lib.design-system";import _c from"@contractspec/lib.ui-link";import{ChevronRight as Mu}from"lucide-react";import{jsx as ia,jsxs as Pa}from"react/jsx-runtime";function Bu(){return Pa("div",{className:"space-y-8",children:[Pa("div",{className:"space-y-4",children:[ia("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.support-bot"}),ia("p",{className:"text-lg text-muted-foreground",children:"Build AI-first support flows using drop-in classifiers, knowledge-grounded resolvers, and tone-aware responders\u2014all wired into the agent runner."})]}),Pa("div",{className:"space-y-4",children:[ia("h2",{className:"font-bold text-2xl",children:"Installation"}),ia(Ou,{package:"@contractspec/lib.support-bot"})]}),Pa("div",{className:"space-y-3",children:[ia("h2",{className:"font-bold text-2xl",children:"Wire the primitives"}),ia(Wc,{language:"typescript",code:`import { TicketClassifier, TicketResolver, AutoResponder } from '@contractspec/lib.support-bot';
4175
+ });`}),io("p",{className:"text-muted-foreground text-sm",children:["When burn rate exceeds the configured thresholds the monitor calls your",Ia("code",{children:"IncidentManager"}),", providing the snapshot that triggered the alert."]})]}),io("div",{className:"space-y-4",children:[Ia("h2",{className:"font-bold text-2xl",children:"History & Reporting"}),Ia("p",{className:"text-muted-foreground text-sm",children:"`SLOTracker.getHistory()` returns the latest snapshots so dashboards can show trends without hitting a warehouse. Prisma models persist everything for long-term audits."})]}),io("div",{className:"flex items-center gap-4 pt-4",children:[Ia(zc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),io(zc,{href:"/docs/libraries/cost-tracking",className:"btn-primary",children:["Next: Cost Tracking ",Ia(Uu,{size:16})]})]})]})}import{CodeBlock as Gc,InstallCommand as _u}from"@contractspec/lib.design-system";import qc from"@contractspec/lib.ui-link";import{ChevronRight as zu}from"lucide-react";import{jsx as ia,jsxs as Pa}from"react/jsx-runtime";function Gu(){return Pa("div",{className:"space-y-8",children:[Pa("div",{className:"space-y-4",children:[ia("h1",{className:"font-bold text-4xl",children:"@contractspec/lib.support-bot"}),ia("p",{className:"text-lg text-muted-foreground",children:"Build AI-first support flows using drop-in classifiers, knowledge-grounded resolvers, and tone-aware responders\u2014all wired into the agent runner."})]}),Pa("div",{className:"space-y-4",children:[ia("h2",{className:"font-bold text-2xl",children:"Installation"}),ia(_u,{package:"@contractspec/lib.support-bot"})]}),Pa("div",{className:"space-y-3",children:[ia("h2",{className:"font-bold text-2xl",children:"Wire the primitives"}),ia(Gc,{language:"typescript",code:`import { TicketClassifier, TicketResolver, AutoResponder } from '@contractspec/lib.support-bot';
4176
4176
 
4177
4177
  const classifier = new TicketClassifier();
4178
4178
  const resolver = new TicketResolver({ knowledge });
@@ -4180,10 +4180,10 @@ const responder = new AutoResponder();
4180
4180
 
4181
4181
  const classification = await classifier.classify(ticket);
4182
4182
  const resolution = await resolver.resolve(ticket);
4183
- 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
+ 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(Gc,{language:"typescript",code:`import { createSupportTools } from '@contractspec/lib.support-bot/bot';
4184
4184
 
4185
4185
  const tools = createSupportTools({ resolver, classifier, responder });
4186
- // 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
+ // 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(qc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Pa(qc,{href:"/docs/libraries/growth",className:"btn-primary",children:["Next: Growth ",ia(zu,{size:16})]})]})]})}import{CodeBlock as br,InstallCommand as qu}from"@contractspec/lib.design-system";import Vc from"@contractspec/lib.ui-link";import{ChevronRight as Vu}from"lucide-react";import{jsx as ra,jsxs as fo}from"react/jsx-runtime";function Hu(){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(qu,{package:"@contractspec/lib.testing"})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Record traffic"}),ra(br,{language:"typescript",code:`import {
4187
4187
  TrafficRecorder,
4188
4188
  InMemoryTrafficStore,
4189
4189
  } from '@contractspec/lib.testing/recorder';
@@ -4203,7 +4203,7 @@ await recorder.record({
4203
4203
  output,
4204
4204
  success: true,
4205
4205
  tenantId: ctx.organizationId ?? undefined,
4206
- });`})]}),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
+ });`})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"Generate suites"}),ra(br,{language:"typescript",code:`import { GoldenTestGenerator } from '@contractspec/lib.testing';
4207
4207
 
4208
4208
  const generator = new GoldenTestGenerator();
4209
4209
  const code = generator.generate(snapshots, {
@@ -4211,7 +4211,7 @@ const code = generator.generate(snapshots, {
4211
4211
  runnerImport: './tests/run-operation',
4212
4212
  runnerFunction: 'runOrdersCommand',
4213
4213
  framework: 'vitest',
4214
- });`})]}),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
+ });`})]}),fo("div",{className:"space-y-3",children:[ra("h2",{className:"font-bold text-2xl",children:"CLI workflow"}),ra(br,{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(Vc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),fo(Vc,{href:"/docs/libraries/resilience",className:"btn-primary",children:["Next: Resilience ",ra(Vu,{size:16})]})]})]})}import{CodeBlock as Fu,InstallCommand as Ku}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 Yu=`import { DataTable } from '@contractspec/lib.ui-kit/ui/data-table';
4215
4215
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
4216
4216
 
4217
4217
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -4255,7 +4255,7 @@ export function NativeAccountGrid() {
4255
4255
  footer={\`Rows \${controller.rows.length}\`}
4256
4256
  />
4257
4257
  );
4258
- }`;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
+ }`;function Ju(){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(Ku,{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(Fu,{language:"tsx",code:Yu})]}),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 Zu,InstallCommand as Xu}from"@contractspec/lib.design-system";import Bi from"@contractspec/lib.ui-link";import{ChevronRight as $u}from"lucide-react";import{jsx as na,jsxs as Fa}from"react/jsx-runtime";var xu=`import { DataTable } from '@contractspec/lib.ui-kit-web/ui/data-table';
4259
4259
  import { useContractTable } from '@contractspec/lib.presentation-runtime-react';
4260
4260
 
4261
4261
  import { SHOWCASE_ROWS } from '@contractspec/example.data-grid-showcase/ui/data-grid-showcase.data';
@@ -4300,7 +4300,7 @@ export function WebAccountGrid() {
4300
4300
  footer={\`Rows \${controller.totalItems}\`}
4301
4301
  />
4302
4302
  );
4303
- }`;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
+ }`;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(Xu,{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(Zu,{language:"tsx",filename:"web-account-grid.tsx",code:xu})]}),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($u,{size:16})]})]})]})}import{CodeBlock as Hc,InstallCommand as eg}from"@contractspec/lib.design-system";import Fc from"@contractspec/lib.ui-link";import{ChevronRight as tg}from"lucide-react";import{jsx as ro,jsxs as Vo}from"react/jsx-runtime";function ag(){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(eg,{package:"@contractspec/lib.workflow-composer"})]}),Vo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Register extensions"}),ro(Hc,{language:"typescript",code:`const composer = new WorkflowComposer();
4304
4304
 
4305
4305
  composer.register({
4306
4306
  workflow: 'billing.invoiceApproval',
@@ -4317,12 +4317,12 @@ composer.register({
4317
4317
  },
4318
4318
  ],
4319
4319
  hiddenSteps: ['internal-audit'],
4320
- });`})]}),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
+ });`})]}),Vo("div",{className:"space-y-4",children:[ro("h2",{className:"font-bold text-2xl",children:"Compose at runtime"}),ro(Hc,{language:"typescript",code:`const tenantWorkflow = composer.compose({
4321
4321
  base: BaseInvoiceWorkflow,
4322
4322
  tenantId: 'acme',
4323
4323
  });
4324
4324
 
4325
- 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
+ workflowRunner.execute(tenantWorkflow, ctx);`})]}),Vo("div",{className:"flex items-center gap-4 pt-4",children:[ro(Fc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),Vo(Fc,{href:"/docs/libraries/workflows",className:"btn-primary",children:["Next: Workflow Runtime ",ro(tg,{size:16})]})]})]})}import{CodeBlock as og,InstallCommand as ig}from"@contractspec/lib.design-system";import Kc from"@contractspec/lib.ui-link";import{ChevronRight as rg}from"lucide-react";import{jsx as ae,jsxs as va}from"react/jsx-runtime";function ng(){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(ig,{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(og,{language:"typescript",code:`import { WorkflowRunner } from '@contractspec/lib.contracts-spec/workflow/runner';
4326
4326
  import { InMemoryStateStore } from '@contractspec/lib.contracts-spec/workflow/adapters/memory-store';
4327
4327
  import { WorkflowRegistry } from '@contractspec/lib.contracts-spec/workflow/spec';
4328
4328
 
@@ -4342,7 +4342,7 @@ const runner = new WorkflowRunner({
4342
4342
  const workflowId = await runner.start('my.workflow', 1, { userId: '123' });
4343
4343
 
4344
4344
  // Execute next step (usually called by a worker or queue consumer)
4345
- 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
+ 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(Kc,{href:"/docs/libraries",className:"btn-ghost",children:"Back to Libraries"}),va(Kc,{href:"/docs/libraries/data-views",className:"btn-primary",children:["Next: Data Views ",ae(rg,{size:16})]})]})]})}import{jsx as Ka,jsxs as Ho}from"react/jsx-runtime";function cg(){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 lg(){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
4346
4346
  AUTO_EVOLUTION_SAMPLE_RATE=0.02
4347
4347
  AUTO_EVOLUTION_WINDOW_MS=900000
4348
4348
 
@@ -4352,15 +4352,15 @@ AUTO_EVOLUTION_AUTO_APPROVE=0.2
4352
4352
 
4353
4353
  # Guardrails (fallback defaults)
4354
4354
  AUTO_EVOLUTION_MAX_ERROR_RATE=0.02
4355
- 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\u20132% 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
+ 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\u20132% 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 sg(){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
4356
4356
  OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
4357
4357
  OTEL_TRACES_SAMPLER=parentbased_traceidratio
4358
- 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
+ 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 dg,DocsSearchForm as pg}from"@contractspec/lib.contracts-spec/docs";import{DataViewList as mg,formRenderer as ug,StatusChip as Nr}from"@contractspec/lib.design-system";import{HStack as gg,VStack as wr}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as hg,Muted as Qc}from"@contractspec/lib.ui-kit-web/ui/typography";import{useMemo as Yc,useState as fg}from"react";import{jsx as Bo,jsxs as kr}from"react/jsx-runtime";function yg(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4359
4359
 
4360
- `).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(`
4361
- `)});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}.`:"\u2022"}),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,`
4360
+ `).trim()}function vg(e){let t=yg(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 bg(e,t){if(!t)return!0;return[e.title,e.summary,e.id,...e.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(t.toLowerCase())}function Jc({entries:e}){let[t,o]=fg({}),n=Yc(()=>e.map(vg),[e]),Nt=Yc(()=>{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 bg(ie,Xe)})},[t,n]),Ne=ug.render(pg,{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 kr(wr,{gap:"xl",children:[kr(wr,{gap:"sm",children:[Bo(hg,{children:"Reference"}),Bo(Qc,{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(wr,{gap:"sm",className:"max-w-2xl",children:Ne}),Bo(mg,{spec:dg,items:Nt,emptyState:Bo(Qc,{children:"No reference docs match your filters."}),onSelect:(Xe)=>{if(Xe.route)window.location.assign(Xe.route)},renderActions:(Xe)=>{return kr(gg,{gap:"xs",justify:"end",children:[Xe.kind?Bo(Nr,{size:"sm",label:Xe.kind}):null,Xe.visibility?Bo(Nr,{size:"sm",label:Xe.visibility}):null,Xe.version?Bo(Nr,{size:"sm",label:`v${Xe.version}`}):null]})}})]})}import{jsx as wg}from"react/jsx-runtime";async function Ng(){let e=await rn();return wg(Jc,{entries:e})}var kg=/^##\s+Metadata[\s\S]*?(?=^##\s|^#\s|Z)/m;function Sg(e){return e.replace(/^#\s+.*\n+/m,"").replace(kg,"")}function Zc(e){return/^#{1,4}\s+/.test(e)||/^```/.test(e)||/^\s*[-*]\s+/.test(e)||/^\s*\d+\.\s+/.test(e)||/^>\s+/.test(e)}function Xc(e){let t=Sg(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(`
4361
+ `)});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&&Zc((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&&!Zc((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 Cg}from"@contractspec/lib.design-system";import{HStack as Ig,VStack as Sr}from"@contractspec/lib.ui-kit-web/ui/stack";import{BlockQuote as Pg,H2 as Tg,H3 as Ag,H4 as Rg,Muted as $c,P as xc}from"@contractspec/lib.ui-kit-web/ui/typography";import{jsx as Ua,jsxs as Og}from"react/jsx-runtime";var Lg=new Set(["typescript","tsx","javascript","jsx","bash","shell","json","yaml","graphql","sql","python","go","rust","css","scss","html","markdown","text"]);function Eg(e){if(!e)return"text";let t=e.toLowerCase();return Lg.has(t)?t:"text"}function Dg(e,t){if(e<=2)return Ua(Tg,{children:t});if(e===3)return Ua(Ag,{children:t});return Ua(Rg,{children:t})}function jc({content:e}){let t=Xc(e);if(!t.length)return Ua($c,{children:"No reference content available."});return Ua(Sr,{gap:"md",children:t.map((o,n)=>{switch(o.type){case"heading":return Ua(Sr,{children:Dg(o.level,o.text)},n);case"paragraph":return Ua(xc,{children:o.text},n);case"quote":return Ua(Pg,{children:o.text},n);case"code":return Ua(Cg,{language:Eg(o.language),code:o.code},n);case"list":return Ua(Sr,{gap:"xs",children:o.items.map((Nt,Ne)=>Og(Ig,{gap:"sm",align:"start",children:[Ua($c,{children:o.ordered?`${Ne+1}.`:"\u2022"}),Ua(xc,{className:"leading-relaxed",children:Nt})]},Ne))},n);default:return null}})})}import{ContractReferenceDataView as Ui}from"@contractspec/lib.contracts-spec/docs";import{DataViewRenderer as Mg}from"@contractspec/lib.design-system";import{VStack as Bg}from"@contractspec/lib.ui-kit-web/ui/stack";import{jsx as el,jsxs as Wg}from"react/jsx-runtime";function fi(e,t){return e.match(new RegExp(`- \\*\\*${t}\\*\\*: (.+)`,"i"))?.[1]?.trim()}function Ug(e){if(!e)return;return e.replace(/<!--.*?-->/g,"").replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
4362
4362
 
4363
- `).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"})," \u2013 Every invocation of a capability, including inputs, outputs, and the user who made the call."]}),Y("li",{children:[w("strong",{children:"Policy decisions"})," \u2013 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"})," \u2013 Every query to a data view, including which fields were accessed and whether any were redacted."]}),Y("li",{children:[w("strong",{children:"Workflow execution"})," \u2013 Every step in a workflow, including retries, compensations, and failures."]}),Y("li",{children:[w("strong",{children:"Administrative actions"})," \u2013 Spec deployments, configuration changes, user role assignments, and other privileged operations."]}),Y("li",{children:[w("strong",{children:"Authentication events"})," \u2013 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
+ `).trim()}function tl({entry:e,content:t}){let o=Ug(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 Wg(Bg,{gap:"xl",children:[el(Mg,{spec:Qo,item:bo}),el(jc,{content:t})]})}import{jsx as zg}from"react/jsx-runtime";function _g({entry:e,content:t}){return zg(tl,{entry:e,content:t})}import Cr from"@contractspec/lib.ui-link";import{ChevronRight as Gg}from"lucide-react";import{jsx as w,jsxs as Y}from"react/jsx-runtime";function qg(){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"})," \u2013 Every invocation of a capability, including inputs, outputs, and the user who made the call."]}),Y("li",{children:[w("strong",{children:"Policy decisions"})," \u2013 Every decision made by the"," ",w(Cr,{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"})," \u2013 Every query to a data view, including which fields were accessed and whether any were redacted."]}),Y("li",{children:[w("strong",{children:"Workflow execution"})," \u2013 Every step in a workflow, including retries, compensations, and failures."]}),Y("li",{children:[w("strong",{children:"Administrative actions"})," \u2013 Spec deployments, configuration changes, user role assignments, and other privileged operations."]}),Y("li",{children:[w("strong",{children:"Authentication events"})," \u2013 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:`{
4364
4364
  "timestamp": "2025-11-13T14:32:15.123Z",
4365
4365
  "eventId": "evt_abc123",
4366
4366
  "eventType": "capability.invoked",
@@ -4391,7 +4391,7 @@ OTEL_TRACES_SAMPLER_ARG=0.1`})]}),hi("div",{className:"space-y-4",children:[Qa("
4391
4391
  "ruleId": "allow-admin-transfers",
4392
4392
  "reason": "User has admin role"
4393
4393
  }
4394
- }`})})]}),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"})," \u2013 For development and testing."]}),Y("li",{children:[w("strong",{children:"Cloud object storage"})," \u2013 S3, GCS, or Azure Blob Storage for production."]}),Y("li",{children:[w("strong",{children:"SIEM integration"})," \u2013 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"})," \u2013 Set up alerts for suspicious activity (e.g., repeated failed login attempts, unauthorized access attempts)."]}),Y("li",{children:[w("strong",{children:"Protect log access"})," \u2013 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"})," \u2013 Check your compliance requirements and configure retention policies accordingly."]}),Y("li",{children:[w("strong",{children:"Test log integrity"})," \u2013 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\u2014adding 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"}),' \u2013 A unique identifier (e.g., "2025-11-13-001") that determines the order of execution.']}),$("li",{children:[f("strong",{children:"Up function"}),` \u2013 The forward migration that applies the change (e.g., "add column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Down function"}),` \u2013 The reverse migration that undoes the change (e.g., "drop column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Dependencies"})," \u2013 Other migrations that must run before this one."]}),$("li",{children:[f("strong",{children:"Validation"}),' \u2013 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
+ }`})})]}),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"})," \u2013 For development and testing."]}),Y("li",{children:[w("strong",{children:"Cloud object storage"})," \u2013 S3, GCS, or Azure Blob Storage for production."]}),Y("li",{children:[w("strong",{children:"SIEM integration"})," \u2013 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"})," \u2013 Set up alerts for suspicious activity (e.g., repeated failed login attempts, unauthorized access attempts)."]}),Y("li",{children:[w("strong",{children:"Protect log access"})," \u2013 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"})," \u2013 Check your compliance requirements and configure retention policies accordingly."]}),Y("li",{children:[w("strong",{children:"Test log integrity"})," \u2013 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(Cr,{href:"/docs/safety/pdp",className:"btn-ghost",children:"Previous: Policy Decision Points"}),Y(Cr,{href:"/docs/safety/migrations",className:"btn-primary",children:["Next: Migrations ",w(Gg,{size:16})]})]})]})}import al from"@contractspec/lib.ui-link";import{ChevronRight as Vg}from"lucide-react";import{jsx as f,jsxs as $}from"react/jsx-runtime";function Hg(){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\u2014adding 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"}),' \u2013 A unique identifier (e.g., "2025-11-13-001") that determines the order of execution.']}),$("li",{children:[f("strong",{children:"Up function"}),` \u2013 The forward migration that applies the change (e.g., "add column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Down function"}),` \u2013 The reverse migration that undoes the change (e.g., "drop column 'email_verified'").`]}),$("li",{children:[f("strong",{children:"Dependencies"})," \u2013 Other migrations that must run before this one."]}),$("li",{children:[f("strong",{children:"Validation"}),' \u2013 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
4395
4395
  version: 2025-11-13-001
4396
4396
  dependencies: []
4397
4397
 
@@ -4414,7 +4414,7 @@ validation:
4414
4414
  - sql: |
4415
4415
  SELECT COUNT(*) FROM users
4416
4416
  WHERE email_verified IS NULL;
4417
- 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\u2014for 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\u2014only 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"})," \u2013 Run them against a copy of production data to catch issues before deploying."]}),$("li",{children:[f("strong",{children:"Keep migrations small"})," \u2013 Each migration should do one thing. This makes them easier to understand and roll back."]}),$("li",{children:[f("strong",{children:"Write reversible migrations"})," \u2013 Always provide a down function, even if you don't plan to roll back."]}),$("li",{children:[f("strong",{children:"Use transactions"})," \u2013 Wrap migrations in database transactions so they either fully succeed or fully fail."]}),$("li",{children:[f("strong",{children:"Avoid destructive changes"})," \u2013 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"})," \u2013 Use timestamps or sequential numbers to ensure migrations run in the correct order."]}),$("li",{children:[f("strong",{children:"Document breaking changes"})," \u2013 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\u2014whether 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"})," \u2013 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"})," \u2013 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"})," \u2013 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"})," ","\u2013 The operation is allowed."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"DENY"})," ","\u2013 The operation is blocked."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"REDACT"})," ","\u2013 The operation is allowed, but sensitive fields are masked."]})]})]}),he("li",{children:[R("strong",{children:"Enforcement"})," \u2013 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"})," \u2013 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
+ 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\u2014for 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\u2014only 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"})," \u2013 Run them against a copy of production data to catch issues before deploying."]}),$("li",{children:[f("strong",{children:"Keep migrations small"})," \u2013 Each migration should do one thing. This makes them easier to understand and roll back."]}),$("li",{children:[f("strong",{children:"Write reversible migrations"})," \u2013 Always provide a down function, even if you don't plan to roll back."]}),$("li",{children:[f("strong",{children:"Use transactions"})," \u2013 Wrap migrations in database transactions so they either fully succeed or fully fail."]}),$("li",{children:[f("strong",{children:"Avoid destructive changes"})," \u2013 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"})," \u2013 Use timestamps or sequential numbers to ensure migrations run in the correct order."]}),$("li",{children:[f("strong",{children:"Document breaking changes"})," \u2013 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(al,{href:"/docs/safety/auditing",className:"btn-ghost",children:"Previous: Audit Logs"}),$(al,{href:"/docs/advanced/renderers",className:"btn-primary",children:["Next: Advanced Topics ",f(Vg,{size:16})]})]})]})}import Fg from"@contractspec/lib.ui-link";import{jsx as yo,jsxs as yi}from"react/jsx-runtime";var Kg=[{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:Kg.map((e)=>yi(Fg,{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 Ir from"@contractspec/lib.ui-link";import{ChevronRight as Yg}from"lucide-react";import{jsx as R,jsxs as he}from"react/jsx-runtime";function Jg(){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\u2014whether 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"})," \u2013 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"})," \u2013 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"})," \u2013 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"})," ","\u2013 The operation is allowed."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"DENY"})," ","\u2013 The operation is blocked."]}),he("li",{children:[R("code",{className:"rounded bg-background/50 px-2 py-1",children:"REDACT"})," ","\u2013 The operation is allowed, but sensitive fields are masked."]})]})]}),he("li",{children:[R("strong",{children:"Enforcement"})," \u2013 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"})," \u2013 Every PDP decision is logged to the"," ",R(Ir,{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
4418
4418
  version: '1.0.0'.0.0
4419
4419
  rules:
4420
4420
  - id: allow-admin-full-access
@@ -4432,11 +4432,11 @@ rules:
4432
4432
  effect: DENY
4433
4433
  condition: |
4434
4434
  user.role NOT IN ['admin', 'support'] AND
4435
- 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"})," \u2013 Policies are enforced uniformly across all surfaces (API, UI, workflows)."]}),he("li",{children:[R("strong",{children:"Auditability"})," \u2013 Every decision is logged, making it easy to trace why access was granted or denied."]}),he("li",{children:[R("strong",{children:"Flexibility"})," \u2013 Policies can be updated without changing application code."]}),he("li",{children:[R("strong",{children:"Security"})," \u2013 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
+ 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"})," \u2013 Policies are enforced uniformly across all surfaces (API, UI, workflows)."]}),he("li",{children:[R("strong",{children:"Auditability"})," \u2013 Every decision is logged, making it easy to trace why access was granted or denied."]}),he("li",{children:[R("strong",{children:"Flexibility"})," \u2013 Policies can be updated without changing application code."]}),he("li",{children:[R("strong",{children:"Security"})," \u2013 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(Ir,{href:"/docs/safety/signing",className:"btn-ghost",children:"Previous: Spec Signing"}),he(Ir,{href:"/docs/safety/auditing",className:"btn-primary",children:["Next: Audit Logs ",R(Yg,{size:16})]})]})]})}import Pr from"@contractspec/lib.ui-link";import{ChevronRight as Tr}from"lucide-react";import{jsx as ne,jsxs as yt}from"react/jsx-runtime";function Zg(){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(Pr,{href:"/SECURITY.md",className:"btn-primary",children:["Read the security policy ",ne(Tr,{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(Pr,{href:"/docs/safety",className:"btn-ghost",children:["Safety overview ",ne(Tr,{size:16})]}),yt(Pr,{href:"/ROADMAP.md",className:"btn-ghost",children:["Roadmap ",ne(Tr,{size:16})]})]})]})]})}import Xg from"@contractspec/lib.ui-link";import{ChevronRight as $g}from"lucide-react";import{jsx as Wa,jsxs as Fo}from"react/jsx-runtime";function xg(){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
4436
4436
  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
4437
4437
  # Output: \u2713 Signature valid
4438
4438
  # Signed by: alice@example.com
4439
- # Timestamp: 2024-11-08T10:30:00Z`})})]}),Wa("div",{className:"flex items-center gap-4 pt-4",children:Fo(Kg,{href:"/docs/safety/pdp",className:"btn-primary",children:["Next: Policy Decision Points ",Wa(Qg,{size:16})]})})]})]})}import{jsx as vo,jsxs as Ko}from"react/jsx-runtime";function Jg(){return Ko("div",{className:"space-y-8",children:[Ko("div",{className:"space-y-4",children:[vo("h1",{className:"font-bold text-4xl",children:"Tenant Isolation"}),vo("p",{className:"text-lg text-muted-foreground",children:'Preventing cross-tenant data leaks is the #1 security priority for any SaaS. ContractSpec employs "Defense in Depth" to ensure safety.'})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 1: RLS Middleware"}),Ko("p",{children:["The primary defense is the Prisma middleware that rewrites queries to include ",vo("code",{children:"WHERE tenantId = ?"}),". This protects against developer error (forgetting to filter)."]})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 2: Isolation Validator"}),Ko("p",{children:["For high-security environments, you can use the"," ",vo("code",{children:"IsolationValidator"})," in your test suite to verify that every query generated by your operations actually includes the tenant ID."]}),vo("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { IsolationValidator } from '@contractspec/lib.multi-tenancy/isolation';
4439
+ # Timestamp: 2024-11-08T10:30:00Z`})})]}),Wa("div",{className:"flex items-center gap-4 pt-4",children:Fo(Xg,{href:"/docs/safety/pdp",className:"btn-primary",children:["Next: Policy Decision Points ",Wa($g,{size:16})]})})]})]})}import{jsx as vo,jsxs as Ko}from"react/jsx-runtime";function jg(){return Ko("div",{className:"space-y-8",children:[Ko("div",{className:"space-y-4",children:[vo("h1",{className:"font-bold text-4xl",children:"Tenant Isolation"}),vo("p",{className:"text-lg text-muted-foreground",children:'Preventing cross-tenant data leaks is the #1 security priority for any SaaS. ContractSpec employs "Defense in Depth" to ensure safety.'})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 1: RLS Middleware"}),Ko("p",{children:["The primary defense is the Prisma middleware that rewrites queries to include ",vo("code",{children:"WHERE tenantId = ?"}),". This protects against developer error (forgetting to filter)."]})]}),Ko("div",{className:"space-y-4",children:[vo("h2",{className:"font-bold text-2xl",children:"Layer 2: Isolation Validator"}),Ko("p",{children:["For high-security environments, you can use the"," ",vo("code",{children:"IsolationValidator"})," in your test suite to verify that every query generated by your operations actually includes the tenant ID."]}),vo("pre",{className:"rounded-lg border bg-muted p-4 text-sm",children:`import { IsolationValidator } from '@contractspec/lib.multi-tenancy/isolation';
4440
4440
 
4441
4441
  test('findUser query is isolated', () => {
4442
4442
  const isValid = IsolationValidator.validateQuery(
@@ -4446,7 +4446,7 @@ test('findUser query is isolated', () => {
4446
4446
  'tenant-123'
4447
4447
  );
4448
4448
  expect(isValid).toBe(true);
4449
- });`})]}),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
+ });`})]}),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 Ar}from"@contractspec/lib.design-system";import ol from"@contractspec/lib.ui-link";import{jsx as E,jsxs as Te}from"react/jsx-runtime";var eh=[{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."}],th=["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."],ah=["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 oh(){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(Ar,{language:"text",filename:"builder-stack",code:`Packages
4450
4450
  - @contractspec/lib.builder-spec
4451
4451
  - @contractspec/lib.builder-runtime
4452
4452
  - @contractspec/lib.provider-spec
@@ -4460,7 +4460,7 @@ Web app routes
4460
4460
  Operate API proxy
4461
4461
  - /api/operate/builder/queries/builder.workspace.snapshot
4462
4462
  - /api/operate/builder/commands/builder.blueprint.patch
4463
- - /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
+ - /api/operate/builder/commands/builder.export.execute`})]}),E("section",{className:"grid gap-4 md:grid-cols-3",children:eh.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:th.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(Ar,{language:"json",filename:".contractsrc.json",code:`{
4464
4464
  "builder": {
4465
4465
  "enabled": true,
4466
4466
  "runtimeMode": "local",
@@ -4475,7 +4475,7 @@ Operate API proxy
4475
4475
  "providerIds": ["provider.codex", "provider.local.model"]
4476
4476
  }
4477
4477
  }
4478
- }`})]}),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
+ }`})]}),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:ah.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(Ar,{language:"tsx",filename:"BuilderWorkbenchHost.tsx",code:`import { BuilderWorkbench, useBuilderWorkbenchState } from "@contractspec/module.builder-workbench";
4479
4479
 
4480
4480
  const state = useBuilderWorkbenchState({
4481
4481
  workspace: initialSnapshot.workspace,
@@ -4493,7 +4493,7 @@ const state = useBuilderWorkbenchState({
4493
4493
  onRunReadiness={runReadiness}
4494
4494
  onExecuteExport={executeExport}
4495
4495
  selectedExportRuntimeMode="hybrid"
4496
- />;`})]}),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
+ />;`})]}),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(ol,{href:"/docs/studio",className:"btn-primary",children:"Studio overview"}),E(ol,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})]})}import ih from"@contractspec/lib.ui-link";import{ChevronRight as rh}from"lucide-react";import{jsx as qt,jsxs as ba}from"react/jsx-runtime";function nh(){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';
4497
4497
  import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
4498
4498
 
4499
4499
  const TransferFundsInput = new SchemaModel({
@@ -4531,7 +4531,7 @@ export const TransferFunds = defineCommand({
4531
4531
  auth: 'user',
4532
4532
  flags: ['payments_enabled'],
4533
4533
  },
4534
- });`})})]}),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:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.NonEmptyString()"})," ","- Non-empty text"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.PositiveNumber()"})," ","- Positive numbers"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.DateTime()"})," ","- ISO 8601 timestamps"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.Email()"})," ","- Valid email addresses"]}),ba("li",{children:["\u2022"," ",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
+ });`})})]}),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:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.NonEmptyString()"})," ","- Non-empty text"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.PositiveNumber()"})," ","- Positive numbers"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.DateTime()"})," ","- ISO 8601 timestamps"]}),ba("li",{children:["\u2022"," ",qt("code",{className:"rounded bg-background/50 px-2 py-1",children:"ScalarTypeEnum.Email()"})," ","- Valid email addresses"]}),ba("li",{children:["\u2022"," ",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(ih,{href:"/docs/specs/dataviews",className:"btn-primary",children:["Next: DataViews ",qt(rh,{size:16})]})})]})]})}import{CodeBlock as ch}from"@contractspec/lib.design-system";import il from"@contractspec/lib.ui-link";import{jsx as oe,jsxs as vt}from"react/jsx-runtime";var lh=[{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."}],sh=["`.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"],dh=["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."],ph=["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 mh(){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(ch,{language:"bash",filename:"contractspec-connect",code:`contractspec connect init --scope workspace
4535
4535
  contractspec connect adoption sync --json
4536
4536
  printf '{"goal":"Prefer an existing release helper before adding a new one"}' | contractspec connect adoption resolve --family sharedLibs --stdin --json
4537
4537
  contractspec connect context --task refactor-docs --paths packages/libs/contracts-spec/src/control-plane/contracts.ts --json
@@ -4539,7 +4539,7 @@ printf '{"objective":"Document the control-plane contract surface","commands":["
4539
4539
  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
4540
4540
  printf 'bun run typecheck' | contractspec connect verify --task refactor-docs --tool acp.terminal.exec --stdin --json
4541
4541
  contractspec connect review list --json
4542
- 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
+ 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:lh.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:sh.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:dh.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:ph.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(il,{href:"/docs/architecture/control-plane",className:"btn-primary",children:"Control-plane runtime"}),oe(il,{href:"/docs/studio",className:"btn-ghost",children:"Studio bridge"})]})]})]})}import Wi from"@contractspec/lib.ui-link";import{ChevronRight as uh}from"lucide-react";import{jsx as G,jsxs as ve}from"react/jsx-runtime";var gh=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
4543
4543
  import { ListDataGridShowcaseRowsQuery } from '@contractspec/example.data-grid-showcase/contracts/data-grid-showcase.operation';
4544
4544
 
4545
4545
  export const DataGridShowcaseDataView = defineDataView({
@@ -4586,7 +4586,7 @@ export const DataGridShowcaseDataView = defineDataView({
4586
4586
  { key: 'notes', label: 'Notes', dataPath: 'notes' },
4587
4587
  ],
4588
4588
  },
4589
- });`;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\u2014databases, 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\u2014no 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"})," \u2013 Optimized SQL or NoSQL queries executed at runtime"]}),ve("li",{children:[G("strong",{children:"API endpoints"})," \u2013 RESTful or GraphQL endpoints for fetching data"]}),ve("li",{children:[G("strong",{children:"UI components"})," \u2013 List views, tables, cards, and detail views"]}),ve("li",{children:[G("strong",{children:"Search interfaces"})," \u2013 Full-text search with autocomplete"]}),ve("li",{children:[G("strong",{children:"Export functions"})," \u2013 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\u2014this 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\u2014they 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 \u2192 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
+ });`;function hh(){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\u2014databases, 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:gh})}),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\u2014no 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"})," \u2013 Optimized SQL or NoSQL queries executed at runtime"]}),ve("li",{children:[G("strong",{children:"API endpoints"})," \u2013 RESTful or GraphQL endpoints for fetching data"]}),ve("li",{children:[G("strong",{children:"UI components"})," \u2013 List views, tables, cards, and detail views"]}),ve("li",{children:[G("strong",{children:"Search interfaces"})," \u2013 Full-text search with autocomplete"]}),ve("li",{children:[G("strong",{children:"Export functions"})," \u2013 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\u2014this 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\u2014they 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(uh,{size:16})]})]})]})}import{CodeBlock as rl}from"@contractspec/lib.design-system";import nl from"@contractspec/lib.ui-link";import{jsx as j,jsxs as tt}from"react/jsx-runtime";var fh=["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"],yh=["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 vh(){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 \u2192 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:fh.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(rl,{language:"typescript",filename:"support.workbench.bundle.ts",code:`import { defineModuleBundle } from "@contractspec/lib.surface-runtime/spec/define-module-bundle";
4590
4590
 
4591
4591
  export const SupportWorkbenchBundle = defineModuleBundle({
4592
4592
  meta: {
@@ -4621,7 +4621,7 @@ export const SupportWorkbenchBundle = defineModuleBundle({
4621
4621
  },
4622
4622
  },
4623
4623
  },
4624
- });`})]}),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:"2) Resolve and render the plan"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"The app renders the resolved plan, not the raw spec. That keeps layout choice, data hydration, overlays, and AI proposals auditable."})]}),j(al,{language:"tsx",filename:"SurfaceHost.tsx",code:`import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
4624
+ });`})]}),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:"2) Resolve and render the plan"}),j("p",{className:"text-muted-foreground text-sm leading-7",children:"The app renders the resolved plan, not the raw spec. That keeps layout choice, data hydration, overlays, and AI proposals auditable."})]}),j(rl,{language:"tsx",filename:"SurfaceHost.tsx",code:`import { BundleProvider, BundleRenderer } from "@contractspec/lib.surface-runtime/react";
4625
4625
  import { resolveBundle } from "@contractspec/lib.surface-runtime/runtime/resolve-bundle";
4626
4626
 
4627
4627
  const plan = await resolveBundle(SupportWorkbenchBundle, {
@@ -4651,7 +4651,7 @@ export function SurfaceHost() {
4651
4651
  <BundleRenderer assistantSlotId="assistant" />
4652
4652
  </BundleProvider>
4653
4653
  );
4654
- }`})]}),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"})," \u2013 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"})," \u2013 Change the order in which fields appear"]}),O("li",{children:[y("strong",{children:"Rename labels"})," \u2013 Use different terminology that's more familiar to the user"]}),O("li",{children:[y("strong",{children:"Change layouts"})," \u2013 Switch between list, grid, or card views"]}),O("li",{children:[y("strong",{children:"Add help text"})," \u2013 Provide context-specific guidance"]}),O("li",{children:[y("strong",{children:"Set default values"})," \u2013 Pre-fill forms with tenant-specific defaults"]}),O("li",{children:[y("strong",{children:"Apply branding"})," \u2013 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
+ }`})]}),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:yh.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(nl,{href:"/docs/specs/overlays",className:"btn-primary",children:"Overlays"}),j(nl,{href:"/docs/architecture",className:"btn-ghost",children:"Architecture overview"})]})]})]})}import ai from"@contractspec/lib.ui-link";import{ChevronRight as bh}from"lucide-react";import{jsx as y,jsxs as O}from"react/jsx-runtime";function Nh(){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"})," \u2013 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"})," \u2013 Change the order in which fields appear"]}),O("li",{children:[y("strong",{children:"Rename labels"})," \u2013 Use different terminology that's more familiar to the user"]}),O("li",{children:[y("strong",{children:"Change layouts"})," \u2013 Switch between list, grid, or card views"]}),O("li",{children:[y("strong",{children:"Add help text"})," \u2013 Provide context-specific guidance"]}),O("li",{children:[y("strong",{children:"Set default values"})," \u2013 Pre-fill forms with tenant-specific defaults"]}),O("li",{children:[y("strong",{children:"Apply branding"})," \u2013 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
4655
4655
  version: '1.0.0'.0.0
4656
4656
  appliesTo:
4657
4657
  capability: createOrder
@@ -4688,7 +4688,7 @@ modifications:
4688
4688
  signature:
4689
4689
  algorithm: EdDSA
4690
4690
  publicKey: "acme-corp-overlay-key"
4691
- 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"})," \u2013 They can only hide or rearrange what the user is already allowed to see"]}),O("li",{children:[y("strong",{children:"Overlays cannot bypass validation"})," \u2013 Field types, constraints, and business rules from the underlying spec still apply"]}),O("li",{children:[y("strong",{children:"Overlays must be signed"})," \u2013 Only authorized parties (typically tenant admins) can create overlays"]}),O("li",{children:[y("strong",{children:"Overlays are versioned"})," \u2013 Changes to overlays are tracked and can be rolled back"]}),O("li",{children:[y("strong",{children:"Overlays are audited"})," \u2013 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"})," \u2013 A drag-and-drop interface for non-technical users"]}),O("li",{children:[y("strong",{children:"TypeScript/JSON"})," \u2013 For developers who prefer code"]}),O("li",{children:[y("strong",{children:"API"})," \u2013 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"})," \u2013 All users in a tenant see the same overlay"]}),O("li",{children:[y("strong",{children:"User"})," \u2013 Individual users can have personal overlays"]}),O("li",{children:[y("strong",{children:"Role"})," \u2013 All users with a specific role see the overlay"]}),O("li",{children:[y("strong",{children:"Device"})," \u2013 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\u2014this 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\u2014they 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 \u2192 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\u2014from 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\u2014it 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\u2014the"," ",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"})," \u2013 PERMIT, DENY, or REDACT"]}),q("li",{children:[m("strong",{children:"Condition"})," \u2013 A boolean expression that determines when the rule applies"]}),q("li",{children:[m("strong",{children:"Scope"})," \u2013 Which resources, actions, or fields the rule applies to"]}),q("li",{children:[m("strong",{children:"Priority"})," \u2013 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
+ 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"})," \u2013 They can only hide or rearrange what the user is already allowed to see"]}),O("li",{children:[y("strong",{children:"Overlays cannot bypass validation"})," \u2013 Field types, constraints, and business rules from the underlying spec still apply"]}),O("li",{children:[y("strong",{children:"Overlays must be signed"})," \u2013 Only authorized parties (typically tenant admins) can create overlays"]}),O("li",{children:[y("strong",{children:"Overlays are versioned"})," \u2013 Changes to overlays are tracked and can be rolled back"]}),O("li",{children:[y("strong",{children:"Overlays are audited"})," \u2013 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"})," \u2013 A drag-and-drop interface for non-technical users"]}),O("li",{children:[y("strong",{children:"TypeScript/JSON"})," \u2013 For developers who prefer code"]}),O("li",{children:[y("strong",{children:"API"})," \u2013 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"})," \u2013 All users in a tenant see the same overlay"]}),O("li",{children:[y("strong",{children:"User"})," \u2013 Individual users can have personal overlays"]}),O("li",{children:[y("strong",{children:"Role"})," \u2013 All users with a specific role see the overlay"]}),O("li",{children:[y("strong",{children:"Device"})," \u2013 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\u2014this 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\u2014they 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(bh,{size:16})]})]})]})}import cl from"@contractspec/lib.ui-link";import{ChevronRight as ll}from"lucide-react";import{jsx as me,jsxs as bt}from"react/jsx-runtime";var wh=[{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"}],kh=[{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 Sh(){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 \u2192 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:wh.map((e)=>bt(cl,{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(ll,{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:kh.map((e)=>bt(cl,{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(ll,{size:14})]})]},e.title))})]})]})}import oi from"@contractspec/lib.ui-link";import{ChevronRight as Ch}from"lucide-react";import{jsx as m,jsxs as q}from"react/jsx-runtime";function Ih(){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\u2014from 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\u2014it 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\u2014the"," ",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"})," \u2013 PERMIT, DENY, or REDACT"]}),q("li",{children:[m("strong",{children:"Condition"})," \u2013 A boolean expression that determines when the rule applies"]}),q("li",{children:[m("strong",{children:"Scope"})," \u2013 Which resources, actions, or fields the rule applies to"]}),q("li",{children:[m("strong",{children:"Priority"})," \u2013 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';
4692
4692
 
4693
4693
  export const CustomerDataAccess = definePolicy({
4694
4694
  meta: {
@@ -4743,7 +4743,7 @@ export const CustomerDataAccess = definePolicy({
4743
4743
  sensitivity: PHI
4744
4744
  - name: salary
4745
4745
  type: number
4746
- 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"})," \u2013 Test how policies evaluate for different users and scenarios"]}),q("li",{children:[m("strong",{children:"Coverage analysis"})," \u2013 Identify resources or actions that aren't covered by any policy"]}),q("li",{children:[m("strong",{children:"Conflict detection"})," \u2013 Find rules that might conflict or produce unexpected results"]}),q("li",{children:[m("strong",{children:"Audit mode"})," \u2013 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\u2014explicitly 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
+ 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"})," \u2013 Test how policies evaluate for different users and scenarios"]}),q("li",{children:[m("strong",{children:"Coverage analysis"})," \u2013 Identify resources or actions that aren't covered by any policy"]}),q("li",{children:[m("strong",{children:"Conflict detection"})," \u2013 Find rules that might conflict or produce unexpected results"]}),q("li",{children:[m("strong",{children:"Audit mode"})," \u2013 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\u2014explicitly 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(Ch,{size:16})]})]})]})}import Rr from"@contractspec/lib.ui-link";import{ChevronRight as Ph}from"lucide-react";import{jsx as P,jsxs as ce}from"react/jsx-runtime";function Th(){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(Rr,{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';
4747
4747
  import { ValidatePaymentMethod, ChargePayment, SendEmail } from './specs';
4748
4748
 
4749
4749
  export const PaymentFlow = defineWorkflow({
@@ -4795,4 +4795,4 @@ export const PaymentFlow = defineWorkflow({
4795
4795
  maxDuration: 30000, // milliseconds
4796
4796
  alertOnBreach: true,
4797
4797
  },
4798
- });`})})]}),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"})," \u2013 A user or system calls the workflow via an API endpoint."]}),ce("li",{children:[P("strong",{children:"Event-driven"})," \u2013 The workflow starts automatically when a specific event occurs (e.g., a new order is created)."]}),ce("li",{children:[P("strong",{children:"Scheduled"})," \u2013 The workflow runs on a cron schedule (e.g., nightly batch processing)."]}),ce("li",{children:[P("strong",{children:"Chained"})," \u2013 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 \u2013 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};
4798
+ });`})})]}),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"})," \u2013 A user or system calls the workflow via an API endpoint."]}),ce("li",{children:[P("strong",{children:"Event-driven"})," \u2013 The workflow starts automatically when a specific event occurs (e.g., a new order is created)."]}),ce("li",{children:[P("strong",{children:"Scheduled"})," \u2013 The workflow runs on a cron schedule (e.g., nightly batch processing)."]}),ce("li",{children:[P("strong",{children:"Chained"})," \u2013 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 \u2013 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(Rr,{href:"/docs/specs/capabilities",className:"btn-ghost",children:"Previous: Capabilities"}),ce(Rr,{href:"/docs/safety",className:"btn-primary",children:["Next: Safety Features ",P(Ph,{size:16})]})]})]})}import Ah from"@contractspec/lib.ui-link";import{jsx as Lr,jsxs as Lh}from"react/jsx-runtime";function Rh(){return Lh("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:"Security and BYOK guidance now lives in the Studio app docs."}),Lr(Ah,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Eh from"@contractspec/lib.ui-link";import{jsx as Er,jsxs as Oh}from"react/jsx-runtime";function Dh(){return Oh("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:"Deployment guidance now lives in the Studio app docs."}),Er(Eh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Mh from"@contractspec/lib.ui-link";import{jsx as Dr,jsxs as Uh}from"react/jsx-runtime";function Bh(){return Uh("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:"The latest getting-started guide now lives in the Studio app docs."}),Dr(Mh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}import Wh from"@contractspec/lib.ui-link";import{jsx as Or,jsxs as zh}from"react/jsx-runtime";function _h(){return zh("main",{className:"space-y-6 py-12",children:[Or("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Or("p",{className:"text-muted-foreground text-sm",children:"Integration guides now live in the Studio app docs."}),Or(Wh,{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 Gh=["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 qh(){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:Gh.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 Vh from"@contractspec/lib.ui-link";import{jsx as Mr,jsxs as Fh}from"react/jsx-runtime";function Hh(){return Fh("main",{className:"space-y-6 py-12",children:[Mr("h1",{className:"font-bold text-3xl",children:"Studio docs moved"}),Mr("p",{className:"text-muted-foreground text-sm",children:"Visual builder documentation now lives in the Studio app docs."}),Mr(Vh,{href:"https://www.contractspec.studio/docs",className:"btn-primary",children:"Open Studio docs"})]})}export{rn as listGeneratedDocs,Br as getSecondaryDocsPages,hl as getPrimaryDocsTraversal,gl as getPrimaryDocsSections,Wv as getGeneratedDocById,Qh as getDocsPageByHref,Yh as getDocsNextPrevious,Uv as getDocsIndexManifest,Ur as getDocsHomeSections,Ab as VSCodeExtensionPage,sd as TroubleshootingPage,Hh as StudioVisualBuilderPage,qh as StudioOverviewPage,_h as StudioIntegrationsPage,Bh as StudioGettingStartedPage,Dh as StudioDeploymentsPage,Rh as StudioBYOKPage,nd as StartHerePage,Th as SpecsWorkflowsPage,Ih as SpecsPolicyPage,Sh as SpecsOverviewPage,Nh as SpecsOverlaysPage,vh as SpecsModuleBundlesPage,hh as SpecsDataViewsPage,mh as SpecsConnectPage,nh as SpecsCapabilitiesPage,oh as SpecsBuilderControlPlanePage,rm as SpecDrivenDevelopmentPage,am as SchemaValidationTypescriptPage,jg as SafetyTenantIsolationPage,xg as SafetySigningPage,Zg as SafetySecurityTrustPage,Jg as SafetyPDPPage,Qg as SafetyOverviewPage,Hg as SafetyMigrationsPage,qg as SafetyAuditingPage,sg as OpsDistributedTracingPage,lg as OpsAutoEvolutionPage,jp as OpenapiAlternativePage,cg as ManifestoPage,ng as LibrariesWorkflowsPage,ag as LibrariesWorkflowComposerPage,ju as LibrariesUIKitWebPage,Ju as LibrariesUIKitPage,Hu as LibrariesTestingPage,Gu as LibrariesSupportBotPage,Mu as LibrariesSchemaPage,Wu as LibrariesSLOPage,Eu as LibrariesRuntimePage,Tu as LibrariesResiliencePage,Cu as LibrariesProgressiveDeliveryPage,wu as LibrariesPersonalizationPage,vu as LibrariesOverviewPage,gu as LibrariesOverlayEnginePage,pu as LibrariesObservabilityPage,lu as LibrariesMultiTenancyPage,ru as LibrariesGrowthPage,au as LibrariesGraphQLPage,xm as LibrariesEvolutionPage,Zm as LibrariesDesignSystemPage,Hm as LibrariesDataViewsPage,Gm as LibrariesDataBackendPage,Wm as LibrariesCrossPlatformUIPage,Bm as LibrariesCostTrackingPage,Dm as LibrariesContractsPage,Tm as LibrariesContentGenPage,Sm as LibrariesAnalyticsPage,wm as LibrariesAiAgentPage,vm as LibrariesAccessibilityPage,hm as KnowledgeSpacesPage,um as KnowledgeSourcesPage,pm as KnowledgeOverviewPage,lm as KnowledgeExamplesPage,cm as KnowledgeCategoriesPage,qp as IntegrationsWhatsappTwilioPage,zp as IntegrationsWhatsappMetaPage,Wp as IntegrationsTwilioPage,Up as IntegrationsStripePage,Mp as IntegrationsSpecModelPage,Dp as IntegrationsSlackPage,Lp as IntegrationsS3Page,Ap as IntegrationsResendPage,Pp as IntegrationsQdrantPage,Cp as IntegrationsPowensPage,kp as IntegrationsPostmarkPage,Np as IntegrationsOverviewPage,vp as IntegrationsOpenAIPage,fp as IntegrationsMistralPage,gp as IntegrationsHealthRoutingPage,up as IntegrationsGoogleCalendarPage,pp as IntegrationsGmailPage,sp as IntegrationsGithubPage,cp as IntegrationsElevenLabsPage,rp as IntegrationsCircuitBreakersPage,od as InstallationPage,ed as HelloWorldPage,ap as GuidesIndexPage,Zd as GuideSpecValidationTypingPage,Yd as GuideReleaseCapsulesPage,Fd as GuideNextjsOneEndpointPage,Vd as GuideImportExistingCodebasesPage,Ud as GuideHostBuilderWorkbenchPage,Dd as GuideGenerateDocsClientsSchemasPage,Ld as GuideFirstModuleBundlePage,Ad as GuideDocsPipelinePage,Pd as GuideContractTypesPage,bd as GuideConnectInRepoPage,fd as GuideCIDiffGatingPage,Xp as GenerateClientFromSchemaPage,Rs as ExampleShowcasePage,ns as EcosystemTemplatesPage,as as EcosystemRegistryPage,es as EcosystemPluginsPage,xl as EcosystemIntegrationsPage,_g as DocsReferencePage,Ng as DocsReferenceIndexPage,kl as DocsIndexPage,hs as DocsExamplesPage,ab as DeveloperToolsPage,Yp as DeterministicCodegenPage,Ks as DataViewTutorialPage,Gi as DOCS_PRIMARY_SECTIONS,vi as DOCS_PAGES,Fp as ContractFirstApiPage,Vs as CompatibilityPage,Zl as ComparisonWorkflowEnginesPage,Jl as ComparisonWindmillPage,Yl as ComparisonOverviewPage,Ql as ComparisonInternalToolBuildersPage,Kl as ComparisonEnterprisePlatformsPage,Hl as ComparisonAutomationPlatformsPage,Gs as CLIPage,Vl as ArchitectureOverviewPage,Gl as ArchitectureMultiTenancyPage,Wl as ArchitectureKnowledgeBindingPage,Bl as ArchitectureIntegrationBindingPage,Ol as ArchitectureControlPlanePage,El as ArchitectureAppConfigPage,If as AdvancedWorkflowMonitoringPage,kf as AdvancedTelemetryPage,yf as AdvancedSpecExperimentsPage,uf as AdvancedRenderersPage,lf as AdvancedOverlayEditorPage,of as AdvancedMCPPage};