ui-gateway 0.0.0-stage → 0.1.0
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 +185 -0
- package/CHANGELOG.md +28 -0
- package/CODE_OF_CONDUCT.md +121 -0
- package/CONTRIBUTING.md +65 -0
- package/LICENSE +21 -0
- package/NON-GOALS.md +23 -0
- package/README.md +369 -2
- package/SECURITY.md +34 -0
- package/SKILL.md +229 -0
- package/dist/evals/src/baseline.d.ts +101 -0
- package/dist/evals/src/baseline.d.ts.map +1 -0
- package/dist/evals/src/baseline.js +683 -0
- package/dist/evals/src/baseline.js.map +1 -0
- package/dist/evals/src/calibration-svg.d.ts +11 -0
- package/dist/evals/src/calibration-svg.d.ts.map +1 -0
- package/dist/evals/src/calibration-svg.js +84 -0
- package/dist/evals/src/calibration-svg.js.map +1 -0
- package/dist/evals/src/golden.d.ts +36 -0
- package/dist/evals/src/golden.d.ts.map +1 -0
- package/dist/evals/src/golden.js +62 -0
- package/dist/evals/src/golden.js.map +1 -0
- package/dist/evals/src/local-llm.d.ts +78 -0
- package/dist/evals/src/local-llm.d.ts.map +1 -0
- package/dist/evals/src/local-llm.js +314 -0
- package/dist/evals/src/local-llm.js.map +1 -0
- package/dist/evals/src/metrics.d.ts +115 -0
- package/dist/evals/src/metrics.d.ts.map +1 -0
- package/dist/evals/src/metrics.js +166 -0
- package/dist/evals/src/metrics.js.map +1 -0
- package/dist/packages/adapters/src/angular/index.d.ts +5 -0
- package/dist/packages/adapters/src/angular/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/angular/index.js +87 -0
- package/dist/packages/adapters/src/angular/index.js.map +1 -0
- package/dist/packages/adapters/src/angular/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/angular/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/angular/manifest.js +156 -0
- package/dist/packages/adapters/src/angular/manifest.js.map +1 -0
- package/dist/packages/adapters/src/antd/index.d.ts +5 -0
- package/dist/packages/adapters/src/antd/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/antd/index.js +76 -0
- package/dist/packages/adapters/src/antd/index.js.map +1 -0
- package/dist/packages/adapters/src/antd/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/antd/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/antd/manifest.js +174 -0
- package/dist/packages/adapters/src/antd/manifest.js.map +1 -0
- package/dist/packages/adapters/src/bootstrap/index.d.ts +5 -0
- package/dist/packages/adapters/src/bootstrap/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/bootstrap/index.js +87 -0
- package/dist/packages/adapters/src/bootstrap/index.js.map +1 -0
- package/dist/packages/adapters/src/bootstrap/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/bootstrap/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/bootstrap/manifest.js +157 -0
- package/dist/packages/adapters/src/bootstrap/manifest.js.map +1 -0
- package/dist/packages/adapters/src/chakra/index.d.ts +5 -0
- package/dist/packages/adapters/src/chakra/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/chakra/index.js +81 -0
- package/dist/packages/adapters/src/chakra/index.js.map +1 -0
- package/dist/packages/adapters/src/chakra/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/chakra/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/chakra/manifest.js +641 -0
- package/dist/packages/adapters/src/chakra/manifest.js.map +1 -0
- package/dist/packages/adapters/src/conformance.d.ts +25 -0
- package/dist/packages/adapters/src/conformance.d.ts.map +1 -0
- package/dist/packages/adapters/src/conformance.js +118 -0
- package/dist/packages/adapters/src/conformance.js.map +1 -0
- package/dist/packages/adapters/src/imports.d.ts +7 -0
- package/dist/packages/adapters/src/imports.d.ts.map +1 -0
- package/dist/packages/adapters/src/imports.js +24 -0
- package/dist/packages/adapters/src/imports.js.map +1 -0
- package/dist/packages/adapters/src/index.d.ts +15 -0
- package/dist/packages/adapters/src/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/index.js +15 -0
- package/dist/packages/adapters/src/index.js.map +1 -0
- package/dist/packages/adapters/src/local.d.ts +6 -0
- package/dist/packages/adapters/src/local.d.ts.map +1 -0
- package/dist/packages/adapters/src/local.js +136 -0
- package/dist/packages/adapters/src/local.js.map +1 -0
- package/dist/packages/adapters/src/mantine/index.d.ts +5 -0
- package/dist/packages/adapters/src/mantine/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/mantine/index.js +81 -0
- package/dist/packages/adapters/src/mantine/index.js.map +1 -0
- package/dist/packages/adapters/src/mantine/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/mantine/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/mantine/manifest.js +522 -0
- package/dist/packages/adapters/src/mantine/manifest.js.map +1 -0
- package/dist/packages/adapters/src/mui/index.d.ts +5 -0
- package/dist/packages/adapters/src/mui/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/mui/index.js +80 -0
- package/dist/packages/adapters/src/mui/index.js.map +1 -0
- package/dist/packages/adapters/src/mui/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/mui/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/mui/manifest.js +390 -0
- package/dist/packages/adapters/src/mui/manifest.js.map +1 -0
- package/dist/packages/adapters/src/registry.d.ts +22 -0
- package/dist/packages/adapters/src/registry.d.ts.map +1 -0
- package/dist/packages/adapters/src/registry.js +61 -0
- package/dist/packages/adapters/src/registry.js.map +1 -0
- package/dist/packages/adapters/src/shadcn/index.d.ts +5 -0
- package/dist/packages/adapters/src/shadcn/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/shadcn/index.js +79 -0
- package/dist/packages/adapters/src/shadcn/index.js.map +1 -0
- package/dist/packages/adapters/src/shadcn/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/shadcn/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/shadcn/manifest.js +470 -0
- package/dist/packages/adapters/src/shadcn/manifest.js.map +1 -0
- package/dist/packages/adapters/src/solid/index.d.ts +5 -0
- package/dist/packages/adapters/src/solid/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/solid/index.js +87 -0
- package/dist/packages/adapters/src/solid/index.js.map +1 -0
- package/dist/packages/adapters/src/solid/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/solid/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/solid/manifest.js +156 -0
- package/dist/packages/adapters/src/solid/manifest.js.map +1 -0
- package/dist/packages/adapters/src/svelte/index.d.ts +5 -0
- package/dist/packages/adapters/src/svelte/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/svelte/index.js +77 -0
- package/dist/packages/adapters/src/svelte/index.js.map +1 -0
- package/dist/packages/adapters/src/svelte/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/svelte/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/svelte/manifest.js +157 -0
- package/dist/packages/adapters/src/svelte/manifest.js.map +1 -0
- package/dist/packages/adapters/src/tokens.d.ts +9 -0
- package/dist/packages/adapters/src/tokens.d.ts.map +1 -0
- package/dist/packages/adapters/src/tokens.js +257 -0
- package/dist/packages/adapters/src/tokens.js.map +1 -0
- package/dist/packages/adapters/src/types.d.ts +58 -0
- package/dist/packages/adapters/src/types.d.ts.map +1 -0
- package/dist/packages/adapters/src/types.js +4 -0
- package/dist/packages/adapters/src/types.js.map +1 -0
- package/dist/packages/adapters/src/vue/index.d.ts +5 -0
- package/dist/packages/adapters/src/vue/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/vue/index.js +78 -0
- package/dist/packages/adapters/src/vue/index.js.map +1 -0
- package/dist/packages/adapters/src/vue/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/vue/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/vue/manifest.js +159 -0
- package/dist/packages/adapters/src/vue/manifest.js.map +1 -0
- package/dist/packages/design-md/src/compile.d.ts +12 -0
- package/dist/packages/design-md/src/compile.d.ts.map +1 -0
- package/dist/packages/design-md/src/compile.js +213 -0
- package/dist/packages/design-md/src/compile.js.map +1 -0
- package/dist/packages/design-md/src/dtcg.d.ts +23 -0
- package/dist/packages/design-md/src/dtcg.d.ts.map +1 -0
- package/dist/packages/design-md/src/dtcg.js +77 -0
- package/dist/packages/design-md/src/dtcg.js.map +1 -0
- package/dist/packages/design-md/src/index.d.ts +6 -0
- package/dist/packages/design-md/src/index.d.ts.map +1 -0
- package/dist/packages/design-md/src/index.js +6 -0
- package/dist/packages/design-md/src/index.js.map +1 -0
- package/dist/packages/design-md/src/parse.d.ts +22 -0
- package/dist/packages/design-md/src/parse.d.ts.map +1 -0
- package/dist/packages/design-md/src/parse.js +206 -0
- package/dist/packages/design-md/src/parse.js.map +1 -0
- package/dist/packages/design-md/src/satisfiability.d.ts +20 -0
- package/dist/packages/design-md/src/satisfiability.d.ts.map +1 -0
- package/dist/packages/design-md/src/satisfiability.js +125 -0
- package/dist/packages/design-md/src/satisfiability.js.map +1 -0
- package/dist/packages/design-md/src/types.d.ts +75 -0
- package/dist/packages/design-md/src/types.d.ts.map +1 -0
- package/dist/packages/design-md/src/types.js +9 -0
- package/dist/packages/design-md/src/types.js.map +1 -0
- package/dist/packages/gateway/src/acceptance.d.ts +5 -0
- package/dist/packages/gateway/src/acceptance.d.ts.map +1 -0
- package/dist/packages/gateway/src/acceptance.js +68 -0
- package/dist/packages/gateway/src/acceptance.js.map +1 -0
- package/dist/packages/gateway/src/composition.d.ts +20 -0
- package/dist/packages/gateway/src/composition.d.ts.map +1 -0
- package/dist/packages/gateway/src/composition.js +468 -0
- package/dist/packages/gateway/src/composition.js.map +1 -0
- package/dist/packages/gateway/src/confidence.d.ts +10 -0
- package/dist/packages/gateway/src/confidence.d.ts.map +1 -0
- package/dist/packages/gateway/src/confidence.js +31 -0
- package/dist/packages/gateway/src/confidence.js.map +1 -0
- package/dist/packages/gateway/src/gateway.d.ts +73 -0
- package/dist/packages/gateway/src/gateway.d.ts.map +1 -0
- package/dist/packages/gateway/src/gateway.js +808 -0
- package/dist/packages/gateway/src/gateway.js.map +1 -0
- package/dist/packages/gateway/src/index.d.ts +7 -0
- package/dist/packages/gateway/src/index.d.ts.map +1 -0
- package/dist/packages/gateway/src/index.js +7 -0
- package/dist/packages/gateway/src/index.js.map +1 -0
- package/dist/packages/gateway/src/layers.d.ts +34 -0
- package/dist/packages/gateway/src/layers.d.ts.map +1 -0
- package/dist/packages/gateway/src/layers.js +294 -0
- package/dist/packages/gateway/src/layers.js.map +1 -0
- package/dist/packages/gateway/src/validate.d.ts +74 -0
- package/dist/packages/gateway/src/validate.d.ts.map +1 -0
- package/dist/packages/gateway/src/validate.js +241 -0
- package/dist/packages/gateway/src/validate.js.map +1 -0
- package/dist/packages/kb/src/bundle-size.d.ts +31 -0
- package/dist/packages/kb/src/bundle-size.d.ts.map +1 -0
- package/dist/packages/kb/src/bundle-size.js +62 -0
- package/dist/packages/kb/src/bundle-size.js.map +1 -0
- package/dist/packages/kb/src/entry.d.ts +534 -0
- package/dist/packages/kb/src/entry.d.ts.map +1 -0
- package/dist/packages/kb/src/entry.js +97 -0
- package/dist/packages/kb/src/entry.js.map +1 -0
- package/dist/packages/kb/src/index.d.ts +6 -0
- package/dist/packages/kb/src/index.d.ts.map +1 -0
- package/dist/packages/kb/src/index.js +6 -0
- package/dist/packages/kb/src/index.js.map +1 -0
- package/dist/packages/kb/src/ingest.d.ts +33 -0
- package/dist/packages/kb/src/ingest.d.ts.map +1 -0
- package/dist/packages/kb/src/ingest.js +137 -0
- package/dist/packages/kb/src/ingest.js.map +1 -0
- package/dist/packages/kb/src/kb.d.ts +66 -0
- package/dist/packages/kb/src/kb.d.ts.map +1 -0
- package/dist/packages/kb/src/kb.js +189 -0
- package/dist/packages/kb/src/kb.js.map +1 -0
- package/dist/packages/kb/src/telemetry.d.ts +54 -0
- package/dist/packages/kb/src/telemetry.d.ts.map +1 -0
- package/dist/packages/kb/src/telemetry.js +242 -0
- package/dist/packages/kb/src/telemetry.js.map +1 -0
- package/dist/packages/matcher/src/anthropic.d.ts +26 -0
- package/dist/packages/matcher/src/anthropic.d.ts.map +1 -0
- package/dist/packages/matcher/src/anthropic.js +113 -0
- package/dist/packages/matcher/src/anthropic.js.map +1 -0
- package/dist/packages/matcher/src/index.d.ts +67 -0
- package/dist/packages/matcher/src/index.d.ts.map +1 -0
- package/dist/packages/matcher/src/index.js +227 -0
- package/dist/packages/matcher/src/index.js.map +1 -0
- package/dist/packages/matcher/src/scaffold.d.ts +35 -0
- package/dist/packages/matcher/src/scaffold.d.ts.map +1 -0
- package/dist/packages/matcher/src/scaffold.js +343 -0
- package/dist/packages/matcher/src/scaffold.js.map +1 -0
- package/dist/packages/matcher/src/score.d.ts +31 -0
- package/dist/packages/matcher/src/score.d.ts.map +1 -0
- package/dist/packages/matcher/src/score.js +141 -0
- package/dist/packages/matcher/src/score.js.map +1 -0
- package/dist/packages/matcher/src/select.d.ts +54 -0
- package/dist/packages/matcher/src/select.d.ts.map +1 -0
- package/dist/packages/matcher/src/select.js +148 -0
- package/dist/packages/matcher/src/select.js.map +1 -0
- package/dist/packages/orchestrator/src/handoff-builder.d.ts +58 -0
- package/dist/packages/orchestrator/src/handoff-builder.d.ts.map +1 -0
- package/dist/packages/orchestrator/src/handoff-builder.js +162 -0
- package/dist/packages/orchestrator/src/handoff-builder.js.map +1 -0
- package/dist/packages/orchestrator/src/index.d.ts +3 -0
- package/dist/packages/orchestrator/src/index.d.ts.map +1 -0
- package/dist/packages/orchestrator/src/index.js +3 -0
- package/dist/packages/orchestrator/src/index.js.map +1 -0
- package/dist/packages/orchestrator/src/orchestrator.d.ts +32 -0
- package/dist/packages/orchestrator/src/orchestrator.d.ts.map +1 -0
- package/dist/packages/orchestrator/src/orchestrator.js +124 -0
- package/dist/packages/orchestrator/src/orchestrator.js.map +1 -0
- package/dist/packages/profile/src/conflicts.d.ts +18 -0
- package/dist/packages/profile/src/conflicts.d.ts.map +1 -0
- package/dist/packages/profile/src/conflicts.js +151 -0
- package/dist/packages/profile/src/conflicts.js.map +1 -0
- package/dist/packages/profile/src/detect.d.ts +14 -0
- package/dist/packages/profile/src/detect.d.ts.map +1 -0
- package/dist/packages/profile/src/detect.js +325 -0
- package/dist/packages/profile/src/detect.js.map +1 -0
- package/dist/packages/profile/src/fs-utils.d.ts +18 -0
- package/dist/packages/profile/src/fs-utils.d.ts.map +1 -0
- package/dist/packages/profile/src/fs-utils.js +104 -0
- package/dist/packages/profile/src/fs-utils.js.map +1 -0
- package/dist/packages/profile/src/index.d.ts +8 -0
- package/dist/packages/profile/src/index.d.ts.map +1 -0
- package/dist/packages/profile/src/index.js +8 -0
- package/dist/packages/profile/src/index.js.map +1 -0
- package/dist/packages/profile/src/local-components.d.ts +17 -0
- package/dist/packages/profile/src/local-components.d.ts.map +1 -0
- package/dist/packages/profile/src/local-components.js +148 -0
- package/dist/packages/profile/src/local-components.js.map +1 -0
- package/dist/packages/profile/src/registry.d.ts +32 -0
- package/dist/packages/profile/src/registry.d.ts.map +1 -0
- package/dist/packages/profile/src/registry.js +56 -0
- package/dist/packages/profile/src/registry.js.map +1 -0
- package/dist/packages/profile/src/skill-layer-context.d.ts +37 -0
- package/dist/packages/profile/src/skill-layer-context.d.ts.map +1 -0
- package/dist/packages/profile/src/skill-layer-context.js +172 -0
- package/dist/packages/profile/src/skill-layer-context.js.map +1 -0
- package/dist/packages/profile/src/skills.d.ts +16 -0
- package/dist/packages/profile/src/skills.d.ts.map +1 -0
- package/dist/packages/profile/src/skills.js +133 -0
- package/dist/packages/profile/src/skills.js.map +1 -0
- package/dist/packages/protocol/src/canonical.d.ts +18 -0
- package/dist/packages/protocol/src/canonical.d.ts.map +1 -0
- package/dist/packages/protocol/src/canonical.js +54 -0
- package/dist/packages/protocol/src/canonical.js.map +1 -0
- package/dist/packages/protocol/src/clock.d.ts +15 -0
- package/dist/packages/protocol/src/clock.d.ts.map +1 -0
- package/dist/packages/protocol/src/clock.js +28 -0
- package/dist/packages/protocol/src/clock.js.map +1 -0
- package/dist/packages/protocol/src/coverage.d.ts +7 -0
- package/dist/packages/protocol/src/coverage.d.ts.map +1 -0
- package/dist/packages/protocol/src/coverage.js +17 -0
- package/dist/packages/protocol/src/coverage.js.map +1 -0
- package/dist/packages/protocol/src/errors.d.ts +24 -0
- package/dist/packages/protocol/src/errors.d.ts.map +1 -0
- package/dist/packages/protocol/src/errors.js +60 -0
- package/dist/packages/protocol/src/errors.js.map +1 -0
- package/dist/packages/protocol/src/event-log.d.ts +137 -0
- package/dist/packages/protocol/src/event-log.d.ts.map +1 -0
- package/dist/packages/protocol/src/event-log.js +270 -0
- package/dist/packages/protocol/src/event-log.js.map +1 -0
- package/dist/packages/protocol/src/events.d.ts +86 -0
- package/dist/packages/protocol/src/events.d.ts.map +1 -0
- package/dist/packages/protocol/src/events.js +182 -0
- package/dist/packages/protocol/src/events.js.map +1 -0
- package/dist/packages/protocol/src/hashing.d.ts +6 -0
- package/dist/packages/protocol/src/hashing.d.ts.map +1 -0
- package/dist/packages/protocol/src/hashing.js +14 -0
- package/dist/packages/protocol/src/hashing.js.map +1 -0
- package/dist/packages/protocol/src/index.d.ts +13 -0
- package/dist/packages/protocol/src/index.d.ts.map +1 -0
- package/dist/packages/protocol/src/index.js +13 -0
- package/dist/packages/protocol/src/index.js.map +1 -0
- package/dist/packages/protocol/src/lease.d.ts +6 -0
- package/dist/packages/protocol/src/lease.d.ts.map +1 -0
- package/dist/packages/protocol/src/lease.js +21 -0
- package/dist/packages/protocol/src/lease.js.map +1 -0
- package/dist/packages/protocol/src/schemas.d.ts +8875 -0
- package/dist/packages/protocol/src/schemas.d.ts.map +1 -0
- package/dist/packages/protocol/src/schemas.js +536 -0
- package/dist/packages/protocol/src/schemas.js.map +1 -0
- package/dist/packages/protocol/src/semantic.d.ts +19 -0
- package/dist/packages/protocol/src/semantic.d.ts.map +1 -0
- package/dist/packages/protocol/src/semantic.js +245 -0
- package/dist/packages/protocol/src/semantic.js.map +1 -0
- package/dist/packages/protocol/src/state-machine.d.ts +12 -0
- package/dist/packages/protocol/src/state-machine.d.ts.map +1 -0
- package/dist/packages/protocol/src/state-machine.js +67 -0
- package/dist/packages/protocol/src/state-machine.js.map +1 -0
- package/dist/packages/protocol/src/wireframe.d.ts +5 -0
- package/dist/packages/protocol/src/wireframe.d.ts.map +1 -0
- package/dist/packages/protocol/src/wireframe.js +23 -0
- package/dist/packages/protocol/src/wireframe.js.map +1 -0
- package/dist/packages/transports/src/cli.d.ts +3 -0
- package/dist/packages/transports/src/cli.d.ts.map +1 -0
- package/dist/packages/transports/src/cli.js +349 -0
- package/dist/packages/transports/src/cli.js.map +1 -0
- package/dist/packages/transports/src/http.d.ts +27 -0
- package/dist/packages/transports/src/http.d.ts.map +1 -0
- package/dist/packages/transports/src/http.js +176 -0
- package/dist/packages/transports/src/http.js.map +1 -0
- package/dist/packages/transports/src/index.d.ts +7 -0
- package/dist/packages/transports/src/index.d.ts.map +1 -0
- package/dist/packages/transports/src/index.js +7 -0
- package/dist/packages/transports/src/index.js.map +1 -0
- package/dist/packages/transports/src/label.d.ts +6 -0
- package/dist/packages/transports/src/label.d.ts.map +1 -0
- package/dist/packages/transports/src/label.js +47 -0
- package/dist/packages/transports/src/label.js.map +1 -0
- package/dist/packages/transports/src/mcp.d.ts +16 -0
- package/dist/packages/transports/src/mcp.d.ts.map +1 -0
- package/dist/packages/transports/src/mcp.js +112 -0
- package/dist/packages/transports/src/mcp.js.map +1 -0
- package/dist/packages/transports/src/resources.d.ts +9 -0
- package/dist/packages/transports/src/resources.d.ts.map +1 -0
- package/dist/packages/transports/src/resources.js +83 -0
- package/dist/packages/transports/src/resources.js.map +1 -0
- package/dist/packages/transports/src/runtime.d.ts +17 -0
- package/dist/packages/transports/src/runtime.d.ts.map +1 -0
- package/dist/packages/transports/src/runtime.js +22 -0
- package/dist/packages/transports/src/runtime.js.map +1 -0
- package/dist/packages/transports/src/tools.d.ts +30 -0
- package/dist/packages/transports/src/tools.d.ts.map +1 -0
- package/dist/packages/transports/src/tools.js +731 -0
- package/dist/packages/transports/src/tools.js.map +1 -0
- package/dist/packages/verifier/src/ast.d.ts +33 -0
- package/dist/packages/verifier/src/ast.d.ts.map +1 -0
- package/dist/packages/verifier/src/ast.js +147 -0
- package/dist/packages/verifier/src/ast.js.map +1 -0
- package/dist/packages/verifier/src/coverage.d.ts +2 -0
- package/dist/packages/verifier/src/coverage.d.ts.map +1 -0
- package/dist/packages/verifier/src/coverage.js +2 -0
- package/dist/packages/verifier/src/coverage.js.map +1 -0
- package/dist/packages/verifier/src/index.d.ts +8 -0
- package/dist/packages/verifier/src/index.d.ts.map +1 -0
- package/dist/packages/verifier/src/index.js +8 -0
- package/dist/packages/verifier/src/index.js.map +1 -0
- package/dist/packages/verifier/src/lint.d.ts +18 -0
- package/dist/packages/verifier/src/lint.d.ts.map +1 -0
- package/dist/packages/verifier/src/lint.js +87 -0
- package/dist/packages/verifier/src/lint.js.map +1 -0
- package/dist/packages/verifier/src/page.d.ts +32 -0
- package/dist/packages/verifier/src/page.d.ts.map +1 -0
- package/dist/packages/verifier/src/page.js +529 -0
- package/dist/packages/verifier/src/page.js.map +1 -0
- package/dist/packages/verifier/src/render-axe-impl.d.ts +21 -0
- package/dist/packages/verifier/src/render-axe-impl.d.ts.map +1 -0
- package/dist/packages/verifier/src/render-axe-impl.js +107 -0
- package/dist/packages/verifier/src/render-axe-impl.js.map +1 -0
- package/dist/packages/verifier/src/render-axe.d.ts +43 -0
- package/dist/packages/verifier/src/render-axe.d.ts.map +1 -0
- package/dist/packages/verifier/src/render-axe.js +78 -0
- package/dist/packages/verifier/src/render-axe.js.map +1 -0
- package/dist/packages/verifier/src/tsc.d.ts +42 -0
- package/dist/packages/verifier/src/tsc.d.ts.map +1 -0
- package/dist/packages/verifier/src/tsc.js +228 -0
- package/dist/packages/verifier/src/tsc.js.map +1 -0
- package/dist/packages/verifier/src/verify.d.ts +31 -0
- package/dist/packages/verifier/src/verify.d.ts.map +1 -0
- package/dist/packages/verifier/src/verify.js +173 -0
- package/dist/packages/verifier/src/verify.js.map +1 -0
- package/dist/scripts/calibration.d.ts +2 -0
- package/dist/scripts/calibration.d.ts.map +1 -0
- package/dist/scripts/calibration.js +45 -0
- package/dist/scripts/calibration.js.map +1 -0
- package/dist/scripts/e2e-demo.d.ts +2 -0
- package/dist/scripts/e2e-demo.d.ts.map +1 -0
- package/dist/scripts/e2e-demo.js +104 -0
- package/dist/scripts/e2e-demo.js.map +1 -0
- package/dist/scripts/fetch-bundle-sizes.d.ts +7 -0
- package/dist/scripts/fetch-bundle-sizes.d.ts.map +1 -0
- package/dist/scripts/fetch-bundle-sizes.js +73 -0
- package/dist/scripts/fetch-bundle-sizes.js.map +1 -0
- package/dist/scripts/fix-imports.d.ts +2 -0
- package/dist/scripts/fix-imports.d.ts.map +1 -0
- package/dist/scripts/fix-imports.js +59 -0
- package/dist/scripts/fix-imports.js.map +1 -0
- package/dist/scripts/mcp-config.d.ts +3 -0
- package/dist/scripts/mcp-config.d.ts.map +1 -0
- package/dist/scripts/mcp-config.js +66 -0
- package/dist/scripts/mcp-config.js.map +1 -0
- package/dist/scripts/test-bundlephobia.d.ts +2 -0
- package/dist/scripts/test-bundlephobia.d.ts.map +1 -0
- package/dist/scripts/test-bundlephobia.js +10 -0
- package/dist/scripts/test-bundlephobia.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +26 -0
- package/dist/vitest.config.js.map +1 -0
- package/evals/fixtures/blind-consensus.json +198 -0
- package/evals/fixtures/blind-labeling-nonauthor.json +338 -0
- package/evals/fixtures/blind-labeling.json +455 -0
- package/evals/fixtures/blind-labels.json +149 -0
- package/evals/fixtures/design-md/default.md +24 -0
- package/evals/fixtures/design-md/existing-chakra.md +20 -0
- package/evals/fixtures/design-md/existing-mantine.md +20 -0
- package/evals/fixtures/design-md/existing-mui.md +21 -0
- package/evals/fixtures/golden-set.json +4222 -0
- package/evals/fixtures/labels.jsonl +5 -0
- package/evals/fixtures/projects/existing-chakra/package.json +12 -0
- package/evals/fixtures/projects/existing-mantine/package.json +11 -0
- package/evals/fixtures/projects/existing-mui/AGENTS.md +5 -0
- package/evals/fixtures/projects/existing-mui/package.json +12 -0
- package/evals/fixtures/projects/existing-mui/src/components/StatusCard.tsx +16 -0
- package/evals/fixtures/projects/existing-shadcn/components.json +16 -0
- package/evals/fixtures/projects/existing-shadcn/package.json +14 -0
- package/evals/fixtures/projects/existing-shadcn/src/components/ui/button.tsx +5 -0
- package/evals/fixtures/projects/existing-shadcn/src/components/ui/card.tsx +10 -0
- package/evals/fixtures/projects/existing-shadcn/tailwind.config.ts +7 -0
- package/evals/fixtures/projects/existing-shadcn/tsconfig.json +15 -0
- package/evals/fixtures/projects/greenfield-react/package.json +13 -0
- package/evals/fixtures/site/dashboard.html +349 -0
- package/evals/fixtures/thresholds.json +11 -0
- package/evals/out/agent-report.json +2722 -0
- package/evals/out/baseline-report.json +7093 -0
- package/evals/out/calibration.json +147 -0
- package/evals/out/eval-report.json +5338 -0
- package/evals/out/groq-baseline-report.json +1010 -0
- package/evals/out/groq-run.log +1118 -0
- package/evals/package.json +10 -0
- package/evals/src/agent-eval.test.ts +18 -0
- package/evals/src/agent-eval.ts +222 -0
- package/evals/src/baseline.ts +850 -0
- package/evals/src/blind-labeling-cli.ts +74 -0
- package/evals/src/blind-labeling.ts +382 -0
- package/evals/src/calibration-svg.ts +105 -0
- package/evals/src/create-blind-subset.ts +91 -0
- package/evals/src/evals.test.ts +354 -0
- package/evals/src/golden.ts +104 -0
- package/evals/src/index.ts +6 -0
- package/evals/src/local-llm.ts +371 -0
- package/evals/src/merge-blind-labels.ts +73 -0
- package/evals/src/metrics.ts +281 -0
- package/evals/src/mutations.ts +244 -0
- package/evals/src/page-a11y-eval.ts +3372 -0
- package/evals/src/page-real-eval.ts +389 -0
- package/evals/src/run-agent-evals.ts +49 -0
- package/evals/src/run-claude-evals.ts +49 -0
- package/evals/src/run-evals.ts +82 -0
- package/evals/src/run-groq-evals.ts +104 -0
- package/evals/src/run-phase9.ts +48 -0
- package/evals/src/run-simulated-evals.ts +45 -0
- package/evals/src/site-eval.ts +161 -0
- package/evals/src/test-support.ts +16 -0
- package/package.json +147 -4
- package/references/composition-apis.md +108 -0
- package/references/design-md.md +134 -0
- package/references/errors.md +94 -0
- package/references/handoff.md +188 -0
- package/references/outcomes.md +114 -0
- package/references/patterns.md +136 -0
- package/references/tools.md +385 -0
- package/scripts/calibration.ts +64 -0
- package/scripts/e2e-demo.ts +112 -0
- package/scripts/fetch-bundle-sizes.ts +106 -0
- package/scripts/fix-imports.ts +67 -0
- package/scripts/mcp-config.ts +90 -0
- package/scripts/test-bundlephobia.ts +11 -0
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { buildKnowledgeBase, createDefaultAdapters } from "@uigw/adapters";
|
|
4
|
+
import { compileDesignMd, describeDesign } from "@uigw/design-md";
|
|
5
|
+
import { createGateway } from "@uigw/gateway";
|
|
6
|
+
import { buildHandoff } from "@uigw/orchestrator";
|
|
7
|
+
import { GatewayResultSchema } from "@uigw/protocol";
|
|
8
|
+
import { detectProject } from "@uigw/profile";
|
|
9
|
+
import { parseSelectionResponse, } from "@uigw/matcher";
|
|
10
|
+
import { buildScaffold, deriveProps } from "@uigw/matcher";
|
|
11
|
+
import { coverageMatrix, fixturesDir, loadGoldenSet } from "./golden";
|
|
12
|
+
import { checkThresholds, computeCalibration, computeMetrics, } from "./metrics";
|
|
13
|
+
import { createLocalLlmSelectionModel, createLocalLlmCall, createOpenAiCompatibleSelectionModel, createOpenAiCompatibleCall, createSimulatedModel, createSimulatedModelCall, renderPlainPrompt } from "./local-llm";
|
|
14
|
+
/**
|
|
15
|
+
* Three-way comparison: the gateway, retrieval-free selection, and plain
|
|
16
|
+
* generation. The latter two are deterministic stand-ins for a bare model so
|
|
17
|
+
* the harness runs offline; swap in a real model through SelectionModel.
|
|
18
|
+
*/
|
|
19
|
+
export async function runComparison(options = {}) {
|
|
20
|
+
const fixtures = options.fixtures ?? fixturesDir();
|
|
21
|
+
const set = loadGoldenSet(fixtures);
|
|
22
|
+
const items = options.limit
|
|
23
|
+
? set.items.slice(0, options.limit)
|
|
24
|
+
: options.stride && options.stride > 1
|
|
25
|
+
? set.items.filter((_, index) => index % options.stride === 0)
|
|
26
|
+
: set.items;
|
|
27
|
+
const thresholds = JSON.parse(readFileSync(join(fixtures, "thresholds.json"), "utf8"));
|
|
28
|
+
const runtimes = new Map();
|
|
29
|
+
const runtimeFor = (name) => {
|
|
30
|
+
const existing = runtimes.get(name);
|
|
31
|
+
if (existing)
|
|
32
|
+
return existing;
|
|
33
|
+
const dir = join(fixtures, "projects", name);
|
|
34
|
+
const profile = detectProject(dir);
|
|
35
|
+
const kb = buildKnowledgeBase({ adapters: createDefaultAdapters(), profile });
|
|
36
|
+
const runtime = {
|
|
37
|
+
dir,
|
|
38
|
+
profile,
|
|
39
|
+
kb,
|
|
40
|
+
gateway: createGateway({
|
|
41
|
+
kb,
|
|
42
|
+
compile: options.compile ? "on" : "off",
|
|
43
|
+
...(options.model ? { model: options.model } : {}),
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
runtimes.set(name, runtime);
|
|
47
|
+
return runtime;
|
|
48
|
+
};
|
|
49
|
+
const knownIds = new Set();
|
|
50
|
+
for (const name of new Set(items.map((item) => item.project ?? "greenfield-react"))) {
|
|
51
|
+
for (const entry of runtimeFor(name).kb.entries)
|
|
52
|
+
knownIds.add(entry.component_id);
|
|
53
|
+
}
|
|
54
|
+
const designCache = new Map();
|
|
55
|
+
const designFor = (item) => {
|
|
56
|
+
const file = item.design_md_file ?? set.design_md_file;
|
|
57
|
+
const cached = designCache.get(file);
|
|
58
|
+
if (cached !== undefined)
|
|
59
|
+
return cached;
|
|
60
|
+
const text = file === set.design_md_file ? set.design_md : readFileSync(join(fixtures, file), "utf8");
|
|
61
|
+
designCache.set(file, text);
|
|
62
|
+
return text;
|
|
63
|
+
};
|
|
64
|
+
const compiledDesigns = new Map();
|
|
65
|
+
const compiledDesignFor = (item) => {
|
|
66
|
+
const file = item.design_md_file ?? set.design_md_file;
|
|
67
|
+
const cached = compiledDesigns.get(file);
|
|
68
|
+
if (cached)
|
|
69
|
+
return cached;
|
|
70
|
+
const compiled = compileDesignMd(designFor(item));
|
|
71
|
+
compiledDesigns.set(file, compiled);
|
|
72
|
+
return compiled;
|
|
73
|
+
};
|
|
74
|
+
const normalizedIntents = new Map();
|
|
75
|
+
const fullRecords = [];
|
|
76
|
+
const fullPredictions = [];
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
const runtime = runtimeFor(item.project ?? "greenfield-react");
|
|
79
|
+
const handoff = buildHandoff({
|
|
80
|
+
design_md: designFor(item),
|
|
81
|
+
intents: [item.intent],
|
|
82
|
+
project: { dir: runtime.dir },
|
|
83
|
+
acceptance_criteria: [{ type: "all_intents_mapped" }],
|
|
84
|
+
});
|
|
85
|
+
normalizedIntents.set(item.item_id, handoff.intents[0]);
|
|
86
|
+
const response = await runtime.gateway.submit(handoff);
|
|
87
|
+
const result = response.ok ? response.result : undefined;
|
|
88
|
+
const predicted = predictedIds(result);
|
|
89
|
+
const intent = result?.intents[0];
|
|
90
|
+
fullPredictions.push({
|
|
91
|
+
item_id: item.item_id,
|
|
92
|
+
predicted,
|
|
93
|
+
acceptable: item.acceptable,
|
|
94
|
+
confidence: intent?.confidence ?? 0,
|
|
95
|
+
});
|
|
96
|
+
fullRecords.push({
|
|
97
|
+
item_id: item.item_id,
|
|
98
|
+
predicted,
|
|
99
|
+
acceptable: item.acceptable,
|
|
100
|
+
schema_valid: Boolean(result && GatewayResultSchema.safeParse(result).success),
|
|
101
|
+
constraints_ok: Boolean(response.ok &&
|
|
102
|
+
result?.intents.every((entry) => !entry.error && (entry.verification?.checks.every((check) => check.passed) ?? true))),
|
|
103
|
+
confidence: intent?.confidence ?? 0,
|
|
104
|
+
outcome: response.ok ? result.outcome : response.outcome,
|
|
105
|
+
invalid_imports: [],
|
|
106
|
+
invalid_props: [],
|
|
107
|
+
turns_to_green: 0,
|
|
108
|
+
refused: !response.ok || result === undefined || result.intents.length === 0,
|
|
109
|
+
refusal_correct: item.acceptable.length === 0,
|
|
110
|
+
unsafe_accept: predicted.length > 0 && !item.acceptable.includes(predicted[0]),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const noRetrievalRecords = await runArm(items, normalizedIntents, compiledDesignFor, runtimeFor, "no-retrieval", options);
|
|
114
|
+
const plainRecords = await runArm(items, normalizedIntents, compiledDesignFor, runtimeFor, "plain", options);
|
|
115
|
+
const vendorMcpTscRecords = await runVendorMcpTscArm(items, normalizedIntents, compiledDesignFor, runtimeFor, options);
|
|
116
|
+
const arms = [
|
|
117
|
+
{
|
|
118
|
+
name: "full_skill",
|
|
119
|
+
description: options.model
|
|
120
|
+
? "Filter, rank, model closed-ID selection, code-written scaffold, verifier"
|
|
121
|
+
: "Filter, rank, closed-ID selection, code-written scaffold, verifier",
|
|
122
|
+
metrics: computeMetrics(fullRecords, knownIds),
|
|
123
|
+
predictions: fullPredictions,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "no_retrieval",
|
|
127
|
+
description: options.noRetrievalModel
|
|
128
|
+
? "Model sees an unranked candidate list; no retrieval scores"
|
|
129
|
+
: "Candidate list without retrieval scoring; first declared match",
|
|
130
|
+
metrics: computeMetrics(noRetrievalRecords, knownIds),
|
|
131
|
+
predictions: noRetrievalRecords.map((record) => ({
|
|
132
|
+
item_id: record.item_id,
|
|
133
|
+
predicted: record.predicted,
|
|
134
|
+
acceptable: record.acceptable,
|
|
135
|
+
confidence: record.confidence,
|
|
136
|
+
})),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "plain_generation",
|
|
140
|
+
description: options.plainCall
|
|
141
|
+
? "Model generates a component id without a candidate list"
|
|
142
|
+
: "Unconstrained component id generation (stand-in for a bare model)",
|
|
143
|
+
metrics: computeMetrics(plainRecords, knownIds),
|
|
144
|
+
predictions: plainRecords.map((record) => ({
|
|
145
|
+
item_id: record.item_id,
|
|
146
|
+
predicted: record.predicted,
|
|
147
|
+
acceptable: record.acceptable,
|
|
148
|
+
confidence: record.confidence,
|
|
149
|
+
})),
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "vendor_mcp_tsc",
|
|
153
|
+
description: options.model
|
|
154
|
+
? "Vendor MCP docs (unranked candidates) + model selection + tsc loop against real library types"
|
|
155
|
+
: "Vendor MCP docs (unranked candidates) + first-declared stand-in + tsc loop against real library types",
|
|
156
|
+
metrics: computeMetrics(vendorMcpTscRecords, knownIds),
|
|
157
|
+
predictions: vendorMcpTscRecords.map((record) => ({
|
|
158
|
+
item_id: record.item_id,
|
|
159
|
+
predicted: record.predicted,
|
|
160
|
+
acceptable: record.acceptable,
|
|
161
|
+
confidence: record.confidence,
|
|
162
|
+
})),
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
const thresholdChecks = checkThresholds(arms[0].metrics, thresholds);
|
|
166
|
+
const calibration = computeCalibration(fullRecords);
|
|
167
|
+
const nSampleAgreement = options.nSamples
|
|
168
|
+
? await runNSampleAgreement(items, options, runtimeFor, normalizedIntents, compiledDesignFor)
|
|
169
|
+
: null;
|
|
170
|
+
const coverage = coverageMatrix(items);
|
|
171
|
+
const modelInfo = options.modelInfo ??
|
|
172
|
+
(options.openAiCompatible
|
|
173
|
+
? { provider: "openai-compatible", id: options.openAiCompatible.model }
|
|
174
|
+
: options.model || options.noRetrievalModel
|
|
175
|
+
? { provider: "injected", id: options.model?.id ?? options.noRetrievalModel.id }
|
|
176
|
+
: null);
|
|
177
|
+
const modelBacked = Boolean(options.openAiCompatible || options.model || options.noRetrievalModel || options.plainCall);
|
|
178
|
+
return {
|
|
179
|
+
generated_at: new Date().toISOString(),
|
|
180
|
+
coverage,
|
|
181
|
+
arms,
|
|
182
|
+
threshold_checks: thresholdChecks,
|
|
183
|
+
thresholds_passed: thresholdChecks.every((check) => check.passed),
|
|
184
|
+
calibration,
|
|
185
|
+
model_info: modelInfo,
|
|
186
|
+
n_sample_agreement: nSampleAgreement,
|
|
187
|
+
notes: [
|
|
188
|
+
`Golden set has ${items.length} items across ${Object.keys(coverage.by_project).length} project fixtures; the Phase 6 count gate is ${coverage.gate.passed ? "met" : "not met"}.`,
|
|
189
|
+
"Labels are author-labeled against the KB, not blind human labels, and have not been relabeled for self-agreement.",
|
|
190
|
+
modelBacked
|
|
191
|
+
? "Model-backed arms use one sample per item. The no-retrieval and plain arms do not run the verifier; only the full arm does."
|
|
192
|
+
: "Plain and no-retrieval arms are deterministic stand-ins, not measured model behaviour.",
|
|
193
|
+
...(options.limit ? [`Evaluated only the first ${options.limit} items (smoke run).`] : []),
|
|
194
|
+
...(options.stride && options.stride > 1
|
|
195
|
+
? [`Evaluated every ${options.stride}th item (${items.length}/${set.items.length}); a stratified sample, not the full set.`]
|
|
196
|
+
: []),
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function predictedIds(result) {
|
|
201
|
+
if (!result)
|
|
202
|
+
return [];
|
|
203
|
+
return result.intents.flatMap((intent) => intent.mappings.map((mapping) => mapping.component_id));
|
|
204
|
+
}
|
|
205
|
+
async function runArm(items, normalizedIntents, compiledDesignFor, runtimeFor, arm, options) {
|
|
206
|
+
const useModel = shouldUseModel(arm, options);
|
|
207
|
+
if (!useModel) {
|
|
208
|
+
return items.map((item) => arm === "no-retrieval"
|
|
209
|
+
? retrievalFreeRecord(item, runtimeFor(item.project ?? "greenfield-react").kb)
|
|
210
|
+
: plainRecord(item));
|
|
211
|
+
}
|
|
212
|
+
let model;
|
|
213
|
+
let plainCall;
|
|
214
|
+
// Use explicitly provided models/calls first
|
|
215
|
+
if (arm === "plain" && options.plainCall) {
|
|
216
|
+
plainCall = options.plainCall;
|
|
217
|
+
}
|
|
218
|
+
else if (arm === "no-retrieval" && options.noRetrievalModel) {
|
|
219
|
+
model = options.noRetrievalModel;
|
|
220
|
+
}
|
|
221
|
+
else if (options.openAiCompatible) {
|
|
222
|
+
if (arm === "plain") {
|
|
223
|
+
plainCall = createOpenAiCompatibleCall(options.openAiCompatible);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
model = createOpenAiCompatibleSelectionModel(options.openAiCompatible);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if (options.localLlm) {
|
|
230
|
+
if (arm === "plain") {
|
|
231
|
+
plainCall = createLocalLlmCall(options.localLlm);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
model = createLocalLlmSelectionModel(options.localLlm);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (options.simulatedBehavior) {
|
|
238
|
+
const behavior = options.simulatedBehavior;
|
|
239
|
+
if (arm === "plain") {
|
|
240
|
+
plainCall = createSimulatedModelCall(behavior);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
model = createSimulatedModel(behavior);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (model) {
|
|
247
|
+
return mapSequential(items, async (item) => {
|
|
248
|
+
const runtime = runtimeFor(item.project ?? "greenfield-react");
|
|
249
|
+
const prompt = arm === "no-retrieval"
|
|
250
|
+
? noRetrievalPrompt(normalizedIntents.get(item.item_id), runtime.kb, compiledDesignFor(item))
|
|
251
|
+
: null;
|
|
252
|
+
if (arm === "no-retrieval" && prompt) {
|
|
253
|
+
return noRetrievalModelRecord(item, prompt, model);
|
|
254
|
+
}
|
|
255
|
+
return plainRecord(item);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (plainCall) {
|
|
259
|
+
return mapSequential(items, async (item) => {
|
|
260
|
+
const runtime = runtimeFor(item.project ?? "greenfield-react");
|
|
261
|
+
const intent = normalizedIntents.get(item.item_id);
|
|
262
|
+
const design = compiledDesignFor(item);
|
|
263
|
+
const libraries = runtime.profile.libraries.value.map((library) => library.id);
|
|
264
|
+
const prompt = renderPlainPrompt({ item_id: item.item_id, intent }, design, libraries);
|
|
265
|
+
const response = await plainCall(prompt);
|
|
266
|
+
const parsed = parseSelectionResponse(response);
|
|
267
|
+
return {
|
|
268
|
+
item_id: item.item_id,
|
|
269
|
+
predicted: parsed.component_id ? [parsed.component_id] : [],
|
|
270
|
+
acceptable: item.acceptable,
|
|
271
|
+
schema_valid: true,
|
|
272
|
+
constraints_ok: true,
|
|
273
|
+
confidence: 0.9,
|
|
274
|
+
outcome: parsed.component_id ? "COMPLETED" : "FAILED",
|
|
275
|
+
invalid_imports: [],
|
|
276
|
+
invalid_props: [],
|
|
277
|
+
turns_to_green: 0,
|
|
278
|
+
refused: !parsed.component_id,
|
|
279
|
+
refusal_correct: item.acceptable.length === 0,
|
|
280
|
+
unsafe_accept: parsed.component_id ? !item.acceptable.includes(parsed.component_id) : false,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// Fallback
|
|
285
|
+
return items.map((item) => arm === "no-retrieval"
|
|
286
|
+
? retrievalFreeRecord(item, runtimeFor(item.project ?? "greenfield-react").kb)
|
|
287
|
+
: plainRecord(item));
|
|
288
|
+
}
|
|
289
|
+
function shouldUseModel(arm, options) {
|
|
290
|
+
const arms = options.modelArms ?? "all";
|
|
291
|
+
return arms === "all" || arms === arm;
|
|
292
|
+
}
|
|
293
|
+
async function mapSequential(items, fn) {
|
|
294
|
+
const results = [];
|
|
295
|
+
for (const item of items)
|
|
296
|
+
results.push(await fn(item));
|
|
297
|
+
return results;
|
|
298
|
+
}
|
|
299
|
+
function noRetrievalPrompt(intent, kb, design) {
|
|
300
|
+
const candidates = kb
|
|
301
|
+
.query({ intent_type: intent.intent_type })
|
|
302
|
+
.sort((a, b) => a.component_id.localeCompare(b.component_id))
|
|
303
|
+
.map((entry) => ({
|
|
304
|
+
component_id: entry.component_id,
|
|
305
|
+
library: entry.library,
|
|
306
|
+
description: entry.description,
|
|
307
|
+
roles: entry.roles,
|
|
308
|
+
score: 0,
|
|
309
|
+
}));
|
|
310
|
+
if (candidates.length === 0)
|
|
311
|
+
return null;
|
|
312
|
+
return {
|
|
313
|
+
intent,
|
|
314
|
+
candidates,
|
|
315
|
+
design_summary: describeDesign(design),
|
|
316
|
+
skills: [],
|
|
317
|
+
retrieval_scores: false,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
async function noRetrievalModelRecord(item, prompt, model) {
|
|
321
|
+
if (!prompt)
|
|
322
|
+
return abstainedRecord(item, "no declared candidates");
|
|
323
|
+
const selected = await model.select(prompt);
|
|
324
|
+
return {
|
|
325
|
+
item_id: item.item_id,
|
|
326
|
+
predicted: selected.component_id ? [selected.component_id] : [],
|
|
327
|
+
acceptable: item.acceptable,
|
|
328
|
+
schema_valid: true,
|
|
329
|
+
constraints_ok: true,
|
|
330
|
+
confidence: 0.9,
|
|
331
|
+
outcome: selected.component_id ? "COMPLETED" : "FAILED",
|
|
332
|
+
invalid_imports: [],
|
|
333
|
+
invalid_props: [],
|
|
334
|
+
turns_to_green: 0,
|
|
335
|
+
refused: !selected.component_id,
|
|
336
|
+
refusal_correct: item.acceptable.length === 0,
|
|
337
|
+
unsafe_accept: selected.component_id ? !item.acceptable.includes(selected.component_id) : false,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function abstainedRecord(item, _reason) {
|
|
341
|
+
return {
|
|
342
|
+
item_id: item.item_id,
|
|
343
|
+
predicted: [],
|
|
344
|
+
acceptable: item.acceptable,
|
|
345
|
+
schema_valid: true,
|
|
346
|
+
constraints_ok: true,
|
|
347
|
+
confidence: 0.9,
|
|
348
|
+
outcome: "FAILED",
|
|
349
|
+
invalid_imports: [],
|
|
350
|
+
invalid_props: [],
|
|
351
|
+
turns_to_green: 0,
|
|
352
|
+
refused: true,
|
|
353
|
+
refusal_correct: item.acceptable.length === 0,
|
|
354
|
+
unsafe_accept: false,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function clip(value, max) {
|
|
358
|
+
return value.length > max ? `${value.slice(0, max)}…` : value;
|
|
359
|
+
}
|
|
360
|
+
function retrievalFreeRecord(item, kb) {
|
|
361
|
+
// Stable adapter order, not alphabetical: adding a catalog library must not
|
|
362
|
+
// silently change which entry the no-retrieval stand-in picks.
|
|
363
|
+
const libraryOrder = Object.keys(kb.libraries);
|
|
364
|
+
const candidates = kb
|
|
365
|
+
.query({ intent_type: item.intent.intent_type })
|
|
366
|
+
.sort((a, b) => libraryOrder.indexOf(a.library) - libraryOrder.indexOf(b.library) ||
|
|
367
|
+
a.component_id.localeCompare(b.component_id));
|
|
368
|
+
const predicted = candidates[0] ? [candidates[0].component_id] : [];
|
|
369
|
+
return {
|
|
370
|
+
item_id: item.item_id,
|
|
371
|
+
predicted,
|
|
372
|
+
acceptable: item.acceptable,
|
|
373
|
+
schema_valid: true,
|
|
374
|
+
constraints_ok: true,
|
|
375
|
+
confidence: 0.9,
|
|
376
|
+
outcome: "COMPLETED",
|
|
377
|
+
invalid_imports: [],
|
|
378
|
+
invalid_props: [],
|
|
379
|
+
turns_to_green: 0,
|
|
380
|
+
refused: predicted.length === 0,
|
|
381
|
+
refusal_correct: item.acceptable.length === 0,
|
|
382
|
+
unsafe_accept: predicted.length > 0 && !item.acceptable.includes(predicted[0]),
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function plainRecord(item) {
|
|
386
|
+
const slug = item.intent.intent_type.replace(/[^a-z0-9]+/g, "-");
|
|
387
|
+
return {
|
|
388
|
+
item_id: item.item_id,
|
|
389
|
+
predicted: [`shadcn/${slug}`],
|
|
390
|
+
acceptable: item.acceptable,
|
|
391
|
+
schema_valid: true,
|
|
392
|
+
constraints_ok: true,
|
|
393
|
+
confidence: 0.9,
|
|
394
|
+
outcome: "COMPLETED",
|
|
395
|
+
invalid_imports: [],
|
|
396
|
+
invalid_props: [],
|
|
397
|
+
turns_to_green: 0,
|
|
398
|
+
refused: false,
|
|
399
|
+
refusal_correct: item.acceptable.length === 0,
|
|
400
|
+
unsafe_accept: !item.acceptable.includes(`shadcn/${slug}`),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
export function loadThresholds(fixtures = fixturesDir()) {
|
|
404
|
+
return JSON.parse(readFileSync(join(fixtures, "thresholds.json"), "utf8"));
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* LibraryTypeChecker reads installed library .d.ts files and answers whether
|
|
408
|
+
* a given prop name exists on a given component. Used to simulate the tsc
|
|
409
|
+
* loop in arm (b): vendor MCP (docs) picks a component, generates scaffold
|
|
410
|
+
* code, then tsc checks it against real library types.
|
|
411
|
+
*
|
|
412
|
+
* This is approximate (regex-based on .d.ts text) but sufficient for Phase 9:
|
|
413
|
+
* it shows whether the KB's hand-curated props agree with the library's own
|
|
414
|
+
* published types, without requiring a full TypeScript parse.
|
|
415
|
+
*/
|
|
416
|
+
export class LibraryTypeChecker {
|
|
417
|
+
typeCache = new Map();
|
|
418
|
+
/** Resolve the main type-declaration file for a library under node_modules. */
|
|
419
|
+
resolveTypes(library) {
|
|
420
|
+
const roots = [
|
|
421
|
+
join("node_modules", library),
|
|
422
|
+
join("node_modules", library, "dist"),
|
|
423
|
+
];
|
|
424
|
+
const names = ["index.d.ts", `${library.split("/").pop() ?? library}.d.ts`];
|
|
425
|
+
for (const root of roots) {
|
|
426
|
+
for (const name of names) {
|
|
427
|
+
const p = join(root, name);
|
|
428
|
+
if (existsSync(p))
|
|
429
|
+
return p;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
getTypes(library) {
|
|
435
|
+
const cached = this.typeCache.get(library);
|
|
436
|
+
if (cached !== undefined)
|
|
437
|
+
return cached;
|
|
438
|
+
const path = this.resolveTypes(library);
|
|
439
|
+
const content = path ? readFileSync(path, "utf8") : "";
|
|
440
|
+
this.typeCache.set(library, content);
|
|
441
|
+
return content;
|
|
442
|
+
}
|
|
443
|
+
/** Approximate check: does propName appear as a property in the library's types? */
|
|
444
|
+
hasProp(library, _componentName, propName) {
|
|
445
|
+
const types = this.getTypes(library);
|
|
446
|
+
if (!types)
|
|
447
|
+
return true; // No types available: can't confirm or deny
|
|
448
|
+
// Match propName as an identifier in a property position: `propName?:` or `propName:` or `propName,`
|
|
449
|
+
return new RegExp(`(?:^|[\\s{(,])${escapeRegExp(propName)}\\s*[?:,]`, "m").test(types);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Check whether the scaffold's imports are valid: every module name must be
|
|
454
|
+
* a bare specifier that the KB declares (not a relative path that won't resolve).
|
|
455
|
+
*/
|
|
456
|
+
function checkImports(imports) {
|
|
457
|
+
const invalid = [];
|
|
458
|
+
for (const spec of imports) {
|
|
459
|
+
if (spec.module.startsWith(".") || spec.module.startsWith("/")) {
|
|
460
|
+
invalid.push(spec.module);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return invalid;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Check whether derived props match the library's real published types.
|
|
467
|
+
* Returns prop names that are NOT found in the library's .d.ts.
|
|
468
|
+
*/
|
|
469
|
+
function checkProps(entry, derivedProps, typeChecker) {
|
|
470
|
+
const invalid = [];
|
|
471
|
+
const kbPropNames = new Set(entry.props.map((p) => p.name));
|
|
472
|
+
for (const prop of derivedProps) {
|
|
473
|
+
// Only flag props that come from the KB (not intent-derived defaults)
|
|
474
|
+
if (!kbPropNames.has(prop.name))
|
|
475
|
+
continue;
|
|
476
|
+
if (!typeChecker.hasProp(entry.library, entry.component_id, prop.name)) {
|
|
477
|
+
invalid.push(prop.name);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return invalid;
|
|
481
|
+
}
|
|
482
|
+
function escapeRegExp(value) {
|
|
483
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Arm (b): vendor MCP (docs only) + tsc loop simulation.
|
|
487
|
+
*
|
|
488
|
+
* Models what a user gets when they:
|
|
489
|
+
* 1. Look up components in vendor docs (KB candidate list, no retrieval scoring)
|
|
490
|
+
* 2. Pick a component (model or first-declared stand-in)
|
|
491
|
+
* 3. Generate scaffold code using KB props
|
|
492
|
+
* 4. Run tsc against real library types; retry on failure (up to maxRetries)
|
|
493
|
+
*
|
|
494
|
+
* This arm has NO constraint checking and NO closed-ID gate, so it accepts
|
|
495
|
+
* whatever the docs return and relies on tsc to catch prop errors after the fact.
|
|
496
|
+
*/
|
|
497
|
+
async function runVendorMcpTscArm(items, normalizedIntents, compiledDesignFor, runtimeFor, options) {
|
|
498
|
+
const maxRetries = 3;
|
|
499
|
+
const typeChecker = new LibraryTypeChecker();
|
|
500
|
+
const modelArms = options.modelArms ?? "all";
|
|
501
|
+
const useModel = modelArms === "all" || modelArms === "vendor-mcp-tsc";
|
|
502
|
+
return mapSequential(items, async (item) => {
|
|
503
|
+
const runtime = runtimeFor(item.project ?? "greenfield-react");
|
|
504
|
+
const intent = normalizedIntents.get(item.item_id);
|
|
505
|
+
const design = compiledDesignFor(item);
|
|
506
|
+
// Vendor MCP: docs only - candidates without retrieval scoring, alphabetical
|
|
507
|
+
const candidates = runtime.kb
|
|
508
|
+
.query({ intent_type: intent.intent_type })
|
|
509
|
+
.sort((a, b) => a.component_id.localeCompare(b.component_id));
|
|
510
|
+
if (candidates.length === 0) {
|
|
511
|
+
return {
|
|
512
|
+
item_id: item.item_id,
|
|
513
|
+
predicted: [],
|
|
514
|
+
acceptable: item.acceptable,
|
|
515
|
+
schema_valid: true,
|
|
516
|
+
constraints_ok: true,
|
|
517
|
+
confidence: 0,
|
|
518
|
+
outcome: "FAILED",
|
|
519
|
+
invalid_imports: [],
|
|
520
|
+
invalid_props: [],
|
|
521
|
+
turns_to_green: 0,
|
|
522
|
+
refused: true,
|
|
523
|
+
refusal_correct: item.acceptable.length === 0,
|
|
524
|
+
unsafe_accept: false,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
let selectedComponent = null;
|
|
528
|
+
let lastInvalidImports = [];
|
|
529
|
+
let lastInvalidProps = [];
|
|
530
|
+
let turnsToGreen = 0;
|
|
531
|
+
// TSC loop: try candidates until one passes the type check, up to maxRetries
|
|
532
|
+
for (let attempt = 0; attempt < maxRetries && attempt < candidates.length; attempt++) {
|
|
533
|
+
const candidate = candidates[attempt];
|
|
534
|
+
turnsToGreen++;
|
|
535
|
+
const derived = deriveProps(candidate, intent, design);
|
|
536
|
+
const scaffold = buildScaffold({
|
|
537
|
+
intent,
|
|
538
|
+
entry: candidate,
|
|
539
|
+
props: derived.props,
|
|
540
|
+
variants: derived.variants,
|
|
541
|
+
});
|
|
542
|
+
const invalidImports = checkImports(scaffold.imports);
|
|
543
|
+
const invalidProps = checkProps(candidate, derived.props, typeChecker);
|
|
544
|
+
lastInvalidImports = invalidImports;
|
|
545
|
+
lastInvalidProps = invalidProps;
|
|
546
|
+
if (invalidImports.length === 0 && invalidProps.length === 0) {
|
|
547
|
+
selectedComponent = candidate;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (!selectedComponent) {
|
|
552
|
+
// TSC loop exhausted: no candidate produced valid types
|
|
553
|
+
return {
|
|
554
|
+
item_id: item.item_id,
|
|
555
|
+
predicted: [],
|
|
556
|
+
acceptable: item.acceptable,
|
|
557
|
+
schema_valid: true,
|
|
558
|
+
constraints_ok: false,
|
|
559
|
+
confidence: 0,
|
|
560
|
+
outcome: "FAILED",
|
|
561
|
+
invalid_imports: lastInvalidImports,
|
|
562
|
+
invalid_props: lastInvalidProps,
|
|
563
|
+
turns_to_green: maxRetries,
|
|
564
|
+
refused: true,
|
|
565
|
+
refusal_correct: item.acceptable.length === 0,
|
|
566
|
+
unsafe_accept: false,
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
const predicted = [selectedComponent.component_id];
|
|
570
|
+
return {
|
|
571
|
+
item_id: item.item_id,
|
|
572
|
+
predicted,
|
|
573
|
+
acceptable: item.acceptable,
|
|
574
|
+
schema_valid: true,
|
|
575
|
+
constraints_ok: true,
|
|
576
|
+
confidence: 0.9,
|
|
577
|
+
outcome: "COMPLETED",
|
|
578
|
+
invalid_imports: [],
|
|
579
|
+
invalid_props: [],
|
|
580
|
+
turns_to_green: turnsToGreen,
|
|
581
|
+
refused: false,
|
|
582
|
+
refusal_correct: false,
|
|
583
|
+
unsafe_accept: !item.acceptable.includes(selectedComponent.component_id),
|
|
584
|
+
};
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
export function goldenSetSummary(set) {
|
|
588
|
+
return coverageMatrix(set.items);
|
|
589
|
+
}
|
|
590
|
+
async function runNSampleAgreement(items, options, runtimeFor, normalizedIntents, compiledDesignFor) {
|
|
591
|
+
const samples = options.nSamples ?? 5;
|
|
592
|
+
const blindItems = options.blindOnly
|
|
593
|
+
? items.filter((item) => item.blind === true)
|
|
594
|
+
: items.filter((item) => item.blind === true);
|
|
595
|
+
if (blindItems.length === 0) {
|
|
596
|
+
return {
|
|
597
|
+
total_blind_items: 0,
|
|
598
|
+
samples_per_item: samples,
|
|
599
|
+
agreements: [],
|
|
600
|
+
overall_agreement_rate: 1,
|
|
601
|
+
notes: ["No blind items found in golden set; self-agreement not measured."],
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
let model;
|
|
605
|
+
if (options.openAiCompatible) {
|
|
606
|
+
model = createOpenAiCompatibleSelectionModel(options.openAiCompatible);
|
|
607
|
+
}
|
|
608
|
+
else if (options.localLlm) {
|
|
609
|
+
model = createLocalLlmSelectionModel(options.localLlm);
|
|
610
|
+
}
|
|
611
|
+
else if (options.simulatedBehavior) {
|
|
612
|
+
model = createSimulatedModel(options.simulatedBehavior);
|
|
613
|
+
}
|
|
614
|
+
else if (options.noRetrievalModel) {
|
|
615
|
+
model = options.noRetrievalModel;
|
|
616
|
+
}
|
|
617
|
+
else if (options.model) {
|
|
618
|
+
model = options.model;
|
|
619
|
+
}
|
|
620
|
+
if (!model) {
|
|
621
|
+
return {
|
|
622
|
+
total_blind_items: blindItems.length,
|
|
623
|
+
samples_per_item: samples,
|
|
624
|
+
agreements: [],
|
|
625
|
+
overall_agreement_rate: 1,
|
|
626
|
+
notes: ["No selection model provided for N-sample agreement; using deterministic stand-in."],
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const agreements = [];
|
|
630
|
+
for (const item of blindItems) {
|
|
631
|
+
const intent = normalizedIntents.get(item.item_id);
|
|
632
|
+
const runtime = runtimeFor(item.project ?? "greenfield-react");
|
|
633
|
+
const prompt = noRetrievalPrompt(intent, runtime.kb, compiledDesignFor(item));
|
|
634
|
+
if (!prompt) {
|
|
635
|
+
agreements.push({
|
|
636
|
+
item_id: item.item_id,
|
|
637
|
+
predictions: [],
|
|
638
|
+
agreement_rate: 1,
|
|
639
|
+
most_common: null,
|
|
640
|
+
});
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
const predictions = [];
|
|
644
|
+
for (let s = 0; s < samples; s++) {
|
|
645
|
+
const result = await model.select(prompt);
|
|
646
|
+
predictions.push(result.component_id ? [result.component_id] : []);
|
|
647
|
+
}
|
|
648
|
+
// Compute agreement rate: fraction of samples that match the most common prediction
|
|
649
|
+
const flat = predictions.flat();
|
|
650
|
+
const counts = new Map();
|
|
651
|
+
for (const p of flat)
|
|
652
|
+
counts.set(p, (counts.get(p) ?? 0) + 1);
|
|
653
|
+
let mostCommon = null;
|
|
654
|
+
let maxCount = 0;
|
|
655
|
+
for (const [comp, count] of counts) {
|
|
656
|
+
if (count > maxCount) {
|
|
657
|
+
maxCount = count;
|
|
658
|
+
mostCommon = comp;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
const agreementRate = flat.length > 0 ? maxCount / flat.length : 1;
|
|
662
|
+
agreements.push({
|
|
663
|
+
item_id: item.item_id,
|
|
664
|
+
predictions,
|
|
665
|
+
agreement_rate: agreementRate,
|
|
666
|
+
most_common: mostCommon,
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
const overallAgreementRate = agreements.length > 0
|
|
670
|
+
? agreements.reduce((sum, a) => sum + a.agreement_rate, 0) / agreements.length
|
|
671
|
+
: 1;
|
|
672
|
+
return {
|
|
673
|
+
total_blind_items: blindItems.length,
|
|
674
|
+
samples_per_item: samples,
|
|
675
|
+
agreements,
|
|
676
|
+
overall_agreement_rate: overallAgreementRate,
|
|
677
|
+
notes: [
|
|
678
|
+
`Measured self-agreement on ${blindItems.length} blind items with ${samples} samples each.`,
|
|
679
|
+
`Overall agreement rate: ${(overallAgreementRate * 100).toFixed(1)}%.`,
|
|
680
|
+
],
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
//# sourceMappingURL=baseline.js.map
|