@warpgogol/werkstatt-shared 0.2.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/package.json +352 -0
- package/src/checks/index.ts +24 -0
- package/src/checks/lib/astro-site-url.ts +30 -0
- package/src/checks/lib/i18n.ts +30 -0
- package/src/checks/result-helpers.ts +102 -0
- package/src/checks/suppressions-config.ts +195 -0
- package/src/index.ts +14 -0
- package/src/integration/README.md +38 -0
- package/src/integration/adapters.ts +143 -0
- package/src/integration/crm-buffer.ts +491 -0
- package/src/integration/dispatch.ts +106 -0
- package/src/integration/funnel.ts +379 -0
- package/src/integration/index.ts +56 -0
- package/src/integration/lifecycle.ts +155 -0
- package/src/integration/orchestration.ts +439 -0
- package/src/integration/port-barrel.ts +124 -0
- package/src/integration/port.ts +143 -0
- package/src/integration/qstash.ts +134 -0
- package/src/integration/sharding.ts +133 -0
- package/src/integration/tests/deliver-event.test.ts +52 -0
- package/src/integration/tests/dispatch.test.ts +88 -0
- package/src/integration/tests/funnel-bridge.test.ts +46 -0
- package/src/integration/tests/hub-runtime.test.ts +128 -0
- package/src/integration/tests/lifecycle.test.ts +69 -0
- package/src/integration/tests/qstash.test.ts +83 -0
- package/src/integration/tests/sharding.test.ts +64 -0
- package/src/integration/vitest.config.ts +8 -0
- package/src/integration-adapter-supabase-crm/adapter.ts +437 -0
- package/src/integration-adapter-supabase-crm/client.ts +605 -0
- package/src/integration-adapter-supabase-crm/index.ts +28 -0
- package/src/integration-adapter-supabase-crm/pipedrive-sync-target.ts +482 -0
- package/src/integration-adapter-supabase-crm/supabase-rest.ts +89 -0
- package/src/integration-adapter-supabase-crm/tenant-registry.ts +334 -0
- package/src/integration-adapter-supabase-crm/tests/change-balance.pbt.test.ts +83 -0
- package/src/integration-adapter-supabase-crm/tests/funnel-persistence.test.ts +409 -0
- package/src/integration-adapter-supabase-crm/tests/lifecycle-sync.test.ts +288 -0
- package/src/integration-adapter-supabase-crm/tests/stage-map.test.ts +80 -0
- package/src/integration-adapter-supabase-crm/vitest.config.ts +8 -0
- package/src/integration-adapter-supabase-crm/worker.ts +223 -0
- package/src/observability/conventions.ts +93 -0
- package/src/observability/env-resolver.ts +57 -0
- package/src/observability/index.ts +57 -0
- package/src/observability/metric-registry.ts +184 -0
- package/src/observability/otlp-converter.ts +125 -0
- package/src/observability/otlp-json.ts +135 -0
- package/src/observability/otlp-transport.ts +68 -0
- package/src/observability/pusher.ts +142 -0
- package/src/observability/redact.ts +27 -0
- package/src/observability/tests/conventions.test.ts +100 -0
- package/src/observability/tests/metric-registry.test.ts +117 -0
- package/src/observability/tests/otlp-converter.pbt.test.ts +77 -0
- package/src/observability/tests/otlp-converter.test.ts +157 -0
- package/src/observability/tests/otlp-json.test.ts +120 -0
- package/src/observability/tests/pusher.test.ts +75 -0
- package/src/observability/tests/redact.pbt.test.ts +71 -0
- package/src/observability/tests/redact.test.ts +37 -0
- package/src/observability/typed-refs.ts +137 -0
- package/src/observability/vitest.config.ts +8 -0
- package/src/ontology/analytics/matomo-binding.yaml +172 -0
- package/src/ontology/analytics/matomo-fleet.registry.yaml +26 -0
- package/src/ontology/analytics/messkanon.yaml +151 -0
- package/src/ontology/archetype-registry.ts +61 -0
- package/src/ontology/archetypes/components/brand-label.yaml +19 -0
- package/src/ontology/archetypes/components/copyright.yaml +19 -0
- package/src/ontology/archetypes/components/currency-aware-price-display.yaml +19 -0
- package/src/ontology/archetypes/components/currency-selector.yaml +19 -0
- package/src/ontology/archetypes/components/footer-promo.yaml +19 -0
- package/src/ontology/archetypes/components/lang-switcher.yaml +19 -0
- package/src/ontology/archetypes/components/layout.yaml +19 -0
- package/src/ontology/archetypes/components/live-photo.yaml +20 -0
- package/src/ontology/archetypes/components/material-credit.yaml +20 -0
- package/src/ontology/archetypes/components/media.yaml +21 -0
- package/src/ontology/archetypes/components/nachweis-card.yaml +34 -0
- package/src/ontology/archetypes/components/nachweis-detail.yaml +43 -0
- package/src/ontology/archetypes/components/nachweis-list.yaml +37 -0
- package/src/ontology/archetypes/components/nachweis-verify.yaml +31 -0
- package/src/ontology/archetypes/components/not-found.yaml +22 -0
- package/src/ontology/archetypes/components/offer-capacity.yaml +21 -0
- package/src/ontology/archetypes/components/passport-header.yaml +19 -0
- package/src/ontology/archetypes/components/passport-provenance.yaml +20 -0
- package/src/ontology/archetypes/components/passport-score-grid.yaml +20 -0
- package/src/ontology/archetypes/components/passport-star-map.yaml +20 -0
- package/src/ontology/archetypes/components/person-profile.yaml +20 -0
- package/src/ontology/archetypes/components/pulsar.yaml +20 -0
- package/src/ontology/archetypes/components/responsive-image.yaml +19 -0
- package/src/ontology/archetypes/components/scroll-to-top.yaml +22 -0
- package/src/ontology/archetypes/components/social-meta.yaml +20 -0
- package/src/ontology/archetypes/components/structured-data.yaml +19 -0
- package/src/ontology/archetypes/index.json +1003 -0
- package/src/ontology/archetypes/index.yaml +821 -0
- package/src/ontology/archetypes/sections/approach.yaml +23 -0
- package/src/ontology/archetypes/sections/article-list.yaml +30 -0
- package/src/ontology/archetypes/sections/audience-cards.yaml +30 -0
- package/src/ontology/archetypes/sections/breadcrumbs.yaml +21 -0
- package/src/ontology/archetypes/sections/chat-widget.yaml +37 -0
- package/src/ontology/archetypes/sections/comparison-cards.yaml +31 -0
- package/src/ontology/archetypes/sections/controlled-responsibility-block.yaml +34 -0
- package/src/ontology/archetypes/sections/credits.yaml +29 -0
- package/src/ontology/archetypes/sections/donation-card.yaml +53 -0
- package/src/ontology/archetypes/sections/donation-use.yaml +23 -0
- package/src/ontology/archetypes/sections/dynamic-status-block.yaml +35 -0
- package/src/ontology/archetypes/sections/faq-list.yaml +26 -0
- package/src/ontology/archetypes/sections/final-cta.yaml +53 -0
- package/src/ontology/archetypes/sections/hero-decision-card.yaml +65 -0
- package/src/ontology/archetypes/sections/hero.yaml +50 -0
- package/src/ontology/archetypes/sections/impact.yaml +23 -0
- package/src/ontology/archetypes/sections/markdown.yaml +43 -0
- package/src/ontology/archetypes/sections/mountain-journey.yaml +43 -0
- package/src/ontology/archetypes/sections/navigation.yaml +20 -0
- package/src/ontology/archetypes/sections/notausgang-block.yaml +41 -0
- package/src/ontology/archetypes/sections/open-source-registry.yaml +26 -0
- package/src/ontology/archetypes/sections/ownership-block.yaml +57 -0
- package/src/ontology/archetypes/sections/people.yaml +48 -0
- package/src/ontology/archetypes/sections/price-card.yaml +50 -0
- package/src/ontology/archetypes/sections/problem.yaml +23 -0
- package/src/ontology/archetypes/sections/send-message.yaml +63 -0
- package/src/ontology/archetypes/sections/service-metadata-block.yaml +40 -0
- package/src/ontology/archetypes/sections/social-proof.yaml +27 -0
- package/src/ontology/archetypes/sections/transparency.yaml +32 -0
- package/src/ontology/archetypes/sections/trust-strip.yaml +42 -0
- package/src/ontology/archetypes/sections/video-section.yaml +27 -0
- package/src/ontology/archetypes/sections/women.yaml +29 -0
- package/src/ontology/biome-token-projection.ts +229 -0
- package/src/ontology/biomes/check-concrete-blueprint.yaml +118 -0
- package/src/ontology/biomes/handwerk-material-warm.yaml +135 -0
- package/src/ontology/biomes/nonprofit-trust.yaml +123 -0
- package/src/ontology/blueprints/offer.yaml +39 -0
- package/src/ontology/blueprints/prompts/local-market-signal.md +13 -0
- package/src/ontology/blueprints/prompts/website-local-narrative.md +24 -0
- package/src/ontology/blueprints/ratgeber.yaml +62 -0
- package/src/ontology/blueprints/website-local.yaml +309 -0
- package/src/ontology/blueprints/website-service.yaml +84 -0
- package/src/ontology/capabilities/lead.submit.yaml +44 -0
- package/src/ontology/cosmic/index.ts +48 -0
- package/src/ontology/cosmic/moon-catalog.ts +173 -0
- package/src/ontology/cosmic/planet-catalog.ts +82 -0
- package/src/ontology/cosmic/star-catalog.ts +337 -0
- package/src/ontology/enums.ts +159 -0
- package/src/ontology/external-surfaces/index.ts +158 -0
- package/src/ontology/external-surfaces/jsonld-types.yaml +135 -0
- package/src/ontology/external-surfaces/sitemap-shape.yaml +6 -0
- package/src/ontology/external-surfaces/url-schema.yaml +95 -0
- package/src/ontology/growth/events/contact-email-click.yaml +21 -0
- package/src/ontology/growth/events/contact-form-submit.yaml +25 -0
- package/src/ontology/growth/events/contact-phone-click.yaml +21 -0
- package/src/ontology/growth/events/contact-route-click.yaml +21 -0
- package/src/ontology/growth/events/contact-submit.yaml +28 -0
- package/src/ontology/growth/events/contact-whatsapp-click.yaml +21 -0
- package/src/ontology/growth/events/cta-click.yaml +30 -0
- package/src/ontology/growth/events/donation-confirmed.yaml +32 -0
- package/src/ontology/growth/events/donation-form-start.yaml +21 -0
- package/src/ontology/growth/events/donation-form-submit.yaml +29 -0
- package/src/ontology/growth/events/donation-intent.yaml +29 -0
- package/src/ontology/growth/events/form-error.yaml +27 -0
- package/src/ontology/growth/events/form-start.yaml +21 -0
- package/src/ontology/growth/events/form-submit.yaml +21 -0
- package/src/ontology/growth/events/outbound-click.yaml +25 -0
- package/src/ontology/growth/events/page-view.yaml +24 -0
- package/src/ontology/growth/events/passport-view.yaml +28 -0
- package/src/ontology/growth/events/star-map-navigate.yaml +30 -0
- package/src/ontology/index.ts +165 -0
- package/src/ontology/manifest.ts +344 -0
- package/src/ontology/operations/index.ts +1 -0
- package/src/ontology/schemas/biome.ts +303 -0
- package/src/ontology/schemas/capability.ts +104 -0
- package/src/ontology/schemas/constellation.ts +114 -0
- package/src/ontology/schemas/dns-records.ts +53 -0
- package/src/ontology/schemas/index.ts +95 -0
- package/src/ontology/schemas/manifest-resolver.ts +123 -0
- package/src/ontology/schemas/page-entry.ts +213 -0
- package/src/ontology/schemas/section-archetype.ts +109 -0
- package/src/ontology/schemas/site-family.ts +98 -0
- package/src/ontology/schemas/system/growth.ts +80 -0
- package/src/ontology/schemas/system/integrations.ts +143 -0
- package/src/ontology/schemas/system/manifest.ts +492 -0
- package/src/ontology/schemas/system/page-output.ts +99 -0
- package/src/ontology/schemas/system/release.ts +58 -0
- package/src/ontology/schemas/system/text.ts +58 -0
- package/src/ontology/schemas/system.ts +53 -0
- package/src/ontology/shared-section-props/body-fragments.ts +182 -0
- package/src/ontology/shared-section-props/catalog.ts +195 -0
- package/src/ontology/shared-section-props/common.ts +178 -0
- package/src/ontology/shared-section-props/index.ts +34 -0
- package/src/ontology/shared-section-props/visual-header.ts +163 -0
- package/src/ontology/site-families/charity-donation-trust/cultural-rules.yaml +6 -0
- package/src/ontology/site-families/charity-donation-trust/family.yaml +44 -0
- package/src/ontology/site-families/charity-donation-trust/linguistic-rules.yaml +6 -0
- package/src/ontology/site-families/check-quality-operator/cultural-rules.yaml +6 -0
- package/src/ontology/site-families/check-quality-operator/family.yaml +40 -0
- package/src/ontology/site-families/check-quality-operator/linguistic-rules.yaml +6 -0
- package/src/ontology/site-families/handwerk-trust-engineering/cultural-rules.yaml +6 -0
- package/src/ontology/site-families/handwerk-trust-engineering/family.yaml +53 -0
- package/src/ontology/site-families/handwerk-trust-engineering/linguistic-rules.yaml +6 -0
- package/src/ontology/tests/catalogs.pbt.test.ts +89 -0
- package/src/ontology/tests/enums.test.ts +203 -0
- package/src/ontology/tests/sternsystem-owner.test.ts +63 -0
- package/src/ontology/vitest.config.ts +8 -0
- package/src/passport/dht-sign.test.ts +99 -0
- package/src/passport/dht-sign.ts +73 -0
- package/src/passport/identity-sign.test.ts +134 -0
- package/src/passport/identity-sign.ts +85 -0
- package/src/passport/index.ts +53 -0
- package/src/passport/key-rotate.ts +133 -0
- package/src/passport/schema.ts +198 -0
- package/src/passport/sign.ts +225 -0
- package/src/passport/tests/schema.pbt.test.ts +93 -0
- package/src/passport/tests/schema.test.ts +222 -0
- package/src/passport/vitest.config.ts +8 -0
- package/src/share/agent/api-catalog.ts +77 -0
- package/src/share/agent/capability.ts +68 -0
- package/src/share/agent/dns-aid.test.ts +74 -0
- package/src/share/agent/dns-aid.ts +53 -0
- package/src/share/agent/fleet-catalog.ts +149 -0
- package/src/share/agent/index.ts +29 -0
- package/src/share/agent/knowledge.ts +96 -0
- package/src/share/agent/manifest.ts +126 -0
- package/src/share/agent/mcp-card.ts +63 -0
- package/src/share/agent/omit-empty.ts +77 -0
- package/src/share/agent/openapi.ts +157 -0
- package/src/share/agent/proof.ts +61 -0
- package/src/share/attribution-display.ts +86 -0
- package/src/share/check-hints.ts +38 -0
- package/src/share/content/entity-id.ts +65 -0
- package/src/share/content/index.ts +16 -0
- package/src/share/content/merge.ts +86 -0
- package/src/share/content/resolve-field-path.ts +39 -0
- package/src/share/content/substitute-deep.ts +47 -0
- package/src/share/content-discipline/index.ts +14 -0
- package/src/share/content-discipline/parsers.ts +66 -0
- package/src/share/content-discipline/types.ts +118 -0
- package/src/share/content-reference.ts +333 -0
- package/src/share/counter-utils.ts +75 -0
- package/src/share/css-value-normalize.ts +48 -0
- package/src/share/dev-props-validator.ts +131 -0
- package/src/share/entitlement.ts +172 -0
- package/src/share/env.d.ts +73 -0
- package/src/share/feature-policy.ts +367 -0
- package/src/share/formula-eval.ts +364 -0
- package/src/share/fs/index.ts +96 -0
- package/src/share/i18n/localization.ts +57 -0
- package/src/share/image-provider.ts +314 -0
- package/src/share/index.ts +86 -0
- package/src/share/knowledge/claim.ts +129 -0
- package/src/share/knowledge/derivation.ts +55 -0
- package/src/share/knowledge/freshness.ts +127 -0
- package/src/share/knowledge/index.ts +23 -0
- package/src/share/knowledge/ledger.ts +222 -0
- package/src/share/knowledge/plan.ts +122 -0
- package/src/share/knowledge/source.ts +170 -0
- package/src/share/legal/translation-policy.ts +133 -0
- package/src/share/material-credits.ts +181 -0
- package/src/share/middleware/language-redirect.ts +49 -0
- package/src/share/offer-capacity.ts +149 -0
- package/src/share/onboarding-yaml/index.ts +162 -0
- package/src/share/page.ts +351 -0
- package/src/share/redirects.test.ts +62 -0
- package/src/share/redirects.ts +54 -0
- package/src/share/rfc0042-utils.ts +95 -0
- package/src/share/runtime-context.ts +70 -0
- package/src/share/schemas/claim-records.ts +69 -0
- package/src/share/schemas/claims.ts +150 -0
- package/src/share/schemas/effects.ts +212 -0
- package/src/share/schemas/features.ts +147 -0
- package/src/share/schemas/horizontal-align.ts +22 -0
- package/src/share/schemas/icon-color.ts +27 -0
- package/src/share/schemas/index.ts +43 -0
- package/src/share/schemas/live-photo.ts +53 -0
- package/src/share/schemas/material-credit.ts +292 -0
- package/src/share/schemas/media.ts +220 -0
- package/src/share/schemas/navigation.ts +74 -0
- package/src/share/schemas/page-base.ts +33 -0
- package/src/share/schemas/participant.ts +247 -0
- package/src/share/schemas/person.ts +24 -0
- package/src/share/schemas/print.ts +93 -0
- package/src/share/schemas/section-background.ts +106 -0
- package/src/share/schemas/section-body.ts +138 -0
- package/src/share/schemas/section-cards.ts +37 -0
- package/src/share/schemas/section-cta.ts +74 -0
- package/src/share/schemas/section-header.ts +77 -0
- package/src/share/schemas/section-image.ts +77 -0
- package/src/share/schemas/section-motion.ts +52 -0
- package/src/share/schemas/section-shell.ts +63 -0
- package/src/share/schemas/section-stats.ts +37 -0
- package/src/share/schemas/site-background.ts +78 -0
- package/src/share/schemas/standard-list-item.ts +38 -0
- package/src/share/scripts/external-links.ts +45 -0
- package/src/share/scripts/gsap-counter.ts +168 -0
- package/src/share/scripts/gsap-mountain-journey.ts +236 -0
- package/src/share/scripts/gsap-parallax.ts +50 -0
- package/src/share/scripts/gsap-reveal.ts +65 -0
- package/src/share/scripts/gsap-stagger.ts +54 -0
- package/src/share/scripts/index.ts +25 -0
- package/src/share/scripts/inline-number-animation.ts +120 -0
- package/src/share/scripts/lenis.ts +109 -0
- package/src/share/scripts/live-photos.ts +250 -0
- package/src/share/scripts/lordicon.ts +94 -0
- package/src/share/scripts/orchestrator.ts +138 -0
- package/src/share/scripts/scheduler.ts +53 -0
- package/src/share/scripts/video-player.ts +116 -0
- package/src/share/semantic/ai.ts +140 -0
- package/src/share/semantic/block-extraction.ts +52 -0
- package/src/share/semantic/block-extractors/index.ts +502 -0
- package/src/share/semantic/breadcrumbs.ts +120 -0
- package/src/share/semantic/build-page.ts +309 -0
- package/src/share/semantic/business-projection.ts +278 -0
- package/src/share/semantic/derived-prices-loader.ts +36 -0
- package/src/share/semantic/extract.ts +118 -0
- package/src/share/semantic/feed.ts +124 -0
- package/src/share/semantic/ids.ts +76 -0
- package/src/share/semantic/image-sitemap.ts +153 -0
- package/src/share/semantic/index.ts +36 -0
- package/src/share/semantic/jsonld/article.ts +47 -0
- package/src/share/semantic/jsonld/breadcrumb.ts +47 -0
- package/src/share/semantic/jsonld/collection-list.ts +30 -0
- package/src/share/semantic/jsonld/context.ts +46 -0
- package/src/share/semantic/jsonld/faq.ts +49 -0
- package/src/share/semantic/jsonld/initiative.ts +53 -0
- package/src/share/semantic/jsonld/organization.ts +101 -0
- package/src/share/semantic/jsonld/person.ts +71 -0
- package/src/share/semantic/jsonld/service.ts +80 -0
- package/src/share/semantic/jsonld/shared.ts +31 -0
- package/src/share/semantic/jsonld/types.ts +18 -0
- package/src/share/semantic/jsonld/webpage.ts +98 -0
- package/src/share/semantic/jsonld/website.ts +27 -0
- package/src/share/semantic/jsonld.ts +75 -0
- package/src/share/semantic/llms-policy.ts +74 -0
- package/src/share/semantic/llms.ts +394 -0
- package/src/share/semantic/markdown-hygiene.ts +68 -0
- package/src/share/semantic/markdown-twin-provenance.ts +242 -0
- package/src/share/semantic/models.ts +402 -0
- package/src/share/semantic/organization-profile.ts +160 -0
- package/src/share/semantic/output-projection.ts +131 -0
- package/src/share/semantic/page-builders/markdown-page.ts +84 -0
- package/src/share/semantic/page-markdown.ts +234 -0
- package/src/share/semantic/page-utils.ts +125 -0
- package/src/share/semantic/price-marker-resolver.ts +92 -0
- package/src/share/semantic/robots.ts +127 -0
- package/src/share/semantic/update-stamp.ts +136 -0
- package/src/share/shared-context.ts +177 -0
- package/src/share/string-utils.ts +19 -0
- package/src/share/tests/api-catalog.test.ts +97 -0
- package/src/share/tests/breadcrumbs.test.ts +126 -0
- package/src/share/tests/build-page-price-markers.test.ts +160 -0
- package/src/share/tests/capability.test.ts +107 -0
- package/src/share/tests/claim.test.ts +90 -0
- package/src/share/tests/content-ref-index.test.ts +328 -0
- package/src/share/tests/create-dev-props-validator.test.ts +38 -0
- package/src/share/tests/derivation.test.ts +39 -0
- package/src/share/tests/dev-props-validator.test.ts +88 -0
- package/src/share/tests/fleet-catalog.test.ts +134 -0
- package/src/share/tests/formula-eval.test.ts +619 -0
- package/src/share/tests/freshness.test.ts +60 -0
- package/src/share/tests/hero-section-numbering-parity.test.ts +51 -0
- package/src/share/tests/image-sitemap.test.ts +101 -0
- package/src/share/tests/jsonld-service.test.ts +282 -0
- package/src/share/tests/knowledge.test.ts +86 -0
- package/src/share/tests/ledger.test.ts +125 -0
- package/src/share/tests/llms-0789.test.ts +63 -0
- package/src/share/tests/manifest.test.ts +100 -0
- package/src/share/tests/markdown-twin-provenance.test.ts +108 -0
- package/src/share/tests/mcp-card.test.ts +57 -0
- package/src/share/tests/onboarding-yaml.test.ts +111 -0
- package/src/share/tests/ontology-role-by-cosmic-name.test.ts +28 -0
- package/src/share/tests/openapi.test.ts +116 -0
- package/src/share/tests/organization-jsonld.test.ts +74 -0
- package/src/share/tests/output-projection.test.ts +61 -0
- package/src/share/tests/plan.test.ts +97 -0
- package/src/share/tests/price-marker-resolver.test.ts +141 -0
- package/src/share/tests/proof.test.ts +72 -0
- package/src/share/tests/resolve-field-path.test.ts +52 -0
- package/src/share/tests/source.test.ts +81 -0
- package/src/share/tests/substitute-deep.test.ts +65 -0
- package/src/share/tests/text-normalize.pbt.test.ts +143 -0
- package/src/share/tests/text-normalize.test.ts +285 -0
- package/src/share/tests/twin-path.test.ts +43 -0
- package/src/share/text-normalize.ts +548 -0
- package/src/share/text-position.ts +19 -0
- package/src/share/types/hls-js-light.d.ts +16 -0
- package/src/share/visibility.ts +167 -0
- package/src/share/vitest.config.ts +8 -0
- package/src/share/wrap-inline-numbers.ts +139 -0
- package/src/surface/blueprint-schema.ts +314 -0
- package/src/surface/blueprint-types.ts +256 -0
- package/src/surface/blueprint.ts +300 -0
- package/src/surface/breaker.ts +57 -0
- package/src/surface/decision-composer.ts +156 -0
- package/src/surface/eligibility.ts +372 -0
- package/src/surface/evidence-records.ts +97 -0
- package/src/surface/fleet.ts +60 -0
- package/src/surface/geo.ts +170 -0
- package/src/surface/governance.ts +146 -0
- package/src/surface/index.ts +216 -0
- package/src/surface/io/index.ts +18 -0
- package/src/surface/io/surface-module-context-io.ts +60 -0
- package/src/surface/io/visibility-outcomes-io.ts +46 -0
- package/src/surface/module-context.ts +120 -0
- package/src/surface/substance.ts +161 -0
- package/src/surface/tests/eligibility.pbt.test.ts +137 -0
- package/src/surface/tests/eligibility.test.ts +302 -0
- package/src/surface/types.ts +289 -0
- package/src/surface/visibility.ts +57 -0
- package/src/surface/vitest.config.ts +8 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
[RFC-0195] Dual SEO + GEO projection for the Programmatic Surface. Renders a baked page into a
|
|
5
|
+
clean Markdown twin (the AI-readable artifact, RFC-0184) and decides per-entry GEO inclusion.
|
|
6
|
+
The same dataset × axes that target Google long-tail also feed generative answer engines, with
|
|
7
|
+
no separate authoring. Suppressed (noindex / non-live) pages are excluded by the caller. Pure.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not write files or read the network (the kernel command does I/O).</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-0195: initial GEO projection.</item>
|
|
15
|
+
<item>Architecture review 2026-07-10: extract blockTwinRegistry so each block type has a registered twin renderer instead of pattern-matching on prop shapes in renderTwin.</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { PageEntry } from "./types.ts";
|
|
20
|
+
import type { VirtualRouteEntry } from "./types.ts";
|
|
21
|
+
|
|
22
|
+
function str(value: unknown): string | undefined {
|
|
23
|
+
return typeof value === "string" && value.trim() ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A twin renderer for one block type: takes the block's props and returns Markdown lines. */
|
|
27
|
+
export type BlockTwinRenderer = (props: Record<string, unknown>) => string[];
|
|
28
|
+
|
|
29
|
+
const heroTwinRenderer: BlockTwinRenderer = (props) => {
|
|
30
|
+
const header = props.header as Record<string, unknown> | undefined;
|
|
31
|
+
const heading = str(props.heading) ?? str(header?.heading);
|
|
32
|
+
const lead = str(props.lead) ?? str(props.description) ?? str(props.tagline);
|
|
33
|
+
const lines: string[] = [];
|
|
34
|
+
if (heading) lines.push(`## ${heading}`);
|
|
35
|
+
if (lead) lines.push("", lead);
|
|
36
|
+
return lines;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const markdownTwinRenderer: BlockTwinRenderer = (props) => {
|
|
40
|
+
const heading = str(props.heading);
|
|
41
|
+
const lead = str(props.lead) ?? str(props.description) ?? str(props.tagline);
|
|
42
|
+
const lines: string[] = [];
|
|
43
|
+
if (heading) lines.push(`## ${heading}`);
|
|
44
|
+
if (lead) lines.push("", lead);
|
|
45
|
+
return lines;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const cardGridTwinRenderer: BlockTwinRenderer = (props) => {
|
|
49
|
+
const heading = str(props.heading);
|
|
50
|
+
const cards = (props.body as { cards?: Array<Record<string, unknown>> } | undefined)?.cards;
|
|
51
|
+
const lines: string[] = [];
|
|
52
|
+
if (heading) lines.push(`## ${heading}`);
|
|
53
|
+
for (const card of cards ?? []) {
|
|
54
|
+
const title = str(card.title);
|
|
55
|
+
const description = str(card.description);
|
|
56
|
+
if (title || description) {
|
|
57
|
+
lines.push(
|
|
58
|
+
"",
|
|
59
|
+
title ? `- **${title}**${description ? `: ${description}` : ""}` : `- ${description}`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return lines;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const linkedCardGridTwinRenderer: BlockTwinRenderer = (props) => {
|
|
67
|
+
const heading = str(props.heading);
|
|
68
|
+
const cards =
|
|
69
|
+
(props.cards as Array<Record<string, unknown>> | undefined) ??
|
|
70
|
+
(props.body as { cards?: Array<Record<string, unknown>> } | undefined)?.cards;
|
|
71
|
+
const lines: string[] = [];
|
|
72
|
+
if (heading) lines.push(`## ${heading}`);
|
|
73
|
+
for (const card of cards ?? []) {
|
|
74
|
+
const title = str(card.title);
|
|
75
|
+
const description = str(card.description);
|
|
76
|
+
if (title || description) {
|
|
77
|
+
lines.push(
|
|
78
|
+
"",
|
|
79
|
+
title ? `- **${title}**${description ? `: ${description}` : ""}` : `- ${description}`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return lines;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const listCardsTwinRenderer: BlockTwinRenderer = (props) => {
|
|
87
|
+
const heading = str(props.heading);
|
|
88
|
+
const items =
|
|
89
|
+
(props.items as Array<Record<string, unknown>> | undefined) ??
|
|
90
|
+
(props.body as { items?: Array<Record<string, unknown>> } | undefined)?.items;
|
|
91
|
+
const lines: string[] = [];
|
|
92
|
+
if (heading) lines.push(`## ${heading}`);
|
|
93
|
+
for (const item of items ?? []) {
|
|
94
|
+
const title = str(item.title);
|
|
95
|
+
const description = str(item.description) ?? str(item.body);
|
|
96
|
+
if (title || description) {
|
|
97
|
+
lines.push(
|
|
98
|
+
"",
|
|
99
|
+
title ? `- **${title}**${description ? `: ${description}` : ""}` : `- ${description}`,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return lines;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const ctaTwinRenderer: BlockTwinRenderer = (props) => {
|
|
107
|
+
const heading = str(props.heading);
|
|
108
|
+
const lines: string[] = [];
|
|
109
|
+
if (heading) lines.push(`## ${heading}`);
|
|
110
|
+
return lines;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const blockTwinRegistry: Readonly<Record<string, BlockTwinRenderer>> = {
|
|
114
|
+
hero: heroTwinRenderer,
|
|
115
|
+
markdown: markdownTwinRenderer,
|
|
116
|
+
"card-grid": cardGridTwinRenderer,
|
|
117
|
+
"linked-card-grid": linkedCardGridTwinRenderer,
|
|
118
|
+
"list-cards": listCardsTwinRenderer,
|
|
119
|
+
cta: ctaTwinRenderer,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** Fallback: extract any visible string-valued props as bullet lines. */
|
|
123
|
+
function fallbackTwinRenderer(props: Record<string, unknown>): string[] {
|
|
124
|
+
const lines: string[] = [];
|
|
125
|
+
const heading = str(props.heading);
|
|
126
|
+
if (heading) lines.push(`## ${heading}`);
|
|
127
|
+
const lead = str(props.lead) ?? str(props.description);
|
|
128
|
+
if (lead) lines.push("", lead);
|
|
129
|
+
return lines;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Render a baked page into a Markdown twin. Each block type has a registered twin renderer in
|
|
134
|
+
* {@link blockTwinRegistry}; unknown block types fall back to a generic visible-text extractor so
|
|
135
|
+
* they are never silently dropped. New block types register a renderer instead of patching this
|
|
136
|
+
* function.
|
|
137
|
+
*/
|
|
138
|
+
export function renderTwin(page: PageEntry, pathname: string): string {
|
|
139
|
+
const lines: string[] = [];
|
|
140
|
+
lines.push(`# ${page.title}`);
|
|
141
|
+
lines.push("");
|
|
142
|
+
if (page.description) {
|
|
143
|
+
lines.push(page.description);
|
|
144
|
+
lines.push("");
|
|
145
|
+
}
|
|
146
|
+
lines.push(`Source: ${pathname}`);
|
|
147
|
+
lines.push("");
|
|
148
|
+
for (const block of page.blocks) {
|
|
149
|
+
const props = (block.props ?? {}) as Record<string, unknown>;
|
|
150
|
+
const renderer = blockTwinRegistry[block.type ?? ""] ?? fallbackTwinRenderer;
|
|
151
|
+
const blockLines = renderer(props);
|
|
152
|
+
if (blockLines.length > 0) {
|
|
153
|
+
lines.push(...blockLines);
|
|
154
|
+
lines.push("");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return lines.join("\n");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** A live, non-suppressed entry whose GEO depth is full or twin-only gets a Markdown twin. */
|
|
161
|
+
export function includeInTwins(entry: VirtualRouteEntry): boolean {
|
|
162
|
+
if (!entry.indexable || entry.noindex || !entry.page) return false;
|
|
163
|
+
return entry.geo !== "off";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** A live, non-suppressed entry whose GEO depth is full contributes to llms.txt. */
|
|
167
|
+
export function includeInLlms(entry: VirtualRouteEntry): boolean {
|
|
168
|
+
if (!entry.indexable || entry.noindex) return false;
|
|
169
|
+
return entry.geo === "full";
|
|
170
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0278/RFC-0279/RFC-0285 shared governance contracts for PSEO autonomy,
|
|
5
|
+
auditable AI review, and human escalation budgets.
|
|
6
|
+
</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>Do not run reviewers, mutate logs, or decide promotions.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-0278/RFC-0279/RFC-0285: governance contract types.</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
|
|
18
|
+
export const approverSchema = z.discriminatedUnion("kind", [
|
|
19
|
+
z.object({ kind: z.literal("human"), handle: z.string().min(1) }).strict(),
|
|
20
|
+
z
|
|
21
|
+
.object({
|
|
22
|
+
kind: z.literal("agent"),
|
|
23
|
+
modelId: z.string().min(1),
|
|
24
|
+
promptId: z.string().min(1),
|
|
25
|
+
version: z.string().min(1),
|
|
26
|
+
})
|
|
27
|
+
.strict(),
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const fieldClassSchema = z.enum(["structural", "narrative", "claims", "product"]);
|
|
31
|
+
export const autonomyLevelSchema = z.enum(["L0", "L1", "L2", "L3", "L4"]);
|
|
32
|
+
|
|
33
|
+
export const autonomyScopeSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
module: z.string().min(1),
|
|
36
|
+
fieldClass: fieldClassSchema,
|
|
37
|
+
locale: z.string().min(1),
|
|
38
|
+
})
|
|
39
|
+
.strict();
|
|
40
|
+
|
|
41
|
+
export const autonomyStateSchema = z
|
|
42
|
+
.object({
|
|
43
|
+
scope: autonomyScopeSchema,
|
|
44
|
+
level: autonomyLevelSchema,
|
|
45
|
+
ceiling: autonomyLevelSchema,
|
|
46
|
+
sinceAt: z.string().datetime({ offset: true }),
|
|
47
|
+
evidenceRef: z.string().min(1),
|
|
48
|
+
lastReviewedBy: approverSchema.optional(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
|
|
52
|
+
export const approvalRecordSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
approver: approverSchema,
|
|
55
|
+
atLevel: autonomyLevelSchema,
|
|
56
|
+
approvedAt: z.string().datetime({ offset: true }),
|
|
57
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
58
|
+
})
|
|
59
|
+
.strict();
|
|
60
|
+
|
|
61
|
+
export const reviewInputSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
artifactRef: z.string().min(1),
|
|
64
|
+
fieldClass: fieldClassSchema,
|
|
65
|
+
grounding: z
|
|
66
|
+
.object({
|
|
67
|
+
record: z.unknown().optional(),
|
|
68
|
+
approvedClaims: z.array(z.unknown()).optional(),
|
|
69
|
+
moduleContext: z.unknown(),
|
|
70
|
+
glossaryId: z.string().min(1).optional(),
|
|
71
|
+
sourceArtifactRef: z.string().min(1).optional(),
|
|
72
|
+
translatorNoteId: z.string().min(1).optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict(),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
|
|
78
|
+
export const reviewVerdictSchema = z
|
|
79
|
+
.object({
|
|
80
|
+
artifactRef: z.string().min(1),
|
|
81
|
+
reviewer: z.object({ modelId: z.string(), promptId: z.string(), version: z.string() }).strict(),
|
|
82
|
+
decision: z.enum(["approve", "reject", "escalate"]),
|
|
83
|
+
confidence: z.number().min(0).max(1),
|
|
84
|
+
checks: z.array(
|
|
85
|
+
z.object({ id: z.string().min(1), pass: z.boolean(), note: z.string().optional() }).strict(),
|
|
86
|
+
),
|
|
87
|
+
groundingViolations: z.array(z.string()),
|
|
88
|
+
samples: z.number().int().min(1),
|
|
89
|
+
reviewedAt: z.string().datetime({ offset: true }),
|
|
90
|
+
})
|
|
91
|
+
.strict();
|
|
92
|
+
|
|
93
|
+
export const escalationReasonSchema = z.enum([
|
|
94
|
+
"low-reviewer-confidence",
|
|
95
|
+
"novel-template",
|
|
96
|
+
"claims-class",
|
|
97
|
+
"anomaly",
|
|
98
|
+
"demotion-review",
|
|
99
|
+
"product-language",
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
export const escalationSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
id: z.string().min(1),
|
|
105
|
+
scope: z.string().min(1),
|
|
106
|
+
reason: escalationReasonSchema,
|
|
107
|
+
artifactRef: z.string().min(1).optional(),
|
|
108
|
+
openedAt: z.string().datetime({ offset: true }),
|
|
109
|
+
resolvedAt: z.string().datetime({ offset: true }).optional(),
|
|
110
|
+
resolvedBy: z
|
|
111
|
+
.object({ kind: z.literal("human"), handle: z.string().min(1) })
|
|
112
|
+
.strict()
|
|
113
|
+
.optional(),
|
|
114
|
+
verdict: z.enum(["approve", "reject", "fix-record"]).optional(),
|
|
115
|
+
minutesSpent: z.number().min(0).optional(),
|
|
116
|
+
feedback: z
|
|
117
|
+
.object({
|
|
118
|
+
toGolden: z.boolean().optional(),
|
|
119
|
+
toCalibration: z.boolean().optional(),
|
|
120
|
+
toRecord: z.string().min(1).optional(),
|
|
121
|
+
})
|
|
122
|
+
.strict(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
|
|
126
|
+
export const escalationBudgetSchema = z
|
|
127
|
+
.object({
|
|
128
|
+
scope: z.string().min(1),
|
|
129
|
+
windowDays: z.number().int().min(1),
|
|
130
|
+
humanMinutesAvailable: z.number().min(0),
|
|
131
|
+
humanMinutesUsed: z.number().min(0),
|
|
132
|
+
minutesPer1000Pages: z.number().min(0),
|
|
133
|
+
})
|
|
134
|
+
.strict();
|
|
135
|
+
|
|
136
|
+
export type Approver = z.infer<typeof approverSchema>;
|
|
137
|
+
export type FieldClass = z.infer<typeof fieldClassSchema>;
|
|
138
|
+
export type AutonomyLevel = z.infer<typeof autonomyLevelSchema>;
|
|
139
|
+
export type AutonomyScope = z.infer<typeof autonomyScopeSchema>;
|
|
140
|
+
export type AutonomyState = z.infer<typeof autonomyStateSchema>;
|
|
141
|
+
export type ApprovalRecord = z.infer<typeof approvalRecordSchema>;
|
|
142
|
+
export type ReviewInput = z.infer<typeof reviewInputSchema>;
|
|
143
|
+
export type ReviewVerdict = z.infer<typeof reviewVerdictSchema>;
|
|
144
|
+
export type EscalationReason = z.infer<typeof escalationReasonSchema>;
|
|
145
|
+
export type Escalation = z.infer<typeof escalationSchema>;
|
|
146
|
+
export type EscalationBudget = z.infer<typeof escalationBudgetSchema>;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>[RFC-0192] Public entrypoint for @warpgogol/werkstatt-shared/surface — the Programmatic Surface port.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Do not perform I/O — consumers (kernel command) supply loaded data.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-0192: initial barrel.</item>
|
|
10
|
+
<item>RFC-0271: export SurfaceModuleContext schema, type, and ownership helpers.</item>
|
|
11
|
+
<item>RFC-0276: export Bordbuch event/status schemas and types.</item>
|
|
12
|
+
<item>RFC-0280/RFC-0281: export DemandSignal and WerkRecord schemas.</item>
|
|
13
|
+
<item>RFC-0278/RFC-0279/RFC-0285: export governance schemas and types.</item>
|
|
14
|
+
<item>RFC-0282/RFC-0283: export visibility and breaker schemas.</item>
|
|
15
|
+
<item>RFC-0284: export fleet Leitstand schemas and types.</item>
|
|
16
|
+
<item>RFC-0264 cleanup: root barrel delegates governance exports to the governance subpath.</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type {
|
|
21
|
+
AxisTuple,
|
|
22
|
+
EligibilityPolicy,
|
|
23
|
+
IndexDecision,
|
|
24
|
+
IndexReason,
|
|
25
|
+
IndustryDossierFields,
|
|
26
|
+
LocalizedSlug,
|
|
27
|
+
LocalizedUniverse,
|
|
28
|
+
PageEntry,
|
|
29
|
+
PageSurfaceProvider,
|
|
30
|
+
RedirectPolicy,
|
|
31
|
+
SurfaceArtifact,
|
|
32
|
+
SurfaceAxis,
|
|
33
|
+
SurfaceBlock,
|
|
34
|
+
SurfaceCounts,
|
|
35
|
+
SurfaceManifest,
|
|
36
|
+
SurfaceNarrative,
|
|
37
|
+
SurfaceRecord,
|
|
38
|
+
SurfaceRecordImage,
|
|
39
|
+
VirtualRouteEntry,
|
|
40
|
+
} from "./types.ts";
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
buildEligibilityMatrix,
|
|
44
|
+
countMatching,
|
|
45
|
+
enumerateCandidateTuples,
|
|
46
|
+
liveChildrenOf,
|
|
47
|
+
liveSiblingsOf,
|
|
48
|
+
matchesRecord,
|
|
49
|
+
nearestLiveAncestor,
|
|
50
|
+
normalizeSegment,
|
|
51
|
+
pathKey,
|
|
52
|
+
type AxisFieldMap,
|
|
53
|
+
type EligibilityMatrix,
|
|
54
|
+
type MatrixEntry,
|
|
55
|
+
} from "./eligibility.ts";
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
assembleEntries,
|
|
59
|
+
buildAxes,
|
|
60
|
+
buildAxisFieldMap,
|
|
61
|
+
generateEntries,
|
|
62
|
+
pageIdFor,
|
|
63
|
+
resolvePolicy,
|
|
64
|
+
resolveSlug,
|
|
65
|
+
type Blueprint,
|
|
66
|
+
type BlueprintAxis,
|
|
67
|
+
type BlueprintDemandDepthPolicy,
|
|
68
|
+
type BlueprintDossier,
|
|
69
|
+
type BlueprintDuplicatePolicy,
|
|
70
|
+
type BlueprintEvidenceDepthPolicy,
|
|
71
|
+
type BlueprintIntersectionConfig,
|
|
72
|
+
type BlueprintLevel,
|
|
73
|
+
type BlueprintLinking,
|
|
74
|
+
type BlueprintPillar,
|
|
75
|
+
type BlueprintPillarAdaptation,
|
|
76
|
+
type BlueprintPillarAdaptationDimension,
|
|
77
|
+
type BlueprintPillarFinalCta,
|
|
78
|
+
type BlueprintPillarHero,
|
|
79
|
+
type BlueprintPillarProductPrice,
|
|
80
|
+
type BlueprintPolicy,
|
|
81
|
+
type BlueprintProjection,
|
|
82
|
+
type EnrichedFieldSpec,
|
|
83
|
+
type GeoDepth,
|
|
84
|
+
type IndustryPublicationGate,
|
|
85
|
+
type IntersectionGate,
|
|
86
|
+
type IntersectionSimilarity,
|
|
87
|
+
type LocalizedString,
|
|
88
|
+
} from "./blueprint.ts";
|
|
89
|
+
|
|
90
|
+
export { blueprintSchema, parseBlueprint, type ParseBlueprintResult } from "./blueprint-schema.ts";
|
|
91
|
+
|
|
92
|
+
// Governance and operational schema bags (RFC-0271..0285) — explicit re-exports.
|
|
93
|
+
export type {
|
|
94
|
+
BlueprintModuleClaim,
|
|
95
|
+
PseoStage,
|
|
96
|
+
SurfaceModuleContext,
|
|
97
|
+
SurfaceModules,
|
|
98
|
+
UrlPolicy,
|
|
99
|
+
} from "./module-context.ts";
|
|
100
|
+
export {
|
|
101
|
+
findDuplicateBlueprintClaims,
|
|
102
|
+
findModuleForBlueprint,
|
|
103
|
+
moduleReviewPolicySchema,
|
|
104
|
+
moduleSiteModeSchema,
|
|
105
|
+
normalizeSurfaceModules,
|
|
106
|
+
pseoStageSchema,
|
|
107
|
+
surfaceModuleContextSchema,
|
|
108
|
+
surfaceModulesSchema,
|
|
109
|
+
urlPolicySchema,
|
|
110
|
+
} from "./module-context.ts";
|
|
111
|
+
|
|
112
|
+
export type {
|
|
113
|
+
DemandAxes,
|
|
114
|
+
DemandIntent,
|
|
115
|
+
DemandSignal,
|
|
116
|
+
DemandSignalSource,
|
|
117
|
+
WerkRecord,
|
|
118
|
+
} from "./evidence-records.ts";
|
|
119
|
+
export {
|
|
120
|
+
demandAxesSchema,
|
|
121
|
+
demandIntentSchema,
|
|
122
|
+
demandSignalSchema,
|
|
123
|
+
demandSignalSourceSchema,
|
|
124
|
+
werkRecordSchema,
|
|
125
|
+
} from "./evidence-records.ts";
|
|
126
|
+
|
|
127
|
+
export type {
|
|
128
|
+
ApprovalRecord,
|
|
129
|
+
Approver,
|
|
130
|
+
AutonomyLevel,
|
|
131
|
+
AutonomyScope,
|
|
132
|
+
AutonomyState,
|
|
133
|
+
Escalation,
|
|
134
|
+
EscalationBudget,
|
|
135
|
+
EscalationReason,
|
|
136
|
+
FieldClass,
|
|
137
|
+
ReviewInput,
|
|
138
|
+
ReviewVerdict,
|
|
139
|
+
} from "./governance.ts";
|
|
140
|
+
export {
|
|
141
|
+
approvalRecordSchema,
|
|
142
|
+
approverSchema,
|
|
143
|
+
autonomyLevelSchema,
|
|
144
|
+
autonomyScopeSchema,
|
|
145
|
+
autonomyStateSchema,
|
|
146
|
+
escalationBudgetSchema,
|
|
147
|
+
escalationReasonSchema,
|
|
148
|
+
escalationSchema,
|
|
149
|
+
fieldClassSchema,
|
|
150
|
+
reviewInputSchema,
|
|
151
|
+
reviewVerdictSchema,
|
|
152
|
+
} from "./governance.ts";
|
|
153
|
+
|
|
154
|
+
export type {
|
|
155
|
+
ClusterAction,
|
|
156
|
+
ClusterOutcome,
|
|
157
|
+
VisibilitySnapshot,
|
|
158
|
+
VisibilitySource,
|
|
159
|
+
} from "./visibility.ts";
|
|
160
|
+
export {
|
|
161
|
+
clusterActionSchema,
|
|
162
|
+
clusterOutcomeSchema,
|
|
163
|
+
visibilitySnapshotSchema,
|
|
164
|
+
visibilitySourceSchema,
|
|
165
|
+
} from "./visibility.ts";
|
|
166
|
+
|
|
167
|
+
export type {
|
|
168
|
+
BreakerVerdict,
|
|
169
|
+
SurfaceState,
|
|
170
|
+
SurfaceStateStatus,
|
|
171
|
+
Tripwire,
|
|
172
|
+
TripwireAction,
|
|
173
|
+
} from "./breaker.ts";
|
|
174
|
+
export {
|
|
175
|
+
breakerVerdictSchema,
|
|
176
|
+
surfaceStateSchema,
|
|
177
|
+
surfaceStateStatusSchema,
|
|
178
|
+
tripwireActionSchema,
|
|
179
|
+
tripwireSchema,
|
|
180
|
+
} from "./breaker.ts";
|
|
181
|
+
|
|
182
|
+
export type {
|
|
183
|
+
FleetBreakerState,
|
|
184
|
+
FleetJob,
|
|
185
|
+
FleetJobKind,
|
|
186
|
+
FleetPlan,
|
|
187
|
+
FleetSiteStatus,
|
|
188
|
+
} from "./fleet.ts";
|
|
189
|
+
export {
|
|
190
|
+
fleetBreakerStateSchema,
|
|
191
|
+
fleetJobKindSchema,
|
|
192
|
+
fleetJobSchema,
|
|
193
|
+
fleetPlanSchema,
|
|
194
|
+
fleetSiteStatusSchema,
|
|
195
|
+
} from "./fleet.ts";
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
buildTokenDocFreq,
|
|
199
|
+
pageText,
|
|
200
|
+
scoreSubstance,
|
|
201
|
+
tokenize,
|
|
202
|
+
type SubstanceComponents,
|
|
203
|
+
type SubstanceScore,
|
|
204
|
+
} from "./substance.ts";
|
|
205
|
+
|
|
206
|
+
export { includeInLlms, includeInTwins, renderTwin, type BlockTwinRenderer } from "./geo.ts";
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
composeIndexDecision,
|
|
210
|
+
evaluateBudgetGate,
|
|
211
|
+
evaluateDemandGate,
|
|
212
|
+
evaluateEvidenceGate,
|
|
213
|
+
evaluateFreshnessGate,
|
|
214
|
+
evaluateSubstanceGate,
|
|
215
|
+
type GateResult,
|
|
216
|
+
} from "./decision-composer.ts";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-0473: Barrel for @warpgogol/werkstatt-shared/surface/io — I/O helpers extracted from site-kernel-checks.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Does not contain pure domain logic — that lives in the root @warpgogol/werkstatt-shared/surface entry points.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-0473: initial io barrel for cross-package I/O helpers.</item>
|
|
10
|
+
</CHANGE_SUMMARY>
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
loadSurfaceModuleContexts,
|
|
15
|
+
type LoadedModuleContexts,
|
|
16
|
+
} from "./surface-module-context-io.ts";
|
|
17
|
+
|
|
18
|
+
export { readVisibilityOutcomes, type OutcomesPayload } from "./visibility-outcomes-io.ts";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0473: I/O helper for loading Programmatic Surface module contexts from a Sternsystem's
|
|
5
|
+
system.md. Extracted from site-kernel-checks so bordbuch.generate in site-kernel-handoff
|
|
6
|
+
can read PSEO module context without depending on site-kernel-checks.
|
|
7
|
+
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Do not mutate system.md.</item>
|
|
10
|
+
<item>Do not make LLM calls or interpret Blueprint axis policy.</item>
|
|
11
|
+
<item>Do not define validation diagnostics — that lives in site-kernel-checks.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-0473: extract loadSurfaceModuleContexts from site-kernel-checks for cross-package reuse.</item>
|
|
16
|
+
<item>RFC-0868: inline loadSystemManifest to break dependency on werkstatt-site/content.</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { readFile, access } from "node:fs/promises";
|
|
22
|
+
import { parse as parseYaml } from "yaml";
|
|
23
|
+
import { normalizeSurfaceModules, type SurfaceModules } from "../index.ts";
|
|
24
|
+
|
|
25
|
+
async function loadSystemManifestRaw(contentDirectory: string): Promise<Record<string, unknown>> {
|
|
26
|
+
const systemMdPath = join(contentDirectory, "system.md");
|
|
27
|
+
await access(systemMdPath);
|
|
28
|
+
const content = await readFile(systemMdPath, "utf8");
|
|
29
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
30
|
+
if (!match) return {};
|
|
31
|
+
return parseYaml(match[1]) as Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LoadedModuleContexts {
|
|
35
|
+
modules: SurfaceModules;
|
|
36
|
+
declaredBlueprints: string[];
|
|
37
|
+
supportedLocales: string[];
|
|
38
|
+
defaultLocale?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function asStringArray(value: unknown): string[] {
|
|
42
|
+
return Array.isArray(value) ? value.map(String).filter(Boolean) : [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function loadSurfaceModuleContexts(appDir: string): Promise<LoadedModuleContexts> {
|
|
46
|
+
const record = await loadSystemManifestRaw(join(appDir, "src", "content"));
|
|
47
|
+
const i18n = record.i18n as { default?: string; supported?: Record<string, unknown> } | undefined;
|
|
48
|
+
const surface = record.surface as { blueprints?: unknown; modules?: unknown } | undefined;
|
|
49
|
+
const supportedLocales = i18n?.supported
|
|
50
|
+
? Object.keys(i18n.supported)
|
|
51
|
+
: i18n?.default
|
|
52
|
+
? [i18n.default]
|
|
53
|
+
: [];
|
|
54
|
+
return {
|
|
55
|
+
modules: normalizeSurfaceModules(surface?.modules ?? {}),
|
|
56
|
+
declaredBlueprints: asStringArray(surface?.blueprints),
|
|
57
|
+
supportedLocales,
|
|
58
|
+
defaultLocale: i18n?.default,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0473: I/O helper for reading PSEO visibility outcomes from a Sternsystem's
|
|
5
|
+
generated outcomes file. Extracted from site-kernel-checks so bordbuch.generate
|
|
6
|
+
in site-kernel-handoff can read visibility outcomes without depending on site-kernel-checks.
|
|
7
|
+
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Do not write outcomes — that lives in site-kernel-checks visibility commands.</item>
|
|
10
|
+
<item>Do not interpret outcomes or propose cluster actions.</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-0473: extract readVisibilityOutcomes from site-kernel-checks for cross-package reuse.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { parse as yamlParse } from "yaml";
|
|
22
|
+
import type { ClusterOutcome } from "../visibility.ts";
|
|
23
|
+
|
|
24
|
+
export interface OutcomesPayload {
|
|
25
|
+
generatedAt: string | null;
|
|
26
|
+
policy: {
|
|
27
|
+
observationWindowDays: number;
|
|
28
|
+
expand: { indexationRateMin: number; medianImpressionsMin: number };
|
|
29
|
+
prune: { afterWindows: number; impressionsMax: number };
|
|
30
|
+
enrich: { requirePositiveDemand: boolean };
|
|
31
|
+
};
|
|
32
|
+
outcomes: ClusterOutcome[];
|
|
33
|
+
demandCorrections: Array<{
|
|
34
|
+
clusterId: string;
|
|
35
|
+
realizedImpressions: number;
|
|
36
|
+
demandVolume: number;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const OUTCOMES_FILE = "src/surface/visibility/outcomes.generated.yaml";
|
|
41
|
+
|
|
42
|
+
export async function readVisibilityOutcomes(appDir: string): Promise<OutcomesPayload | null> {
|
|
43
|
+
const path = join(appDir, OUTCOMES_FILE);
|
|
44
|
+
if (!existsSync(path)) return null;
|
|
45
|
+
return yamlParse(await readFile(path, "utf8")) as OutcomesPayload;
|
|
46
|
+
}
|