@aglyn/plugins-ai 1.4.0 → 1.6.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 +17 -17
- package/src/lib/components/ai-seo-audit-card.component.d.ts +7 -0
- package/src/lib/components/ai-seo-audit-card.component.js +32 -4
- package/src/lib/components/ai-seo-audit-card.component.js.map +1 -1
- package/src/lib/insights/ai-figure-readers.js +3 -2
- package/src/lib/insights/ai-figure-readers.js.map +1 -1
- package/src/lib/insights/ai-figure-summaries.d.ts +1 -0
- package/src/lib/insights/ai-figure-summaries.js +11 -1
- package/src/lib/insights/ai-figure-summaries.js.map +1 -1
- package/src/lib/insights/ai-insight-digest.js +3 -10
- package/src/lib/insights/ai-insight-digest.js.map +1 -1
- package/src/lib/jobs/ai-job-seo-step.d.ts +4 -0
- package/src/lib/jobs/ai-job-seo-step.js +9 -4
- package/src/lib/jobs/ai-job-seo-step.js.map +1 -1
- package/src/lib/jobs/ai-job-settings-step.d.ts +6 -2
- package/src/lib/jobs/ai-job-settings-step.js +45 -6
- package/src/lib/jobs/ai-job-settings-step.js.map +1 -1
- package/src/lib/jobs/ai-site-publish.js +1 -1
- package/src/lib/jobs/ai-site-publish.js.map +1 -1
- package/src/lib/model/ai-insight.js +2 -5
- package/src/lib/model/ai-insight.js.map +1 -1
- package/src/lib/model/ai-site-entity.d.ts +4 -4
- package/src/lib/model/ai-site-entity.js +3 -3
- package/src/lib/model/ai-site-entity.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-entity.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\nimport { defaultHomeDescription, defaultSiteSeo } from '@aglyn/aglyn/app-utils/default-site'\nimport type { LocalBusinessType } from '@aglyn/aglyn/app-utils/local-business'\nimport { HostEntityType } from '@aglyn/aglyn/foundation/definitions/platform.types'\nimport { aiSiteAddressLine, aiSiteDetailsOf, aiSiteHoursSentence, aiSiteServiceAreas } from './ai-site-details'\nimport { aiSiteKindOfInputs } from './ai-site-kinds'\nimport { aiSiteSeoProposalForInputs, AI_SITE_SEO_FORM_FIELDS, type AiSiteSeoProposal } from './ai-site-start-seo'\n\n/**\n * Who publishes a site a guided start built, as its structured data and its\n * `/llms.txt` say (AGL-3979).\n *\n * Every tenant page publishes a top-level Organization (or Person) node, and\n * `/llms.txt` carries the site's agent guidance, both read off the host's\n * Setup → SEO → Entity and AI agents fields (`siteEntityJsonLd`,\n * `buildLlmsTxt`). Before this, a guided start wrote none of those fields:\n * every AI-built site published a node holding its name and nothing else — no\n * contact point, no address, no business type — and the guidance was the\n * platform's own default. The answers the person gave are the facts those\n * fields ask for, so the publish writes them.\n *\n * ── Derived, never generated ─────────────────────────────────────────────\n *\n * Each value is the person's own words or arithmetic on them: the schema\n * type from the kind of site they picked (and, for a few kinds, the words\n * they used), the description from the same composition as the site's\n * search listing, the guidance from what they said and gave. No model is\n * asked, and nothing is invented: a field the answers say nothing about is\n * left alone.\n *\n * ── Never over the owner ─────────────────────────────────────────────────\n *\n * {@link aiSiteEntityUpdates} writes only fields that are empty, so a site\n * whose owner already filled its Entity keeps every word of it, and a second\n * publish (Try again) writes nothing it wrote before.\n *\n * ── The site's own listing ───────────────────────────────────────────────\n *\n * `/llms.txt` opens with the site's title and description, and every page\n * without its own title falls back to them. A new site is created with its\n * name and a \"Welcome to …\" line there, which nobody chose, so\n * {@link aiSiteListingUpdates} puts the start's listing over that seeded\n * default, and only over it: a title or description the owner changed keeps\n * their words, and the SEO section offers the start's beside them.\n *\n * Pure: no Firestore and no React.\n */\n\n/** How a kind of site publishes: as a person, or as a business of a `schema.org` LocalBusiness type. */\ninterface KindSchema {\n person?: true\n businessType?: LocalBusinessType\n /** A narrower type the person's words name, first match wins. */\n refine?: ReadonlyArray<readonly [RegExp, LocalBusinessType]>\n}\n\n/**\n * Each `AI_SITE_KINDS` entry's `schema.org` type (`ai-site-entity.spec.ts`\n * holds every kind to an entry). A kind with no business type publishes as an\n * Organization — a blog, a band, an event, a course — unless the person gave\n * a street address or opening hours, which make it a place a visitor goes:\n * a LocalBusiness. Only types on the platform's `LOCAL_BUSINESS_TYPES` list\n * are used, since only those publish.\n */\nexport const AI_SITE_KIND_SCHEMA: Readonly<Record<string, KindSchema>> = {\n business: {\n businessType: 'LocalBusiness',\n refine: [\n [/\\b(?:marketing|consult\\w*|agency|freelanc\\w*|staffing|bookkeep\\w*|design(?:er)?s?)\\b/i, 'ProfessionalService'],\n [/\\b(?:car wash|detailing|auto repair|mechanic|tire|tyre)\\b/i, 'AutomotiveBusiness'],\n ],\n },\n trades: {\n businessType: 'HomeAndConstructionBusiness',\n refine: [\n [/\\bplumb\\w*/i, 'Plumber'],\n [/\\belectric\\w*/i, 'Electrician'],\n [/\\b(?:hvac|heating|air condition\\w*|furnace)\\b/i, 'HVACBusiness'],\n [/\\broof\\w*/i, 'RoofingContractor'],\n [/\\bpaint\\w*/i, 'HousePainter'],\n [/\\blocksmith\\w*/i, 'Locksmith'],\n [/\\bmov(?:ing|ers?)\\b/i, 'MovingCompany'],\n [/\\b(?:contractor|remodel\\w*|renovat\\w*|builders?|construction)\\b/i, 'GeneralContractor'],\n ],\n },\n professional: {\n businessType: 'ProfessionalService',\n refine: [\n [/\\b(?:law|lawyers?|attorneys?|legal|solicitors?)\\b/i, 'LegalService'],\n [/\\b(?:accounting|accountants?|bookkeep\\w*|tax|cpa)\\b/i, 'AccountingService'],\n ],\n },\n wellness: {\n businessType: 'HealthAndBeautyBusiness',\n refine: [\n [/\\b(?:dentist\\w*|dental|orthodont\\w*)\\b/i, 'Dentist'],\n [/\\b(?:clinic|doctors?|physicians?|medical|therap\\w*|chiropract\\w*|physio\\w*|counsel\\w*)\\b/i, 'MedicalBusiness'],\n ],\n },\n restaurant: {\n businessType: 'Restaurant',\n refine: [[/\\b(?:caf[eé]s?|coffee|bakery|bakeries|bars?|brewery|food truck|deli)\\b/i, 'FoodEstablishment']],\n },\n store: { businessType: 'Store' },\n portfolio: {},\n studio: { businessType: 'ProfessionalService' },\n photography: { businessType: 'ProfessionalService' },\n blog: {},\n events: {},\n fitness: { businessType: 'SportsActivityLocation' },\n yoga: { businessType: 'SportsActivityLocation' },\n beauty: { businessType: 'HealthAndBeautyBusiness' },\n realestate: { businessType: 'RealEstateAgent' },\n education: { refine: [[/\\b(?:day ?care|child ?care|preschool|nursery)\\b/i, 'ChildCare']] },\n nonprofit: { refine: [[/\\b(?:animal (?:shelter|rescue)|pet rescue)\\b/i, 'AnimalShelter']] },\n music: {},\n personal: { person: true },\n landing: {},\n 'coming-soon': {},\n}\n\n/** The schema a site's answers publish under: a Person, or an Organization with a business type or none. */\nexport interface AiSiteSchema {\n person: boolean\n businessType: LocalBusinessType | null\n}\n\n/** What a job's inputs say the site publishes as. */\nexport function aiSiteSchemaOf(inputs: Readonly<Record<string, unknown>> | null | undefined): AiSiteSchema {\n const kind = aiSiteKindOfInputs(inputs)\n const entry = (kind && AI_SITE_KIND_SCHEMA[kind.id]) || {}\n if (entry.person) return { person: true, businessType: null }\n const words = [inputs?.['businessType'], inputs?.['audience']].filter((value) => typeof value === 'string').join(' ')\n const refined = entry.refine?.find(([pattern]) => pattern.test(words))?.[1]\n const details = aiSiteDetailsOf(inputs)\n const place = Boolean(details.street || details.hours)\n return { person: false, businessType: refined ?? entry.businessType ?? (place ? 'LocalBusiness' : null) }\n}\n\n/** The Entity and AI-agent values a job's answers give; a field they say nothing about is `''` or `[]`. */\nexport interface AiSiteEntityValues {\n person: boolean\n name: string\n description: string\n email: string\n telephone: string\n address: {\n streetAddress: string\n addressLocality: string\n addressRegion: string\n postalCode: string\n addressCountry: string\n }\n /** The street address as one line, as Setup → Details → Business details holds it; `''` without a street. */\n postalAddress: string\n businessType: string\n areaServed: string[]\n openingHours: string\n priceRange: string\n sameAs: string[]\n whenToUse: string\n howToUse: string\n}\n\nconst text = (value: unknown): string => (typeof value === 'string' ? value.replace(/\\s+/g, ' ').trim() : '')\n\n/** \"a, b and c\". */\nfunction listed(parts: readonly string[]): string {\n if (parts.length < 2) return parts.join('')\n return `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1]}`\n}\n\n/**\n * The site's agent guidance from its answers (AGL-3979): when an agent should\n * use the site — what the business is, then what the site answers — and,\n * where the person gave a way to reach it, how to reach a person. Written in\n * English, as the rest of `/llms.txt` is.\n */\nexport function aiSiteAgentGuidance(input: {\n name: string\n description: string\n areas: readonly string[]\n hours: boolean\n prices: boolean\n languages: string\n phone: string\n email: string\n address: string\n}): { whenToUse: string; howToUse: string } {\n const who = input.name || 'this business'\n const answers = [\n `what ${who} offers`,\n ...(input.areas.length ? [`the areas it serves (${input.areas.slice(0, 6).join(', ')})`] : []),\n ...(input.hours ? ['its opening hours'] : []),\n ...(input.prices ? ['its prices'] : []),\n 'how to get in touch',\n ]\n // A site the answers say nothing about gets no guidance: the platform's own\n // derived \"When to use this site\" says more than a sentence about nobody.\n const said = Boolean(input.name || input.description)\n const when = said\n ? [\n input.description,\n `Use this site for ${listed(answers)}.`,\n input.languages ? `It serves customers in ${input.languages.replace(/[.\\s]+$/, '')}.` : '',\n ]\n .filter(Boolean)\n .join(' ')\n : ''\n const reach = [input.phone ? `call ${input.phone}` : '', input.email ? `email ${input.email}` : ''].filter(Boolean)\n const how = [\n reach.length ? `To reach a person at ${who}, ${reach.join(' or ')}.` : '',\n input.address ? `${input.name || 'The business'} is at ${input.address}.` : '',\n ]\n .filter(Boolean)\n .join(' ')\n return { whenToUse: when, howToUse: how }\n}\n\n/**\n * The Entity and AI-agent values a site job's inputs imply, in the language\n * its plan writes the site in. `siteName` is the site's own name: it leads\n * the description and the guidance where the inputs name no business, and is\n * never written as the Entity's name, which falls back to it at render and so\n * follows a rename.\n */\nexport function aiSiteEntityValues(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n options: { language?: string | null; siteName?: string | null } = {},\n): AiSiteEntityValues {\n const details = aiSiteDetailsOf(inputs)\n const schema = aiSiteSchemaOf(inputs)\n const name = text(inputs?.['businessName'])\n const city = text(inputs?.['city'])\n const listing = aiSiteSeoProposalForInputs(inputs, options.language ?? null, options.siteName ?? null)\n const description = listing?.values[AI_SITE_SEO_FORM_FIELDS.description] ?? ''\n const areas = aiSiteServiceAreas(details.serviceArea)\n // A business that names no other area serves the city it is in.\n const areaServed = schema.businessType ? (areas.length ? areas : city ? [city] : []) : []\n const sameAs = details.social ? details.social.split('\\n').filter(Boolean) : []\n const address = details.street ? aiSiteAddressLine(details, city) : ''\n const guidance = aiSiteAgentGuidance({\n name: name || text(options.siteName),\n description,\n areas,\n hours: Boolean(aiSiteHoursSentence(details.hours)),\n prices: Boolean(details.priceRange),\n languages: details.languages,\n phone: details.phone,\n email: details.email,\n address,\n })\n return {\n person: schema.person,\n name,\n description,\n email: details.email,\n telephone: details.phone,\n address: {\n streetAddress: details.street,\n // The city is where the business is only where it gave a street to be on.\n addressLocality: details.street || details.postalCode ? city : '',\n addressRegion: details.region,\n postalCode: details.postalCode,\n addressCountry: details.country,\n },\n postalAddress: address,\n businessType: schema.businessType ?? '',\n areaServed,\n openingHours: details.hours,\n priceRange: details.priceRange,\n sameAs,\n ...guidance,\n }\n}\n\nconst isBlank = (value: unknown): boolean =>\n value === undefined ||\n value === null ||\n (typeof value === 'string' && !value.trim()) ||\n (Array.isArray(value) && !value.some((entry) => typeof entry === 'string' && entry.trim()))\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/** The contact a start's phone or email answers, as the Setup form's **Contact is for** says it: its default. */\nexport const AI_SITE_CONTACT_TYPE = 'customer support'\n\n/**\n * The host updates that put a start's Entity and AI-agent values on its site,\n * as field paths (`seo.entity.telephone`), for the publish's own batch: only\n * fields that are empty on the site, so nothing the owner wrote is replaced.\n * The address is written whole or not at all — a start's street beside the\n * owner's own city would be an address of neither. `{}` when there is\n * nothing to write.\n *\n * Beside the Entity, from what the site already has and the same answers:\n * - the Entity logo is the site's own logo, where it has one and the Entity\n * names none (a Person's Entity picture is their photo, never a logo);\n * - **Contact is for** says what the phone or email this start wrote answers;\n * - Setup → Details → Business details gets the email as the support email\n * (which `{{host.supportEmail}}` and a form that cannot take a message name)\n * and the street address as its one block of text.\n */\nexport function aiSiteEntityUpdates(\n seo: unknown,\n values: AiSiteEntityValues,\n site: { logoUrl?: unknown; business?: unknown } = {},\n): Record<string, unknown> {\n const current = isRecord(seo) ? seo : {}\n const entity = isRecord(current['entity']) ? current['entity'] : {}\n const agent = isRecord(current['agent']) ? current['agent'] : {}\n const business = isRecord(site.business) ? site.business : {}\n const updates: Record<string, unknown> = {}\n const fill = (path: string, now: unknown, next: string | string[]) => {\n if (!isBlank(next) && isBlank(now)) updates[path] = next\n }\n const person = values.person && isBlank(entity['type'])\n // As the Setup form's select stores it: the enum's value as text.\n if (person) updates['seo.entity.type'] = String(HostEntityType.PERSON)\n fill('seo.entity.name', entity['name'], values.name)\n fill('seo.entity.description', entity['description'], values.description)\n fill('seo.entity.email', entity['email'], values.email)\n fill('seo.entity.telephone', entity['telephone'], values.telephone)\n if (updates['seo.entity.email'] || updates['seo.entity.telephone']) {\n fill('seo.entity.contactType', entity['contactType'], AI_SITE_CONTACT_TYPE)\n }\n const address = isRecord(entity['address']) ? entity['address'] : {}\n if (Object.values(address).every(isBlank)) {\n for (const [field, value] of Object.entries(values.address)) {\n if (value) updates[`seo.entity.address.${field}`] = value\n }\n }\n // A Person carries none of a business's fields (`siteEntityJsonLd`).\n const isPerson = person || Number(entity['type']) === HostEntityType.PERSON\n if (!isPerson) {\n fill('seo.entity.logo', entity['logo'], typeof site.logoUrl === 'string' ? site.logoUrl.trim() : '')\n fill('seo.entity.businessType', entity['businessType'], values.businessType)\n fill('seo.entity.areaServed', entity['areaServed'], values.areaServed)\n fill('seo.entity.openingHours', entity['openingHours'], values.openingHours)\n fill('seo.entity.priceRange', entity['priceRange'], values.priceRange)\n }\n fill('seo.entity.sameAs', entity['sameAs'], values.sameAs)\n fill('seo.agent.whenToUse', agent['whenToUse'], values.whenToUse)\n fill('seo.agent.howToUse', agent['howToUse'], values.howToUse)\n fill('business.supportEmail', business['supportEmail'], values.email)\n fill('business.address', business['address'], values.postalAddress)\n return updates\n}\n\n/** Trimmed, or `''` for anything that is not a string: as site creation compares names. */\nconst trimmed = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\n/**\n * Which half of a site's own listing is still the one its creation seeded\n * (AGL-3979): `defaultSiteSeo(name)` — the site's name as its title and\n * \"Welcome to {name}. See what we do, browse our work and get in touch.\" as\n * its description. Blank counts as seeded too: nobody chose it.\n *\n * The title is seeded when it is the site's name, or when it still pairs with\n * a seeded description, as it does on a site renamed after it was made. The\n * description is seeded when it is the welcome line for the site's name, for\n * the title's, or for no name. Anything else is the owner's own words.\n */\nexport function aiSiteListingSeeded(seo: unknown, displayName: unknown): { title: boolean; description: boolean } {\n const current = isRecord(seo) ? seo : {}\n const title = trimmed(current['title'])\n const description = trimmed(current['description'])\n const name = trimmed(displayName)\n const welcomes = new Set([name, title, ''].map((each) => defaultHomeDescription(each)))\n const seededDescription = !description || welcomes.has(description)\n const seededTitle =\n !title ||\n title === trimmed(defaultSiteSeo(name)['title']) ||\n (Boolean(description) && description === defaultHomeDescription(title))\n return { title: seededTitle, description: seededDescription }\n}\n\n/**\n * The host updates that put a start's own listing on its site (AGL-3979), as\n * field paths for the publish's batch: each half only where it is still the\n * seeded default and differs from the listing, so the owner's own title or\n * description is never written over, and a second publish writes nothing.\n * `{}` with no listing to write.\n */\nexport function aiSiteListingUpdates(\n seo: unknown,\n displayName: unknown,\n listing: AiSiteSeoProposal | null,\n): Record<string, string> {\n if (!listing) return {}\n const current = isRecord(seo) ? seo : {}\n const seeded = aiSiteListingSeeded(current, displayName)\n const updates: Record<string, string> = {}\n const title = trimmed(listing.values[AI_SITE_SEO_FORM_FIELDS.title])\n const description = trimmed(listing.values[AI_SITE_SEO_FORM_FIELDS.description])\n if (title && seeded.title && title !== trimmed(current['title'])) updates[AI_SITE_SEO_FORM_FIELDS.title] = title\n if (description && seeded.description && description !== trimmed(current['description'])) {\n updates[AI_SITE_SEO_FORM_FIELDS.description] = description\n }\n return updates\n}\n"],"names":["defaultHomeDescription","defaultSiteSeo","HostEntityType","aiSiteAddressLine","aiSiteDetailsOf","aiSiteHoursSentence","aiSiteServiceAreas","aiSiteKindOfInputs","aiSiteSeoProposalForInputs","AI_SITE_SEO_FORM_FIELDS","AI_SITE_KIND_SCHEMA","business","businessType","refine","trades","professional","wellness","restaurant","store","portfolio","studio","photography","blog","events","fitness","yoga","beauty","realestate","education","nonprofit","music","personal","person","landing","aiSiteSchemaOf","inputs","refined","entry","kind","id","words","filter","value","join","find","pattern","test","details","place","Boolean","street","hours","text","replace","trim","listed","parts","length","slice","aiSiteAgentGuidance","input","who","name","answers","areas","prices","said","description","when","languages","reach","phone","email","how","address","whenToUse","howToUse","aiSiteEntityValues","options","schema","city","listing","language","siteName","values","serviceArea","areaServed","sameAs","social","split","guidance","priceRange","telephone","streetAddress","addressLocality","postalCode","addressRegion","region","addressCountry","country","postalAddress","openingHours","isBlank","undefined","Array","isArray","some","isRecord","AI_SITE_CONTACT_TYPE","aiSiteEntityUpdates","seo","site","current","entity","agent","updates","fill","path","now","next","String","PERSON","Object","every","field","entries","isPerson","Number","logoUrl","trimmed","aiSiteListingSeeded","displayName","title","welcomes","Set","map","each","seededDescription","has","seededTitle","aiSiteListingUpdates","seeded"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,EAAEC,cA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AASxI,uBAAuBwI;IAChF,MAAMC,oBAAoB,CAACtE,eAAekE,SAASK,GAAG,CAACvE;IACvD,MAAMwE,cACJ,CAACP,SACDA,UAAUH,QAAQhI,eAAe6D,KAAK,CAAC,QAAQ,KAC9Cb,QAAQkB,gBAAgBA,gBAAgBnE,uBAAuBoI;IAClE,OAAO;QAAEA,OAAOO;QAAaxE,aAAasE;IAAkB;AAC9D;AAEA;;;;;;CAMC,GACD,OAAO,SAASG,qBACd9B,GAAY,EACZqB,WAAoB,EACpBlD,OAAiC;IAEjC,IAAI,CAACA,SAAS,OAAO,CAAC;IACtB,MAAM+B,UAAUL,SAASG,OAAOA,MAAM,CAAC;IACvC,MAAM+B,SAASX,oBAAoBlB,SAASmB;IAC5C,MAAMhB,UAAkC,CAAC;IACzC,MAAMiB,QAAQH,QAAQhD,QAAQG,MAAM,CAAC3E,wBAAwB2H,KAAK,CAAC;IACnE,MAAMjE,cAAc8D,QAAQhD,QAAQG,MAAM,CAAC3E,wBAAwB0D,WAAW,CAAC;IAC/E,IAAIiE,SAASS,OAAOT,KAAK,IAAIA,UAAUH,QAAQjB,OAAO,CAAC,QAAQ,GAAGG,OAAO,CAAC1G,wBAAwB2H,KAAK,CAAC,GAAGA;IAC3G,IAAIjE,eAAe0E,OAAO1E,WAAW,IAAIA,gBAAgB8D,QAAQjB,OAAO,CAAC,cAAc,GAAG;QACxFG,OAAO,CAAC1G,wBAAwB0D,WAAW,CAAC,GAAGA;IACjD;IACA,OAAOgD;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-entity.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\nimport { defaultHomeDescription, defaultSiteSeo } from '@aglyn/aglyn/app-utils/default-site'\nimport type { LocalBusinessType } from '@aglyn/aglyn/app-utils/local-business'\nimport { HostEntityType } from '@aglyn/aglyn/foundation/definitions/platform.types'\nimport { aiSiteAddressLine, aiSiteDetailsOf, aiSiteHoursSentence, aiSiteServiceAreas } from './ai-site-details'\nimport { aiSiteKindOfInputs } from './ai-site-kinds'\nimport { aiSiteSeoProposalForInputs, AI_SITE_SEO_FORM_FIELDS, type AiSiteSeoProposal } from './ai-site-start-seo'\n\n/**\n * Who publishes a site a guided start built, as its structured data and its\n * `/llms.txt` say (AGL-3979).\n *\n * Every tenant page publishes a top-level Organization (or Person) node, and\n * `/llms.txt` carries the site's agent guidance, both read off the host's\n * Setup → SEO → Entity and AI agents fields (`siteEntityJsonLd`,\n * `buildLlmsTxt`). Before this, a guided start wrote none of those fields:\n * every AI-built site published a node holding its name and nothing else — no\n * contact point, no address, no business type — and the guidance was the\n * platform's own default. The answers the person gave are the facts those\n * fields ask for, so the publish writes them.\n *\n * ── Derived, never generated ─────────────────────────────────────────────\n *\n * Each value is the person's own words or arithmetic on them: the schema\n * type from the kind of site they picked (and, for a few kinds, the words\n * they used), the description from the same composition as the site's\n * search listing, the guidance from what they said and gave. No model is\n * asked, and nothing is invented: a field the answers say nothing about is\n * left alone.\n *\n * ── Never over the owner ─────────────────────────────────────────────────\n *\n * {@link aiSiteEntityUpdates} writes only fields that are empty, so a site\n * whose owner already filled its Entity keeps every word of it, and a second\n * publish (Try again) writes nothing it wrote before.\n *\n * ── The site's own listing ───────────────────────────────────────────────\n *\n * `/llms.txt` opens with the site's title and description, and every page\n * without its own title falls back to them. A new site is created with its\n * name and a \"Welcome to …\" line there, which nobody chose, so\n * {@link aiSiteListingUpdates} puts the start's listing over that seeded\n * default, and only over it: a title or description the owner changed keeps\n * their words, and the SEO section offers the start's beside them.\n *\n * Pure: no Firestore and no React.\n */\n\n/** How a kind of site publishes: as a person, or as a business of a `schema.org` LocalBusiness type. */\ninterface KindSchema {\n person?: true\n businessType?: LocalBusinessType\n /** A narrower type the person's words name, first match wins. */\n refine?: ReadonlyArray<readonly [RegExp, LocalBusinessType]>\n}\n\n/**\n * Each `AI_SITE_KINDS` entry's `schema.org` type (`ai-site-entity.spec.ts`\n * holds every kind to an entry). A kind with no business type publishes as an\n * Organization — a blog, a band, an event, a course — unless the person gave\n * a street address or opening hours, which make it a place a visitor goes:\n * a LocalBusiness. Only types on the platform's `LOCAL_BUSINESS_TYPES` list\n * are used, since only those publish.\n */\nexport const AI_SITE_KIND_SCHEMA: Readonly<Record<string, KindSchema>> = {\n business: {\n businessType: 'LocalBusiness',\n refine: [\n [/\\b(?:marketing|consult\\w*|agency|freelanc\\w*|staffing|bookkeep\\w*|design(?:er)?s?)\\b/i, 'ProfessionalService'],\n [/\\b(?:car wash|detailing|auto repair|mechanic|tire|tyre)\\b/i, 'AutomotiveBusiness'],\n ],\n },\n trades: {\n businessType: 'HomeAndConstructionBusiness',\n refine: [\n [/\\bplumb\\w*/i, 'Plumber'],\n [/\\belectric\\w*/i, 'Electrician'],\n [/\\b(?:hvac|heating|air condition\\w*|furnace)\\b/i, 'HVACBusiness'],\n [/\\broof\\w*/i, 'RoofingContractor'],\n [/\\bpaint\\w*/i, 'HousePainter'],\n [/\\blocksmith\\w*/i, 'Locksmith'],\n [/\\bmov(?:ing|ers?)\\b/i, 'MovingCompany'],\n [/\\b(?:contractor|remodel\\w*|renovat\\w*|builders?|construction)\\b/i, 'GeneralContractor'],\n ],\n },\n professional: {\n businessType: 'ProfessionalService',\n refine: [\n [/\\b(?:law|lawyers?|attorneys?|legal|solicitors?)\\b/i, 'LegalService'],\n [/\\b(?:accounting|accountants?|bookkeep\\w*|tax|cpa)\\b/i, 'AccountingService'],\n ],\n },\n wellness: {\n businessType: 'HealthAndBeautyBusiness',\n refine: [\n [/\\b(?:dentist\\w*|dental|orthodont\\w*)\\b/i, 'Dentist'],\n [/\\b(?:clinic|doctors?|physicians?|medical|therap\\w*|chiropract\\w*|physio\\w*|counsel\\w*)\\b/i, 'MedicalBusiness'],\n ],\n },\n restaurant: {\n businessType: 'Restaurant',\n refine: [[/\\b(?:caf[eé]s?|coffee|bakery|bakeries|bars?|brewery|food truck|deli)\\b/i, 'FoodEstablishment']],\n },\n store: { businessType: 'Store' },\n portfolio: {},\n studio: { businessType: 'ProfessionalService' },\n photography: { businessType: 'ProfessionalService' },\n blog: {},\n events: {},\n fitness: { businessType: 'SportsActivityLocation' },\n yoga: { businessType: 'SportsActivityLocation' },\n beauty: { businessType: 'HealthAndBeautyBusiness' },\n realestate: { businessType: 'RealEstateAgent' },\n education: { refine: [[/\\b(?:day ?care|child ?care|preschool|nursery)\\b/i, 'ChildCare']] },\n nonprofit: { refine: [[/\\b(?:animal (?:shelter|rescue)|pet rescue)\\b/i, 'AnimalShelter']] },\n music: {},\n personal: { person: true },\n landing: {},\n 'coming-soon': {},\n}\n\n/** The schema a site's answers publish under: a Person, or an Organization with a business type or none. */\nexport interface AiSiteSchema {\n person: boolean\n businessType: LocalBusinessType | null\n}\n\n/** What a job's inputs say the site publishes as. */\nexport function aiSiteSchemaOf(inputs: Readonly<Record<string, unknown>> | null | undefined): AiSiteSchema {\n const kind = aiSiteKindOfInputs(inputs)\n const entry = (kind && AI_SITE_KIND_SCHEMA[kind.id]) || {}\n if (entry.person) return { person: true, businessType: null }\n const words = [inputs?.['businessType'], inputs?.['audience']].filter((value) => typeof value === 'string').join(' ')\n const refined = entry.refine?.find(([pattern]) => pattern.test(words))?.[1]\n const details = aiSiteDetailsOf(inputs)\n const place = Boolean(details.street || details.hours)\n return { person: false, businessType: refined ?? entry.businessType ?? (place ? 'LocalBusiness' : null) }\n}\n\n/** The Entity and AI-agent values a job's answers give; a field they say nothing about is `''` or `[]`. */\nexport interface AiSiteEntityValues {\n person: boolean\n name: string\n description: string\n email: string\n telephone: string\n address: {\n streetAddress: string\n addressLocality: string\n addressRegion: string\n postalCode: string\n addressCountry: string\n }\n /** The street address as one line, as the one-block `business.address` holds it; `''` without a street. */\n postalAddress: string\n businessType: string\n areaServed: string[]\n openingHours: string\n priceRange: string\n sameAs: string[]\n whenToUse: string\n howToUse: string\n}\n\nconst text = (value: unknown): string => (typeof value === 'string' ? value.replace(/\\s+/g, ' ').trim() : '')\n\n/** \"a, b and c\". */\nfunction listed(parts: readonly string[]): string {\n if (parts.length < 2) return parts.join('')\n return `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1]}`\n}\n\n/**\n * The site's agent guidance from its answers (AGL-3979): when an agent should\n * use the site — what the business is, then what the site answers — and,\n * where the person gave a way to reach it, how to reach a person. Written in\n * English, as the rest of `/llms.txt` is.\n */\nexport function aiSiteAgentGuidance(input: {\n name: string\n description: string\n areas: readonly string[]\n hours: boolean\n prices: boolean\n languages: string\n phone: string\n email: string\n address: string\n}): { whenToUse: string; howToUse: string } {\n const who = input.name || 'this business'\n const answers = [\n `what ${who} offers`,\n ...(input.areas.length ? [`the areas it serves (${input.areas.slice(0, 6).join(', ')})`] : []),\n ...(input.hours ? ['its opening hours'] : []),\n ...(input.prices ? ['its prices'] : []),\n 'how to get in touch',\n ]\n // A site the answers say nothing about gets no guidance: the platform's own\n // derived \"When to use this site\" says more than a sentence about nobody.\n const said = Boolean(input.name || input.description)\n const when = said\n ? [\n input.description,\n `Use this site for ${listed(answers)}.`,\n input.languages ? `It serves customers in ${input.languages.replace(/[.\\s]+$/, '')}.` : '',\n ]\n .filter(Boolean)\n .join(' ')\n : ''\n const reach = [input.phone ? `call ${input.phone}` : '', input.email ? `email ${input.email}` : ''].filter(Boolean)\n const how = [\n reach.length ? `To reach a person at ${who}, ${reach.join(' or ')}.` : '',\n input.address ? `${input.name || 'The business'} is at ${input.address}.` : '',\n ]\n .filter(Boolean)\n .join(' ')\n return { whenToUse: when, howToUse: how }\n}\n\n/**\n * The Entity and AI-agent values a site job's inputs imply, in the language\n * its plan writes the site in. `siteName` is the site's own name: it leads\n * the description and the guidance where the inputs name no business, and is\n * never written as the Entity's name, which falls back to it at render and so\n * follows a rename.\n */\nexport function aiSiteEntityValues(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n options: { language?: string | null; siteName?: string | null } = {},\n): AiSiteEntityValues {\n const details = aiSiteDetailsOf(inputs)\n const schema = aiSiteSchemaOf(inputs)\n const name = text(inputs?.['businessName'])\n const city = text(inputs?.['city'])\n const listing = aiSiteSeoProposalForInputs(inputs, options.language ?? null, options.siteName ?? null)\n const description = listing?.values[AI_SITE_SEO_FORM_FIELDS.description] ?? ''\n const areas = aiSiteServiceAreas(details.serviceArea)\n // A business that names no other area serves the city it is in.\n const areaServed = schema.businessType ? (areas.length ? areas : city ? [city] : []) : []\n const sameAs = details.social ? details.social.split('\\n').filter(Boolean) : []\n const address = details.street ? aiSiteAddressLine(details, city) : ''\n const guidance = aiSiteAgentGuidance({\n name: name || text(options.siteName),\n description,\n areas,\n hours: Boolean(aiSiteHoursSentence(details.hours)),\n prices: Boolean(details.priceRange),\n languages: details.languages,\n phone: details.phone,\n email: details.email,\n address,\n })\n return {\n person: schema.person,\n name,\n description,\n email: details.email,\n telephone: details.phone,\n address: {\n streetAddress: details.street,\n // The city is where the business is only where it gave a street to be on.\n addressLocality: details.street || details.postalCode ? city : '',\n addressRegion: details.region,\n postalCode: details.postalCode,\n addressCountry: details.country,\n },\n postalAddress: address,\n businessType: schema.businessType ?? '',\n areaServed,\n openingHours: details.hours,\n priceRange: details.priceRange,\n sameAs,\n ...guidance,\n }\n}\n\nconst isBlank = (value: unknown): boolean =>\n value === undefined ||\n value === null ||\n (typeof value === 'string' && !value.trim()) ||\n (Array.isArray(value) && !value.some((entry) => typeof entry === 'string' && entry.trim()))\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/** The contact a start's phone or email answers, as the Setup form's **Contact is for** says it: its default. */\nexport const AI_SITE_CONTACT_TYPE = 'customer support'\n\n/**\n * The host updates that put a start's Entity and AI-agent values on its site,\n * as field paths (`seo.entity.telephone`), for the publish's own batch: only\n * fields that are empty on the site, so nothing the owner wrote is replaced.\n * The address is written whole or not at all — a start's street beside the\n * owner's own city would be an address of neither. `{}` when there is\n * nothing to write.\n *\n * Beside the Entity, from what the site already has and the same answers:\n * - the Entity logo is the site's own logo, where it has one and the Entity\n * names none (a Person's Entity picture is their photo, never a logo);\n * - **Contact is for** says what the phone or email this start wrote answers;\n * - the one-block `business` copies get the email and the street address,\n * the copies Setup → Business profile keeps in step with the entity (AGL-4136) and\n * the native apps still read.\n */\nexport function aiSiteEntityUpdates(\n seo: unknown,\n values: AiSiteEntityValues,\n site: { logoUrl?: unknown; business?: unknown } = {},\n): Record<string, unknown> {\n const current = isRecord(seo) ? seo : {}\n const entity = isRecord(current['entity']) ? current['entity'] : {}\n const agent = isRecord(current['agent']) ? current['agent'] : {}\n const business = isRecord(site.business) ? site.business : {}\n const updates: Record<string, unknown> = {}\n const fill = (path: string, now: unknown, next: string | string[]) => {\n if (!isBlank(next) && isBlank(now)) updates[path] = next\n }\n const person = values.person && isBlank(entity['type'])\n // As the Setup form's select stores it: the enum's value as text.\n if (person) updates['seo.entity.type'] = String(HostEntityType.PERSON)\n fill('seo.entity.name', entity['name'], values.name)\n fill('seo.entity.description', entity['description'], values.description)\n fill('seo.entity.email', entity['email'], values.email)\n fill('seo.entity.telephone', entity['telephone'], values.telephone)\n if (updates['seo.entity.email'] || updates['seo.entity.telephone']) {\n fill('seo.entity.contactType', entity['contactType'], AI_SITE_CONTACT_TYPE)\n }\n const address = isRecord(entity['address']) ? entity['address'] : {}\n if (Object.values(address).every(isBlank)) {\n for (const [field, value] of Object.entries(values.address)) {\n if (value) updates[`seo.entity.address.${field}`] = value\n }\n }\n // A Person carries none of a business's fields (`siteEntityJsonLd`).\n const isPerson = person || Number(entity['type']) === HostEntityType.PERSON\n if (!isPerson) {\n fill('seo.entity.logo', entity['logo'], typeof site.logoUrl === 'string' ? site.logoUrl.trim() : '')\n fill('seo.entity.businessType', entity['businessType'], values.businessType)\n fill('seo.entity.areaServed', entity['areaServed'], values.areaServed)\n fill('seo.entity.openingHours', entity['openingHours'], values.openingHours)\n fill('seo.entity.priceRange', entity['priceRange'], values.priceRange)\n }\n fill('seo.entity.sameAs', entity['sameAs'], values.sameAs)\n fill('seo.agent.whenToUse', agent['whenToUse'], values.whenToUse)\n fill('seo.agent.howToUse', agent['howToUse'], values.howToUse)\n fill('business.supportEmail', business['supportEmail'], values.email)\n fill('business.address', business['address'], values.postalAddress)\n return updates\n}\n\n/** Trimmed, or `''` for anything that is not a string: as site creation compares names. */\nconst trimmed = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\n/**\n * Which half of a site's own listing is still the one its creation seeded\n * (AGL-3979): `defaultSiteSeo(name)` — the site's name as its title and\n * \"Welcome to {name}. See what we do, browse our work and get in touch.\" as\n * its description. Blank counts as seeded too: nobody chose it.\n *\n * The title is seeded when it is the site's name, or when it still pairs with\n * a seeded description, as it does on a site renamed after it was made. The\n * description is seeded when it is the welcome line for the site's name, for\n * the title's, or for no name. Anything else is the owner's own words.\n */\nexport function aiSiteListingSeeded(seo: unknown, displayName: unknown): { title: boolean; description: boolean } {\n const current = isRecord(seo) ? seo : {}\n const title = trimmed(current['title'])\n const description = trimmed(current['description'])\n const name = trimmed(displayName)\n const welcomes = new Set([name, title, ''].map((each) => defaultHomeDescription(each)))\n const seededDescription = !description || welcomes.has(description)\n const seededTitle =\n !title ||\n title === trimmed(defaultSiteSeo(name)['title']) ||\n (Boolean(description) && description === defaultHomeDescription(title))\n return { title: seededTitle, description: seededDescription }\n}\n\n/**\n * The host updates that put a start's own listing on its site (AGL-3979), as\n * field paths for the publish's batch: each half only where it is still the\n * seeded default and differs from the listing, so the owner's own title or\n * description is never written over, and a second publish writes nothing.\n * `{}` with no listing to write.\n */\nexport function aiSiteListingUpdates(\n seo: unknown,\n displayName: unknown,\n listing: AiSiteSeoProposal | null,\n): Record<string, string> {\n if (!listing) return {}\n const current = isRecord(seo) ? seo : {}\n const seeded = aiSiteListingSeeded(current, displayName)\n const updates: Record<string, string> = {}\n const title = trimmed(listing.values[AI_SITE_SEO_FORM_FIELDS.title])\n const description = trimmed(listing.values[AI_SITE_SEO_FORM_FIELDS.description])\n if (title && seeded.title && title !== trimmed(current['title'])) updates[AI_SITE_SEO_FORM_FIELDS.title] = title\n if (description && seeded.description && description !== trimmed(current['description'])) {\n updates[AI_SITE_SEO_FORM_FIELDS.description] = description\n }\n return updates\n}\n"],"names":["defaultHomeDescription","defaultSiteSeo","HostEntityType","aiSiteAddressLine","aiSiteDetailsOf","aiSiteHoursSentence","aiSiteServiceAreas","aiSiteKindOfInputs","aiSiteSeoProposalForInputs","AI_SITE_SEO_FORM_FIELDS","AI_SITE_KIND_SCHEMA","business","businessType","refine","trades","professional","wellness","restaurant","store","portfolio","studio","photography","blog","events","fitness","yoga","beauty","realestate","education","nonprofit","music","personal","person","landing","aiSiteSchemaOf","inputs","refined","entry","kind","id","words","filter","value","join","find","pattern","test","details","place","Boolean","street","hours","text","replace","trim","listed","parts","length","slice","aiSiteAgentGuidance","input","who","name","answers","areas","prices","said","description","when","languages","reach","phone","email","how","address","whenToUse","howToUse","aiSiteEntityValues","options","schema","city","listing","language","siteName","values","serviceArea","areaServed","sameAs","social","split","guidance","priceRange","telephone","streetAddress","addressLocality","postalCode","addressRegion","region","addressCountry","country","postalAddress","openingHours","isBlank","undefined","Array","isArray","some","isRecord","AI_SITE_CONTACT_TYPE","aiSiteEntityUpdates","seo","site","current","entity","agent","updates","fill","path","now","next","String","PERSON","Object","every","field","entries","isPerson","Number","logoUrl","trimmed","aiSiteListingSeeded","displayName","title","welcomes","Set","map","each","seededDescription","has","seededTitle","aiSiteListingUpdates","seeded"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,EAAEC,cAAc,QAAQ,sCAAqC;AA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