@aglyn/plugins-ai 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/ai-site-build-page.component.js +5 -3
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/ai-site-import-finish.component.d.ts +3 -1
- package/src/lib/components/ai-site-import-finish.component.js +3 -3
- package/src/lib/components/ai-site-import-finish.component.js.map +1 -1
- package/src/lib/components/ai-site-import-job.component.d.ts +4 -3
- package/src/lib/components/ai-site-import-job.component.js +141 -43
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/components/ai-site-import-plan.component.d.ts +42 -0
- package/src/lib/components/ai-site-import-plan.component.js +246 -0
- package/src/lib/components/ai-site-import-plan.component.js.map +1 -0
- package/src/lib/components/ai-site-import-start.component.d.ts +3 -1
- package/src/lib/components/ai-site-import-start.component.js +3 -2
- package/src/lib/components/ai-site-import-start.component.js.map +1 -1
- package/src/lib/components/ai-site-start-card.component.js +6 -2
- package/src/lib/components/ai-site-start-card.component.js.map +1 -1
- package/src/lib/components/ai-site-start-steps.component.d.ts +3 -2
- package/src/lib/components/ai-site-start-steps.component.js +12 -5
- package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +47 -2
- package/src/lib/jobs/ai-job-import-step.js +356 -22
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +4 -1
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +21 -2
- package/src/lib/jobs/ai-job-page-language.js +217 -5
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.d.ts +7 -0
- package/src/lib/jobs/ai-job-page-step.js +73 -12
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.js +4 -2
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-look.js +14 -5
- package/src/lib/jobs/ai-job-site-look.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +10 -2
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs.js +2 -1
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +43 -2
- package/src/lib/jobs/ai-site-import-compile.js +126 -63
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +25 -1
- package/src/lib/jobs/ai-site-import-document.js +26 -7
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-honesty.d.ts +65 -0
- package/src/lib/jobs/ai-site-import-honesty.js +271 -0
- package/src/lib/jobs/ai-site-import-honesty.js.map +1 -0
- package/src/lib/jobs/ai-site-import-improve.d.ts +233 -0
- package/src/lib/jobs/ai-site-import-improve.js +1151 -0
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -0
- package/src/lib/jobs/ai-site-import-look.d.ts +4 -0
- package/src/lib/jobs/ai-site-import-look.js +16 -6
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/jobs/ai-site-import-pictures.d.ts +83 -0
- package/src/lib/jobs/ai-site-import-pictures.js +261 -0
- package/src/lib/jobs/ai-site-import-pictures.js.map +1 -0
- package/src/lib/jobs/ai-site-import-plan.d.ts +78 -0
- package/src/lib/jobs/ai-site-import-plan.js +627 -0
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -0
- package/src/lib/jobs/ai-site-import-wording.js +2 -5
- package/src/lib/jobs/ai-site-import-wording.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
- package/src/lib/layout-language/ai-layout-compiler.js +100 -14
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-design.d.ts +9 -0
- package/src/lib/layout-language/ai-layout-design.js +29 -3
- package/src/lib/layout-language/ai-layout-design.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +5 -0
- package/src/lib/layout-language/ai-layout-frame-source.js +4 -2
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.d.ts +2 -0
- package/src/lib/layout-language/ai-layout-frame.js +20 -12
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +16 -2
- package/src/lib/layout-language/ai-layout-language.js +11 -5
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +71 -0
- package/src/lib/model/ai-site-import-fidelity.js +438 -6
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-ledger.d.ts +82 -0
- package/src/lib/model/ai-site-import-ledger.js +254 -0
- package/src/lib/model/ai-site-import-ledger.js.map +1 -0
- package/src/lib/model/ai-site-import-view.d.ts +110 -6
- package/src/lib/model/ai-site-import-view.js +166 -13
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +234 -2
- package/src/lib/model/ai-site-import.js +312 -15
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-job.js +4 -0
- package/src/lib/model/ai-site-job.js.map +1 -1
- package/src/lib/model/ai-site-kinds.d.ts +2 -0
- package/src/lib/model/ai-site-kinds.js +7 -0
- package/src/lib/model/ai-site-kinds.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +14 -5
- package/src/lib/model/ai-site-look.js +22 -16
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/model/ai-site-start.d.ts +37 -7
- package/src/lib/model/ai-site-start.js +54 -10
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/ai-site-starter-look.d.ts +69 -0
- package/src/lib/model/ai-site-starter-look.js +90 -0
- package/src/lib/model/ai-site-starter-look.js.map +1 -0
- package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -0
- package/src/lib/runtime/ai-doctrine-validators.js +3 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-doctrine.d.ts +10 -0
- package/src/lib/runtime/ai-doctrine.js +16 -2
- package/src/lib/runtime/ai-doctrine.js.map +1 -1
- package/src/lib/runtime/site-inventory.js +2 -3
- package/src/lib/runtime/site-inventory.js.map +1 -1
- package/src/lib/server/ai-jobs-resume.js +12 -3
- package/src/lib/server/ai-jobs-resume.js.map +1 -1
- package/src/lib/server/ai-jobs-route.js +5 -1
- package/src/lib/server/ai-jobs-route.js.map +1 -1
- package/src/lib/server/ai-site-import-route.d.ts +6 -0
- package/src/lib/server/ai-site-import-route.js +8 -1
- package/src/lib/server/ai-site-import-route.js.map +1 -1
- package/src/lib/server/assist-view-context.js +3 -3
- package/src/lib/server/assist-view-context.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +57 -7
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +277 -21
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-improve-answers.d.ts +33 -0
- package/src/lib/site-import/fixtures/site-import-improve-answers.js +457 -0
- package/src/lib/site-import/fixtures/site-import-improve-answers.js.map +1 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +29 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +26 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-concealed.d.ts +30 -0
- package/src/lib/site-import/site-import-concealed.js +231 -0
- package/src/lib/site-import/site-import-concealed.js.map +1 -0
- package/src/lib/site-import/site-import-crawl.d.ts +3 -1
- package/src/lib/site-import/site-import-crawl.js +8 -1
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.js +13 -2
- package/src/lib/site-import/site-import-css.js.map +1 -1
- package/src/lib/site-import/site-import-flag.d.ts +17 -0
- package/src/lib/site-import/site-import-flag.js +15 -0
- package/src/lib/site-import/site-import-flag.js.map +1 -1
- package/src/lib/site-import/site-import-html.d.ts +28 -0
- package/src/lib/site-import/site-import-html.js +246 -49
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.js +211 -12
- package/src/lib/site-import/site-import-layout.js.map +1 -1
- package/src/lib/site-import/site-import-page.js +2 -0
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/testing/stand-in-dataset-index.js +6 -2
- package/src/lib/testing/stand-in-dataset-index.js.map +1 -1
|
@@ -49,7 +49,8 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
|
|
|
49
49
|
* site. The person is told why and checks again.
|
|
50
50
|
*=========================================*/ import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
51
51
|
import { videoEmbedOf } from "@aglyn/aglyn/plugin-manager/video-embed-provider";
|
|
52
|
-
import { aiCreditRangeOrdered, aiCreditRangeText, AI_MEASURED_IMPORT_CREDITS } from "./ai-credit-estimate.js";
|
|
52
|
+
import { aiCreditRangeOrdered, aiCreditRangeText, AI_MEASURED_IMPORT_CREDITS, AI_MEASURED_PAID_SITE_CREDITS } from "./ai-credit-estimate.js";
|
|
53
|
+
import { aiMediaCreditsPerPicture } from "./ai-media-credits.js";
|
|
53
54
|
/** The job kind. */ export const AI_SITE_IMPORT_KIND = 'import';
|
|
54
55
|
/** The input naming the proved domain the job brings in. */ export const AI_SITE_IMPORT_DOMAIN_INPUT = 'domain';
|
|
55
56
|
/** The most pages one wave brings in. */ export const AI_SITE_IMPORT_WAVE_PAGES = 10;
|
|
@@ -470,6 +471,28 @@ function trimItem(item, keep) {
|
|
|
470
471
|
'imprint',
|
|
471
472
|
'impressum'
|
|
472
473
|
];
|
|
474
|
+
/** What a page's row says where its redesign did not pass (AGL-4152). */ export const AI_SITE_IMPORT_LAYOUT_KEPT = 'Layout kept: the redesign did not pass';
|
|
475
|
+
/** What a proposed page's row says where it could not be written: it has no old page to keep, so it is left out. */ export const AI_SITE_IMPORT_PROPOSED_NOT_WRITTEN = 'This new page was left out: it could not be written without inventing facts. Its credits are given back.';
|
|
476
|
+
export const AI_SITE_IMPORT_PAGE_ROLES = [
|
|
477
|
+
'home',
|
|
478
|
+
'service',
|
|
479
|
+
'about',
|
|
480
|
+
'contact',
|
|
481
|
+
'gallery',
|
|
482
|
+
'pricing',
|
|
483
|
+
'faq',
|
|
484
|
+
'other'
|
|
485
|
+
];
|
|
486
|
+
/**
|
|
487
|
+
* Whether generated pictures are on where the owner has not said (AGL-4152):
|
|
488
|
+
* on, with a switch. A picture costs credits, so a wave that may take them
|
|
489
|
+
* quotes them in its ceiling before it starts, and the switch turns them off.
|
|
490
|
+
*/ export const AI_SITE_IMPORT_GENERATED_PICTURES_DEFAULT = true;
|
|
491
|
+
/** What a plan's row and panel say where it did not pass (AGL-4152). */ export const AI_SITE_IMPORT_PLAN_FELL_BACK = 'Your menu and footer stay as your site has them: the plan for your new site did not pass.';
|
|
492
|
+
/** The ledger slot of the plan's proposed page. */ export const AI_SITE_IMPORT_PROPOSED_SLOT = 'proposed';
|
|
493
|
+
/** What a plan's answer calls its proposed page before it has an id. */ export const AI_SITE_IMPORT_PROPOSED_PAGE = 'new';
|
|
494
|
+
/** The most generated pictures one page takes (AGL-4152), a hero or a section's lead only. */ export const AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE = 2;
|
|
495
|
+
/** What the plan's own pass may spend at most: its answer and its one re-ask at the measured p90. */ export const AI_SITE_IMPORT_PLAN_CEILING_CREDITS = 180;
|
|
473
496
|
/**
|
|
474
497
|
* Whether the site's header and footer are built from the source's own menu
|
|
475
498
|
* (AGL-4108), with no model: the home page's menu was read. Then the frame
|
|
@@ -965,6 +988,7 @@ const OPEN = new Set([
|
|
|
965
988
|
return read.layout.sections.some((section)=>holds(section.nodes));
|
|
966
989
|
}
|
|
967
990
|
/** What the next pass of the step does. */ export function aiSiteImportNextWork(state, items) {
|
|
991
|
+
var _state_waves_;
|
|
968
992
|
// A read that stopped at its home page reads again: the person's Check again.
|
|
969
993
|
if (!state || aiSiteImportReadStops(state.verdict)) return {
|
|
970
994
|
kind: 'inventory'
|
|
@@ -990,6 +1014,17 @@ const OPEN = new Set([
|
|
|
990
1014
|
wave: running,
|
|
991
1015
|
pages: unread
|
|
992
1016
|
};
|
|
1017
|
+
// A generative Improve it plans the site once, before anything of it is built (AGL-4152).
|
|
1018
|
+
if (running.generative && running.frame && ((_state_waves_ = state.waves[0]) == null ? void 0 : _state_waves_.index) === running.index) {
|
|
1019
|
+
if (state.plan === undefined) return {
|
|
1020
|
+
kind: 'plan',
|
|
1021
|
+
wave: running
|
|
1022
|
+
};
|
|
1023
|
+
if (state.plan && !state.planAccepted) return {
|
|
1024
|
+
kind: 'plan-accepted',
|
|
1025
|
+
wave: running
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
993
1028
|
if (running.frame && state.frame && aiSiteImportItemOpen(items, AI_SITE_IMPORT_FRAME_SLOT)) {
|
|
994
1029
|
return {
|
|
995
1030
|
kind: 'frame',
|
|
@@ -1271,16 +1306,23 @@ const readChars = (read)=>{
|
|
|
1271
1306
|
* of its pages with whether its words are kept or improved. The step stamps a
|
|
1272
1307
|
* wave once, when it starts, so a change made before a later wave reaches only
|
|
1273
1308
|
* the waves that have not started.
|
|
1274
|
-
*/ export function aiSiteImportWaveStamped(state, index) {
|
|
1309
|
+
*/ export function aiSiteImportWaveStamped(state, index, options = {}) {
|
|
1275
1310
|
const wave = state.waves.find((entry)=>entry.index === index);
|
|
1276
1311
|
if (!wave) return state;
|
|
1277
1312
|
const choice = aiSiteImportChoiceOf(state);
|
|
1278
1313
|
const slots = new Set(wave.slots);
|
|
1314
|
+
// A generative Improve it plans the site and its design with new copy or without (AGL-4152):
|
|
1315
|
+
// a page is redesigned from its ledger only where its words are improved too.
|
|
1316
|
+
const generative = options.generative === true && choice.finish === 'improve';
|
|
1279
1317
|
return _extends({}, state, {
|
|
1280
1318
|
waves: state.waves.map((entry)=>entry.index === index ? _extends({}, entry, {
|
|
1281
1319
|
finish: choice.finish,
|
|
1282
1320
|
wording: choice.wording
|
|
1283
|
-
}
|
|
1321
|
+
}, generative ? {
|
|
1322
|
+
generative: true
|
|
1323
|
+
} : {}, options.videoPosters === true ? {
|
|
1324
|
+
videoPosters: true
|
|
1325
|
+
} : {}) : entry),
|
|
1284
1326
|
pages: state.pages.map((page)=>slots.has(page.slot) ? _extends({}, page, {
|
|
1285
1327
|
wording: aiSiteImportPageWording(page, choice)
|
|
1286
1328
|
}) : page)
|
|
@@ -1306,6 +1348,213 @@ const readChars = (read)=>{
|
|
|
1306
1348
|
'siteImport.wording': aiSiteImportWordingOf(finish, asked)
|
|
1307
1349
|
};
|
|
1308
1350
|
}
|
|
1351
|
+
/** The most source photos an import holds for a later page's slots: each is a library reference, and every page rides one job document. */ const SITE_PHOTOS_HELD = 24;
|
|
1352
|
+
/**
|
|
1353
|
+
* How a page's generative Improve it came out (AGL-4152), what it added and what
|
|
1354
|
+
* it shows, for its row; and the source's photos it left off, which a later
|
|
1355
|
+
* page's slot takes before a stock photo.
|
|
1356
|
+
*/ export function aiSiteImportRedesignOf(state, slot, redesign, added, pictures) {
|
|
1357
|
+
var _ref, _ref1, _next_sitePhotos;
|
|
1358
|
+
var _state_pages_find_photos, _state_pages_find;
|
|
1359
|
+
const next = withPage(state, slot, _extends({
|
|
1360
|
+
redesign
|
|
1361
|
+
}, (added == null ? void 0 : added.length) ? {
|
|
1362
|
+
added: [
|
|
1363
|
+
...added
|
|
1364
|
+
]
|
|
1365
|
+
} : {}, pictures ? {
|
|
1366
|
+
pictures
|
|
1367
|
+
} : {}));
|
|
1368
|
+
const left = new Set((_ref = pictures == null ? void 0 : pictures.unplaced) != null ? _ref : []);
|
|
1369
|
+
if (!left.size) return next;
|
|
1370
|
+
const assets = (_ref1 = (_state_pages_find = state.pages.find((page)=>page.slot === slot)) == null ? void 0 : (_state_pages_find_photos = _state_pages_find.photos) == null ? void 0 : _state_pages_find_photos.assets) != null ? _ref1 : [];
|
|
1371
|
+
const held = (_next_sitePhotos = next.sitePhotos) != null ? _next_sitePhotos : [];
|
|
1372
|
+
const pool = [
|
|
1373
|
+
...held,
|
|
1374
|
+
...assets.filter((photo)=>!!photo.from && left.has(photo.from) && !held.some((other)=>other.src === photo.src))
|
|
1375
|
+
].slice(0, SITE_PHOTOS_HELD);
|
|
1376
|
+
return pool.length ? _extends({}, next, {
|
|
1377
|
+
sitePhotos: pool
|
|
1378
|
+
}) : next;
|
|
1379
|
+
}
|
|
1380
|
+
/*------------------------------------------
|
|
1381
|
+
* The site's plan (AGL-4152)
|
|
1382
|
+
*-----------------------------------------*/ /** Whether generated pictures are on for an import: as its owner said, else the default. */ export function aiSiteImportGeneratedPicturesOn(state) {
|
|
1383
|
+
return typeof (state == null ? void 0 : state.generatedPictures) === 'boolean' ? state.generatedPictures : AI_SITE_IMPORT_GENERATED_PICTURES_DEFAULT;
|
|
1384
|
+
}
|
|
1385
|
+
/** Whether the job waits on its owner's say-so over a plan (AGL-4152): shown, and nothing of the site built. */ export function aiSiteImportPlanAwaits(state) {
|
|
1386
|
+
return !!(state == null ? void 0 : state.plan) && !state.planAccepted;
|
|
1387
|
+
}
|
|
1388
|
+
/** Whether the site has room for a page more than the import brings in (AGL-4152): the plan's count, against what is there and what is coming. */ export function aiSiteImportHasRoomForPage(state, room) {
|
|
1389
|
+
if (room.limit === null) return true;
|
|
1390
|
+
return room.limit - room.used - state.pages.filter((page)=>!page.refused).length >= 1;
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* The plan in, or the plan that did not pass (`null`). A proposed page takes
|
|
1394
|
+
* its place in the wave's rows as a page of its own, new, with no source: its
|
|
1395
|
+
* words are written from what the site says, so its one line is its purpose.
|
|
1396
|
+
*/ export function aiSiteImportPlanIn(state, wave, plan, at, draftId) {
|
|
1397
|
+
if (!(plan == null ? void 0 : plan.proposed)) return _extends({}, state, {
|
|
1398
|
+
plan
|
|
1399
|
+
});
|
|
1400
|
+
const proposed = plan.proposed;
|
|
1401
|
+
const named = (pages)=>pages.map((page)=>page === AI_SITE_IMPORT_PROPOSED_PAGE ? draftId : page);
|
|
1402
|
+
const page = {
|
|
1403
|
+
slot: AI_SITE_IMPORT_PROPOSED_SLOT,
|
|
1404
|
+
url: `https://${state.domain}/${proposed.slug}`,
|
|
1405
|
+
path: `/${proposed.slug}`,
|
|
1406
|
+
title: proposed.title,
|
|
1407
|
+
group: 'main',
|
|
1408
|
+
wave: wave.index,
|
|
1409
|
+
draftId,
|
|
1410
|
+
slug: proposed.slug,
|
|
1411
|
+
words: 0,
|
|
1412
|
+
images: 0,
|
|
1413
|
+
origin: 'proposed',
|
|
1414
|
+
build: 'arranged',
|
|
1415
|
+
wording: 'improved',
|
|
1416
|
+
photos: {
|
|
1417
|
+
brought: 0,
|
|
1418
|
+
reused: 0,
|
|
1419
|
+
skipped: 0,
|
|
1420
|
+
assets: []
|
|
1421
|
+
},
|
|
1422
|
+
read: {
|
|
1423
|
+
at,
|
|
1424
|
+
title: proposed.title,
|
|
1425
|
+
text: proposed.purpose,
|
|
1426
|
+
sections: [
|
|
1427
|
+
proposed.title
|
|
1428
|
+
],
|
|
1429
|
+
images: [],
|
|
1430
|
+
blocks: [
|
|
1431
|
+
{
|
|
1432
|
+
kind: 'heading',
|
|
1433
|
+
level: 1,
|
|
1434
|
+
text: proposed.title,
|
|
1435
|
+
region: 'main'
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
kind: 'paragraph',
|
|
1439
|
+
text: proposed.purpose,
|
|
1440
|
+
region: 'main'
|
|
1441
|
+
}
|
|
1442
|
+
],
|
|
1443
|
+
words: proposed.purpose.split(/\s+/).filter(Boolean).length,
|
|
1444
|
+
forms: [],
|
|
1445
|
+
layout: null
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
const cta = plan.nav.primaryCta;
|
|
1449
|
+
return _extends({}, state, {
|
|
1450
|
+
plan: _extends({}, plan, {
|
|
1451
|
+
nav: {
|
|
1452
|
+
groups: plan.nav.groups.map((group)=>_extends({}, group, {
|
|
1453
|
+
pages: named(group.pages)
|
|
1454
|
+
})),
|
|
1455
|
+
primaryCta: cta && cta.target === AI_SITE_IMPORT_PROPOSED_PAGE ? _extends({}, cta, {
|
|
1456
|
+
target: draftId
|
|
1457
|
+
}) : cta,
|
|
1458
|
+
footer: plan.nav.footer.map((column)=>_extends({}, column, {
|
|
1459
|
+
pages: named(column.pages)
|
|
1460
|
+
}))
|
|
1461
|
+
},
|
|
1462
|
+
proposed: _extends({}, proposed, {
|
|
1463
|
+
draftId
|
|
1464
|
+
})
|
|
1465
|
+
}, plan.roles ? {
|
|
1466
|
+
roles: Object.fromEntries(Object.entries(plan.roles).map(([id, role])=>[
|
|
1467
|
+
id === AI_SITE_IMPORT_PROPOSED_PAGE ? draftId : id,
|
|
1468
|
+
role
|
|
1469
|
+
]))
|
|
1470
|
+
} : {}),
|
|
1471
|
+
pages: [
|
|
1472
|
+
...state.pages,
|
|
1473
|
+
page
|
|
1474
|
+
],
|
|
1475
|
+
waves: state.waves.map((entry)=>entry.index === wave.index ? _extends({}, entry, {
|
|
1476
|
+
slots: [
|
|
1477
|
+
...entry.slots,
|
|
1478
|
+
AI_SITE_IMPORT_PROPOSED_SLOT
|
|
1479
|
+
]
|
|
1480
|
+
}) : entry)
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
/** A plan with its proposed page's row: pending, unless it is the one row a plan has already added. */ export function aiSiteImportPlanRow(state, items) {
|
|
1484
|
+
var _state_plan;
|
|
1485
|
+
const proposed = (_state_plan = state.plan) == null ? void 0 : _state_plan.proposed;
|
|
1486
|
+
if (!proposed || items.some((row)=>row.slot === AI_SITE_IMPORT_PROPOSED_SLOT)) return [
|
|
1487
|
+
...items
|
|
1488
|
+
];
|
|
1489
|
+
return [
|
|
1490
|
+
...items,
|
|
1491
|
+
{
|
|
1492
|
+
slot: AI_SITE_IMPORT_PROPOSED_SLOT,
|
|
1493
|
+
op: 'page',
|
|
1494
|
+
label: proposed.title,
|
|
1495
|
+
status: 'pending',
|
|
1496
|
+
attempt: 1,
|
|
1497
|
+
creditsSpent: 0,
|
|
1498
|
+
creditsRefunded: 0,
|
|
1499
|
+
outputs: []
|
|
1500
|
+
}
|
|
1501
|
+
];
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* The owner started the build (AGL-4152). A proposed page they switched off is
|
|
1505
|
+
* gone: its row, its place in the wave, and every menu entry that named it.
|
|
1506
|
+
*/ export function aiSiteImportPlanAccepted(state, items) {
|
|
1507
|
+
const plan = state.plan;
|
|
1508
|
+
if (!(plan == null ? void 0 : plan.proposed) || plan.proposed.on) return {
|
|
1509
|
+
state: _extends({}, state, {
|
|
1510
|
+
planAccepted: true
|
|
1511
|
+
}),
|
|
1512
|
+
items: [
|
|
1513
|
+
...items
|
|
1514
|
+
]
|
|
1515
|
+
};
|
|
1516
|
+
const off = plan.proposed.draftId;
|
|
1517
|
+
const kept = (pages)=>pages.filter((page)=>page !== off);
|
|
1518
|
+
const cta = plan.nav.primaryCta;
|
|
1519
|
+
return {
|
|
1520
|
+
state: _extends({}, state, {
|
|
1521
|
+
planAccepted: true,
|
|
1522
|
+
plan: _extends({}, plan, {
|
|
1523
|
+
nav: {
|
|
1524
|
+
groups: plan.nav.groups.map((group)=>_extends({}, group, {
|
|
1525
|
+
pages: kept(group.pages)
|
|
1526
|
+
})).filter((group)=>group.pages.length),
|
|
1527
|
+
primaryCta: (cta == null ? void 0 : cta.target) === off ? null : cta,
|
|
1528
|
+
footer: plan.nav.footer.map((column)=>_extends({}, column, {
|
|
1529
|
+
pages: kept(column.pages)
|
|
1530
|
+
})).filter((column)=>column.pages.length)
|
|
1531
|
+
},
|
|
1532
|
+
proposed: _extends({}, plan.proposed, {
|
|
1533
|
+
on: false
|
|
1534
|
+
})
|
|
1535
|
+
}),
|
|
1536
|
+
pages: state.pages.filter((page)=>page.slot !== AI_SITE_IMPORT_PROPOSED_SLOT),
|
|
1537
|
+
waves: state.waves.map((wave)=>_extends({}, wave, {
|
|
1538
|
+
slots: wave.slots.filter((slot)=>slot !== AI_SITE_IMPORT_PROPOSED_SLOT)
|
|
1539
|
+
}))
|
|
1540
|
+
}),
|
|
1541
|
+
items: items.filter((row)=>row.slot !== AI_SITE_IMPORT_PROPOSED_SLOT)
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* The owner's answer to a plan (AGL-4152), as the resume door writes it onto
|
|
1546
|
+
* an import waiting on one. What is not given stands. `null` when the job is
|
|
1547
|
+
* not an import waiting on a plan, or nothing is asked.
|
|
1548
|
+
*/ export function aiSiteImportPlanUpdate(job, change) {
|
|
1549
|
+
var _job_siteImport;
|
|
1550
|
+
var _job_review, _state_plan;
|
|
1551
|
+
const state = (_job_siteImport = job.siteImport) != null ? _job_siteImport : null;
|
|
1552
|
+
if (job.kind !== AI_SITE_IMPORT_KIND || job.status !== 'needs_review' || ((_job_review = job.review) == null ? void 0 : _job_review.reason) !== 'wave' || !aiSiteImportPlanAwaits(state)) return null;
|
|
1553
|
+
const update = {};
|
|
1554
|
+
if (typeof change.addPage === 'boolean' && (state == null ? void 0 : (_state_plan = state.plan) == null ? void 0 : _state_plan.proposed)) update['siteImport.plan.proposed.on'] = change.addPage;
|
|
1555
|
+
if (typeof change.pictures === 'boolean') update['siteImport.generatedPictures'] = change.pictures;
|
|
1556
|
+
return Object.keys(update).length ? update : null;
|
|
1557
|
+
}
|
|
1309
1558
|
/**
|
|
1310
1559
|
* A page whose rewrite was refused (AGL-4152): it keeps every word as
|
|
1311
1560
|
* written, and its row reads as kept. Only a page stamped `improved` changes.
|
|
@@ -1359,14 +1608,19 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1359
1608
|
* priced as an AI page, inside the same ceiling.
|
|
1360
1609
|
*/ export function aiSiteImportCreditRange(pages, options = {}) {
|
|
1361
1610
|
const count = whole(pages);
|
|
1362
|
-
const
|
|
1611
|
+
const proposed = whole(options.proposed);
|
|
1612
|
+
const arranged = whole(options.arranged) + proposed;
|
|
1363
1613
|
const copied = whole(options.copied);
|
|
1364
|
-
const wording = aiSiteImportWordingCredits(Math.min(arranged, whole(options.reworded)));
|
|
1614
|
+
const wording = aiSiteImportWordingCredits(Math.min(arranged, whole(options.reworded) + proposed));
|
|
1365
1615
|
const measured = AI_MEASURED_IMPORT_CREDITS;
|
|
1616
|
+
const plan = options.plan ? AI_MEASURED_PAID_SITE_CREDITS.plan : {
|
|
1617
|
+
median: 0,
|
|
1618
|
+
p90: 0
|
|
1619
|
+
};
|
|
1366
1620
|
return aiCreditRangeOrdered({
|
|
1367
|
-
likely: count * measured.page.median + arranged * measured.arranged.median + wording.likely + copied * measured.copied.median + (options.frame ? measured.frame.median : 0),
|
|
1368
|
-
p90: count * measured.page.p90 + arranged * measured.arranged.p90 + wording.p90 + copied * measured.copied.p90 + (options.frame ? measured.frame.p90 : 0),
|
|
1369
|
-
ceiling: (count + arranged) * AI_SITE_IMPORT_PAGE_CEILING_CREDITS + copied * AI_SITE_IMPORT_COPIED_CEILING_CREDITS + (options.frame ? AI_SITE_IMPORT_FRAME_CEILING_CREDITS : 0)
|
|
1621
|
+
likely: count * measured.page.median + arranged * measured.arranged.median + wording.likely + copied * measured.copied.median + (options.frame ? measured.frame.median : 0) + plan.median,
|
|
1622
|
+
p90: count * measured.page.p90 + arranged * measured.arranged.p90 + wording.p90 + copied * measured.copied.p90 + (options.frame ? measured.frame.p90 : 0) + plan.p90,
|
|
1623
|
+
ceiling: (count + arranged) * AI_SITE_IMPORT_PAGE_CEILING_CREDITS + copied * AI_SITE_IMPORT_COPIED_CEILING_CREDITS + (options.frame ? AI_SITE_IMPORT_FRAME_CEILING_CREDITS : 0) + (options.plan ? AI_SITE_IMPORT_PLAN_CEILING_CREDITS : 0) + whole(options.pictures) * aiMediaCreditsPerPicture('photo', undefined, '1K')
|
|
1370
1624
|
});
|
|
1371
1625
|
}
|
|
1372
1626
|
/**
|
|
@@ -1375,15 +1629,19 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1375
1629
|
* wave improves (AGL-4152): as stamped once it has started, and as the
|
|
1376
1630
|
* import's choice now would stamp them before.
|
|
1377
1631
|
*/ export function aiSiteImportWaveOwed(state, wave, items) {
|
|
1632
|
+
var _state_waves_;
|
|
1378
1633
|
const owed = (slot)=>items ? aiSiteImportItemOpen(items, slot) : true;
|
|
1379
1634
|
const choice = aiSiteImportWaveChoice(state, wave);
|
|
1635
|
+
// A generative Improve it's own (AGL-4152): its frame draws from the plan, and a plan is owed once.
|
|
1636
|
+
const generative = aiSiteImportWaveIsGenerative(state, wave);
|
|
1637
|
+
const planned = generative && !!state.plan;
|
|
1380
1638
|
// A header and footer drawn from the source's own menu ask no model (AGL-4108), so are owed nothing.
|
|
1381
1639
|
const counts = {
|
|
1382
1640
|
pages: 0,
|
|
1383
1641
|
arranged: 0,
|
|
1384
1642
|
reworded: 0,
|
|
1385
1643
|
copied: 0,
|
|
1386
|
-
frame: wave.frame && !!state.frame && !aiSiteImportFrameIsRead(state) && owed(AI_SITE_IMPORT_FRAME_SLOT)
|
|
1644
|
+
frame: wave.frame && !!state.frame && !aiSiteImportFrameIsRead(state) && !planned && owed(AI_SITE_IMPORT_FRAME_SLOT)
|
|
1387
1645
|
};
|
|
1388
1646
|
for (const slot of wave.slots){
|
|
1389
1647
|
const page = state.pages.find((entry)=>entry.slot === slot);
|
|
@@ -1394,7 +1652,28 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1394
1652
|
} else if ((page == null ? void 0 : page.build) === 'copied') counts.copied += 1;
|
|
1395
1653
|
else counts.pages += 1;
|
|
1396
1654
|
}
|
|
1397
|
-
return counts;
|
|
1655
|
+
if (!generative) return counts;
|
|
1656
|
+
const first = ((_state_waves_ = state.waves[0]) == null ? void 0 : _state_waves_.index) === wave.index && wave.frame;
|
|
1657
|
+
// Before the plan is in, a page it may propose is quoted, where the plan's count has room for one.
|
|
1658
|
+
const proposed = first && state.plan === undefined && choice.wording && aiSiteImportHasRoomForPage(state, {
|
|
1659
|
+
limit: state.pageLimit,
|
|
1660
|
+
used: state.existingPages
|
|
1661
|
+
}) ? 1 : 0;
|
|
1662
|
+
const pictures = choice.wording && aiSiteImportGeneratedPicturesOn(state) ? (counts.reworded + proposed) * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE : 0;
|
|
1663
|
+
return _extends({}, counts, first && state.plan === undefined ? {
|
|
1664
|
+
plan: true
|
|
1665
|
+
} : {}, proposed ? {
|
|
1666
|
+
proposed
|
|
1667
|
+
} : {}, pictures ? {
|
|
1668
|
+
pictures
|
|
1669
|
+
} : {});
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Whether a wave is a generative Improve it (AGL-4152): as stamped once it has
|
|
1673
|
+
* started; before, whether the import was read under the flag and asks to be
|
|
1674
|
+
* improved now.
|
|
1675
|
+
*/ export function aiSiteImportWaveIsGenerative(state, wave) {
|
|
1676
|
+
return wave.startedAt ? wave.generative === true : state.generative === true && aiSiteImportChoiceOf(state).finish === 'improve';
|
|
1398
1677
|
}
|
|
1399
1678
|
/** A wave's quote: the pages it has still to bring in, and its header and footer while they are owed. */ export function aiSiteImportWaveCreditRange(state, wave, items) {
|
|
1400
1679
|
const owed = aiSiteImportWaveOwed(state, wave, items);
|
|
@@ -1402,7 +1681,10 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1402
1681
|
frame: owed.frame,
|
|
1403
1682
|
arranged: owed.arranged,
|
|
1404
1683
|
reworded: owed.reworded,
|
|
1405
|
-
copied: owed.copied
|
|
1684
|
+
copied: owed.copied,
|
|
1685
|
+
plan: owed.plan,
|
|
1686
|
+
proposed: owed.proposed,
|
|
1687
|
+
pictures: owed.pictures
|
|
1406
1688
|
});
|
|
1407
1689
|
}
|
|
1408
1690
|
/** Every wave still waiting, quoted at once: "Start every remaining wave" (AGL-4083). */ export function aiSiteImportRemainingCreditRange(state, items) {
|
|
@@ -1411,9 +1693,13 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1411
1693
|
arranged: 0,
|
|
1412
1694
|
reworded: 0,
|
|
1413
1695
|
copied: 0,
|
|
1414
|
-
frame: false
|
|
1696
|
+
frame: false,
|
|
1697
|
+
plan: false,
|
|
1698
|
+
proposed: 0,
|
|
1699
|
+
pictures: 0
|
|
1415
1700
|
};
|
|
1416
1701
|
for (const wave of state.waves){
|
|
1702
|
+
var _owed_proposed, _owed_pictures;
|
|
1417
1703
|
if (wave.status !== 'waiting') continue;
|
|
1418
1704
|
const owed = aiSiteImportWaveOwed(state, wave, items);
|
|
1419
1705
|
total.pages += owed.pages;
|
|
@@ -1421,24 +1707,31 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1421
1707
|
total.reworded += owed.reworded;
|
|
1422
1708
|
total.copied += owed.copied;
|
|
1423
1709
|
total.frame = total.frame || owed.frame;
|
|
1710
|
+
total.plan = total.plan || owed.plan === true;
|
|
1711
|
+
total.proposed += (_owed_proposed = owed.proposed) != null ? _owed_proposed : 0;
|
|
1712
|
+
total.pictures += (_owed_pictures = owed.pictures) != null ? _owed_pictures : 0;
|
|
1424
1713
|
}
|
|
1425
1714
|
return aiSiteImportCreditRange(total.pages, {
|
|
1426
1715
|
frame: total.frame,
|
|
1427
1716
|
arranged: total.arranged,
|
|
1428
1717
|
reworded: total.reworded,
|
|
1429
|
-
copied: total.copied
|
|
1718
|
+
copied: total.copied,
|
|
1719
|
+
plan: total.plan,
|
|
1720
|
+
proposed: total.proposed,
|
|
1721
|
+
pictures: total.pictures
|
|
1430
1722
|
});
|
|
1431
1723
|
}
|
|
1432
1724
|
/**
|
|
1433
1725
|
* "About 95 credits (up to 600): 7 pages arranged by Aglyn AI, 3 copied as
|
|
1434
1726
|
* they are"; the build is named once the step has chosen, and pages whose
|
|
1435
1727
|
* words are improved too (AGL-4152) as "arranged and reworded by Aglyn AI".
|
|
1436
|
-
*/ export function aiSiteImportQuoteText(range, owed) {
|
|
1728
|
+
*/ export function aiSiteImportQuoteText(range, owed, options = {}) {
|
|
1437
1729
|
const reworded = Math.min(owed.arranged, whole(owed.reworded));
|
|
1438
1730
|
const runs = [
|
|
1731
|
+
// Under a generative Improve it, a page redesigned from its ledger (AGL-4152).
|
|
1439
1732
|
[
|
|
1440
1733
|
reworded,
|
|
1441
|
-
()
|
|
1734
|
+
()=>options.generative ? `redesigned by ${PLATFORM_BRAND_NAME} AI` : `arranged and reworded by ${PLATFORM_BRAND_NAME} AI`
|
|
1442
1735
|
],
|
|
1443
1736
|
[
|
|
1444
1737
|
owed.arranged - reworded,
|
|
@@ -1455,6 +1748,10 @@ const whole = (value)=>Math.max(0, Math.floor(Number.isFinite(value) ? value : 0
|
|
|
1455
1748
|
// The first run names its pages; the rest are counted beside it.
|
|
1456
1749
|
parts.push(`${parts.length ? count.toLocaleString('en-US') : aiSiteImportPagesText(count)} ${what(count)}`);
|
|
1457
1750
|
}
|
|
1751
|
+
// What a generative Improve it adds (AGL-4152): its plan, the page it may propose, the pictures it may generate.
|
|
1752
|
+
if (owed.plan) parts.unshift('your site’s plan');
|
|
1753
|
+
if (owed.proposed) parts.push('a new page if the plan proposes one');
|
|
1754
|
+
if (owed.pictures) parts.push(`up to ${owed.pictures.toLocaleString('en-US')} generated pictures`);
|
|
1458
1755
|
return parts.length ? `${aiCreditRangeText(range)}: ${parts.join(', ')}` : aiCreditRangeText(range);
|
|
1459
1756
|
}
|
|
1460
1757
|
/*------------------------------------------
|