ui-gateway 0.1.0 → 0.1.2
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.
- package/AGENTS.md +41 -6
- package/BENCHMARK.md +141 -0
- package/CHANGELOG.md +200 -2
- package/CONTRIBUTING.md +48 -6
- package/NON-GOALS.md +9 -6
- package/README.md +148 -38
- package/SECURITY.md +22 -1
- package/SKILL.md +71 -17
- package/action.yml +90 -0
- package/dist/evals/src/baseline.d.ts +4 -1
- package/dist/evals/src/baseline.d.ts.map +1 -1
- package/dist/evals/src/baseline.js +28 -6
- package/dist/evals/src/baseline.js.map +1 -1
- package/dist/evals/src/metrics.d.ts +35 -0
- package/dist/evals/src/metrics.d.ts.map +1 -1
- package/dist/evals/src/metrics.js +24 -0
- package/dist/evals/src/metrics.js.map +1 -1
- package/dist/packages/adapters/src/angular/index.js +2 -2
- package/dist/packages/adapters/src/angular/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/angular/manifest.js +2 -8
- package/dist/packages/adapters/src/angular/manifest.js.map +1 -1
- package/dist/packages/adapters/src/antd/index.js +2 -2
- package/dist/packages/adapters/src/antd/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/antd/manifest.js +2 -8
- package/dist/packages/adapters/src/antd/manifest.js.map +1 -1
- package/dist/packages/adapters/src/bootstrap/index.js +2 -2
- package/dist/packages/adapters/src/bootstrap/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/bootstrap/manifest.js +2 -8
- package/dist/packages/adapters/src/bootstrap/manifest.js.map +1 -1
- package/dist/packages/adapters/src/chakra/index.d.ts.map +1 -1
- package/dist/packages/adapters/src/chakra/index.js +30 -5
- package/dist/packages/adapters/src/chakra/index.js.map +1 -1
- package/dist/packages/adapters/src/chakra/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/chakra/manifest.js +309 -10
- package/dist/packages/adapters/src/chakra/manifest.js.map +1 -1
- package/dist/packages/adapters/src/index.d.ts +4 -0
- package/dist/packages/adapters/src/index.d.ts.map +1 -1
- package/dist/packages/adapters/src/index.js +18 -14
- package/dist/packages/adapters/src/index.js.map +1 -1
- package/dist/packages/adapters/src/local.d.ts.map +1 -1
- package/dist/packages/adapters/src/local.js +4 -2
- package/dist/packages/adapters/src/local.js.map +1 -1
- package/dist/packages/adapters/src/mantine/index.js +3 -3
- package/dist/packages/adapters/src/mantine/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/mantine/manifest.js +8 -21
- package/dist/packages/adapters/src/mantine/manifest.js.map +1 -1
- package/dist/packages/adapters/src/mui/index.js +3 -3
- package/dist/packages/adapters/src/mui/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/mui/manifest.js +2 -11
- package/dist/packages/adapters/src/mui/manifest.js.map +1 -1
- package/dist/packages/adapters/src/nuxt-ui/index.d.ts +5 -0
- package/dist/packages/adapters/src/nuxt-ui/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/index.js +79 -0
- package/dist/packages/adapters/src/nuxt-ui/index.js.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.js +295 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.js.map +1 -0
- package/dist/packages/adapters/src/radix/index.d.ts +5 -0
- package/dist/packages/adapters/src/radix/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/radix/index.js +71 -0
- package/dist/packages/adapters/src/radix/index.js.map +1 -0
- package/dist/packages/adapters/src/radix/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/radix/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/radix/manifest.js +331 -0
- package/dist/packages/adapters/src/radix/manifest.js.map +1 -0
- package/dist/packages/adapters/src/registry.d.ts +1 -1
- package/dist/packages/adapters/src/registry.d.ts.map +1 -1
- package/dist/packages/adapters/src/registry.js +16 -12
- package/dist/packages/adapters/src/registry.js.map +1 -1
- package/dist/packages/adapters/src/shadcn/index.js +3 -3
- package/dist/packages/adapters/src/shadcn/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/shadcn/manifest.js +2 -11
- package/dist/packages/adapters/src/shadcn/manifest.js.map +1 -1
- package/dist/packages/adapters/src/solid/index.js +2 -2
- package/dist/packages/adapters/src/solid/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/solid/manifest.js +2 -8
- package/dist/packages/adapters/src/solid/manifest.js.map +1 -1
- package/dist/packages/adapters/src/svelte/index.js +2 -2
- package/dist/packages/adapters/src/svelte/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/svelte/manifest.js +2 -8
- package/dist/packages/adapters/src/svelte/manifest.js.map +1 -1
- package/dist/packages/adapters/src/vue/index.js +2 -2
- package/dist/packages/adapters/src/vue/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/vue/manifest.js +2 -8
- package/dist/packages/adapters/src/vue/manifest.js.map +1 -1
- package/dist/packages/design-md/src/compile.js +2 -2
- package/dist/packages/design-md/src/derive.d.ts +41 -0
- package/dist/packages/design-md/src/derive.d.ts.map +1 -0
- package/dist/packages/design-md/src/derive.js +341 -0
- package/dist/packages/design-md/src/derive.js.map +1 -0
- package/dist/packages/design-md/src/index.d.ts +1 -0
- package/dist/packages/design-md/src/index.d.ts.map +1 -1
- package/dist/packages/design-md/src/index.js +6 -5
- package/dist/packages/design-md/src/index.js.map +1 -1
- package/dist/packages/gateway/src/confidence.d.ts +51 -1
- package/dist/packages/gateway/src/confidence.d.ts.map +1 -1
- package/dist/packages/gateway/src/confidence.js +198 -6
- package/dist/packages/gateway/src/confidence.js.map +1 -1
- package/dist/packages/gateway/src/gateway.d.ts +10 -2
- package/dist/packages/gateway/src/gateway.d.ts.map +1 -1
- package/dist/packages/gateway/src/gateway.js +190 -14
- package/dist/packages/gateway/src/gateway.js.map +1 -1
- package/dist/packages/gateway/src/index.d.ts +1 -0
- package/dist/packages/gateway/src/index.d.ts.map +1 -1
- package/dist/packages/gateway/src/index.js +7 -6
- package/dist/packages/gateway/src/index.js.map +1 -1
- package/dist/packages/gateway/src/preview.d.ts +12 -0
- package/dist/packages/gateway/src/preview.d.ts.map +1 -0
- package/dist/packages/gateway/src/preview.js +113 -0
- package/dist/packages/gateway/src/preview.js.map +1 -0
- package/dist/packages/gateway/src/validate.d.ts +5 -2
- package/dist/packages/gateway/src/validate.d.ts.map +1 -1
- package/dist/packages/gateway/src/validate.js +46 -18
- package/dist/packages/gateway/src/validate.js.map +1 -1
- package/dist/packages/kb/src/bundle-size.d.ts +8 -9
- package/dist/packages/kb/src/bundle-size.d.ts.map +1 -1
- package/dist/packages/kb/src/bundle-size.js +14 -12
- package/dist/packages/kb/src/bundle-size.js.map +1 -1
- package/dist/packages/kb/src/entry.d.ts +19 -1
- package/dist/packages/kb/src/entry.d.ts.map +1 -1
- package/dist/packages/kb/src/entry.js +13 -1
- package/dist/packages/kb/src/entry.js.map +1 -1
- package/dist/packages/kb/src/freshness.d.ts +76 -0
- package/dist/packages/kb/src/freshness.d.ts.map +1 -0
- package/dist/packages/kb/src/freshness.js +186 -0
- package/dist/packages/kb/src/freshness.js.map +1 -0
- package/dist/packages/kb/src/index.d.ts +2 -1
- package/dist/packages/kb/src/index.d.ts.map +1 -1
- package/dist/packages/kb/src/index.js +6 -5
- package/dist/packages/kb/src/index.js.map +1 -1
- package/dist/packages/kb/src/ingest.d.ts +3 -0
- package/dist/packages/kb/src/ingest.d.ts.map +1 -1
- package/dist/packages/kb/src/ingest.js +7 -1
- package/dist/packages/kb/src/ingest.js.map +1 -1
- package/dist/packages/kb/src/kb.d.ts +5 -0
- package/dist/packages/kb/src/kb.d.ts.map +1 -1
- package/dist/packages/kb/src/kb.js +5 -2
- package/dist/packages/kb/src/kb.js.map +1 -1
- package/dist/packages/matcher/src/anthropic.js +1 -1
- package/dist/packages/matcher/src/index.d.ts +8 -1
- package/dist/packages/matcher/src/index.d.ts.map +1 -1
- package/dist/packages/matcher/src/index.js +21 -11
- package/dist/packages/matcher/src/index.js.map +1 -1
- package/dist/packages/matcher/src/scaffold.d.ts.map +1 -1
- package/dist/packages/matcher/src/scaffold.js +62 -19
- package/dist/packages/matcher/src/scaffold.js.map +1 -1
- package/dist/packages/matcher/src/score.d.ts +8 -1
- package/dist/packages/matcher/src/score.d.ts.map +1 -1
- package/dist/packages/matcher/src/score.js +90 -25
- package/dist/packages/matcher/src/score.js.map +1 -1
- package/dist/packages/matcher/src/select.d.ts +15 -1
- package/dist/packages/matcher/src/select.d.ts.map +1 -1
- package/dist/packages/matcher/src/select.js +53 -3
- package/dist/packages/matcher/src/select.js.map +1 -1
- package/dist/packages/orchestrator/src/figma.d.ts +12 -0
- package/dist/packages/orchestrator/src/figma.d.ts.map +1 -0
- package/dist/packages/orchestrator/src/figma.js +102 -0
- package/dist/packages/orchestrator/src/figma.js.map +1 -0
- package/dist/packages/orchestrator/src/index.d.ts +1 -0
- package/dist/packages/orchestrator/src/index.d.ts.map +1 -1
- package/dist/packages/orchestrator/src/index.js +3 -2
- package/dist/packages/orchestrator/src/index.js.map +1 -1
- package/dist/packages/orchestrator/src/orchestrator.d.ts.map +1 -1
- package/dist/packages/orchestrator/src/orchestrator.js +14 -3
- package/dist/packages/orchestrator/src/orchestrator.js.map +1 -1
- package/dist/packages/profile/src/detect.d.ts +9 -0
- package/dist/packages/profile/src/detect.d.ts.map +1 -1
- package/dist/packages/profile/src/detect.js +52 -5
- package/dist/packages/profile/src/detect.js.map +1 -1
- package/dist/packages/profile/src/index.js +7 -7
- package/dist/packages/profile/src/local-components.d.ts.map +1 -1
- package/dist/packages/profile/src/local-components.js +70 -1
- package/dist/packages/profile/src/local-components.js.map +1 -1
- package/dist/packages/profile/src/registry.d.ts.map +1 -1
- package/dist/packages/profile/src/registry.js +3 -1
- package/dist/packages/profile/src/registry.js.map +1 -1
- package/dist/packages/profile/src/skills.js +1 -1
- package/dist/packages/protocol/src/errors.js +1 -1
- package/dist/packages/protocol/src/errors.js.map +1 -1
- package/dist/packages/protocol/src/event-log.d.ts.map +1 -1
- package/dist/packages/protocol/src/event-log.js +11 -5
- package/dist/packages/protocol/src/event-log.js.map +1 -1
- package/dist/packages/protocol/src/events.js +5 -5
- package/dist/packages/protocol/src/hashing.d.ts +6 -0
- package/dist/packages/protocol/src/hashing.d.ts.map +1 -1
- package/dist/packages/protocol/src/hashing.js +8 -2
- package/dist/packages/protocol/src/hashing.js.map +1 -1
- package/dist/packages/protocol/src/index.js +12 -12
- package/dist/packages/protocol/src/lease.js +2 -2
- package/dist/packages/protocol/src/schemas.d.ts +2803 -116
- package/dist/packages/protocol/src/schemas.d.ts.map +1 -1
- package/dist/packages/protocol/src/schemas.js +54 -4
- package/dist/packages/protocol/src/schemas.js.map +1 -1
- package/dist/packages/protocol/src/semantic.js +1 -1
- package/dist/packages/protocol/src/state-machine.js +1 -1
- package/dist/packages/transports/src/check.d.ts +30 -0
- package/dist/packages/transports/src/check.d.ts.map +1 -0
- package/dist/packages/transports/src/check.js +190 -0
- package/dist/packages/transports/src/check.js.map +1 -0
- package/dist/packages/transports/src/cli.d.ts +1 -1
- package/dist/packages/transports/src/cli.js +278 -25
- package/dist/packages/transports/src/cli.js.map +1 -1
- package/dist/packages/transports/src/exit-codes.d.ts +8 -0
- package/dist/packages/transports/src/exit-codes.d.ts.map +1 -0
- package/dist/packages/transports/src/exit-codes.js +19 -0
- package/dist/packages/transports/src/exit-codes.js.map +1 -0
- package/dist/packages/transports/src/http.js +2 -2
- package/dist/packages/transports/src/http.js.map +1 -1
- package/dist/packages/transports/src/index.d.ts +5 -0
- package/dist/packages/transports/src/index.d.ts.map +1 -1
- package/dist/packages/transports/src/index.js +11 -6
- package/dist/packages/transports/src/index.js.map +1 -1
- package/dist/packages/transports/src/init.d.ts +32 -0
- package/dist/packages/transports/src/init.d.ts.map +1 -0
- package/dist/packages/transports/src/init.js +110 -0
- package/dist/packages/transports/src/init.js.map +1 -0
- package/dist/packages/transports/src/mcp-config.d.ts +27 -0
- package/dist/packages/transports/src/mcp-config.d.ts.map +1 -0
- package/dist/packages/transports/src/mcp-config.js +99 -0
- package/dist/packages/transports/src/mcp-config.js.map +1 -0
- package/dist/packages/transports/src/mcp.js +3 -3
- package/dist/packages/transports/src/paths.d.ts +9 -0
- package/dist/packages/transports/src/paths.d.ts.map +1 -0
- package/dist/packages/transports/src/paths.js +32 -0
- package/dist/packages/transports/src/paths.js.map +1 -0
- package/dist/packages/transports/src/receipt.d.ts +8 -0
- package/dist/packages/transports/src/receipt.d.ts.map +1 -0
- package/dist/packages/transports/src/receipt.js +87 -0
- package/dist/packages/transports/src/receipt.js.map +1 -0
- package/dist/packages/transports/src/resources.js +3 -3
- package/dist/packages/transports/src/resources.js.map +1 -1
- package/dist/packages/transports/src/tools.d.ts.map +1 -1
- package/dist/packages/transports/src/tools.js +284 -10
- package/dist/packages/transports/src/tools.js.map +1 -1
- package/dist/packages/verifier/src/index.js +7 -7
- package/dist/packages/verifier/src/lint.js +1 -1
- package/dist/packages/verifier/src/page.js +2 -2
- package/dist/packages/verifier/src/render-axe.js +1 -1
- package/dist/packages/verifier/src/verify.js +4 -4
- package/dist/scripts/build-site.d.ts +2 -0
- package/dist/scripts/build-site.d.ts.map +1 -0
- package/dist/scripts/build-site.js +254 -0
- package/dist/scripts/build-site.js.map +1 -0
- package/dist/scripts/calibration.js +33 -2
- package/dist/scripts/calibration.js.map +1 -1
- package/dist/scripts/fix-imports.js +32 -2
- package/dist/scripts/fix-imports.js.map +1 -1
- package/dist/scripts/generate-kb.d.ts +3 -0
- package/dist/scripts/generate-kb.d.ts.map +1 -0
- package/dist/scripts/generate-kb.js +195 -0
- package/dist/scripts/generate-kb.js.map +1 -0
- package/dist/scripts/generate-refusal-catalog.d.ts +3 -0
- package/dist/scripts/generate-refusal-catalog.d.ts.map +1 -0
- package/dist/scripts/generate-refusal-catalog.js +50 -0
- package/dist/scripts/generate-refusal-catalog.js.map +1 -0
- package/dist/scripts/generate-tool-docs.d.ts +3 -0
- package/dist/scripts/generate-tool-docs.d.ts.map +1 -0
- package/dist/scripts/generate-tool-docs.js +24 -0
- package/dist/scripts/generate-tool-docs.js.map +1 -0
- package/dist/scripts/mcp-config.js +28 -60
- package/dist/scripts/mcp-config.js.map +1 -1
- package/docs/archive/UI Gateway Final Project Roadmap.md +285 -0
- package/docs/benchmarks/external-repos.json +26 -0
- package/docs/benchmarks/local-gemma3-1b-stride32.json +455 -0
- package/docs/calibration.svg +44 -0
- package/docs/design-import.md +19 -0
- package/docs/design-md.md +109 -0
- package/docs/distribution.md +41 -0
- package/docs/engineering-principles.md +152 -0
- package/docs/layers-plan.md +372 -0
- package/docs/metrics.md +153 -0
- package/docs/modes.md +22 -0
- package/docs/parking-lot.md +25 -0
- package/docs/quickstart.md +72 -0
- package/docs/refusal-catalog.md +32 -0
- package/docs/spike-source-discovery.md +36 -0
- package/docs/telemetry.md +26 -0
- package/evals/fixtures/external-repos.json +55 -0
- package/evals/fixtures/kb-generated/angular.json +72 -0
- package/evals/fixtures/kb-generated/antd.json +72 -0
- package/evals/fixtures/kb-generated/bootstrap.json +72 -0
- package/evals/fixtures/kb-generated/chakra.json +14939 -0
- package/evals/fixtures/kb-generated/mantine.json +192 -0
- package/evals/fixtures/kb-generated/mui.json +8997 -0
- package/evals/fixtures/kb-generated/shadcn.json +192 -0
- package/evals/fixtures/kb-generated/solid.json +72 -0
- package/evals/fixtures/kb-generated/svelte.json +72 -0
- package/evals/fixtures/kb-generated/vue.json +72 -0
- package/evals/fixtures/projects/existing-chakra-v3/package.json +10 -0
- package/evals/fixtures/projects/existing-nuxt-ui/package.json +9 -0
- package/evals/fixtures/projects/existing-radix/package.json +9 -0
- package/evals/out/agent-report.json +190 -11
- package/evals/out/baseline-report.json +1441 -387
- package/evals/out/calibration.json +387 -42
- package/evals/out/external-repos-report.json +112 -0
- package/evals/out/local-benchmark-report.json +455 -0
- package/evals/src/agent-eval.test.ts +3 -0
- package/evals/src/agent-eval.ts +26 -4
- package/evals/src/baseline.ts +48 -7
- package/evals/src/blind-labeling-cli.ts +5 -0
- package/evals/src/blind-labeling.ts +46 -0
- package/evals/src/external-repos.ts +179 -0
- package/evals/src/metrics.ts +70 -0
- package/evals/src/mutations.ts +6 -6
- package/evals/src/page-a11y-eval.ts +37 -36
- package/evals/src/page-real-eval.ts +8 -7
- package/evals/src/plain-agent.test.ts +14 -0
- package/evals/src/plain-agent.ts +240 -0
- package/evals/src/run-agent-evals.ts +3 -0
- package/evals/src/run-external-repos.ts +43 -0
- package/evals/src/run-local-benchmark.ts +105 -0
- package/evals/src/run-plain-agent.ts +81 -0
- package/examples/README.md +32 -0
- package/examples/build-handoff.ts +106 -0
- package/examples/design-md.md +24 -0
- package/examples/handoff-input.json +59 -0
- package/examples/handoff.json +216 -0
- package/examples/layer-operations.json +18 -0
- package/examples/website-demo-handoff.json +580 -0
- package/package.json +30 -7
- package/references/design-md.md +3 -1
- package/references/errors.md +1 -1
- package/references/handoff.md +16 -1
- package/references/outcomes.md +60 -11
- package/references/patterns.md +3 -3
- package/references/tools.md +86 -27
- package/scripts/action-review.mjs +59 -0
- package/scripts/bench-latency.ts +90 -0
- package/scripts/build-site.ts +324 -0
- package/scripts/calibration.ts +50 -14
- package/scripts/fix-imports.ts +31 -2
- package/scripts/generate-kb.ts +214 -0
- package/scripts/generate-refusal-catalog.ts +58 -0
- package/scripts/generate-tool-docs.ts +31 -0
- package/scripts/mcp-config.ts +26 -83
- package/scripts/package-plugin.mjs +50 -0
- package/scripts/sbom.mjs +46 -0
- package/scripts/visual-diff.mjs +52 -0
- package/site/data.json +187 -0
- package/site/index.html +151 -0
- package/skills/ui-gateway-cli/SKILL.md +41 -0
- package/templates/next-shadcn/.github/workflows/ui-check.yml +14 -0
- package/templates/next-shadcn/.mcp.json +8 -0
- package/templates/next-shadcn/DESIGN.md +35 -0
- package/templates/next-shadcn/README.md +14 -0
- package/templates/next-shadcn/app/page.tsx +8 -0
- package/templates/next-shadcn/package.json +19 -0
- package/templates/vite-mantine/.github/workflows/ui-check.yml +14 -0
- package/templates/vite-mantine/.mcp.json +8 -0
- package/templates/vite-mantine/DESIGN.md +30 -0
- package/templates/vite-mantine/README.md +7 -0
- package/templates/vite-mantine/package.json +21 -0
- package/templates/vite-mantine/src/App.tsx +10 -0
- package/templates/vite-mui/.github/workflows/ui-check.yml +14 -0
- package/templates/vite-mui/.mcp.json +8 -0
- package/templates/vite-mui/DESIGN.md +30 -0
- package/templates/vite-mui/README.md +8 -0
- package/templates/vite-mui/package.json +22 -0
- package/templates/vite-mui/src/App.tsx +12 -0
- package/scripts/fetch-bundle-sizes.ts +0 -106
- package/scripts/test-bundlephobia.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-kb.js","sourceRoot":"","sources":["../../scripts/generate-kb.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAoBvE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AACxE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;AAEnE,MAAM,SAAS,GAAe,EAAE,CAAC;AACjC,KAAK,MAAM,OAAO,IAAI,qBAAqB,EAAE,EAAE,CAAC;IAC9C,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,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;QAChG,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnC,IAAI,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-refusal-catalog.d.ts","sourceRoot":"","sources":["../../scripts/generate-refusal-catalog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Generate docs/refusal-catalog.md from the protocol ErrorCode enum. The
|
|
4
|
+
* catalog is the agent-facing list of every refusal, whether it is retryable,
|
|
5
|
+
* and what to do next. Run with `npm run docs:refusals`.
|
|
6
|
+
*/
|
|
7
|
+
import { writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { ErrorCodeSchema, RETRYABLE } from "../packages/protocol/src/index";
|
|
10
|
+
const FIXES = {
|
|
11
|
+
INVALID_HANDOFF: "Fix the schema, hash, semantic issue or Design MD error named in the message, then rebuild. Do not submit again unchanged.",
|
|
12
|
+
INTEGRITY_MISMATCH: "Re-read the Design MD and rebuild the handoff so design_md_hash matches the normalized text.",
|
|
13
|
+
CONFLICT: "The handoff_id was already used with different content. Use a new handoff_id; do not overwrite history.",
|
|
14
|
+
UNSATISFIABLE_CONSTRAINTS: "The Design MD contradicts itself or the project. Remove the conflicting constraint or add the missing provider.",
|
|
15
|
+
NO_MATCH: "No vetted component survived verification. Read the failures, add a local component, or relax the constraint that filtered the candidates.",
|
|
16
|
+
KB_STALE: "Call describe_kb and rebuild with the returned kb_version.",
|
|
17
|
+
LEASE_EXPIRED: "Ownership was not returned in time. Retry with a new handoff or recover the expired result.",
|
|
18
|
+
LEASE_CONFLICT: "Another process owns this handoff. Wait for its lease or use a different handoff_id.",
|
|
19
|
+
UNSUPPORTED: "The framework, schema version or library is not supported. Ask the user; do not guess a fallback.",
|
|
20
|
+
INTERNAL: "Report the message with the handoff id. Do not retry automatically.",
|
|
21
|
+
RESULT_REJECTED: "The returned result failed its integrity check. Report it; do not apply it.",
|
|
22
|
+
};
|
|
23
|
+
const rows = ErrorCodeSchema.options.map((code) => `| \`${code}\` | ${RETRYABLE[code] ? "yes" : "no"} | ${FIXES[code]} |`);
|
|
24
|
+
writeFileSync(join(process.cwd(), "docs", "refusal-catalog.md"), [
|
|
25
|
+
"# Refusal catalog",
|
|
26
|
+
"",
|
|
27
|
+
"Generated from `ErrorCodeSchema` and `RETRYABLE` in `packages/protocol/src/errors.ts`.",
|
|
28
|
+
"Do not edit by hand; run `npm run docs:refusals`.",
|
|
29
|
+
"",
|
|
30
|
+
"The gateway fails closed. A refusal is data: report it, answer the missing",
|
|
31
|
+
"information, or fix the input. Never replace a refused mapping with a guess.",
|
|
32
|
+
"",
|
|
33
|
+
"| Code | Retryable | What to do |",
|
|
34
|
+
"| --- | --- | --- |",
|
|
35
|
+
...rows,
|
|
36
|
+
"",
|
|
37
|
+
"## Outcomes",
|
|
38
|
+
"",
|
|
39
|
+
"| Outcome | Meaning | Action |",
|
|
40
|
+
"| --- | --- | --- |",
|
|
41
|
+
"| `COMPLETED` | Every intent mapped and acceptance passed. | Apply the scaffolds. |",
|
|
42
|
+
"| `PARTIAL` | Some intents mapped; others refused or acceptance failed. | Apply mapped intents only and report the rest. |",
|
|
43
|
+
"| `NEEDS_INPUT` | The gateway needs a decision or a fact. | Write nothing; ask the questions in `missing_information`. |",
|
|
44
|
+
"| `AMBIGUOUS` | Two or more candidates are too close to choose. | Ask the user to pick from the returned alternatives. |",
|
|
45
|
+
"| `FAILED` | Nothing could be mapped, or a hard failure occurred. | Read `errors`; do not retry unchanged. |",
|
|
46
|
+
"| `EXPIRED` | The lease expired before the result was written. | Recover or resubmit with a new handoff. |",
|
|
47
|
+
"",
|
|
48
|
+
].join("\n"), "utf8");
|
|
49
|
+
process.stdout.write(`wrote ${rows.length} error codes to docs/refusal-catalog.md\n`);
|
|
50
|
+
//# sourceMappingURL=generate-refusal-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-refusal-catalog.js","sourceRoot":"","sources":["../../scripts/generate-refusal-catalog.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAkB,MAAM,gCAAgC,CAAC;AAE5F,MAAM,KAAK,GAA8B;IACvC,eAAe,EAAE,4HAA4H;IAC7I,kBAAkB,EAAE,8FAA8F;IAClH,QAAQ,EAAE,yGAAyG;IACnH,yBAAyB,EAAE,iHAAiH;IAC5I,QAAQ,EAAE,4IAA4I;IACtJ,QAAQ,EAAE,4DAA4D;IACtE,aAAa,EAAE,6FAA6F;IAC5G,cAAc,EAAE,sFAAsF;IACtG,WAAW,EAAE,mGAAmG;IAChH,QAAQ,EAAE,qEAAqE;IAC/E,eAAe,EAAE,6EAA6E;CAC/F,CAAC;AAEF,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,QAAQ,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CACjF,CAAC;AAEF,aAAa,CACX,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,oBAAoB,CAAC,EACjD;IACE,mBAAmB;IACnB,EAAE;IACF,wFAAwF;IACxF,mDAAmD;IACnD,EAAE;IACF,4EAA4E;IAC5E,8EAA8E;IAC9E,EAAE;IACF,mCAAmC;IACnC,qBAAqB;IACrB,GAAG,IAAI;IACP,EAAE;IACF,aAAa;IACb,EAAE;IACF,gCAAgC;IAChC,qBAAqB;IACrB,qFAAqF;IACrF,4HAA4H;IAC5H,0HAA0H;IAC1H,0HAA0H;IAC1H,8GAA8G;IAC9G,4GAA4G;IAC5G,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,MAAM,CACP,CAAC;AACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,MAAM,2CAA2C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-tool-docs.d.ts","sourceRoot":"","sources":["../../scripts/generate-tool-docs.ts"],"names":[],"mappings":";AAYA,wBAAgB,eAAe,IAAI,MAAM,CAKxC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Regenerate the tool table in README.md from TOOLS, so the README cannot
|
|
4
|
+
* drift from the actual MCP/HTTP surface. Run with `npm run docs:tools`.
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { TOOLS } from "../packages/transports/src/tools";
|
|
9
|
+
const START = "<!-- TOOLS:START -->";
|
|
10
|
+
const END = "<!-- TOOLS:END -->";
|
|
11
|
+
export function renderToolTable() {
|
|
12
|
+
const rows = TOOLS.map((tool) => `| \`${tool.name}\` | ${tool.description.split(/(?<=\.)\s/)[0].replace(/\|/g, "\\|")} |`);
|
|
13
|
+
return [`| Tool | Purpose |`, `| --- | --- |`, ...rows].join("\n");
|
|
14
|
+
}
|
|
15
|
+
const readmePath = join(process.cwd(), "README.md");
|
|
16
|
+
const readme = readFileSync(readmePath, "utf8");
|
|
17
|
+
if (!readme.includes(START) || !readme.includes(END)) {
|
|
18
|
+
process.stderr.write(`README.md is missing ${START} / ${END} markers\n`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const next = readme.replace(new RegExp(`${START}[\\s\\S]*?${END}`), `${START}\n${renderToolTable()}\n${END}`);
|
|
22
|
+
writeFileSync(readmePath, next, "utf8");
|
|
23
|
+
process.stdout.write(`wrote ${TOOLS.length} tools to README.md\n`);
|
|
24
|
+
//# sourceMappingURL=generate-tool-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-tool-docs.js","sourceRoot":"","sources":["../../scripts/generate-tool-docs.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEzD,MAAM,KAAK,GAAG,sBAAsB,CAAC;AACrC,MAAM,GAAG,GAAG,oBAAoB,CAAC;AAEjC,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CACpB,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CACpG,CAAC;IACF,OAAO,CAAC,oBAAoB,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;AACpD,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,KAAK,MAAM,GAAG,YAAY,CAAC,CAAC;IACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CACzB,IAAI,MAAM,CAAC,GAAG,KAAK,aAAa,GAAG,EAAE,CAAC,EACtC,GAAG,KAAK,KAAK,eAAe,EAAE,KAAK,GAAG,EAAE,CACzC,CAAC;AACF,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,MAAM,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,66 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return { project: resolve(project), client };
|
|
22
|
-
}
|
|
23
|
-
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
24
|
-
const tsxCli = join(repoRoot, "node_modules", "tsx", "dist", "cli.mjs");
|
|
25
|
-
const gatewayCli = join(repoRoot, "packages", "transports", "src", "cli.ts");
|
|
26
|
-
const { project, client } = parseArgs();
|
|
27
|
-
if (!existsSync(tsxCli)) {
|
|
28
|
-
process.stderr.write(`tsx was not found at ${tsxCli}. Run "npm install" in ${repoRoot} first.\n`);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
if (!existsSync(gatewayCli)) {
|
|
32
|
-
process.stderr.write(`gateway CLI was not found at ${gatewayCli}.\n`);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
2
|
+
/**
|
|
3
|
+
* Thin wrapper kept for `npm run mcp:config`. The real implementation lives in
|
|
4
|
+
* packages/transports/src/mcp-config.ts and is exported by the CLI as
|
|
5
|
+
* `ui-gateway mcp:config`, so installed consumers do not need tsx or source.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join, resolve } from "node:path";
|
|
9
|
+
import { detectClient, mergeMcpConfig, readJsonIfPresent, renderMcpConfig } from "../packages/transports/src/mcp-config";
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const valueOf = (name) => {
|
|
12
|
+
const inline = args.find((arg) => arg.startsWith(`--${name}=`));
|
|
13
|
+
if (inline)
|
|
14
|
+
return inline.slice(name.length + 3);
|
|
15
|
+
const index = args.indexOf(`--${name}`);
|
|
16
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
17
|
+
};
|
|
18
|
+
const project = resolve(valueOf("project") ?? process.cwd());
|
|
19
|
+
const requested = valueOf("client");
|
|
20
|
+
const client = (requested ?? detectClient(project));
|
|
35
21
|
if (!existsSync(project)) {
|
|
36
22
|
process.stderr.write(`project directory does not exist: ${project}\n`);
|
|
37
23
|
process.exit(1);
|
|
38
24
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
}, null, 2)}\n`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
process.stdout.write(`${JSON.stringify({
|
|
54
|
-
mcpServers: {
|
|
55
|
-
"ui-gateway": {
|
|
56
|
-
command: command[0],
|
|
57
|
-
args: command.slice(1),
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
}, null, 2)}\n`);
|
|
61
|
-
}
|
|
62
|
-
process.stderr.write(client === "opencode"
|
|
63
|
-
? `\nPaste the "mcp" entry above into your OpenCode config. --project is ${project}.\n`
|
|
64
|
-
: `\nPaste the JSON above into your MCP client config. --project is ${project}.\n` +
|
|
65
|
-
`Use "npm run mcp:config -- --project <dir> --client opencode" for OpenCode.\n`);
|
|
25
|
+
const write = args.includes("--write");
|
|
26
|
+
const rendered = renderMcpConfig({ project, client });
|
|
27
|
+
const config = write
|
|
28
|
+
? mergeMcpConfig(readJsonIfPresent(join(project, rendered.target)), rendered.config)
|
|
29
|
+
: rendered.config;
|
|
30
|
+
if (write)
|
|
31
|
+
writeFileSync(join(project, rendered.target), `${JSON.stringify(config, null, 2)}\n`, "utf8");
|
|
32
|
+
process.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
|
|
33
|
+
process.stderr.write(`${rendered.instructions}${write ? ` Written to ${rendered.target}.` : ""}\n`);
|
|
66
34
|
//# sourceMappingURL=mcp-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../../scripts/mcp-config.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../../scripts/mcp-config.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAkB,MAAM,uCAAuC,CAAC;AAEzI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAsB,EAAE;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,G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,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACzG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# UI Gateway: Final Project Roadmap
|
|
2
|
+
|
|
3
|
+
Prepared 24 November 2026. Consolidates the protocol, safeguard, and project-compatibility decisions into one plan.
|
|
4
|
+
|
|
5
|
+
## 1. Purpose and scope
|
|
6
|
+
|
|
7
|
+
The UI Gateway receives a structured handoff (a Design MD plus wireframe intents, optionally with a project profile) and returns verified UI component mappings from any supported library. It enforces constraints in code, fails closed when it cannot answer safely, and returns ownership of every handoff to its caller.
|
|
8
|
+
|
|
9
|
+
**Library-agnostic.** shadcn/ui is the first adapter, not the only one. v1 commits to two adapters passing one conformance suite; the second is chosen by the Day-1 source-discovery spike.
|
|
10
|
+
|
|
11
|
+
**Project-aware.** When a project already has UI libraries, local components, or UI skills, the gateway detects them and stays compatible. Mode is `greenfield` or `existing`, auto-detected and overridable by flag.
|
|
12
|
+
|
|
13
|
+
**Assumptions.** One developer, about 10 to 15 hours a week, TypeScript monorepo, Zod as the single schema source. You build both the gateway and the orchestrator.
|
|
14
|
+
|
|
15
|
+
## 2. Success metrics
|
|
16
|
+
|
|
17
|
+
Thresholds are written down before the first eval run so they cannot be tuned to the result.
|
|
18
|
+
|
|
19
|
+
| Metric | Target |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Schema validity of outputs (after validation) | 100% |
|
|
22
|
+
| Hallucinated component, import, or prop (after verifier) | 0% by construction |
|
|
23
|
+
| Hard-constraint violations | 0% |
|
|
24
|
+
| Verifier recall (mutation-tested) | Measured and tracked |
|
|
25
|
+
| Acceptable-set hit rate vs plain-Claude baseline | Target set after the baseline run |
|
|
26
|
+
| Silent-wrong rate (wrong and high confidence) | Minimized; the headline number |
|
|
27
|
+
|
|
28
|
+
Statistical caution: with about 100 labeled items and roughly 80% accuracy, the 95% interval is about plus or minus 8 points. Report intervals and trust only large gaps.
|
|
29
|
+
|
|
30
|
+
## 3. Locked design decisions
|
|
31
|
+
|
|
32
|
+
- Fail closed. Deterministic normalizations are recorded; meaning is never guessed.
|
|
33
|
+
- The LLM only selects from candidate IDs that code has vetted. Code writes imports, variants, and state transitions.
|
|
34
|
+
- Per-intent isolation. One corrupted intent never sinks the rest. Default is partial results with typed per-intent errors; `strict` is opt-in.
|
|
35
|
+
- Outcomes: `COMPLETED`, `PARTIAL`, `NEEDS_INPUT`, `AMBIGUOUS`, `FAILED`, `EXPIRED`.
|
|
36
|
+
- Confidence is computed from signals (retrieval score, margin, first-pass verification, sample agreement), never self-reported.
|
|
37
|
+
- All free text (wireframe notes, descriptions, project skills) is untrusted data and never sits in an instruction position.
|
|
38
|
+
- Only protocol code transitions state. The LLM stage returns a result object and nothing more.
|
|
39
|
+
|
|
40
|
+
## 4. Architecture
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
packages/
|
|
44
|
+
protocol/ schemas, state machine, lease, idempotency, event log (SQLite)
|
|
45
|
+
design-md/ parser, normalizer, constraint compiler, satisfiability check
|
|
46
|
+
profile/ project detector, provenance and confidence, conflict detection
|
|
47
|
+
kb/ adapter interface, ingestion, entries, staleness, import verifier
|
|
48
|
+
adapters/ shadcn, second library, local-components adapter
|
|
49
|
+
matcher/ filter, rank, LLM closed-ID selection, scaffold
|
|
50
|
+
verifier/ schema, KB existence, tsc sandbox, prop AST check, coverage, lint
|
|
51
|
+
gateway/ wires the above; in-process API
|
|
52
|
+
orchestrator/ your caller: builds handoffs, tracks ownership, re-verifies results
|
|
53
|
+
transports/ mcp and cli
|
|
54
|
+
evals/ fixtures, mutation harness, golden set, baseline runner
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Dependencies point one way. `protocol` and `design-md` know nothing about the LLM, so they stay exhaustively testable.
|
|
58
|
+
|
|
59
|
+
## 5. Protocol layer
|
|
60
|
+
|
|
61
|
+
**State machine.** `CREATED, VALIDATED, ACCEPTED, IN_PROGRESS`, then a terminal state (`COMPLETED`, `PARTIAL`, `NEEDS_INPUT`, `AMBIGUOUS`, `FAILED`, `EXPIRED`, `REJECTED`, `CANCELLED`), then `RETURNED`. Illegal transitions throw.
|
|
62
|
+
|
|
63
|
+
**Invariants.** One owner at a time. `RETURNED` is the only exit. Terminal states are immutable. Same `handoff_id` with the same content hash is idempotent; with a different hash it is a conflict.
|
|
64
|
+
|
|
65
|
+
**Lease.** Ownership is a lease with a TTL and an injectable clock. If the gateway dies mid-task the lease expires and ownership returns with `EXPIRED`.
|
|
66
|
+
|
|
67
|
+
**Persistence.** Append-only SQLite event log with a hash chain. State is derived by replay. A result and its ownership-return transition are written in one transaction.
|
|
68
|
+
|
|
69
|
+
**Envelope.** `schema_version`, `correlation_id`, `parent_handoff_id`, `deadline`, `design_md_hash`, `profile_hash`. Acceptance criteria are typed predicates (for example `all_intents_mapped`, `scaffolds_compile`, `max_new_dependencies`, `no_forbidden_patterns`), checked by the gateway before returning and re-checked by the caller on receipt.
|
|
70
|
+
|
|
71
|
+
**Error taxonomy** (each with a `retryable` flag): `INVALID_HANDOFF`, `INTEGRITY_MISMATCH`, `UNSATISFIABLE_CONSTRAINTS`, `NO_MATCH`, `KB_STALE`, `LEASE_EXPIRED`, `UNSUPPORTED`, `INTERNAL`.
|
|
72
|
+
|
|
73
|
+
**Versioning.** Additive changes are minor; anything else is major. The gateway rejects versions it does not speak.
|
|
74
|
+
|
|
75
|
+
## 6. Library-agnostic and project-aware design
|
|
76
|
+
|
|
77
|
+
### Adapter interface
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
LibraryAdapter {
|
|
81
|
+
detect(project) installed? version? how is it used?
|
|
82
|
+
ingest(source) KB entries with provenance tier
|
|
83
|
+
tokenMap(designMd) Design MD tokens to the library's theme config
|
|
84
|
+
scaffoldRules() import style, composition patterns
|
|
85
|
+
verify(scaffold) tsc and AST checks specific to the library
|
|
86
|
+
capabilities frameworks, styling systems, tier, verification level
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Unsupported framework or styling combinations return a typed `UNSUPPORTED` instead of a guess. Non-React frameworks need their own compilers (vue-tsc, svelte-check) and are post-v1.
|
|
91
|
+
|
|
92
|
+
### Source-quality ladder
|
|
93
|
+
|
|
94
|
+
| Tier | Source | Verifier trust |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| A | Published TypeScript types / `.d.ts` | Authoritative |
|
|
97
|
+
| B | Library registry or manifest | Authoritative for what it covers |
|
|
98
|
+
| C | Source parsing (ts-morph, `cva`) | Authoritative if it compiles |
|
|
99
|
+
| D | Docs scraping | Advisory only; never used by the verifier |
|
|
100
|
+
|
|
101
|
+
Every mapping carries `verification_level` (`derived`, `partial`, `advisory`). Licenses are recorded per library, and the KB stores metadata rather than copied source. What shadcn and other libraries publish is unverified, which is why Phase 0 includes a source-discovery spike with a pre-decided fallback.
|
|
102
|
+
|
|
103
|
+
### Existing-project mode
|
|
104
|
+
|
|
105
|
+
A detector scans `package.json`, the lockfile, `components.json`, Tailwind or theme config, local component directories, and any project-level skill or convention files. It produces a profile where every field has provenance and confidence, and the handoff pins its hash. Low confidence returns `NEEDS_INPUT`.
|
|
106
|
+
|
|
107
|
+
**Three KB layers, default reuse order:**
|
|
108
|
+
|
|
109
|
+
1. Local components (the project's own wrappers and design system, derived with ts-morph)
|
|
110
|
+
2. Installed libraries (from `node_modules` types)
|
|
111
|
+
3. Catalog libraries (not installed; candidates only)
|
|
112
|
+
|
|
113
|
+
**Policy fields:**
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
project_context.policy {
|
|
117
|
+
reuse_order: ["local", "installed", "new"],
|
|
118
|
+
new_dependencies: "forbid" | "ask" | "allow", // default for existing: "ask"
|
|
119
|
+
on_conflict: "project" | "design_md" | "ask" // default: "ask"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Conflicts handled explicitly.** If the Design MD prefers one library but the project uses another, `preferred_libraries` becomes soft and the conflict is reported; tokens map through the project library's `tokenMap`. Two styling systems in one project are flagged, never mixed silently. A required new dependency appears in `dependency_changes` and respects the policy.
|
|
124
|
+
|
|
125
|
+
**Existing UI skills.** Prose skills cannot be machine-enforced, so they are advisory, untrusted context in a bounded slot of the LLM stage. They can influence selection among vetted candidates but never override hard constraints. Rules that must be enforced belong in the Design MD or project policy, and the gateway can suggest promoting recurring skill rules into constraints. Contradictions with the Design MD appear in `profile_conflicts`.
|
|
126
|
+
|
|
127
|
+
### Schema additions
|
|
128
|
+
|
|
129
|
+
Handoff: `project_context` and policy, `intent_type` enum with structured attributes (`blocking`, `content_size`, `interaction`), tree-shaped wireframe, `kb_version` pin. Output: `interpretation` receipt per intent, ranked `alternatives`, `source` per mapping (`local`, `installed`, `new`), `dependency_changes`, `profile_conflicts`, `verification_level`, computed `confidence`, `profile_hash`.
|
|
130
|
+
|
|
131
|
+
## 7. Edge cases and safeguards
|
|
132
|
+
|
|
133
|
+
### Corrupted or bad input
|
|
134
|
+
|
|
135
|
+
| Kind | Detection | Response |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| Structural (truncated JSON, wrong types) | Zod parse | `INVALID_HANDOFF` |
|
|
138
|
+
| Integrity (altered or cut in transit) | Content hash, pinned `design_md_hash` | `INTEGRITY_MISMATCH`, retryable |
|
|
139
|
+
| Semantic (duplicate ids, empty elements, impossible nesting, cross-field contradiction) | Validators beyond the schema, shared with the producer | Per-intent error, quarantine that intent |
|
|
140
|
+
| Adversarial (instructions inside free text) | Free text never in an instruction position | Can only change which vetted candidate is chosen |
|
|
141
|
+
| Ambiguous but valid | Underspecification check | `NEEDS_INPUT` naming what is missing |
|
|
142
|
+
|
|
143
|
+
The gateway returns an interpretation receipt for each intent so the caller can diff the gateway's understanding against what it meant to send.
|
|
144
|
+
|
|
145
|
+
### Hallucinations
|
|
146
|
+
|
|
147
|
+
| Failure | Defense |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| Nonexistent component or import | Imports and variants filled from the KB, never written by the LLM |
|
|
150
|
+
| Real component, invented prop or variant | AST check against KB entries plus `tsc` against pinned types |
|
|
151
|
+
| Unlisted or lookalike package | Dependency allowlist from the chosen libraries |
|
|
152
|
+
| Violates constraints while compiling | Lint rules compiled from the Design MD |
|
|
153
|
+
| Silently dropped or invented element | Coverage check in both directions between intent elements and scaffold |
|
|
154
|
+
| Fabricated rationale | Verifiable parts generated by code; LLM prose labeled non-authoritative |
|
|
155
|
+
| Truncated model output | Schema-constrained output; length-limited stops are hard failures |
|
|
156
|
+
|
|
157
|
+
Retries feed structured verifier errors back, cap at two, and never relax a constraint. After the cap the result is `PARTIAL` or `FAILED`.
|
|
158
|
+
|
|
159
|
+
### Honest residual
|
|
160
|
+
|
|
161
|
+
"Compiles and satisfies constraints" is not the same as "is the best component." The mitigations are rule-based selection for common cases, abstention when the top-two margin is small, sample agreement, calibration against a golden set, and an optional render and axe layer. What remains is measured as the silent-wrong rate rather than assumed to be zero. Semantic errors inside an internally consistent wireframe are only catchable at the producer.
|
|
162
|
+
|
|
163
|
+
## 8. Risk register
|
|
164
|
+
|
|
165
|
+
| Risk | Safeguards | Gate |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| Matcher is unproven | Baseline harness built first, pre-registered thresholds, dev/test split, capability ladder (rules, then LLM select, then sampling and render), published competence map, model pinning with automatic eval re-run | Phase 6 decision gate |
|
|
168
|
+
| Golden-set labeling is tedious | Keyboard-only labeling CLI, 10 intents a day tracked in CI, mined real-code pairs per library, coverage matrix, 15% relabel for self-agreement, blind-labeled subset to measure LLM anchoring | Phase 6 cannot start until 100 dev and 40 test items meet coverage minimums |
|
|
169
|
+
| Registry and source metadata uncertain | Day-1 spike per library, source-quality ladder, pre-decided fallback, `verification_level` in output, license check | Tier assigned before Phase 4 design |
|
|
170
|
+
| Scope creep | Written non-goals, phases cut scope at 1.5x estimate instead of moving dates, one adapter at a time behind a conformance suite, feature flags for gated layers, parking-lot file reviewed only at phase boundaries | Weekly check against gate list |
|
|
171
|
+
| Project profile detected wrongly | Evidence-based fields with confidence, hash pinning, `NEEDS_INPUT` on low confidence, fixtures for monorepo and mixed-library cases | Phase 3 fixtures |
|
|
172
|
+
| Wrapped components hide real props | Local KB derived from the wrapper's own types | Phase 4 conformance |
|
|
173
|
+
| Prose skills contradict each other or the Design MD | Advisory-only handling and conflict reporting | Phase 5 policy tests |
|
|
174
|
+
|
|
175
|
+
The compatibility requirement is itself scope growth. It is contained by limiting v1 to two adapters and brownfield support for those two.
|
|
176
|
+
|
|
177
|
+
## 9. Phase plan
|
|
178
|
+
|
|
179
|
+
Estimated total: about 12 to 14 weeks to a validated v1 (Phases 0 to 7) at 10 to 15 hours a week. Phase 8 adds 1 to 2 weeks and is gated. Phases 3 and 4 can overlap, and golden-set labeling runs throughout.
|
|
180
|
+
|
|
181
|
+
### Phase 0: Foundations and spikes (1 week)
|
|
182
|
+
|
|
183
|
+
- Monorepo, CI, canonical JSON hashing, injectable clock, metric definitions
|
|
184
|
+
- Source-discovery spike per candidate library; assign each a ladder tier
|
|
185
|
+
- Plain-Claude baseline harness using the same project profile, with pre-registered thresholds
|
|
186
|
+
- Labeling CLI and the first 20 labels
|
|
187
|
+
- Written non-goals file
|
|
188
|
+
|
|
189
|
+
**Exit:** every candidate library has a tier, the baseline runs, 20 labels exist.
|
|
190
|
+
|
|
191
|
+
### Phase 1: Protocol core (1 week)
|
|
192
|
+
|
|
193
|
+
- Zod schemas v1.0 with all additions in section 6
|
|
194
|
+
- State machine, hash-chained event log, idempotency
|
|
195
|
+
|
|
196
|
+
**Exit:** property-based tests show one owner at a time, immutable terminals, and correct idempotency and conflict handling.
|
|
197
|
+
|
|
198
|
+
### Phase 2: Leases, orchestrator, fault injection (1 to 1.5 weeks)
|
|
199
|
+
|
|
200
|
+
- TTL leases, your orchestrator with re-verification and `RESULT_REJECTED` handling
|
|
201
|
+
- Mutation harness for inputs
|
|
202
|
+
|
|
203
|
+
**Exit:** kill-mid-task, duplicate, and out-of-order tests always end in `RETURNED`; each mutation type yields its expected error code.
|
|
204
|
+
|
|
205
|
+
### Phase 3: Design MD compiler and project profile (2 weeks)
|
|
206
|
+
|
|
207
|
+
- Parser, normalizer with recorded defaults, hard and soft constraint compilation, satisfiability check
|
|
208
|
+
- Shared semantic validators (cross-field, tree plausibility)
|
|
209
|
+
- Profile detector with provenance, confidence, and conflict detection
|
|
210
|
+
|
|
211
|
+
**Exit:** fuzzed contradictions always return `UNSATISFIABLE_CONSTRAINTS` naming the pair; profile fixtures detect correctly or ask.
|
|
212
|
+
|
|
213
|
+
### Phase 4: Adapter interface and KB (2 to 2.5 weeks)
|
|
214
|
+
|
|
215
|
+
- Adapter interface and conformance suite
|
|
216
|
+
- Three-layer KB with provenance tiers, CI self-test, drift diff
|
|
217
|
+
- Adapters: shadcn plus the second library chosen by the spike
|
|
218
|
+
|
|
219
|
+
**Exit:** both adapters pass the same conformance suite; every entry compiles or is quarantined.
|
|
220
|
+
|
|
221
|
+
### Phase 5: Matcher and verifier (2 weeks)
|
|
222
|
+
|
|
223
|
+
- Capability ladder, closed-ID LLM selection, reuse-order and policy enforcement
|
|
224
|
+
- `tsc` and prop AST checks, coverage check, dependency allowlist, capped retries
|
|
225
|
+
|
|
226
|
+
**Exit:** the verifier mutation suite rejects injected bad scaffolds; decoy intents return `NO_MATCH`; forbid, ask, and allow policy tests pass.
|
|
227
|
+
|
|
228
|
+
### Phase 6: Eval and calibration (1.5 weeks)
|
|
229
|
+
|
|
230
|
+
- Golden set (100 dev, 40 test) with coverage matrix including existing-project cases
|
|
231
|
+
- Three-way comparison: full skill, no retrieval, plain Claude
|
|
232
|
+
- Calibration curve, competence map, abstention threshold
|
|
233
|
+
|
|
234
|
+
**Exit:** the decision gate below.
|
|
235
|
+
|
|
236
|
+
### Phase 7: Integration (1 week)
|
|
237
|
+
|
|
238
|
+
- MCP adapter, SKILL.md, README
|
|
239
|
+
- End-to-end demo in greenfield and existing modes
|
|
240
|
+
|
|
241
|
+
**Exit:** a fresh Claude client completes a handoff on both project types.
|
|
242
|
+
|
|
243
|
+
### Phase 8: Gated quality tier (1 to 2 weeks, optional)
|
|
244
|
+
|
|
245
|
+
- Render and axe checks, N-sample agreement, bundle-size scoring, additional adapters
|
|
246
|
+
- Built only for what Phase 6 error analysis justifies
|
|
247
|
+
|
|
248
|
+
## 10. Decision gates
|
|
249
|
+
|
|
250
|
+
- **After Phase 2:** if protocol invariants fail under fault injection, stop and fix. Nothing above is trustworthy otherwise.
|
|
251
|
+
- **After Phase 4:** if the second adapter forced changes to the interface, fix the interface now. This is the only real test of "agnostic."
|
|
252
|
+
- **After Phase 6:**
|
|
253
|
+
- Skill clearly beats baseline on hallucination, constraint violations, and silent-wrong rate: proceed.
|
|
254
|
+
- Only the verifier, compiler, and profile detector help: keep those and simplify retrieval.
|
|
255
|
+
- Nothing beats baseline: ship the protocol, verifier, and profile detector as a library and skip Phase 8.
|
|
256
|
+
|
|
257
|
+
## 11. Testing strategy
|
|
258
|
+
|
|
259
|
+
| Layer | Method |
|
|
260
|
+
| --- | --- |
|
|
261
|
+
| Schemas | Contract tests with fixtures for every valid and invalid case |
|
|
262
|
+
| State machine | Property-based tests (fast-check) over random event sequences |
|
|
263
|
+
| Lease and idempotency | Fault injection: kill mid-task, duplicate delivery, out-of-order events |
|
|
264
|
+
| Input handling | Mutation harness: drop fields, truncate, duplicate ids, swap types, homoglyphs, embedded instructions |
|
|
265
|
+
| Design MD compiler | Table-driven tests plus contradiction fuzzing |
|
|
266
|
+
| Project profile | Fixtures: monorepo, mixed libraries, wrapped components, missing config |
|
|
267
|
+
| KB | CI self-test compiling and rendering a snippet per component and variant; nightly drift diff |
|
|
268
|
+
| Verifier | Mutation testing with injected bad scaffolds; recall is a tracked number |
|
|
269
|
+
| LLM stage | Golden-set eval with pre-registered thresholds and intervals; measure hallucination before and after the verifier |
|
|
270
|
+
| Regression | Replay audit-log handoffs; every orchestrator override becomes a new labeled fixture |
|
|
271
|
+
|
|
272
|
+
## 12. Definition of done and non-goals
|
|
273
|
+
|
|
274
|
+
**Done for v1.** Phases 0 to 7 complete. All invariant, mutation, conformance, and policy suites green in CI. The metrics table populated with real numbers and intervals. Two adapters passing conformance. One reproducible end-to-end demo in each mode.
|
|
275
|
+
|
|
276
|
+
**Post-v1.** Non-React frameworks, additional adapters, the `design_md_updates` feedback loop, multi-orchestrator concurrency, and Phase 8 layers not justified by the eval.
|
|
277
|
+
|
|
278
|
+
## 13. First two weeks
|
|
279
|
+
|
|
280
|
+
1. Create the monorepo with CI, canonical hashing, and the injectable clock.
|
|
281
|
+
2. Run the source-discovery spike for shadcn and two candidate second libraries; record tiers and licenses.
|
|
282
|
+
3. Write the baseline harness and the pre-registered thresholds.
|
|
283
|
+
4. Build the labeling CLI; label 10 intents a day from day one.
|
|
284
|
+
5. Write the Zod schemas v1.0 with `project_context`, `intent_type`, tree wireframe, and the extended output.
|
|
285
|
+
6. Implement the transition table and the property-test setup; begin the mutation fixtures alongside the error taxonomy.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generated_at": "2026-11-28T17:11:32.870Z",
|
|
3
|
+
"results": [
|
|
4
|
+
{
|
|
5
|
+
"name": "vite-react-template",
|
|
6
|
+
"repo": "https://github.com/vitejs/vite.git",
|
|
7
|
+
"ref": "main",
|
|
8
|
+
"resolved_commit": "7d0c054f41ba1107a1d7d9ddae23930d9d6b4f8e",
|
|
9
|
+
"cloned": true,
|
|
10
|
+
"detected": true,
|
|
11
|
+
"framework": "vite-react",
|
|
12
|
+
"styling": [
|
|
13
|
+
"plain-css"
|
|
14
|
+
],
|
|
15
|
+
"libraries": [],
|
|
16
|
+
"local_components": 0,
|
|
17
|
+
"needs_input": [
|
|
18
|
+
"project is marked existing but no UI libraries or local components were found"
|
|
19
|
+
],
|
|
20
|
+
"design_md_ok": true,
|
|
21
|
+
"design_sources": [
|
|
22
|
+
"src/index.css"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|