@aglyn/plugins-ai 1.15.1 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-plan.component.js +1 -1
  3. package/src/lib/components/ai-site-import-plan.component.js.map +1 -1
  4. package/src/lib/jobs/ai-job-import-step.js +6 -4
  5. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  6. package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
  7. package/src/lib/jobs/ai-job-page-language.js +29 -14
  8. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  9. package/src/lib/jobs/ai-job-page-step.js +3 -1
  10. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  11. package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
  12. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  13. package/src/lib/jobs/ai-site-import-compile.d.ts +9 -1
  14. package/src/lib/jobs/ai-site-import-compile.js +67 -1
  15. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  16. package/src/lib/jobs/ai-site-import-honesty.d.ts +6 -2
  17. package/src/lib/jobs/ai-site-import-honesty.js +5 -5
  18. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
  19. package/src/lib/jobs/ai-site-import-improve.d.ts +61 -2
  20. package/src/lib/jobs/ai-site-import-improve.js +184 -19
  21. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  22. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -1
  23. package/src/lib/layout-language/ai-layout-compiler.js +27 -9
  24. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  25. package/src/lib/model/ai-site-import-fidelity.d.ts +18 -2
  26. package/src/lib/model/ai-site-import-fidelity.js +35 -11
  27. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  28. package/src/lib/model/ai-site-import-view.js +6 -1
  29. package/src/lib/model/ai-site-import-view.js.map +1 -1
  30. package/src/lib/model/ai-site-import.d.ts +8 -1
  31. package/src/lib/model/ai-site-import.js +12 -4
  32. package/src/lib/model/ai-site-import.js.map +1 -1
  33. package/src/lib/runtime/ai-palette.generated.js +36 -5
  34. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
@@ -286,6 +286,8 @@ export interface AiLayoutPageBuilt {
286
286
  names?: string[];
287
287
  /** Why its layout was kept, or the design lines a redesign was taken missing, by internal code (AGL-4152): the row keeps them, the owner never reads them. */
288
288
  missed?: string[];
289
+ /** Why its layout was kept, line by line (`aiSiteImportRedesignWhy`): each miss's code and the line it names, for the job's record. */
290
+ why?: string[];
289
291
  };
290
292
  }
291
293
  export interface AiLayoutPageCheckInput {
@@ -45,7 +45,7 @@ import { AI_SITE_IMPORT_DESIGN_MAX_CHARS, aiCompileImportedPage, aiSiteImportDes
45
45
  import { aiSiteImportPageIsLegal, AI_SITE_IMPORT_LAYOUT_KEPT, AI_SITE_IMPORT_PROPOSED_NOT_WRITTEN } from "../model/ai-site-import.js";
46
46
  import { siteImportFidelity } from "../model/ai-site-import-fidelity.js";
47
47
  import { aiGenerationMaxTokensWithin, aiGenerationWorstCaseMs } from "./ai-job-budget.js";
48
- import { AI_SITE_IMPORT_IMPROVE_KIND, AI_SITE_IMPORT_IMPROVE_MOST_TOKENS, AI_SITE_IMPORT_IMPROVE_TOOL, aiSiteImportImproveCheck, aiSiteImportImproveDestinations, aiSiteImportImproveDigest, aiSiteImportImproveInstructions, aiSiteImportImproveLedger, aiSiteImportImprovePrompt, aiSiteImportImproveScope, aiSiteImportImprovedMisses, aiSiteImportImproveInputUsage, aiSiteImportImproveReaskTokens, aiSiteImportImproveRoleLines, aiSiteImportImproveTokensWithin, aiSiteImportImproveOnlySoft, aiSiteImportNewSectionsWanted, aiSiteImportPageRoleOf } from "./ai-site-import-improve.js";
48
+ import { AI_SITE_IMPORT_IMPROVE_KIND, AI_SITE_IMPORT_IMPROVE_MOST_TOKENS, AI_SITE_IMPORT_IMPROVE_TOOL, aiSiteImportImproveCheck, aiSiteImportImproveDestinations, aiSiteImportImproveDigest, aiSiteImportImproveInstructions, aiSiteImportImproveLedger, aiSiteImportImprovePrompt, aiSiteImportImproveScope, aiSiteImportImprovedMisses, aiSiteImportImproveInputUsage, aiSiteImportImproveReaskTokens, aiSiteImportImproveRoleLines, aiSiteImportImproveTokensWithin, aiSiteImportImproveOnlySoft, aiSiteImportNewSectionsWanted, aiSiteImportPageRoleOf, aiSiteImportMeaningShare, aiSiteImportRedesignWhy } from "./ai-site-import-improve.js";
49
49
  import { AI_SITE_IMPORT_WORDING_INSTRUCTIONS, AI_SITE_IMPORT_WORDING_KIND, AI_SITE_IMPORT_WORDING_TOOL, aiSiteImportWordingCheck, aiSiteImportWordingPage, aiSiteImportWordingPrompt, aiSiteImportWordingTokens } from "./ai-site-import-wording.js";
50
50
  /**
51
51
  * A page built in the compact layout language (AGL-3660): the page step's
@@ -992,9 +992,15 @@ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
992
992
  ]
993
993
  };
994
994
  }
995
- const report = validateAiDoctrineTree({
995
+ // What a rule has one answer for is settled as on every page the platform writes (AGL-4152): a style
996
+ // repeated on each element of one frame moves to the frame, before the check reads it.
997
+ const nodes = aiSettleMechanicalRules({
996
998
  rootId: CANVAS_ROOT_ELEMENT_ID,
997
999
  nodes: stored.nodes
1000
+ }, 'page').nodes;
1001
+ const report = validateAiDoctrineTree({
1002
+ rootId: CANVAS_ROOT_ELEMENT_ID,
1003
+ nodes
998
1004
  }, 'page', _extends({}, context, {
999
1005
  scrollTargetIds: input.sectionIds,
1000
1006
  repeatsCompiled: true
@@ -1007,7 +1013,7 @@ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
1007
1013
  return {
1008
1014
  compiled,
1009
1015
  value: {
1010
- nodes: aiWithSiteMotion(stored.nodes, (_ref = (_input_motion = input.motion) != null ? _input_motion : input.design) != null ? _ref : {
1016
+ nodes: aiWithSiteMotion(nodes, (_ref = (_input_motion = input.motion) != null ? _input_motion : input.design) != null ? _ref : {
1011
1017
  seed: 0
1012
1018
  }, {
1013
1019
  sectionIds: input.sectionIds
@@ -1335,6 +1341,11 @@ const NO_USAGE = {
1335
1341
  scope: (_doc_siteLines = doc.siteLines) != null ? _doc_siteLines : [],
1336
1342
  plan: (_doc_plan = doc.plan) != null ? _doc_plan : null
1337
1343
  }));
1344
+ const roleLines = aiSiteImportImproveRoleLines(_extends({}, needs, {
1345
+ folded: ledger.folded,
1346
+ kind: (_ref = (_doc_plan1 = doc.plan) == null ? void 0 : _doc_plan1.site.kind) != null ? _ref : null,
1347
+ seed: aiSiteSeed(input.job.$id)
1348
+ }));
1338
1349
  const prompt = aiSiteImportImprovePrompt({
1339
1350
  screen: input.screen,
1340
1351
  doc,
@@ -1342,11 +1353,7 @@ const NO_USAGE = {
1342
1353
  destinations: aiSiteImportImproveDestinations(doc, ledger),
1343
1354
  kindLines: aiSiteKindDesignLines(input.job.inputs),
1344
1355
  seed: input.job.$id.slice(-6),
1345
- roleLines: aiSiteImportImproveRoleLines(_extends({}, needs, {
1346
- folded: ledger.folded,
1347
- kind: (_ref = (_doc_plan1 = doc.plan) == null ? void 0 : _doc_plan1.site.kind) != null ? _ref : null,
1348
- seed: aiSiteSeed(input.job.$id)
1349
- }))
1356
+ roleLines
1350
1357
  });
1351
1358
  // The page's ceiling holds in code: the answer asks no more than it buys, and a re-ask it cannot pay for is not asked.
1352
1359
  const most = aiSiteImportImproveMaxTokens(input.model);
@@ -1371,7 +1378,9 @@ const NO_USAGE = {
1371
1378
  framing: (_input_context_framing = input.context.framing) != null ? _input_context_framing : null,
1372
1379
  plan: (_doc_plan = doc.plan) != null ? _doc_plan : null,
1373
1380
  theme,
1374
- needs
1381
+ needs,
1382
+ // The platform's own words for what the page tells ("why choose it"), which the answer may say in any case (AGL-4152).
1383
+ vocabulary: roleLines
1375
1384
  }, lenient ? {
1376
1385
  lenient: true
1377
1386
  } : {}, {
@@ -1403,7 +1412,9 @@ const NO_USAGE = {
1403
1412
  improved: _extends({
1404
1413
  scope: facts,
1405
1414
  destinations,
1406
- forms: savedForms
1415
+ forms: savedForms,
1416
+ vocabulary: roleLines,
1417
+ meaning: aiSiteImportMeaningShare(role)
1407
1418
  }, doc.proposed ? {
1408
1419
  proposed: true
1409
1420
  } : {})
@@ -1469,10 +1480,12 @@ const NO_USAGE = {
1469
1480
  ] : [
1470
1481
  answered.status
1471
1482
  ];
1472
- // Logged by its codes alone: an answer's words are the site's content.
1483
+ // Logged with each miss's line, cut short (AGL-4152): the answer is not kept, so this is all a later read of the job has to go on.
1484
+ const why = answered.status === 'needs_input' ? aiSiteImportRedesignWhy(answered.violations) : [];
1473
1485
  console.info('ai imported page: its redesign did not pass, its layout kept', {
1474
1486
  status: answered.status,
1475
- codes
1487
+ codes,
1488
+ why
1476
1489
  });
1477
1490
  // A new page has no words of its own to fall back on: it is left out, and its row says why.
1478
1491
  if (doc.proposed) return _extends({}, spent, {
@@ -1493,12 +1506,14 @@ const NO_USAGE = {
1493
1506
  ],
1494
1507
  words: 'kept',
1495
1508
  // Why, by internal code, for the job's row and the report (AGL-4152): never shown to the owner as it is.
1496
- redesign: {
1509
+ redesign: _extends({
1497
1510
  status: 'layout-kept',
1498
1511
  added: [],
1499
1512
  pictures: null,
1500
1513
  missed: codes
1501
- }
1514
+ }, why.length ? {
1515
+ why
1516
+ } : {})
1502
1517
  })
1503
1518
  });
1504
1519
  }