@aglyn/plugins-ai 1.0.0-beta.237 → 1.0.0-beta.238

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.
Files changed (128) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-credits-prompt.component.d.ts +11 -4
  3. package/src/lib/components/ai-credits-prompt.component.js +84 -34
  4. package/src/lib/components/ai-credits-prompt.component.js.map +1 -1
  5. package/src/lib/components/ai-job-cancel.component.d.ts +38 -0
  6. package/src/lib/components/ai-job-cancel.component.js +156 -0
  7. package/src/lib/components/ai-job-cancel.component.js.map +1 -0
  8. package/src/lib/components/ai-job-plan.component.js +12 -1
  9. package/src/lib/components/ai-job-plan.component.js.map +1 -1
  10. package/src/lib/components/ai-jobs-list-page.component.js +141 -72
  11. package/src/lib/components/ai-jobs-list-page.component.js.map +1 -1
  12. package/src/lib/components/ai-site-build-page.component.js +22 -2
  13. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  14. package/src/lib/components/ai-usage-strip.component.d.ts +19 -2
  15. package/src/lib/components/ai-usage-strip.component.js +40 -9
  16. package/src/lib/components/ai-usage-strip.component.js.map +1 -1
  17. package/src/lib/components/assist-jobs-drawer.component.js +12 -16
  18. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  19. package/src/lib/components/assist-panel.component.js +87 -51
  20. package/src/lib/components/assist-panel.component.js.map +1 -1
  21. package/src/lib/jobs/ai-job-build-step.js +4 -1
  22. package/src/lib/jobs/ai-job-build-step.js.map +1 -1
  23. package/src/lib/jobs/ai-job-cancel.d.ts +71 -0
  24. package/src/lib/jobs/ai-job-cancel.js +102 -0
  25. package/src/lib/jobs/ai-job-cancel.js.map +1 -0
  26. package/src/lib/jobs/ai-job-component-step.js +4 -1
  27. package/src/lib/jobs/ai-job-component-step.js.map +1 -1
  28. package/src/lib/jobs/ai-job-drafts.js +2 -0
  29. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  30. package/src/lib/jobs/ai-job-form-step.js +4 -1
  31. package/src/lib/jobs/ai-job-form-step.js.map +1 -1
  32. package/src/lib/jobs/ai-job-layout-language.d.ts +2 -0
  33. package/src/lib/jobs/ai-job-layout-language.js +13 -1
  34. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  35. package/src/lib/jobs/ai-job-layout-step.js +6 -1
  36. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  37. package/src/lib/jobs/ai-job-page-language.js +8 -0
  38. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  39. package/src/lib/jobs/ai-job-page-step.js +12 -1
  40. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  41. package/src/lib/jobs/ai-job-plan-step.d.ts +20 -1
  42. package/src/lib/jobs/ai-job-plan-step.js +49 -9
  43. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  44. package/src/lib/jobs/ai-job-site-content.d.ts +15 -0
  45. package/src/lib/jobs/ai-job-site-content.js +66 -7
  46. package/src/lib/jobs/ai-job-site-content.js.map +1 -1
  47. package/src/lib/jobs/ai-job-site-step.js +4 -1
  48. package/src/lib/jobs/ai-job-site-step.js.map +1 -1
  49. package/src/lib/jobs/ai-job-template-step.js +4 -1
  50. package/src/lib/jobs/ai-job-template-step.js.map +1 -1
  51. package/src/lib/jobs/ai-jobs.d.ts +37 -12
  52. package/src/lib/jobs/ai-jobs.js +184 -28
  53. package/src/lib/jobs/ai-jobs.js.map +1 -1
  54. package/src/lib/jobs/ai-layout-stock-photos.d.ts +143 -70
  55. package/src/lib/jobs/ai-layout-stock-photos.js +649 -176
  56. package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
  57. package/src/lib/jobs/fixtures/ai-ceramics-portfolio-site-plan.d.ts +30 -0
  58. package/src/lib/jobs/fixtures/ai-ceramics-portfolio-site-plan.js +220 -0
  59. package/src/lib/jobs/fixtures/ai-ceramics-portfolio-site-plan.js.map +1 -0
  60. package/src/lib/jobs/fixtures/ai-stock-photo-pixabay-recordings.d.ts +27 -0
  61. package/src/lib/jobs/fixtures/ai-stock-photo-pixabay-recordings.js +151 -0
  62. package/src/lib/jobs/fixtures/ai-stock-photo-pixabay-recordings.js.map +1 -0
  63. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
  64. package/src/lib/layout-language/ai-layout-compiler.js +304 -8
  65. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  66. package/src/lib/layout-language/ai-layout-design.d.ts +6 -3
  67. package/src/lib/layout-language/ai-layout-design.js +5 -3
  68. package/src/lib/layout-language/ai-layout-design.js.map +1 -1
  69. package/src/lib/layout-language/ai-layout-frame.d.ts +12 -0
  70. package/src/lib/layout-language/ai-layout-frame.js +58 -3
  71. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  72. package/src/lib/layout-language/ai-layout-listings.d.ts +13 -1
  73. package/src/lib/layout-language/ai-layout-listings.js +61 -46
  74. package/src/lib/layout-language/ai-layout-listings.js.map +1 -1
  75. package/src/lib/layout-language/ai-layout-pictures.d.ts +8 -0
  76. package/src/lib/layout-language/ai-layout-pictures.js.map +1 -1
  77. package/src/lib/layout-language/ai-layout-storefront.d.ts +82 -0
  78. package/src/lib/layout-language/ai-layout-storefront.js +223 -0
  79. package/src/lib/layout-language/ai-layout-storefront.js.map +1 -0
  80. package/src/lib/model/ai-build-job.d.ts +9 -1
  81. package/src/lib/model/ai-build-job.js +19 -5
  82. package/src/lib/model/ai-build-job.js.map +1 -1
  83. package/src/lib/model/ai-build-progress.d.ts +2 -2
  84. package/src/lib/model/ai-build-progress.js +6 -4
  85. package/src/lib/model/ai-build-progress.js.map +1 -1
  86. package/src/lib/model/ai-credit-estimate.d.ts +69 -2
  87. package/src/lib/model/ai-credit-estimate.js +91 -3
  88. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  89. package/src/lib/model/ai-job-cancel-copy.d.ts +44 -0
  90. package/src/lib/model/ai-job-cancel-copy.js +53 -0
  91. package/src/lib/model/ai-job-cancel-copy.js.map +1 -0
  92. package/src/lib/model/ai-job-failure-copy.d.ts +4 -1
  93. package/src/lib/model/ai-job-failure-copy.js +8 -3
  94. package/src/lib/model/ai-job-failure-copy.js.map +1 -1
  95. package/src/lib/model/ai-jobs.types.d.ts +20 -0
  96. package/src/lib/model/ai-jobs.types.js.map +1 -1
  97. package/src/lib/model/ai-site-build-progress.js +7 -4
  98. package/src/lib/model/ai-site-build-progress.js.map +1 -1
  99. package/src/lib/model/ai-site-job.d.ts +19 -2
  100. package/src/lib/model/ai-site-job.js +29 -8
  101. package/src/lib/model/ai-site-job.js.map +1 -1
  102. package/src/lib/model/ai-site-kinds.d.ts +4 -1
  103. package/src/lib/model/ai-site-kinds.js +34 -6
  104. package/src/lib/model/ai-site-kinds.js.map +1 -1
  105. package/src/lib/runtime/ai-doctrine-validators.d.ts +37 -1
  106. package/src/lib/runtime/ai-doctrine-validators.js +151 -6
  107. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  108. package/src/lib/runtime/ai-doctrine.js +4 -3
  109. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  110. package/src/lib/runtime/ai-palette.generated.js +53 -7
  111. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  112. package/src/lib/server/ai-jobs-cancel.d.ts +13 -5
  113. package/src/lib/server/ai-jobs-cancel.js +27 -9
  114. package/src/lib/server/ai-jobs-cancel.js.map +1 -1
  115. package/src/lib/server/ai-jobs-gate.d.ts +12 -2
  116. package/src/lib/server/ai-jobs-gate.js +20 -9
  117. package/src/lib/server/ai-jobs-gate.js.map +1 -1
  118. package/src/lib/usage/ai-usage-meter.d.ts +2 -1
  119. package/src/lib/usage/ai-usage-meter.js +17 -1
  120. package/src/lib/usage/ai-usage-meter.js.map +1 -1
  121. package/src/lib/usage/ai-usage-wire.d.ts +6 -0
  122. package/src/lib/usage/ai-usage-wire.js.map +1 -1
  123. package/src/lib/usage/assist-usage.d.ts +7 -0
  124. package/src/lib/usage/assist-usage.js +14 -4
  125. package/src/lib/usage/assist-usage.js.map +1 -1
  126. package/src/lib/usage/free-ai-credits-left.d.ts +7 -0
  127. package/src/lib/usage/free-ai-credits-left.js +4 -2
  128. package/src/lib/usage/free-ai-credits-left.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-layout-stock-photos.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 {\n pluginMediaIngest,\n type PluginMediaIngest,\n type PluginMediaIngestResult,\n} from '@aglyn/aglyn/plugin-manager/plugin-media-ingest'\nimport {\n STOCK_PHOTO_QUERY_MAX_CHARS,\n stockPhotoProvider,\n stockPhotoSourceKey,\n type StockPhoto,\n type StockPhotoOrientation,\n type StockPhotoProvider,\n type StockPhotoSearchRequest,\n} from '@aglyn/aglyn/plugin-manager/stock-photo-provider'\nimport type { NodesMap } from '@aglyn/aglyn/types/nodes'\nimport {\n aiLayoutSeedNumber,\n type AiLayoutPicturePhoto,\n type AiLayoutPictureSlot,\n type AiLayoutPictureSource,\n} from '../layout-language/ai-layout-pictures'\n\n/**\n * STOCK PHOTOS FOR A LANGUAGE PAGE'S PICTURE SLOTS (AGL-3660).\n *\n * The source `aiResolveLayoutPictures` asks before it falls back to the\n * starter photos. It names no library: it asks core for the deployment's\n * stock photo provider (`core.stock-photos`) and for the media library's\n * server door (`core.media-ingest`), and builds no source at all when either\n * is missing, so a deployment without a key behaves exactly as before.\n *\n * For each slot, in document order:\n *\n * 1. **Search.** Plain words. The hero asks for the kind of business (the\n * head of the site's business type, \"yoga studio\" from \"a family-owned\n * yoga studio in Austin\"). Any other picture asks for its SUBJECT: the\n * noun phrase that opens the alt text the model wrote, its filler\n * adjectives dropped (\"serving bowl\" from \"A beautiful hand-thrown serving\n * bowl on a linen cloth\"), qualified by the site's craft where the phrase\n * does not already say it (\"serving bowl ceramic\" for a ceramics studio).\n * An about picture asks for people. The orientation and a minimum size\n * come from the slot's frame. The provider caches every search for a day\n * and keeps its own rate limit; one page never asks the same words twice.\n * 2. **Rank.** A picture of a thing must show the thing: every hit is scored\n * by how many of the subject's words its tags, its description and its\n * page's address name (singular and plural alike, the head noun counting\n * double), and a hit naming none of them never fills a picture of a\n * thing. The live Juniper Clay start put crackers under \"Serving bowl\"\n * and plants under \"Espresso cup\". Among the best-scored hits the job's\n * seed picks, so two sites built from the same words rarely open with the\n * same photo while one job always picks the same.\n * 3. **Never twice.** A photo is placed once per job: not twice on a page,\n * and not on a page when another page (or another pass, in this process)\n * of the same job already placed it — the maker's portrait in About is\n * never a vase in Selected work. The caller hands in what the job's other\n * pages hold (`avoid`); a pass repeated over its own page keeps its own.\n * 4. **Fall back.** A picture of a thing nothing relevant answered asks once\n * more for the place itself (\"ceramics studio interior\"), a neutral photo\n * any caption sits under, before it is left to a starter photo.\n * 5. **Keep.** A photo the site's library already holds (by its source key)\n * is reused; otherwise its bytes are downloaded from the library and\n * stored in the site's own media library as the member who started the\n * job, credited to its photographer. The page names the site's asset,\n * never the library's address.\n *\n * A slot that finds nothing, any error, a refusal from the library (its\n * storage band, say) or the time running out leaves the slot to a starter\n * photo. Nothing here throws, and none of it is an AI model call: photos cost\n * no AI credits.\n */\n\n/** Wall clock the whole page's photos may take, inside the step's own signal. */\nexport const AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS = 20_000\n\n/** Searches one page may send to the provider; a repeated query is answered from the page's own memory. */\nexport const AI_LAYOUT_STOCK_SEARCHES_PER_PAGE = 12\n\n/** The hits a pick is made among. */\nexport const AI_LAYOUT_STOCK_PICK_WINDOW = 8\n\n/** The ranked hits one search may try to place before the slot moves to its next search. */\nconst AI_LAYOUT_STOCK_TRIES_PER_SEARCH = 3\n\n/** The largest photo copied: inside one direct upload. */\nexport const AI_LAYOUT_STOCK_MAX_BYTES = 3 * 1024 * 1024\n\n/**\n * The unit job input naming the screen drafts the job's other pages were\n * written to, whose photos a page does not place again (AGL-3660).\n */\nexport const AI_STOCK_PHOTO_PAGES_INPUT = 'stockPhotoPages'\n\n/** Words that carry no subject. */\nconst STOPWORDS = new Set(\n (\n 'a an the and or of in on at to for with from by into onto over under near our your their my his her its ' +\n 'this that these those is are be being was were who whom which where while as about than then very just ' +\n 'small local best new top quality premium family-owned family owned independent professional ' +\n 'business company shop services service site website page photo picture image showing shows show ' +\n 'someone people person one two three some many several'\n ).split(' '),\n)\n\n/**\n * Words that describe a picture's look, not what it shows, dropped from a\n * subject. A word that is as often a noun (\"light\", \"set\") is not one.\n */\nconst FILLER = new Set(\n (\n 'beautiful beautifully stunning gorgeous lovely pretty elegant modern contemporary rustic cozy cosy warm cool ' +\n 'soft bright natural simple minimal minimalist delicate unique special artisan artisanal handmade ' +\n 'hand-made hand-thrown handthrown hand-crafted handcrafted crafted hand-built handbuilt finished styled perfect ' +\n 'fresh clean calm serene quiet peaceful vibrant colorful colourful sunlit sunny golden glossy matte textured ' +\n 'close-up closeup up view views detail details detailed shot shots overhead flat lay flatlay flat-lay ' +\n 'top-down wide angle featuring featured displayed arranged sitting resting placed standing lined ' +\n 'single pair collection assortment selection group few various array range large tiny big little ' +\n 'white black grey gray beige cream ivory brown tan blue green red pink yellow orange purple speckled ' +\n 'gentle airy inviting welcoming cheerful happy smiling friendly'\n ).split(' '),\n)\n\n/** The nouns that name a place of business, not its craft: \"studio\" in \"ceramics studio\". */\nconst VENUES = new Set(\n (\n 'studio studios shop shops store stores boutique company co workshop gallery atelier agency brand practice ' +\n 'salon house collective lab market services service firm clinic center centre parlor parlour bar ' +\n 'class classes lessons school academy'\n ).split(' '),\n)\n\n/** Lowercase words, letters only, without stopwords. */\nfunction contentWords(text: string): string[] {\n return text\n .toLowerCase()\n .replace(/https?:\\/\\/\\S+|\\S+@\\S+|\\+?\\d[\\d\\s().-]{5,}\\d/g, ' ')\n .replace(/[^a-zÀ-ɏ\\s-]/g, ' ')\n .split(/\\s+/)\n .map((word) => word.replace(/^-+|-+$/g, ''))\n .filter((word) => word.length > 1 && !STOPWORDS.has(word))\n}\n\n/**\n * A word's singular, for matching only: \"bowls\" and \"bowl\", \"vases\" and\n * \"vase\", \"berries\" and \"berry\", \"dishes\" and \"dish\" meet. Both sides of a\n * comparison are reduced the same way, so an odd stem still matches itself.\n */\nexport function aiStockStem(word: string): string {\n const lower = word.toLowerCase()\n if (lower.length > 4 && lower.endsWith('ies')) return `${lower.slice(0, -3)}y`\n if (lower.length > 4 && /(?:ches|shes|sses|xes|zes)$/.test(lower)) return lower.slice(0, -2)\n if (lower.length > 3 && lower.endsWith('s') && !/(?:ss|us|is)$/.test(lower)) return lower.slice(0, -1)\n return lower\n}\n\n/** A text's words as stems; a hyphenated word counts as its parts. */\nfunction stems(text: string): Set<string> {\n const out = new Set<string>()\n for (const word of text.toLowerCase().split(/[^a-zÀ-ɏ]+/)) {\n if (word.length > 1) out.add(aiStockStem(word))\n }\n return out\n}\n\n/** Where a noun phrase ends: punctuation, a preposition, a conjunction. */\nconst CLAUSE_BREAK =\n /[,;:.()]|\\s[-–—]\\s|\\b(?:with|on|in|at|against|beside|next|near|under|over|by|from|for|during|while|atop|inside|across|beneath|through|into|onto|amid|among|and|of|that|which|who)\\b|&/\n\n/**\n * The kind of business in a few words: the first clause of the business\n * type, before a place or an audience, its last three content words (the\n * head of an English noun phrase is at its end).\n */\nexport function aiStockBusinessWords(businessType: string): string {\n const clause = businessType\n .toLowerCase()\n .split(/[,;:.()]|\\s[-–—]\\s|\\b(?:in|for|near|serving|based|located|that|which|who|with|from|since|and|&)\\b/)[0]\n const words = contentWords(clause ?? '')\n return words.slice(-3).join(' ')\n}\n\n/**\n * The business's craft in one word: the last of its words that is not the\n * place it is done in, singular — \"ceramic\" from \"small-batch ceramics\n * studio\", \"yoga\" from \"yoga studio\". Empty when the business is only a\n * place (\"a shop\").\n */\nexport function aiStockCraftWords(business: string): string {\n const words = business.split(/\\s+/).filter((word) => word && !VENUES.has(word) && !FILLER.has(word))\n const craft = words[words.length - 1]\n return craft ? aiStockStem(craft) : ''\n}\n\n/** A phrase's content words without its filler; all filler, and nothing is left. */\nfunction subjectOf(words: readonly string[]): string[] {\n return words.filter((word) => !FILLER.has(word))\n}\n\n/**\n * A picture's subject in a few words (AGL-3660): the noun phrase its alt\n * text opens with — its first clause holding more than filler, cut where a\n * preposition starts the setting, filler dropped, its last three words (the\n * head noun is the last) — else its section's name.\n */\nexport function aiStockSubjectWords(alt: string, sectionName: string): string {\n for (const clause of alt.toLowerCase().split(CLAUSE_BREAK)) {\n const words = subjectOf(contentWords(clause ?? ''))\n if (words.length) return words.slice(-3).join(' ')\n }\n return subjectOf(contentWords(sectionName)).slice(0, 2).join(' ')\n}\n\nconst clip = (query: string) => query.replace(/\\s+/g, ' ').trim().slice(0, STOCK_PHOTO_QUERY_MAX_CHARS).trim()\n\n/** The frame's orientation: a wide frame wants a landscape photo, a tall one a portrait. */\nexport function aiStockOrientation(aspect: number): StockPhotoOrientation {\n if (aspect > 1.15) return 'horizontal'\n if (aspect < 0.87) return 'vertical'\n return 'any'\n}\n\n/**\n * One search a slot tries. A gallery picture's searches must find a hit\n * naming its subject; a `neutral` one asks for the place itself, which any\n * caption sits under.\n */\nexport interface AiStockSearch extends StockPhotoSearchRequest {\n neutral?: boolean\n}\n\n/** The searches a slot tries, in order, most specific first, each distinct. */\nexport function aiStockSearchesFor(\n slot: Pick<AiLayoutPictureSlot, 'role' | 'alt' | 'aspect'>,\n words: { business: string; subject: string; craft?: string },\n): AiStockSearch[] {\n const orientation = aiStockOrientation(slot.aspect)\n const size =\n slot.role === 'hero'\n ? { minWidth: 1600 }\n : orientation === 'vertical'\n ? { minHeight: 900 }\n : { minWidth: 900 }\n const craft = words.craft ?? aiStockCraftWords(words.business)\n const subjectStems = stems(words.subject)\n // The craft qualifies a subject that does not already say it.\n const qualified =\n craft && [...stems(craft)].some((stem) => !subjectStems.has(stem)) ? `${words.subject} ${craft}` : words.subject\n const place = words.business.split(/\\s+/).some((word) => VENUES.has(word))\n ? `${words.business} interior`\n : words.business\n const queries: Array<{ query: string; neutral?: boolean }> =\n slot.role === 'hero'\n ? [{ query: words.business }, { query: `${words.business} ${words.subject}` }]\n : slot.role === 'about'\n ? [{ query: `${words.business} ${words.subject}` }, { query: words.business }]\n : words.subject\n ? [{ query: qualified }, { query: words.subject }, { query: place, neutral: true }]\n : [{ query: place, neutral: true }]\n const seen = new Set<string>()\n const searches: AiStockSearch[] = []\n for (const raw of queries) {\n const query = clip(raw.query)\n if (!query || seen.has(query)) continue\n seen.add(query)\n searches.push({\n query,\n orientation,\n ...size,\n ...(slot.role === 'about' ? { people: true } : {}),\n ...(raw.neutral ? { neutral: true } : {}),\n })\n }\n return searches\n}\n\n/**\n * How well a hit names a subject (AGL-3660): each subject word its tags, its\n * description or its page's address names counts once, the head noun (the\n * subject's last word) twice, and a craft word a quarter, as a tiebreak.\n * Zero when it names none of the subject.\n */\nexport function aiStockRelevance(\n photo: Pick<StockPhoto, 'tags' | 'alt' | 'pageUrl'>,\n terms: { subject: string; craft?: string },\n): number {\n const subject = terms.subject.split(/\\s+/).filter(Boolean).map(aiStockStem)\n if (!subject.length) return 0\n let slug: string\n try {\n slug = new URL(photo.pageUrl).pathname\n } catch {\n slug = ''\n }\n const named = stems([...(photo.tags ?? []), photo.alt ?? '', slug].join(' '))\n const head = subject[subject.length - 1] as string\n let score = 0\n for (const word of new Set(subject)) {\n if (named.has(word)) score += word === head ? 2 : 1\n }\n if (score === 0) return 0\n for (const word of new Set((terms.craft ?? '').split(/\\s+/).filter(Boolean).map(aiStockStem))) {\n if (named.has(word)) score += 0.25\n }\n return score\n}\n\nexport interface AiStockRankOptions {\n /** The words a hit is scored by; none, and every hit scores alike. */\n subject?: string\n craft?: string\n /** A hit naming none of the subject is no candidate at all. */\n strict?: boolean\n}\n\n/**\n * A search's hits in the order they are tried (AGL-3660): those not placed\n * yet, among the first few, best-scored first; the seed turns the hits that\n * score alike, so two jobs differ and one job repeats itself.\n */\nexport function aiStockRank(\n photos: readonly StockPhoto[],\n used: ReadonlySet<string>,\n seed: string,\n options: AiStockRankOptions = {},\n): StockPhoto[] {\n const subject = options.subject ?? ''\n const scored = photos\n .filter((photo) => !used.has(stockPhotoSourceKey(photo)))\n .slice(0, AI_LAYOUT_STOCK_PICK_WINDOW)\n .map((photo) => ({\n photo,\n score: subject ? aiStockRelevance(photo, { subject, ...(options.craft ? { craft: options.craft } : {}) }) : 0,\n }))\n .filter((entry) => !options.strict || !subject || entry.score > 0)\n if (!scored.length) return []\n const turn = aiLayoutSeedNumber(seed)\n const ranked: StockPhoto[] = []\n for (const score of [...new Set(scored.map((entry) => entry.score))].sort((a, b) => b - a)) {\n const tier = scored.filter((entry) => entry.score === score)\n const start = turn % tier.length\n for (const entry of [...tier.slice(start), ...tier.slice(0, start)]) ranked.push(entry.photo)\n }\n return ranked\n}\n\n/** The pick among a search's hits: the first {@link aiStockRank} would try, or `null`. */\nexport function aiStockPick(\n photos: readonly StockPhoto[],\n used: ReadonlySet<string>,\n seed: string,\n options: AiStockRankOptions = {},\n): StockPhoto | null {\n return aiStockRank(photos, used, seed, options)[0] ?? null\n}\n\n/**\n * The library photos a stored page already shows: every `image` whose\n * source is the site's media reference. Starter photos are the platform's,\n * not the job's, and are not listed.\n */\nexport function aiStockPlacedSrcs(nodes: NodesMap | null | undefined): string[] {\n const map = (nodes ?? {}) as unknown as Record<string, { componentId?: string; props?: Record<string, unknown> }>\n const out: string[] = []\n for (const node of Object.values(map)) {\n const src = node?.componentId === 'image' ? node.props?.['src'] : null\n if (typeof src === 'string' && src.startsWith('media:')) out.push(src)\n }\n return out\n}\n\n/**\n * What this process has placed for each job, by source key and asset src,\n * with the scope (the page's seed) that placed it (AGL-3660). It spans the\n * passes of one job that run here, so a page, the products or a post built\n * later does not place what an earlier one did, while a pass repeated over\n * its own page keeps its own photos. Bounded; the oldest job goes first.\n */\nconst JOB_PHOTOS = new Map<string, Map<string, string>>()\nconst JOB_PHOTOS_MAX = 200\n\nfunction jobPhotos(key: string | null): Map<string, string> | null {\n if (!key) return null\n let placed = JOB_PHOTOS.get(key)\n if (!placed) {\n placed = new Map()\n JOB_PHOTOS.set(key, placed)\n while (JOB_PHOTOS.size > JOB_PHOTOS_MAX) {\n const oldest = JOB_PHOTOS.keys().next().value\n if (oldest === undefined) break\n JOB_PHOTOS.delete(oldest)\n }\n }\n return placed\n}\n\n/** Forgets every job's placed photos; for specs. */\nexport function aiStockForgetJobPhotos(): void {\n JOB_PHOTOS.clear()\n}\n\nconst EXTENSIONS: Record<string, string> = { 'image/jpeg': 'jpg', 'image/png': 'png', 'image/webp': 'webp' }\n\nexport interface AiLayoutStockPhotoSourceInput {\n hostId: string\n /** The member the photos are stored as: the job's creator. */\n uid: string\n /** The job's seed, as the starter photos turn by; also the scope a photo is placed under. */\n seed: string\n /** The site's business type, else the job's brief. */\n business: string\n /** The page's section names, by plan index. */\n sectionNames: readonly string[]\n /**\n * The job the member started (`aiOriginJobId`), so a photo is placed once\n * across its pages. Absent, only the page itself is kept free of repeats.\n */\n jobId?: string\n /** Asset srcs or source keys the job's other pages already show. */\n avoid?: readonly string[]\n signal?: AbortSignal\n}\n\nexport interface AiLayoutStockPhotoDeps {\n provider?: () => StockPhotoProvider | null\n ingest?: () => PluginMediaIngest | null\n budgetMs?: number\n}\n\n/**\n * The source for one page, or `null` when this deployment has no stock\n * photo library or no media door, which leaves every slot to the starters.\n */\nexport function aiLayoutStockPhotoSource(\n input: AiLayoutStockPhotoSourceInput,\n deps: AiLayoutStockPhotoDeps = {},\n): AiLayoutPictureSource | null {\n const provider = (deps.provider ?? stockPhotoProvider)()\n const ingest = (deps.ingest ?? pluginMediaIngest)()\n if (!provider || !ingest || !input.hostId || !input.uid) return null\n const business = aiStockBusinessWords(input.business)\n const craft = aiStockCraftWords(business)\n return async (slots) => {\n const timeout = AbortSignal.timeout(deps.budgetMs ?? AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS)\n const signal = input.signal ? AbortSignal.any([input.signal, timeout]) : timeout\n const scope = input.seed\n const job = jobPhotos(input.jobId ? `${input.hostId}:${input.jobId}` : null)\n const avoid = new Set(input.avoid ?? [])\n /** Placed elsewhere in the job: by another page in this process, or one the caller read. */\n const elsewhere = (key: string) => avoid.has(key) || (job?.has(key) === true && job.get(key) !== scope)\n /** Source keys this page has placed or turned down. */\n const used = new Set<string>()\n /** Asset srcs this page has placed. */\n const placedSrcs = new Set<string>()\n const answers = new Map<string, StockPhoto[]>()\n let searches = 0\n let storing = true\n const remember = (sourceKey: string, src: string) => {\n placedSrcs.add(src)\n job?.set(sourceKey, scope)\n job?.set(src, scope)\n }\n /** A search's hits; the same words twice are answered from memory, and `null` once the page's searches are spent. */\n const search = async (wanted: AiStockSearch): Promise<StockPhoto[] | null> => {\n const request: StockPhotoSearchRequest = { ...wanted }\n delete (request as AiStockSearch).neutral\n const key = JSON.stringify([request.query, request.orientation, request.people === true])\n const known = answers.get(key)\n if (known) return known\n if (searches >= AI_LAYOUT_STOCK_SEARCHES_PER_PAGE) return null\n searches += 1\n let found: StockPhoto[]\n try {\n found = (await provider.search(request, { signal }))?.photos ?? []\n } catch {\n found = []\n }\n answers.set(key, found)\n return found\n }\n /** The photo placed in the site's library, a copy it holds or a new one; `null` when it cannot be placed. */\n const keep = async (\n photo: StockPhoto,\n slot: AiLayoutPictureSlot,\n query: string,\n ): Promise<AiLayoutPicturePhoto | null> => {\n const sourceKey = stockPhotoSourceKey(photo)\n used.add(sourceKey)\n try {\n const kept = await ingest.findStockPhoto({ hostId: input.hostId, sourceKey })\n if (kept) {\n // Held because a slot of this page or another page of the job shows it.\n if (placedSrcs.has(kept.src) || elsewhere(kept.src)) return null\n remember(sourceKey, kept.src)\n return { src: kept.src, width: kept.width ?? photo.width, height: kept.height ?? photo.height }\n }\n // A refusal to store (the storage band, a lockdown) holds for the\n // whole page, so the rest of it reuses what it can and copies nothing.\n if (!storing) return null\n const bytes = await provider.download(photo, { maxBytes: AI_LAYOUT_STOCK_MAX_BYTES, signal })\n if (!bytes || signal.aborted) return null\n const credit = provider.credit(photo)\n const stored = await ingest.ingest({\n hostId: input.hostId,\n uid: input.uid,\n fileName: `${photo.provider}-${photo.id}.${EXTENSIONS[bytes.contentType] ?? 'jpg'}`,\n contentType: bytes.contentType,\n bytes: bytes.bytes,\n alt: slot.alt,\n description: credit.text,\n stockPhoto: {\n key: sourceKey,\n provider: photo.provider,\n providerLabel: credit.providerLabel,\n id: photo.id,\n pageUrl: photo.pageUrl,\n photographer: photo.photographer,\n ...(photo.photographerUrl ? { photographerUrl: photo.photographerUrl } : {}),\n license: credit.license,\n licenseUrl: credit.licenseUrl,\n attributionRequired: credit.attributionRequired,\n query,\n },\n })\n if (stored.ok) {\n remember(sourceKey, stored.src)\n return { src: stored.src, width: stored.width ?? photo.width, height: stored.height ?? photo.height }\n }\n storing = false\n const refusal = stored as Extract<PluginMediaIngestResult, { ok: false }>\n console.warn('ai layout pictures: the media library refused a stock photo', {\n status: refusal.status,\n reason: refusal.reason,\n })\n } catch (error) {\n console.warn('ai layout pictures: a stock photo could not be kept', { error: String(error) })\n }\n return null\n }\n const photos: Array<AiLayoutPicturePhoto | null> = []\n for (const [index, slot] of slots.entries()) {\n if (signal.aborted) {\n photos.push(null)\n continue\n }\n const subject = aiStockSubjectWords(slot.alt, input.sectionNames[slot.sectionIndex] ?? '')\n let placed: AiLayoutPicturePhoto | null = null\n for (const request of aiStockSearchesFor(slot, { business, subject, craft })) {\n if (placed || signal.aborted) break\n const found = await search(request)\n if (found === null) break\n // A gallery picture names a thing, and only a hit naming it fills it;\n // a hero, an about picture and the neutral search rank, unfiltered.\n const blocked = new Set(used)\n for (const hit of found) {\n const key = stockPhotoSourceKey(hit)\n if (elsewhere(key)) blocked.add(key)\n }\n const ranked = aiStockRank(found, blocked, `${input.seed}:${index}:${request.query}`, {\n subject: request.neutral ? craft || business : subject,\n craft,\n strict: slot.role === 'gallery' && !request.neutral,\n })\n for (const photo of ranked.slice(0, AI_LAYOUT_STOCK_TRIES_PER_SEARCH)) {\n if (signal.aborted) break\n placed = await keep(photo, slot, request.query)\n if (placed) break\n }\n }\n photos.push(placed)\n }\n return photos\n }\n}\n"],"names":["pluginMediaIngest","STOCK_PHOTO_QUERY_MAX_CHARS","stockPhotoProvider","stockPhotoSourceKey","aiLayoutSeedNumber","AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS","AI_LAYOUT_STOCK_SEARCHES_PER_PAGE","AI_LAYOUT_STOCK_PICK_WINDOW","AI_LAYOUT_STOCK_TRIES_PER_SEARCH","AI_LAYOUT_STOCK_MAX_BYTES","AI_STOCK_PHOTO_PAGES_INPUT","STOPWORDS","Set","split","FILLER","VENUES","contentWords","text","toLowerCase","replace","map","word","filter","length","has","aiStockStem","lower","endsWith","slice","test","stems","out","add","CLAUSE_BREAK","aiStockBusinessWords","businessType","clause","words","join","aiStockCraftWords","business","craft","subjectOf","aiStockSubjectWords","alt","sectionName","clip","query","trim","aiStockOrientation","aspect","aiStockSearchesFor","slot","orientation","size","role","minWidth","minHeight","subjectStems","subject","qualified","some","stem","place","queries","neutral","seen","searches","raw","push","people","aiStockRelevance","photo","terms","Boolean","slug","URL","pageUrl","pathname","named","tags","head","score","aiStockRank","photos","used","seed","options","scored","entry","strict","turn","ranked","sort","a","b","tier","start","aiStockPick","aiStockPlacedSrcs","nodes","node","Object","values","src","componentId","props","startsWith","JOB_PHOTOS","Map","JOB_PHOTOS_MAX","jobPhotos","key","placed","get","set","oldest","keys","next","value","undefined","delete","aiStockForgetJobPhotos","clear","EXTENSIONS","aiLayoutStockPhotoSource","input","deps","provider","ingest","hostId","uid","slots","timeout","AbortSignal","budgetMs","signal","any","scope","job","jobId","avoid","elsewhere","placedSrcs","answers","storing","remember","sourceKey","search","wanted","request","JSON","stringify","known","found","keep","kept","findStockPhoto","width","height","bytes","download","maxBytes","aborted","credit","stored","fileName","id","contentType","description","stockPhoto","providerLabel","photographer","photographerUrl","license","licenseUrl","attributionRequired","ok","refusal","console","warn","status","reason","error","String","index","entries","sectionNames","sectionIndex","blocked","hit"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iBAAiB,QAGZ,kDAAiD;AACxD,SACEC,2BAA2B,EAC3BC,kBAAkB,EAClBC,mBAAmB,QAKd,mDAAkD;AAEzD,SACEC,kBAAkB,QAIb,2CAAuC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CC,GAED,+EAA+E,GAC/E,OAAO,MAAMC,mCAAmC,MAAM;AAEtD,yGAAyG,GACzG,OAAO,MAAMC,oCAAoC,GAAE;AAEnD,mCAAmC,GACnC,OAAO,MAAMC,8BAA8B,EAAC;AAE5C,0FAA0F,GAC1F,MAAMC,mCAAmC;AAEzC,wDAAwD,GACxD,OAAO,MAAMC,4BAA4B,IAAI,OAAO,KAAI;AAExD;;;CAGC,GACD,OAAO,MAAMC,6BAA6B,kBAAiB;AAE3D,iCAAiC,GACjC,MAAMC,YAAY,IAAIC,IACpB,AACE,CAAA,6GACA,4GACA,iGACA,qGACA,uDAAsD,EACtDC,KAAK,CAAC;AAGV;;;CAGC,GACD,MAAMC,SAAS,IAAIF,IACjB,AACE,CAAA,kHACA,sGACA,oHACA,iHACA,0GACA,qGACA,qGACA,yGACA,gEAA+D,EAC/DC,KAAK,CAAC;AAGV,2FAA2F,GAC3F,MAAME,SAAS,IAAIH,IACjB,AACE,CAAA,+GACA,qGACA,sCAAqC,EACrCC,KAAK,CAAC;AAGV,sDAAsD,GACtD,SAASG,aAAaC,IAAY;IAChC,OAAOA,KACJC,WAAW,GACXC,OAAO,CAAC,iDAAiD,KACzDA,OAAO,CAAC,iBAAiB,KACzBN,KAAK,CAAC,OACNO,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D,SAAS,MAAM0C,KAAKnF,OAAOpB,MAAMkG,QAAQvG,KAAK;oBAC9C,IAAIkE,QAAQ;gBACd;YACF;YACA7B,OAAOf,IAAI,CAAC4C;QACd;QACA,OAAO7B;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-layout-stock-photos.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 {\n pluginMediaIngest,\n type PluginMediaIngest,\n type PluginMediaIngestResult,\n} from '@aglyn/aglyn/plugin-manager/plugin-media-ingest'\nimport {\n STOCK_PHOTO_QUERY_MAX_CHARS,\n stockPhotoProvider,\n stockPhotoSourceKey,\n type StockPhoto,\n type StockPhotoOrientation,\n type StockPhotoProvider,\n type StockPhotoSearchRequest,\n} from '@aglyn/aglyn/plugin-manager/stock-photo-provider'\nimport type { NodesMap } from '@aglyn/aglyn/types/nodes'\nimport {\n aiLayoutSeedNumber,\n type AiLayoutPicturePhoto,\n type AiLayoutPictureSlot,\n type AiLayoutPictureSource,\n} from '../layout-language/ai-layout-pictures'\n\n/**\n * STOCK PHOTOS FOR A LANGUAGE PAGE'S PICTURE SLOTS (AGL-3660).\n *\n * The source `aiResolveLayoutPictures` asks before it falls back to the\n * starter photos. It names no library: it asks core for the deployment's\n * stock photo provider (`core.stock-photos`) and for the media library's\n * server door (`core.media-ingest`), and builds no source at all when either\n * is missing, so a deployment without a key behaves exactly as before.\n *\n * What the live starts of 2026-10-10 taught (Juniper Clay Works, a ceramic\n * artist's portfolio, and Willow Wick Candles, a candle store), each photo\n * traced through the library's cached answers:\n *\n * - The site's words were read as \"portfolio\" and \"online\" — the kind of\n * SITE, not the craft — so every search said \"serving bowl portfolio\" and\n * the hero asked for \"portfolio\": a wallet, fashion models, and a blank\n * paper mockup that read as an empty panel beside the brushes.\n * - A hit naming the object anywhere won: a robin tagged \"food bowl\" filled\n * \"Speckled serving bowl\", a lilac branch tagged \"bud, vase\" filled \"Tall\n * bud vase\", letterpress type tagged \"set\" filled \"Nesting bowl set\" (its\n * head noun was read as \"set\"), and an antique tea set tagged \"brown\n * candle\" filled \"Candle Gift Set\".\n * - The page's 20 seconds ran out after four photos (each copy took ~5s, one\n * after another), and the slots left took the starter photos: the laptop\n * desk with pink roses under \"Candle Wick Trimmer\" and a work card, and the\n * windowsill plants under another.\n *\n * So, for each slot:\n *\n * 1. **The site's terms** ({@link aiStockSiteTerms}): the business is the\n * first clause of its type that says more than what kind of site it is\n * (\"ceramic artist\" from \"a portfolio for a ceramic artist who makes\n * stoneware bowls\"), its craft one word (\"ceramic\"), and its DOMAIN the\n * words a photo of its world names: the craft, the business type's own\n * nouns (\"stoneware\", \"soy\") and, for common crafts, their kin (\"pottery\",\n * \"clay\", \"wax\"). Its broad searches ask for the world itself (\"handmade\n * ceramics\", \"pottery\").\n * 2. **Search.** A picture of a thing asks for its subject — the noun phrase\n * of the caption, filler dropped — qualified by the craft where it does\n * not already name the domain (\"ceramic serving bowl\"), then the craft and\n * the object alone (\"ceramic bowl\"), then the broad searches. A hero asks\n * for the business, then broad; an about picture for the business's\n * people, then broad. The orientation and a minimum size come from the\n * slot's frame.\n * 3. **Accept, or reject.** A hit tagged as a mockup, a blank or a template\n * never fills anything. A picture of a thing takes only a hit naming its\n * OBJECT (the head noun, past \"set\", \"gift\", \"kit\": \"bowl\" in \"nesting\n * bowl set\", \"candle\" in \"candle gift set\") AND either the site's domain\n * or the subject's own two-word phrase (\"bud vase\"). A broad, hero or\n * about search takes only a hit naming the domain. The accepted are\n * ranked: the object in the hit's first tags (what the photo is OF) over\n * a mention in its last, the subject's other words, the domain. Among\n * equals the job's seed picks, so two sites differ and one job repeats.\n * 4. **Never twice.** A photo is placed once per job: not twice on a page,\n * and not on a page when another page (or another pass, in this process)\n * of the same job already placed it. The caller hands in what the job's\n * other pages hold (`avoid`); a pass repeated over its own page keeps its\n * own.\n * 5. **Keep, all at once.** The choosing is done first, slot by slot; the\n * copies then run side by side, a few at a time, so a page of eight\n * pictures takes about as long as two. A photo the site's library already\n * holds (by its source key) is reused; otherwise its bytes are copied\n * into the site's own library as the member who started the job, credited\n * to its photographer. A copy that fails tries the slot's next accepted\n * hit.\n *\n * A slot nothing acceptable answered — the library down, refusing, or out\n * of time — is left `null` for the starter photos. A named object is never\n * given one while the library answers anything of the site's world: the\n * broad searches come first. Nothing here throws, and none of it is an AI\n * model call: photos cost no AI credits.\n */\n\n/** Wall clock the whole page's photos may take, inside the step's own signal. */\nexport const AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS = 30_000\n\n/** Searches one page may send to the provider; a repeated query is answered from the page's own memory. */\nexport const AI_LAYOUT_STOCK_SEARCHES_PER_PAGE = 18\n\n/** The hits a pick is made among. */\nexport const AI_LAYOUT_STOCK_PICK_WINDOW = 40\n\n/** The accepted hits a slot keeps in hand, in case a copy fails. */\nconst AI_LAYOUT_STOCK_TRIES_PER_SLOT = 3\n\n/** Copies made side by side. */\nconst AI_LAYOUT_STOCK_COPIES_AT_ONCE = 4\n\n/** The largest photo copied: inside one direct upload. */\nexport const AI_LAYOUT_STOCK_MAX_BYTES = 3 * 1024 * 1024\n\n/**\n * The unit job input naming the screen drafts the job's other pages were\n * written to, whose photos a page does not place again (AGL-3660).\n */\nexport const AI_STOCK_PHOTO_PAGES_INPUT = 'stockPhotoPages'\n\nconst words = (list: string) => new Set(list.trim().split(/\\s+/))\n\n/** Words that carry no subject. */\nconst STOPWORDS = words(\n 'a an the and or of in on at to for with from by into onto over under near our your their my his her its ' +\n 'this that these those is are be being was were who whom which where while as about than then very just ' +\n 'small local best new top quality premium family-owned family owned independent professional ' +\n 'business company services service page photo picture image showing shows show ' +\n 'someone people person one two three some many several',\n)\n\n/**\n * Words that describe a picture's look, not what it shows, dropped from a\n * subject. A word that is as often a noun (\"light\", \"set\") is not one.\n */\nconst FILLER = words(\n 'beautiful beautifully stunning gorgeous lovely pretty elegant modern contemporary rustic cozy cosy warm cool ' +\n 'soft bright natural simple minimal minimalist delicate unique special artisan artisanal handmade ' +\n 'hand-made hand-thrown handthrown hand-crafted handcrafted crafted hand-built handbuilt hand-poured ' +\n 'hand-painted hand-dyed hand-stitched poured finished styled perfect ' +\n 'fresh clean calm serene quiet peaceful vibrant colorful colourful sunlit sunny golden glossy matte textured ' +\n 'close-up closeup up view views detail details detailed shot shots overhead flat lay flatlay flat-lay ' +\n 'top-down wide angle featuring featured displayed arranged sitting resting placed standing lined ' +\n 'single pair collection assortment selection group few various array range large tiny big little ' +\n 'tall short wide narrow everyday classic signature original favorite favourite bestselling best-selling ' +\n 'small-batch batch limited edition custom bespoke ' +\n 'white black grey gray beige cream ivory brown tan blue green red pink yellow orange purple speckled ' +\n 'gentle airy inviting welcoming cheerful happy smiling friendly',\n)\n\n/** The nouns that name a place of business, not its craft: \"studio\" in \"ceramics studio\". */\nconst VENUES = words(\n 'studio studios shop shops store stores boutique company co workshop gallery atelier agency brand practice ' +\n 'salon house collective lab market services service firm clinic center centre parlor parlour bar ' +\n 'class classes lessons school academy',\n)\n\n/** The person who does the craft, not the craft: \"artist\" in \"ceramic artist\". */\nconst ROLES = words(\n 'artist artists maker makers artisan artisans owner owners founder founders creator creators',\n)\n\n/** Words naming what kind of SITE it is, never what it shows: \"portfolio\" in \"a portfolio for a ceramic artist\". */\nconst SITE_KINDS = words(\n 'portfolio portfolios website websites site sites blog blogs online web webshop ecommerce e-commerce ' +\n 'landing personal homepage storefront',\n)\n\n/** Verbs a business type uses to say what it does; what follows them is its domain, never its business. */\nconst DOING =\n /(?<![\\w-])(?:makes?|making|made|sells?|selling|sold|offers?|offering|creates?|creating|specializ(?:es|ing)|specialis(?:es|ing)|provides?|providing|featuring|showcasing)(?![\\w-])/g\n\n/** Where a business type's own clause ends. */\nconst BUSINESS_BREAK =\n /[,;:.()]|\\s[-–—]\\s|\\b(?:in|for|near|serving|based|located|that|which|who|with|from|since|and|&)\\b/\n\n/** A clause after one of these says where or for whom, never what: \"in Austin\", \"for busy parents\". */\nconst PLACE_OR_AUDIENCE =\n /^(?:in|near|serving|based|located|across|around|throughout|for)$/\n\n/**\n * Words naming a set or a wrapper of a thing, never the thing: the OBJECT\n * of \"nesting bowl set\" is the bowl, of \"candle gift set\" the candle.\n */\nconst WRAPPERS = words(\n 'set sets kit kits gift gifts bundle bundles pack packs box boxes trio duo pair collection sampler assortment ' +\n 'series range line group lot bunch',\n)\n\n/**\n * A hit tagged with any of these is never placed: a mockup's blank panel is\n * an empty frame on the page (the Juniper Clay hero), a template or a\n * graphic is not a photo of anything.\n */\nconst REJECTED_TAGS = words(\n 'mockup mock-up mock blank template templates clipart clip-art illustration vector logo icon ' +\n 'ai-generated generated render rendering 3d',\n)\n\n/**\n * The kin of a few common crafts: the words a photo of that world is\n * tagged with, and the broad searches that find it. A craft not listed\n * still has its own words; this only widens what counts as its world.\n */\nconst CRAFT_KIN: ReadonlyArray<{\n match: readonly string[]\n kin: readonly string[]\n broad: readonly string[]\n}> = [\n {\n match: [\n 'ceramic',\n 'ceramics',\n 'pottery',\n 'potter',\n 'stoneware',\n 'porcelain',\n 'earthenware',\n 'clay',\n ],\n kin: [\n 'ceramic',\n 'ceramics',\n 'pottery',\n 'potter',\n 'stoneware',\n 'porcelain',\n 'earthenware',\n 'clay',\n 'glaze',\n 'kiln',\n ],\n broad: ['handmade ceramics', 'pottery'],\n },\n {\n match: ['candle', 'candlemaker', 'candlemaking'],\n kin: [\n 'candle',\n 'candlelight',\n 'wax',\n 'soy',\n 'wick',\n 'scented',\n 'votive',\n 'candlestick',\n ],\n broad: ['handmade candles', 'scented candles'],\n },\n {\n match: [\n 'jewelry',\n 'jewellery',\n 'jeweler',\n 'jeweller',\n 'silversmith',\n 'goldsmith',\n ],\n kin: [\n 'jewelry',\n 'jewellery',\n 'ring',\n 'necklace',\n 'earring',\n 'bracelet',\n 'silver',\n 'gold',\n 'gemstone',\n ],\n broad: ['handmade jewelry', 'jewelry'],\n },\n {\n match: ['soap', 'soapmaker', 'skincare'],\n kin: ['soap', 'skincare', 'lotion', 'bath', 'spa', 'natural', 'cosmetic'],\n broad: ['handmade soap', 'natural skincare'],\n },\n {\n match: [\n 'wood',\n 'woodwork',\n 'woodworking',\n 'woodworker',\n 'carpenter',\n 'carpentry',\n 'furniture',\n 'joinery',\n ],\n kin: [\n 'wood',\n 'wooden',\n 'woodwork',\n 'timber',\n 'furniture',\n 'carpentry',\n 'oak',\n 'walnut',\n ],\n broad: ['woodworking', 'wooden furniture'],\n },\n {\n match: ['bakery', 'baker', 'bread', 'pastry', 'cake', 'patisserie'],\n kin: [\n 'bakery',\n 'bread',\n 'pastry',\n 'cake',\n 'baking',\n 'baked',\n 'dough',\n 'croissant',\n ],\n broad: ['bakery', 'fresh bread'],\n },\n {\n match: ['coffee', 'cafe', 'café', 'roaster', 'espresso'],\n kin: [\n 'coffee',\n 'cafe',\n 'espresso',\n 'latte',\n 'cappuccino',\n 'barista',\n 'beans',\n ],\n broad: ['coffee shop', 'coffee'],\n },\n {\n match: ['florist', 'flower', 'floral'],\n kin: ['flower', 'floral', 'bouquet', 'florist', 'bloom', 'blossom'],\n broad: ['florist', 'flower bouquet'],\n },\n {\n match: [\n 'knit',\n 'knitting',\n 'yarn',\n 'weaving',\n 'weaver',\n 'textile',\n 'textiles',\n 'quilt',\n 'quilting',\n 'sewing',\n ],\n kin: [\n 'knit',\n 'knitting',\n 'yarn',\n 'wool',\n 'weaving',\n 'textile',\n 'fabric',\n 'quilt',\n 'sewing',\n ],\n broad: ['handmade textiles', 'yarn'],\n },\n {\n match: ['leather', 'leatherwork', 'leathercraft'],\n kin: ['leather', 'wallet', 'bag', 'belt', 'stitching'],\n broad: ['leather craft', 'leather goods'],\n },\n]\n\n/** Lowercase words, letters only, without stopwords. */\nfunction contentWords(text: string): string[] {\n return text\n .toLowerCase()\n .replace(/https?:\\/\\/\\S+|\\S+@\\S+|\\+?\\d[\\d\\s().-]{5,}\\d/g, ' ')\n .replace(/[^a-zÀ-ɏ\\s-]/g, ' ')\n .split(/\\s+/)\n .map((word) => word.replace(/^-+|-+$/g, ''))\n .filter((word) => word.length > 1 && !STOPWORDS.has(word))\n}\n\n/**\n * A word's singular, for matching only: \"bowls\" and \"bowl\", \"vases\" and\n * \"vase\", \"berries\" and \"berry\", \"dishes\" and \"dish\" meet. Both sides of a\n * comparison are reduced the same way, so an odd stem still matches itself.\n */\nexport function aiStockStem(word: string): string {\n const lower = word.toLowerCase()\n if (lower.length > 4 && lower.endsWith('ies')) return `${lower.slice(0, -3)}y`\n if (lower.length > 4 && /(?:ches|shes|sses|xes|zes)$/.test(lower))\n return lower.slice(0, -2)\n if (lower.length > 3 && lower.endsWith('s') && !/(?:ss|us|is)$/.test(lower))\n return lower.slice(0, -1)\n return lower\n}\n\n/** A text's words as stems, in order; a hyphenated word counts as its parts. */\nfunction stemList(text: string): string[] {\n return text\n .toLowerCase()\n .split(/[^a-zÀ-ɏ]+/)\n .filter((word) => word.length > 1)\n .map(aiStockStem)\n}\n\n/** Where a noun phrase ends: punctuation, a preposition, a conjunction. */\nconst CLAUSE_BREAK =\n /[,;:.()]|\\s[-–—]\\s|\\b(?:with|on|in|at|against|beside|next|near|under|over|by|from|for|during|while|atop|inside|across|beneath|through|into|onto|amid|among|and|of|that|which|who)\\b|&/\n\n/** A business type's clauses, each with the word that opened it. */\nfunction businessClauses(\n businessType: string,\n): Array<{ opener: string; words: string[] }> {\n const text = businessType.toLowerCase().replace(DOING, ' | ')\n const clauses: Array<{ opener: string; words: string[] }> = []\n const breaker = new RegExp(`${BUSINESS_BREAK.source}|\\\\|`, 'g')\n let at = 0\n let opener = ''\n for (const match of text.matchAll(breaker)) {\n clauses.push({ opener, words: contentWords(text.slice(at, match.index)) })\n opener = match[0].trim()\n at = (match.index ?? 0) + match[0].length\n }\n clauses.push({ opener, words: contentWords(text.slice(at)) })\n return clauses\n}\n\n/** A clause's words that name the business: no site kind, no filler. */\nconst businessOf = (clause: readonly string[]) =>\n clause.filter((word) => !SITE_KINDS.has(word) && !FILLER.has(word))\n\n/**\n * The kind of business in a few words: the first clause of the business\n * type that says more than what kind of site it is, before a place, an\n * audience or what it makes, filler dropped, its last three words (the head\n * of an English noun phrase is at its end). \"ceramic artist\" from \"a\n * portfolio for a ceramic artist who makes stoneware bowls\"; \"candle shop\"\n * from \"a small-batch candle shop selling hand-poured soy candles online\".\n */\nexport function aiStockBusinessWords(businessType: string): string {\n for (const { words: clause } of businessClauses(businessType)) {\n const named = businessOf(clause)\n if (named.length) return named.slice(-3).join(' ')\n }\n return ''\n}\n\n/**\n * The business's craft in one word: the last of its words that is not the\n * place it is done in nor the person doing it, singular — \"ceramic\" from\n * \"ceramics studio\" or \"ceramic artist\", \"yoga\" from \"yoga studio\". Empty\n * when the business is only a place (\"a shop\").\n */\nexport function aiStockCraftWords(business: string): string {\n const named = business\n .split(/\\s+/)\n .filter(\n (word) =>\n word &&\n !VENUES.has(word) &&\n !ROLES.has(word) &&\n !FILLER.has(word) &&\n !SITE_KINDS.has(word),\n )\n const craft = named[named.length - 1]\n return craft ? aiStockStem(craft) : ''\n}\n\n/** What a site's photos are searched and judged by (AGL-3660). */\nexport interface AiStockSiteTerms {\n /** The kind of business, in a few words: \"ceramic artist\". */\n business: string\n /** Its craft, one singular word: \"ceramic\". */\n craft: string\n /**\n * The stems a photo of the site's world names: the business's own words,\n * what the things it makes are made of, and the craft's kin. Empty for a\n * site whose words name no world (a type left blank), and then no hit is\n * held to it.\n */\n domain: string[]\n /** The searches for the site's world itself, broadest last. */\n broad: string[]\n}\n\n/** The site's terms, read from its business type. */\nexport function aiStockSiteTerms(businessType: string): AiStockSiteTerms {\n const business = aiStockBusinessWords(businessType)\n const craft = aiStockCraftWords(business)\n const domain = new Set<string>()\n /** The things it makes, by their head nouns. */\n const made = new Set<string>()\n let named = false\n let making = false\n for (const { opener, words: clause } of businessClauses(businessType)) {\n if (opener === '|') making = true\n // Where it is, and who it is for, are not its world — once something has named it.\n if (named && PLACE_OR_AUDIENCE.test(opener)) {\n making = false\n continue\n }\n const kept = businessOf(clause).filter(\n (word) => !VENUES.has(word) && !ROLES.has(word),\n )\n if (kept.length) named = true\n // What it makes names its world by what the things are made of, never\n // the things: \"stoneware\" of \"stoneware bowls\", \"soy\" of \"soy candles\".\n // A bowl is not a ceramic world; a robin's food bowl is not pottery.\n const world = making ? kept.slice(0, -1) : kept\n for (const word of world)\n for (const stem of stemList(word)) domain.add(stem)\n if (making)\n for (const word of kept.slice(-1))\n for (const stem of stemList(word)) made.add(stem)\n }\n if (craft) domain.add(craft)\n // A business named only by what it sells (\"a shop selling pottery\") is of that world.\n if (!domain.size) for (const stem of made) domain.add(stem)\n const broad: string[] = []\n for (const group of CRAFT_KIN) {\n if (\n !group.match.some(\n (word) => domain.has(aiStockStem(word)) || made.has(aiStockStem(word)),\n )\n )\n continue\n for (const word of group.kin) domain.add(aiStockStem(word))\n broad.push(...group.broad)\n }\n if (!broad.length) broad.push(business, craft)\n return {\n business,\n craft,\n domain: [...domain].filter((stem) => stem.length > 1),\n broad: [...new Set(broad.map((query) => query.trim()).filter(Boolean))],\n }\n}\n\n/** A phrase's content words without its filler; all filler, and nothing is left. */\nfunction subjectOf(list: readonly string[]): string[] {\n return list.filter((word) => !FILLER.has(word))\n}\n\n/**\n * A picture's subject in a few words (AGL-3660): the noun phrase its alt\n * text opens with — its first clause holding more than filler, cut where a\n * preposition starts the setting, filler dropped, its last three words (the\n * head noun is the last) — else its section's name.\n */\nexport function aiStockSubjectWords(alt: string, sectionName: string): string {\n for (const clause of alt.toLowerCase().split(CLAUSE_BREAK)) {\n const found = subjectOf(contentWords(clause ?? ''))\n if (found.length) return found.slice(-3).join(' ')\n }\n return subjectOf(contentWords(sectionName)).slice(0, 2).join(' ')\n}\n\n/**\n * The thing a subject shows, one singular word: its last word that is not\n * a set or a wrapper of it — \"bowl\" from \"nesting bowl set\", \"candle\" from\n * \"candle gift set\", \"vase\" from \"bud vase\". Its last word when every word\n * is one (\"gift set\").\n */\nexport function aiStockObjectWord(subject: string): string {\n const list = subject.split(/\\s+/).filter(Boolean)\n const object =\n [...list].reverse().find((word) => !WRAPPERS.has(word)) ??\n list[list.length - 1] ??\n ''\n return object ? aiStockStem(object) : ''\n}\n\nconst clip = (query: string) =>\n query.replace(/\\s+/g, ' ').trim().slice(0, STOCK_PHOTO_QUERY_MAX_CHARS).trim()\n\n/** The frame's orientation: a wide frame wants a landscape photo, a tall one a portrait. */\nexport function aiStockOrientation(aspect: number): StockPhotoOrientation {\n if (aspect > 1.15) return 'horizontal'\n if (aspect < 0.87) return 'vertical'\n return 'any'\n}\n\n/**\n * One search a slot tries. A `broad` one asks for the site's world and\n * takes any hit of it; any other picture of a thing takes only a hit naming\n * the thing.\n */\nexport interface AiStockSearch extends StockPhotoSearchRequest {\n broad?: boolean\n /** The words its hits are scored by, where they are not the slot's own subject (a product's searches, AGL-3676). */\n subject?: string\n /** A word every hit must name: a product's photo names the shop's category (AGL-3676). */\n requires?: string\n}\n\n/**\n * A product's searches (AGL-3676), most specific first: each of its subjects\n * — its name's noun phrase, then its photo's — with the shop's category\n * where the phrase does not already say it (\"candle gift box\"), then the\n * category alone, a plain photo of what the shop sells. Every one must find a\n * hit naming the category, so no product is ever filled with a lifestyle shot\n * of something else: the beta.237 Willow Wick start put a laptop and roses\n * under \"Candle Wick Trimmer\" and an antique tea set under \"Candle Gift Set\".\n */\nexport function aiStockProductSearches(\n slot: Pick<AiLayoutPictureSlot, 'aspect' | 'product'>,\n craft: string,\n): AiStockSearch[] {\n const orientation = aiStockOrientation(slot.aspect)\n const size = orientation === 'vertical' ? { minHeight: 900 } : { minWidth: 900 }\n const craftStems = stemList(craft)\n const queries: Array<{ query: string; subject: string }> = []\n for (const raw of slot.product?.subjects ?? []) {\n const subject = aiStockSubjectWords(raw, '')\n if (!subject) continue\n const says = craftStems.every((stem) => stemList(subject).includes(stem))\n queries.push({ query: craft && !says ? `${craft} ${subject}` : subject, subject })\n }\n if (craft) queries.push({ query: craft, subject: craft })\n const seen = new Set<string>()\n const searches: AiStockSearch[] = []\n for (const entry of queries) {\n const query = clip(entry.query)\n if (!query || seen.has(query)) continue\n seen.add(query)\n searches.push({ query, orientation, ...size, subject: entry.subject, ...(craft ? { requires: craft } : {}) })\n }\n return searches\n}\n\n/** The searches a slot tries, in order, most specific first, each distinct. */\nexport function aiStockSearchesFor(\n slot: Pick<AiLayoutPictureSlot, 'role' | 'alt' | 'aspect'>,\n terms: Pick<AiStockSiteTerms, 'business' | 'craft' | 'domain' | 'broad'>,\n subject: string,\n): AiStockSearch[] {\n const orientation = aiStockOrientation(slot.aspect)\n const size =\n slot.role === 'hero'\n ? { minWidth: 1600 }\n : orientation === 'vertical'\n ? { minHeight: 900 }\n : { minWidth: 900 }\n const domain = new Set(terms.domain)\n const object = aiStockObjectWord(subject)\n const subjectStems = stemList(subject)\n // The craft qualifies a subject that does not already name the site's world.\n const namesWorld = subjectStems.some((stem) => domain.has(stem))\n const qualify = (phrase: string) =>\n terms.craft && !namesWorld && !stemList(phrase).includes(terms.craft)\n ? `${terms.craft} ${phrase}`\n : phrase\n const broad = terms.broad.map((query) => ({ query, broad: true }))\n const queries: Array<{ query: string; broad?: boolean; people?: boolean }> =\n slot.role === 'hero'\n ? [{ query: terms.business, broad: true }, ...broad]\n : slot.role === 'about'\n ? [\n {\n query: `${terms.business} ${subject}`,\n broad: true,\n people: true,\n },\n { query: terms.business, broad: true, people: true },\n ...broad,\n ]\n : subject\n ? [{ query: qualify(subject) }, { query: qualify(object) }, ...broad]\n : broad\n const seen = new Set<string>()\n const searches: AiStockSearch[] = []\n for (const raw of queries) {\n const query = clip(raw.query)\n const key = `${query}|${raw.people === true}`\n if (!query || seen.has(key)) continue\n seen.add(key)\n searches.push({\n query,\n orientation,\n ...size,\n ...(raw.people ? { people: true } : {}),\n ...(raw.broad ? { broad: true } : {}),\n })\n }\n return searches\n}\n\n/** What a hit is judged by. */\nexport interface AiStockJudgement {\n /** The words the picture is of; empty for a picture of the site's world. */\n subject?: string\n /** The site's domain stems ({@link AiStockSiteTerms.domain}). */\n domain?: readonly string[]\n /**\n * Whether a hit must name the subject's object. A broad search, a hero\n * and an about picture need only name the domain.\n */\n strict?: boolean\n /** A word every hit must name: a product's photo names the shop's category (AGL-3676). */\n requires?: string\n}\n\n/** The words of a photo's page address at its library, its id dropped: \"robin-bird-songbird-garden-winter\". */\nfunction pageSlug(pageUrl: string): string {\n try {\n const last = decodeURIComponent(new URL(pageUrl).pathname)\n .split('/')\n .filter(Boolean)\n .pop()\n return last?.replace(/-?\\d+$/, '') ?? ''\n } catch {\n return ''\n }\n}\n\n/** A hit's words: the first few (what it is OF), every one, and each tag's phrase. */\nfunction hitWords(photo: Pick<StockPhoto, 'tags' | 'alt' | 'pageUrl'>) {\n const slug = pageSlug(photo.pageUrl)\n const tags = (photo.tags ?? [])\n .map((tag) => tag.toLowerCase().trim())\n .filter(Boolean)\n const lead = new Set(stemList([...tags.slice(0, 3), slug].join(' ')))\n const all = new Set(stemList([...tags, photo.alt ?? '', slug].join(' ')))\n const phrases = [\n ...tags.map((tag) => stemList(tag).join(' ')),\n stemList(photo.alt ?? '').join(' '),\n stemList(slug).join(' '),\n ]\n const rejected = tags.some(\n (tag) =>\n REJECTED_TAGS.has(tag) ||\n tag.split(/\\s+/).some((word) => REJECTED_TAGS.has(word)),\n )\n return { lead, all, phrases, rejected }\n}\n\n/**\n * How well a hit shows what a slot needs (AGL-3660), or 0 when it must not\n * fill it: a mockup or a blank never; a picture of a thing only when the hit\n * names its object AND either the site's world or the subject's own\n * two-word phrase (\"bud vase\", \"wick trimmer\"); anything else only when it\n * names the site's world (when the site names one). Among the accepted, the\n * object among the hit's first tags counts 4 (a mention among its last, 2),\n * the subject's two-word phrase 3, each of its other words 1, and the\n * site's world 1, plus a quarter when it is among the first tags.\n */\nexport function aiStockRelevance(\n photo: Pick<StockPhoto, 'tags' | 'alt' | 'pageUrl'>,\n judgement: AiStockJudgement,\n): number {\n const hit = hitWords(photo)\n if (hit.rejected) return 0\n const required = stemList(judgement.requires ?? '')\n if (required.some((stem) => !hit.all.has(stem))) return 0\n const subject = stemList(judgement.subject ?? '')\n const object = judgement.subject ? aiStockObjectWord(judgement.subject) : ''\n const domain = (judgement.domain ?? []).filter((stem) => stem !== object)\n // A hit naming the word it must name is of the site's world: a product's\n // category is that world even where it is the product's own object.\n const world =\n required.length > 0 || domain.some((stem) => hit.all.has(stem))\n const worldLead =\n (required.length > 0 && required.every((stem) => hit.lead.has(stem))) ||\n domain.some((stem) => hit.lead.has(stem))\n const pair = subject.length >= 2 ? subject.slice(-2).join(' ') : ''\n const phrased =\n Boolean(pair) &&\n hit.phrases.some((phrase) => ` ${phrase} `.includes(` ${pair} `))\n let score = 0\n if (judgement.strict && object) {\n if (!hit.all.has(object)) return 0\n if (domain.length && !world && !phrased) return 0\n score += hit.lead.has(object) ? 4 : 2\n } else if (domain.length) {\n if (!world) return 0\n }\n if (phrased) score += 3\n for (const word of new Set(subject))\n if (word !== object && hit.all.has(word)) score += 1\n if (world) score += worldLead ? 1.25 : 1\n return Math.max(score, 0.5)\n}\n\n/**\n * A search's acceptable hits in the order they are tried (AGL-3660): those\n * not placed yet, among the first few the library returned, those it must\n * not take dropped ({@link aiStockRelevance}), best first; the seed turns\n * the hits that score alike, so two jobs differ and one job repeats itself.\n */\nexport function aiStockRank(\n photos: readonly StockPhoto[],\n used: ReadonlySet<string>,\n seed: string,\n judgement: AiStockJudgement = {},\n): StockPhoto[] {\n const scored = photos\n .filter((photo) => !used.has(stockPhotoSourceKey(photo)))\n .slice(0, AI_LAYOUT_STOCK_PICK_WINDOW)\n .map((photo) => ({ photo, score: aiStockRelevance(photo, judgement) }))\n .filter((entry) => entry.score > 0)\n if (!scored.length) return []\n const turn = aiLayoutSeedNumber(seed)\n const ranked: StockPhoto[] = []\n for (const score of [...new Set(scored.map((entry) => entry.score))].sort(\n (a, b) => b - a,\n )) {\n const tier = scored.filter((entry) => entry.score === score)\n const start = turn % tier.length\n for (const entry of [...tier.slice(start), ...tier.slice(0, start)])\n ranked.push(entry.photo)\n }\n return ranked\n}\n\n/** The pick among a search's hits: the first {@link aiStockRank} would try, or `null`. */\nexport function aiStockPick(\n photos: readonly StockPhoto[],\n used: ReadonlySet<string>,\n seed: string,\n judgement: AiStockJudgement = {},\n): StockPhoto | null {\n return aiStockRank(photos, used, seed, judgement)[0] ?? null\n}\n\n/**\n * The library photos a stored page already shows: every `image` whose\n * source is the site's media reference. Starter photos are the platform's,\n * not the job's, and are not listed.\n */\nexport function aiStockPlacedSrcs(\n nodes: NodesMap | null | undefined,\n): string[] {\n const map = (nodes ?? {}) as unknown as Record<\n string,\n { componentId?: string; props?: Record<string, unknown> }\n >\n const out: string[] = []\n for (const node of Object.values(map)) {\n const src = node?.componentId === 'image' ? node.props?.['src'] : null\n if (typeof src === 'string' && src.startsWith('media:')) out.push(src)\n }\n return out\n}\n\n/**\n * What this process has placed for each job, by source key and asset src,\n * with the scope (the page's seed) that placed it (AGL-3660). It spans the\n * passes of one job that run here, so a page, the products or a post built\n * later does not place what an earlier one did, while a pass repeated over\n * its own page keeps its own photos. Bounded; the oldest job goes first.\n */\nconst JOB_PHOTOS = new Map<string, Map<string, string>>()\nconst JOB_PHOTOS_MAX = 200\n\nfunction jobPhotos(key: string | null): Map<string, string> | null {\n if (!key) return null\n let placed = JOB_PHOTOS.get(key)\n if (!placed) {\n placed = new Map()\n JOB_PHOTOS.set(key, placed)\n while (JOB_PHOTOS.size > JOB_PHOTOS_MAX) {\n const oldest = JOB_PHOTOS.keys().next().value\n if (oldest === undefined) break\n JOB_PHOTOS.delete(oldest)\n }\n }\n return placed\n}\n\n/** Forgets every job's placed photos; for specs. */\nexport function aiStockForgetJobPhotos(): void {\n JOB_PHOTOS.clear()\n}\n\nconst EXTENSIONS: Record<string, string> = {\n 'image/jpeg': 'jpg',\n 'image/png': 'png',\n 'image/webp': 'webp',\n}\n\nexport interface AiLayoutStockPhotoSourceInput {\n hostId: string\n /** The member the photos are stored as: the job's creator. */\n uid: string\n /** The job's seed, as the starter photos turn by; also the scope a photo is placed under. */\n seed: string\n /** The site's business type, else the job's brief. */\n business: string\n /** The page's section names, by plan index. */\n sectionNames: readonly string[]\n /**\n * The job the member started (`aiOriginJobId`), so a photo is placed once\n * across its pages. Absent, only the page itself is kept free of repeats.\n */\n jobId?: string\n /** Asset srcs or source keys the job's other pages already show. */\n avoid?: readonly string[]\n /** The most searches this source sends; a page's own bound where absent. A store's products search more (AGL-3676). */\n searches?: number\n signal?: AbortSignal\n}\n\nexport interface AiLayoutStockPhotoDeps {\n provider?: () => StockPhotoProvider | null\n ingest?: () => PluginMediaIngest | null\n budgetMs?: number\n}\n\n/** A slot's choice: the accepted hits it may be filled from, best first, and the query that found them. */\ninterface AiStockChoice {\n candidates: StockPhoto[]\n query: string\n}\n\n/**\n * The source for one page, or `null` when this deployment has no stock\n * photo library or no media door, which leaves every slot to the starters.\n */\nexport function aiLayoutStockPhotoSource(\n input: AiLayoutStockPhotoSourceInput,\n deps: AiLayoutStockPhotoDeps = {},\n): AiLayoutPictureSource | null {\n const provider = (deps.provider ?? stockPhotoProvider)()\n const ingest = (deps.ingest ?? pluginMediaIngest)()\n if (!provider || !ingest || !input.hostId || !input.uid) return null\n const terms = aiStockSiteTerms(input.business)\n return async (slots) => {\n const timeout = AbortSignal.timeout(\n deps.budgetMs ?? AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS,\n )\n const signal = input.signal\n ? AbortSignal.any([input.signal, timeout])\n : timeout\n const scope = input.seed\n const job = jobPhotos(input.jobId ? `${input.hostId}:${input.jobId}` : null)\n const avoid = new Set(input.avoid ?? [])\n /** Placed elsewhere in the job: by another page in this process, or one the caller read. */\n const elsewhere = (key: string) =>\n avoid.has(key) || (job?.has(key) === true && job.get(key) !== scope)\n /** Source keys this page has claimed for a slot, or turned down. */\n const claimed = new Set<string>()\n /** Asset srcs this page has placed. */\n const placedSrcs = new Set<string>()\n const answers = new Map<string, Promise<StockPhoto[] | null>>()\n let searches = 0\n let storing = true\n const remember = (sourceKey: string, src: string) => {\n placedSrcs.add(src)\n job?.set(sourceKey, scope)\n job?.set(src, scope)\n }\n /** A search's hits; the same words twice are answered from memory, and `null` once the page's searches are spent. */\n const search = (wanted: AiStockSearch): Promise<StockPhoto[] | null> => {\n const request: StockPhotoSearchRequest = { ...wanted }\n delete (request as AiStockSearch).broad\n delete (request as AiStockSearch).subject\n delete (request as AiStockSearch).requires\n const key = JSON.stringify([\n request.query,\n request.orientation,\n request.people === true,\n ])\n const known = answers.get(key)\n if (known) return known\n if (searches >= (input.searches ?? AI_LAYOUT_STOCK_SEARCHES_PER_PAGE))\n return Promise.resolve(null)\n searches += 1\n const asked = provider\n .search(request, { signal })\n .then((found) => found?.photos ?? [])\n .catch(() => [] as StockPhoto[])\n answers.set(key, asked)\n return asked\n }\n /** The photo placed in the site's library, a copy it holds or a new one; `null` when it cannot be placed. */\n const keep = async (\n photo: StockPhoto,\n slot: AiLayoutPictureSlot,\n query: string,\n ): Promise<AiLayoutPicturePhoto | null> => {\n const sourceKey = stockPhotoSourceKey(photo)\n try {\n const kept = await ingest.findStockPhoto({\n hostId: input.hostId,\n sourceKey,\n })\n if (kept) {\n // Held because a slot of this page or another page of the job shows it.\n if (placedSrcs.has(kept.src) || elsewhere(kept.src)) return null\n remember(sourceKey, kept.src)\n return {\n src: kept.src,\n width: kept.width ?? photo.width,\n height: kept.height ?? photo.height,\n }\n }\n // A refusal to store (the storage band, a lockdown) holds for the\n // whole page, so the rest of it reuses what it can and copies nothing.\n if (!storing || signal.aborted) return null\n const bytes = await provider.download(photo, {\n maxBytes: AI_LAYOUT_STOCK_MAX_BYTES,\n signal,\n })\n if (!bytes || signal.aborted || !storing) return null\n const credit = provider.credit(photo)\n const stored = await ingest.ingest({\n hostId: input.hostId,\n uid: input.uid,\n fileName: `${photo.provider}-${photo.id}.${EXTENSIONS[bytes.contentType] ?? 'jpg'}`,\n contentType: bytes.contentType,\n bytes: bytes.bytes,\n alt: slot.alt,\n description: credit.text,\n stockPhoto: {\n key: sourceKey,\n provider: photo.provider,\n providerLabel: credit.providerLabel,\n id: photo.id,\n pageUrl: photo.pageUrl,\n photographer: photo.photographer,\n ...(photo.photographerUrl\n ? { photographerUrl: photo.photographerUrl }\n : {}),\n license: credit.license,\n licenseUrl: credit.licenseUrl,\n attributionRequired: credit.attributionRequired,\n query,\n },\n })\n if (stored.ok) {\n remember(sourceKey, stored.src)\n return {\n src: stored.src,\n width: stored.width ?? photo.width,\n height: stored.height ?? photo.height,\n }\n }\n storing = false\n const refusal = stored as Extract<\n PluginMediaIngestResult,\n { ok: false }\n >\n console.warn(\n 'ai layout pictures: the media library refused a stock photo',\n {\n status: refusal.status,\n reason: refusal.reason,\n },\n )\n } catch (error) {\n console.warn('ai layout pictures: a stock photo could not be kept', {\n error: String(error),\n })\n }\n return null\n }\n\n // 1. Choose, slot by slot, so the page's choices never collide: each\n // slot claims its best accepted hit before the next slot looks.\n const choices: Array<AiStockChoice | null> = []\n for (const [index, slot] of slots.entries()) {\n if (signal.aborted) {\n choices.push(null)\n continue\n }\n const subject = aiStockSubjectWords(\n slot.alt,\n input.sectionNames[slot.sectionIndex] ?? '',\n )\n let choice: AiStockChoice | null = null\n const requests = slot.product\n ? aiStockProductSearches(slot, terms.craft)\n : aiStockSearchesFor(slot, terms, subject)\n for (const request of requests) {\n if (choice || signal.aborted) break\n const found = await search(request)\n if (found === null) break\n const blocked = new Set(claimed)\n for (const hit of found) {\n const key = stockPhotoSourceKey(hit)\n if (elsewhere(key)) blocked.add(key)\n }\n const ranked = aiStockRank(\n found,\n blocked,\n `${input.seed}:${index}:${request.query}`,\n {\n subject: request.subject ?? (request.broad ? '' : subject),\n domain: terms.domain,\n strict:\n (slot.role === 'gallery' && !request.broad) || !!request.requires,\n ...(request.requires ? { requires: request.requires } : {}),\n },\n )\n if (!ranked.length) continue\n const first = ranked[0] as StockPhoto\n claimed.add(stockPhotoSourceKey(first))\n choice = {\n candidates: ranked.slice(0, AI_LAYOUT_STOCK_TRIES_PER_SLOT),\n query: request.query,\n }\n }\n choices.push(choice)\n }\n\n // 2. Keep, a few at a time; a copy that fails tries the slot's next\n // accepted hit no other slot has claimed.\n const photos: Array<AiLayoutPicturePhoto | null> = slots.map(() => null)\n const fill = async (index: number) => {\n const choice = choices[index]\n const slot = slots[index]\n if (!choice || !slot) return\n for (const [rank, candidate] of choice.candidates.entries()) {\n if (signal.aborted) return\n const key = stockPhotoSourceKey(candidate)\n if (rank > 0) {\n if (claimed.has(key)) continue\n claimed.add(key)\n }\n const placed = await keep(candidate, slot, choice.query)\n if (placed) {\n photos[index] = placed\n return\n }\n }\n }\n let next = 0\n const worker = async () => {\n while (next < slots.length) {\n const index = next\n next += 1\n await fill(index)\n }\n }\n await Promise.all(\n Array.from(\n { length: Math.min(AI_LAYOUT_STOCK_COPIES_AT_ONCE, slots.length) },\n worker,\n ),\n )\n return photos\n }\n}\n"],"names":["pluginMediaIngest","STOCK_PHOTO_QUERY_MAX_CHARS","stockPhotoProvider","stockPhotoSourceKey","aiLayoutSeedNumber","AI_LAYOUT_STOCK_PHOTOS_BUDGET_MS","AI_LAYOUT_STOCK_SEARCHES_PER_PAGE","AI_LAYOUT_STOCK_PICK_WINDOW","AI_LAYOUT_STOCK_TRIES_PER_SLOT","AI_LAYOUT_STOCK_COPIES_AT_ONCE","AI_LAYOUT_STOCK_MAX_BYTES","AI_STOCK_PHOTO_PAGES_INPUT","words","list","Set","trim","split","STOPWORDS","FILLER","VENUES","ROLES","SITE_KINDS","DOING","BUSINESS_BREAK","PLACE_OR_AUDIENCE","WRAPPERS","REJECTED_TAGS","CRAFT_KIN","match","kin","broad","contentWords","text","toLowerCase","replace","map","word","filter","length","has","aiStockStem","lower","endsWith","slice","test","stemList","CLAUSE_BREAK","businessClauses","businessType","clauses","breaker","RegExp","source","at","opener","matchAll","push","index","businessOf","clause","aiStockBusinessWords","named","join","aiStockCraftWords","business","craft","aiStockSiteTerms","domain","made","making","kept","world","stem","add","size","group","some","query","Boolean","subjectOf","aiStockSubjectWords","alt","sectionName","found","aiStockObjectWord","subject","object","reverse","find","clip","aiStockOrientation","aspect","aiStockProductSearches","slot","orientation","minHeight","minWidth","craftStems","queries","raw","product","subjects","says","every","includes","seen","searches","entry","requires","aiStockSearchesFor","terms","role","subjectStems","namesWorld","qualify","phrase","people","key","pageSlug","pageUrl","last","decodeURIComponent","URL","pathname","pop","hitWords","photo","slug","tags","tag","lead","all","phrases","rejected","aiStockRelevance","judgement","hit","required","worldLead","pair","phrased","score","strict","Math","max","aiStockRank","photos","used","seed","scored","turn","ranked","sort","a","b","tier","start","aiStockPick","aiStockPlacedSrcs","nodes","out","node","Object","values","src","componentId","props","startsWith","JOB_PHOTOS","Map","JOB_PHOTOS_MAX","jobPhotos","placed","get","set","oldest","keys","next","value","undefined","delete","aiStockForgetJobPhotos","clear","EXTENSIONS","aiLayoutStockPhotoSource","input","deps","provider","ingest","hostId","uid","slots","timeout","AbortSignal","budgetMs","signal","any","scope","job","jobId","avoid","elsewhere","claimed","placedSrcs","answers","storing","remember","sourceKey","search","wanted","request","JSON","stringify","known","Promise","resolve","asked","then","catch","keep","findStockPhoto","width","height","aborted","bytes","download","maxBytes","credit","stored","fileName","id","contentType","description","stockPhoto","providerLabel","photographer","photographerUrl","license","licenseUrl","attributionRequired","ok","refusal","console","warn","status","reason","error","String","choices","entries","sectionNames","sectionIndex","choice","requests","blocked","first","candidates","fill","rank","candidate","worker","Array","from","min"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iBAAiB,QAGZ,kDAAiD;AACxD,SACEC,2BAA2B,EAC3BC,kBAAkB,EAClBC,mBAAm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A;SACD;QACDC,OAAO;YAAC;YAAqB;SAAU;IACzC;IACA;QACEF,OAAO;YAAC;YAAU;YAAe;SAAe;QAChDC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAoB;SAAkB;IAChD;IACA;QACEF,OAAO;YACL;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAoB;SAAU;IACxC;IACA;QACEF,OAAO;YAAC;YAAQ;YAAa;SAAW;QACxCC,KAAK;YAAC;YAAQ;YAAY;YAAU;YAAQ;YAAO;YAAW;SAAW;QACzEC,OAAO;YAAC;YAAiB;SAAmB;IAC9C;IACA;QACEF,OAAO;YACL;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAe;SAAmB;IAC5C;IACA;QACEF,OAAO;YAAC;YAAU;YAAS;YAAS;YAAU;YAAQ;SAAa;QACnEC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAU;SAAc;IAClC;IACA;QACEF,OAAO;YAAC;YAAU;YAAQ;YAAQ;YAAW;SAAW;QACxDC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAe;SAAS;IAClC;IACA;QACEF,OAAO;YAAC;YAAW;YAAU;SAAS;QACtCC,KAAK;YAAC;YAAU;YAAU;YAAW;YAAW;YAAS;SAAU;QACnEC,OAAO;YAAC;YAAW;SAAiB;IACtC;IACA;QACEF,OAAO;YACL;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,KAAK;YACH;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,OAAO;YAAC;YAAqB;SAAO;IACtC;IACA;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GAAG,CACfkI,MAAMC,IAAI,CACR;YAAEhO,QAAQyG,KAAKwH,GAAG,CAAC9P,gCAAgCsL,MAAMzJ,MAAM;QAAE,GACjE8N;QAGJ,OAAOlH;IACT;AACF"}
@@ -0,0 +1,30 @@
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
+ import type { AiBuildPlan } from '../../model/ai-build-plan';
18
+ /**
19
+ * RECONSTRUCTED, NOT RECORDED: the shape of the plan a production guided
20
+ * start failed on (AGL-3660). On 2026-10-09 (beta.237) a paid five-page
21
+ * portfolio start for "a ceramic artist who makes stoneware bowls, mugs and
22
+ * vases" (site kind portfolio, 94 credits, refunded) stopped at its plan with
23
+ * one finding, rule 3 `plan-form-not-placed` at `screens[1].sections[4]`,
24
+ * after its answer and its re-ask. The job keeps the findings but not the
25
+ * refused plan, so this is built from the job's inputs and that finding: the
26
+ * plan makes one contact form and places it on its Contact page, and its
27
+ * Work page ends with a section that asks for commissions and places
28
+ * nothing. The business name is replaced.
29
+ */
30
+ export declare const AI_CERAMICS_PORTFOLIO_SITE_PLAN: AiBuildPlan;
@@ -0,0 +1,220 @@
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
+ * RECONSTRUCTED, NOT RECORDED: the shape of the plan a production guided
18
+ * start failed on (AGL-3660). On 2026-10-09 (beta.237) a paid five-page
19
+ * portfolio start for "a ceramic artist who makes stoneware bowls, mugs and
20
+ * vases" (site kind portfolio, 94 credits, refunded) stopped at its plan with
21
+ * one finding, rule 3 `plan-form-not-placed` at `screens[1].sections[4]`,
22
+ * after its answer and its re-ask. The job keeps the findings but not the
23
+ * refused plan, so this is built from the job's inputs and that finding: the
24
+ * plan makes one contact form and places it on its Contact page, and its
25
+ * Work page ends with a section that asks for commissions and places
26
+ * nothing. The business name is replaced.
27
+ */ export const AI_CERAMICS_PORTFOLIO_SITE_PLAN = {
28
+ reuse: [
29
+ {
30
+ kind: 'layout',
31
+ id: 'laySite',
32
+ purpose: 'the site header, navigation and footer'
33
+ }
34
+ ],
35
+ create: [
36
+ {
37
+ kind: 'form',
38
+ name: 'Contact form',
39
+ why: 'Collectors and shops need a way to ask about pieces, commissions and wholesale orders.',
40
+ duplicateOf: null,
41
+ fields: [
42
+ 'name',
43
+ 'email',
44
+ 'subject',
45
+ 'message'
46
+ ]
47
+ }
48
+ ],
49
+ screens: [
50
+ {
51
+ title: 'Home',
52
+ slug: '/',
53
+ layout: 'laySite',
54
+ template: null,
55
+ duplicateOf: null,
56
+ nav: true,
57
+ seoTitle: 'Handmade Stoneware Ceramics | Kiln Street Ceramics',
58
+ seoDescription: 'Wheel-thrown stoneware bowls, mugs and vases, made by hand in small batches.',
59
+ record: null,
60
+ sections: [
61
+ {
62
+ name: 'Hero',
63
+ uses: [],
64
+ items: 0
65
+ },
66
+ {
67
+ name: 'Featured works',
68
+ uses: [],
69
+ items: 6
70
+ },
71
+ {
72
+ name: 'About the maker',
73
+ uses: [],
74
+ items: 0
75
+ },
76
+ {
77
+ name: 'From clay to kiln',
78
+ uses: [],
79
+ items: 3
80
+ },
81
+ {
82
+ name: 'Studio notes',
83
+ uses: [],
84
+ items: 3
85
+ },
86
+ {
87
+ name: 'Visit the studio',
88
+ uses: [],
89
+ items: 0
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ title: 'Work',
95
+ slug: '/work',
96
+ layout: 'laySite',
97
+ template: null,
98
+ duplicateOf: null,
99
+ nav: true,
100
+ seoTitle: 'Stoneware Bowls, Mugs and Vases | Kiln Street Ceramics',
101
+ seoDescription: 'Browse handmade stoneware: serving bowls, everyday mugs and sculptural vases.',
102
+ record: null,
103
+ sections: [
104
+ {
105
+ name: 'Work intro',
106
+ uses: [],
107
+ items: 0
108
+ },
109
+ {
110
+ name: 'Bowls collection',
111
+ uses: [],
112
+ items: 6
113
+ },
114
+ {
115
+ name: 'Mugs collection',
116
+ uses: [],
117
+ items: 6
118
+ },
119
+ {
120
+ name: 'Vases collection',
121
+ uses: [],
122
+ items: 6
123
+ },
124
+ {
125
+ name: 'Commission inquiry',
126
+ uses: [],
127
+ items: 0
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ title: 'About',
133
+ slug: '/about',
134
+ layout: 'laySite',
135
+ template: null,
136
+ duplicateOf: null,
137
+ nav: true,
138
+ seoTitle: 'About the Potter | Kiln Street Ceramics',
139
+ seoDescription: 'The story behind the studio, the clay and the glazes.',
140
+ record: null,
141
+ sections: [
142
+ {
143
+ name: 'Story',
144
+ uses: [],
145
+ items: 0
146
+ },
147
+ {
148
+ name: 'The studio',
149
+ uses: [],
150
+ items: 0
151
+ },
152
+ {
153
+ name: 'Materials and glazes',
154
+ uses: [],
155
+ items: 3
156
+ }
157
+ ]
158
+ },
159
+ {
160
+ title: 'Process',
161
+ slug: '/process',
162
+ layout: 'laySite',
163
+ template: null,
164
+ duplicateOf: null,
165
+ nav: true,
166
+ seoTitle: 'How Each Piece Is Made | Kiln Street Ceramics',
167
+ seoDescription: 'Throwing, trimming, glazing and firing: how a stoneware piece comes to be.',
168
+ record: null,
169
+ sections: [
170
+ {
171
+ name: 'Process intro',
172
+ uses: [],
173
+ items: 0
174
+ },
175
+ {
176
+ name: 'Steps',
177
+ uses: [],
178
+ items: 4
179
+ },
180
+ {
181
+ name: 'Care for your pieces',
182
+ uses: [],
183
+ items: 0
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ title: 'Contact',
189
+ slug: '/contact',
190
+ layout: 'laySite',
191
+ template: null,
192
+ duplicateOf: null,
193
+ nav: true,
194
+ seoTitle: 'Contact the Studio | Kiln Street Ceramics',
195
+ seoDescription: 'Ask about a piece, a commission or a wholesale order.',
196
+ record: null,
197
+ sections: [
198
+ {
199
+ name: 'Contact intro',
200
+ uses: [],
201
+ items: 0
202
+ },
203
+ {
204
+ name: 'Contact form',
205
+ uses: [
206
+ 'new:Contact form'
207
+ ],
208
+ items: 0
209
+ },
210
+ {
211
+ name: 'Studio hours',
212
+ uses: [],
213
+ items: 0
214
+ }
215
+ ]
216
+ }
217
+ ]
218
+ };
219
+
220
+ //# sourceMappingURL=ai-ceramics-portfolio-site-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/ai/src/lib/jobs/fixtures/ai-ceramics-portfolio-site-plan.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 type { AiBuildPlan } from '../../model/ai-build-plan'\n\n/**\n * RECONSTRUCTED, NOT RECORDED: the shape of the plan a production guided\n * start failed on (AGL-3660). On 2026-10-09 (beta.237) a paid five-page\n * portfolio start for \"a ceramic artist who makes stoneware bowls, mugs and\n * vases\" (site kind portfolio, 94 credits, refunded) stopped at its plan with\n * one finding, rule 3 `plan-form-not-placed` at `screens[1].sections[4]`,\n * after its answer and its re-ask. The job keeps the findings but not the\n * refused plan, so this is built from the job's inputs and that finding: the\n * plan makes one contact form and places it on its Contact page, and its\n * Work page ends with a section that asks for commissions and places\n * nothing. The business name is replaced.\n */\nexport const AI_CERAMICS_PORTFOLIO_SITE_PLAN: AiBuildPlan = {\n reuse: [{ kind: 'layout', id: 'laySite', purpose: 'the site header, navigation and footer' }],\n create: [\n {\n kind: 'form',\n name: 'Contact form',\n why: 'Collectors and shops need a way to ask about pieces, commissions and wholesale orders.',\n duplicateOf: null,\n fields: ['name', 'email', 'subject', 'message'],\n },\n ],\n screens: [\n {\n title: 'Home',\n slug: '/',\n layout: 'laySite',\n template: null,\n duplicateOf: null,\n nav: true,\n seoTitle: 'Handmade Stoneware Ceramics | Kiln Street Ceramics',\n seoDescription: 'Wheel-thrown stoneware bowls, mugs and vases, made by hand in small batches.',\n record: null,\n sections: [\n { name: 'Hero', uses: [], items: 0 },\n { name: 'Featured works', uses: [], items: 6 },\n { name: 'About the maker', uses: [], items: 0 },\n { name: 'From clay to kiln', uses: [], items: 3 },\n { name: 'Studio notes', uses: [], items: 3 },\n { name: 'Visit the studio', uses: [], items: 0 },\n ],\n },\n {\n title: 'Work',\n slug: '/work',\n layout: 'laySite',\n template: null,\n duplicateOf: null,\n nav: true,\n seoTitle: 'Stoneware Bowls, Mugs and Vases | Kiln Street Ceramics',\n seoDescription: 'Browse handmade stoneware: serving bowls, everyday mugs and sculptural vases.',\n record: null,\n sections: [\n { name: 'Work intro', uses: [], items: 0 },\n { name: 'Bowls collection', uses: [], items: 6 },\n { name: 'Mugs collection', uses: [], items: 6 },\n { name: 'Vases collection', uses: [], items: 6 },\n { name: 'Commission inquiry', uses: [], items: 0 },\n ],\n },\n {\n title: 'About',\n slug: '/about',\n layout: 'laySite',\n template: null,\n duplicateOf: null,\n nav: true,\n seoTitle: 'About the Potter | Kiln Street Ceramics',\n seoDescription: 'The story behind the studio, the clay and the glazes.',\n record: null,\n sections: [\n { name: 'Story', uses: [], items: 0 },\n { name: 'The studio', uses: [], items: 0 },\n { name: 'Materials and glazes', uses: [], items: 3 },\n ],\n },\n {\n title: 'Process',\n slug: '/process',\n layout: 'laySite',\n template: null,\n duplicateOf: null,\n nav: true,\n seoTitle: 'How Each Piece Is Made | Kiln Street Ceramics',\n seoDescription: 'Throwing, trimming, glazing and firing: how a stoneware piece comes to be.',\n record: null,\n sections: [\n { name: 'Process intro', uses: [], items: 0 },\n { name: 'Steps', uses: [], items: 4 },\n { name: 'Care for your pieces', uses: [], items: 0 },\n ],\n },\n {\n title: 'Contact',\n slug: '/contact',\n layout: 'laySite',\n template: null,\n duplicateOf: null,\n nav: true,\n seoTitle: 'Contact the Studio | Kiln Street Ceramics',\n seoDescription: 'Ask about a piece, a commission or a wholesale order.',\n record: null,\n sections: [\n { name: 'Contact intro', uses: [], items: 0 },\n { name: 'Contact form', uses: ['new:Contact form'], items: 0 },\n { name: 'Studio hours', uses: [], items: 0 },\n ],\n },\n ],\n}\n"],"names":["AI_CERAMICS_PORTFOLIO_SITE_PLAN","reuse","kind","id","purpose","create","name","why","duplicateOf","fields","screens","title","slug","layout","template","nav","seoTitle","seoDescription","record","sections","uses","items"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAID;;;;;;;;;;;CAWC,GACD,OAAO,MAAMA,kCAA+C;IAC1DC,OAAO;QAAC;YAAEC,MAAM;YAAUC,IAAI;YAAWC,SAAS;QAAyC;KAAE;IAC7FC,QAAQ;QACN;YACEH,MAAM;YACNI,MAAM;YACNC,KAAK;YACLC,aAAa;YACbC,QAAQ;gBAAC;gBAAQ;gBAAS;gBAAW;aAAU;QACjD;KACD;IACDC,SAAS;QACP;YACEC,OAAO;YACPC,MAAM;YACNC,QAAQ;YACRC,UAAU;YACVN,aAAa;YACbO,KAAK;YACLC,UAAU;YACVC,gBAAgB;Y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YACEV,OAAO;YACPC,MAAM;YACNC,QAAQ;YACRC,UAAU;YACVN,aAAa;YACbO,KAAK;YACLC,UAAU;YACVC,gBAAgB;YAChBC,QAAQ;YACRC,UAAU;gBACR;oBAAEb,MAAM;oBAAiBc,MAAM,EAAE;oBAAEC,OAAO;gBAAE;gBAC5C;oBAAEf,MAAM;oBAASc,MAAM,EAAE;oBAAEC,OAAO;gBAAE;gBACpC;oBAAEf,MAAM;oBAAwBc,MAAM,EAAE;oBAAEC,OAAO;gBAAE;aACpD;QACH;QACA;YACEV,OAAO;YACPC,MAAM;YACNC,QAAQ;YACRC,UAAU;YACVN,aAAa;YACbO,KAAK;YACLC,UAAU;YACVC,gBAAgB;YAChBC,QAAQ;YACRC,UAAU;gBACR;oBAAEb,MAAM;oBAAiBc,MAAM,EAAE;oBAAEC,OAAO;gBAAE;gBAC5C;oBAAEf,MAAM;oBAAgBc,MAAM;wBAAC;qBAAmB;oBAAEC,OAAO;gBAAE;gBAC7D;oBAAEf,MAAM;oBAAgBc,MAAM,EAAE;oBAAEC,OAAO;gBAAE;aAC5C;QACH;KACD;AACH,EAAC"}
@@ -0,0 +1,27 @@
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
+ import type { StockPhoto } from '@aglyn/aglyn/plugin-manager/stock-photo-provider';
18
+ /** `serving bowl portfolio` (horizontal, min_width 900), answered 2026-10-10T04:31:50.394Z. */
19
+ export declare const SERVING_BOWL_PORTFOLIO: StockPhoto[];
20
+ /** `nesting bowl set portfolio` (horizontal, min_width 900), answered 2026-10-10T04:32:04.242Z. */
21
+ export declare const NESTING_BOWL_SET_PORTFOLIO: StockPhoto[];
22
+ /** `tall bud vase portfolio` (vertical, min_height 900), answered 2026-10-10T04:31:59.394Z. */
23
+ export declare const TALL_BUD_VASE_PORTFOLIO: StockPhoto[];
24
+ /** `portfolio` (horizontal, min_width 1600), answered 2026-10-10T04:31:45.186Z. */
25
+ export declare const PORTFOLIO: StockPhoto[];
26
+ /** `candle gift set online` (vertical, min_height 900), answered 2026-10-10T04:18:45.927Z. */
27
+ export declare const CANDLE_GIFT_SET_ONLINE: StockPhoto[];