@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
|
@@ -18,6 +18,8 @@ import type { ClientBuildIntake } from '@aglyn/aglyn/app-utils/client-build';
|
|
|
18
18
|
import { type AiSiteDetailKey, type AiSiteDetails } from './ai-site-details';
|
|
19
19
|
import { type AiSiteKind } from './ai-site-kinds';
|
|
20
20
|
import { type AiSiteJobInputs, type AiSiteSubmissions } from './ai-site-job';
|
|
21
|
+
import { AI_SITE_STARTER_LOOK_INPUT, type AiSiteStarterLook } from './ai-site-starter-look';
|
|
22
|
+
export { AI_SITE_STARTER_LOOK_INPUT, AI_SITE_STARTER_LOOK_MAX_CHARS, aiSiteStarterLookFromInput, type AiSiteStarterLook, } from './ai-site-starter-look';
|
|
21
23
|
/**
|
|
22
24
|
* The guided start (AGL-2918): the questions a person answers on a site they
|
|
23
25
|
* have just made, and the site job those answers become.
|
|
@@ -117,6 +119,17 @@ export interface AiSiteStartAnswers extends AiSiteDetails {
|
|
|
117
119
|
* for none. Asked only while `release_ai_site_inspiration` is on.
|
|
118
120
|
*/
|
|
119
121
|
inspiration?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* The look an AI starter promised (AGL-4049): its base theme, font pairing
|
|
124
|
+
* and style tokens, held while the Style card is the starter's own
|
|
125
|
+
* (`style` is that card), and dropped, base and fonts both, while another
|
|
126
|
+
* is chosen ({@link aiSiteStartHeldStarterLook}). Absent on a start from
|
|
127
|
+
* no starter.
|
|
128
|
+
*/
|
|
129
|
+
starterLook?: {
|
|
130
|
+
style: string;
|
|
131
|
+
look: AiSiteStarterLook;
|
|
132
|
+
};
|
|
120
133
|
}
|
|
121
134
|
/**
|
|
122
135
|
* What the questions start on. Five pages because it is the middle of the
|
|
@@ -190,9 +203,10 @@ export declare function aiSiteStartBrief(answers: AiSiteStartAnswers): string;
|
|
|
190
203
|
*/
|
|
191
204
|
export declare function aiSiteStartInputs(answers: AiSiteStartAnswers): Omit<AiSiteJobInputs, 'batchId' | 'inspiration' | AiSiteDetailKey> & Partial<AiSiteDetails> & {
|
|
192
205
|
inspiration?: string;
|
|
206
|
+
[AI_SITE_STARTER_LOOK_INPUT]?: string;
|
|
193
207
|
};
|
|
194
208
|
/** The site inputs a guided start's answers become, by name: what a summary carries back (AGL-3596). */
|
|
195
|
-
export declare const AI_SITE_START_INPUT_KEYS: readonly ["businessType", "audience", "starter", "siteKind", "pages", "businessName", "city", "brand", "submissions", "welcomeEmail", "phone", "email", "tagline", "founded", "serviceArea", "priceRange", "languages", "street", "region", "postalCode", "country", "hours", "social", "inspiration"];
|
|
209
|
+
export declare const AI_SITE_START_INPUT_KEYS: readonly ["businessType", "audience", "starter", "siteKind", "pages", "businessName", "city", "brand", "submissions", "welcomeEmail", "phone", "email", "tagline", "founded", "serviceArea", "priceRange", "languages", "street", "region", "postalCode", "country", "hours", "social", "inspiration", "starterLook"];
|
|
196
210
|
/** A site job's scalar inputs, and nothing else its inputs carry; `null` when it has none. */
|
|
197
211
|
export declare function aiSiteStartInputsOf(inputs: Readonly<Record<string, unknown>> | null | undefined): Record<string, unknown> | null;
|
|
198
212
|
/**
|
|
@@ -221,17 +235,33 @@ export declare function aiSiteStartAnswersFromInputs(inputs: Readonly<Record<str
|
|
|
221
235
|
* workspace's band. A description of the pages is the kind's own guidance,
|
|
222
236
|
* which the kind already carries to the plan.
|
|
223
237
|
* - `brief` → what the site is for, as typed on the first question.
|
|
238
|
+
* - `style` and `fonts` → the look the listing promised, `starterLook`:
|
|
239
|
+
* the style's base theme, pairing and tokens, with `fonts` winning over
|
|
240
|
+
* the style's own pairing where it names one this deployment has. A base,
|
|
241
|
+
* pairing or token this deployment does not know is left out, and a
|
|
242
|
+
* starter whose kind chooses no card holds no look, since the look holds
|
|
243
|
+
* only while its card is chosen ({@link aiSiteStartHeldStarterLook}).
|
|
224
244
|
*
|
|
225
|
-
* Anything else a starter carries is left out
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* answer starts where the questions start, so a starter never answers for
|
|
229
|
-
* the person what it does not say. Anything that is not a set of answers
|
|
230
|
-
* reads as none.
|
|
245
|
+
* Anything else a starter carries is left out. Every other answer starts
|
|
246
|
+
* where the questions start, so a starter never answers for the person what
|
|
247
|
+
* it does not say. Anything that is not a set of answers reads as none.
|
|
231
248
|
*/
|
|
232
249
|
export declare function aiSiteStartAnswersFromStarter(answers: Readonly<Record<string, unknown>> | null | undefined, options?: {
|
|
233
250
|
freeTaste?: boolean;
|
|
234
251
|
}): AiSiteStartAnswers;
|
|
252
|
+
/**
|
|
253
|
+
* The AI starter's look the answers hold (AGL-4049), while the Style card
|
|
254
|
+
* chosen is the starter's own; `null` from any other card, "Pick for me"
|
|
255
|
+
* included, so a person who picks another style gets that style's look,
|
|
256
|
+
* its base theme and fonts with it.
|
|
257
|
+
*/
|
|
258
|
+
export declare function aiSiteStartHeldStarterLook(answers: Pick<AiSiteStartAnswers, 'style' | 'starterLook'>): AiSiteStarterLook | null;
|
|
259
|
+
/**
|
|
260
|
+
* What the starter's look is set in, as the Style card and the review say it
|
|
261
|
+
* (AGL-4049): "Set in Bootstrap with Fraunces and Inter; pick another style
|
|
262
|
+
* to change it." `null` while it is not held.
|
|
263
|
+
*/
|
|
264
|
+
export declare function aiSiteStartStarterLookLine(answers: Pick<AiSiteStartAnswers, 'style' | 'starterLook'>): string | null;
|
|
235
265
|
/**
|
|
236
266
|
* The questions' answers for a site staff are building for a client: what
|
|
237
267
|
* the business does is the kind of site, and the details the intake holds
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
import { SITE_STYLE_AUTO } from "@aglyn/aglyn/app-utils/site-styles";
|
|
18
18
|
import { weeklyHoursFromText, weeklyHoursToText } from "@aglyn/shared-ui-jsx/utils/weekly-hours";
|
|
19
19
|
import { AI_SITE_DETAIL_KEYS, AI_SITE_NO_DETAILS, aiSiteDetailProblem, aiSiteDetailsOf } from "./ai-site-details.js";
|
|
20
|
-
import { aiSiteKind, aiSiteKindFor } from "./ai-site-kinds.js";
|
|
20
|
+
import { aiSiteFontPairing, aiSiteKind, aiSiteKindFor } from "./ai-site-kinds.js";
|
|
21
21
|
import { AI_SITE_INSPIRATION_INPUT, aiSiteInspirationInput, aiSiteInspirationLimit, aiSiteInspirationRefusal, aiSiteInspirationUrl } from "./ai-site-inspiration.js";
|
|
22
22
|
import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from "./ai-site-job.js";
|
|
23
|
+
import { AI_SITE_STARTER_LOOK_INPUT, aiSiteStarterLookFromInput, aiSiteStarterLookInput, aiSiteStarterLookLine, aiSiteStarterLookOf } from "./ai-site-starter-look.js";
|
|
24
|
+
export { AI_SITE_STARTER_LOOK_INPUT, AI_SITE_STARTER_LOOK_MAX_CHARS, aiSiteStarterLookFromInput } from "./ai-site-starter-look.js";
|
|
23
25
|
/**
|
|
24
26
|
* The examples the start offers, in the order they are shown. The platform's
|
|
25
27
|
* own starter sites: a person who has no words for what they want has seen
|
|
@@ -247,6 +249,8 @@ import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from ".
|
|
|
247
249
|
// The sites they like travel only when there are some (AGL-3975), so a
|
|
248
250
|
// start without them asks for exactly what it always did.
|
|
249
251
|
const inspiration = aiSiteInspirationInput(aiSiteStartInspirationTyped(answers));
|
|
252
|
+
// An AI starter's look travels while its card is the one chosen (AGL-4049).
|
|
253
|
+
const starterLook = aiSiteStartHeldStarterLook(answers);
|
|
250
254
|
return _extends({
|
|
251
255
|
businessType: answers.siteType.trim(),
|
|
252
256
|
audience: answers.audience.trim(),
|
|
@@ -260,6 +264,8 @@ import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from ".
|
|
|
260
264
|
welcomeEmail: answers.welcomeEmail
|
|
261
265
|
}, details, inspiration ? {
|
|
262
266
|
[AI_SITE_INSPIRATION_INPUT]: inspiration
|
|
267
|
+
} : {}, starterLook ? {
|
|
268
|
+
[AI_SITE_STARTER_LOOK_INPUT]: aiSiteStarterLookInput(starterLook)
|
|
263
269
|
} : {});
|
|
264
270
|
}
|
|
265
271
|
/** The site inputs a guided start's answers become, by name: what a summary carries back (AGL-3596). */ export const AI_SITE_START_INPUT_KEYS = [
|
|
@@ -274,7 +280,8 @@ import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from ".
|
|
|
274
280
|
'submissions',
|
|
275
281
|
'welcomeEmail',
|
|
276
282
|
...AI_SITE_DETAIL_KEYS,
|
|
277
|
-
AI_SITE_INSPIRATION_INPUT
|
|
283
|
+
AI_SITE_INSPIRATION_INPUT,
|
|
284
|
+
AI_SITE_STARTER_LOOK_INPUT
|
|
278
285
|
];
|
|
279
286
|
/** A site job's scalar inputs, and nothing else its inputs carry; `null` when it has none. */ export function aiSiteStartInputsOf(inputs) {
|
|
280
287
|
if (!inputs) return null;
|
|
@@ -301,11 +308,15 @@ import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from ".
|
|
|
301
308
|
const pages = typeof (inputs == null ? void 0 : inputs['pages']) === 'number' ? Math.round(inputs['pages']) : AI_SITE_START_ANSWERS.pages;
|
|
302
309
|
const starter = text('starter');
|
|
303
310
|
const submissions = text('submissions');
|
|
311
|
+
// A start that ran had its style chosen: its kind, or "Pick for me".
|
|
312
|
+
const style = aiSiteStartStyleAnswer((_ref = (_aiSiteKind = aiSiteKind(text('siteKind'))) == null ? void 0 : _aiSiteKind.id) != null ? _ref : SITE_STYLE_AUTO);
|
|
313
|
+
// An AI starter's look comes back on the card it was sent with (AGL-4049).
|
|
314
|
+
const starterLook = style.kind ? aiSiteStarterLookFromInput(inputs == null ? void 0 : inputs[AI_SITE_STARTER_LOOK_INPUT]) : null;
|
|
304
315
|
return _extends({
|
|
305
316
|
siteType,
|
|
306
317
|
audience: text('audience'),
|
|
307
318
|
example: AI_SITE_START_EXAMPLES.some((entry)=>entry.id === starter) ? starter : null
|
|
308
|
-
},
|
|
319
|
+
}, style, {
|
|
309
320
|
pages: Math.min(band.max, Math.max(band.min, pages)),
|
|
310
321
|
submissions: AI_SITE_SUBMISSIONS.includes(submissions) ? submissions : AI_SITE_START_ANSWERS.submissions,
|
|
311
322
|
welcomeEmail: options.freeTaste ? false : (inputs == null ? void 0 : inputs['welcomeEmail']) !== false,
|
|
@@ -316,6 +327,11 @@ import { AI_SITE_INPUT_MAX_CHARS, AI_SITE_SUBMISSIONS, aiSitePagesBand } from ".
|
|
|
316
327
|
text(key)
|
|
317
328
|
])), text(AI_SITE_INSPIRATION_INPUT) ? {
|
|
318
329
|
inspiration: text(AI_SITE_INSPIRATION_INPUT).split(/\s+/).filter(Boolean).slice(0, aiSiteInspirationLimit(options.freeTaste))
|
|
330
|
+
} : {}, starterLook && style.kind ? {
|
|
331
|
+
starterLook: {
|
|
332
|
+
style: style.kind,
|
|
333
|
+
look: starterLook
|
|
334
|
+
}
|
|
319
335
|
} : {});
|
|
320
336
|
}
|
|
321
337
|
// ── An AI starter's answers (AGL-4049) ──────────────────────────────────────
|
|
@@ -337,13 +353,16 @@ const isAnswersRecord = (value)=>!!value && typeof value === 'object' && !Array.
|
|
|
337
353
|
* workspace's band. A description of the pages is the kind's own guidance,
|
|
338
354
|
* which the kind already carries to the plan.
|
|
339
355
|
* - `brief` → what the site is for, as typed on the first question.
|
|
356
|
+
* - `style` and `fonts` → the look the listing promised, `starterLook`:
|
|
357
|
+
* the style's base theme, pairing and tokens, with `fonts` winning over
|
|
358
|
+
* the style's own pairing where it names one this deployment has. A base,
|
|
359
|
+
* pairing or token this deployment does not know is left out, and a
|
|
360
|
+
* starter whose kind chooses no card holds no look, since the look holds
|
|
361
|
+
* only while its card is chosen ({@link aiSiteStartHeldStarterLook}).
|
|
340
362
|
*
|
|
341
|
-
* Anything else a starter carries is left out
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* answer starts where the questions start, so a starter never answers for
|
|
345
|
-
* the person what it does not say. Anything that is not a set of answers
|
|
346
|
-
* reads as none.
|
|
363
|
+
* Anything else a starter carries is left out. Every other answer starts
|
|
364
|
+
* where the questions start, so a starter never answers for the person what
|
|
365
|
+
* it does not say. Anything that is not a set of answers reads as none.
|
|
347
366
|
*/ export function aiSiteStartAnswersFromStarter(answers, options = {}) {
|
|
348
367
|
if (!isAnswersRecord(answers)) return _extends({}, AI_SITE_START_ANSWERS);
|
|
349
368
|
const band = aiSitePagesBand(options.freeTaste);
|
|
@@ -352,13 +371,38 @@ const isAnswersRecord = (value)=>!!value && typeof value === 'object' && !Array.
|
|
|
352
371
|
const primary = typeof colors['primary'] === 'string' ? colors['primary'].trim() : '';
|
|
353
372
|
const pages = answers['pages'];
|
|
354
373
|
const brief = typeof answers['brief'] === 'string' ? answers['brief'] : '';
|
|
374
|
+
const style = isAnswersRecord(answers['style']) ? answers['style'] : {};
|
|
375
|
+
const look = kind ? aiSiteStarterLookOf(_extends({}, style, aiSiteFontPairing(answers['fonts']) ? {
|
|
376
|
+
fonts: answers['fonts']
|
|
377
|
+
} : {})) : null;
|
|
355
378
|
return _extends({}, AI_SITE_START_ANSWERS, {
|
|
356
379
|
siteType: bounded(brief, AI_SITE_INPUT_MAX_CHARS)
|
|
357
|
-
}, kind ? aiSiteStartStyleAnswer(kind.id) : {}, {
|
|
380
|
+
}, kind ? aiSiteStartStyleAnswer(kind.id) : {}, kind && look ? {
|
|
381
|
+
starterLook: {
|
|
382
|
+
style: kind.id,
|
|
383
|
+
look
|
|
384
|
+
}
|
|
385
|
+
} : {}, {
|
|
358
386
|
pages: typeof pages === 'number' && Number.isInteger(pages) ? Math.min(band.max, Math.max(band.min, pages)) : Math.min(band.max, Math.max(band.min, AI_SITE_START_ANSWERS.pages)),
|
|
359
387
|
brand: STARTER_BRAND_HEX.test(primary) ? primary.toLowerCase() : ''
|
|
360
388
|
});
|
|
361
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The AI starter's look the answers hold (AGL-4049), while the Style card
|
|
392
|
+
* chosen is the starter's own; `null` from any other card, "Pick for me"
|
|
393
|
+
* included, so a person who picks another style gets that style's look,
|
|
394
|
+
* its base theme and fonts with it.
|
|
395
|
+
*/ export function aiSiteStartHeldStarterLook(answers) {
|
|
396
|
+
const held = answers.starterLook;
|
|
397
|
+
return held && answers.style === held.style ? held.look : null;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* What the starter's look is set in, as the Style card and the review say it
|
|
401
|
+
* (AGL-4049): "Set in Bootstrap with Fraunces and Inter; pick another style
|
|
402
|
+
* to change it." `null` while it is not held.
|
|
403
|
+
*/ export function aiSiteStartStarterLookLine(answers) {
|
|
404
|
+
return aiSiteStarterLookLine(aiSiteStartHeldStarterLook(answers));
|
|
405
|
+
}
|
|
362
406
|
// ── A build staff run for a client (AGL-3958) ───────────────────────────────
|
|
363
407
|
/** Shortens an answer to what a scalar input admits, on a word where it can. */ function bounded(value, max) {
|
|
364
408
|
const trimmed = value.trim().replace(/\s+/g, ' ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-start.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 { ClientBuildIntake } from '@aglyn/aglyn/app-utils/client-build'\nimport { SITE_STYLE_AUTO } from '@aglyn/aglyn/app-utils/site-styles'\nimport { weeklyHoursFromText, weeklyHoursToText } from '@aglyn/shared-ui-jsx/utils/weekly-hours'\nimport {\n AI_SITE_DETAIL_KEYS,\n AI_SITE_NO_DETAILS,\n aiSiteDetailProblem,\n aiSiteDetailsOf,\n type AiSiteDetailKey,\n type AiSiteDetails,\n} from './ai-site-details'\nimport { aiSiteKind, aiSiteKindFor, type AiSiteKind } from './ai-site-kinds'\nimport {\n AI_SITE_INSPIRATION_INPUT,\n aiSiteInspirationInput,\n aiSiteInspirationLimit,\n aiSiteInspirationRefusal,\n aiSiteInspirationUrl,\n} from './ai-site-inspiration'\nimport {\n AI_SITE_INPUT_MAX_CHARS,\n AI_SITE_SUBMISSIONS,\n aiSitePagesBand,\n type AiSiteJobInputs,\n type AiSiteSubmissions,\n} from './ai-site-job'\n\n/**\n * The guided start (AGL-2918): the questions a person answers on a site they\n * have just made, and the site job those answers become.\n *\n * A scaffold already exists — the `site` job plans four to eight pages, a\n * layout, a contact form, a palette and a welcome email, and builds every one\n * of them as a draft. What it had no way in through was a brief: somebody had\n * to know what to write, on a site where nothing has happened yet. So this\n * module is the QUESTIONS, and nothing else: what is asked, what an answer may\n * be, and how a set of answers becomes the brief and the scalar inputs the\n * `site` door already takes.\n *\n * ── Answering is never the way out ───────────────────────────────────────\n *\n * There is no answer here that means \"not this\". The way past the questions\n * is the `hostFirstRun` zone's own `startBlank`, which is drawn beside them\n * from the first one and creates nothing at all — see the zone in\n * `CONSOLE_WIDGET_SLOTS`. Putting the exit inside the question set would make\n * leaving a thing you answer your way to, and it is not.\n *\n * ── Every answer but the first is optional ───────────────────────────────\n *\n * Only what a site is FOR has no default worth guessing. The audience narrows\n * the copy, the example steers the shape, the page count and the welcome\n * email are defaults a person may change — so a person who types six words\n * and confirms gets a planned site, and the rest of the questions are there\n * for the person who wants to answer them.\n *\n * Pure: shapes, vocabularies and two string builders. No React, no network,\n * and no import of the starter catalog — {@link AI_SITE_START_EXAMPLES} names\n * the starters rather than reading them, so the console does not carry a\n * catalog of node maps to draw five cards. `ai-site-start.spec.ts` holds the\n * two lists to each other.\n */\n\n/** A worked example a person picks to steer what the site should look like. */\nexport interface AiSiteStartExample {\n /** A `STARTER_TEMPLATES` id, which is a persisted identifier. */\n id: string\n /** The starter as its card names it. */\n label: string\n /** The starter's category, which is how the examples group. */\n category: string\n /** What the example is, in one line a person reads before picking it. */\n blurb: string\n}\n\n/**\n * The examples the start offers, in the order they are shown. The platform's\n * own starter sites: a person who has no words for what they want has seen\n * these five shapes before, and picking one says more than a sentence would.\n */\nexport const AI_SITE_START_EXAMPLES: readonly AiSiteStartExample[] = [\n {\n id: 'business',\n label: 'Business',\n category: 'Business',\n blurb: 'A home page led by what you do, an about page and a contact page',\n },\n {\n id: 'landing',\n label: 'Landing Page',\n category: 'Marketing',\n blurb: 'One page that leads to one action, with the reasons to take it',\n },\n {\n id: 'portfolio',\n label: 'Portfolio',\n category: 'Personal',\n blurb: 'An introduction, a grid of work and a way to get in touch',\n },\n {\n id: 'physical-shop',\n label: 'Shop (physical products)',\n category: 'Commerce',\n blurb: 'Featured products, a shop to browse, and a cart',\n },\n {\n id: 'digital-shop',\n label: 'Shop (digital products)',\n category: 'Commerce',\n blurb: 'Downloads up front, a shop to browse, and a cart',\n },\n]\n\n/**\n * Kinds of site offered beside the first question's box, so answering it can\n * be a tap. They fill the box rather than replacing it: what somebody is\n * building is theirs to say, and a list of eight is a list somebody is not on.\n */\nexport const AI_SITE_START_TYPES: readonly string[] = [\n 'a local service business',\n 'a restaurant or cafe',\n 'a professional practice',\n 'a trades business',\n 'a shop',\n 'a nonprofit',\n 'a personal portfolio',\n 'an event',\n]\n\n/**\n * What a person answered; the shape the card holds and the brief is built from.\n *\n * Beside the answers each step asks, the business details its \"More details\"\n * offers (AGL-3979, `AiSiteDetails`): every one optional and `''` until given,\n * the phone number and email on the Details step itself.\n */\nexport interface AiSiteStartAnswers extends AiSiteDetails {\n /** What kind of site this is. The one answer with no default. */\n siteType: string\n /** Who the site is for; empty when they did not say. */\n audience: string\n /** The example they liked, by {@link AiSiteStartExample.id}; `null` for none. */\n example: string | null\n /**\n * The style card they clicked (AGL-4049): a kind's id, or\n * `SITE_STYLE_AUTO` for \"Pick for me\"; `null` while they have clicked none.\n * Nothing is chosen for a person, so the Style step does not go forward on\n * `null` ({@link aiSiteStartStyleAnswer} sets this and {@link kind} together).\n */\n style: string | null\n /**\n * The kind of site they picked (AGL-3660), by its `AI_SITE_KINDS` id;\n * `null` for \"Pick for me\", or before a style is chosen, when the kind\n * their first answer suggests is the one used ({@link aiSiteStartKind}).\n */\n kind: string | null\n /** How many pages to plan. */\n pages: number\n /** Where the contact form's submissions go. */\n submissions: AiSiteSubmissions\n /** Whether the scaffold also drafts a welcome email. */\n welcomeEmail: boolean\n /** The city or town the business is in (AGL-3979); empty when they did not say. */\n city: string\n /** The brand color, as a six-digit hex (AGL-3979); empty for the style's own. */\n brand: string\n /**\n * The sites they like (AGL-3975), as typed, one a field; absent or empty\n * for none. Asked only while `release_ai_site_inspiration` is on.\n */\n inspiration?: string[]\n}\n\n/**\n * What the questions start on. Five pages because it is the middle of the\n * band the scaffold builds, a welcome email because the scaffold drafts one\n * unless it is told not to, and the Inbox because it is what every submission\n * does anyway — filing a lead as well is the addition, and an addition is the\n * thing a person should have to choose.\n */\nexport const AI_SITE_START_ANSWERS: AiSiteStartAnswers = {\n siteType: '',\n audience: '',\n example: null,\n style: null,\n kind: null,\n pages: 5,\n submissions: 'inbox',\n welcomeEmail: true,\n city: '',\n brand: '',\n ...AI_SITE_NO_DETAILS,\n}\n\n/**\n * Why the Style step does not go forward before a card is clicked (AGL-4049),\n * and why the review does not plan: nothing is chosen for a person, and\n * \"Pick for me\" is a card too. The door itself admits a start without one\n * ({@link aiSiteStartRefusal} is what it would refuse), so this is the\n * questions' rule, held by `aiSiteStartStepErrors` and the card.\n */\nexport const AI_SITE_START_STYLE_REQUIRED = 'Choose a style, or Pick for me.'\n\n/** The answers a person may give beyond the ones each step asks, by key (AGL-3979). */\nexport type AiSiteStartExtraKey = AiSiteDetailKey | 'city' | 'brand'\n\n/** Every extra, in the order the review lists them. */\nexport const AI_SITE_START_EXTRA_KEYS: readonly AiSiteStartExtraKey[] = [\n 'phone',\n 'email',\n 'tagline',\n 'founded',\n 'serviceArea',\n 'priceRange',\n 'languages',\n 'brand',\n 'street',\n 'city',\n 'region',\n 'postalCode',\n 'country',\n 'hours',\n 'social',\n]\n\n/** What is wrong with one extra, worded for beside its field; `null` when it may be used. */\nexport function aiSiteStartExtraProblem(\n key: AiSiteStartExtraKey,\n value: string,\n): { code: 'too_long' | 'invalid'; message: string } | null {\n if (key === 'city' || key === 'brand') {\n return value.trim().length > AI_SITE_INPUT_MAX_CHARS\n ? { code: 'too_long', message: `Keep this under ${AI_SITE_INPUT_MAX_CHARS} characters.` }\n : null\n }\n return aiSiteDetailProblem(key, value)\n}\n\n/** The extras a person gave, in the review's order: what \"More details\" was used for. */\nexport function aiSiteStartExtrasGiven(answers: AiSiteStartAnswers): AiSiteStartExtraKey[] {\n return AI_SITE_START_EXTRA_KEYS.filter((key) => (answers[key] ?? '').trim() !== '')\n}\n\n/**\n * A style card clicked (AGL-4049), as the answers hold it: the card's id as\n * the style, and the kind it names — none for \"Pick for me\", which leaves the\n * kind to what the site is and who it is for.\n */\nexport function aiSiteStartStyleAnswer(id: string): Pick<AiSiteStartAnswers, 'style' | 'kind'> {\n return { style: id, kind: id === SITE_STYLE_AUTO ? null : (aiSiteKind(id)?.id ?? null) }\n}\n\n/** The kind of site the answers pick, else the one what the site is and who it is for suggest. */\nexport function aiSiteStartKind(\n answers: Pick<AiSiteStartAnswers, 'kind' | 'siteType'> & Partial<Pick<AiSiteStartAnswers, 'audience'>>,\n): AiSiteKind {\n return aiSiteKind(answers.kind) ?? aiSiteKindFor(answers.siteType, answers.audience ?? '')\n}\n\n/** The example an answer names, or `null` when it names none this list knows. */\nexport function aiSiteStartExample(\n answers: AiSiteStartAnswers,\n): AiSiteStartExample | null {\n if (!answers.example) return null\n return AI_SITE_START_EXAMPLES.find((entry) => entry.id === answers.example) ?? null\n}\n\n/**\n * Why these answers cannot start a site, in a sentence a person reads; `null`\n * when they can. The door's own parser is what actually admits the job — this\n * is what the card says before it asks for one.\n */\nexport function aiSiteStartRefusal(\n answers: AiSiteStartAnswers,\n options: { freeTaste?: boolean } = {},\n): string | null {\n // The workspace's own band (AGL-3594): one or two pages on the Free taste.\n const band = aiSitePagesBand(options.freeTaste)\n const siteType = answers.siteType.trim()\n if (!siteType) return 'Say what kind of site this is.'\n if (siteType.length > AI_SITE_INPUT_MAX_CHARS) {\n return `Keep what kind of site this is under ${AI_SITE_INPUT_MAX_CHARS} characters.`\n }\n if (answers.audience.trim().length > AI_SITE_INPUT_MAX_CHARS) {\n return `Keep who the site is for under ${AI_SITE_INPUT_MAX_CHARS} characters.`\n }\n if (!Number.isInteger(answers.pages) || answers.pages < band.min || answers.pages > band.max) {\n return `A site is planned with ${band.min} to ${band.max} pages.`\n }\n if (answers.example !== null && !aiSiteStartExample(answers)) {\n return 'Pick one of the examples, or none of them.'\n }\n if (!(AI_SITE_SUBMISSIONS as readonly string[]).includes(answers.submissions)) {\n return 'Say where the contact form’s submissions go.'\n }\n for (const key of AI_SITE_START_EXTRA_KEYS) {\n const problem = aiSiteStartExtraProblem(key, answers[key] ?? '')\n if (problem) return problem.message\n }\n return aiSiteStartInspirationRefusal(answers, options)\n}\n\n/** The sites they typed, without the empty fields. */\nexport function aiSiteStartInspirationTyped(answers: Pick<AiSiteStartAnswers, 'inspiration'>): string[] {\n return (answers.inspiration ?? []).map((entry) => entry.trim()).filter(Boolean)\n}\n\n/** Why the sites they like cannot go forward, as the door would refuse them; `null` when they can. */\nexport function aiSiteStartInspirationRefusal(\n answers: Pick<AiSiteStartAnswers, 'inspiration'>,\n options: { freeTaste?: boolean } = {},\n): string | null {\n const typed = aiSiteStartInspirationTyped(answers)\n if (typed.some((entry) => !aiSiteInspirationUrl(entry))) {\n return 'Give each site you like as its https address, like https://example.com.'\n }\n return aiSiteInspirationRefusal(typed, options.freeTaste)\n}\n\n/**\n * The answers as the brief the `site` job is created with: the plan step reads\n * it as the person's own words, so it says what they said and asks for nothing\n * they did not.\n */\nexport function aiSiteStartBrief(answers: AiSiteStartAnswers): string {\n const siteType = answers.siteType.trim()\n const audience = answers.audience.trim()\n const example = aiSiteStartExample(answers)\n const sentences = [\n `A ${answers.pages}-page website for ${siteType}.`,\n ]\n if (audience) sentences.push(`It is for ${audience}.`)\n if (example) {\n sentences.push(\n `Follow the shape of the ${example.label} starter: ${example.blurb.toLowerCase()}.`,\n )\n }\n // The kind they picked, or the one their answer suggests (AGL-3660).\n sentences.push(`Make it a ${aiSiteStartKind(answers).label.toLowerCase()} site.`)\n // The form on the page a visitor opens to get in touch, never every page's\n // last band (AGL-3899): \"on the page that asks to be contacted\" read as\n // the home's closing band on 16 of the 22 newest production starts.\n sentences.push(\n answers.pages === 1\n ? 'Plan the page around what a visitor comes to do, with a contact form on it.'\n : 'Plan a page for each thing a visitor comes to do, with the contact form on the page a visitor opens to get in touch.',\n )\n if (audience) {\n // Said of the FORM as well as of the copy: who fills a form in is what\n // decides which fields it asks for, and a brief that named the audience\n // once, in a sentence about the pages, left the form to guess.\n sentences.push(`Ask the contact form for what ${audience} would be asked for.`)\n }\n return sentences.join(' ')\n}\n\n/**\n * The answers as the `site` job's scalar inputs. Read by the door's\n * {@link parseAiSiteJobInputs}, and put in front of the model one per line by\n * the plan step, which is how the audience and the example reach the plan\n * without a prompt of their own.\n *\n * The per-site variables an agency batch fills — the business name, the city,\n * the brand — are left empty here: the questions never ask them. The name is\n * the site's own, and the create door fills it from the site\n * (`aiJobAdmittedInputs`, AGL-3596) when the job is started — a job that\n * reached the model with no name had the model invent one for its header and\n * footer.\n */\nexport function aiSiteStartInputs(\n answers: AiSiteStartAnswers,\n): Omit<AiSiteJobInputs, 'batchId' | 'inspiration' | AiSiteDetailKey> & Partial<AiSiteDetails> & { inspiration?: string } {\n const example = aiSiteStartExample(answers)\n const kind = aiSiteStartKind(answers)\n // The details are sent only where given (AGL-3979): the plan step lists\n // every scalar input on a line of its own, and a start without them is\n // asked exactly what it was asked before.\n const details: Partial<AiSiteDetails> = {}\n for (const key of AI_SITE_DETAIL_KEYS) {\n const value = (answers[key] ?? '').trim()\n if (value) details[key] = value\n }\n // The sites they like travel only when there are some (AGL-3975), so a\n // start without them asks for exactly what it always did.\n const inspiration = aiSiteInspirationInput(aiSiteStartInspirationTyped(answers))\n return {\n businessType: answers.siteType.trim(),\n audience: answers.audience.trim(),\n starter: example?.id ?? kind.starter,\n siteKind: kind.id,\n pages: answers.pages,\n businessName: '',\n city: (answers.city ?? '').trim(),\n brand: (answers.brand ?? '').trim(),\n submissions: answers.submissions,\n welcomeEmail: answers.welcomeEmail,\n ...details,\n ...(inspiration ? { [AI_SITE_INSPIRATION_INPUT]: inspiration } : {}),\n }\n}\n\n/** The site inputs a guided start's answers become, by name: what a summary carries back (AGL-3596). */\nexport const AI_SITE_START_INPUT_KEYS = [\n 'businessType',\n 'audience',\n 'starter',\n 'siteKind',\n 'pages',\n 'businessName',\n 'city',\n 'brand',\n 'submissions',\n 'welcomeEmail',\n ...AI_SITE_DETAIL_KEYS,\n AI_SITE_INSPIRATION_INPUT,\n] as const\n\n/** A site job's scalar inputs, and nothing else its inputs carry; `null` when it has none. */\nexport function aiSiteStartInputsOf(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n): Record<string, unknown> | null {\n if (!inputs) return null\n const kept: Record<string, unknown> = {}\n for (const key of AI_SITE_START_INPUT_KEYS) {\n const value = inputs[key]\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') kept[key] = value\n }\n return Object.keys(kept).length ? kept : null\n}\n\n/**\n * A failed start's answers, back as the questions hold them (AGL-3596), so\n * Try again reopens the guided start filled in for the person to adjust:\n * the inverse of {@link aiSiteStartInputs}. Read defensively — an answer the\n * questions no longer offer goes back to its default — and held to the\n * workspace's page band. `null` when the inputs say no kind of site at all.\n */\nexport function aiSiteStartAnswersFromInputs(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n options: { freeTaste?: boolean } = {},\n): AiSiteStartAnswers | null {\n const text = (key: string) => (typeof inputs?.[key] === 'string' ? (inputs[key] as string).trim() : '')\n const siteType = text('businessType')\n if (!siteType) return null\n const band = aiSitePagesBand(options.freeTaste)\n const pages = typeof inputs?.['pages'] === 'number' ? Math.round(inputs['pages'] as number) : AI_SITE_START_ANSWERS.pages\n const starter = text('starter')\n const submissions = text('submissions')\n return {\n siteType,\n audience: text('audience'),\n example: AI_SITE_START_EXAMPLES.some((entry) => entry.id === starter) ? starter : null,\n // A start that ran had its style chosen: its kind, or \"Pick for me\".\n ...aiSiteStartStyleAnswer(aiSiteKind(text('siteKind'))?.id ?? SITE_STYLE_AUTO),\n pages: Math.min(band.max, Math.max(band.min, pages)),\n submissions: (AI_SITE_SUBMISSIONS as readonly string[]).includes(submissions)\n ? (submissions as AiSiteSubmissions)\n : AI_SITE_START_ANSWERS.submissions,\n welcomeEmail: options.freeTaste ? false : inputs?.['welcomeEmail'] !== false,\n city: text('city'),\n brand: text('brand'),\n ...(Object.fromEntries(AI_SITE_DETAIL_KEYS.map((key) => [key, text(key)])) as unknown as AiSiteDetails),\n // The sites they liked come back as typed, within the workspace's limit (AGL-3975).\n ...(text(AI_SITE_INSPIRATION_INPUT)\n ? { inspiration: text(AI_SITE_INSPIRATION_INPUT).split(/\\s+/).filter(Boolean).slice(0, aiSiteInspirationLimit(options.freeTaste)) }\n : {}),\n }\n}\n\n// ── An AI starter's answers (AGL-4049) ──────────────────────────────────────\n\n/** A brand color as the questions hold one: six hex digits. */\nconst STARTER_BRAND_HEX = /^#[0-9a-f]{6}$/i\n\nconst isAnswersRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n !!value && typeof value === 'object' && !Array.isArray(value)\n\n/**\n * The questions' answers an AI starter fills in (AGL-4049), from the answers\n * its listing carries: what \"Choose your starter\" hands the start when a\n * person picks one. Every answer stays the person's to change.\n *\n * Read from the keys a starter writes (`first-party-starters.mjs`, and a\n * publisher's AI starter in the same shape):\n *\n * - `kind` → the style chosen, and the kind it names. The person chose it by\n * picking the starter, so it arrives chosen; a kind this deployment does\n * not know chooses nothing, and the Style step asks as ever.\n * - `brandColors.primary` → the brand color, when it is a color.\n * - `pages`, when it is a whole number → how many pages to plan, held to the\n * workspace's band. A description of the pages is the kind's own guidance,\n * which the kind already carries to the plan.\n * - `brief` → what the site is for, as typed on the first question.\n *\n * Anything else a starter carries is left out — `style`'s finer tokens and\n * `fonts` included: the questions ask neither, and the kind's look and the\n * brand color are what carry a starter's look into the job. Every other\n * answer starts where the questions start, so a starter never answers for\n * the person what it does not say. Anything that is not a set of answers\n * reads as none.\n */\nexport function aiSiteStartAnswersFromStarter(\n answers: Readonly<Record<string, unknown>> | null | undefined,\n options: { freeTaste?: boolean } = {},\n): AiSiteStartAnswers {\n if (!isAnswersRecord(answers)) return { ...AI_SITE_START_ANSWERS }\n const band = aiSitePagesBand(options.freeTaste)\n const kind = aiSiteKind(typeof answers['kind'] === 'string' ? answers['kind'] : null)\n const colors = isAnswersRecord(answers['brandColors']) ? answers['brandColors'] : {}\n const primary = typeof colors['primary'] === 'string' ? colors['primary'].trim() : ''\n const pages = answers['pages']\n const brief = typeof answers['brief'] === 'string' ? answers['brief'] : ''\n return {\n ...AI_SITE_START_ANSWERS,\n siteType: bounded(brief, AI_SITE_INPUT_MAX_CHARS),\n ...(kind ? aiSiteStartStyleAnswer(kind.id) : {}),\n pages:\n typeof pages === 'number' && Number.isInteger(pages)\n ? Math.min(band.max, Math.max(band.min, pages))\n : Math.min(band.max, Math.max(band.min, AI_SITE_START_ANSWERS.pages)),\n brand: STARTER_BRAND_HEX.test(primary) ? primary.toLowerCase() : '',\n }\n}\n\n// ── A build staff run for a client (AGL-3958) ───────────────────────────────\n\n/** Shortens an answer to what a scalar input admits, on a word where it can. */\nfunction bounded(value: string, max: number): string {\n const trimmed = value.trim().replace(/\\s+/g, ' ')\n if (trimmed.length <= max) return trimmed\n const cut = trimmed.slice(0, max)\n const space = cut.lastIndexOf(' ')\n return (space > max / 2 ? cut.slice(0, space) : cut).trim()\n}\n\n/** A time with am or pm: \"9am\", \"5:30 pm\", \"12 a.m.\". */\nconst TWELVE_HOUR_TIME = /\\b(\\d{1,2})(?::(\\d{2}))?\\s*([ap])\\.?m\\.?(?![a-z])/gi\n\n/**\n * The hours an owner gave, in the shape the Details step's hours picker\n * writes (`Tu-Sa 09:00-17:00`, one set of days a line), so the plan reads\n * them as it reads hours picked there. A time with am or pm is the time it\n * names, \"to\" joins a range as a dash does, and days with their hours may be\n * set apart by a comma, a semicolon or a line. Whatever still does not read\n * as hours — \"8–5\", \"Sat by appointment\" — is left out rather than guessed at.\n */\nfunction clientBuildHours(hours: string): string {\n const lines = hours\n .replace(TWELVE_HOUR_TIME, (time, hour: string, minutes: string | undefined, half: string) => {\n const h = Number(hour)\n if (h < 1 || h > 12) return time\n const clock = (h % 12) + (half.toLowerCase() === 'p' ? 12 : 0)\n return `${String(clock).padStart(2, '0')}:${minutes ?? '00'}`\n })\n .replace(/\\s+to\\s+/gi, '-')\n .replace(/(\\d{1,2}:\\d{2})\\s*,\\s*/g, '$1\\n')\n .replace(/;/g, '\\n')\n const week = weeklyHoursFromText(lines).hours\n return week.some((day) => day.length) ? weeklyHoursToText(week) : ''\n}\n\n/**\n * The towns an intake serves, one a line, as the Details step's \"Areas you\n * serve\" holds them: \"Austin, Round Rock and Pflugerville\" is three.\n */\nfunction clientBuildServiceArea(towns: string): string {\n return towns\n .split(/\\r?\\n|[,;]|\\s+(?:and|&)\\s+/i)\n .map((town) => town.trim())\n .filter(Boolean)\n .join('\\n')\n}\n\n/**\n * The questions' answers for a site staff are building for a client: what\n * the business does is the kind of site, and the details the intake holds\n * fill the Details step's own fields (AGL-3979, AGL-3995): the phone, the\n * email, the towns as the areas it serves and the hours, each held to that\n * detail's own rule, so one the Details step would refuse is left empty\n * there. Every other answer keeps its default, which the review shows to\n * change. The intake, a refused detail included, also reaches the job\n * through {@link aiSiteStartClientInputs} and {@link aiSiteStartClientBrief}.\n */\nexport function aiSiteStartAnswersFromClientBuild(intake: ClientBuildIntake): AiSiteStartAnswers {\n const details = aiSiteDetailsOf({\n phone: intake.phone,\n email: intake.email,\n serviceArea: clientBuildServiceArea(intake.towns),\n hours: clientBuildHours(intake.hours),\n })\n return {\n ...AI_SITE_START_ANSWERS,\n siteType: bounded(intake.whatTheyDo, AI_SITE_INPUT_MAX_CHARS),\n // The site exists already and the intake answered for it: what the\n // business does picks its style, as \"Pick for me\" does, and staff change\n // it on the review like any answer.\n ...aiSiteStartStyleAnswer(SITE_STYLE_AUTO),\n phone: details.phone,\n email: details.email,\n serviceArea: details.serviceArea,\n hours: details.hours,\n }\n}\n\n/**\n * The per-site inputs the intake fills, which the guided start's own\n * questions leave empty: the business's name for the header and footer, and\n * the towns it serves as its place.\n *\n * The towns are the place only while no address is given. The Entity reads\n * `city` as the address's own locality wherever there is a street or a\n * postal code (`aiSiteEntity`), so once the answers carry either, `city` is\n * the city the Details step was given with that address, never the towns\n * (AGL-3995). The intake asks no address, so today that is the Details step's\n * own, typed on the review; the towns still reach the site as the areas it\n * serves.\n */\nexport function aiSiteStartClientInputs(\n intake: ClientBuildIntake,\n answers?: Pick<AiSiteStartAnswers, 'street' | 'postalCode' | 'city'> | null,\n): Pick<AiSiteJobInputs, 'businessName' | 'city'> {\n const addressed = Boolean(answers?.street.trim() || answers?.postalCode.trim())\n return {\n businessName: bounded(intake.businessName, AI_SITE_INPUT_MAX_CHARS),\n city: bounded(addressed ? (answers?.city ?? '') : intake.towns, AI_SITE_INPUT_MAX_CHARS),\n }\n}\n\n/**\n * The intake as sentences added to the brief: how to reach the business and\n * when it is open, which the site should say where a visitor looks for them,\n * and the owner's own words, quoted, which the copy should sound like. Empty\n * answers say nothing.\n */\nexport function aiSiteStartClientBrief(intake: ClientBuildIntake): string {\n const name = intake.businessName.trim()\n const towns = intake.towns.trim()\n const phone = intake.phone.trim()\n const email = intake.email.trim()\n const hours = intake.hours.trim()\n const words = intake.ownerWords.trim().replace(/\\s+/g, ' ')\n const sentences: string[] = []\n if (name) sentences.push(`The business is called ${name}.`)\n if (towns) sentences.push(`It serves ${towns}.`)\n const contact = [phone ? `call ${phone}` : '', email ? `email ${email}` : ''].filter(Boolean)\n if (contact.length) {\n sentences.push(`Visitors reach it to ${contact.join(' or ')}; say so wherever the site tells them how to get in touch.`)\n }\n if (hours) sentences.push(`Its hours are ${hours}.`)\n if (words) sentences.push(`In the owner's own words: \"${words}\" Write the copy so it sounds like them.`)\n return sentences.join(' ')\n}\n\n/**\n * What the review says the client build adds beyond its own rows, so staff\n * see the intake is used without it being asked again: the business's name\n * and the owner's own words, which no row shows. The phone, email, towns and\n * hours are the review's Details rows already (AGL-3995), so the note does\n * not say them twice: \"Also from the client's details: Harbor Plumbing and\n * the owner's own words.\"\n */\nexport function aiSiteStartClientNote(intake: ClientBuildIntake): string {\n const parts = [intake.businessName.trim(), intake.ownerWords.trim() ? \"the owner's own words\" : ''].filter(Boolean)\n if (!parts.length) return 'Built from the client’s details.'\n return `Also from the client’s details: ${parts.join(' and ')}.`\n}\n"],"names":["SITE_STYLE_AUTO","weeklyHoursFromText","weeklyHoursToText","AI_SITE_DETAIL_KEYS","AI_SITE_NO_DETAILS","aiSiteDetailProblem","aiSiteDetailsOf","aiSiteKind","aiSiteKindFor","AI_SITE_INSPIRATION_INPUT","aiSiteInspirationInput","aiSiteInspirationLimit","aiSiteInspirationRefusal","aiSiteInspirationUrl","AI_SITE_INPUT_MAX_CHARS","AI_SITE_SUBMISSIONS","aiSitePagesBand","AI_SITE_START_EXAMPLES","id","label","category","blurb","AI_SITE_START_TYPES","AI_SITE_START_ANSWERS","siteType","audience","example","style","kind","pages","submissions","welcomeEmail","city","brand","AI_SITE_START_STYLE_REQUIRED","AI_SITE_START_EXTRA_KEYS","aiSiteStartExtraProblem","key","value","trim","length","code","message","aiSiteStartExtrasGiven","answers","filter","aiSiteStartStyleAnswer","aiSiteStartKind","aiSiteStartExample","find","entry","aiSiteStartRefusal","options","band","freeTaste","Number","isInteger","min","max","includes","problem","aiSiteStartInspirationRefusal","aiSiteStartInspirationTyped","inspiration","map","Boolean","typed","some","aiSiteStartBrief","sentences","push","toLowerCase","join","aiSiteStartInputs","details","businessType","starter","siteKind","businessName","AI_SITE_START_INPUT_KEYS","aiSiteStartInputsOf","inputs","kept","Object","keys","aiSiteStartAnswersFromInputs","text","Math","round","fromEntries","split","slice","STARTER_BRAND_HEX","isAnswersRecord","Array","isArray","aiSiteStartAnswersFromStarter","colors","primary","brief","bounded","test","trimmed","replace","cut","space","lastIndexOf","TWELVE_HOUR_TIME","clientBuildHours","hours","lines","time","hour","minutes","half","h","clock","String","padStart","week","day","clientBuildServiceArea","towns","town","aiSiteStartAnswersFromClientBuild","intake","phone","email","serviceArea","whatTheyDo","aiSiteStartClientInputs","addressed","street","postalCode","aiSiteStartClientBrief","name","words","ownerWords","contact","aiSiteStartClientNote","parts"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,eAAe,QAAQ,qCAAoC;AACpE,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,0CAAyC;AAChG,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,mBAAmB,EACnBC,eAAe,QAGV,uBAAmB;AAC1B,SAASC,UAAU,EAAEC,aAAa,QAAyB,qBAAiB;AAC5E,SACEC,yBAAyB,EACzBC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,EACxBC,oBAAoB,QACf,2B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QAClB6B,UAAUC,IAAI,CAAC,CAAC,qBAAqB,EAAEoE,QAAQlE,IAAI,CAAC,QAAQ,0DAA0D,CAAC;IACzH;IACA,IAAIqC,OAAOxC,UAAUC,IAAI,CAAC,CAAC,cAAc,EAAEuC,MAAM,CAAC,CAAC;IACnD,IAAI2B,OAAOnE,UAAUC,IAAI,CAAC,CAAC,2BAA2B,EAAEkE,MAAM,wCAAwC,CAAC;IACvG,OAAOnE,UAAUG,IAAI,CAAC;AACxB;AAEA;;;;;;;CAOC,GACD,OAAO,SAASmE,sBAAsBd,MAAyB;IAC7D,MAAMe,QAAQ;QAACf,OAAO/C,YAAY,CAACvC,IAAI;QAAIsF,OAAOY,UAAU,CAAClG,IAAI,KAAK,0BAA0B;KAAG,CAACM,MAAM,CAACoB;IAC3G,IAAI,CAAC2E,MAAMpG,MAAM,EAAE,OAAO;IAC1B,OAAO,CAAC,gCAAgC,EAAEoG,MAAMpE,IAAI,CAAC,SAAS,CAAC,CAAC;AAClE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-start.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 { ClientBuildIntake } from '@aglyn/aglyn/app-utils/client-build'\nimport { SITE_STYLE_AUTO } from '@aglyn/aglyn/app-utils/site-styles'\nimport { weeklyHoursFromText, weeklyHoursToText } from '@aglyn/shared-ui-jsx/utils/weekly-hours'\nimport {\n AI_SITE_DETAIL_KEYS,\n AI_SITE_NO_DETAILS,\n aiSiteDetailProblem,\n aiSiteDetailsOf,\n type AiSiteDetailKey,\n type AiSiteDetails,\n} from './ai-site-details'\nimport { aiSiteFontPairing, aiSiteKind, aiSiteKindFor, type AiSiteKind } from './ai-site-kinds'\nimport {\n AI_SITE_INSPIRATION_INPUT,\n aiSiteInspirationInput,\n aiSiteInspirationLimit,\n aiSiteInspirationRefusal,\n aiSiteInspirationUrl,\n} from './ai-site-inspiration'\nimport {\n AI_SITE_INPUT_MAX_CHARS,\n AI_SITE_SUBMISSIONS,\n aiSitePagesBand,\n type AiSiteJobInputs,\n type AiSiteSubmissions,\n} from './ai-site-job'\nimport {\n AI_SITE_STARTER_LOOK_INPUT,\n aiSiteStarterLookFromInput,\n aiSiteStarterLookInput,\n aiSiteStarterLookLine,\n aiSiteStarterLookOf,\n type AiSiteStarterLook,\n} from './ai-site-starter-look'\n\nexport {\n AI_SITE_STARTER_LOOK_INPUT,\n AI_SITE_STARTER_LOOK_MAX_CHARS,\n aiSiteStarterLookFromInput,\n type AiSiteStarterLook,\n} from './ai-site-starter-look'\n\n/**\n * The guided start (AGL-2918): the questions a person answers on a site they\n * have just made, and the site job those answers become.\n *\n * A scaffold already exists — the `site` job plans four to eight pages, a\n * layout, a contact form, a palette and a welcome email, and builds every one\n * of them as a draft. What it had no way in through was a brief: somebody had\n * to know what to write, on a site where nothing has happened yet. So this\n * module is the QUESTIONS, and nothing else: what is asked, what an answer may\n * be, and how a set of answers becomes the brief and the scalar inputs the\n * `site` door already takes.\n *\n * ── Answering is never the way out ───────────────────────────────────────\n *\n * There is no answer here that means \"not this\". The way past the questions\n * is the `hostFirstRun` zone's own `startBlank`, which is drawn beside them\n * from the first one and creates nothing at all — see the zone in\n * `CONSOLE_WIDGET_SLOTS`. Putting the exit inside the question set would make\n * leaving a thing you answer your way to, and it is not.\n *\n * ── Every answer but the first is optional ───────────────────────────────\n *\n * Only what a site is FOR has no default worth guessing. The audience narrows\n * the copy, the example steers the shape, the page count and the welcome\n * email are defaults a person may change — so a person who types six words\n * and confirms gets a planned site, and the rest of the questions are there\n * for the person who wants to answer them.\n *\n * Pure: shapes, vocabularies and two string builders. No React, no network,\n * and no import of the starter catalog — {@link AI_SITE_START_EXAMPLES} names\n * the starters rather than reading them, so the console does not carry a\n * catalog of node maps to draw five cards. `ai-site-start.spec.ts` holds the\n * two lists to each other.\n */\n\n/** A worked example a person picks to steer what the site should look like. */\nexport interface AiSiteStartExample {\n /** A `STARTER_TEMPLATES` id, which is a persisted identifier. */\n id: string\n /** The starter as its card names it. */\n label: string\n /** The starter's category, which is how the examples group. */\n category: string\n /** What the example is, in one line a person reads before picking it. */\n blurb: string\n}\n\n/**\n * The examples the start offers, in the order they are shown. The platform's\n * own starter sites: a person who has no words for what they want has seen\n * these five shapes before, and picking one says more than a sentence would.\n */\nexport const AI_SITE_START_EXAMPLES: readonly AiSiteStartExample[] = [\n {\n id: 'business',\n label: 'Business',\n category: 'Business',\n blurb: 'A home page led by what you do, an about page and a contact page',\n },\n {\n id: 'landing',\n label: 'Landing Page',\n category: 'Marketing',\n blurb: 'One page that leads to one action, with the reasons to take it',\n },\n {\n id: 'portfolio',\n label: 'Portfolio',\n category: 'Personal',\n blurb: 'An introduction, a grid of work and a way to get in touch',\n },\n {\n id: 'physical-shop',\n label: 'Shop (physical products)',\n category: 'Commerce',\n blurb: 'Featured products, a shop to browse, and a cart',\n },\n {\n id: 'digital-shop',\n label: 'Shop (digital products)',\n category: 'Commerce',\n blurb: 'Downloads up front, a shop to browse, and a cart',\n },\n]\n\n/**\n * Kinds of site offered beside the first question's box, so answering it can\n * be a tap. They fill the box rather than replacing it: what somebody is\n * building is theirs to say, and a list of eight is a list somebody is not on.\n */\nexport const AI_SITE_START_TYPES: readonly string[] = [\n 'a local service business',\n 'a restaurant or cafe',\n 'a professional practice',\n 'a trades business',\n 'a shop',\n 'a nonprofit',\n 'a personal portfolio',\n 'an event',\n]\n\n/**\n * What a person answered; the shape the card holds and the brief is built from.\n *\n * Beside the answers each step asks, the business details its \"More details\"\n * offers (AGL-3979, `AiSiteDetails`): every one optional and `''` until given,\n * the phone number and email on the Details step itself.\n */\nexport interface AiSiteStartAnswers extends AiSiteDetails {\n /** What kind of site this is. The one answer with no default. */\n siteType: string\n /** Who the site is for; empty when they did not say. */\n audience: string\n /** The example they liked, by {@link AiSiteStartExample.id}; `null` for none. */\n example: string | null\n /**\n * The style card they clicked (AGL-4049): a kind's id, or\n * `SITE_STYLE_AUTO` for \"Pick for me\"; `null` while they have clicked none.\n * Nothing is chosen for a person, so the Style step does not go forward on\n * `null` ({@link aiSiteStartStyleAnswer} sets this and {@link kind} together).\n */\n style: string | null\n /**\n * The kind of site they picked (AGL-3660), by its `AI_SITE_KINDS` id;\n * `null` for \"Pick for me\", or before a style is chosen, when the kind\n * their first answer suggests is the one used ({@link aiSiteStartKind}).\n */\n kind: string | null\n /** How many pages to plan. */\n pages: number\n /** Where the contact form's submissions go. */\n submissions: AiSiteSubmissions\n /** Whether the scaffold also drafts a welcome email. */\n welcomeEmail: boolean\n /** The city or town the business is in (AGL-3979); empty when they did not say. */\n city: string\n /** The brand color, as a six-digit hex (AGL-3979); empty for the style's own. */\n brand: string\n /**\n * The sites they like (AGL-3975), as typed, one a field; absent or empty\n * for none. Asked only while `release_ai_site_inspiration` is on.\n */\n inspiration?: string[]\n /**\n * The look an AI starter promised (AGL-4049): its base theme, font pairing\n * and style tokens, held while the Style card is the starter's own\n * (`style` is that card), and dropped, base and fonts both, while another\n * is chosen ({@link aiSiteStartHeldStarterLook}). Absent on a start from\n * no starter.\n */\n starterLook?: { style: string; look: AiSiteStarterLook }\n}\n\n/**\n * What the questions start on. Five pages because it is the middle of the\n * band the scaffold builds, a welcome email because the scaffold drafts one\n * unless it is told not to, and the Inbox because it is what every submission\n * does anyway — filing a lead as well is the addition, and an addition is the\n * thing a person should have to choose.\n */\nexport const AI_SITE_START_ANSWERS: AiSiteStartAnswers = {\n siteType: '',\n audience: '',\n example: null,\n style: null,\n kind: null,\n pages: 5,\n submissions: 'inbox',\n welcomeEmail: true,\n city: '',\n brand: '',\n ...AI_SITE_NO_DETAILS,\n}\n\n/**\n * Why the Style step does not go forward before a card is clicked (AGL-4049),\n * and why the review does not plan: nothing is chosen for a person, and\n * \"Pick for me\" is a card too. The door itself admits a start without one\n * ({@link aiSiteStartRefusal} is what it would refuse), so this is the\n * questions' rule, held by `aiSiteStartStepErrors` and the card.\n */\nexport const AI_SITE_START_STYLE_REQUIRED = 'Choose a style, or Pick for me.'\n\n/** The answers a person may give beyond the ones each step asks, by key (AGL-3979). */\nexport type AiSiteStartExtraKey = AiSiteDetailKey | 'city' | 'brand'\n\n/** Every extra, in the order the review lists them. */\nexport const AI_SITE_START_EXTRA_KEYS: readonly AiSiteStartExtraKey[] = [\n 'phone',\n 'email',\n 'tagline',\n 'founded',\n 'serviceArea',\n 'priceRange',\n 'languages',\n 'brand',\n 'street',\n 'city',\n 'region',\n 'postalCode',\n 'country',\n 'hours',\n 'social',\n]\n\n/** What is wrong with one extra, worded for beside its field; `null` when it may be used. */\nexport function aiSiteStartExtraProblem(\n key: AiSiteStartExtraKey,\n value: string,\n): { code: 'too_long' | 'invalid'; message: string } | null {\n if (key === 'city' || key === 'brand') {\n return value.trim().length > AI_SITE_INPUT_MAX_CHARS\n ? { code: 'too_long', message: `Keep this under ${AI_SITE_INPUT_MAX_CHARS} characters.` }\n : null\n }\n return aiSiteDetailProblem(key, value)\n}\n\n/** The extras a person gave, in the review's order: what \"More details\" was used for. */\nexport function aiSiteStartExtrasGiven(answers: AiSiteStartAnswers): AiSiteStartExtraKey[] {\n return AI_SITE_START_EXTRA_KEYS.filter((key) => (answers[key] ?? '').trim() !== '')\n}\n\n/**\n * A style card clicked (AGL-4049), as the answers hold it: the card's id as\n * the style, and the kind it names — none for \"Pick for me\", which leaves the\n * kind to what the site is and who it is for.\n */\nexport function aiSiteStartStyleAnswer(id: string): Pick<AiSiteStartAnswers, 'style' | 'kind'> {\n return { style: id, kind: id === SITE_STYLE_AUTO ? null : (aiSiteKind(id)?.id ?? null) }\n}\n\n/** The kind of site the answers pick, else the one what the site is and who it is for suggest. */\nexport function aiSiteStartKind(\n answers: Pick<AiSiteStartAnswers, 'kind' | 'siteType'> & Partial<Pick<AiSiteStartAnswers, 'audience'>>,\n): AiSiteKind {\n return aiSiteKind(answers.kind) ?? aiSiteKindFor(answers.siteType, answers.audience ?? '')\n}\n\n/** The example an answer names, or `null` when it names none this list knows. */\nexport function aiSiteStartExample(\n answers: AiSiteStartAnswers,\n): AiSiteStartExample | null {\n if (!answers.example) return null\n return AI_SITE_START_EXAMPLES.find((entry) => entry.id === answers.example) ?? null\n}\n\n/**\n * Why these answers cannot start a site, in a sentence a person reads; `null`\n * when they can. The door's own parser is what actually admits the job — this\n * is what the card says before it asks for one.\n */\nexport function aiSiteStartRefusal(\n answers: AiSiteStartAnswers,\n options: { freeTaste?: boolean } = {},\n): string | null {\n // The workspace's own band (AGL-3594): one or two pages on the Free taste.\n const band = aiSitePagesBand(options.freeTaste)\n const siteType = answers.siteType.trim()\n if (!siteType) return 'Say what kind of site this is.'\n if (siteType.length > AI_SITE_INPUT_MAX_CHARS) {\n return `Keep what kind of site this is under ${AI_SITE_INPUT_MAX_CHARS} characters.`\n }\n if (answers.audience.trim().length > AI_SITE_INPUT_MAX_CHARS) {\n return `Keep who the site is for under ${AI_SITE_INPUT_MAX_CHARS} characters.`\n }\n if (!Number.isInteger(answers.pages) || answers.pages < band.min || answers.pages > band.max) {\n return `A site is planned with ${band.min} to ${band.max} pages.`\n }\n if (answers.example !== null && !aiSiteStartExample(answers)) {\n return 'Pick one of the examples, or none of them.'\n }\n if (!(AI_SITE_SUBMISSIONS as readonly string[]).includes(answers.submissions)) {\n return 'Say where the contact form’s submissions go.'\n }\n for (const key of AI_SITE_START_EXTRA_KEYS) {\n const problem = aiSiteStartExtraProblem(key, answers[key] ?? '')\n if (problem) return problem.message\n }\n return aiSiteStartInspirationRefusal(answers, options)\n}\n\n/** The sites they typed, without the empty fields. */\nexport function aiSiteStartInspirationTyped(answers: Pick<AiSiteStartAnswers, 'inspiration'>): string[] {\n return (answers.inspiration ?? []).map((entry) => entry.trim()).filter(Boolean)\n}\n\n/** Why the sites they like cannot go forward, as the door would refuse them; `null` when they can. */\nexport function aiSiteStartInspirationRefusal(\n answers: Pick<AiSiteStartAnswers, 'inspiration'>,\n options: { freeTaste?: boolean } = {},\n): string | null {\n const typed = aiSiteStartInspirationTyped(answers)\n if (typed.some((entry) => !aiSiteInspirationUrl(entry))) {\n return 'Give each site you like as its https address, like https://example.com.'\n }\n return aiSiteInspirationRefusal(typed, options.freeTaste)\n}\n\n/**\n * The answers as the brief the `site` job is created with: the plan step reads\n * it as the person's own words, so it says what they said and asks for nothing\n * they did not.\n */\nexport function aiSiteStartBrief(answers: AiSiteStartAnswers): string {\n const siteType = answers.siteType.trim()\n const audience = answers.audience.trim()\n const example = aiSiteStartExample(answers)\n const sentences = [\n `A ${answers.pages}-page website for ${siteType}.`,\n ]\n if (audience) sentences.push(`It is for ${audience}.`)\n if (example) {\n sentences.push(\n `Follow the shape of the ${example.label} starter: ${example.blurb.toLowerCase()}.`,\n )\n }\n // The kind they picked, or the one their answer suggests (AGL-3660).\n sentences.push(`Make it a ${aiSiteStartKind(answers).label.toLowerCase()} site.`)\n // The form on the page a visitor opens to get in touch, never every page's\n // last band (AGL-3899): \"on the page that asks to be contacted\" read as\n // the home's closing band on 16 of the 22 newest production starts.\n sentences.push(\n answers.pages === 1\n ? 'Plan the page around what a visitor comes to do, with a contact form on it.'\n : 'Plan a page for each thing a visitor comes to do, with the contact form on the page a visitor opens to get in touch.',\n )\n if (audience) {\n // Said of the FORM as well as of the copy: who fills a form in is what\n // decides which fields it asks for, and a brief that named the audience\n // once, in a sentence about the pages, left the form to guess.\n sentences.push(`Ask the contact form for what ${audience} would be asked for.`)\n }\n return sentences.join(' ')\n}\n\n/**\n * The answers as the `site` job's scalar inputs. Read by the door's\n * {@link parseAiSiteJobInputs}, and put in front of the model one per line by\n * the plan step, which is how the audience and the example reach the plan\n * without a prompt of their own.\n *\n * The per-site variables an agency batch fills — the business name, the city,\n * the brand — are left empty here: the questions never ask them. The name is\n * the site's own, and the create door fills it from the site\n * (`aiJobAdmittedInputs`, AGL-3596) when the job is started — a job that\n * reached the model with no name had the model invent one for its header and\n * footer.\n */\nexport function aiSiteStartInputs(\n answers: AiSiteStartAnswers,\n): Omit<AiSiteJobInputs, 'batchId' | 'inspiration' | AiSiteDetailKey> &\n Partial<AiSiteDetails> & { inspiration?: string; [AI_SITE_STARTER_LOOK_INPUT]?: string } {\n const example = aiSiteStartExample(answers)\n const kind = aiSiteStartKind(answers)\n // The details are sent only where given (AGL-3979): the plan step lists\n // every scalar input on a line of its own, and a start without them is\n // asked exactly what it was asked before.\n const details: Partial<AiSiteDetails> = {}\n for (const key of AI_SITE_DETAIL_KEYS) {\n const value = (answers[key] ?? '').trim()\n if (value) details[key] = value\n }\n // The sites they like travel only when there are some (AGL-3975), so a\n // start without them asks for exactly what it always did.\n const inspiration = aiSiteInspirationInput(aiSiteStartInspirationTyped(answers))\n // An AI starter's look travels while its card is the one chosen (AGL-4049).\n const starterLook = aiSiteStartHeldStarterLook(answers)\n return {\n businessType: answers.siteType.trim(),\n audience: answers.audience.trim(),\n starter: example?.id ?? kind.starter,\n siteKind: kind.id,\n pages: answers.pages,\n businessName: '',\n city: (answers.city ?? '').trim(),\n brand: (answers.brand ?? '').trim(),\n submissions: answers.submissions,\n welcomeEmail: answers.welcomeEmail,\n ...details,\n ...(inspiration ? { [AI_SITE_INSPIRATION_INPUT]: inspiration } : {}),\n ...(starterLook ? { [AI_SITE_STARTER_LOOK_INPUT]: aiSiteStarterLookInput(starterLook) } : {}),\n }\n}\n\n/** The site inputs a guided start's answers become, by name: what a summary carries back (AGL-3596). */\nexport const AI_SITE_START_INPUT_KEYS = [\n 'businessType',\n 'audience',\n 'starter',\n 'siteKind',\n 'pages',\n 'businessName',\n 'city',\n 'brand',\n 'submissions',\n 'welcomeEmail',\n ...AI_SITE_DETAIL_KEYS,\n AI_SITE_INSPIRATION_INPUT,\n AI_SITE_STARTER_LOOK_INPUT,\n] as const\n\n/** A site job's scalar inputs, and nothing else its inputs carry; `null` when it has none. */\nexport function aiSiteStartInputsOf(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n): Record<string, unknown> | null {\n if (!inputs) return null\n const kept: Record<string, unknown> = {}\n for (const key of AI_SITE_START_INPUT_KEYS) {\n const value = inputs[key]\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') kept[key] = value\n }\n return Object.keys(kept).length ? kept : null\n}\n\n/**\n * A failed start's answers, back as the questions hold them (AGL-3596), so\n * Try again reopens the guided start filled in for the person to adjust:\n * the inverse of {@link aiSiteStartInputs}. Read defensively — an answer the\n * questions no longer offer goes back to its default — and held to the\n * workspace's page band. `null` when the inputs say no kind of site at all.\n */\nexport function aiSiteStartAnswersFromInputs(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n options: { freeTaste?: boolean } = {},\n): AiSiteStartAnswers | null {\n const text = (key: string) => (typeof inputs?.[key] === 'string' ? (inputs[key] as string).trim() : '')\n const siteType = text('businessType')\n if (!siteType) return null\n const band = aiSitePagesBand(options.freeTaste)\n const pages = typeof inputs?.['pages'] === 'number' ? Math.round(inputs['pages'] as number) : AI_SITE_START_ANSWERS.pages\n const starter = text('starter')\n const submissions = text('submissions')\n // A start that ran had its style chosen: its kind, or \"Pick for me\".\n const style = aiSiteStartStyleAnswer(aiSiteKind(text('siteKind'))?.id ?? SITE_STYLE_AUTO)\n // An AI starter's look comes back on the card it was sent with (AGL-4049).\n const starterLook = style.kind ? aiSiteStarterLookFromInput(inputs?.[AI_SITE_STARTER_LOOK_INPUT]) : null\n return {\n siteType,\n audience: text('audience'),\n example: AI_SITE_START_EXAMPLES.some((entry) => entry.id === starter) ? starter : null,\n ...style,\n pages: Math.min(band.max, Math.max(band.min, pages)),\n submissions: (AI_SITE_SUBMISSIONS as readonly string[]).includes(submissions)\n ? (submissions as AiSiteSubmissions)\n : AI_SITE_START_ANSWERS.submissions,\n welcomeEmail: options.freeTaste ? false : inputs?.['welcomeEmail'] !== false,\n city: text('city'),\n brand: text('brand'),\n ...(Object.fromEntries(AI_SITE_DETAIL_KEYS.map((key) => [key, text(key)])) as unknown as AiSiteDetails),\n // The sites they liked come back as typed, within the workspace's limit (AGL-3975).\n ...(text(AI_SITE_INSPIRATION_INPUT)\n ? { inspiration: text(AI_SITE_INSPIRATION_INPUT).split(/\\s+/).filter(Boolean).slice(0, aiSiteInspirationLimit(options.freeTaste)) }\n : {}),\n ...(starterLook && style.kind ? { starterLook: { style: style.kind, look: starterLook } } : {}),\n }\n}\n\n// ── An AI starter's answers (AGL-4049) ──────────────────────────────────────\n\n/** A brand color as the questions hold one: six hex digits. */\nconst STARTER_BRAND_HEX = /^#[0-9a-f]{6}$/i\n\nconst isAnswersRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n !!value && typeof value === 'object' && !Array.isArray(value)\n\n/**\n * The questions' answers an AI starter fills in (AGL-4049), from the answers\n * its listing carries: what \"Choose your starter\" hands the start when a\n * person picks one. Every answer stays the person's to change.\n *\n * Read from the keys a starter writes (`first-party-starters.mjs`, and a\n * publisher's AI starter in the same shape):\n *\n * - `kind` → the style chosen, and the kind it names. The person chose it by\n * picking the starter, so it arrives chosen; a kind this deployment does\n * not know chooses nothing, and the Style step asks as ever.\n * - `brandColors.primary` → the brand color, when it is a color.\n * - `pages`, when it is a whole number → how many pages to plan, held to the\n * workspace's band. A description of the pages is the kind's own guidance,\n * which the kind already carries to the plan.\n * - `brief` → what the site is for, as typed on the first question.\n * - `style` and `fonts` → the look the listing promised, `starterLook`:\n * the style's base theme, pairing and tokens, with `fonts` winning over\n * the style's own pairing where it names one this deployment has. A base,\n * pairing or token this deployment does not know is left out, and a\n * starter whose kind chooses no card holds no look, since the look holds\n * only while its card is chosen ({@link aiSiteStartHeldStarterLook}).\n *\n * Anything else a starter carries is left out. Every other answer starts\n * where the questions start, so a starter never answers for the person what\n * it does not say. Anything that is not a set of answers reads as none.\n */\nexport function aiSiteStartAnswersFromStarter(\n answers: Readonly<Record<string, unknown>> | null | undefined,\n options: { freeTaste?: boolean } = {},\n): AiSiteStartAnswers {\n if (!isAnswersRecord(answers)) return { ...AI_SITE_START_ANSWERS }\n const band = aiSitePagesBand(options.freeTaste)\n const kind = aiSiteKind(typeof answers['kind'] === 'string' ? answers['kind'] : null)\n const colors = isAnswersRecord(answers['brandColors']) ? answers['brandColors'] : {}\n const primary = typeof colors['primary'] === 'string' ? colors['primary'].trim() : ''\n const pages = answers['pages']\n const brief = typeof answers['brief'] === 'string' ? answers['brief'] : ''\n const style = isAnswersRecord(answers['style']) ? answers['style'] : {}\n const look = kind\n ? aiSiteStarterLookOf({ ...style, ...(aiSiteFontPairing(answers['fonts']) ? { fonts: answers['fonts'] } : {}) })\n : null\n return {\n ...AI_SITE_START_ANSWERS,\n siteType: bounded(brief, AI_SITE_INPUT_MAX_CHARS),\n ...(kind ? aiSiteStartStyleAnswer(kind.id) : {}),\n ...(kind && look ? { starterLook: { style: kind.id, look } } : {}),\n pages:\n typeof pages === 'number' && Number.isInteger(pages)\n ? Math.min(band.max, Math.max(band.min, pages))\n : Math.min(band.max, Math.max(band.min, AI_SITE_START_ANSWERS.pages)),\n brand: STARTER_BRAND_HEX.test(primary) ? primary.toLowerCase() : '',\n }\n}\n\n/**\n * The AI starter's look the answers hold (AGL-4049), while the Style card\n * chosen is the starter's own; `null` from any other card, \"Pick for me\"\n * included, so a person who picks another style gets that style's look,\n * its base theme and fonts with it.\n */\nexport function aiSiteStartHeldStarterLook(\n answers: Pick<AiSiteStartAnswers, 'style' | 'starterLook'>,\n): AiSiteStarterLook | null {\n const held = answers.starterLook\n return held && answers.style === held.style ? held.look : null\n}\n\n/**\n * What the starter's look is set in, as the Style card and the review say it\n * (AGL-4049): \"Set in Bootstrap with Fraunces and Inter; pick another style\n * to change it.\" `null` while it is not held.\n */\nexport function aiSiteStartStarterLookLine(answers: Pick<AiSiteStartAnswers, 'style' | 'starterLook'>): string | null {\n return aiSiteStarterLookLine(aiSiteStartHeldStarterLook(answers))\n}\n\n// ── A build staff run for a client (AGL-3958) ───────────────────────────────\n\n/** Shortens an answer to what a scalar input admits, on a word where it can. */\nfunction bounded(value: string, max: number): string {\n const trimmed = value.trim().replace(/\\s+/g, ' ')\n if (trimmed.length <= max) return trimmed\n const cut = trimmed.slice(0, max)\n const space = cut.lastIndexOf(' ')\n return (space > max / 2 ? cut.slice(0, space) : cut).trim()\n}\n\n/** A time with am or pm: \"9am\", \"5:30 pm\", \"12 a.m.\". */\nconst TWELVE_HOUR_TIME = /\\b(\\d{1,2})(?::(\\d{2}))?\\s*([ap])\\.?m\\.?(?![a-z])/gi\n\n/**\n * The hours an owner gave, in the shape the Details step's hours picker\n * writes (`Tu-Sa 09:00-17:00`, one set of days a line), so the plan reads\n * them as it reads hours picked there. A time with am or pm is the time it\n * names, \"to\" joins a range as a dash does, and days with their hours may be\n * set apart by a comma, a semicolon or a line. Whatever still does not read\n * as hours — \"8–5\", \"Sat by appointment\" — is left out rather than guessed at.\n */\nfunction clientBuildHours(hours: string): string {\n const lines = hours\n .replace(TWELVE_HOUR_TIME, (time, hour: string, minutes: string | undefined, half: string) => {\n const h = Number(hour)\n if (h < 1 || h > 12) return time\n const clock = (h % 12) + (half.toLowerCase() === 'p' ? 12 : 0)\n return `${String(clock).padStart(2, '0')}:${minutes ?? '00'}`\n })\n .replace(/\\s+to\\s+/gi, '-')\n .replace(/(\\d{1,2}:\\d{2})\\s*,\\s*/g, '$1\\n')\n .replace(/;/g, '\\n')\n const week = weeklyHoursFromText(lines).hours\n return week.some((day) => day.length) ? weeklyHoursToText(week) : ''\n}\n\n/**\n * The towns an intake serves, one a line, as the Details step's \"Areas you\n * serve\" holds them: \"Austin, Round Rock and Pflugerville\" is three.\n */\nfunction clientBuildServiceArea(towns: string): string {\n return towns\n .split(/\\r?\\n|[,;]|\\s+(?:and|&)\\s+/i)\n .map((town) => town.trim())\n .filter(Boolean)\n .join('\\n')\n}\n\n/**\n * The questions' answers for a site staff are building for a client: what\n * the business does is the kind of site, and the details the intake holds\n * fill the Details step's own fields (AGL-3979, AGL-3995): the phone, the\n * email, the towns as the areas it serves and the hours, each held to that\n * detail's own rule, so one the Details step would refuse is left empty\n * there. Every other answer keeps its default, which the review shows to\n * change. The intake, a refused detail included, also reaches the job\n * through {@link aiSiteStartClientInputs} and {@link aiSiteStartClientBrief}.\n */\nexport function aiSiteStartAnswersFromClientBuild(intake: ClientBuildIntake): AiSiteStartAnswers {\n const details = aiSiteDetailsOf({\n phone: intake.phone,\n email: intake.email,\n serviceArea: clientBuildServiceArea(intake.towns),\n hours: clientBuildHours(intake.hours),\n })\n return {\n ...AI_SITE_START_ANSWERS,\n siteType: bounded(intake.whatTheyDo, AI_SITE_INPUT_MAX_CHARS),\n // The site exists already and the intake answered for it: what the\n // business does picks its style, as \"Pick for me\" does, and staff change\n // it on the review like any answer.\n ...aiSiteStartStyleAnswer(SITE_STYLE_AUTO),\n phone: details.phone,\n email: details.email,\n serviceArea: details.serviceArea,\n hours: details.hours,\n }\n}\n\n/**\n * The per-site inputs the intake fills, which the guided start's own\n * questions leave empty: the business's name for the header and footer, and\n * the towns it serves as its place.\n *\n * The towns are the place only while no address is given. The Entity reads\n * `city` as the address's own locality wherever there is a street or a\n * postal code (`aiSiteEntity`), so once the answers carry either, `city` is\n * the city the Details step was given with that address, never the towns\n * (AGL-3995). The intake asks no address, so today that is the Details step's\n * own, typed on the review; the towns still reach the site as the areas it\n * serves.\n */\nexport function aiSiteStartClientInputs(\n intake: ClientBuildIntake,\n answers?: Pick<AiSiteStartAnswers, 'street' | 'postalCode' | 'city'> | null,\n): Pick<AiSiteJobInputs, 'businessName' | 'city'> {\n const addressed = Boolean(answers?.street.trim() || answers?.postalCode.trim())\n return {\n businessName: bounded(intake.businessName, AI_SITE_INPUT_MAX_CHARS),\n city: bounded(addressed ? (answers?.city ?? '') : intake.towns, AI_SITE_INPUT_MAX_CHARS),\n }\n}\n\n/**\n * The intake as sentences added to the brief: how to reach the business and\n * when it is open, which the site should say where a visitor looks for them,\n * and the owner's own words, quoted, which the copy should sound like. Empty\n * answers say nothing.\n */\nexport function aiSiteStartClientBrief(intake: ClientBuildIntake): string {\n const name = intake.businessName.trim()\n const towns = intake.towns.trim()\n const phone = intake.phone.trim()\n const email = intake.email.trim()\n const hours = intake.hours.trim()\n const words = intake.ownerWords.trim().replace(/\\s+/g, ' ')\n const sentences: string[] = []\n if (name) sentences.push(`The business is called ${name}.`)\n if (towns) sentences.push(`It serves ${towns}.`)\n const contact = [phone ? `call ${phone}` : '', email ? `email ${email}` : ''].filter(Boolean)\n if (contact.length) {\n sentences.push(`Visitors reach it to ${contact.join(' or ')}; say so wherever the site tells them how to get in touch.`)\n }\n if (hours) sentences.push(`Its hours are ${hours}.`)\n if (words) sentences.push(`In the owner's own words: \"${words}\" Write the copy so it sounds like them.`)\n return sentences.join(' ')\n}\n\n/**\n * What the review says the client build adds beyond its own rows, so staff\n * see the intake is used without it being asked again: the business's name\n * and the owner's own words, which no row shows. The phone, email, towns and\n * hours are the review's Details rows already (AGL-3995), so the note does\n * not say them twice: \"Also from the client's details: Harbor Plumbing and\n * the owner's own words.\"\n */\nexport function aiSiteStartClientNote(intake: ClientBuildIntake): string {\n const parts = [intake.businessName.trim(), intake.ownerWords.trim() ? \"the owner's own words\" : ''].filter(Boolean)\n if (!parts.length) return 'Built from the client’s details.'\n return `Also from the client’s details: ${parts.join(' and ')}.`\n}\n"],"names":["SITE_STYLE_AUTO","weeklyHoursFromText","weeklyHoursToText","AI_SITE_DETAIL_KEYS","AI_SITE_NO_DETAILS","aiSiteDetailProblem","aiSiteDetailsOf","aiSiteFontPairing","aiSiteKind","aiSiteKindFor","AI_SITE_INSPIRATION_INPUT","aiSiteInspirationInput","aiSiteInspirationLimit","aiSiteInspirationRefusal","aiSiteInspirationUrl","AI_SITE_INPUT_MAX_CHARS","AI_SITE_SUBMISSIONS","aiSitePagesBand","AI_SITE_STARTER_LOOK_INPUT","aiSiteStarterLookFromInput","aiSiteStarterLookInput","aiSiteStarterLookLine","aiSiteStarterLookOf","AI_SITE_STARTER_LOOK_MAX_CHARS","AI_SITE_START_EXAMPLES","id","label","category","blurb","AI_SITE_START_TYPES","AI_SITE_START_ANSWERS","siteType","audience","example","style","kind","pages","submissions","welcomeEmail","city","brand","AI_SITE_START_STYLE_REQUIRED","AI_SITE_START_EXTRA_KEYS","aiSiteStartExtraProblem","key","value","trim","length","code","message","aiSiteStartExtrasGiven","answers","filter","aiSiteStartStyleAnswer","aiSiteStartKind","aiSiteStartExample","find","entry","aiSiteStartRefusal","options","band","freeTaste","Number","isInteger","min","max","includes","problem","aiSiteStartInspirationRefusal","aiSiteStartInspirationTyped","inspiration","map","Boolean","typed","some","aiSiteStartBrief","sentences","push","toLowerCase","join","aiSiteStartInputs","details","starterLook","aiSiteStartHeldStarterLook","businessType","starter","siteKind","businessName","AI_SITE_START_INPUT_KEYS","aiSiteStartInputsOf","inputs","kept","Object","keys","aiSiteStartAnswersFromInputs","text","Math","round","fromEntries","split","slice","look","STARTER_BRAND_HEX","isAnswersRecord","Array","isArray","aiSiteStartAnswersFromStarter","colors","primary","brief","fonts","bounded","test","held","aiSiteStartStarterLookLine","trimmed","replace","cut","space","lastIndexOf","TWELVE_HOUR_TIME","clientBuildHours","hours","lines","time","hour","minutes","half","h","clock","String","padStart","week","day","clientBuildServiceArea","towns","town","aiSiteStartAnswersFromClientBuild","intake","phone","email","serviceArea","whatTheyDo","aiSiteStartClientInputs","addressed","street","postalCode","aiSiteStartClientBrief","name","words","ownerWords","contact","aiSiteStartClientNote","parts"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,eAAe,QAAQ,qCAAoC;AACpE,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,0CAAyC;AAChG,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,mBAAmB,EACnBC,eAAe,QAGV,uBAAmB;AAC1B,S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AEA,OAAO,GAAG;QAAIC,QAAQ,CAAC,MAAM,EAAEA,OAAO,GAAG;KAAG,CAACxF,MAAM,CAACoB;IACrF,IAAI+E,QAAQxG,MAAM,EAAE;QAClB6B,UAAUC,IAAI,CAAC,CAAC,qBAAqB,EAAE0E,QAAQxE,IAAI,CAAC,QAAQ,0DAA0D,CAAC;IACzH;IACA,IAAI2C,OAAO9C,UAAUC,IAAI,CAAC,CAAC,cAAc,EAAE6C,MAAM,CAAC,CAAC;IACnD,IAAI2B,OAAOzE,UAAUC,IAAI,CAAC,CAAC,2BAA2B,EAAEwE,MAAM,wCAAwC,CAAC;IACvG,OAAOzE,UAAUG,IAAI,CAAC;AACxB;AAEA;;;;;;;CAOC,GACD,OAAO,SAASyE,sBAAsBd,MAAyB;IAC7D,MAAMe,QAAQ;QAACf,OAAOnD,YAAY,CAACzC,IAAI;QAAI4F,OAAOY,UAAU,CAACxG,IAAI,KAAK,0BAA0B;KAAG,CAACM,MAAM,CAACoB;IAC3G,IAAI,CAACiF,MAAM1G,MAAM,EAAE,OAAO;IAC1B,OAAO,CAAC,gCAAgC,EAAE0G,MAAM1E,IAAI,CAAC,SAAS,CAAC,CAAC;AAClE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 AiSiteBase, type AiSiteButtons, type AiSiteCorners, type AiSiteGround } from './ai-site-kinds';
|
|
18
|
+
/**
|
|
19
|
+
* An AI starter's look (AGL-4049): the built-in base theme, font pairing and
|
|
20
|
+
* finer style tokens its listing promises, carried from "Choose your starter"
|
|
21
|
+
* to the look unit, which keeps each one as it keeps what the sites a person
|
|
22
|
+
* likes pin (`AiSiteLookPins`).
|
|
23
|
+
*
|
|
24
|
+
* AI starters are the built-in shape only: a base, a pairing and tokens over
|
|
25
|
+
* it, with the brand color as the start's own brand answer. A starter that
|
|
26
|
+
* carries a full theme of its own is a base starter, which starts no job.
|
|
27
|
+
*
|
|
28
|
+
* Pure, and small: the guided start, the create door and the look unit all
|
|
29
|
+
* read it, and the console does not load the look's theme builder to do so.
|
|
30
|
+
*/
|
|
31
|
+
/** The job input the look travels in, as text: the door admits scalars only. */
|
|
32
|
+
export declare const AI_SITE_STARTER_LOOK_INPUT = "starterLook";
|
|
33
|
+
/** The longest the input may be. A whole look is under 120 characters. */
|
|
34
|
+
export declare const AI_SITE_STARTER_LOOK_MAX_CHARS = 400;
|
|
35
|
+
/** What an AI starter's look may say, every part optional. */
|
|
36
|
+
export interface AiSiteStarterLook {
|
|
37
|
+
base?: AiSiteBase;
|
|
38
|
+
/** A font pairing, by its `SITE_FONT_PAIRINGS` id. */
|
|
39
|
+
fonts?: string;
|
|
40
|
+
/** The brand hue, a whole number of degrees from 0 to 359. */
|
|
41
|
+
hue?: number;
|
|
42
|
+
ground?: AiSiteGround;
|
|
43
|
+
corners?: AiSiteCorners;
|
|
44
|
+
buttons?: AiSiteButtons;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A look, read strictly: each part kept only when it is exactly a value of
|
|
48
|
+
* its vocabulary (a base, a pairing, a ground, corners or buttons this
|
|
49
|
+
* deployment knows, a whole hue from 0 to 359), with nothing coerced and
|
|
50
|
+
* every other key left out. `null` when no part is left.
|
|
51
|
+
*/
|
|
52
|
+
export declare function aiSiteStarterLookOf(raw: unknown): AiSiteStarterLook | null;
|
|
53
|
+
/** A look as the job input carries it. */
|
|
54
|
+
export declare function aiSiteStarterLookInput(look: AiSiteStarterLook): string;
|
|
55
|
+
/**
|
|
56
|
+
* The look a job input carries, read strictly: text within
|
|
57
|
+
* {@link AI_SITE_STARTER_LOOK_MAX_CHARS} holding a look
|
|
58
|
+
* ({@link aiSiteStarterLookOf}); anything else is none.
|
|
59
|
+
*/
|
|
60
|
+
export declare function aiSiteStarterLookFromInput(value: unknown): AiSiteStarterLook | null;
|
|
61
|
+
/** Why the door refuses a site job's starter look; `null` when it admits it. Its parts are the look unit's to read. */
|
|
62
|
+
export declare function aiSiteStarterLookRefusal(inputs: Readonly<Record<string, unknown>> | null | undefined): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* What a look is set in, in the words the Style card and the review say it:
|
|
65
|
+
* "Set in Bootstrap with Fraunces and Inter; pick another style to change
|
|
66
|
+
* it." The base by its theme's name, the pairing by its families. `null`
|
|
67
|
+
* for a look that names neither.
|
|
68
|
+
*/
|
|
69
|
+
export declare function aiSiteStarterLookLine(look: AiSiteStarterLook | null | undefined): string | null;
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
*/ import { SITE_THEME_BASE_NAMES } from "@aglyn/aglyn/app-utils/site-starter";
|
|
17
|
+
import { AI_SITE_BASES, AI_SITE_BUTTONS, AI_SITE_CORNERS, AI_SITE_GROUNDS, aiSiteFontPairing } from "./ai-site-kinds.js";
|
|
18
|
+
/**
|
|
19
|
+
* An AI starter's look (AGL-4049): the built-in base theme, font pairing and
|
|
20
|
+
* finer style tokens its listing promises, carried from "Choose your starter"
|
|
21
|
+
* to the look unit, which keeps each one as it keeps what the sites a person
|
|
22
|
+
* likes pin (`AiSiteLookPins`).
|
|
23
|
+
*
|
|
24
|
+
* AI starters are the built-in shape only: a base, a pairing and tokens over
|
|
25
|
+
* it, with the brand color as the start's own brand answer. A starter that
|
|
26
|
+
* carries a full theme of its own is a base starter, which starts no job.
|
|
27
|
+
*
|
|
28
|
+
* Pure, and small: the guided start, the create door and the look unit all
|
|
29
|
+
* read it, and the console does not load the look's theme builder to do so.
|
|
30
|
+
*/ /** The job input the look travels in, as text: the door admits scalars only. */ export const AI_SITE_STARTER_LOOK_INPUT = 'starterLook';
|
|
31
|
+
/** The longest the input may be. A whole look is under 120 characters. */ export const AI_SITE_STARTER_LOOK_MAX_CHARS = 400;
|
|
32
|
+
const isRecord = (value)=>!!value && typeof value === 'object' && !Array.isArray(value);
|
|
33
|
+
const oneOf = (value, values)=>typeof value === 'string' && values.includes(value) ? value : undefined;
|
|
34
|
+
/**
|
|
35
|
+
* A look, read strictly: each part kept only when it is exactly a value of
|
|
36
|
+
* its vocabulary (a base, a pairing, a ground, corners or buttons this
|
|
37
|
+
* deployment knows, a whole hue from 0 to 359), with nothing coerced and
|
|
38
|
+
* every other key left out. `null` when no part is left.
|
|
39
|
+
*/ export function aiSiteStarterLookOf(raw) {
|
|
40
|
+
if (!isRecord(raw)) return null;
|
|
41
|
+
const look = {};
|
|
42
|
+
const base = oneOf(raw['base'], AI_SITE_BASES);
|
|
43
|
+
if (base) look.base = base;
|
|
44
|
+
if (aiSiteFontPairing(raw['fonts'])) look.fonts = raw['fonts'];
|
|
45
|
+
const hue = raw['hue'];
|
|
46
|
+
if (typeof hue === 'number' && Number.isInteger(hue) && hue >= 0 && hue < 360) look.hue = hue;
|
|
47
|
+
const ground = oneOf(raw['ground'], AI_SITE_GROUNDS);
|
|
48
|
+
if (ground) look.ground = ground;
|
|
49
|
+
const corners = oneOf(raw['corners'], AI_SITE_CORNERS);
|
|
50
|
+
if (corners) look.corners = corners;
|
|
51
|
+
const buttons = oneOf(raw['buttons'], AI_SITE_BUTTONS);
|
|
52
|
+
if (buttons) look.buttons = buttons;
|
|
53
|
+
return Object.keys(look).length ? look : null;
|
|
54
|
+
}
|
|
55
|
+
/** A look as the job input carries it. */ export function aiSiteStarterLookInput(look) {
|
|
56
|
+
var _aiSiteStarterLookOf;
|
|
57
|
+
return JSON.stringify((_aiSiteStarterLookOf = aiSiteStarterLookOf(look)) != null ? _aiSiteStarterLookOf : {});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The look a job input carries, read strictly: text within
|
|
61
|
+
* {@link AI_SITE_STARTER_LOOK_MAX_CHARS} holding a look
|
|
62
|
+
* ({@link aiSiteStarterLookOf}); anything else is none.
|
|
63
|
+
*/ export function aiSiteStarterLookFromInput(value) {
|
|
64
|
+
if (typeof value !== 'string' || !value || value.length > AI_SITE_STARTER_LOOK_MAX_CHARS) return null;
|
|
65
|
+
try {
|
|
66
|
+
return aiSiteStarterLookOf(JSON.parse(value));
|
|
67
|
+
} catch (unused) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Why the door refuses a site job's starter look; `null` when it admits it. Its parts are the look unit's to read. */ export function aiSiteStarterLookRefusal(inputs) {
|
|
72
|
+
const value = inputs == null ? void 0 : inputs[AI_SITE_STARTER_LOOK_INPUT];
|
|
73
|
+
if (value === undefined || value === null || value === '') return null;
|
|
74
|
+
return typeof value === 'string' && value.length <= AI_SITE_STARTER_LOOK_MAX_CHARS ? null : `${AI_SITE_STARTER_LOOK_INPUT} must be text under ${AI_SITE_STARTER_LOOK_MAX_CHARS} characters`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What a look is set in, in the words the Style card and the review say it:
|
|
78
|
+
* "Set in Bootstrap with Fraunces and Inter; pick another style to change
|
|
79
|
+
* it." The base by its theme's name, the pairing by its families. `null`
|
|
80
|
+
* for a look that names neither.
|
|
81
|
+
*/ export function aiSiteStarterLookLine(look) {
|
|
82
|
+
if (!look) return null;
|
|
83
|
+
const base = look.base ? look.base === 'starter' ? 'the starter theme' : SITE_THEME_BASE_NAMES[look.base] : null;
|
|
84
|
+
const pairing = aiSiteFontPairing(look.fonts);
|
|
85
|
+
const type = pairing ? pairing.heading.family === pairing.body.family ? pairing.heading.family : `${pairing.heading.family} and ${pairing.body.family}` : null;
|
|
86
|
+
const set = base && type ? `${base} with ${type}` : base != null ? base : type;
|
|
87
|
+
return set ? `Set in ${set}; pick another style to change it.` : null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=ai-site-starter-look.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-starter-look.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 { SITE_THEME_BASE_NAMES } from '@aglyn/aglyn/app-utils/site-starter'\nimport {\n AI_SITE_BASES,\n AI_SITE_BUTTONS,\n AI_SITE_CORNERS,\n AI_SITE_GROUNDS,\n aiSiteFontPairing,\n type AiSiteBase,\n type AiSiteButtons,\n type AiSiteCorners,\n type AiSiteGround,\n} from './ai-site-kinds'\n\n/**\n * An AI starter's look (AGL-4049): the built-in base theme, font pairing and\n * finer style tokens its listing promises, carried from \"Choose your starter\"\n * to the look unit, which keeps each one as it keeps what the sites a person\n * likes pin (`AiSiteLookPins`).\n *\n * AI starters are the built-in shape only: a base, a pairing and tokens over\n * it, with the brand color as the start's own brand answer. A starter that\n * carries a full theme of its own is a base starter, which starts no job.\n *\n * Pure, and small: the guided start, the create door and the look unit all\n * read it, and the console does not load the look's theme builder to do so.\n */\n\n/** The job input the look travels in, as text: the door admits scalars only. */\nexport const AI_SITE_STARTER_LOOK_INPUT = 'starterLook'\n\n/** The longest the input may be. A whole look is under 120 characters. */\nexport const AI_SITE_STARTER_LOOK_MAX_CHARS = 400\n\n/** What an AI starter's look may say, every part optional. */\nexport interface AiSiteStarterLook {\n base?: AiSiteBase\n /** A font pairing, by its `SITE_FONT_PAIRINGS` id. */\n fonts?: string\n /** The brand hue, a whole number of degrees from 0 to 359. */\n hue?: number\n ground?: AiSiteGround\n corners?: AiSiteCorners\n buttons?: AiSiteButtons\n}\n\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>\n !!value && typeof value === 'object' && !Array.isArray(value)\n\nconst oneOf = <T extends string>(value: unknown, values: readonly T[]): T | undefined =>\n typeof value === 'string' && (values as readonly string[]).includes(value) ? (value as T) : undefined\n\n/**\n * A look, read strictly: each part kept only when it is exactly a value of\n * its vocabulary (a base, a pairing, a ground, corners or buttons this\n * deployment knows, a whole hue from 0 to 359), with nothing coerced and\n * every other key left out. `null` when no part is left.\n */\nexport function aiSiteStarterLookOf(raw: unknown): AiSiteStarterLook | null {\n if (!isRecord(raw)) return null\n const look: AiSiteStarterLook = {}\n const base = oneOf(raw['base'], AI_SITE_BASES)\n if (base) look.base = base\n if (aiSiteFontPairing(raw['fonts'])) look.fonts = raw['fonts'] as string\n const hue = raw['hue']\n if (typeof hue === 'number' && Number.isInteger(hue) && hue >= 0 && hue < 360) look.hue = hue\n const ground = oneOf(raw['ground'], AI_SITE_GROUNDS)\n if (ground) look.ground = ground\n const corners = oneOf(raw['corners'], AI_SITE_CORNERS)\n if (corners) look.corners = corners\n const buttons = oneOf(raw['buttons'], AI_SITE_BUTTONS)\n if (buttons) look.buttons = buttons\n return Object.keys(look).length ? look : null\n}\n\n/** A look as the job input carries it. */\nexport function aiSiteStarterLookInput(look: AiSiteStarterLook): string {\n return JSON.stringify(aiSiteStarterLookOf(look) ?? {})\n}\n\n/**\n * The look a job input carries, read strictly: text within\n * {@link AI_SITE_STARTER_LOOK_MAX_CHARS} holding a look\n * ({@link aiSiteStarterLookOf}); anything else is none.\n */\nexport function aiSiteStarterLookFromInput(value: unknown): AiSiteStarterLook | null {\n if (typeof value !== 'string' || !value || value.length > AI_SITE_STARTER_LOOK_MAX_CHARS) return null\n try {\n return aiSiteStarterLookOf(JSON.parse(value))\n } catch {\n return null\n }\n}\n\n/** Why the door refuses a site job's starter look; `null` when it admits it. Its parts are the look unit's to read. */\nexport function aiSiteStarterLookRefusal(inputs: Readonly<Record<string, unknown>> | null | undefined): string | null {\n const value = inputs?.[AI_SITE_STARTER_LOOK_INPUT]\n if (value === undefined || value === null || value === '') return null\n return typeof value === 'string' && value.length <= AI_SITE_STARTER_LOOK_MAX_CHARS\n ? null\n : `${AI_SITE_STARTER_LOOK_INPUT} must be text under ${AI_SITE_STARTER_LOOK_MAX_CHARS} characters`\n}\n\n/**\n * What a look is set in, in the words the Style card and the review say it:\n * \"Set in Bootstrap with Fraunces and Inter; pick another style to change\n * it.\" The base by its theme's name, the pairing by its families. `null`\n * for a look that names neither.\n */\nexport function aiSiteStarterLookLine(look: AiSiteStarterLook | null | undefined): string | null {\n if (!look) return null\n const base = look.base ? (look.base === 'starter' ? 'the starter theme' : SITE_THEME_BASE_NAMES[look.base]) : null\n const pairing = aiSiteFontPairing(look.fonts)\n const type = pairing\n ? pairing.heading.family === pairing.body.family\n ? pairing.heading.family\n : `${pairing.heading.family} and ${pairing.body.family}`\n : null\n const set = base && type ? `${base} with ${type}` : (base ?? type)\n return set ? `Set in ${set}; pick another style to change it.` : null\n}\n"],"names":["SITE_THEME_BASE_NAMES","AI_SITE_BASES","AI_SITE_BUTTONS","AI_SITE_CORNERS","AI_SITE_GROUNDS","aiSiteFontPairing","AI_SITE_STARTER_LOOK_INPUT","AI_SITE_STARTER_LOOK_MAX_CHARS","isRecord","value","Array","isArray","oneOf","values","includes","undefined","aiSiteStarterLookOf","raw","look","base","fonts","hue","Number","isInteger","ground","corners","buttons","Object","keys","length","aiSiteStarterLookInput","JSON","stringify","aiSiteStarterLookFromInput","parse","aiSiteStarterLookRefusal","inputs","aiSiteStarterLookLine","pairing","type","heading","family","body","set"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,qBAAqB,QAAQ,sCAAqC;AAC3E,SACEC,aAAa,EACbC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,iBAAiB,QAKZ,qBAAiB;AAExB;;;;;;;;;;;;CAYC,GAED,8EAA8E,GAC9E,OAAO,MAAMC,6BAA6B,cAAa;AAEvD,wEAAwE,GACxE,OAAO,MAAMC,iCAAiC,IAAG;AAcjD,MAAMC,WAAW,CAACC,QAChB,CAAC,CAACA,SAAS,OAAOA,UAAU,YAAY,CAACC,MAAMC,OAAO,CAACF;AAEzD,MAAMG,QAAQ,CAAmBH,OAAgBI,SAC/C,OAAOJ,UAAU,YAAY,AAACI,OAA6BC,QAAQ,CAACL,SAAUA,QAAcM;AAE9F;;;;;CAKC,GACD,OAAO,SAASC,oBAAoBC,GAAY;IAC9C,IAAI,CAACT,SAASS,MAAM,OAAO;IAC3B,MAAMC,OAA0B,CAAC;IACjC,MAAMC,OAAOP,MAAMK,GAAG,CAAC,OAAO,EAAEhB;IAChC,IAAIkB,MAAMD,KAAKC,IAAI,GAAGA;IACtB,IAAId,kBAAkBY,GAAG,CAAC,QAAQ,GAAGC,KAAKE,KAAK,GAAGH,GAAG,CAAC,QAAQ;IAC9D,MAAMI,M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