@aglyn/plugins-ai 1.0.0-beta.292 → 1.0.0-beta.296
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-job-links.d.ts +15 -2
- package/src/lib/components/ai-job-links.js +24 -3
- package/src/lib/components/ai-job-links.js.map +1 -1
- package/src/lib/components/ai-job-requests.d.ts +9 -0
- package/src/lib/components/ai-job-requests.js +34 -0
- package/src/lib/components/ai-job-requests.js.map +1 -1
- package/src/lib/components/ai-site-build-page.component.js +28 -2
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/ai-site-import-job.component.js +5 -4
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/components/ai-site-import-start.component.js +3 -3
- package/src/lib/components/ai-site-import-start.component.js.map +1 -1
- package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
- package/src/lib/components/ai-site-start-card.component.js +129 -29
- package/src/lib/components/ai-site-start-card.component.js.map +1 -1
- package/src/lib/components/ai-site-start-steps.component.d.ts +15 -3
- package/src/lib/components/ai-site-start-steps.component.js +42 -25
- package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
- package/src/lib/components/ai-site-style-previews.d.ts +17 -0
- package/src/lib/components/ai-site-style-previews.js +26 -95
- package/src/lib/components/ai-site-style-previews.js.map +1 -1
- package/src/lib/components/assist-jobs-drawer.component.d.ts +7 -1
- package/src/lib/components/assist-jobs-drawer.component.js +20 -6
- package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
- package/src/lib/components/assist-page-change-card.component.d.ts +44 -0
- package/src/lib/components/assist-page-change-card.component.js +166 -0
- package/src/lib/components/assist-page-change-card.component.js.map +1 -0
- package/src/lib/components/assist-panel.component.d.ts +105 -1
- package/src/lib/components/assist-panel.component.js +224 -29
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/declarations.server.js +22 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/jobs/ai-job-edit-step.d.ts +62 -16
- package/src/lib/jobs/ai-job-edit-step.js +172 -61
- package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +21 -2
- package/src/lib/jobs/ai-job-import-step.js +179 -49
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.d.ts +27 -3
- package/src/lib/jobs/ai-job-layout-language.js +156 -113
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-step.js +56 -17
- package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
- package/src/lib/jobs/ai-job-navigation-step.js +4 -2
- package/src/lib/jobs/ai-job-navigation-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +25 -15
- package/src/lib/jobs/ai-job-page-language.js +120 -66
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +27 -7
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-datasets.d.ts +12 -4
- package/src/lib/jobs/ai-job-site-datasets.js +36 -16
- package/src/lib/jobs/ai-job-site-datasets.js.map +1 -1
- package/src/lib/jobs/ai-jobs.js +6 -2
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-layout-stock-photos.d.ts +50 -1
- package/src/lib/jobs/ai-layout-stock-photos.js +586 -35
- package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +147 -0
- package/src/lib/jobs/ai-site-import-compile.js +1143 -0
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -0
- package/src/lib/jobs/ai-site-import-document.d.ts +9 -36
- package/src/lib/jobs/ai-site-import-document.js +23 -489
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-look.d.ts +54 -7
- package/src/lib/jobs/ai-site-import-look.js +163 -52
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/jobs/ai-site-import-publish.d.ts +7 -1
- package/src/lib/jobs/ai-site-import-publish.js +19 -5
- package/src/lib/jobs/ai-site-import-publish.js.map +1 -1
- package/src/lib/jobs/ai-site-late-photos.js +4 -2
- package/src/lib/jobs/ai-site-late-photos.js.map +1 -1
- package/src/lib/jobs/ai-site-publish.d.ts +10 -1
- package/src/lib/jobs/ai-site-publish.js +8 -3
- package/src/lib/jobs/ai-site-publish.js.map +1 -1
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.d.ts +23 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js +677 -0
- package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js.map +1 -0
- package/src/lib/layout-language/ai-layout-compiler.d.ts +26 -0
- package/src/lib/layout-language/ai-layout-compiler.js +677 -33
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-hollows.js +5 -1
- package/src/lib/layout-language/ai-layout-frame-hollows.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +196 -0
- package/src/lib/layout-language/ai-layout-frame-source.js +726 -0
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -0
- package/src/lib/layout-language/ai-layout-frame.d.ts +22 -0
- package/src/lib/layout-language/ai-layout-frame.js +121 -29
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +103 -37
- package/src/lib/layout-language/ai-layout-language.js +85 -120
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-credit-estimate.d.ts +11 -7
- package/src/lib/model/ai-credit-estimate.js +11 -7
- package/src/lib/model/ai-credit-estimate.js.map +1 -1
- package/src/lib/model/ai-edit-job.d.ts +33 -16
- package/src/lib/model/ai-edit-job.js +50 -34
- package/src/lib/model/ai-edit-job.js.map +1 -1
- package/src/lib/model/ai-job-activity.d.ts +6 -11
- package/src/lib/model/ai-job-activity.js +8 -15
- package/src/lib/model/ai-job-activity.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +6 -0
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +307 -13
- package/src/lib/model/ai-site-import.js +227 -19
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-inventory.d.ts +6 -0
- package/src/lib/model/ai-site-inventory.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +65 -1
- package/src/lib/model/ai-site-look.js +141 -23
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/model/ai-site-photos.d.ts +2 -0
- package/src/lib/model/ai-site-photos.js.map +1 -1
- package/src/lib/model/ai-site-start-steps.d.ts +4 -3
- package/src/lib/model/ai-site-start-steps.js +11 -3
- package/src/lib/model/ai-site-start-steps.js.map +1 -1
- package/src/lib/model/ai-site-start.d.ts +23 -2
- package/src/lib/model/ai-site-start.js +25 -3
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/assist-edit.d.ts +18 -1
- package/src/lib/model/assist-edit.js +7 -0
- package/src/lib/model/assist-edit.js.map +1 -1
- package/src/lib/model/assist-page-change.d.ts +86 -0
- package/src/lib/model/assist-page-change.js +86 -0
- package/src/lib/model/assist-page-change.js.map +1 -0
- package/src/lib/providers/routing.d.ts +11 -0
- package/src/lib/providers/routing.js +23 -0
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/runtime/ai-doctrine-validators.d.ts +4 -2
- package/src/lib/runtime/ai-doctrine-validators.js +7 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-eval.js +3 -1
- package/src/lib/runtime/ai-eval.js.map +1 -1
- package/src/lib/runtime/ai-icon-library.d.ts +4 -0
- package/src/lib/runtime/ai-icon-library.js +4 -0
- package/src/lib/runtime/ai-icon-library.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.d.ts +5 -0
- package/src/lib/runtime/ai-node-tree.js +23 -4
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-palette.d.ts +2 -0
- package/src/lib/runtime/ai-palette.generated.js +19 -3
- package/src/lib/runtime/ai-palette.generated.js.map +1 -1
- package/src/lib/runtime/ai-palette.js +2 -1
- package/src/lib/runtime/ai-palette.js.map +1 -1
- package/src/lib/runtime/site-inventory.d.ts +8 -1
- package/src/lib/runtime/site-inventory.js +18 -0
- package/src/lib/runtime/site-inventory.js.map +1 -1
- package/src/lib/server/assist-build.js +2 -0
- package/src/lib/server/assist-build.js.map +1 -1
- package/src/lib/server/assist-chat.js +51 -2
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-edit.d.ts +54 -2
- package/src/lib/server/assist-edit.js +219 -30
- package/src/lib/server/assist-edit.js.map +1 -1
- package/src/lib/server/assist-page-change.d.ts +62 -0
- package/src/lib/server/assist-page-change.js +140 -0
- package/src/lib/server/assist-page-change.js.map +1 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +50 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +86 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -0
- package/src/lib/site-import/site-import-crawl.d.ts +18 -1
- package/src/lib/site-import/site-import-crawl.js +70 -10
- package/src/lib/site-import/site-import-crawl.js.map +1 -1
- package/src/lib/site-import/site-import-css.d.ts +110 -0
- package/src/lib/site-import/site-import-css.js +826 -0
- package/src/lib/site-import/site-import-css.js.map +1 -0
- package/src/lib/site-import/site-import-html.d.ts +116 -1
- package/src/lib/site-import/site-import-html.js +538 -46
- package/src/lib/site-import/site-import-html.js.map +1 -1
- package/src/lib/site-import/site-import-layout.d.ts +79 -0
- package/src/lib/site-import/site-import-layout.js +1608 -0
- package/src/lib/site-import/site-import-layout.js.map +1 -0
- package/src/lib/site-import/site-import-nav.d.ts +40 -0
- package/src/lib/site-import/site-import-nav.js +437 -0
- package/src/lib/site-import/site-import-nav.js.map +1 -0
- package/src/lib/site-import/site-import-page.d.ts +8 -1
- package/src/lib/site-import/site-import-page.js +24 -2
- package/src/lib/site-import/site-import-page.js.map +1 -1
- package/src/lib/assets/site-styles/beauty.webp +0 -0
- package/src/lib/assets/site-styles/blog.webp +0 -0
- package/src/lib/assets/site-styles/business.webp +0 -0
- package/src/lib/assets/site-styles/coming-soon.webp +0 -0
- package/src/lib/assets/site-styles/education.webp +0 -0
- package/src/lib/assets/site-styles/events.webp +0 -0
- package/src/lib/assets/site-styles/fitness.webp +0 -0
- package/src/lib/assets/site-styles/landing.webp +0 -0
- package/src/lib/assets/site-styles/music.webp +0 -0
- package/src/lib/assets/site-styles/nonprofit.webp +0 -0
- package/src/lib/assets/site-styles/personal.webp +0 -0
- package/src/lib/assets/site-styles/photography.webp +0 -0
- package/src/lib/assets/site-styles/portfolio.webp +0 -0
- package/src/lib/assets/site-styles/professional.webp +0 -0
- package/src/lib/assets/site-styles/realestate.webp +0 -0
- package/src/lib/assets/site-styles/restaurant.webp +0 -0
- package/src/lib/assets/site-styles/store.webp +0 -0
- package/src/lib/assets/site-styles/studio.webp +0 -0
- package/src/lib/assets/site-styles/trades.webp +0 -0
- package/src/lib/assets/site-styles/wellness.webp +0 -0
- package/src/lib/assets/site-styles/yoga.webp +0 -0
- package/src/lib/site-import/site-import-review.d.ts +0 -40
- package/src/lib/site-import/site-import-review.js +0 -149
- package/src/lib/site-import/site-import-review.js.map +0 -1
|
@@ -21,7 +21,7 @@ import { aiHomeScreenIds } from "../model/ai-site-inventory.js";
|
|
|
21
21
|
import { AI_LAYOUT_POST_ADDRESS_TOKENS, aiCompileLayoutPage } from "../layout-language/ai-layout-compiler.js";
|
|
22
22
|
import { aiSiteMotionStyle, aiWithSiteMotion } from "../layout-language/ai-layout-motion.js";
|
|
23
23
|
import { aiLayoutListingAt, aiLayoutListingsOf, aiLayoutRecordHref } from "../layout-language/ai-layout-listings.js";
|
|
24
|
-
import {
|
|
24
|
+
import { AI_LAYOUT_DESIGN_TOOL, AI_LAYOUT_LANGUAGE_TEXT, AI_LAYOUT_PAGE_TOOL, aiReadLayoutDesign, aiReadLayoutPage } from "../layout-language/ai-layout-language.js";
|
|
25
25
|
import { aiLayoutCopyCheck, aiLayoutWithoutSections } from "../layout-language/ai-layout-gaps.js";
|
|
26
26
|
import { aiLayoutPromisedCopyViolations, aiLayoutPromisedSections } from "../layout-language/ai-layout-promised-copy.js";
|
|
27
27
|
import { aiLayoutStoredTree } from "../layout-language/ai-layout-store.js";
|
|
@@ -38,7 +38,8 @@ import { aiJobBriefLine, aiPlanReferenceLines } from "./ai-job-generation.js";
|
|
|
38
38
|
import { aiLayoutIsHomeSlug, aiLayoutSiteAliases, aiLayoutSitePages } from "./ai-job-layout-site-pages.js";
|
|
39
39
|
import { aiLayoutInventedContactViolations } from "./ai-layout-site-facts.js";
|
|
40
40
|
import { aiSiteContactOf } from "../model/ai-site-details.js";
|
|
41
|
-
import {
|
|
41
|
+
import { aiSiteImportDocumentOf } from "./ai-site-import-document.js";
|
|
42
|
+
import { AI_SITE_IMPORT_DESIGN_MAX_CHARS, aiCompileImportedPage, aiSiteImportDesignText, aiSiteImportSectionNames } from "./ai-site-import-compile.js";
|
|
42
43
|
/**
|
|
43
44
|
* A page built in the compact layout language (AGL-3660): the page step's
|
|
44
45
|
* pass for a site's page units — a guided start's and a build's — in place of
|
|
@@ -861,68 +862,89 @@ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
|
|
|
861
862
|
return _extends({}, second, spentTogether(first, second));
|
|
862
863
|
}
|
|
863
864
|
/*------------------------------------------
|
|
864
|
-
* A page brought in:
|
|
865
|
+
* A page brought in: built by the site compiler (AGL-4084, AGL-4107)
|
|
865
866
|
*-----------------------------------------*/ /**
|
|
866
|
-
* What
|
|
867
|
-
* are the source's and fixed,
|
|
868
|
-
*
|
|
869
|
-
|
|
870
|
-
|
|
867
|
+
* What a main page's design answer is told (AGL-4107), cached: the page's
|
|
868
|
+
* words and structure are the source's and fixed, read by code, and the
|
|
869
|
+
* answer only chooses how its sections are drawn. The tool has no field for
|
|
870
|
+
* a word of copy, a line or a block, so nothing it says can reword or move
|
|
871
|
+
* one.
|
|
872
|
+
*/ export const AI_LAYOUT_DESIGN_TEXT = [
|
|
873
|
+
"You design how a page brought in from its owner's own website is drawn. Its words, its sections and what each section shows are fixed: the platform reads them from the source and places every line exactly as written, in the site's theme. You choose only the design; you never write a word.",
|
|
871
874
|
'',
|
|
872
|
-
'Answer with
|
|
873
|
-
'-
|
|
874
|
-
|
|
875
|
-
'- align: start or center.',
|
|
876
|
-
|
|
877
|
-
''
|
|
878
|
-
'Block kinds: heading, eyebrow, lede, text and note show their lines one under another; list shows each of its lines as an item; cards, steps, stats and faq show items, each item\'s from its title line first and then its text lines (from is then []); button is a line that is a link; image is a line that is a picture.',
|
|
879
|
-
"Every line goes in exactly one block of its own section. Name no line twice and no line of another section. A line you leave out is still shown, at the end of its section, so leave none out on purpose. The page's first section opens with its heading line."
|
|
875
|
+
'Answer with submit_design: one entry in sections for each section listed, in order. A section has:',
|
|
876
|
+
'- hero: for the first section, where it opens the page with a picture: split or bleed (the words beside the picture), cover or poster (the words over the picture, dimmed), panel (the words on a card over the picture), column or editorial (the words above a wide picture). Choose the one closest to how the source places its picture unless another reads better for this site; none keeps the source\'s own arrangement. Every other section: none.',
|
|
877
|
+
"- band: source keeps the section's own background. Only a section with no band of its own may take plain, soft or dark, so neighboring sections read apart; every other section: source.",
|
|
878
|
+
'- align: source, start or center.',
|
|
879
|
+
"- groups: one entry for each of the section's groups, in the order they are numbered. kind: source, or cards, steps, stats or list where the group plainly is one (numbered items are steps, a figure over its label is stats). style: cards (the theme's cards), ruled (open columns under a thin rule), icons (open columns led by their icons, only where each item has one), pictures (each item's picture over its words, open) or articles (the same, in cards), pictures and articles only where each item has a picture.",
|
|
880
|
+
'Draw the page at least as well as its source: keep its boxes where it boxes its items, its icons where it draws them and its pictures where it shows them.'
|
|
880
881
|
].join('\n');
|
|
881
|
-
/** The
|
|
882
|
+
/** The design answer's cached instructions, and the rule that fenced text is data. */ export const AI_JOB_PAGE_DESIGN_INSTRUCTIONS = [
|
|
882
883
|
{
|
|
883
|
-
text:
|
|
884
|
+
text: AI_LAYOUT_DESIGN_TEXT,
|
|
884
885
|
cacheBreakpoint: true
|
|
885
886
|
},
|
|
886
887
|
{
|
|
887
888
|
text: UNTRUSTED_TEXT_RULE
|
|
888
889
|
}
|
|
889
890
|
];
|
|
890
|
-
/**
|
|
891
|
-
const
|
|
891
|
+
/** A design answer's user turn: the page, the kind of site it is, and its structure, the sections' names fenced. */ export function aiLayoutDesignPrompt(input) {
|
|
892
|
+
const count = aiSiteImportSectionNames(input.doc).length;
|
|
892
893
|
return [
|
|
893
894
|
`Page: "${input.screen.title}" at ${input.screen.slug}`,
|
|
894
895
|
...aiSiteKindDesignLines(input.job.inputs),
|
|
895
|
-
`Its ${
|
|
896
|
-
fenceUntrustedText(`The owner's page ${input.doc.url}`,
|
|
897
|
-
maxChars:
|
|
896
|
+
`Its ${count === 1 ? 'one section' : `${count} sections`}, each with what it shows:`,
|
|
897
|
+
fenceUntrustedText(`The structure of the owner's page ${input.doc.url}`, aiSiteImportDesignText(input.doc), {
|
|
898
|
+
maxChars: AI_SITE_IMPORT_DESIGN_MAX_CHARS
|
|
898
899
|
}),
|
|
899
900
|
`Design seed: ${input.job.$id.slice(-6)}.`
|
|
900
901
|
].join('\n');
|
|
901
902
|
}
|
|
903
|
+
/** The site a page brought in is drawn for: its design, else the page's own, so its hero has a home to open (AGL-4107). */ function importedDesign(design, screen) {
|
|
904
|
+
return design != null ? design : {
|
|
905
|
+
kind: 'business',
|
|
906
|
+
seed: 0,
|
|
907
|
+
home: aiLayoutIsHomeSlug(screen.slug)
|
|
908
|
+
};
|
|
909
|
+
}
|
|
902
910
|
/**
|
|
903
|
-
* The check a page brought in is held to (AGL-4084):
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* words.
|
|
911
|
+
* The check a page brought in is held to (AGL-4084, AGL-4107): its layout
|
|
912
|
+
* compiled by the site compiler with every word as written — with the design
|
|
913
|
+
* answer where one is given — stored, and checked whole as a page of its
|
|
914
|
+
* owner's own words. An answer whose design cannot be drawn is set aside and
|
|
915
|
+
* the page is drawn as its source lays it out, so no answer is asked again
|
|
916
|
+
* for what code decides. Nothing in an answer can change a word.
|
|
907
917
|
*/ export function aiImportedPageCheck(input) {
|
|
908
918
|
const context = _extends({}, aiLayoutListingContext(input.context, input.targets), {
|
|
909
919
|
ownWords: true
|
|
910
920
|
});
|
|
911
|
-
|
|
921
|
+
const plan = {
|
|
922
|
+
title: input.screen.title,
|
|
923
|
+
sections: input.screen.sections.map((section)=>({
|
|
924
|
+
name: section.name,
|
|
925
|
+
uses: [],
|
|
926
|
+
items: 0
|
|
927
|
+
}))
|
|
928
|
+
};
|
|
929
|
+
const build = (design)=>{
|
|
912
930
|
var _ref, _input_motion;
|
|
913
|
-
const
|
|
914
|
-
const compiled = aiCompileImportedDocument({
|
|
931
|
+
const compiled = aiCompileImportedPage(_extends({
|
|
915
932
|
doc: input.doc,
|
|
916
933
|
sectionIds: input.sectionIds,
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
934
|
+
plan,
|
|
935
|
+
targets: input.targets,
|
|
936
|
+
design: importedDesign(input.design, input.screen),
|
|
937
|
+
answer: design
|
|
938
|
+
}, input.language ? {
|
|
939
|
+
language: input.language
|
|
940
|
+
} : {}));
|
|
920
941
|
const stored = aiLayoutStoredTree(compiled.tree, 'screen', context, input.sectionIds);
|
|
921
942
|
if (stored.ok === false) {
|
|
922
943
|
console.error('ai imported page: a compiled page did not store', {
|
|
923
944
|
error: stored.error
|
|
924
945
|
});
|
|
925
946
|
return {
|
|
947
|
+
compiled,
|
|
926
948
|
value: null,
|
|
927
949
|
violations: [
|
|
928
950
|
{
|
|
@@ -942,10 +964,12 @@ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
|
|
|
942
964
|
repeatsCompiled: true
|
|
943
965
|
}));
|
|
944
966
|
if (report.violations.length) return {
|
|
967
|
+
compiled,
|
|
945
968
|
value: null,
|
|
946
969
|
violations: report.violations
|
|
947
970
|
};
|
|
948
971
|
return {
|
|
972
|
+
compiled,
|
|
949
973
|
value: {
|
|
950
974
|
nodes: aiWithSiteMotion(stored.nodes, (_ref = (_input_motion = input.motion) != null ? _input_motion : input.design) != null ? _ref : {
|
|
951
975
|
seed: 0
|
|
@@ -953,15 +977,39 @@ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
|
|
|
953
977
|
sectionIds: input.sectionIds
|
|
954
978
|
}),
|
|
955
979
|
load: report.load,
|
|
956
|
-
settled:
|
|
980
|
+
settled: compiled.settled,
|
|
957
981
|
dropped: [],
|
|
958
|
-
items:
|
|
982
|
+
items: compiled.sectionRoots.map(()=>0)
|
|
959
983
|
},
|
|
960
984
|
violations: []
|
|
961
985
|
};
|
|
962
986
|
};
|
|
987
|
+
return (answer)=>{
|
|
988
|
+
var _ref;
|
|
989
|
+
var _designed_violations_;
|
|
990
|
+
const design = answer ? aiReadLayoutDesign(answer, input.sectionIds.length) : null;
|
|
991
|
+
const designed = build(design);
|
|
992
|
+
if (designed.value || !design) return {
|
|
993
|
+
value: designed.value,
|
|
994
|
+
violations: designed.violations
|
|
995
|
+
};
|
|
996
|
+
// The answer's design could not be drawn: the page as its source lays it out.
|
|
997
|
+
const plain = build(null);
|
|
998
|
+
if (plain.value) plain.value.settled.push({
|
|
999
|
+
at: 'design',
|
|
1000
|
+
what: `the design answer set aside: ${(_ref = (_designed_violations_ = designed.violations[0]) == null ? void 0 : _designed_violations_.code) != null ? _ref : 'not drawn'}`
|
|
1001
|
+
});
|
|
1002
|
+
return {
|
|
1003
|
+
value: plain.value,
|
|
1004
|
+
violations: plain.violations
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
963
1007
|
}
|
|
964
|
-
/** The
|
|
1008
|
+
/** The design answer's kind of generation, which shares the page's ceilings. */ export const AI_LAYOUT_DESIGN_KIND = AI_LAYOUT_PAGE_KIND;
|
|
1009
|
+
/**
|
|
1010
|
+
* The most a design answer runs to (AGL-4107): a few tokens a section and a
|
|
1011
|
+
* group, with room to think, inside a page's ceiling on the balanced tier.
|
|
1012
|
+
*/ export const AI_LAYOUT_DESIGN_MAX_TOKENS = 3000;
|
|
965
1013
|
const NO_USAGE = {
|
|
966
1014
|
inputTokens: 0,
|
|
967
1015
|
outputTokens: 0,
|
|
@@ -969,62 +1017,68 @@ const NO_USAGE = {
|
|
|
969
1017
|
cacheWriteTokens: 0
|
|
970
1018
|
};
|
|
971
1019
|
/**
|
|
972
|
-
* A page brought in (AGL-4084).
|
|
973
|
-
*
|
|
974
|
-
*
|
|
1020
|
+
* A page brought in (AGL-4084, AGL-4107). Its layout is compiled first with
|
|
1021
|
+
* no model: a page of a collection is that page, nothing spent; a page that
|
|
1022
|
+
* cannot be built so is reviewed before anything is spent on it. A main page
|
|
1023
|
+
* then asks one design answer on the page step's balanced tier and is drawn
|
|
1024
|
+
* with it, every word still the source's.
|
|
975
1025
|
*/ async function aiRunImportedPage(input, doc) {
|
|
976
1026
|
var _input_observe;
|
|
977
|
-
const check = aiImportedPageCheck({
|
|
1027
|
+
const check = aiImportedPageCheck(_extends({
|
|
978
1028
|
screen: input.screen,
|
|
979
1029
|
sectionIds: input.sectionIds,
|
|
980
1030
|
targets: input.targets,
|
|
981
1031
|
context: input.context,
|
|
982
1032
|
design: aiLayoutDesignOf(input.job, input.screen.slug),
|
|
983
|
-
motion: aiLayoutMotionSiteOf(input.job, input.screen.slug)
|
|
1033
|
+
motion: aiLayoutMotionSiteOf(input.job, input.screen.slug)
|
|
1034
|
+
}, input.plan.language ? {
|
|
1035
|
+
language: input.plan.language
|
|
1036
|
+
} : {}, {
|
|
984
1037
|
doc
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
return
|
|
997
|
-
status: 'ok',
|
|
998
|
-
value: result.value
|
|
999
|
-
}) : _extends({}, spend, {
|
|
1038
|
+
}));
|
|
1039
|
+
const spend = {
|
|
1040
|
+
attempts: 0,
|
|
1041
|
+
usage: NO_USAGE,
|
|
1042
|
+
estCostUsd: 0,
|
|
1043
|
+
model: input.model,
|
|
1044
|
+
stopReason: null,
|
|
1045
|
+
effort: null
|
|
1046
|
+
};
|
|
1047
|
+
const plain = check(null);
|
|
1048
|
+
if (!plain.value) {
|
|
1049
|
+
return _extends({}, spend, {
|
|
1000
1050
|
status: 'needs_input',
|
|
1001
|
-
violations:
|
|
1002
|
-
message: aiDoctrineNeedsInputMessage(
|
|
1051
|
+
violations: plain.violations,
|
|
1052
|
+
message: aiDoctrineNeedsInputMessage(plain.violations),
|
|
1003
1053
|
answer: null
|
|
1004
1054
|
});
|
|
1005
1055
|
}
|
|
1056
|
+
if (doc.build === 'copied') return _extends({}, spend, {
|
|
1057
|
+
status: 'ok',
|
|
1058
|
+
value: plain.value
|
|
1059
|
+
});
|
|
1006
1060
|
const observe = (_input_observe = input.observe) != null ? _input_observe : (inner)=>inner;
|
|
1007
|
-
return runValidatedGeneration(
|
|
1061
|
+
return runValidatedGeneration(AI_LAYOUT_DESIGN_KIND, _extends({
|
|
1008
1062
|
step: 'job.page',
|
|
1009
1063
|
model: input.model,
|
|
1010
|
-
instructions:
|
|
1011
|
-
// The
|
|
1064
|
+
instructions: AI_JOB_PAGE_DESIGN_INSTRUCTIONS,
|
|
1065
|
+
// The structure is the whole question: no lookup of the site is offered.
|
|
1012
1066
|
inventory: null,
|
|
1013
1067
|
messages: [
|
|
1014
1068
|
{
|
|
1015
1069
|
role: 'user',
|
|
1016
|
-
content:
|
|
1070
|
+
content: aiLayoutDesignPrompt({
|
|
1017
1071
|
job: input.job,
|
|
1018
1072
|
screen: input.screen,
|
|
1019
1073
|
doc
|
|
1020
1074
|
})
|
|
1021
1075
|
}
|
|
1022
1076
|
],
|
|
1023
|
-
tool:
|
|
1024
|
-
maxTokens: AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model),
|
|
1077
|
+
tool: AI_LAYOUT_DESIGN_TOOL,
|
|
1078
|
+
maxTokens: Math.min(AI_LAYOUT_DESIGN_MAX_TOKENS, AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model)),
|
|
1025
1079
|
cutOff: {
|
|
1026
|
-
noun: '
|
|
1027
|
-
smaller: '
|
|
1080
|
+
noun: 'design',
|
|
1081
|
+
smaller: 'Answer with the choices alone.'
|
|
1028
1082
|
}
|
|
1029
1083
|
}, AI_LAYOUT_LANGUAGE_THINKING, {
|
|
1030
1084
|
check: observe((answer)=>check(answer))
|