@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,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0287: the static Agent Surface knowledge tier. Defines the closed domain
|
|
5
|
+
list, the per-domain envelope shape, and the pure envelope formatter. Callers
|
|
6
|
+
(kernel commands) load and project business content through the existing
|
|
7
|
+
RFC-0148 projectors and pass the already-resolved per-language payload here —
|
|
8
|
+
this module never reads files or invents fact shapes.
|
|
9
|
+
</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>Do not read content or call projectors — the kernel command does that.</item>
|
|
12
|
+
<item>Do not define new fact shapes — extend business-projection.ts/models.ts first.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-0287: initial knowledge tier — domain list, envelope, formatter.</item>
|
|
17
|
+
<item>RFC-0602: allow null lastVerified in AgentKnowledgeFreshness for derived-source fallback.</item>
|
|
18
|
+
</CHANGE_SUMMARY>
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { computeAgentManifestContentHash } from "./manifest.ts";
|
|
22
|
+
import type { AgentSurfaceProof } from "./proof.ts";
|
|
23
|
+
|
|
24
|
+
/** Exactly the `public`-visibility keys of BUSINESS_DOMAIN_VISIBILITY (RFC-0148). */
|
|
25
|
+
export const AGENT_KNOWLEDGE_DOMAINS = [
|
|
26
|
+
"company",
|
|
27
|
+
"legal",
|
|
28
|
+
"contact",
|
|
29
|
+
"offer",
|
|
30
|
+
"service",
|
|
31
|
+
"location",
|
|
32
|
+
"web",
|
|
33
|
+
"people",
|
|
34
|
+
"trust",
|
|
35
|
+
"faq",
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
export type AgentKnowledgeDomain = (typeof AGENT_KNOWLEDGE_DOMAINS)[number];
|
|
39
|
+
|
|
40
|
+
export function isAgentKnowledgeDomain(value: string): value is AgentKnowledgeDomain {
|
|
41
|
+
return (AGENT_KNOWLEDGE_DOMAINS as readonly string[]).includes(value);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface AgentKnowledgeFreshness {
|
|
45
|
+
lastVerified: string | null;
|
|
46
|
+
source: "ckl-claim-ledger" | "authored-verification" | "derived-source";
|
|
47
|
+
coverage: "domain";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AgentKnowledgeEnvelope<TData = unknown> {
|
|
51
|
+
/** e.g. "gogol.agent.knowledge/offer@1" or @2 for RFC-0319 shape changes. */
|
|
52
|
+
schema: string;
|
|
53
|
+
site: string;
|
|
54
|
+
baseUrl: string;
|
|
55
|
+
languages: { default: string; supported: string[] };
|
|
56
|
+
/** sha256 hex over sorted-key JSON of this document minus contentHash. */
|
|
57
|
+
contentHash: string;
|
|
58
|
+
/** RFC-0319: required freshness for every emitted envelope. */
|
|
59
|
+
freshness?: AgentKnowledgeFreshness;
|
|
60
|
+
/** Per-language payload; non-default languages carry only overlay fields (RFC-0008). */
|
|
61
|
+
data: Record<string, TData>;
|
|
62
|
+
/** RFC-0308: detached Ed25519 proof, null/absent when unsigned. */
|
|
63
|
+
proof?: AgentSurfaceProof | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface AgentKnowledgeBuildInput<TData = unknown> {
|
|
67
|
+
domain: AgentKnowledgeDomain;
|
|
68
|
+
site: string;
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
languages: { default: string; supported: string[] };
|
|
71
|
+
/** Already-projected per-language payload — never raw content. */
|
|
72
|
+
data: Record<string, TData>;
|
|
73
|
+
freshness?: AgentKnowledgeFreshness;
|
|
74
|
+
/** RFC-0319: schema version. Defaults to 1. Bump to 2 for breaking shape changes. */
|
|
75
|
+
schemaVersion?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Pure: assemble + hash one domain's knowledge envelope. Deterministic. */
|
|
79
|
+
export function formatAgentKnowledge<TData = unknown>(
|
|
80
|
+
input: AgentKnowledgeBuildInput<TData>,
|
|
81
|
+
): AgentKnowledgeEnvelope<TData> {
|
|
82
|
+
const version = input.schemaVersion ?? 1;
|
|
83
|
+
const base: Omit<AgentKnowledgeEnvelope<TData>, "contentHash"> = {
|
|
84
|
+
schema: `gogol.agent.knowledge/${input.domain}@${version}`,
|
|
85
|
+
site: input.site,
|
|
86
|
+
baseUrl: input.baseUrl.replace(/\/+$/, ""),
|
|
87
|
+
languages: {
|
|
88
|
+
default: input.languages.default,
|
|
89
|
+
supported: [...input.languages.supported].sort(),
|
|
90
|
+
},
|
|
91
|
+
...(input.freshness ? { freshness: input.freshness } : {}),
|
|
92
|
+
data: input.data,
|
|
93
|
+
};
|
|
94
|
+
const contentHash = computeAgentManifestContentHash(base as unknown as Record<string, unknown>);
|
|
95
|
+
return { ...base, contentHash };
|
|
96
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0286: the Agent Surface Manifest — the single generated artifact every
|
|
5
|
+
protocol projection (knowledge files, OpenAPI, MCP) derives from (AS-1). Pure,
|
|
6
|
+
deterministic assembly: no I/O, no timestamps, sorted-key canonical hashing so
|
|
7
|
+
two runs on unchanged input are byte-identical (AS-7).
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not read files or content — callers (kernel commands) load and pass data.</item>
|
|
11
|
+
<item>Do not sign — proof is always null here; RFC-0308 adds signing over the
|
|
12
|
+
domain-separated content hash payload via agent.surface.sign.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-0286: initial manifest contract and pure builder.</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
import type { AgentSurfaceProof } from "./proof.ts";
|
|
22
|
+
|
|
23
|
+
/** Semver of THIS manifest schema. Bump only via an RFC amending RFC-0286 (AS-7). */
|
|
24
|
+
export const AGENT_SURFACE_VERSION = "1.0.0";
|
|
25
|
+
|
|
26
|
+
export interface AgentKnowledgeRef {
|
|
27
|
+
/** A BusinessDomain with visibility "public" (RFC-0287). */
|
|
28
|
+
domain: string;
|
|
29
|
+
url: string;
|
|
30
|
+
/** e.g. "gogol.agent.knowledge/offer@1". */
|
|
31
|
+
schema: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AgentActionRef {
|
|
35
|
+
/** Capability catalog id, e.g. "lead.submit" (RFC-0288). */
|
|
36
|
+
id: string;
|
|
37
|
+
url: string;
|
|
38
|
+
title: Record<string, string>;
|
|
39
|
+
inputSchemaRef: string;
|
|
40
|
+
entitlement: "agent.actions";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AgentSurfaceManifest {
|
|
44
|
+
surfaceVersion: string;
|
|
45
|
+
site: string;
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
languages: { default: string; supported: string[] };
|
|
48
|
+
/** sha256 hex over sorted-key JSON of this document minus contentHash + proof. */
|
|
49
|
+
contentHash: string;
|
|
50
|
+
knowledge: AgentKnowledgeRef[];
|
|
51
|
+
actions: AgentActionRef[];
|
|
52
|
+
interfaces: {
|
|
53
|
+
llms: string;
|
|
54
|
+
twins: { pattern: string } | null;
|
|
55
|
+
openapi: string | null;
|
|
56
|
+
mcp: { url: string; protocolVersion: string } | null;
|
|
57
|
+
};
|
|
58
|
+
/** Null until agent.surface.sign signs it (RFC-0308) or when no key material exists. */
|
|
59
|
+
proof: AgentSurfaceProof | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface AgentSurfaceManifestInput {
|
|
63
|
+
site: string;
|
|
64
|
+
baseUrl: string;
|
|
65
|
+
languages: { default: string; supported: string[] };
|
|
66
|
+
knowledge?: AgentKnowledgeRef[];
|
|
67
|
+
actions?: AgentActionRef[];
|
|
68
|
+
hasTwins?: boolean;
|
|
69
|
+
openapiUrl?: string | null;
|
|
70
|
+
mcp?: { url: string; protocolVersion: string } | null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Canonicalization — shared by hashing here and by signing in RFC-0308
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
function sortKeysDeep(value: unknown): unknown {
|
|
78
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep);
|
|
79
|
+
if (value !== null && typeof value === "object") {
|
|
80
|
+
const out: Record<string, unknown> = {};
|
|
81
|
+
for (const key of Object.keys(value as Record<string, unknown>).sort()) {
|
|
82
|
+
out[key] = sortKeysDeep((value as Record<string, unknown>)[key]);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Deterministic sorted-key JSON serialization — no whitespace, stable key order. */
|
|
90
|
+
export function canonicalJson(value: unknown): string {
|
|
91
|
+
return JSON.stringify(sortKeysDeep(value));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** sha256 hex over the canonical JSON of `doc` with `contentHash` and `proof` removed. */
|
|
95
|
+
export function computeAgentManifestContentHash(doc: Record<string, unknown>): string {
|
|
96
|
+
const { contentHash: _contentHash, proof: _proof, ...rest } = doc;
|
|
97
|
+
return createHash("sha256").update(canonicalJson(rest), "utf8").digest("hex");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Builder
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
/** Pure: assemble + hash the manifest. Deterministic — sorts refs and languages. */
|
|
105
|
+
export function buildAgentSurfaceManifest(input: AgentSurfaceManifestInput): AgentSurfaceManifest {
|
|
106
|
+
const base: Omit<AgentSurfaceManifest, "contentHash"> = {
|
|
107
|
+
surfaceVersion: AGENT_SURFACE_VERSION,
|
|
108
|
+
site: input.site,
|
|
109
|
+
baseUrl: input.baseUrl.replace(/\/+$/, ""),
|
|
110
|
+
languages: {
|
|
111
|
+
default: input.languages.default,
|
|
112
|
+
supported: [...input.languages.supported].sort(),
|
|
113
|
+
},
|
|
114
|
+
knowledge: [...(input.knowledge ?? [])].sort((a, b) => a.domain.localeCompare(b.domain)),
|
|
115
|
+
actions: [...(input.actions ?? [])].sort((a, b) => a.id.localeCompare(b.id)),
|
|
116
|
+
interfaces: {
|
|
117
|
+
llms: "/llms.txt",
|
|
118
|
+
twins: input.hasTwins ? { pattern: "/**.md" } : null,
|
|
119
|
+
openapi: input.openapiUrl ?? null,
|
|
120
|
+
mcp: input.mcp ?? null,
|
|
121
|
+
},
|
|
122
|
+
proof: null,
|
|
123
|
+
};
|
|
124
|
+
const contentHash = computeAgentManifestContentHash(base as unknown as Record<string, unknown>);
|
|
125
|
+
return { ...base, contentHash };
|
|
126
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0783: pure, dependency-free formatter that projects a site's Agent Surface
|
|
5
|
+
Manifest into a SEP-1649 MCP Server Card for /.well-known/mcp/server-card.json.
|
|
6
|
+
No I/O — the kernel command loads the manifest and passes it here.
|
|
7
|
+
</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Do not read files — callers load and pass the manifest.</item>
|
|
10
|
+
<item>Do not sign — signing is a separate concern (agent.surface.sign).</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-0783: initial MCP Server Card projection.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { AgentSurfaceManifest } from "./manifest.ts";
|
|
19
|
+
|
|
20
|
+
/** SEP-1649 MCP Server Card. */
|
|
21
|
+
export interface McpServerCard {
|
|
22
|
+
serverInfo: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
};
|
|
27
|
+
transport: {
|
|
28
|
+
type: "streamable-http";
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
protocolVersion: string;
|
|
32
|
+
capabilities: {
|
|
33
|
+
tools: { listChanged: boolean };
|
|
34
|
+
resources: { listChanged: boolean; subscribe: boolean };
|
|
35
|
+
prompts: { listChanged: boolean };
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Pure: project Agent Surface Manifest into SEP-1649 server card.
|
|
41
|
+
* Deterministic — same manifest input produces byte-identical output (DNA-58).
|
|
42
|
+
* Returns null when manifest.interfaces.mcp is null (no MCP endpoint).
|
|
43
|
+
*/
|
|
44
|
+
export function buildMcpServerCard(manifest: AgentSurfaceManifest): McpServerCard | null {
|
|
45
|
+
if (!manifest.interfaces.mcp) return null;
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
serverInfo: {
|
|
49
|
+
name: `${manifest.site}-agent-gate`,
|
|
50
|
+
version: manifest.surfaceVersion,
|
|
51
|
+
},
|
|
52
|
+
transport: {
|
|
53
|
+
type: "streamable-http",
|
|
54
|
+
url: manifest.interfaces.mcp.url,
|
|
55
|
+
},
|
|
56
|
+
protocolVersion: manifest.interfaces.mcp.protocolVersion,
|
|
57
|
+
capabilities: {
|
|
58
|
+
tools: { listChanged: false },
|
|
59
|
+
resources: { listChanged: false, subscribe: false },
|
|
60
|
+
prompts: { listChanged: false },
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0319: omit-empty serialization for agent knowledge JSON envelopes.
|
|
5
|
+
Prunes empty strings, empty objects, and empty arrays from public knowledge
|
|
6
|
+
payloads before hashing and serialization. Never omits false, 0, or null
|
|
7
|
+
when schema explicitly allows them.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not omit false, 0, or null when schema allows them.</item>
|
|
11
|
+
<item>Do not invent values to fill empty fields.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-0319: initial implementation.</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export interface OmitEmptyOptions {
|
|
20
|
+
/** JSON pointer paths where empty arrays are meaningful and should be preserved. */
|
|
21
|
+
preserveEmptyArraysFor?: readonly string[];
|
|
22
|
+
/** JSON pointer paths where empty objects are meaningful and should be preserved. */
|
|
23
|
+
preserveEmptyObjectsFor?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* RFC-0319: Recursively prune empty strings, empty objects, and empty arrays.
|
|
28
|
+
* Returns `undefined` if the entire value becomes empty after pruning.
|
|
29
|
+
*/
|
|
30
|
+
export function omitEmptyKnowledgeValues<T>(
|
|
31
|
+
value: T,
|
|
32
|
+
opts: OmitEmptyOptions = {},
|
|
33
|
+
path = "",
|
|
34
|
+
): T | undefined {
|
|
35
|
+
if (value === null || value === undefined) return undefined;
|
|
36
|
+
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
const trimmed = value.trim();
|
|
39
|
+
return trimmed === "" ? undefined : (value as T);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
const pruned = value
|
|
48
|
+
.map((item, i) => omitEmptyKnowledgeValues(item, opts, `${path}/${i}`))
|
|
49
|
+
.filter((item) => item !== undefined);
|
|
50
|
+
|
|
51
|
+
if (pruned.length === 0) {
|
|
52
|
+
const preserve = opts.preserveEmptyArraysFor?.includes(path);
|
|
53
|
+
return preserve ? ([] as unknown as T) : undefined;
|
|
54
|
+
}
|
|
55
|
+
return pruned as unknown as T;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof value === "object") {
|
|
59
|
+
const result: Record<string, unknown> = {};
|
|
60
|
+
for (const [key, val] of Object.entries(value as Record<string, unknown>)) {
|
|
61
|
+
const childPath = `${path}/${key}`;
|
|
62
|
+
const pruned = omitEmptyKnowledgeValues(val, opts, childPath);
|
|
63
|
+
if (pruned !== undefined) {
|
|
64
|
+
result[key] = pruned;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const keys = Object.keys(result);
|
|
69
|
+
if (keys.length === 0) {
|
|
70
|
+
const preserve = opts.preserveEmptyObjectsFor?.includes(path);
|
|
71
|
+
return preserve ? ({} as unknown as T) : undefined;
|
|
72
|
+
}
|
|
73
|
+
return result as unknown as T;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0289: pure, dependency-free formatter that projects a site's Agent Surface
|
|
5
|
+
Manifest (+ the capability schemas for its active actions) into a static
|
|
6
|
+
OpenAPI 3.1 document. No transformation of capability schemas — they are
|
|
7
|
+
copied verbatim (AGO-04 enforces this).
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not read files or resolve capabilities — the kernel command does that
|
|
11
|
+
and passes the manifest + capability schemas here.</item>
|
|
12
|
+
<item>Do not adopt an OpenAPI library/types package — this is a small, closed
|
|
13
|
+
structural subset (AS-5: protocols are disposable).</item>
|
|
14
|
+
</non-goals>
|
|
15
|
+
</MODULE_CONTRACT>
|
|
16
|
+
<CHANGE_SUMMARY>
|
|
17
|
+
<item>RFC-0289: initial OpenAPI projection.</item>
|
|
18
|
+
</CHANGE_SUMMARY>
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { AgentSurfaceManifest } from "./manifest.ts";
|
|
22
|
+
import type { CapabilityInputOutputSchema } from "@warpgogol/werkstatt-shared/ontology";
|
|
23
|
+
|
|
24
|
+
export interface OpenApiSchemaObject {
|
|
25
|
+
type: string;
|
|
26
|
+
required?: string[];
|
|
27
|
+
additionalProperties?: boolean;
|
|
28
|
+
properties?: Record<string, unknown>;
|
|
29
|
+
description?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface OpenApiOperation {
|
|
33
|
+
operationId: string;
|
|
34
|
+
summary?: string;
|
|
35
|
+
tags: string[];
|
|
36
|
+
requestBody?: {
|
|
37
|
+
required: true;
|
|
38
|
+
content: { "application/json": { schema: OpenApiSchemaObject } };
|
|
39
|
+
};
|
|
40
|
+
responses: Record<
|
|
41
|
+
string,
|
|
42
|
+
{ description: string; content?: { "application/json": { schema: unknown } } }
|
|
43
|
+
>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface OpenApiDocument {
|
|
47
|
+
openapi: "3.1.0";
|
|
48
|
+
info: { title: string; version: string; "x-gogol-content-hash": string };
|
|
49
|
+
servers: Array<{ url: string }>;
|
|
50
|
+
paths: Record<string, Record<string, OpenApiOperation>>;
|
|
51
|
+
components: { schemas: Record<string, unknown> };
|
|
52
|
+
externalDocs?: { url: string; description: string };
|
|
53
|
+
"x-gogol-mcp"?: { url: string; protocolVersion: string };
|
|
54
|
+
"x-gogol-proof"?: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** One active capability's schemas — the exact shapes referenced by its AgentActionRef. */
|
|
58
|
+
export interface CapabilitySchemaInput {
|
|
59
|
+
id: string;
|
|
60
|
+
input: CapabilityInputOutputSchema;
|
|
61
|
+
output: CapabilityInputOutputSchema;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Generic envelope schema — every knowledge domain shares this wrapper shape (RFC-0287); only `data`'s inner shape varies by domain and is intentionally left untyped here. */
|
|
65
|
+
function knowledgeEnvelopeSchema(): OpenApiSchemaObject {
|
|
66
|
+
return {
|
|
67
|
+
type: "object",
|
|
68
|
+
required: ["schema", "site", "baseUrl", "languages", "contentHash", "data"],
|
|
69
|
+
properties: {
|
|
70
|
+
schema: { type: "string" },
|
|
71
|
+
site: { type: "string" },
|
|
72
|
+
baseUrl: { type: "string" },
|
|
73
|
+
languages: { type: "object" },
|
|
74
|
+
contentHash: { type: "string" },
|
|
75
|
+
freshness: { type: "object" },
|
|
76
|
+
data: { type: "object", description: "Per-language payload; shape varies by domain." },
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Pure: project the manifest (+ active capabilities' schemas) into an OpenAPI
|
|
83
|
+
* 3.1 document. Exhaustive per the RFC-0289 projection table — adds nothing beyond it.
|
|
84
|
+
*/
|
|
85
|
+
export function formatAgentOpenApi(
|
|
86
|
+
manifest: AgentSurfaceManifest,
|
|
87
|
+
capabilitySchemas: CapabilitySchemaInput[],
|
|
88
|
+
): OpenApiDocument {
|
|
89
|
+
const schemasById = new Map(capabilitySchemas.map((c) => [c.id, c]));
|
|
90
|
+
const paths: OpenApiDocument["paths"] = {};
|
|
91
|
+
const componentSchemas: Record<string, unknown> = {};
|
|
92
|
+
|
|
93
|
+
for (const ref of manifest.knowledge) {
|
|
94
|
+
componentSchemas[`knowledge-${ref.domain}`] = knowledgeEnvelopeSchema();
|
|
95
|
+
paths[ref.url] = {
|
|
96
|
+
get: {
|
|
97
|
+
operationId: `knowledge.${ref.domain}.get`,
|
|
98
|
+
tags: ["knowledge"],
|
|
99
|
+
responses: {
|
|
100
|
+
"200": {
|
|
101
|
+
description: `${ref.domain} knowledge envelope`,
|
|
102
|
+
content: {
|
|
103
|
+
"application/json": {
|
|
104
|
+
schema: { $ref: `#/components/schemas/knowledge-${ref.domain}` },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
for (const ref of manifest.actions) {
|
|
114
|
+
const schemas = schemasById.get(ref.id);
|
|
115
|
+
if (!schemas) continue; // defensive — AGO-04-checked at validate time
|
|
116
|
+
componentSchemas[`${ref.id}-input`] = schemas.input;
|
|
117
|
+
componentSchemas[`${ref.id}-output`] = schemas.output;
|
|
118
|
+
paths[ref.url] = {
|
|
119
|
+
post: {
|
|
120
|
+
operationId: `action.${ref.id}`,
|
|
121
|
+
summary: ref.title[manifest.languages.default] ?? ref.id,
|
|
122
|
+
tags: ["actions"],
|
|
123
|
+
requestBody: {
|
|
124
|
+
required: true,
|
|
125
|
+
content: { "application/json": { schema: schemas.input } },
|
|
126
|
+
},
|
|
127
|
+
responses: {
|
|
128
|
+
"200": {
|
|
129
|
+
description: `${ref.id} accepted`,
|
|
130
|
+
content: { "application/json": { schema: schemas.output } },
|
|
131
|
+
},
|
|
132
|
+
"400": { description: "Schema violation" },
|
|
133
|
+
"429": { description: "Rate limit exceeded" },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const doc: OpenApiDocument = {
|
|
140
|
+
openapi: "3.1.0",
|
|
141
|
+
info: {
|
|
142
|
+
title: `${manifest.site} agent surface`,
|
|
143
|
+
version: manifest.surfaceVersion,
|
|
144
|
+
"x-gogol-content-hash": manifest.contentHash,
|
|
145
|
+
},
|
|
146
|
+
servers: [{ url: manifest.baseUrl }],
|
|
147
|
+
paths,
|
|
148
|
+
components: { schemas: componentSchemas },
|
|
149
|
+
externalDocs: {
|
|
150
|
+
url: `${manifest.baseUrl}${manifest.interfaces.llms}`,
|
|
151
|
+
description: "LLM-oriented text surface",
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
if (manifest.interfaces.mcp) doc["x-gogol-mcp"] = manifest.interfaces.mcp;
|
|
155
|
+
if (manifest.proof) doc["x-gogol-proof"] = manifest.proof;
|
|
156
|
+
return doc;
|
|
157
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0308: pure, framework-free Ed25519 proof types and domain-separated
|
|
5
|
+
signing payload builder for Agent Surface artifacts. The signing and
|
|
6
|
+
verification primitives (Ed25519 sign/verify, multibase encoding) live in
|
|
7
|
+
@warpgogol/werkstatt-shared/passport; this module owns only the canonical payload format and
|
|
8
|
+
the proof shape that generators, agent.surface.sign, and agent.surface.verify
|
|
9
|
+
share.
|
|
10
|
+
</purpose>
|
|
11
|
+
<non-goals>
|
|
12
|
+
<item>Do not import or call Ed25519 signing/verification primitives — that
|
|
13
|
+
is @warpgogol/werkstatt-shared/passport's job. This module is pure and dependency-free.</item>
|
|
14
|
+
<item>Do not read files or perform I/O.</item>
|
|
15
|
+
</non-goals>
|
|
16
|
+
</MODULE_CONTRACT>
|
|
17
|
+
<CHANGE_SUMMARY>
|
|
18
|
+
<item>RFC-0308: initial proof module — payload builder + proof type.</item>
|
|
19
|
+
</CHANGE_SUMMARY>
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Artifact kind for domain-separated signing (RFC-0308). */
|
|
23
|
+
export type AgentProofArtifactKind = "manifest" | "knowledge" | "openapi";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* W3C Ed25519Signature2020 proof object embedded in signed agent artifacts.
|
|
27
|
+
*
|
|
28
|
+
* `proofValue` is a multibase base58btc-encoded Ed25519 signature (prefix "z"),
|
|
29
|
+
* consistent with the Cosmic Passport key encoding (RFC-0028).
|
|
30
|
+
*/
|
|
31
|
+
export interface AgentSurfaceProof {
|
|
32
|
+
type: "Ed25519Signature2020";
|
|
33
|
+
created: string;
|
|
34
|
+
verificationMethod: string;
|
|
35
|
+
proofPurpose: "assertionMethod";
|
|
36
|
+
/** Multibase-encoded (base58btc, prefix "z") Ed25519 signature. */
|
|
37
|
+
proofValue: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Domain-separation prefix for agent surface signing payloads (RFC-0308). */
|
|
41
|
+
export const AGENT_PROOF_DOMAIN = "WARPGOGOL_AGENT_SURFACE_V1";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Build the domain-separated canonical signing payload for an agent surface
|
|
45
|
+
* artifact.
|
|
46
|
+
*
|
|
47
|
+
* The signed input is:
|
|
48
|
+
* ```
|
|
49
|
+
* WARPGOGOL_AGENT_SURFACE_V1\n<artifact-kind>\n<absolute-canonical-url>\n<contentHash>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* This prevents signature reuse across artifact kinds or URLs.
|
|
53
|
+
*/
|
|
54
|
+
export function buildAgentSigningPayload(
|
|
55
|
+
kind: AgentProofArtifactKind,
|
|
56
|
+
canonicalUrl: string,
|
|
57
|
+
contentHash: string,
|
|
58
|
+
): Uint8Array {
|
|
59
|
+
const text = `${AGENT_PROOF_DOMAIN}\n${kind}\n${canonicalUrl}\n${contentHash}`;
|
|
60
|
+
return new TextEncoder().encode(text);
|
|
61
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-0231 attribution visibility policy. One vocabulary + one pure resolver that
|
|
5
|
+
decides whether an attribution surface (material credit, prose byline, footer
|
|
6
|
+
copyright) renders its VISIBLE form. Hiding never affects provenance: callers
|
|
7
|
+
must keep emitting JSON-LD and the credits-page listing regardless of the result.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not read content or globs; callers pass the resolved overrides.</item>
|
|
11
|
+
<item>Do not render UI or emit JSON-LD; @warpgogol/werkstatt-site/ui owns presentation.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-0231: initial attribution visibility policy resolver + site schema.</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
|
|
21
|
+
/** RFC-0231: every visibility level speaks the same two-word vocabulary. */
|
|
22
|
+
export type AttributionDisplay = "shown" | "hidden";
|
|
23
|
+
export type AttributionSurface = "material-credit" | "prose-authorship" | "footer-copyright";
|
|
24
|
+
/** Site default may defer to RFC-0228 editorial/decorative intent. */
|
|
25
|
+
export type AttributionSiteDefault = "byIntent" | "shown" | "hidden";
|
|
26
|
+
|
|
27
|
+
export const attributionDisplaySchema = z.enum(["shown", "hidden"]);
|
|
28
|
+
export const attributionSiteDefaultSchema = z.enum(["byIntent", "shown", "hidden"]);
|
|
29
|
+
|
|
30
|
+
/** RFC-0231: the `attribution` block authored in site/{lang}/labels.md. */
|
|
31
|
+
export const attributionPolicySchema = z
|
|
32
|
+
.object({
|
|
33
|
+
/** Material-credit inline disclosures. Defaults to byIntent. */
|
|
34
|
+
credits: attributionSiteDefaultSchema.optional(),
|
|
35
|
+
/** Visible prose byline. Defaults to shown. */
|
|
36
|
+
proseAuthorship: attributionDisplaySchema.optional(),
|
|
37
|
+
/** Footer site-copyright line. Defaults to shown. */
|
|
38
|
+
footerCopyright: attributionDisplaySchema.optional(),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
export type AttributionPolicy = z.infer<typeof attributionPolicySchema>;
|
|
42
|
+
|
|
43
|
+
export interface AttributionDisplayInputs {
|
|
44
|
+
surface: AttributionSurface;
|
|
45
|
+
/** RFC-0228 intent of the target; editorial ⇒ shown, decorative ⇒ hidden under byIntent. */
|
|
46
|
+
intent?: "editorial" | "decorative";
|
|
47
|
+
/** Level 1: per-asset `display` in the sidecar (material credit only). */
|
|
48
|
+
assetOverride?: AttributionDisplay;
|
|
49
|
+
/** Level 2: per-placement `creditDisplay` on the section/block content. */
|
|
50
|
+
placementOverride?: AttributionDisplay;
|
|
51
|
+
/** Level 3: per-page `attribution.*` in page frontmatter. */
|
|
52
|
+
pageOverride?: AttributionDisplay;
|
|
53
|
+
/** Level 4: site default from the `attribution` labels block. */
|
|
54
|
+
siteDefault?: AttributionSiteDefault;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* RFC-0231: resolve one visible-surface decision. Most-specific level wins; the
|
|
59
|
+
* intrinsic default (editorial shown / decorative hidden) applies only when no
|
|
60
|
+
* explicit level set a value and the site default is `byIntent` (or unset).
|
|
61
|
+
*/
|
|
62
|
+
export function resolveAttributionDisplay(inputs: AttributionDisplayInputs): AttributionDisplay {
|
|
63
|
+
const explicit = inputs.assetOverride ?? inputs.placementOverride ?? inputs.pageOverride;
|
|
64
|
+
if (explicit) return explicit;
|
|
65
|
+
|
|
66
|
+
const site = inputs.siteDefault ?? "byIntent";
|
|
67
|
+
if (site === "shown" || site === "hidden") return site;
|
|
68
|
+
|
|
69
|
+
// byIntent: decorative material is quiet by default; everything else shows.
|
|
70
|
+
return inputs.intent === "decorative" ? "hidden" : "shown";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** RFC-0231: parse the optional site `attribution` block; tolerate absence/garbage. */
|
|
74
|
+
export function readAttributionPolicy(
|
|
75
|
+
labels: Record<string, unknown> | undefined,
|
|
76
|
+
): AttributionPolicy {
|
|
77
|
+
const parsed = attributionPolicySchema.safeParse(labels?.attribution);
|
|
78
|
+
return parsed.success ? parsed.data : {};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** RFC-0231: site-level default for material credits, defaulting to byIntent. */
|
|
82
|
+
export function readCreditsSiteDefault(
|
|
83
|
+
labels: Record<string, unknown> | undefined,
|
|
84
|
+
): AttributionSiteDefault {
|
|
85
|
+
return readAttributionPolicy(labels).credits ?? "byIntent";
|
|
86
|
+
}
|