@aglyn/plugins-ai 1.21.0 → 1.22.1

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 (38) hide show
  1. package/package.json +18 -18
  2. package/src/lib/jobs/ai-job-import-step.d.ts +8 -0
  3. package/src/lib/jobs/ai-job-import-step.js +19 -2
  4. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  5. package/src/lib/jobs/ai-job-page-language.d.ts +8 -0
  6. package/src/lib/jobs/ai-job-page-language.js +127 -26
  7. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  8. package/src/lib/jobs/ai-job-page-step.d.ts +10 -0
  9. package/src/lib/jobs/ai-job-page-step.js +23 -1
  10. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  11. package/src/lib/jobs/ai-site-import-actions.d.ts +12 -3
  12. package/src/lib/jobs/ai-site-import-actions.js +43 -18
  13. package/src/lib/jobs/ai-site-import-actions.js.map +1 -1
  14. package/src/lib/jobs/ai-site-import-improve.d.ts +170 -5
  15. package/src/lib/jobs/ai-site-import-improve.js +508 -46
  16. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  17. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
  18. package/src/lib/layout-language/ai-layout-compiler.js +10 -4
  19. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  20. package/src/lib/layout-language/ai-layout-frame.js +11 -2
  21. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  22. package/src/lib/layout-language/ai-layout-gaps.d.ts +27 -0
  23. package/src/lib/layout-language/ai-layout-gaps.js +124 -0
  24. package/src/lib/layout-language/ai-layout-gaps.js.map +1 -1
  25. package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
  26. package/src/lib/layout-language/ai-layout-language.js +46 -1
  27. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  28. package/src/lib/model/ai-site-import-fidelity.d.ts +14 -1
  29. package/src/lib/model/ai-site-import-fidelity.js +25 -1
  30. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  31. package/src/lib/runtime/ai-doctrine.d.ts +3 -1
  32. package/src/lib/runtime/ai-doctrine.js +4 -1
  33. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  34. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +9 -8
  35. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  36. package/src/lib/site-import/site-import-page.d.ts +2 -2
  37. package/src/lib/site-import/site-import-page.js +42 -2
  38. package/src/lib/site-import/site-import-page.js.map +1 -1
@@ -2289,6 +2289,19 @@ const isHeading = (node)=>{
2289
2289
  if (xs) return Number(xs) < 6;
2290
2290
  return !/\b(?:sm|md|lg):/.test(size) && size.trim() !== '' && Number(size) < 6;
2291
2291
  };
2292
+ /** The most characters a line an invented fact sat in is kept at (AGL-4152). */ export const SITE_IMPORT_INVENTED_LINE_CHARS = 120;
2293
+ /**
2294
+ * A line cut short around what it says (AGL-4152): whole where it is short,
2295
+ * else the `SITE_IMPORT_INVENTED_LINE_CHARS` around the first place it says
2296
+ * `what`, an ellipsis where it was cut.
2297
+ */ export function siteImportLineAround(text, what, most = SITE_IMPORT_INVENTED_LINE_CHARS) {
2298
+ const line = clean(text);
2299
+ if (line.length <= most) return line;
2300
+ const found = line.toLowerCase().indexOf(what.toLowerCase());
2301
+ const room = most - 2;
2302
+ const start = Math.max(0, Math.min(found < 0 ? 0 : found - Math.floor(room / 2), line.length - room));
2303
+ return `${start > 0 ? '…' : ''}${line.slice(start, start + room).trim()}${start + room < line.length ? '…' : ''}`;
2304
+ }
2292
2305
  /** The kept ledger and the design lines of a page a generative Improve it built (AGL-4152). */ function improvedScore(source, built, look, drawnSections, options) {
2293
2306
  var _options_scope, _options_vocabulary, _source_photos, _options_forms, _options_destinations, _options_meaning, _source_photos1, _ref, _look_theme_button_fill;
2294
2307
  const ledger = siteImportLedger(_extends({
@@ -2326,6 +2339,15 @@ const isHeading = (node)=>{
2326
2339
  const found = [
2327
2340
  ...new Set(shown.flatMap((text)=>siteImportFactTokens(text, scope, true)))
2328
2341
  ].filter((token)=>!allowed.has(token) && token !== 'name:FAQ' && token !== 'name:FAQs');
2342
+ // The line each was found in, cut short around it (AGL-4152): never the page whole.
2343
+ const inventedAt = [
2344
+ ...new Set(found.slice(0, 8).flatMap((token)=>{
2345
+ const text = shown.find((entry)=>siteImportFactTokens(entry, scope, true).includes(token));
2346
+ return text ? [
2347
+ siteImportLineAround(text, token.slice(token.indexOf(':') + 1))
2348
+ ] : [];
2349
+ }))
2350
+ ];
2329
2351
  // Held: every thing that must land, on the page.
2330
2352
  const photoOf = new Map(((_source_photos = source.photos) != null ? _source_photos : []).flatMap((photo)=>photo.from ? [
2331
2353
  [
@@ -2395,7 +2417,9 @@ const isHeading = (node)=>{
2395
2417
  }),
2396
2418
  invented: _extends({}, line(found.length ? 0 : 1, 1), {
2397
2419
  found: found.slice(0, 8)
2398
- }),
2420
+ }, inventedAt.length ? {
2421
+ at: inventedAt
2422
+ } : {}),
2399
2423
  held: _extends({}, line(musts.length - missingHeld.length, musts.length), {
2400
2424
  missing: missingHeld
2401
2425
  }),