@vectoriox/iox-ui 5.62.0 → 5.63.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/fesm2022/vectoriox-iox-ui-generation-core.mjs +4 -2
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +54 -16
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/harness-core/index.d.ts +10 -3
- package/package.json +1 -1
- package/src/generation-core/plan-wire.ts +4 -2
- package/src/harness-core/site-analysis.ts +43 -8
- package/src/harness-core/site-reading.ts +16 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MOOD_IDS, MOOD_LABELS, STYLE_PRESETS, flavorPackById, parseFontFamilies, SPEC_AXES, parseHexColor, rgbToOklab, presetChoices, toHexColor, stylePresetById, resolveTokenValues, designTokenRows, wcagContrastRatio, auditDesignContrast } from '@vectoriox/iox-ui/design-core';
|
|
2
|
-
import { shapeKeys, requiredShapeKeys, PathIssueCollector, isPlainObject, pathAt, FACT_KEYS, jsonText, jsonOneOf, jsonListOf, jsonShapedObject,
|
|
2
|
+
import { shapeKeys, requiredShapeKeys, PathIssueCollector, isPlainObject, pathAt, FACT_KEYS, jsonText, jsonOneOf, jsonListOf, jsonShapedObject, describeShapeKey, SPEC_SITE_LIBRARY, patternById, SITE_FACT_LABELS, HEBREW_PREFIXES, SITE_TEMPLATES, STUDIO_TEMPLATE, jsonInteger } from '@vectoriox/iox-ui/generation-core';
|
|
3
3
|
|
|
4
4
|
// GENERATED from iox-ai-guidance flavor-spec.v1.json — do not edit; re-run scripts/gen-flavor-spec.mjs
|
|
5
5
|
// (npm run gen:flavor-spec). The JSON is itself generated by iox-ai-guidance
|
|
@@ -3912,18 +3912,24 @@ const oneOf = jsonOneOf;
|
|
|
3912
3912
|
const listOf = jsonListOf;
|
|
3913
3913
|
/** An object of `shape`: exactly its keys, its required ones required, each described by the table. */
|
|
3914
3914
|
const shaped = (shape, properties) => jsonShapedObject(SHAPE[shape], properties, shape);
|
|
3915
|
-
/**
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3915
|
+
/** A stated fact on the wire: which fact, then the document's `factRead` keys in the table's own words. */
|
|
3916
|
+
const FACT_LINE_SHAPE = {
|
|
3917
|
+
fact: `${FACT_KEYS.map(k => `'${k}'`).join(' | ')} — which fact (site.facts), each at most once`,
|
|
3918
|
+
...SHAPE['factRead'],
|
|
3919
|
+
};
|
|
3920
|
+
/** The analysis as the wire carries it: `facts` a list of fact lines, described in the table's words. */
|
|
3921
|
+
const ANALYSIS_WIRE_SHAPE = {
|
|
3922
|
+
...SHAPE['analysis'],
|
|
3923
|
+
facts: `factLine[] — ${describeShapeKey(SHAPE['analysis'], 'facts').replace(/^\{ \[fact\]: factRead \} — /, '')}`,
|
|
3924
|
+
};
|
|
3919
3925
|
function siteAnalysisJsonSchema() {
|
|
3920
|
-
const
|
|
3921
|
-
return
|
|
3926
|
+
const factLine = jsonShapedObject(FACT_LINE_SHAPE, { fact: oneOf(FACT_KEYS), value: text(), quote: text() }, 'factLine');
|
|
3927
|
+
return jsonShapedObject(ANALYSIS_WIRE_SHAPE, {
|
|
3922
3928
|
businessType: oneOf(BUSINESS_TYPE_IDS),
|
|
3923
3929
|
alternatives: listOf(oneOf(BUSINESS_TYPE_IDS)),
|
|
3924
3930
|
business: shaped('business', { name: text(), audience: text() }),
|
|
3925
3931
|
needs: listOf(shaped('need', { id: oneOf(NEED_IDS), from: oneOf(Object.values(NeedSource)), name: text() })),
|
|
3926
|
-
facts:
|
|
3932
|
+
facts: listOf(factLine),
|
|
3927
3933
|
missingFacts: listOf(oneOf(FACT_KEYS)),
|
|
3928
3934
|
voice: shaped('voice', {
|
|
3929
3935
|
tone: text(),
|
|
@@ -3935,7 +3941,32 @@ function siteAnalysisJsonSchema() {
|
|
|
3935
3941
|
avoid: listOf(oneOf(USER_AVOID_IDS)),
|
|
3936
3942
|
hero: shaped('hero', { headline: text(), lead: text() }),
|
|
3937
3943
|
locale: oneOf(Object.values(AnalysisLocale)),
|
|
3944
|
+
}, 'analysis');
|
|
3945
|
+
}
|
|
3946
|
+
/** A model's analysis (the wire) → the document, and the faults only the wire can have (a fact stated twice). Never repairs. */
|
|
3947
|
+
function analysisFromWire(wire) {
|
|
3948
|
+
if (!isPlainObject(wire))
|
|
3949
|
+
return { analysis: wire, issues: [] };
|
|
3950
|
+
if (!Array.isArray(wire['facts']))
|
|
3951
|
+
return { analysis: wire, issues: [{ code: AnalysisIssueCode.Shape, path: 'facts', message: 'must be a list of { fact, value, quote }' }] };
|
|
3952
|
+
const facts = {};
|
|
3953
|
+
const issues = [];
|
|
3954
|
+
wire['facts'].forEach((line, i) => {
|
|
3955
|
+
if (!isPlainObject(line) || typeof line['fact'] !== 'string') {
|
|
3956
|
+
issues.push({ code: AnalysisIssueCode.Shape, path: `facts[${i}]`, message: 'must be { fact, value, quote }' });
|
|
3957
|
+
return;
|
|
3958
|
+
}
|
|
3959
|
+
const { fact, ...read } = line;
|
|
3960
|
+
if (fact in facts)
|
|
3961
|
+
issues.push({ code: AnalysisIssueCode.Duplicate, path: `facts[${i}].fact`, message: `"${fact}" is stated twice` });
|
|
3962
|
+
else
|
|
3963
|
+
facts[fact] = read;
|
|
3938
3964
|
});
|
|
3965
|
+
return { analysis: { ...wire, facts }, issues };
|
|
3966
|
+
}
|
|
3967
|
+
/** The document → the wire (what a model writes). */
|
|
3968
|
+
function analysisToWire(analysis) {
|
|
3969
|
+
return { ...analysis, facts: Object.entries(analysis.facts).map(([fact, read]) => ({ fact, ...read })) };
|
|
3939
3970
|
}
|
|
3940
3971
|
|
|
3941
3972
|
var PresetFit;
|
|
@@ -4665,25 +4696,32 @@ function validatePictures(c, raw, count) {
|
|
|
4665
4696
|
c.oneOf(style, 'shape', Object.keys(SPEC_AXES.shapes), 'pictures.style');
|
|
4666
4697
|
c.oneOf(style, 'density', Object.keys(SPEC_AXES.densities), 'pictures.style');
|
|
4667
4698
|
}
|
|
4699
|
+
/** The analysis on the wire, judged as the document it becomes: the wire's own faults, then `validateSiteAnalysis`'s. */
|
|
4700
|
+
function analysisIssues(wire, prompt) {
|
|
4701
|
+
const read = analysisFromWire(wire);
|
|
4702
|
+
return [...read.issues, ...validateSiteAnalysis(read.analysis, { prompt }).issues];
|
|
4703
|
+
}
|
|
4668
4704
|
/** The reading's gate: the analysis by `validateSiteAnalysis` (paths under `analysis.` when pictures came too), the pictures by `READING_SHAPE`. */
|
|
4669
4705
|
function validateSiteReading(value, ctx) {
|
|
4670
|
-
if (ctx.pictureCount <= 0)
|
|
4671
|
-
|
|
4706
|
+
if (ctx.pictureCount <= 0) {
|
|
4707
|
+
const issues = analysisIssues(value, ctx.prompt);
|
|
4708
|
+
return { valid: issues.length === 0, issues };
|
|
4709
|
+
}
|
|
4672
4710
|
const c = new Collector();
|
|
4673
4711
|
const reading = c.object(value, 'reading', '');
|
|
4674
4712
|
if (!reading)
|
|
4675
4713
|
return { valid: false, issues: c.issues };
|
|
4676
|
-
const
|
|
4677
|
-
const issues = analysis.issues.map(i => ({ ...i, path: pathAt('analysis', i.path) }));
|
|
4714
|
+
const issues = analysisIssues(reading['analysis'], ctx.prompt).map(i => ({ ...i, path: pathAt('analysis', i.path) }));
|
|
4678
4715
|
validatePictures(c, reading['pictures'], ctx.pictureCount);
|
|
4679
4716
|
issues.push(...c.issues);
|
|
4680
4717
|
return { valid: issues.length === 0, issues };
|
|
4681
4718
|
}
|
|
4682
|
-
/** A valid reading's answer → `SiteReading` (the analysis alone answers `{ analysis }
|
|
4719
|
+
/** A valid reading's answer → `SiteReading` (the analysis alone answers `{ analysis }`; the facts made a map again). */
|
|
4683
4720
|
function decodeSiteReading(value, pictureCount) {
|
|
4684
4721
|
if (pictureCount <= 0)
|
|
4685
|
-
return { analysis: value };
|
|
4686
|
-
|
|
4722
|
+
return { analysis: analysisFromWire(value).analysis };
|
|
4723
|
+
const reading = value;
|
|
4724
|
+
return { ...reading, analysis: analysisFromWire(reading.analysis).analysis };
|
|
4687
4725
|
}
|
|
4688
4726
|
/** The liked pictures as a StyleRead: their palettes measured together, what the model saw of them. */
|
|
4689
4727
|
function pictureStyleRead(pictures, style) {
|
|
@@ -4842,5 +4880,5 @@ function startingDesign(input, read = null) {
|
|
|
4842
4880
|
* Generated bundle index. Do not edit.
|
|
4843
4881
|
*/
|
|
4844
4882
|
|
|
4845
|
-
export { ANIMATE_ADVICE_STEPS, AnalysisIssueCode, AnalysisLocale, AvoidCheck, BUSINESS_TYPES, BUSINESS_TYPE_IDS, BookingNeed, COPY_LENGTH_ORDER, CopyLength, GENERATION_LIMITS, HARNESS_SOURCE, LITTLE_MOVEMENT_AVOID, LITTLE_MOVEMENT_CAP, LintKind, MAX_ANALYSIS_MOODS, MAX_PIXEL_SAMPLES, MAX_READ_PICTURES, NEEDS, NEED_IDS, NeedSource, PALETTE_SIZE, PALETTE_THRESHOLDS, PictureRole, PlanChangeOutcome, PresetFit, RANK_WEIGHTS, READING_SHAPE, READ_ANIMATE, READ_WEIGHTS, RankReason, ReaderState, ReadingIssueCode, SITE_ANALYSIS_SCHEMA_NAME, SITE_READING_SCHEMA_NAME, SPEC_ANALYSIS_SHAPE, SPEC_BUSINESS_TYPES, SPEC_HARNESS_EXAMPLES, SPEC_HARNESS_SOURCE, SPEC_NEEDS, SPEC_STRUCTURES, SPEC_USER_AVOIDS, STRUCTURES, SiteReadRefusal, StyleReadGround, StyleReadHeadings, StyleReadMotion, StyleReadSourceKind, USER_AVOID_IDS, VoiceFormality, VoicePerson, addressesIn, analysisPromptContext, businessTypeById, calmerChoice, decodeSiteReading, inferNeeds, isLookRule, lintDesign, lookMatches, mapStyleRead, matchBusinessType, matchBusinessTypes, measurePalette, mergeStyleReads, motionAdvice, motionFor, normalizeAddress, oklchHue, paletteBrand, paletteGround, paletteSamples, pictureStyleRead, pixelSamples, presetDesign, presetHasSerifHeadings, presetLook, presetReason, rankStylePresets, rankWithReferences, readPalette, referenceSeed, seedPassesPreset, siteAnalysisJsonSchema, siteReadingJsonSchema, startingDesign, structureFor, userAvoidRule, validateSiteAnalysis, validateSiteReading, withoutAddress };
|
|
4883
|
+
export { ANIMATE_ADVICE_STEPS, AnalysisIssueCode, AnalysisLocale, AvoidCheck, BUSINESS_TYPES, BUSINESS_TYPE_IDS, BookingNeed, COPY_LENGTH_ORDER, CopyLength, GENERATION_LIMITS, HARNESS_SOURCE, LITTLE_MOVEMENT_AVOID, LITTLE_MOVEMENT_CAP, LintKind, MAX_ANALYSIS_MOODS, MAX_PIXEL_SAMPLES, MAX_READ_PICTURES, NEEDS, NEED_IDS, NeedSource, PALETTE_SIZE, PALETTE_THRESHOLDS, PictureRole, PlanChangeOutcome, PresetFit, RANK_WEIGHTS, READING_SHAPE, READ_ANIMATE, READ_WEIGHTS, RankReason, ReaderState, ReadingIssueCode, SITE_ANALYSIS_SCHEMA_NAME, SITE_READING_SCHEMA_NAME, SPEC_ANALYSIS_SHAPE, SPEC_BUSINESS_TYPES, SPEC_HARNESS_EXAMPLES, SPEC_HARNESS_SOURCE, SPEC_NEEDS, SPEC_STRUCTURES, SPEC_USER_AVOIDS, STRUCTURES, SiteReadRefusal, StyleReadGround, StyleReadHeadings, StyleReadMotion, StyleReadSourceKind, USER_AVOID_IDS, VoiceFormality, VoicePerson, addressesIn, analysisFromWire, analysisPromptContext, analysisToWire, businessTypeById, calmerChoice, decodeSiteReading, inferNeeds, isLookRule, lintDesign, lookMatches, mapStyleRead, matchBusinessType, matchBusinessTypes, measurePalette, mergeStyleReads, motionAdvice, motionFor, normalizeAddress, oklchHue, paletteBrand, paletteGround, paletteSamples, pictureStyleRead, pixelSamples, presetDesign, presetHasSerifHeadings, presetLook, presetReason, rankStylePresets, rankWithReferences, readPalette, referenceSeed, seedPassesPreset, siteAnalysisJsonSchema, siteReadingJsonSchema, startingDesign, structureFor, userAvoidRule, validateSiteAnalysis, validateSiteReading, withoutAddress };
|
|
4846
4884
|
//# sourceMappingURL=vectoriox-iox-ui-harness-core.mjs.map
|