@aglyn/aglyn 1.0.0-beta.220 → 1.0.0-beta.222
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 +15 -11
- package/src/lib/app-utils/agent-openapi.js +1 -1
- package/src/lib/app-utils/agent-openapi.js.map +1 -1
- package/src/lib/app-utils/analytics-events.d.ts +3 -2
- package/src/lib/app-utils/analytics-events.js +3 -2
- package/src/lib/app-utils/analytics-events.js.map +1 -1
- package/src/lib/app-utils/api-plugins.d.ts +30 -0
- package/src/lib/app-utils/api-plugins.js +24 -1
- package/src/lib/app-utils/api-plugins.js.map +1 -1
- package/src/lib/app-utils/author-html.d.ts +1 -1
- package/src/lib/app-utils/author-html.js.map +1 -1
- package/src/lib/app-utils/bandwidth-cap.d.ts +12 -1
- package/src/lib/app-utils/bandwidth-cap.js +17 -1
- package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
- package/src/lib/app-utils/compose-reusable-components.d.ts +19 -0
- package/src/lib/app-utils/compose-reusable-components.js +116 -26
- package/src/lib/app-utils/compose-reusable-components.js.map +1 -1
- package/src/lib/app-utils/console-routes.d.ts +4 -0
- package/src/lib/app-utils/console-routes.js +3 -0
- package/src/lib/app-utils/console-routes.js.map +1 -1
- package/src/lib/app-utils/contacts.d.ts +71 -0
- package/src/lib/app-utils/contacts.js +55 -0
- package/src/lib/app-utils/contacts.js.map +1 -1
- package/src/lib/app-utils/contexts.d.ts +1 -0
- package/src/lib/app-utils/contexts.js +1 -0
- package/src/lib/app-utils/contexts.js.map +1 -1
- package/src/lib/app-utils/crm-email-templates.js +21 -4
- package/src/lib/app-utils/crm-email-templates.js.map +1 -1
- package/src/lib/app-utils/crm-kinds.d.ts +2 -0
- package/src/lib/app-utils/crm-kinds.js +1 -0
- package/src/lib/app-utils/crm-kinds.js.map +1 -1
- package/src/lib/app-utils/crm.d.ts +1199 -67
- package/src/lib/app-utils/crm.js +1951 -310
- package/src/lib/app-utils/crm.js.map +1 -1
- package/src/lib/app-utils/csv-import.d.ts +10 -38
- package/src/lib/app-utils/csv-import.js +17 -42
- package/src/lib/app-utils/csv-import.js.map +1 -1
- package/src/lib/app-utils/csv.d.ts +32 -11
- package/src/lib/app-utils/csv.js +43 -5
- package/src/lib/app-utils/csv.js.map +1 -1
- package/src/lib/app-utils/default-site.d.ts +116 -0
- package/src/lib/app-utils/default-site.js +1024 -0
- package/src/lib/app-utils/default-site.js.map +1 -0
- package/src/lib/app-utils/docs-help.generated.d.ts +23 -23
- package/src/lib/app-utils/docs-help.generated.js +47 -10
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +746 -151
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/draft-placeholders.d.ts +76 -0
- package/src/lib/app-utils/draft-placeholders.js +115 -0
- package/src/lib/app-utils/draft-placeholders.js.map +1 -0
- package/src/lib/app-utils/entity-picker-context.d.ts +19 -15
- package/src/lib/app-utils/entity-picker-context.js +4 -4
- package/src/lib/app-utils/entity-picker-context.js.map +1 -1
- package/src/lib/app-utils/expand-repeatables.d.ts +66 -10
- package/src/lib/app-utils/expand-repeatables.js +88 -14
- package/src/lib/app-utils/expand-repeatables.js.map +1 -1
- package/src/lib/app-utils/forms.d.ts +33 -22
- package/src/lib/app-utils/forms.js +47 -28
- package/src/lib/app-utils/forms.js.map +1 -1
- package/src/lib/app-utils/full-use-cost.d.ts +277 -0
- package/src/lib/app-utils/full-use-cost.js +421 -0
- package/src/lib/app-utils/full-use-cost.js.map +1 -0
- package/src/lib/app-utils/health-report.js +33 -0
- package/src/lib/app-utils/health-report.js.map +1 -1
- package/src/lib/app-utils/leaving-notice.d.ts +96 -0
- package/src/lib/app-utils/leaving-notice.js +157 -0
- package/src/lib/app-utils/leaving-notice.js.map +1 -0
- package/src/lib/app-utils/llms-txt.d.ts +20 -0
- package/src/lib/app-utils/llms-txt.js +7 -1
- package/src/lib/app-utils/llms-txt.js.map +1 -1
- package/src/lib/app-utils/media-asset-facts.d.ts +16 -1
- package/src/lib/app-utils/media-asset-facts.js +40 -13
- package/src/lib/app-utils/media-asset-facts.js.map +1 -1
- package/src/lib/app-utils/media-bandwidth.d.ts +52 -0
- package/src/lib/app-utils/media-bandwidth.js +94 -0
- package/src/lib/app-utils/media-bandwidth.js.map +1 -0
- package/src/lib/app-utils/media-ref.d.ts +241 -33
- package/src/lib/app-utils/media-ref.js +324 -43
- package/src/lib/app-utils/media-ref.js.map +1 -1
- package/src/lib/app-utils/media-src.d.ts +8 -8
- package/src/lib/app-utils/media-src.js +27 -11
- package/src/lib/app-utils/media-src.js.map +1 -1
- package/src/lib/app-utils/media-takedown-reach.d.ts +4 -1
- package/src/lib/app-utils/media-takedown-reach.js +6 -3
- package/src/lib/app-utils/media-takedown-reach.js.map +1 -1
- package/src/lib/app-utils/notifications.d.ts +1 -1
- package/src/lib/app-utils/notifications.js +2 -0
- package/src/lib/app-utils/notifications.js.map +1 -1
- package/src/lib/app-utils/operator-alerts.js +17 -0
- package/src/lib/app-utils/operator-alerts.js.map +1 -1
- package/src/lib/app-utils/organizations.d.ts +51 -2
- package/src/lib/app-utils/organizations.js +56 -3
- package/src/lib/app-utils/organizations.js.map +1 -1
- package/src/lib/app-utils/page-record-sources.d.ts +87 -0
- package/src/lib/app-utils/page-record-sources.js +53 -0
- package/src/lib/app-utils/page-record-sources.js.map +1 -0
- package/src/lib/app-utils/paid-media-source.d.ts +3 -7
- package/src/lib/app-utils/paid-media-source.js +5 -19
- package/src/lib/app-utils/paid-media-source.js.map +1 -1
- package/src/lib/app-utils/person-erasure.d.ts +5 -2
- package/src/lib/app-utils/person-erasure.js.map +1 -1
- package/src/lib/app-utils/picklists.d.ts +187 -0
- package/src/lib/app-utils/picklists.js +320 -0
- package/src/lib/app-utils/picklists.js.map +1 -0
- package/src/lib/app-utils/plan-entitlements.d.ts +220 -50
- package/src/lib/app-utils/plan-entitlements.js +309 -115
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/realm-host-surface.generated.js +2 -0
- package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
- package/src/lib/app-utils/release-flags.d.ts +1 -1
- package/src/lib/app-utils/release-flags.js +11 -0
- package/src/lib/app-utils/release-flags.js.map +1 -1
- package/src/lib/app-utils/rendered-widths.d.ts +121 -0
- package/src/lib/app-utils/rendered-widths.js +211 -0
- package/src/lib/app-utils/rendered-widths.js.map +1 -0
- package/src/lib/app-utils/repeat-sources.d.ts +2 -1
- package/src/lib/app-utils/repeat-sources.js.map +1 -1
- package/src/lib/app-utils/screen-link-context-value.d.ts +7 -0
- package/src/lib/app-utils/screen-link-context-value.js.map +1 -1
- package/src/lib/app-utils/screen-link-context.js +14 -2
- package/src/lib/app-utils/screen-link-context.js.map +1 -1
- package/src/lib/app-utils/screen-route.d.ts +157 -36
- package/src/lib/app-utils/screen-route.js +191 -41
- package/src/lib/app-utils/screen-route.js.map +1 -1
- package/src/lib/app-utils/seo-audit.d.ts +11 -1
- package/src/lib/app-utils/seo-audit.js +33 -13
- package/src/lib/app-utils/seo-audit.js.map +1 -1
- package/src/lib/app-utils/seo-keywords.d.ts +11 -0
- package/src/lib/app-utils/seo-keywords.js +19 -5
- package/src/lib/app-utils/seo-keywords.js.map +1 -1
- package/src/lib/app-utils/seo-page-facts.d.ts +47 -4
- package/src/lib/app-utils/seo-page-facts.js +136 -31
- package/src/lib/app-utils/seo-page-facts.js.map +1 -1
- package/src/lib/app-utils/seo-site-scan.d.ts +42 -4
- package/src/lib/app-utils/seo-site-scan.js +113 -12
- package/src/lib/app-utils/seo-site-scan.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +5 -4
- package/src/lib/app-utils/server.js +14 -5
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/app-utils/site-icon-set.d.ts +195 -0
- package/src/lib/app-utils/site-icon-set.js +351 -0
- package/src/lib/app-utils/site-icon-set.js.map +1 -0
- package/src/lib/app-utils/site-interactions.d.ts +101 -4
- package/src/lib/app-utils/site-interactions.js +120 -4
- package/src/lib/app-utils/site-interactions.js.map +1 -1
- package/src/lib/app-utils/starter-template-nodes.d.ts +7 -0
- package/src/lib/app-utils/starter-template-nodes.js +3 -0
- package/src/lib/app-utils/starter-template-nodes.js.map +1 -1
- package/src/lib/app-utils/starter-templates.d.ts +5 -19
- package/src/lib/app-utils/starter-templates.js +5 -49
- package/src/lib/app-utils/starter-templates.js.map +1 -1
- package/src/lib/app-utils/transfer-launcher-context.d.ts +136 -0
- package/src/lib/app-utils/transfer-launcher-context.js +23 -0
- package/src/lib/app-utils/transfer-launcher-context.js.map +1 -0
- package/src/lib/app-utils/transfer-resume-import.d.ts +39 -0
- package/src/lib/app-utils/transfer-resume-import.js +128 -0
- package/src/lib/app-utils/transfer-resume-import.js.map +1 -0
- package/src/lib/app-utils/upgrade-proposal.d.ts +66 -0
- package/src/lib/app-utils/upgrade-proposal.js +95 -0
- package/src/lib/app-utils/upgrade-proposal.js.map +1 -0
- package/src/lib/app-utils/utc-month.d.ts +33 -0
- package/src/lib/app-utils/utc-month.js +35 -0
- package/src/lib/app-utils/utc-month.js.map +1 -0
- package/src/lib/app-utils/visitor-record-ceiling.d.ts +4 -4
- package/src/lib/app-utils/visitor-record-ceiling.js +4 -4
- package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
- package/src/lib/app-utils/wire-nodes.d.ts +39 -19
- package/src/lib/app-utils/wire-nodes.js +120 -34
- package/src/lib/app-utils/wire-nodes.js.map +1 -1
- package/src/lib/data-transfer/access.d.ts +74 -0
- package/src/lib/data-transfer/access.js +93 -0
- package/src/lib/data-transfer/access.js.map +1 -0
- package/src/lib/data-transfer/derive.d.ts +246 -0
- package/src/lib/data-transfer/derive.js +1007 -0
- package/src/lib/data-transfer/derive.js.map +1 -0
- package/src/lib/data-transfer/export-file.d.ts +46 -0
- package/src/lib/data-transfer/export-file.js +146 -0
- package/src/lib/data-transfer/export-file.js.map +1 -0
- package/src/lib/data-transfer/field-catalog.d.ts +134 -0
- package/src/lib/data-transfer/field-catalog.js +278 -0
- package/src/lib/data-transfer/field-catalog.js.map +1 -0
- package/src/lib/data-transfer/header-match.d.ts +129 -0
- package/src/lib/data-transfer/header-match.js +367 -0
- package/src/lib/data-transfer/header-match.js.map +1 -0
- package/src/lib/data-transfer/index.d.ts +34 -0
- package/src/lib/data-transfer/index.js +40 -0
- package/src/lib/data-transfer/index.js.map +1 -0
- package/src/lib/data-transfer/job.d.ts +190 -0
- package/src/lib/data-transfer/job.js +229 -0
- package/src/lib/data-transfer/job.js.map +1 -0
- package/src/lib/data-transfer/lookup.d.ts +45 -0
- package/src/lib/data-transfer/lookup.js +71 -0
- package/src/lib/data-transfer/lookup.js.map +1 -0
- package/src/lib/data-transfer/match.d.ts +99 -0
- package/src/lib/data-transfer/match.js +244 -0
- package/src/lib/data-transfer/match.js.map +1 -0
- package/src/lib/data-transfer/package-plan.d.ts +205 -0
- package/src/lib/data-transfer/package-plan.js +475 -0
- package/src/lib/data-transfer/package-plan.js.map +1 -0
- package/src/lib/data-transfer/package.d.ts +181 -0
- package/src/lib/data-transfer/package.js +426 -0
- package/src/lib/data-transfer/package.js.map +1 -0
- package/src/lib/data-transfer/picklist-map.d.ts +139 -0
- package/src/lib/data-transfer/picklist-map.js +271 -0
- package/src/lib/data-transfer/picklist-map.js.map +1 -0
- package/src/lib/data-transfer/plan.d.ts +176 -0
- package/src/lib/data-transfer/plan.js +451 -0
- package/src/lib/data-transfer/plan.js.map +1 -0
- package/src/lib/data-transfer/policy.d.ts +170 -0
- package/src/lib/data-transfer/policy.js +378 -0
- package/src/lib/data-transfer/policy.js.map +1 -0
- package/src/lib/data-transfer/resource.d.ts +211 -0
- package/src/lib/data-transfer/resource.js +241 -0
- package/src/lib/data-transfer/resource.js.map +1 -0
- package/src/lib/data-transfer/review.d.ts +70 -0
- package/src/lib/data-transfer/review.js +233 -0
- package/src/lib/data-transfer/review.js.map +1 -0
- package/src/lib/data-transfer/similarity.d.ts +40 -0
- package/src/lib/data-transfer/similarity.js +106 -0
- package/src/lib/data-transfer/similarity.js.map +1 -0
- package/src/lib/data-transfer/site-package.d.ts +365 -0
- package/src/lib/data-transfer/site-package.js +1077 -0
- package/src/lib/data-transfer/site-package.js.map +1 -0
- package/src/lib/data-transfer/source.d.ts +74 -0
- package/src/lib/data-transfer/source.js +293 -0
- package/src/lib/data-transfer/source.js.map +1 -0
- package/src/lib/data-transfer/transfer-api.d.ts +898 -0
- package/src/lib/data-transfer/transfer-api.js +107 -0
- package/src/lib/data-transfer/transfer-api.js.map +1 -0
- package/src/lib/foundation/definitions/org-billing.types.d.ts +31 -0
- package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
- package/src/lib/foundation/definitions/organization.types.d.ts +42 -1
- package/src/lib/foundation/definitions/organization.types.js.map +1 -1
- package/src/lib/foundation/definitions/platform.types.d.ts +6 -4
- package/src/lib/foundation/definitions/platform.types.js.map +1 -1
- package/src/lib/foundation/index.d.ts +1 -1
- package/src/lib/foundation/index.js.map +1 -1
- package/src/lib/plugin-manager/feature-plugins.d.ts +91 -2
- package/src/lib/plugin-manager/feature-plugins.js +48 -3
- package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +56 -0
- package/src/lib/plugin-manager/first-party-plugins.generated.js +1132 -27
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/index.d.ts +0 -1
- package/src/lib/plugin-manager/index.js +0 -1
- package/src/lib/plugin-manager/index.js.map +1 -1
- package/src/lib/plugin-manager/interaction-recipes.d.ts +142 -0
- package/src/lib/plugin-manager/interaction-recipes.js +104 -0
- package/src/lib/plugin-manager/interaction-recipes.js.map +1 -0
- package/src/lib/plugin-manager/interaction-step-checks.d.ts +66 -0
- package/src/lib/plugin-manager/interaction-step-checks.js +86 -0
- package/src/lib/plugin-manager/interaction-step-checks.js.map +1 -0
- package/src/lib/plugin-manager/plugin-artifact-types.d.ts +235 -0
- package/src/lib/plugin-manager/plugin-artifact-types.js +99 -0
- package/src/lib/plugin-manager/plugin-artifact-types.js.map +1 -0
- package/src/lib/plugin-manager/plugin-contact-capture.d.ts +8 -0
- package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
- package/src/lib/plugin-manager/plugin-conversion-credit.d.ts +216 -0
- package/src/lib/plugin-manager/plugin-conversion-credit.js +91 -0
- package/src/lib/plugin-manager/plugin-conversion-credit.js.map +1 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.d.ts +83 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.js +87 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.js.map +1 -0
- package/src/lib/plugin-manager/plugin-host-resources.d.ts +6 -0
- package/src/lib/plugin-manager/plugin-host-resources.js +6 -1
- package/src/lib/plugin-manager/plugin-host-resources.js.map +1 -1
- package/src/lib/plugin-manager/plugin-intake-gates.d.ts +75 -0
- package/src/lib/plugin-manager/plugin-intake-gates.js +49 -0
- package/src/lib/plugin-manager/plugin-intake-gates.js.map +1 -0
- package/src/lib/plugin-manager/plugin-jobs.d.ts +5 -5
- package/src/lib/plugin-manager/plugin-jobs.js +7 -7
- package/src/lib/plugin-manager/plugin-jobs.js.map +1 -1
- package/src/lib/plugin-manager/plugin-live-paths.d.ts +70 -0
- package/src/lib/plugin-manager/plugin-live-paths.js +66 -0
- package/src/lib/plugin-manager/plugin-live-paths.js.map +1 -0
- package/src/lib/plugin-manager/plugin-org-erasure.d.ts +3 -2
- package/src/lib/plugin-manager/plugin-org-erasure.js +30 -5
- package/src/lib/plugin-manager/plugin-org-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-person-erasure.d.ts +68 -9
- package/src/lib/plugin-manager/plugin-person-erasure.js +196 -51
- package/src/lib/plugin-manager/plugin-person-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-person-records.d.ts +275 -0
- package/src/lib/plugin-manager/plugin-person-records.js +107 -0
- package/src/lib/plugin-manager/plugin-person-records.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-counts.d.ts +76 -0
- package/src/lib/plugin-manager/plugin-record-counts.js +49 -0
- package/src/lib/plugin-manager/plugin-record-counts.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-email-state.d.ts +26 -0
- package/src/lib/plugin-manager/plugin-record-email-state.js +16 -0
- package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-index.d.ts +10 -0
- package/src/lib/plugin-manager/plugin-record-index.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-lists.d.ts +86 -6
- package/src/lib/plugin-manager/plugin-record-lists.js +42 -5
- package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-origin.d.ts +79 -0
- package/src/lib/plugin-manager/plugin-record-origin.js +46 -0
- package/src/lib/plugin-manager/plugin-record-origin.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-pages.d.ts +37 -0
- package/src/lib/plugin-manager/plugin-record-pages.js +52 -0
- package/src/lib/plugin-manager/plugin-record-pages.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-timeline.d.ts +60 -0
- package/src/lib/plugin-manager/plugin-record-timeline.js +16 -0
- package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
- package/src/lib/plugin-manager/plugin-resource-drafts.d.ts +5 -5
- package/src/lib/plugin-manager/plugin-resource-drafts.js.map +1 -1
- package/src/lib/plugin-manager/plugin-revocations.d.ts +64 -0
- package/src/lib/plugin-manager/plugin-revocations.js +47 -0
- package/src/lib/plugin-manager/plugin-revocations.js.map +1 -0
- package/src/lib/plugin-manager/plugin-send-tallies.d.ts +69 -0
- package/src/lib/plugin-manager/plugin-send-tallies.js +45 -0
- package/src/lib/plugin-manager/plugin-send-tallies.js.map +1 -0
- package/src/lib/plugin-manager/plugin-server-steps.d.ts +170 -0
- package/src/lib/plugin-manager/plugin-server-steps.js +116 -0
- package/src/lib/plugin-manager/plugin-server-steps.js.map +1 -0
- package/src/lib/plugin-manager/plugin-site-bundle.d.ts +40 -0
- package/src/lib/plugin-manager/plugin-site-bundle.js +4 -0
- package/src/lib/plugin-manager/plugin-site-bundle.js.map +1 -1
- package/src/lib/plugin-manager/plugin-site-export.d.ts +57 -1
- package/src/lib/plugin-manager/plugin-site-export.js +23 -10
- package/src/lib/plugin-manager/plugin-site-export.js.map +1 -1
- package/src/lib/plugin-manager/plugin-sitemap-readers.d.ts +146 -0
- package/src/lib/plugin-manager/plugin-sitemap-readers.js +110 -0
- package/src/lib/plugin-manager/plugin-sitemap-readers.js.map +1 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +714 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.js +443 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -0
- package/src/lib/plugin-manager/plugin-usage-axes.d.ts +54 -5
- package/src/lib/plugin-manager/plugin-usage-axes.js +11 -3
- package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
- package/src/lib/plugin-manager/plugin-user-erasure.js +9 -1
- package/src/lib/plugin-manager/plugin-user-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-visitor-doors.d.ts +104 -0
- package/src/lib/plugin-manager/plugin-visitor-doors.js +108 -0
- package/src/lib/plugin-manager/plugin-visitor-doors.js.map +1 -0
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js +2 -0
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
- package/src/lib/plugin-manager/repeat-rows.d.ts +5 -6
- package/src/lib/plugin-manager/repeat-rows.js.map +1 -1
- package/src/lib/app-utils/actions.d.ts +0 -310
- package/src/lib/app-utils/actions.js +0 -506
- package/src/lib/app-utils/actions.js.map +0 -1
- package/src/lib/app-utils/automation-placeholders.d.ts +0 -72
- package/src/lib/app-utils/automation-placeholders.js +0 -207
- package/src/lib/app-utils/automation-placeholders.js.map +0 -1
- package/src/lib/app-utils/dataset-models.d.ts +0 -339
- package/src/lib/app-utils/dataset-models.js +0 -722
- package/src/lib/app-utils/dataset-models.js.map +0 -1
- package/src/lib/app-utils/datasets.d.ts +0 -171
- package/src/lib/app-utils/datasets.js +0 -227
- package/src/lib/app-utils/datasets.js.map +0 -1
- package/src/lib/app-utils/form-abuse-ceiling.d.ts +0 -146
- package/src/lib/app-utils/form-abuse-ceiling.js +0 -158
- package/src/lib/app-utils/form-abuse-ceiling.js.map +0 -1
- package/src/lib/plugin-manager/order-fulfilment.d.ts +0 -142
- package/src/lib/plugin-manager/order-fulfilment.js +0 -104
- package/src/lib/plugin-manager/order-fulfilment.js.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/** The first path segment the notice owns on every site (a reserved slug). */
|
|
18
|
+
export declare const LEAVING_NOTICE_ROUTE_SEGMENT = "_aglyn";
|
|
19
|
+
/** Where the notice is served, on the site's own host. */
|
|
20
|
+
export declare const LEAVING_NOTICE_PATH = "/_aglyn/leaving";
|
|
21
|
+
/** The query parameter carrying the destination. */
|
|
22
|
+
export declare const LEAVING_NOTICE_DESTINATION_PARAM = "to";
|
|
23
|
+
/** The query parameter carrying the destination's signature. */
|
|
24
|
+
export declare const LEAVING_NOTICE_SIGNATURE_PARAM = "sig";
|
|
25
|
+
/** What a page in its notice window carries, from the server. */
|
|
26
|
+
export interface LeavingNoticeConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Epoch ms the window closes. For people and specs reading the payload:
|
|
29
|
+
* nothing here compares it to a clock, because the page that carries this
|
|
30
|
+
* config was rendered inside the window and its href has to match the
|
|
31
|
+
* server's byte for byte.
|
|
32
|
+
*/
|
|
33
|
+
until: number;
|
|
34
|
+
/**
|
|
35
|
+
* The hosts a link may go to without the notice: the site's own subdomain
|
|
36
|
+
* and custom domain, and the platform's own. An entry starting with `.` is
|
|
37
|
+
* that domain AND every name under it.
|
|
38
|
+
*/
|
|
39
|
+
hosts: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* Destination (as {@link normalizeLeavingDestination} writes it) → its
|
|
42
|
+
* signature, for every outside address the server found on this page. A
|
|
43
|
+
* destination with none still goes through the notice, which refuses it.
|
|
44
|
+
*/
|
|
45
|
+
sigs: Readonly<Record<string, string>>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The absolute http(s) address an href navigates to when it names another
|
|
49
|
+
* host, or `null` for anything that stays on the page's own origin or is not
|
|
50
|
+
* a navigation at all.
|
|
51
|
+
*
|
|
52
|
+
* Resolved the way a browser resolves it rather than pattern-matched, because
|
|
53
|
+
* a pattern is exactly what a disguised link is built to get past: `//evil`
|
|
54
|
+
* and `/\evil` are both protocol-relative to a browser while reading as
|
|
55
|
+
* site paths to a `^/` test. `mailto:`, `tel:` and `sms:` hand off to another
|
|
56
|
+
* app and are not navigations, so they answer `null` with every other scheme.
|
|
57
|
+
*
|
|
58
|
+
* The answer is the URL's `href` — lowercased host, default port dropped,
|
|
59
|
+
* root path filled in — so the server that signs a destination and the
|
|
60
|
+
* client that looks the signature up agree on one spelling.
|
|
61
|
+
*/
|
|
62
|
+
export declare function normalizeLeavingDestination(raw: unknown): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a hostname is one a link may reach without the notice: listed in
|
|
65
|
+
* `hosts` (exactly, or under a `.domain` entry), or a development machine's
|
|
66
|
+
* own `localhost`, which sends a visitor nowhere.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isLeavingNoticeExempt(hostname: string, hosts: readonly string[]): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The normalized destination of an href that leaves for a host outside
|
|
71
|
+
* `hosts`, or `null` when the href stays, is not a navigation, or is exempt.
|
|
72
|
+
*/
|
|
73
|
+
export declare function leavingDestination(raw: unknown, hosts: readonly string[]): string | null;
|
|
74
|
+
/** The notice's own address for a destination, signed when a signature is known. */
|
|
75
|
+
export declare function leavingNoticeHref(destination: string, signature?: string | null): string;
|
|
76
|
+
/**
|
|
77
|
+
* The href a link should carry instead of `raw` — the notice for its
|
|
78
|
+
* destination — or `undefined` to leave it as it is: no config (the site is
|
|
79
|
+
* not in its window), a destination on an exempt host, or not a navigation.
|
|
80
|
+
*/
|
|
81
|
+
export declare function routeThroughLeavingNotice(raw: unknown, config: LeavingNoticeConfig | null | undefined): string | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Points the anchor an event landed in at the notice, when it leaves.
|
|
84
|
+
*
|
|
85
|
+
* The catch-all for every link `useLinkTarget` never saw — Markdown and rich
|
|
86
|
+
* text bodies, collection blocks, a plugin's own anchors. The href is
|
|
87
|
+
* rewritten IN PLACE, before the browser acts on the event, so the visitor's
|
|
88
|
+
* own gesture still decides how it opens: a modified click, a middle click
|
|
89
|
+
* and "Open in new tab" all take the notice with them. Next's `Link` leaves
|
|
90
|
+
* a non-local href to the browser, so the browser is what reads the change.
|
|
91
|
+
*
|
|
92
|
+
* Returns whether it rewrote anything.
|
|
93
|
+
*/
|
|
94
|
+
export declare function rerouteLeavingAnchor(target: EventTarget | null, config: LeavingNoticeConfig | null | undefined): boolean;
|
|
95
|
+
/** Installs {@link rerouteLeavingAnchor} on a document; returns the uninstall. */
|
|
96
|
+
export declare function installLeavingNoticeInterceptor(doc: Document, config: LeavingNoticeConfig): () => void;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /*==========================================
|
|
17
|
+
* THE "YOU'RE LEAVING THIS SITE" NOTICE, CLIENT HALF (AGL-3452).
|
|
18
|
+
*
|
|
19
|
+
* Both phishing pages found on free sites on 2026-10-01 had one button, and it
|
|
20
|
+
* went straight to an outside credential harvester: the site's address was
|
|
21
|
+
* only the trusted-looking hop. So for a FREE workspace in its first 14 days,
|
|
22
|
+
* a link to another domain goes through a notice on the site's own host
|
|
23
|
+
* first, which names the destination in plain text and says the platform
|
|
24
|
+
* does not operate it.
|
|
25
|
+
*
|
|
26
|
+
* The server decides whether a page is in that window and hands the page a
|
|
27
|
+
* {@link LeavingNoticeConfig}; this module only applies it. Nothing here
|
|
28
|
+
* reads the clock, so the server render and the hydrating client always
|
|
29
|
+
* produce the same href.
|
|
30
|
+
*
|
|
31
|
+
* A leaf with no imports: it is on every published page through
|
|
32
|
+
* `useLinkTarget`, and the hosts and signatures it needs arrive as data.
|
|
33
|
+
*=========================================*/ /** The first path segment the notice owns on every site (a reserved slug). */ export const LEAVING_NOTICE_ROUTE_SEGMENT = '_aglyn';
|
|
34
|
+
/** Where the notice is served, on the site's own host. */ export const LEAVING_NOTICE_PATH = `/${LEAVING_NOTICE_ROUTE_SEGMENT}/leaving`;
|
|
35
|
+
/** The query parameter carrying the destination. */ export const LEAVING_NOTICE_DESTINATION_PARAM = 'to';
|
|
36
|
+
/** The query parameter carrying the destination's signature. */ export const LEAVING_NOTICE_SIGNATURE_PARAM = 'sig';
|
|
37
|
+
/** The origin a site-relative href is resolved against to tell it apart. */ const SITE_RELATIVE_BASE = 'https://site-relative.invalid';
|
|
38
|
+
const SITE_RELATIVE_HOSTNAME = 'site-relative.invalid';
|
|
39
|
+
/**
|
|
40
|
+
* The absolute http(s) address an href navigates to when it names another
|
|
41
|
+
* host, or `null` for anything that stays on the page's own origin or is not
|
|
42
|
+
* a navigation at all.
|
|
43
|
+
*
|
|
44
|
+
* Resolved the way a browser resolves it rather than pattern-matched, because
|
|
45
|
+
* a pattern is exactly what a disguised link is built to get past: `//evil`
|
|
46
|
+
* and `/\evil` are both protocol-relative to a browser while reading as
|
|
47
|
+
* site paths to a `^/` test. `mailto:`, `tel:` and `sms:` hand off to another
|
|
48
|
+
* app and are not navigations, so they answer `null` with every other scheme.
|
|
49
|
+
*
|
|
50
|
+
* The answer is the URL's `href` — lowercased host, default port dropped,
|
|
51
|
+
* root path filled in — so the server that signs a destination and the
|
|
52
|
+
* client that looks the signature up agree on one spelling.
|
|
53
|
+
*/ export function normalizeLeavingDestination(raw) {
|
|
54
|
+
if (typeof raw !== 'string') return null;
|
|
55
|
+
const trimmed = raw.trim();
|
|
56
|
+
if (!trimmed) return null;
|
|
57
|
+
let url;
|
|
58
|
+
try {
|
|
59
|
+
url = new URL(trimmed, SITE_RELATIVE_BASE);
|
|
60
|
+
} catch (unused) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;
|
|
64
|
+
if (!url.hostname || url.hostname === SITE_RELATIVE_HOSTNAME) return null;
|
|
65
|
+
return url.href;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether a hostname is one a link may reach without the notice: listed in
|
|
69
|
+
* `hosts` (exactly, or under a `.domain` entry), or a development machine's
|
|
70
|
+
* own `localhost`, which sends a visitor nowhere.
|
|
71
|
+
*/ export function isLeavingNoticeExempt(hostname, hosts) {
|
|
72
|
+
const name = String(hostname != null ? hostname : '').toLowerCase().replace(/\.+$/, '');
|
|
73
|
+
if (!name) return true;
|
|
74
|
+
if (name === 'localhost' || name.endsWith('.localhost')) return true;
|
|
75
|
+
for (const entry of hosts){
|
|
76
|
+
if (entry.startsWith('.')) {
|
|
77
|
+
if (name === entry.slice(1) || name.endsWith(entry)) return true;
|
|
78
|
+
} else if (name === entry) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The normalized destination of an href that leaves for a host outside
|
|
86
|
+
* `hosts`, or `null` when the href stays, is not a navigation, or is exempt.
|
|
87
|
+
*/ export function leavingDestination(raw, hosts) {
|
|
88
|
+
const destination = normalizeLeavingDestination(raw);
|
|
89
|
+
if (!destination) return null;
|
|
90
|
+
return isLeavingNoticeExempt(new URL(destination).hostname, hosts) ? null : destination;
|
|
91
|
+
}
|
|
92
|
+
/** The notice's own address for a destination, signed when a signature is known. */ export function leavingNoticeHref(destination, signature) {
|
|
93
|
+
const params = new URLSearchParams();
|
|
94
|
+
params.set(LEAVING_NOTICE_DESTINATION_PARAM, destination);
|
|
95
|
+
if (signature) params.set(LEAVING_NOTICE_SIGNATURE_PARAM, signature);
|
|
96
|
+
return `${LEAVING_NOTICE_PATH}?${params.toString()}`;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The href a link should carry instead of `raw` — the notice for its
|
|
100
|
+
* destination — or `undefined` to leave it as it is: no config (the site is
|
|
101
|
+
* not in its window), a destination on an exempt host, or not a navigation.
|
|
102
|
+
*/ export function routeThroughLeavingNotice(raw, config) {
|
|
103
|
+
var _config_sigs;
|
|
104
|
+
if (!config) return undefined;
|
|
105
|
+
const destination = leavingDestination(raw, config.hosts);
|
|
106
|
+
if (!destination) return undefined;
|
|
107
|
+
return leavingNoticeHref(destination, (_config_sigs = config.sigs) == null ? void 0 : _config_sigs[destination]);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Points the anchor an event landed in at the notice, when it leaves.
|
|
111
|
+
*
|
|
112
|
+
* The catch-all for every link `useLinkTarget` never saw — Markdown and rich
|
|
113
|
+
* text bodies, collection blocks, a plugin's own anchors. The href is
|
|
114
|
+
* rewritten IN PLACE, before the browser acts on the event, so the visitor's
|
|
115
|
+
* own gesture still decides how it opens: a modified click, a middle click
|
|
116
|
+
* and "Open in new tab" all take the notice with them. Next's `Link` leaves
|
|
117
|
+
* a non-local href to the browser, so the browser is what reads the change.
|
|
118
|
+
*
|
|
119
|
+
* Returns whether it rewrote anything.
|
|
120
|
+
*/ export function rerouteLeavingAnchor(target, config) {
|
|
121
|
+
var _node_parentElement;
|
|
122
|
+
var _element_closest;
|
|
123
|
+
if (!config || !target) return false;
|
|
124
|
+
const node = target;
|
|
125
|
+
const element = node.nodeType === 1 ? node : (_node_parentElement = node.parentElement) != null ? _node_parentElement : null;
|
|
126
|
+
const anchor = element == null ? void 0 : (_element_closest = element.closest) == null ? void 0 : _element_closest.call(element, 'a[href], area[href]');
|
|
127
|
+
if (!anchor) return false;
|
|
128
|
+
const rerouted = routeThroughLeavingNotice(anchor.getAttribute('href'), config);
|
|
129
|
+
if (!rerouted) return false;
|
|
130
|
+
anchor.setAttribute('href', rerouted);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Every gesture that can follow, open or copy a link, caught on the way
|
|
135
|
+
* down so the href is the notice's before anything reads it.
|
|
136
|
+
*/ const LEAVING_NOTICE_EVENTS = [
|
|
137
|
+
'pointerdown',
|
|
138
|
+
'click',
|
|
139
|
+
'auxclick',
|
|
140
|
+
'contextmenu',
|
|
141
|
+
'focusin'
|
|
142
|
+
];
|
|
143
|
+
/** Installs {@link rerouteLeavingAnchor} on a document; returns the uninstall. */ export function installLeavingNoticeInterceptor(doc, config) {
|
|
144
|
+
const handler = (event)=>{
|
|
145
|
+
rerouteLeavingAnchor(event.target, config);
|
|
146
|
+
};
|
|
147
|
+
for (const type of LEAVING_NOTICE_EVENTS){
|
|
148
|
+
doc.addEventListener(type, handler, true);
|
|
149
|
+
}
|
|
150
|
+
return ()=>{
|
|
151
|
+
for (const type of LEAVING_NOTICE_EVENTS){
|
|
152
|
+
doc.removeEventListener(type, handler, true);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=leaving-notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/leaving-notice.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE \"YOU'RE LEAVING THIS SITE\" NOTICE, CLIENT HALF (AGL-3452).\n *\n * Both phishing pages found on free sites on 2026-10-01 had one button, and it\n * went straight to an outside credential harvester: the site's address was\n * only the trusted-looking hop. So for a FREE workspace in its first 14 days,\n * a link to another domain goes through a notice on the site's own host\n * first, which names the destination in plain text and says the platform\n * does not operate it.\n *\n * The server decides whether a page is in that window and hands the page a\n * {@link LeavingNoticeConfig}; this module only applies it. Nothing here\n * reads the clock, so the server render and the hydrating client always\n * produce the same href.\n *\n * A leaf with no imports: it is on every published page through\n * `useLinkTarget`, and the hosts and signatures it needs arrive as data.\n *=========================================*/\n\n/** The first path segment the notice owns on every site (a reserved slug). */\nexport const LEAVING_NOTICE_ROUTE_SEGMENT = '_aglyn'\n\n/** Where the notice is served, on the site's own host. */\nexport const LEAVING_NOTICE_PATH = `/${LEAVING_NOTICE_ROUTE_SEGMENT}/leaving`\n\n/** The query parameter carrying the destination. */\nexport const LEAVING_NOTICE_DESTINATION_PARAM = 'to'\n\n/** The query parameter carrying the destination's signature. */\nexport const LEAVING_NOTICE_SIGNATURE_PARAM = 'sig'\n\n/** What a page in its notice window carries, from the server. */\nexport interface LeavingNoticeConfig {\n /**\n * Epoch ms the window closes. For people and specs reading the payload:\n * nothing here compares it to a clock, because the page that carries this\n * config was rendered inside the window and its href has to match the\n * server's byte for byte.\n */\n until: number\n /**\n * The hosts a link may go to without the notice: the site's own subdomain\n * and custom domain, and the platform's own. An entry starting with `.` is\n * that domain AND every name under it.\n */\n hosts: readonly string[]\n /**\n * Destination (as {@link normalizeLeavingDestination} writes it) → its\n * signature, for every outside address the server found on this page. A\n * destination with none still goes through the notice, which refuses it.\n */\n sigs: Readonly<Record<string, string>>\n}\n\n/** The origin a site-relative href is resolved against to tell it apart. */\nconst SITE_RELATIVE_BASE = 'https://site-relative.invalid'\nconst SITE_RELATIVE_HOSTNAME = 'site-relative.invalid'\n\n/**\n * The absolute http(s) address an href navigates to when it names another\n * host, or `null` for anything that stays on the page's own origin or is not\n * a navigation at all.\n *\n * Resolved the way a browser resolves it rather than pattern-matched, because\n * a pattern is exactly what a disguised link is built to get past: `//evil`\n * and `/\\evil` are both protocol-relative to a browser while reading as\n * site paths to a `^/` test. `mailto:`, `tel:` and `sms:` hand off to another\n * app and are not navigations, so they answer `null` with every other scheme.\n *\n * The answer is the URL's `href` — lowercased host, default port dropped,\n * root path filled in — so the server that signs a destination and the\n * client that looks the signature up agree on one spelling.\n */\nexport function normalizeLeavingDestination(raw: unknown): string | null {\n if (typeof raw !== 'string') return null\n const trimmed = raw.trim()\n if (!trimmed) return null\n let url: URL\n try {\n url = new URL(trimmed, SITE_RELATIVE_BASE)\n } catch {\n return null\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return null\n if (!url.hostname || url.hostname === SITE_RELATIVE_HOSTNAME) return null\n return url.href\n}\n\n/**\n * Whether a hostname is one a link may reach without the notice: listed in\n * `hosts` (exactly, or under a `.domain` entry), or a development machine's\n * own `localhost`, which sends a visitor nowhere.\n */\nexport function isLeavingNoticeExempt(\n hostname: string,\n hosts: readonly string[],\n): boolean {\n const name = String(hostname ?? '')\n .toLowerCase()\n .replace(/\\.+$/, '')\n if (!name) return true\n if (name === 'localhost' || name.endsWith('.localhost')) return true\n for (const entry of hosts) {\n if (entry.startsWith('.')) {\n if (name === entry.slice(1) || name.endsWith(entry)) return true\n } else if (name === entry) {\n return true\n }\n }\n return false\n}\n\n/**\n * The normalized destination of an href that leaves for a host outside\n * `hosts`, or `null` when the href stays, is not a navigation, or is exempt.\n */\nexport function leavingDestination(\n raw: unknown,\n hosts: readonly string[],\n): string | null {\n const destination = normalizeLeavingDestination(raw)\n if (!destination) return null\n return isLeavingNoticeExempt(new URL(destination).hostname, hosts)\n ? null\n : destination\n}\n\n/** The notice's own address for a destination, signed when a signature is known. */\nexport function leavingNoticeHref(\n destination: string,\n signature?: string | null,\n): string {\n const params = new URLSearchParams()\n params.set(LEAVING_NOTICE_DESTINATION_PARAM, destination)\n if (signature) params.set(LEAVING_NOTICE_SIGNATURE_PARAM, signature)\n return `${LEAVING_NOTICE_PATH}?${params.toString()}`\n}\n\n/**\n * The href a link should carry instead of `raw` — the notice for its\n * destination — or `undefined` to leave it as it is: no config (the site is\n * not in its window), a destination on an exempt host, or not a navigation.\n */\nexport function routeThroughLeavingNotice(\n raw: unknown,\n config: LeavingNoticeConfig | null | undefined,\n): string | undefined {\n if (!config) return undefined\n const destination = leavingDestination(raw, config.hosts)\n if (!destination) return undefined\n return leavingNoticeHref(destination, config.sigs?.[destination])\n}\n\n/**\n * Points the anchor an event landed in at the notice, when it leaves.\n *\n * The catch-all for every link `useLinkTarget` never saw — Markdown and rich\n * text bodies, collection blocks, a plugin's own anchors. The href is\n * rewritten IN PLACE, before the browser acts on the event, so the visitor's\n * own gesture still decides how it opens: a modified click, a middle click\n * and \"Open in new tab\" all take the notice with them. Next's `Link` leaves\n * a non-local href to the browser, so the browser is what reads the change.\n *\n * Returns whether it rewrote anything.\n */\nexport function rerouteLeavingAnchor(\n target: EventTarget | null,\n config: LeavingNoticeConfig | null | undefined,\n): boolean {\n if (!config || !target) return false\n const node = target as Node\n const element =\n node.nodeType === 1 ? (node as Element) : (node.parentElement ?? null)\n const anchor = element?.closest?.('a[href], area[href]')\n if (!anchor) return false\n const rerouted = routeThroughLeavingNotice(anchor.getAttribute('href'), config)\n if (!rerouted) return false\n anchor.setAttribute('href', rerouted)\n return true\n}\n\n/**\n * Every gesture that can follow, open or copy a link, caught on the way\n * down so the href is the notice's before anything reads it.\n */\nconst LEAVING_NOTICE_EVENTS = [\n 'pointerdown',\n 'click',\n 'auxclick',\n 'contextmenu',\n 'focusin',\n] as const\n\n/** Installs {@link rerouteLeavingAnchor} on a document; returns the uninstall. */\nexport function installLeavingNoticeInterceptor(\n doc: Document,\n config: LeavingNoticeConfig,\n): () => void {\n const handler = (event: Event) => {\n rerouteLeavingAnchor(event.target, config)\n }\n for (const type of LEAVING_NOTICE_EVENTS) {\n doc.addEventListener(type, handler, true)\n }\n return () => {\n for (const type of LEAVING_NOTICE_EVENTS) {\n doc.removeEventListener(type, handler, true)\n }\n }\n}\n"],"names":["LEAVING_NOTICE_ROUTE_SEGMENT","LEAVING_NOTICE_PATH","LEAVING_NOTICE_DESTINATION_PARAM","LEAVING_NOTICE_SIGNATURE_PARAM","SITE_RELATIVE_BASE","SITE_RELATIVE_HOSTNAME","normalizeLeavingDestination","raw","trimmed","trim","url","URL","protocol","hostname","href","isLeavingNoticeExempt","hosts","name","String","toLowerCase","replace","endsWith","entry","startsWith","slice","leavingDestination","destination","leavingNoticeHref","signature","params","URLSearchParams","set","toString","routeThroughLeavingNotice","config","undefined","sigs","rerouteLeavingAnchor","target","node","element","nodeType","parentElement","anchor","closest","rerouted","getAttribute","setAttribute","LEAVING_NOTICE_EVENTS","installLeavingNoticeInterceptor","doc","handler","event","type","addEventListener","removeEventListener"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;2CAiB2C,GAE3C,4EAA4E,GAC5E,OAAO,MAAMA,+BAA+B,SAAQ;AAEpD,wDAAwD,GACxD,OAAO,MAAMC,sBAAsB,CAAC,CAAC,EAAED,6BAA6B,QAAQ,CAAC,CAAA;AAE7E,kDAAkD,GAClD,OAAO,MAAME,mCAAmC,KAAI;AAEpD,8DAA8D,GAC9D,OAAO,MAAMC,iCAAiC,MAAK;AAyBnD,0EAA0E,GAC1E,MAAMC,qBAAqB;AAC3B,MAAMC,yBAAyB;AAE/B;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,4BAA4BC,GAAY;IACtD,IAAI,OAAOA,QAAQ,UAAU,OAAO;IACpC,MAAMC,UAAUD,IAAIE,IAAI;IACxB,IAAI,CAACD,SAAS,OAAO;IACrB,IAAIE;IACJ,IAAI;QACFA,MAAM,IAAIC,IAAIH,SAASJ;IACzB,EAAE,eAAM;QACN,OAAO;IACT;IACA,IAAIM,IAAIE,QAAQ,KAAK,WAAWF,IAAIE,QAAQ,KAAK,UAAU,OAAO;IAClE,IAAI,CAACF,IAAIG,QAAQ,IAAIH,IAAIG,QAAQ,KAAKR,wBAAwB,OAAO;IACrE,OAAOK,IAAII,IAAI;AACjB;AAEA;;;;CAIC,GACD,OAAO,SAASC,sBACdF,QAAgB,EAChBG,KAAwB;IAExB,MAAMC,OAAOC,OAAOL,mBAAAA,WAAY,IAC7BM,WAAW,GACXC,OAAO,CAAC,QAAQ;IACnB,IAAI,CAACH,MAAM,OAAO;IAClB,IAAIA,SAAS,eAAeA,KAAKI,QAAQ,CAAC,eAAe,OAAO;IAChE,KAAK,MAAMC,SAASN,MAAO;QACzB,IAAIM,MAAMC,UAAU,CAAC,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,MAAME,WAAWZ,0BAA0BU,OAAOG,YAAY,CAAC,SAASZ;IACxE,IAAI,CAACW,UAAU,OAAO;IACtBF,OAAOI,YAAY,CAAC,QAAQF;IAC5B,OAAO;AACT;AAEA;;;CAGC,GACD,MAAMG,wBAAwB;IAC5B;IACA;IACA;IACA;IACA;CACD;AAED,gFAAgF,GAChF,OAAO,SAASC,gCACdC,GAAa,EACbhB,MAA2B;IAE3B,MAAMiB,UAAU,CAACC;QACff,qBAAqBe,MAAMd,MAAM,EAAEJ;IACrC;IACA,KAAK,MAAMmB,QAAQL,sBAAuB;QACxCE,IAAII,gBAAgB,CAACD,MAAMF,SAAS;IACtC;IACA,OAAO;QACL,KAAK,MAAME,QAAQL,sBAAuB;YACxCE,IAAIK,mBAAmB,CAACF,MAAMF,SAAS;QACzC;IACF;AACF"}
|
|
@@ -63,6 +63,24 @@ export interface LlmsTxtCollection {
|
|
|
63
63
|
/** Published entries, when the count is known and cheap to have. */
|
|
64
64
|
entryCount?: number;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* A group of pages served under one base, one page per record of a dataset
|
|
68
|
+
* (AGL-3475): `Services`, twelve pages at `/services/…`.
|
|
69
|
+
*/
|
|
70
|
+
export interface LlmsTxtPageGroup {
|
|
71
|
+
/** What the pages are. */
|
|
72
|
+
name: string;
|
|
73
|
+
/** The path the pages share, without slashes at either end. */
|
|
74
|
+
base: string;
|
|
75
|
+
/** How many pages the group holds. */
|
|
76
|
+
count: number;
|
|
77
|
+
/**
|
|
78
|
+
* Whether a page is published at the base itself — a listing the group can
|
|
79
|
+
* be linked to. Without one the group links to the sitemap, which lists
|
|
80
|
+
* every page in it, rather than to an address that serves nothing.
|
|
81
|
+
*/
|
|
82
|
+
hasListing?: boolean;
|
|
83
|
+
}
|
|
66
84
|
/** One curated page link. */
|
|
67
85
|
export interface LlmsTxtPage {
|
|
68
86
|
/** Route path, with or without its leading slash. */
|
|
@@ -89,6 +107,8 @@ export interface LlmsTxtOptions {
|
|
|
89
107
|
agent?: LlmsTxtAgentGuidance | null;
|
|
90
108
|
pages?: readonly LlmsTxtPage[];
|
|
91
109
|
collections?: readonly LlmsTxtCollection[];
|
|
110
|
+
/** Pages served one per record, grouped by base (AGL-3475). */
|
|
111
|
+
pageGroups?: readonly LlmsTxtPageGroup[];
|
|
92
112
|
/** Whether this site serves `/search`. */
|
|
93
113
|
hasSearch?: boolean;
|
|
94
114
|
/** Where a human is reached, when the site publishes one. */
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
* counts and names come from the site's own data, so nothing here is a claim
|
|
77
77
|
* the reader cannot verify by following the link.
|
|
78
78
|
*/ function derivedGuidance(options) {
|
|
79
|
-
var _options_collections;
|
|
79
|
+
var _options_collections, _options_pageGroups;
|
|
80
80
|
const { origin, siteName } = options;
|
|
81
81
|
const lines = [];
|
|
82
82
|
for (const collection of (_options_collections = options.collections) != null ? _options_collections : []){
|
|
@@ -84,6 +84,12 @@
|
|
|
84
84
|
const count = typeof collection.entryCount === 'number' && collection.entryCount > 0 ? `${collection.entryCount} published ${collection.entryCount === 1 ? 'entry' : 'entries'}` : 'the published entries';
|
|
85
85
|
lines.push(item(name, absoluteSiteUrl(origin, collection.slug), collection.description ? `${label(collection.description)} — ${count}, newest first` : `${count}, newest first. Read this when you need ${label(name.toLowerCase())} published by ${label(siteName)}`));
|
|
86
86
|
}
|
|
87
|
+
for (const group of (_options_pageGroups = options.pageGroups) != null ? _options_pageGroups : []){
|
|
88
|
+
if (!(group.count > 0)) continue;
|
|
89
|
+
const where = `/${group.base}/`;
|
|
90
|
+
const count = `${group.count} ${group.count === 1 ? 'page' : 'pages'}`;
|
|
91
|
+
lines.push(item(group.name || nameForSlug(group.base), group.hasListing ? absoluteSiteUrl(origin, group.base) : absoluteSiteUrl(origin, 'sitemap.xml'), group.hasListing ? `${count} under \`${where}\`, one per entry, each linked from this page` : `${count} under \`${where}\`, one per entry; the sitemap lists every one`));
|
|
92
|
+
}
|
|
87
93
|
if (options.hasSearch) {
|
|
88
94
|
lines.push(item('Search this site', `${absoluteSiteUrl(origin, 'search')}?q=`, 'full-text search across this site’s pages and published entries; ' + 'append your query to `?q=`'));
|
|
89
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/llms-txt.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * `/llms.txt` for a tenant site, in the llmstxt.org format (AGL-2716).\n *\n * The file an agent reads FIRST — before the sitemap, before the homepage — to\n * decide whether this site can answer the question it is holding, and which\n * URL to fetch if it can.\n *\n * ## The format, exactly\n *\n * llmstxt.org specifies, in this order: an H1 with the project name (the ONLY\n * required part), an optional blockquote summary, zero or more non-heading\n * markdown sections, then zero or more H2-delimited sections of \"file lists\" —\n * markdown lists whose items are a required `[name](url)` link optionally\n * followed by `:` and a note.\n *\n * Every H2 section this builder emits is a file list of that shape, INCLUDING\n * the when-to-use section. That is the design decision worth keeping: guidance\n * written as prose tells an agent what the site is about and leaves it to\n * guess a URL, while guidance written as a link list answers \"which address\n * serves this job\" in the same breath. It also keeps the file inside the\n * format rather than beside it.\n *\n * ## What goes in it, and what does not\n *\n * NOT every URL — that is the sitemap's job, and this file links to it. A site\n * with five hundred pages has an llms.txt of the same length as a site with\n * five: identity, what it is for, the handful of entry points that lead\n * everywhere else, and the machine-readable descriptions of its own surface.\n *\n * ## Why the derived guidance is factual and never promotional\n *\n * A site whose author writes nothing still gets a when-to-use section, built\n * from what the site demonstrably HAS: the collections it publishes, the\n * endpoints it answers, the entry counts. Marketing copy in this position is\n * worse than an empty section — an agent scoring a dozen candidate sources\n * discounts a claim it cannot check, and the whole point of the section is to\n * be checkable.\n */\n\n/** A content collection published by the site. */\nexport interface LlmsTxtCollection {\n /** Public slug — the path segment the list answers at. */\n slug: string\n /** Display name, falling back to the slug. */\n name?: string\n /** The collection's own description, when the author wrote one. */\n description?: string\n /** Published entries, when the count is known and cheap to have. */\n entryCount?: number\n}\n\n/** One curated page link. */\nexport interface LlmsTxtPage {\n /** Route path, with or without its leading slash. */\n path: string\n /** Link text; the path is used when a screen has no name. */\n title?: string\n /** Optional note after the colon. */\n note?: string\n}\n\n/** Author-written agent guidance, as `host.seo.agent` stores it. */\nexport interface LlmsTxtAgentGuidance {\n /** \"When to use this site\" — the jobs it is the right answer to. */\n whenToUse?: string\n /** How an agent should call it — endpoints, auth, rate limits, etiquette. */\n howToUse?: string\n}\n\nexport interface LlmsTxtOptions {\n /** The site's name — the H1, and the only required field in the format. */\n siteName: string\n /** Absolute origin, no trailing slash. */\n origin: string\n /** The summary blockquote. */\n description?: string\n agent?: LlmsTxtAgentGuidance | null\n pages?: readonly LlmsTxtPage[]\n collections?: readonly LlmsTxtCollection[]\n /** Whether this site serves `/search`. */\n hasSearch?: boolean\n /** Where a human is reached, when the site publishes one. */\n contactEmail?: string\n}\n\n/** Path of the agent-guidance file, at the site root, per llmstxt.org. */\nexport const LLMS_TXT_PATH = '/llms.txt'\n\n/** Path of the machine-readable API description. */\nexport const OPENAPI_PATH = '/openapi.json'\n\n/** Join an origin and a path into an absolute URL with exactly one slash. */\nexport function absoluteSiteUrl(origin: string, path: string): string {\n const base = origin.replace(/\\/+$/, '')\n if (!path || path === '/') return `${base}/`\n return `${base}/${String(path).replace(/^\\/+/, '')}`\n}\n\n/**\n * Markdown link text, escaped.\n *\n * Only `[` and `]` — the two characters that can close a link label early and\n * turn the rest of the line into loose text. Escaping more would put\n * backslashes in a page title for no benefit; this is a label, not a document.\n */\nconst label = (value: string): string =>\n String(value).replace(/\\s+/g, ' ').trim().replace(/([[\\]])/g, '\\\\$1')\n\n/** One file-list item: `- [name](url): note`. */\nconst item = (name: string, url: string, note?: string): string =>\n note ? `- [${label(name)}](${url}): ${note}` : `- [${label(name)}](${url})`\n\n/** Title-case-ish display name for a slug with no name of its own. */\nfunction nameForSlug(slug: string): string {\n const words = slug.replace(/[-_]+/g, ' ').trim()\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : slug\n}\n\n/**\n * The when-to-use items derived from what the site actually publishes.\n *\n * Each is a job an agent might hold, paired with the URL that answers it. The\n * counts and names come from the site's own data, so nothing here is a claim\n * the reader cannot verify by following the link.\n */\nfunction derivedGuidance(options: LlmsTxtOptions): string[] {\n const { origin, siteName } = options\n const lines: string[] = []\n for (const collection of options.collections ?? []) {\n const name = collection.name || nameForSlug(collection.slug)\n const count =\n typeof collection.entryCount === 'number' && collection.entryCount > 0\n ? `${collection.entryCount} published ${\n collection.entryCount === 1 ? 'entry' : 'entries'\n }`\n : 'the published entries'\n lines.push(\n item(\n name,\n absoluteSiteUrl(origin, collection.slug),\n collection.description\n ? `${label(collection.description)} — ${count}, newest first`\n : `${count}, newest first. Read this when you need ${label(\n name.toLowerCase(),\n )} published by ${label(siteName)}`,\n ),\n )\n }\n if (options.hasSearch) {\n lines.push(\n item(\n 'Search this site',\n `${absoluteSiteUrl(origin, 'search')}?q=`,\n 'full-text search across this site’s pages and published entries; ' +\n 'append your query to `?q=`',\n ),\n )\n }\n lines.push(\n item(\n 'Sitemap index',\n absoluteSiteUrl(origin, 'sitemap.xml'),\n 'every indexable URL on this site, split into dated child sitemaps',\n ),\n )\n lines.push(\n item(\n 'OpenAPI description',\n absoluteSiteUrl(origin, OPENAPI_PATH),\n 'every public endpoint this site serves, with typed parameters, ' +\n 'response schemas and a unique operationId per operation',\n ),\n )\n if (options.contactEmail) {\n lines.push(\n item(\n 'Contact a person',\n `mailto:${options.contactEmail}`,\n 'reach the people who publish this site when the answer is not on it',\n ),\n )\n }\n return lines\n}\n\n/** Build the `/llms.txt` body. */\nexport function buildLlmsTxt(options: LlmsTxtOptions): string {\n const { origin } = options\n const sections: string[] = []\n\n sections.push(`# ${label(options.siteName || 'Site')}`)\n\n const description = String(options.description ?? '').replace(/\\s+/g, ' ').trim()\n if (description) sections.push(`> ${description}`)\n\n /*\n The author's own guidance leads, in their words, because they know things\n this file cannot derive — which questions the site is genuinely the best\n source for, and which it is not.\n */\n const whenToUse = String(options.agent?.whenToUse ?? '').trim()\n if (whenToUse) sections.push(whenToUse)\n\n /*\n The negotiation contract, stated once. An agent that knows a Markdown\n variant exists asks for it; one that does not, parses HTML it did not need.\n Both spellings are given because the two conventions have different\n audiences: `Accept` is acceptmarkdown.com, `.md` is llmstxt.org, and an\n agent that only knows one of them still gets clean text.\n */\n sections.push(\n 'Every page on this site serves a Markdown representation of itself. ' +\n 'Send `Accept: text/markdown`, or append `.md` to any path — ' +\n `for example \\`${absoluteSiteUrl(origin, 'about.md')}\\`. ` +\n 'Responses vary on `Accept`, so a cache cannot hand you the wrong one.',\n )\n\n const howToUse = String(options.agent?.howToUse ?? '').trim()\n if (howToUse) sections.push(howToUse)\n\n const guidance = derivedGuidance(options)\n if (guidance.length) {\n sections.push(['## When to use this site', ...guidance].join('\\n'))\n }\n\n const pages = options.pages ?? []\n if (pages.length) {\n sections.push(\n [\n '## Pages',\n ...pages.map((entry) =>\n item(\n entry.title || nameForSlug(entry.path.replace(/^\\/+/, '')) || 'Home',\n absoluteSiteUrl(origin, entry.path),\n entry.note,\n ),\n ),\n ].join('\\n'),\n )\n }\n\n const collections = options.collections ?? []\n if (collections.length) {\n sections.push(\n [\n '## Feeds',\n ...collections.map((collection) =>\n item(\n `${collection.name || nameForSlug(collection.slug)} (RSS)`,\n absoluteSiteUrl(origin, `${collection.slug}/rss.xml`),\n 'newest entries as RSS 2.0',\n ),\n ),\n ].join('\\n'),\n )\n }\n\n return `${sections.join('\\n\\n').trim()}\\n`\n}\n"],"names":["LLMS_TXT_PATH","OPENAPI_PATH","absoluteSiteUrl","origin","path","base","replace","String","label","value","trim","item","name","url","note","nameForSlug","slug","words","charAt","toUpperCase","slice","derivedGuidance","options","siteName","lines","collection","collections","count","entryCount","push","description","toLowerCase","hasSearch","contactEmail","buildLlmsTxt","sections","whenToUse","agent","howToUse","guidance","length","join","pages","map","entry","title"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCC,GAED,gDAAgD,GA8ChD,wEAAwE,GACxE,OAAO,MAAMA,gBAAgB,YAAW;AAExC,kDAAkD,GAClD,OAAO,MAAMC,eAAe,gBAAe;AAE3C,2EAA2E,GAC3E,OAAO,SAASC,gBAAgBC,MAAc,EAAEC,IAAY;IAC1D,MAAMC,OAAOF,OAAOG,OAAO,CAAC,QAAQ;IACpC,IAAI,CAACF,QAAQA,SAAS,KAAK,OAAO,GAAGC,KAAK,CAAC,CAAC;IAC5C,OAAO,GAAGA,KAAK,CAAC,EAAEE,OAAOH,MAAME,OAAO,CAAC,QAAQ,KAAK;AACtD;AAEA;;;;;;CAMC,GACD,MAAME,QAAQ,CAACC,QACbF,OAAOE,OAAOH,OAAO,CAAC,QAAQ,KAAKI,IAAI,GAAGJ,OAAO,CAAC,YAAY;AAEhE,+CAA+C,GAC/C,MAAMK,OAAO,CAACC,MAAcC,KAAaC,OACvCA,OAAO,CAAC,GAAG,EAAEN,MAAMI,MAAM,EAAE,EAAEC,IAAI,GAAG,EAAEC,MAAM,GAAG,CAAC,GAAG,EAAEN,MAAMI,MAAM,EAAE,EAAEC,IAAI,CAAC,CAAC;AAE7E,oEAAoE,GACpE,SAASE,YAAYC,IAAY;IAC/B,MAAMC,QAAQD,KAAKV,OAAO,CAAC,UAAU,KAAKI,IAAI;IAC9C,OAAOO,QAAQA,MAAMC,MAAM,CAAC,GAAGC,WAAW,KAAKF,MAAMG,KAAK,CAAC,KAAKJ;AAClE;AAEA;;;;;;CAMC,GACD,SAAS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7C,IAAII,YAAYc,MAAM,EAAE;QACtBL,SAASN,IAAI,CACX;YACE;eACGH,YAAYiB,GAAG,CAAC,CAAClB,aAClBd,KACE,GAAGc,WAAWb,IAAI,IAAIG,YAAYU,WAAWT,IAAI,EAAE,MAAM,CAAC,EAC1Dd,gBAAgBC,QAAQ,GAAGsB,WAAWT,IAAI,CAAC,QAAQ,CAAC,GACpD;SAGL,CAACyB,IAAI,CAAC;IAEX;IAEA,OAAO,GAAGN,SAASM,IAAI,CAAC,QAAQ/B,IAAI,GAAG,EAAE,CAAC;AAC5C"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/llms-txt.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * `/llms.txt` for a tenant site, in the llmstxt.org format (AGL-2716).\n *\n * The file an agent reads FIRST — before the sitemap, before the homepage — to\n * decide whether this site can answer the question it is holding, and which\n * URL to fetch if it can.\n *\n * ## The format, exactly\n *\n * llmstxt.org specifies, in this order: an H1 with the project name (the ONLY\n * required part), an optional blockquote summary, zero or more non-heading\n * markdown sections, then zero or more H2-delimited sections of \"file lists\" —\n * markdown lists whose items are a required `[name](url)` link optionally\n * followed by `:` and a note.\n *\n * Every H2 section this builder emits is a file list of that shape, INCLUDING\n * the when-to-use section. That is the design decision worth keeping: guidance\n * written as prose tells an agent what the site is about and leaves it to\n * guess a URL, while guidance written as a link list answers \"which address\n * serves this job\" in the same breath. It also keeps the file inside the\n * format rather than beside it.\n *\n * ## What goes in it, and what does not\n *\n * NOT every URL — that is the sitemap's job, and this file links to it. A site\n * with five hundred pages has an llms.txt of the same length as a site with\n * five: identity, what it is for, the handful of entry points that lead\n * everywhere else, and the machine-readable descriptions of its own surface.\n *\n * ## Why the derived guidance is factual and never promotional\n *\n * A site whose author writes nothing still gets a when-to-use section, built\n * from what the site demonstrably HAS: the collections it publishes, the\n * endpoints it answers, the entry counts. Marketing copy in this position is\n * worse than an empty section — an agent scoring a dozen candidate sources\n * discounts a claim it cannot check, and the whole point of the section is to\n * be checkable.\n */\n\n/** A content collection published by the site. */\nexport interface LlmsTxtCollection {\n /** Public slug — the path segment the list answers at. */\n slug: string\n /** Display name, falling back to the slug. */\n name?: string\n /** The collection's own description, when the author wrote one. */\n description?: string\n /** Published entries, when the count is known and cheap to have. */\n entryCount?: number\n}\n\n/**\n * A group of pages served under one base, one page per record of a dataset\n * (AGL-3475): `Services`, twelve pages at `/services/…`.\n */\nexport interface LlmsTxtPageGroup {\n /** What the pages are. */\n name: string\n /** The path the pages share, without slashes at either end. */\n base: string\n /** How many pages the group holds. */\n count: number\n /**\n * Whether a page is published at the base itself — a listing the group can\n * be linked to. Without one the group links to the sitemap, which lists\n * every page in it, rather than to an address that serves nothing.\n */\n hasListing?: boolean\n}\n\n/** One curated page link. */\nexport interface LlmsTxtPage {\n /** Route path, with or without its leading slash. */\n path: string\n /** Link text; the path is used when a screen has no name. */\n title?: string\n /** Optional note after the colon. */\n note?: string\n}\n\n/** Author-written agent guidance, as `host.seo.agent` stores it. */\nexport interface LlmsTxtAgentGuidance {\n /** \"When to use this site\" — the jobs it is the right answer to. */\n whenToUse?: string\n /** How an agent should call it — endpoints, auth, rate limits, etiquette. */\n howToUse?: string\n}\n\nexport interface LlmsTxtOptions {\n /** The site's name — the H1, and the only required field in the format. */\n siteName: string\n /** Absolute origin, no trailing slash. */\n origin: string\n /** The summary blockquote. */\n description?: string\n agent?: LlmsTxtAgentGuidance | null\n pages?: readonly LlmsTxtPage[]\n collections?: readonly LlmsTxtCollection[]\n /** Pages served one per record, grouped by base (AGL-3475). */\n pageGroups?: readonly LlmsTxtPageGroup[]\n /** Whether this site serves `/search`. */\n hasSearch?: boolean\n /** Where a human is reached, when the site publishes one. */\n contactEmail?: string\n}\n\n/** Path of the agent-guidance file, at the site root, per llmstxt.org. */\nexport const LLMS_TXT_PATH = '/llms.txt'\n\n/** Path of the machine-readable API description. */\nexport const OPENAPI_PATH = '/openapi.json'\n\n/** Join an origin and a path into an absolute URL with exactly one slash. */\nexport function absoluteSiteUrl(origin: string, path: string): string {\n const base = origin.replace(/\\/+$/, '')\n if (!path || path === '/') return `${base}/`\n return `${base}/${String(path).replace(/^\\/+/, '')}`\n}\n\n/**\n * Markdown link text, escaped.\n *\n * Only `[` and `]` — the two characters that can close a link label early and\n * turn the rest of the line into loose text. Escaping more would put\n * backslashes in a page title for no benefit; this is a label, not a document.\n */\nconst label = (value: string): string =>\n String(value).replace(/\\s+/g, ' ').trim().replace(/([[\\]])/g, '\\\\$1')\n\n/** One file-list item: `- [name](url): note`. */\nconst item = (name: string, url: string, note?: string): string =>\n note ? `- [${label(name)}](${url}): ${note}` : `- [${label(name)}](${url})`\n\n/** Title-case-ish display name for a slug with no name of its own. */\nfunction nameForSlug(slug: string): string {\n const words = slug.replace(/[-_]+/g, ' ').trim()\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : slug\n}\n\n/**\n * The when-to-use items derived from what the site actually publishes.\n *\n * Each is a job an agent might hold, paired with the URL that answers it. The\n * counts and names come from the site's own data, so nothing here is a claim\n * the reader cannot verify by following the link.\n */\nfunction derivedGuidance(options: LlmsTxtOptions): string[] {\n const { origin, siteName } = options\n const lines: string[] = []\n for (const collection of options.collections ?? []) {\n const name = collection.name || nameForSlug(collection.slug)\n const count =\n typeof collection.entryCount === 'number' && collection.entryCount > 0\n ? `${collection.entryCount} published ${\n collection.entryCount === 1 ? 'entry' : 'entries'\n }`\n : 'the published entries'\n lines.push(\n item(\n name,\n absoluteSiteUrl(origin, collection.slug),\n collection.description\n ? `${label(collection.description)} — ${count}, newest first`\n : `${count}, newest first. Read this when you need ${label(\n name.toLowerCase(),\n )} published by ${label(siteName)}`,\n ),\n )\n }\n for (const group of options.pageGroups ?? []) {\n if (!(group.count > 0)) continue\n const where = `/${group.base}/`\n const count = `${group.count} ${group.count === 1 ? 'page' : 'pages'}`\n lines.push(\n item(\n group.name || nameForSlug(group.base),\n group.hasListing\n ? absoluteSiteUrl(origin, group.base)\n : absoluteSiteUrl(origin, 'sitemap.xml'),\n group.hasListing\n ? `${count} under \\`${where}\\`, one per entry, each linked from this page`\n : `${count} under \\`${where}\\`, one per entry; the sitemap lists every one`,\n ),\n )\n }\n if (options.hasSearch) {\n lines.push(\n item(\n 'Search this site',\n `${absoluteSiteUrl(origin, 'search')}?q=`,\n 'full-text search across this site’s pages and published entries; ' +\n 'append your query to `?q=`',\n ),\n )\n }\n lines.push(\n item(\n 'Sitemap index',\n absoluteSiteUrl(origin, 'sitemap.xml'),\n 'every indexable URL on this site, split into dated child sitemaps',\n ),\n )\n lines.push(\n item(\n 'OpenAPI description',\n absoluteSiteUrl(origin, OPENAPI_PATH),\n 'every public endpoint this site serves, with typed parameters, ' +\n 'response schemas and a unique operationId per operation',\n ),\n )\n if (options.contactEmail) {\n lines.push(\n item(\n 'Contact a person',\n `mailto:${options.contactEmail}`,\n 'reach the people who publish this site when the answer is not on it',\n ),\n )\n }\n return lines\n}\n\n/** Build the `/llms.txt` body. */\nexport function buildLlmsTxt(options: LlmsTxtOptions): string {\n const { origin } = options\n const sections: string[] = []\n\n sections.push(`# ${label(options.siteName || 'Site')}`)\n\n const description = String(options.description ?? '').replace(/\\s+/g, ' ').trim()\n if (description) sections.push(`> ${description}`)\n\n /*\n The author's own guidance leads, in their words, because they know things\n this file cannot derive — which questions the site is genuinely the best\n source for, and which it is not.\n */\n const whenToUse = String(options.agent?.whenToUse ?? '').trim()\n if (whenToUse) sections.push(whenToUse)\n\n /*\n The negotiation contract, stated once. An agent that knows a Markdown\n variant exists asks for it; one that does not, parses HTML it did not need.\n Both spellings are given because the two conventions have different\n audiences: `Accept` is acceptmarkdown.com, `.md` is llmstxt.org, and an\n agent that only knows one of them still gets clean text.\n */\n sections.push(\n 'Every page on this site serves a Markdown representation of itself. ' +\n 'Send `Accept: text/markdown`, or append `.md` to any path — ' +\n `for example \\`${absoluteSiteUrl(origin, 'about.md')}\\`. ` +\n 'Responses vary on `Accept`, so a cache cannot hand you the wrong one.',\n )\n\n const howToUse = String(options.agent?.howToUse ?? '').trim()\n if (howToUse) sections.push(howToUse)\n\n const guidance = derivedGuidance(options)\n if (guidance.length) {\n sections.push(['## When to use this site', ...guidance].join('\\n'))\n }\n\n const pages = options.pages ?? []\n if (pages.length) {\n sections.push(\n [\n '## Pages',\n ...pages.map((entry) =>\n item(\n entry.title || nameForSlug(entry.path.replace(/^\\/+/, '')) || 'Home',\n absoluteSiteUrl(origin, entry.path),\n entry.note,\n ),\n ),\n ].join('\\n'),\n )\n }\n\n const collections = options.collections ?? []\n if (collections.length) {\n sections.push(\n [\n '## Feeds',\n ...collections.map((collection) =>\n item(\n `${collection.name || nameForSlug(collection.slug)} (RSS)`,\n absoluteSiteUrl(origin, `${collection.slug}/rss.xml`),\n 'newest entries as RSS 2.0',\n ),\n ),\n ].join('\\n'),\n )\n }\n\n return `${sections.join('\\n\\n').trim()}\\n`\n}\n"],"names":["LLMS_TXT_PATH","OPENAPI_PATH","absoluteSiteUrl","origin","path","base","replace","String","label","value","trim","item","name","url","note","nameForSlug","slug","words","charAt","toUpperCase","slice","derivedGuidance","options","siteName","lines","collection","collections","count","entryCount","push","description","toLowerCase","group","pageGroups","where","hasListing","hasSearch","contactEmail","buildLlmsTxt","sections","whenToUse","agent","howToUse","guidance","length","join","pages","map","entry","title"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCC,GAED,gDAAgD,GAmEhD,wEAAwE,GACxE,OAAO,MAAMA,gBAAgB,YAA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CAACC,QACZrC,KACEqC,MAAMC,KAAK,IAAIlC,YAAYiC,MAAM5C,IAAI,CAACE,OAAO,CAAC,QAAQ,QAAQ,QAC9DJ,gBAAgBC,QAAQ6C,MAAM5C,IAAI,GAClC4C,MAAMlC,IAAI;SAGf,CAAC+B,IAAI,CAAC;IAEX;IAEA,MAAMnB,eAAcJ,uBAAAA,QAAQI,WAAW,YAAnBJ,uBAAuB,EAAE;IAC7C,IAAII,YAAYkB,MAAM,EAAE;QACtBL,SAASV,IAAI,CACX;YACE;eACGH,YAAYqB,GAAG,CAAC,CAACtB,aAClBd,KACE,GAAGc,WAAWb,IAAI,IAAIG,YAAYU,WAAWT,IAAI,EAAE,MAAM,CAAC,EAC1Dd,gBAAgBC,QAAQ,GAAGsB,WAAWT,IAAI,CAAC,QAAQ,CAAC,GACpD;SAGL,CAAC6B,IAAI,CAAC;IAEX;IAEA,OAAO,GAAGN,SAASM,IAAI,CAAC,QAAQnC,IAAI,GAAG,EAAE,CAAC;AAC5C"}
|
|
@@ -35,6 +35,12 @@ export interface MediaAssetFacts {
|
|
|
35
35
|
video?: unknown;
|
|
36
36
|
/** The document's generated `poster` record, when it has one. */
|
|
37
37
|
poster?: unknown;
|
|
38
|
+
/**
|
|
39
|
+
* The document's `contentHash`, which a replace changes with the bytes. An
|
|
40
|
+
* image placement carries it as `mediaVersion`, and the URL it renders is
|
|
41
|
+
* then the versioned one the CDN lets every cache keep (AGL-3485).
|
|
42
|
+
*/
|
|
43
|
+
contentHash?: unknown;
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* Every field an asset's facts are decided from, and the projection a reader
|
|
@@ -43,7 +49,7 @@ export interface MediaAssetFacts {
|
|
|
43
49
|
* three are the gates `serveMediaCdn` applies before it will serve an asset at
|
|
44
50
|
* all, so no surface shows the shape of a file its page's URL refuses.
|
|
45
51
|
*/
|
|
46
|
-
export declare const MEDIA_ASSET_FACT_FIELDS: readonly ["width", "height", "video", "poster", "deletedAt", "private", "visibleTo"];
|
|
52
|
+
export declare const MEDIA_ASSET_FACT_FIELDS: readonly ["width", "height", "video", "poster", "contentHash", "deletedAt", "private", "visibleTo"];
|
|
47
53
|
/** An asset's media document, as far as {@link MEDIA_ASSET_FACT_FIELDS} reach. */
|
|
48
54
|
export type MediaAssetDocument = Partial<Record<(typeof MEDIA_ASSET_FACT_FIELDS)[number], unknown>>;
|
|
49
55
|
/** The elements whose placements follow their file. */
|
|
@@ -97,6 +103,13 @@ export declare function mediaAssetFactsFromDocument(document: MediaAssetDocument
|
|
|
97
103
|
* asset are one entry: a pin names bytes, not a different asset.
|
|
98
104
|
*/
|
|
99
105
|
export declare function mediaAssetRefs(nodes: Record<string, unknown> | null | undefined, options?: MediaAssetFactsOptions): MediaRef[];
|
|
106
|
+
/**
|
|
107
|
+
* The prop an Image placement carries its asset's current content hash in
|
|
108
|
+
* (AGL-3485). Laid on at composition like the pixel pair and never an author
|
|
109
|
+
* control: it describes the file, and `image.tsx` hands it to
|
|
110
|
+
* `resolveMediaSrc` so the page names the versioned URL.
|
|
111
|
+
*/
|
|
112
|
+
export declare const IMAGE_MEDIA_VERSION_PROP = "mediaVersion";
|
|
100
113
|
/**
|
|
101
114
|
* The prop a markdown body carries its images' pixel pairs in, keyed by the
|
|
102
115
|
* target the body wrote (AGL-3149).
|
|
@@ -111,6 +124,8 @@ export declare const BODY_IMAGE_SIZES_PROP = "intrinsicSizes";
|
|
|
111
124
|
export interface BodyImageSize {
|
|
112
125
|
width: number;
|
|
113
126
|
height: number;
|
|
127
|
+
/** The asset's content hash, for the versioned URL (AGL-3485). */
|
|
128
|
+
version?: string;
|
|
114
129
|
}
|
|
115
130
|
/**
|
|
116
131
|
* The composed map with each placed asset's facts laid over its node, and each
|
|
@@ -85,7 +85,7 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
|
|
|
85
85
|
*/ import { CANVAS_ROOT_ELEMENT_ID } from "../foundation/constants/canvas.js";
|
|
86
86
|
import { mediaCdnScopeRefusal, parseMediaCdnScope } from "./media-cdn-scope.js";
|
|
87
87
|
import { intrinsicMediaSize, videoMediaProps } from "./media-metadata.js";
|
|
88
|
-
import { hostQualifiedScope, parseMediaRef } from "./media-ref.js";
|
|
88
|
+
import { hostQualifiedScope, isMediaCdnPath, mediaCdnVersionToken, mediaRefFromCdnPath, parseMediaRef } from "./media-ref.js";
|
|
89
89
|
import { VIDEO_COMPONENT_ID } from "./video-object.js";
|
|
90
90
|
/** The Image element's persisted component id (`image.tsx`), never renamed. */ export const IMAGE_COMPONENT_ID = 'image';
|
|
91
91
|
/**
|
|
@@ -120,6 +120,7 @@ import { VIDEO_COMPONENT_ID } from "./video-object.js";
|
|
|
120
120
|
'height',
|
|
121
121
|
'video',
|
|
122
122
|
'poster',
|
|
123
|
+
'contentHash',
|
|
123
124
|
'deletedAt',
|
|
124
125
|
'private',
|
|
125
126
|
'visibleTo'
|
|
@@ -165,7 +166,8 @@ const owns = (map, key)=>Object.prototype.hasOwnProperty.call(map, key);
|
|
|
165
166
|
width: document.width,
|
|
166
167
|
height: document.height,
|
|
167
168
|
video: document.video,
|
|
168
|
-
poster: document.poster
|
|
169
|
+
poster: document.poster,
|
|
170
|
+
contentHash: document.contentHash
|
|
169
171
|
};
|
|
170
172
|
}
|
|
171
173
|
/** The library asset an Image or Video node places, or null for anything else. */ function placedAsset(node, only) {
|
|
@@ -178,7 +180,19 @@ const owns = (map, key)=>Object.prototype.hasOwnProperty.call(map, key);
|
|
|
178
180
|
// The precedence every other reader of the composed map uses: a node inside
|
|
179
181
|
// a repeated collection carries its bound values in the resolved copy.
|
|
180
182
|
const props = (_ref = node == null ? void 0 : node.resolvedProps) != null ? _ref : node == null ? void 0 : node.props;
|
|
181
|
-
return
|
|
183
|
+
return placedRef(props == null ? void 0 : props['src']);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The library asset a stored `src` names: a `media:` reference, or the
|
|
187
|
+
* site-relative CDN path the first media picker wrote before references
|
|
188
|
+
* existed (AGL-1215). Both name one asset by its id, and the path's are among
|
|
189
|
+
* the oldest placements on the platform — the ones that most need their file's
|
|
190
|
+
* shape read back, since nothing copied it onto the node when they were made.
|
|
191
|
+
* Only the strict root-relative path: a hotlink on another host that happens
|
|
192
|
+
* to contain our route names nothing of ours.
|
|
193
|
+
*/ function placedRef(src) {
|
|
194
|
+
if (isMediaCdnPath(src)) return parseMediaRef(mediaRefFromCdnPath(src));
|
|
195
|
+
return parseMediaRef(src);
|
|
182
196
|
}
|
|
183
197
|
/** A compose-time token the tenant has not substituted — never a document. */ const UNRESOLVED_TOKEN = /^\{\{[^}]+\}\}$/;
|
|
184
198
|
/**
|
|
@@ -355,16 +369,26 @@ const usable = (value)=>typeof value === 'number' && Number.isFinite(value) && v
|
|
|
355
369
|
assetWidth: facts.width,
|
|
356
370
|
assetHeight: facts.height
|
|
357
371
|
});
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
return _extends({}, props, {
|
|
372
|
+
const version = mediaVersionOf(facts);
|
|
373
|
+
const pair = live.intrinsicWidth !== undefined && live.intrinsicHeight !== undefined;
|
|
374
|
+
const pairChanged = pair && (props['intrinsicWidth'] !== live.intrinsicWidth || props['intrinsicHeight'] !== live.intrinsicHeight);
|
|
375
|
+
const versionChanged = version !== undefined && props[IMAGE_MEDIA_VERSION_PROP] !== version;
|
|
376
|
+
if (!pairChanged && !versionChanged) return props;
|
|
377
|
+
return _extends({}, props, pairChanged ? {
|
|
365
378
|
intrinsicWidth: live.intrinsicWidth,
|
|
366
379
|
intrinsicHeight: live.intrinsicHeight
|
|
367
|
-
}
|
|
380
|
+
} : {}, versionChanged ? {
|
|
381
|
+
[IMAGE_MEDIA_VERSION_PROP]: version
|
|
382
|
+
} : {});
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* The prop an Image placement carries its asset's current content hash in
|
|
386
|
+
* (AGL-3485). Laid on at composition like the pixel pair and never an author
|
|
387
|
+
* control: it describes the file, and `image.tsx` hands it to
|
|
388
|
+
* `resolveMediaSrc` so the page names the versioned URL.
|
|
389
|
+
*/ export const IMAGE_MEDIA_VERSION_PROP = 'mediaVersion';
|
|
390
|
+
/** The document's content hash, when it is one a URL can carry. */ function mediaVersionOf(facts) {
|
|
391
|
+
return mediaCdnVersionToken(facts.contentHash) === undefined ? undefined : facts.contentHash;
|
|
368
392
|
}
|
|
369
393
|
/**
|
|
370
394
|
* The prop a markdown body carries its images' pixel pairs in, keyed by the
|
|
@@ -402,10 +426,13 @@ const usable = (value)=>typeof value === 'number' && Number.isFinite(value) && v
|
|
|
402
426
|
continue;
|
|
403
427
|
}
|
|
404
428
|
if (!sizes) sizes = {};
|
|
405
|
-
|
|
429
|
+
const version = mediaVersionOf(found);
|
|
430
|
+
sizes[target] = _extends({
|
|
406
431
|
width: live.intrinsicWidth,
|
|
407
432
|
height: live.intrinsicHeight
|
|
408
|
-
}
|
|
433
|
+
}, version ? {
|
|
434
|
+
version
|
|
435
|
+
} : {});
|
|
409
436
|
}
|
|
410
437
|
if (!sizes) return props;
|
|
411
438
|
return _extends({}, props, {
|