import{CodeBlock as o}from"@contractspec/lib.design-system";import r from"@contractspec/lib.ui-link";import{jsx as e,jsxs as a}from"react/jsx-runtime";var i=[{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."}],n=["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."],s=["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 p(){return a("div",{className:"space-y-10",children:[a("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."}),a("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."]})]}),a("section",{className:"editorial-proof-strip",children:[a("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."})]}),a("section",{className:"editorial-panel space-y-5",children:[a("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(o,{language:"text",filename:"builder-stack",code:`Packages
- @contractspec/lib.builder-spec
- @contractspec/lib.builder-runtime
- @contractspec/lib.provider-spec
- @contractspec/module.builder-workbench
- @contractspec/module.mobile-review

Web app routes
- /operate/builder/workspaces/:workspaceId
- /operate/builder/workspaces/:workspaceId/mobile-review/:cardId

Operate API proxy
- /api/operate/builder/queries/builder.workspace.snapshot
- /api/operate/builder/commands/builder.blueprint.patch
- /api/operate/builder/commands/builder.export.execute`})]}),e("section",{className:"grid gap-4 md:grid-cols-3",children:i.map((t)=>a("article",{className:"editorial-panel space-y-3",children:[e("h2",{className:"font-semibold text-xl",children:t.title}),e("p",{className:"text-muted-foreground text-sm leading-7",children:t.body})]},t.title))}),a("section",{className:"grid gap-5 lg:grid-cols-2",children:[a("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:n.map((t)=>e("li",{children:t},t))})]}),a("article",{className:"editorial-panel space-y-4",children:[e("h2",{className:"font-serif text-3xl tracking-[-0.03em]",children:"What Builder should not become"}),a("ul",{className:"editorial-list",children:[a("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:"Not a competitor to specialized coding agents such as Codex or Claude Code."})]}),a("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."})]}),a("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:"Not a hidden routing layer that obscures provider provenance, receipts, or runtime mode."})]}),a("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."})]})]})]})]}),a("section",{className:"editorial-panel space-y-5",children:[a("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(o,{language:"json",filename:".contractsrc.json",code:`{
  "builder": {
    "enabled": true,
    "runtimeMode": "local",
    "bootstrapPreset": "local_daemon_mvp",
    "api": {
      "baseUrl": "https://api.contractspec.io",
      "controlPlaneTokenEnvVar": "CONTROL_PLANE_API_TOKEN"
    },
    "localRuntime": {
      "runtimeId": "rt_local_daemon",
      "grantedTo": "local:operator",
      "providerIds": ["provider.codex", "provider.local.model"]
    }
  }
}`})]}),a("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:s.map((t)=>a("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:t})]},t))})]}),a("section",{className:"editorial-panel space-y-5",children:[a("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(o,{language:"tsx",filename:"BuilderWorkbenchHost.tsx",code:`import { BuilderWorkbench, useBuilderWorkbenchState } from "@contractspec/module.builder-workbench";

const state = useBuilderWorkbenchState({
  workspace: initialSnapshot.workspace,
  initialSnapshot,
});

<BuilderWorkbench
  snapshot={state.snapshot}
  promptDraft={state.promptDraft}
  onPromptDraftChange={state.setPromptDraft}
  onCapturePrompt={capturePrompt}
  onGenerateBlueprint={generateBlueprint}
  onCompilePlan={compilePlan}
  onCreatePreview={createPreview}
  onRunReadiness={runReadiness}
  onExecuteExport={executeExport}
  selectedExportRuntimeMode="hybrid"
/>;`})]}),a("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."}),a("div",{className:"flex flex-wrap gap-3",children:[e(r,{href:"/docs/studio",className:"btn-primary",children:"Studio overview"}),e(r,{href:"/docs/architecture/control-plane",className:"btn-ghost",children:"Control-plane runtime"})]})]})]})}export{p as SpecsBuilderControlPlanePage};
