@vectoriox/iox-ui 5.152.0 → 5.154.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.
@@ -1,4 +1,4 @@
1
- import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode, SectionInput, KeptReason } from '@vectoriox/iox-ui/generation-core';
1
+ import { AiStep, JsonSchema, PlanWordContext, AdjustAxis, AdjustKind, SerializedNode, SectionInput, KeptReason, AiFeature, WordsArea, PictureReview, AiTokenPrice, AiModelEntry, ArtDirection, AiEntitlementsView, AiRefusal } from '@vectoriox/iox-ui/generation-core';
2
2
  import { DesignChoices, DesignMode } from '@vectoriox/iox-ui/design-core';
3
3
 
4
4
  /**
@@ -1614,5 +1614,205 @@ declare function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>
1614
1614
  /** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
1615
1615
  declare const languageName: (locale: string, uiLang: string) => string;
1616
1616
 
1617
- export { AI_DRAFT_SOURCE, AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistHandOff, AssistIssueCode, AssistMemoryOutcome, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistRunStatus, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, LOOK_AXES, LOOK_AXIS_LABELS, LOOK_KEEP, LookAnswerKey, LookAxis, LookButtons, MAX_ASSIST_PHOTOS, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, MODE_LABELS, NEW_TARGET, NONE_TEXT, NeverWriteReason, OWNER_FILL_MAX_CHARS, PAGE_WORD_SLOTS, PHOTOS_PER_READ, PHOTO_GROUP_HANDLE_PREFIX, PageChangeOp, PagePartKind, PageSuggestionKind, PhotoAnswerKey, PhotoGrouping, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, ValueSource, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, aiDraftStamp, applyFieldEdits, applyLookEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeLookAnswers, decodePhotoDraftAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, draftFromPhotos, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, groupPhotos, isAiDraft, isEmptyFieldValue, isPlainRecord, isRunBusy, isSchemeEdit, isSectionEdit, isSessionOf, isSiteLookEdit, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookAxisValue, lookHex, lookJsonSchema, lookNames, memoryLine, namedLocale, ownerFillFields, ownerFillIssues, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, photoDraftJsonSchema, photoGroupBrief, photoGroupHandle, photoReadCount, photoSlots, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, styleJsonSchema, suggestPhotoType, summarizeItem, summarizeLook, summarizePage, summarizePhotos, surfacePermissions, surfaceSpec, surfaceUndoPermissions, takesPhotos, titleField, turnLocale, unknownHandles, validateRunRequest, validateTurnRequest, withOwnerFill, wordsJsonSchema };
1618
- export type { AiDraftStamp, AssistChange, AssistEdit, AssistField, AssistIssue, AssistMemoryLine, AssistModelChoice, AssistPhoto, AssistRoute, AssistRunRequest, AssistRunView, AssistSession, AssistTarget, AssistTurn, AssistTurnAccepted, AssistTurnProgress, AssistTurnRefusal, AssistTurnRequest, AssistWordContext, BaselineStyles, Brief, BriefRules, BriefValue, ContentControllerDef, ContentPropertyDef, ContentRecord, ContentTypeSchema, DraftValue, FieldChange, FieldEdit, FieldEditContext, FieldEditsOutcome, FieldsSchemaExtra, FieldsSchemaOptions, FieldsSchemas, HandleMap, HandleResolution, HandleTarget, ItemAround, ItemBrief, ItemBriefContext, ItemBriefField, ItemFocus, ItemSuggestion, ItemSummary, KeptDraft, LookEditsOutcome, LookMap, LookSchemas, LookSummary, LookTarget, NeverWrite, NodeStyleEdit, PageAround, PageBrief, PageBriefContext, PageChange, PageEdit, PageEditContext, PageEditsOutcome, PageFocus, PageLook, PagePart, PageSectionSummary, PageSuggestion, PhotoBriefField, PhotoDraft, PhotoDraftAnswer, PhotoDraftContext, PhotoDraftOutcome, PhotoGroup, PhotoSlots, PhotosAround, PhotosBrief, PhotosBriefContext, PhotosFocus, SchemeEdit, SectionAdd, SectionChange, SectionEdit, SectionEditContext, SectionEditsOutcome, SectionMap, SectionMove, SectionRemove, SectionSwap, SectionTarget, SiteLookChange, SiteLookEdit, SizeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SummarizedPhotos, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
1617
+ /**
1618
+ * FILES BOX ▸ GENERATE — the vocabulary of AI Assist's surface S7 (ai-assist-plan §2 "S7", A-D14 · A-D15 · A-D16), the
1619
+ * pictures half. ONE spelling for the Files box (iox-cms-client), the route that makes the pictures (iox-cms) and the
1620
+ * proof: what may be asked, how the asked words become the prompt, what it costs before the button, when it is refused
1621
+ * before any call, and what a made picture is afterwards.
1622
+ *
1623
+ * It adds NO generator: a picture is made by the M7 pipeline's own call and looked at by its own review
1624
+ * (`PictureReview`), under the same art-direction preamble (`artDirectionPreamble`). The two calls run as steps of
1625
+ * Assist's own (`GENERATE_STEPS` — `AiStep.AssistPicture` / `AssistPictureReview`, which `AI_STEP_RUNS_AS` the M7 steps'
1626
+ * models), so the Assist feature alone allows Generate and its ledger rows are Assist's. What differs
1627
+ * from a site build's pictures is the owner's part: THEY write the words, THEY choose how many, and every candidate made
1628
+ * is charged and KEPT — a review that says no marks the picture, it does not buy a second try (gateway rule 3, R-H12).
1629
+ */
1630
+ /** The two steps a press runs — Assist's own names for the M7 picture call and its review. */
1631
+ declare const GENERATE_STEPS: {
1632
+ readonly picture: AiStep.AssistPicture;
1633
+ readonly review: AiStep.AssistPictureReview;
1634
+ };
1635
+ declare enum GenerateKind {
1636
+ Photo = "photo",
1637
+ Video = "video"
1638
+ }
1639
+ /** Why a kind cannot be made yet — the Files box says it in words, never with a button that fails (R-H13). */
1640
+ declare enum GenerateUnavailable {
1641
+ /** No provider makes a video from a start picture yet (`generateVideo`, premium-sites SC6c). */
1642
+ NoProvider = "noProvider"
1643
+ }
1644
+ /** What each kind can do today. Video turns on here, in one place, the day a provider exists. */
1645
+ declare const GENERATE_KINDS: Readonly<Record<GenerateKind, {
1646
+ readonly available: boolean;
1647
+ readonly why?: GenerateUnavailable;
1648
+ }>>;
1649
+ /** How many candidates one press makes. */
1650
+ declare const GENERATE_COUNTS: ReadonlyArray<number>;
1651
+ declare const GENERATE_COUNT_DEFAULT = 4;
1652
+ /** The frames offered (each a frame the image model is asked for — `PICTURE_ASPECTS`), widest first. */
1653
+ declare const GENERATE_SHAPES: ReadonlyArray<string>;
1654
+ declare const GENERATE_SHAPE_DEFAULT = "4:3";
1655
+ declare const GENERATE_PROMPT_MIN = 3;
1656
+ declare const GENERATE_PROMPT_MAX = 600;
1657
+ /** The element that opened the box, as far as a picture cares: its shape, and the part of it words sit over. */
1658
+ interface GenerateSlot {
1659
+ /** Width / height of the slot. */
1660
+ readonly aspect?: number;
1661
+ readonly wordsArea?: WordsArea;
1662
+ }
1663
+ /** What the owner asks for — the body of the route, checked by `generateRequestIssues` on both sides. */
1664
+ interface GeneratePicturesRequest {
1665
+ readonly kind: `${GenerateKind}`;
1666
+ /** The owner's own words. */
1667
+ readonly prompt: string;
1668
+ readonly shape: string;
1669
+ readonly count: number;
1670
+ /** Wear the site's art direction ("Your look") — on unless the owner turned it off. */
1671
+ readonly look: boolean;
1672
+ /** A picture model of the vetted list; absent = the studio's model for the step (Settings ▸ AI ▸ Models, A-D14). */
1673
+ readonly model?: string;
1674
+ readonly slot?: GenerateSlot;
1675
+ }
1676
+ declare enum GenerateIssueCode {
1677
+ Shape = "shape",
1678
+ Kind = "kind",
1679
+ KindUnavailable = "kindUnavailable",
1680
+ Prompt = "prompt",
1681
+ PromptTooLong = "promptTooLong",
1682
+ Frame = "frame",
1683
+ Count = "count",
1684
+ Model = "model"
1685
+ }
1686
+ interface GenerateIssue {
1687
+ readonly code: GenerateIssueCode;
1688
+ readonly path: string;
1689
+ readonly message: string;
1690
+ }
1691
+ /** What is wrong with a value as a request to generate pictures — nothing is repaired, each fault has its path. */
1692
+ declare function generateRequestIssues(value: unknown): GenerateIssue[];
1693
+ /**
1694
+ * The offered frame nearest a slot ("fits the slot"): by the ratio of the two shapes, so 4:5 goes to 3:4 and never to
1695
+ * 1:1 by a hair. No slot, or one with no shape yet = the default.
1696
+ */
1697
+ declare function shapeForSlot(aspect: number | undefined | null): string;
1698
+ /**
1699
+ * The prompt a generated picture is asked with: the site's preamble VERBATIM when "Your look" is on (the same one a
1700
+ * site build's pictures get — one preamble per prompt), then the OWNER'S WORDS as written, the frame, and the part left
1701
+ * calm for words when the slot has words over it. Nothing else is added and nothing of the owner's is rewritten.
1702
+ */
1703
+ declare function generatePicturePrompt(request: Pick<GeneratePicturesRequest, 'prompt' | 'shape' | 'look' | 'slot'>, direction: ArtDirection | null | undefined): string;
1704
+ /** True when the owner's words ask for writing INSIDE the picture — the box says "put the words on the page". */
1705
+ declare function promptAsksForWords(prompt: string): boolean;
1706
+ /**
1707
+ * "Describe from the page": the words the box fills in for the element that opened it — the section's own words and
1708
+ * the kind of business, never the business's name (it would be drawn). No model is asked; empty when the page says
1709
+ * nothing.
1710
+ */
1711
+ declare function describeFromPage(context: {
1712
+ readonly business?: string;
1713
+ readonly words?: string;
1714
+ }): string;
1715
+ interface GenerateEstimate {
1716
+ readonly count: number;
1717
+ /** One picture, in credits. */
1718
+ readonly picture: number;
1719
+ /** One review of a picture, in credits. */
1720
+ readonly review: number;
1721
+ /** One candidate: a picture and its review. */
1722
+ readonly each: number;
1723
+ /** What the owner is shown, and the most the press may spend. */
1724
+ readonly total: number;
1725
+ }
1726
+ /**
1727
+ * The cost shown under the box (A-D15: the owner chooses the cost): every candidate is made once and looked at once.
1728
+ * Unlike a site build's pictures (`estimatePictures`) there is NO second try in it — a candidate the review says no to
1729
+ * is kept and marked, and the owner decides whether to press again.
1730
+ */
1731
+ declare function estimateGenerate(count: number, prices: {
1732
+ readonly image: AiTokenPrice;
1733
+ readonly review: AiTokenPrice;
1734
+ }): GenerateEstimate;
1735
+ /** A picture model the owner may choose, with what one candidate costs on it (the model button, A-D14). */
1736
+ interface GenerateModelChoice {
1737
+ readonly id: string;
1738
+ readonly label: string;
1739
+ /** The studio's default for the step — what "Auto" runs. */
1740
+ readonly recommended: boolean;
1741
+ /** Null when the list carries no price for it (the provider reports each call's cost). */
1742
+ readonly each: number | null;
1743
+ }
1744
+ /**
1745
+ * The picture models of the vetted list, each with its estimate for ONE candidate, the default first. A retired model
1746
+ * or one that cannot make a picture is never offered.
1747
+ */
1748
+ declare function generateModelChoices(models: ReadonlyArray<AiModelEntry>, review: AiTokenPrice): GenerateModelChoice[];
1749
+ /**
1750
+ * The plan features Generate needs — what its two steps belong to (`AI_STEP_FEATURE`): AI Assist, alone (Doron,
1751
+ * 2026-11-24; a studio needs no site generation to make a picture). A plan missing it is refused `NotInPlan`.
1752
+ */
1753
+ declare const GENERATE_FEATURES: ReadonlyArray<AiFeature>;
1754
+ /**
1755
+ * May this press run? The answer BEFORE any provider call (R-H12): the plan is known, it includes what Generate needs,
1756
+ * and the credits left cover the cost shown. The Files box asks it to disable the button and say why; iox-cms asks it
1757
+ * again with its own numbers before the first call — the client's are never trusted. Null = go.
1758
+ * A studio on its own key has no meter (`remaining: null`) and is never refused for credits.
1759
+ */
1760
+ declare function generateRefusal(estimate: Pick<GenerateEstimate, 'total'>, entitlements: AiEntitlementsView | null | undefined): AiRefusal | null;
1761
+ /** Where one candidate stands — the tile's state in the grid. */
1762
+ declare enum CandidateState {
1763
+ Making = "making",
1764
+ Checking = "checking",
1765
+ /** Made, looked at, kept. */
1766
+ Kept = "kept",
1767
+ /** Made and kept, but the look found something the owner should see (words in it, a warped hand). */
1768
+ Flagged = "flagged",
1769
+ /** Not made: the provider failed. Nothing was charged for it. */
1770
+ Failed = "failed"
1771
+ }
1772
+ /** What the look found, in the order the tile says it. */
1773
+ declare enum CandidateFlag {
1774
+ /** Writing, a logo or a watermark inside the picture. */
1775
+ Words = "words",
1776
+ /** Warped hands, faces or objects. */
1777
+ Anatomy = "anatomy",
1778
+ /** Not what was asked for. */
1779
+ Subject = "subject",
1780
+ /** The part left for words is too busy to read over. */
1781
+ CalmArea = "calmArea"
1782
+ }
1783
+ interface CandidateVerdict {
1784
+ readonly state: CandidateState.Kept | CandidateState.Flagged;
1785
+ readonly flags: ReadonlyArray<CandidateFlag>;
1786
+ /** The alt text written from the picture — stored on the asset, set on the element when the picture is used. */
1787
+ readonly alt: string;
1788
+ }
1789
+ /**
1790
+ * A made picture after its look: KEPT either way (it was paid for), flagged when the review says no — the same four
1791
+ * answers a site build's review gives (`pictureReviewPasses`), read here as marks instead of a reason to try again.
1792
+ */
1793
+ declare function candidateVerdict(review: PictureReview, slot?: Pick<GenerateSlot, 'wordsArea'>): CandidateVerdict;
1794
+ /** One candidate as the route answers it and the tile shows it. */
1795
+ interface GenerateCandidate {
1796
+ readonly id: string;
1797
+ readonly state: `${CandidateState}`;
1798
+ /** The asset written (`assets.source: generated`) — absent while making and when it failed. */
1799
+ readonly assetId?: string;
1800
+ readonly url?: string;
1801
+ readonly alt?: string;
1802
+ readonly flags?: ReadonlyArray<`${CandidateFlag}`>;
1803
+ /** What this candidate was charged, in credits (0 when it failed before a picture was made). */
1804
+ readonly credits?: number;
1805
+ }
1806
+ /** How one press ended, for the line under the box: how many were made, kept and charged; how many could not be. */
1807
+ interface GenerateOutcome {
1808
+ readonly made: number;
1809
+ readonly flagged: number;
1810
+ readonly failed: number;
1811
+ readonly credits: number;
1812
+ /** Every candidate has reached a final state. */
1813
+ readonly done: boolean;
1814
+ }
1815
+ declare function generateOutcome(candidates: ReadonlyArray<GenerateCandidate>): GenerateOutcome;
1816
+
1817
+ export { AI_DRAFT_SOURCE, AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistHandOff, AssistIssueCode, AssistMemoryOutcome, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistRunStatus, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CandidateFlag, CandidateState, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, GENERATE_COUNTS, GENERATE_COUNT_DEFAULT, GENERATE_FEATURES, GENERATE_KINDS, GENERATE_PROMPT_MAX, GENERATE_PROMPT_MIN, GENERATE_SHAPES, GENERATE_SHAPE_DEFAULT, GENERATE_STEPS, GenerateIssueCode, GenerateKind, GenerateUnavailable, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, LOOK_AXES, LOOK_AXIS_LABELS, LOOK_KEEP, LookAnswerKey, LookAxis, LookButtons, MAX_ASSIST_PHOTOS, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, MODE_LABELS, NEW_TARGET, NONE_TEXT, NeverWriteReason, OWNER_FILL_MAX_CHARS, PAGE_WORD_SLOTS, PHOTOS_PER_READ, PHOTO_GROUP_HANDLE_PREFIX, PageChangeOp, PagePartKind, PageSuggestionKind, PhotoAnswerKey, PhotoGrouping, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, ValueSource, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, aiDraftStamp, applyFieldEdits, applyLookEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, candidateVerdict, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeLookAnswers, decodePhotoDraftAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, describeFromPage, draftFromPhotos, escapeText, estimateGenerate, fieldHandle, fieldsJsonSchema, fieldsNamedIn, generateModelChoices, generateOutcome, generatePicturePrompt, generateRefusal, generateRequestIssues, groupPhotos, isAiDraft, isEmptyFieldValue, isPlainRecord, isRunBusy, isSchemeEdit, isSectionEdit, isSessionOf, isSiteLookEdit, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookAxisValue, lookHex, lookJsonSchema, lookNames, memoryLine, namedLocale, ownerFillFields, ownerFillIssues, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, photoDraftJsonSchema, photoGroupBrief, photoGroupHandle, photoReadCount, photoSlots, primaryLocale, promptAsksForWords, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, shapeForSlot, styleJsonSchema, suggestPhotoType, summarizeItem, summarizeLook, summarizePage, summarizePhotos, surfacePermissions, surfaceSpec, surfaceUndoPermissions, takesPhotos, titleField, turnLocale, unknownHandles, validateRunRequest, validateTurnRequest, withOwnerFill, wordsJsonSchema };
1818
+ export type { AiDraftStamp, AssistChange, AssistEdit, AssistField, AssistIssue, AssistMemoryLine, AssistModelChoice, AssistPhoto, AssistRoute, AssistRunRequest, AssistRunView, AssistSession, AssistTarget, AssistTurn, AssistTurnAccepted, AssistTurnProgress, AssistTurnRefusal, AssistTurnRequest, AssistWordContext, BaselineStyles, Brief, BriefRules, BriefValue, CandidateVerdict, ContentControllerDef, ContentPropertyDef, ContentRecord, ContentTypeSchema, DraftValue, FieldChange, FieldEdit, FieldEditContext, FieldEditsOutcome, FieldsSchemaExtra, FieldsSchemaOptions, FieldsSchemas, GenerateCandidate, GenerateEstimate, GenerateIssue, GenerateModelChoice, GenerateOutcome, GeneratePicturesRequest, GenerateSlot, HandleMap, HandleResolution, HandleTarget, ItemAround, ItemBrief, ItemBriefContext, ItemBriefField, ItemFocus, ItemSuggestion, ItemSummary, KeptDraft, LookEditsOutcome, LookMap, LookSchemas, LookSummary, LookTarget, NeverWrite, NodeStyleEdit, PageAround, PageBrief, PageBriefContext, PageChange, PageEdit, PageEditContext, PageEditsOutcome, PageFocus, PageLook, PagePart, PageSectionSummary, PageSuggestion, PhotoBriefField, PhotoDraft, PhotoDraftAnswer, PhotoDraftContext, PhotoDraftOutcome, PhotoGroup, PhotoSlots, PhotosAround, PhotosBrief, PhotosBriefContext, PhotosFocus, SchemeEdit, SectionAdd, SectionChange, SectionEdit, SectionEditContext, SectionEditsOutcome, SectionMap, SectionMove, SectionRemove, SectionSwap, SectionTarget, SiteLookChange, SiteLookEdit, SizeEdit, StyleChange, StyleEdit, StyleEditContext, StyleEditsOutcome, StyleSchemas, SummarizedItem, SummarizedPage, SummarizedPhotos, SurfaceSpec, WalkedLook, WordChange, WordEdit, WordEditContext, WordEditsOutcome, WordsSchemas, WrittenWords };
@@ -1,4 +1,4 @@
1
- import { AiStep, STRICT_SCHEMA_BUDGET, strictSchemaComplexity, jsonText, jsonListOf, jsonOneOf, jsonClosedObject, jsonAnyOf, PlanWordIssueCode, factIssues, walkSerialized, AdjustKind, AdjustAxis, adjustStepOf, ADJUST_STEPS, NODE_BASELINES, adjustStyleProps, ADJUST_AXIS_LABELS, adjustStepLabel, patternById, carryInto, composeSection } from '@vectoriox/iox-ui/generation-core';
1
+ import { AiStep, STRICT_SCHEMA_BUDGET, strictSchemaComplexity, jsonText, jsonListOf, jsonOneOf, jsonClosedObject, jsonAnyOf, PlanWordIssueCode, factIssues, walkSerialized, AdjustKind, AdjustAxis, adjustStepOf, ADJUST_STEPS, NODE_BASELINES, adjustStyleProps, ADJUST_AXIS_LABELS, adjustStepLabel, patternById, carryInto, composeSection, PICTURE_ASPECTS, artDirectionPreamble, frameWords, emptyAreaPhrase, estimateStepCredits, creditsOfUsd, aiModelStep, modelCanDo, AI_STEP_FEATURE, AiRefusalCode, aiRefusalNext, pictureReviewPasses } from '@vectoriox/iox-ui/generation-core';
2
2
  import { elementStylesFor, colorSchemeOf, ColorScheme, COLOR_SCHEME_TYPES, elementStyleById, COLOR_SCHEMES, NEW_NODE_STYLE_DEFAULTS, setColorScheme, switchElementStyle, flavorPackById, parseHexColor, resolveDesignChoices, SPEC_AXES, stylePresetOfChoices, BETWEEN_IDS, ANIMATE_IDS, SCROLL_IDS, COLUMN_IDS, TINT_IDS, STYLE_PRESETS, stylePresetById, presetChoices, designTokenRows, auditDesignContrast } from '@vectoriox/iox-ui/design-core';
3
3
 
4
4
  /**
@@ -175,6 +175,9 @@ const SURFACES = {
175
175
  scopes: [AssistScope.Field, AssistScope.Item],
176
176
  status: SurfaceStatus.Planned,
177
177
  }),
178
+ // S7 Files box ▸ Generate: no sentence is routed and no Assist step runs — the box IS the request (`media-generate.ts`:
179
+ // what may be asked, the prompt, the cost before the button, the refusal before any call). It writes assets, so a
180
+ // press is a Run; placing a made picture is the Files box's own pick, one builder step. Built when the box ships.
178
181
  [AssistSurface.Media]: spec({
179
182
  surface: AssistSurface.Media,
180
183
  families: [EditFamily.Media],
@@ -2787,7 +2790,7 @@ const isRunBusy = (status) => !!status && RUN_BUSY.has(status);
2787
2790
  /** What the server refuses in a run request against the turn's drafts: none, unknown or repeated picks. */
2788
2791
  function validateRunRequest(req, drafts) {
2789
2792
  const issue = (code, message, handle) => ({ code, message, ...(handle ? { handle } : {}) });
2790
- if (!isObject(req))
2793
+ if (!isObject$1(req))
2791
2794
  return [issue(AssistIssueCode.BadRequest, 'a run is an object')];
2792
2795
  const picks = req['picks'];
2793
2796
  if (!Array.isArray(picks) || !picks.length || !picks.every(nonEmpty))
@@ -2796,7 +2799,7 @@ function validateRunRequest(req, drafts) {
2796
2799
  return [
2797
2800
  ...picks.filter(p => !known.has(p)).map(p => issue(AssistIssueCode.UnknownHandle, `"${p}" is not a draft of this turn`, p)),
2798
2801
  ...(new Set(picks).size !== picks.length ? [issue(AssistIssueCode.Duplicate, 'a draft is picked twice')] : []),
2799
- ...(req['fill'] !== undefined && !isObject(req['fill']) ? [issue(AssistIssueCode.BadRequest, 'fill is an object of field → text')] : []),
2802
+ ...(req['fill'] !== undefined && !isObject$1(req['fill']) ? [issue(AssistIssueCode.BadRequest, 'fill is an object of field → text')] : []),
2800
2803
  ];
2801
2804
  }
2802
2805
  var AssistRouteKey;
@@ -2909,7 +2912,7 @@ function sessionMemory(turns) {
2909
2912
  .slice(-MEMORY_TURNS)
2910
2913
  .map(memoryLine);
2911
2914
  }
2912
- const isObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
2915
+ const isObject$1 = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
2913
2916
  const nonEmpty = (v) => typeof v === 'string' && v.trim() !== '';
2914
2917
  /** Absent, or a list of non-empty field keys. */
2915
2918
  const isOwnerEdited = (v) => v === undefined || (Array.isArray(v) && v.every(nonEmpty));
@@ -2924,7 +2927,7 @@ function photoIssues(photos, grouping) {
2924
2927
  out.push(issue('a photos turn names its photos'));
2925
2928
  else if (photos.length > MAX_ASSIST_PHOTOS)
2926
2929
  out.push(issue(`at most ${MAX_ASSIST_PHOTOS} photos a turn`));
2927
- else if (!photos.every(p => isObject(p) && nonEmpty(p['key'])))
2930
+ else if (!photos.every(p => isObject$1(p) && nonEmpty(p['key'])))
2928
2931
  out.push(issue('each photo is its storage key'));
2929
2932
  else if (new Set(photos.map(p => p['key'])).size !== photos.length)
2930
2933
  out.push(issue('a photo is named twice'));
@@ -2935,7 +2938,7 @@ function photoIssues(photos, grouping) {
2935
2938
  /** What the server refuses in a posted turn before anything runs. Empty = accepted. */
2936
2939
  function validateTurnRequest(req) {
2937
2940
  const issue = (code, message) => ({ code, message });
2938
- if (!isObject(req))
2941
+ if (!isObject$1(req))
2939
2942
  return [issue(AssistIssueCode.BadRequest, 'a turn is an object')];
2940
2943
  const surface = req['surface'];
2941
2944
  const spec = Object.prototype.hasOwnProperty.call(SURFACES, surface) ? SURFACES[surface] : undefined;
@@ -2952,10 +2955,10 @@ function validateTurnRequest(req) {
2952
2955
  ...(spec.readsPhotos && spec.commit === CommitKind.Run ? photoIssues(req['photos'], req['grouping']) : []),
2953
2956
  ...(nonEmpty(sentence) && sentence.length > MAX_SENTENCE_CHARS ? [issue(AssistIssueCode.SentenceTooLong, `the sentence is over ${MAX_SENTENCE_CHARS} characters`)] : []),
2954
2957
  ...(!nonEmpty(req['model']) ? [issue(AssistIssueCode.BadRequest, 'no model choice (auto or a model id)')] : []),
2955
- ...(!isObject(brief) || brief['surface'] !== surface ? [issue(AssistIssueCode.BadRequest, `the brief is not a ${surface} brief`)] : []),
2956
- ...(!isObject(req['handles']) || !Object.keys(req['handles']).length ? [issue(AssistIssueCode.MissingHandles, 'the brief\'s handles are missing')] : []),
2957
- ...(spec.commit === CommitKind.FormFill && !isObject(req['values']) ? [issue(AssistIssueCode.MissingValues, 'a form-fill turn carries the form\'s values')] : []),
2958
- ...(spec.commit === CommitKind.BuilderStep && (!Array.isArray(req['layout']) || !req['layout'].length || !req['layout'].every(isObject))
2958
+ ...(!isObject$1(brief) || brief['surface'] !== surface ? [issue(AssistIssueCode.BadRequest, `the brief is not a ${surface} brief`)] : []),
2959
+ ...(!isObject$1(req['handles']) || !Object.keys(req['handles']).length ? [issue(AssistIssueCode.MissingHandles, 'the brief\'s handles are missing')] : []),
2960
+ ...(spec.commit === CommitKind.FormFill && !isObject$1(req['values']) ? [issue(AssistIssueCode.MissingValues, 'a form-fill turn carries the form\'s values')] : []),
2961
+ ...(spec.commit === CommitKind.BuilderStep && (!Array.isArray(req['layout']) || !req['layout'].length || !req['layout'].every(isObject$1))
2959
2962
  ? [issue(AssistIssueCode.MissingValues, 'a builder turn carries the page\'s layout')] : []),
2960
2963
  ...(spec.commit === CommitKind.BuilderStep && !nonEmpty(req['pageId']) ? [issue(AssistIssueCode.BadRequest, `${surface} names its page`)] : []),
2961
2964
  ...(!isOwnerEdited(req['ownerEdited']) ? [issue(AssistIssueCode.BadRequest, 'ownerEdited is a list of field keys')] : []),
@@ -2963,6 +2966,253 @@ function validateTurnRequest(req) {
2963
2966
  ];
2964
2967
  }
2965
2968
 
2969
+ /**
2970
+ * FILES BOX ▸ GENERATE — the vocabulary of AI Assist's surface S7 (ai-assist-plan §2 "S7", A-D14 · A-D15 · A-D16), the
2971
+ * pictures half. ONE spelling for the Files box (iox-cms-client), the route that makes the pictures (iox-cms) and the
2972
+ * proof: what may be asked, how the asked words become the prompt, what it costs before the button, when it is refused
2973
+ * before any call, and what a made picture is afterwards.
2974
+ *
2975
+ * It adds NO generator: a picture is made by the M7 pipeline's own call and looked at by its own review
2976
+ * (`PictureReview`), under the same art-direction preamble (`artDirectionPreamble`). The two calls run as steps of
2977
+ * Assist's own (`GENERATE_STEPS` — `AiStep.AssistPicture` / `AssistPictureReview`, which `AI_STEP_RUNS_AS` the M7 steps'
2978
+ * models), so the Assist feature alone allows Generate and its ledger rows are Assist's. What differs
2979
+ * from a site build's pictures is the owner's part: THEY write the words, THEY choose how many, and every candidate made
2980
+ * is charged and KEPT — a review that says no marks the picture, it does not buy a second try (gateway rule 3, R-H12).
2981
+ */
2982
+ /** The two steps a press runs — Assist's own names for the M7 picture call and its review. */
2983
+ const GENERATE_STEPS = { picture: AiStep.AssistPicture, review: AiStep.AssistPictureReview };
2984
+ var GenerateKind;
2985
+ (function (GenerateKind) {
2986
+ GenerateKind["Photo"] = "photo";
2987
+ GenerateKind["Video"] = "video";
2988
+ })(GenerateKind || (GenerateKind = {}));
2989
+ /** Why a kind cannot be made yet — the Files box says it in words, never with a button that fails (R-H13). */
2990
+ var GenerateUnavailable;
2991
+ (function (GenerateUnavailable) {
2992
+ /** No provider makes a video from a start picture yet (`generateVideo`, premium-sites SC6c). */
2993
+ GenerateUnavailable["NoProvider"] = "noProvider";
2994
+ })(GenerateUnavailable || (GenerateUnavailable = {}));
2995
+ /** What each kind can do today. Video turns on here, in one place, the day a provider exists. */
2996
+ const GENERATE_KINDS = {
2997
+ [GenerateKind.Photo]: { available: true },
2998
+ [GenerateKind.Video]: { available: false, why: GenerateUnavailable.NoProvider },
2999
+ };
3000
+ /** How many candidates one press makes. */
3001
+ const GENERATE_COUNTS = [1, 2, 4];
3002
+ const GENERATE_COUNT_DEFAULT = 4;
3003
+ /** The frames offered (each a frame the image model is asked for — `PICTURE_ASPECTS`), widest first. */
3004
+ const GENERATE_SHAPES = ['16:9', '4:3', '1:1', '3:4', '9:16'];
3005
+ const GENERATE_SHAPE_DEFAULT = '4:3';
3006
+ const GENERATE_PROMPT_MIN = 3;
3007
+ const GENERATE_PROMPT_MAX = 600;
3008
+ var GenerateIssueCode;
3009
+ (function (GenerateIssueCode) {
3010
+ GenerateIssueCode["Shape"] = "shape";
3011
+ GenerateIssueCode["Kind"] = "kind";
3012
+ GenerateIssueCode["KindUnavailable"] = "kindUnavailable";
3013
+ GenerateIssueCode["Prompt"] = "prompt";
3014
+ GenerateIssueCode["PromptTooLong"] = "promptTooLong";
3015
+ GenerateIssueCode["Frame"] = "frame";
3016
+ GenerateIssueCode["Count"] = "count";
3017
+ GenerateIssueCode["Model"] = "model";
3018
+ })(GenerateIssueCode || (GenerateIssueCode = {}));
3019
+ const isObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
3020
+ const REQUEST_KEYS = ['kind', 'prompt', 'shape', 'count', 'look', 'model', 'slot'];
3021
+ /** What is wrong with a value as a request to generate pictures — nothing is repaired, each fault has its path. */
3022
+ function generateRequestIssues(value) {
3023
+ if (!isObject(value))
3024
+ return [{ code: GenerateIssueCode.Shape, path: '', message: 'must be an object' }];
3025
+ const v = value;
3026
+ const issues = [];
3027
+ const say = (code, path, message) => issues.push({ code, path, message });
3028
+ const kinds = Object.values(GenerateKind);
3029
+ if (typeof v.kind !== 'string' || !kinds.includes(v.kind))
3030
+ say(GenerateIssueCode.Kind, 'kind', `one of ${kinds.join(', ')}`);
3031
+ else if (!GENERATE_KINDS[v.kind].available)
3032
+ say(GenerateIssueCode.KindUnavailable, 'kind', `${v.kind} cannot be made yet`);
3033
+ const prompt = typeof v.prompt === 'string' ? v.prompt.trim() : '';
3034
+ if (prompt.length < GENERATE_PROMPT_MIN)
3035
+ say(GenerateIssueCode.Prompt, 'prompt', 'describe the picture');
3036
+ else if (prompt.length > GENERATE_PROMPT_MAX)
3037
+ say(GenerateIssueCode.PromptTooLong, 'prompt', `at most ${GENERATE_PROMPT_MAX} characters`);
3038
+ if (typeof v.shape !== 'string' || !GENERATE_SHAPES.includes(v.shape))
3039
+ say(GenerateIssueCode.Frame, 'shape', `one of ${GENERATE_SHAPES.join(', ')}`);
3040
+ if (typeof v.count !== 'number' || !GENERATE_COUNTS.includes(v.count))
3041
+ say(GenerateIssueCode.Count, 'count', `one of ${GENERATE_COUNTS.join(', ')}`);
3042
+ if (typeof v.look !== 'boolean')
3043
+ say(GenerateIssueCode.Shape, 'look', 'must be true or false');
3044
+ if (v.model !== undefined && (typeof v.model !== 'string' || !v.model))
3045
+ say(GenerateIssueCode.Model, 'model', 'a model id, or absent');
3046
+ if (v.slot !== undefined) {
3047
+ if (!isObject(v.slot))
3048
+ say(GenerateIssueCode.Shape, 'slot', 'must be an object');
3049
+ else {
3050
+ const slot = v.slot;
3051
+ if (slot.aspect !== undefined && !(typeof slot.aspect === 'number' && slot.aspect > 0 && Number.isFinite(slot.aspect)))
3052
+ say(GenerateIssueCode.Shape, 'slot.aspect', 'a positive number');
3053
+ const area = slot.wordsArea;
3054
+ const good = !!area && typeof area === 'object' && (area.edge === 'top' || area.edge === 'bottom') && typeof area.share === 'number' && area.share > 0 && area.share <= 1;
3055
+ if (slot.wordsArea !== undefined && !good)
3056
+ say(GenerateIssueCode.Shape, 'slot.wordsArea', '{ edge: top | bottom, share: 0–1 }');
3057
+ }
3058
+ }
3059
+ for (const key of Object.keys(value))
3060
+ if (!REQUEST_KEYS.includes(key))
3061
+ say(GenerateIssueCode.Shape, key, 'is not a key of the request');
3062
+ return issues;
3063
+ }
3064
+ /**
3065
+ * The offered frame nearest a slot ("fits the slot"): by the ratio of the two shapes, so 4:5 goes to 3:4 and never to
3066
+ * 1:1 by a hair. No slot, or one with no shape yet = the default.
3067
+ */
3068
+ function shapeForSlot(aspect) {
3069
+ if (!(typeof aspect === 'number' && aspect > 0 && Number.isFinite(aspect)))
3070
+ return GENERATE_SHAPE_DEFAULT;
3071
+ let best = GENERATE_SHAPE_DEFAULT, distance = Infinity;
3072
+ for (const shape of GENERATE_SHAPES) {
3073
+ const d = Math.abs(Math.log(PICTURE_ASPECTS[shape] / aspect));
3074
+ if (d < distance) {
3075
+ best = shape;
3076
+ distance = d;
3077
+ }
3078
+ }
3079
+ return best;
3080
+ }
3081
+ /**
3082
+ * The prompt a generated picture is asked with: the site's preamble VERBATIM when "Your look" is on (the same one a
3083
+ * site build's pictures get — one preamble per prompt), then the OWNER'S WORDS as written, the frame, and the part left
3084
+ * calm for words when the slot has words over it. Nothing else is added and nothing of the owner's is rewritten.
3085
+ */
3086
+ function generatePicturePrompt(request, direction) {
3087
+ return [
3088
+ ...(request.look && direction ? [artDirectionPreamble(direction)] : []),
3089
+ request.prompt.trim(),
3090
+ frameWords(request.shape),
3091
+ ...(request.slot?.wordsArea ? [emptyAreaPhrase(request.slot.wordsArea)] : []),
3092
+ ].join('\n');
3093
+ }
3094
+ /** Words an image model draws badly: asked for inside the picture, they come out wrong (the honesty line). */
3095
+ const WORDS_ASKED = /\b(logo|text|words?|sign|signage|letters?|caption|title|headline|slogan|typography)\b|כיתוב|טקסט|לוגו|כותרת|אותיות|שלט|סלוגן/i;
3096
+ /** True when the owner's words ask for writing INSIDE the picture — the box says "put the words on the page". */
3097
+ function promptAsksForWords(prompt) {
3098
+ return WORDS_ASKED.test(prompt ?? '');
3099
+ }
3100
+ /**
3101
+ * "Describe from the page": the words the box fills in for the element that opened it — the section's own words and
3102
+ * the kind of business, never the business's name (it would be drawn). No model is asked; empty when the page says
3103
+ * nothing.
3104
+ */
3105
+ function describeFromPage(context) {
3106
+ const business = (context.business ?? '').trim();
3107
+ const words = (context.words ?? '').replace(/\s+/g, ' ').trim().slice(0, 240);
3108
+ if (!business && !words)
3109
+ return '';
3110
+ const subject = business ? `A picture for ${business}` : 'A picture for this part of the page';
3111
+ return (words ? `${subject}. It goes beside these words: “${words}”.` : `${subject}.`).slice(0, GENERATE_PROMPT_MAX);
3112
+ }
3113
+ /**
3114
+ * The cost shown under the box (A-D15: the owner chooses the cost): every candidate is made once and looked at once.
3115
+ * Unlike a site build's pictures (`estimatePictures`) there is NO second try in it — a candidate the review says no to
3116
+ * is kept and marked, and the owner decides whether to press again.
3117
+ */
3118
+ function estimateGenerate(count, prices) {
3119
+ const picture = estimateStepCredits(GENERATE_STEPS.picture, prices.image);
3120
+ const review = estimateStepCredits(GENERATE_STEPS.review, prices.review);
3121
+ const n = Math.max(0, Math.floor(count));
3122
+ return { count: n, picture, review, each: creditsOfUsd((picture + review) / 100), total: creditsOfUsd((n * (picture + review)) / 100) };
3123
+ }
3124
+ /**
3125
+ * The picture models of the vetted list, each with its estimate for ONE candidate, the default first. A retired model
3126
+ * or one that cannot make a picture is never offered.
3127
+ */
3128
+ function generateModelChoices(models, review) {
3129
+ const step = aiModelStep(GENERATE_STEPS.picture); // the vetted list names the step whose model this runs on
3130
+ return models
3131
+ .filter(m => !m.retired && m.steps.includes(step) && modelCanDo(m, step))
3132
+ .map(m => ({ id: m.id, label: m.label, recommended: !!m.recommendedFor?.includes(step), each: m.price ? estimateGenerate(1, { image: m.price, review }).each : null }))
3133
+ .sort((a, b) => Number(b.recommended) - Number(a.recommended));
3134
+ }
3135
+ /**
3136
+ * The plan features Generate needs — what its two steps belong to (`AI_STEP_FEATURE`): AI Assist, alone (Doron,
3137
+ * 2026-11-24; a studio needs no site generation to make a picture). A plan missing it is refused `NotInPlan`.
3138
+ */
3139
+ const GENERATE_FEATURES = Array.from(new Set(Object.values(GENERATE_STEPS).map(step => AI_STEP_FEATURE[step])));
3140
+ /**
3141
+ * May this press run? The answer BEFORE any provider call (R-H12): the plan is known, it includes what Generate needs,
3142
+ * and the credits left cover the cost shown. The Files box asks it to disable the button and say why; iox-cms asks it
3143
+ * again with its own numbers before the first call — the client's are never trusted. Null = go.
3144
+ * A studio on its own key has no meter (`remaining: null`) and is never refused for credits.
3145
+ */
3146
+ function generateRefusal(estimate, entitlements) {
3147
+ if (!entitlements || !entitlements.known)
3148
+ return { code: AiRefusalCode.PlanUnknown, next: { kind: aiRefusalNext(AiRefusalCode.PlanUnknown) } };
3149
+ const missing = GENERATE_FEATURES.find(f => entitlements.features?.[f] !== true);
3150
+ if (missing)
3151
+ return { code: AiRefusalCode.NotInPlan, planName: entitlements.planName, next: { kind: aiRefusalNext(AiRefusalCode.NotInPlan) } };
3152
+ const remaining = entitlements.meter?.remaining;
3153
+ if (typeof remaining === 'number' && estimate.total > remaining) {
3154
+ const buy = entitlements.meter?.buy ?? null;
3155
+ return {
3156
+ code: AiRefusalCode.OutOfCredits, planName: entitlements.planName, remaining, estimate: estimate.total,
3157
+ next: { kind: aiRefusalNext(AiRefusalCode.OutOfCredits, buy), ...(buy ? { href: buy.url } : {}) },
3158
+ };
3159
+ }
3160
+ return null;
3161
+ }
3162
+ // ── A candidate, once made ────────────────────────────────────────────────────────────────────
3163
+ /** Where one candidate stands — the tile's state in the grid. */
3164
+ var CandidateState;
3165
+ (function (CandidateState) {
3166
+ CandidateState["Making"] = "making";
3167
+ CandidateState["Checking"] = "checking";
3168
+ /** Made, looked at, kept. */
3169
+ CandidateState["Kept"] = "kept";
3170
+ /** Made and kept, but the look found something the owner should see (words in it, a warped hand). */
3171
+ CandidateState["Flagged"] = "flagged";
3172
+ /** Not made: the provider failed. Nothing was charged for it. */
3173
+ CandidateState["Failed"] = "failed";
3174
+ })(CandidateState || (CandidateState = {}));
3175
+ /** What the look found, in the order the tile says it. */
3176
+ var CandidateFlag;
3177
+ (function (CandidateFlag) {
3178
+ /** Writing, a logo or a watermark inside the picture. */
3179
+ CandidateFlag["Words"] = "words";
3180
+ /** Warped hands, faces or objects. */
3181
+ CandidateFlag["Anatomy"] = "anatomy";
3182
+ /** Not what was asked for. */
3183
+ CandidateFlag["Subject"] = "subject";
3184
+ /** The part left for words is too busy to read over. */
3185
+ CandidateFlag["CalmArea"] = "calmArea";
3186
+ })(CandidateFlag || (CandidateFlag = {}));
3187
+ /**
3188
+ * A made picture after its look: KEPT either way (it was paid for), flagged when the review says no — the same four
3189
+ * answers a site build's review gives (`pictureReviewPasses`), read here as marks instead of a reason to try again.
3190
+ */
3191
+ function candidateVerdict(review, slot) {
3192
+ const flags = [];
3193
+ if (!review.clean)
3194
+ flags.push(CandidateFlag.Words);
3195
+ if (!review.anatomy)
3196
+ flags.push(CandidateFlag.Anatomy);
3197
+ if (!review.subject)
3198
+ flags.push(CandidateFlag.Subject);
3199
+ if (slot?.wordsArea && !review.calmArea)
3200
+ flags.push(CandidateFlag.CalmArea);
3201
+ const passes = pictureReviewPasses(review, { wordsArea: slot?.wordsArea });
3202
+ return { state: passes ? CandidateState.Kept : CandidateState.Flagged, flags: passes ? [] : flags, alt: review.alt.trim() };
3203
+ }
3204
+ const FINAL = [CandidateState.Kept, CandidateState.Flagged, CandidateState.Failed];
3205
+ function generateOutcome(candidates) {
3206
+ const made = candidates.filter(c => c.state === CandidateState.Kept || c.state === CandidateState.Flagged);
3207
+ return {
3208
+ made: made.length,
3209
+ flagged: candidates.filter(c => c.state === CandidateState.Flagged).length,
3210
+ failed: candidates.filter(c => c.state === CandidateState.Failed).length,
3211
+ credits: creditsOfUsd(candidates.reduce((sum, c) => sum + (c.credits ?? 0), 0) / 100),
3212
+ done: candidates.length > 0 && candidates.every(c => FINAL.includes(c.state)),
3213
+ };
3214
+ }
3215
+
2966
3216
  /**
2967
3217
  * @vectoriox/iox-ui/assist-core — the shared, FRAMEWORK-FREE vocabulary of AI Assist (iox-ai-guidance
2968
3218
  * `architecture/ai/ai-assist-plan.md` §3b): the surfaces and their specs, the brief and its handle map, the route
@@ -2983,5 +3233,5 @@ function validateTurnRequest(req) {
2983
3233
  * Generated bundle index. Do not edit.
2984
3234
  */
2985
3235
 
2986
- export { AI_DRAFT_SOURCE, AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistHandOff, AssistIssueCode, AssistMemoryOutcome, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistRunStatus, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, LOOK_AXES, LOOK_AXIS_LABELS, LOOK_KEEP, LookAnswerKey, LookAxis, LookButtons, MAX_ASSIST_PHOTOS, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, MODE_LABELS, NEW_TARGET, NONE_TEXT, NeverWriteReason, OWNER_FILL_MAX_CHARS, PAGE_WORD_SLOTS, PHOTOS_PER_READ, PHOTO_GROUP_HANDLE_PREFIX, PageChangeOp, PagePartKind, PageSuggestionKind, PhotoAnswerKey, PhotoGrouping, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, ValueSource, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, aiDraftStamp, applyFieldEdits, applyLookEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeLookAnswers, decodePhotoDraftAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, draftFromPhotos, escapeText, fieldHandle, fieldsJsonSchema, fieldsNamedIn, groupPhotos, isAiDraft, isEmptyFieldValue, isPlainRecord, isRunBusy, isSchemeEdit, isSectionEdit, isSessionOf, isSiteLookEdit, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookAxisValue, lookHex, lookJsonSchema, lookNames, memoryLine, namedLocale, ownerFillFields, ownerFillIssues, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, photoDraftJsonSchema, photoGroupBrief, photoGroupHandle, photoReadCount, photoSlots, primaryLocale, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, styleJsonSchema, suggestPhotoType, summarizeItem, summarizeLook, summarizePage, summarizePhotos, surfacePermissions, surfaceSpec, surfaceUndoPermissions, takesPhotos, titleField, turnLocale, unknownHandles, validateRunRequest, validateTurnRequest, withOwnerFill, wordsJsonSchema };
3236
+ export { AI_DRAFT_SOURCE, AROUND_ITEMS_MAX, AROUND_TEXT_CHARS, ASK_SECTION_PATTERNS, ASK_STYLE_SETS, ASSIST_MODEL_AUTO, ASSIST_POLL_MS, ASSIST_ROUTES, AssistBriefError, AssistBudgetError, AssistFieldKind, AssistHandOff, AssistIssueCode, AssistMemoryOutcome, AssistPathError, AssistPermission, AssistRefusalCode, AssistRouteKey, AssistRunStatus, AssistScope, AssistStep, AssistSurface, AssistTurnStatus, BOOLEAN_FALSE, BOOLEAN_TRUE, CandidateFlag, CandidateState, CommitKind, EditFamily, FIELDS_PER_PART, FIELD_HANDLE_PREFIX, FOCUS_TEXT_CHARS, FieldsAnswerKey, GENERATE_COUNTS, GENERATE_COUNT_DEFAULT, GENERATE_FEATURES, GENERATE_KINDS, GENERATE_PROMPT_MAX, GENERATE_PROMPT_MIN, GENERATE_SHAPES, GENERATE_SHAPE_DEFAULT, GENERATE_STEPS, GenerateIssueCode, GenerateKind, GenerateUnavailable, ItemSuggestionKind, LOCALE_NAME_LANGUAGES, LOOK_AXES, LOOK_AXIS_LABELS, LOOK_KEEP, LookAnswerKey, LookAxis, LookButtons, MAX_ASSIST_PHOTOS, MAX_ASSIST_PROPERTIES, MAX_ROUTE_PROPERTIES, MAX_SENTENCE_CHARS, MEMORY_TURNS, MODE_LABELS, NEW_TARGET, NONE_TEXT, NeverWriteReason, OWNER_FILL_MAX_CHARS, PAGE_WORD_SLOTS, PHOTOS_PER_READ, PHOTO_GROUP_HANDLE_PREFIX, PageChangeOp, PagePartKind, PageSuggestionKind, PhotoAnswerKey, PhotoGrouping, RouteAnswerKey, SECTION_START, SHORTEN_FROM_CHARS, SHORTEN_HEADING_FROM_CHARS, SHORTEN_TEXT_FROM_CHARS, SIBLING_HANDLE_PREFIX, SURFACES, SectionChangeKind, SectionsAnswerKey, StyleAnswerKey, SurfaceStatus, ValueSource, WORDS_PER_PART, WordsAnswerKey, adjustAxesOf, aiDraftStamp, applyFieldEdits, applyLookEdits, applyPageEdits, applySectionEdits, applyStyleEdits, applyWordEdits, askSectionPatternNames, askableStyles, assertAssistBudget, assistBudgetIssues, assistFactIssues, assistFields, assistPath, assistSession, assistSessionKey, builtSurfaces, candidateVerdict, clipText, commitOf, containsHtml, decodeFieldsAnswers, decodeLookAnswers, decodePhotoDraftAnswers, decodeSectionsAnswers, decodeStyleAnswers, decodeWordsAnswers, describeFromPage, draftFromPhotos, escapeText, estimateGenerate, fieldHandle, fieldsJsonSchema, fieldsNamedIn, generateModelChoices, generateOutcome, generatePicturePrompt, generateRefusal, generateRequestIssues, groupPhotos, isAiDraft, isEmptyFieldValue, isPlainRecord, isRunBusy, isSchemeEdit, isSectionEdit, isSessionOf, isSiteLookEdit, isSizeEdit, isStyleEdit, isTerminalTurn, isWritable, itemLocales, itemSuggestions, languageName, lookAxisValue, lookHex, lookJsonSchema, lookNames, memoryLine, namedLocale, ownerFillFields, ownerFillIssues, pageLooks, pageSuggestions, pageWriteLocale, paragraphsToRichText, photoDraftJsonSchema, photoGroupBrief, photoGroupHandle, photoReadCount, photoSlots, primaryLocale, promptAsksForWords, readFieldValue, readLocaleValues, readRoute, readableWords, resolveHandle, richTextParagraphs, routeJsonSchema, sectionLabel, sectionPatternOf, sectionsJsonSchema, serializedBaselineStyles, sessionMemory, shapeForSlot, styleJsonSchema, suggestPhotoType, summarizeItem, summarizeLook, summarizePage, summarizePhotos, surfacePermissions, surfaceSpec, surfaceUndoPermissions, takesPhotos, titleField, turnLocale, unknownHandles, validateRunRequest, validateTurnRequest, withOwnerFill, wordsJsonSchema };
2987
3237
  //# sourceMappingURL=vectoriox-iox-ui-assist-core.mjs.map