@vectoriox/iox-ui 5.111.0 → 5.113.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.
@@ -5577,28 +5577,7 @@ declare const SPEC_SITE_LAYOUT: {
5577
5577
  readonly "phone.stack": "one under another";
5578
5578
  readonly "phone.two-up": "two across";
5579
5579
  };
5580
- readonly waits: {
5581
- readonly "arrange.deck": {
5582
- readonly phase: "LI4";
5583
- readonly drawnAs: "row";
5584
- };
5585
- readonly "who.middle": {
5586
- readonly phase: "LI4";
5587
- readonly drawnAs: "none";
5588
- };
5589
- readonly "how.bigger": {
5590
- readonly phase: "LI4";
5591
- readonly drawnAs: null;
5592
- };
5593
- readonly "how.raised": {
5594
- readonly phase: "LI4";
5595
- readonly drawnAs: null;
5596
- };
5597
- readonly "how.brighter": {
5598
- readonly phase: "LI4";
5599
- readonly drawnAs: null;
5600
- };
5601
- };
5580
+ readonly waits: {};
5602
5581
  readonly defaults: {
5603
5582
  readonly item: "card";
5604
5583
  readonly arrange: "grid";
@@ -8618,7 +8597,13 @@ declare enum AiStep {
8618
8597
  CheckPictures = "imageReview",
8619
8598
  NameStructures = "scanNaming",
8620
8599
  /** M8 gate 2: each composed page's layout, one strict request a page, after the plan (M8-G2-D2). */
8621
- ComposePages = "composePages"
8600
+ ComposePages = "composePages",
8601
+ /** AI Assist (A-D7): which edit families a sentence on a screen asks for — or that it cannot be done. Fast, small. */
8602
+ AssistRoute = "assistRoute",
8603
+ /** AI Assist: the edits themselves, one strict request per routed family. */
8604
+ AssistEdit = "assistEdit",
8605
+ /** AI Assist: photos read into content (≤ 6 a request, S3). */
8606
+ AssistRead = "assistRead"
8622
8607
  }
8623
8608
  declare const AI_STEPS: ReadonlyArray<AiStep>;
8624
8609
  /** Each step's name on the wire (the control plane's `label`, the console) — the screens translate their own. */
@@ -8772,8 +8757,12 @@ interface AiMeter {
8772
8757
  }
8773
8758
  /** The plan entitlements AI reads (the control plane's `features` / `limits` keys) — ONE spelling. */
8774
8759
  declare enum AiFeature {
8775
- SiteGeneration = "aiSiteGeneration"
8760
+ SiteGeneration = "aiSiteGeneration",
8761
+ /** AI Assist on every screen (ai-assist-plan A-D6): its own switch, the plan's shared credits. */
8762
+ Assist = "aiAssist"
8776
8763
  }
8764
+ /** The feature a step belongs to — the gate refuses a step whose feature the plan does not include. */
8765
+ declare const AI_STEP_FEATURE: Readonly<Record<AiStep, AiFeature>>;
8777
8766
  declare enum AiLimit {
8778
8767
  CreditsPerMonth = "aiCreditsPerMonth",
8779
8768
  CreditsPerGeneration = "aiCreditsPerGeneration"
@@ -9134,6 +9123,11 @@ declare const HEBREW_PREFIXES = "[\u05D5\u05D4\u05D1\u05DC\u05DE\u05E9\u05DB]{0,
9134
9123
  declare function wordPattern(word: string): RegExp;
9135
9124
  /** Every price written in `text` (commerce C-D21: what a business sells never carries one — the owner sets prices). */
9136
9125
  declare function pricesIn(text: string): string[];
9126
+ /**
9127
+ * The words to avoid and the facts never given, in any texts a model wrote — the plan's (`planWordIssues`) and an AI
9128
+ * Assist turn's field values (assist-core, R-H2): ONE judge of what a model may write.
9129
+ */
9130
+ declare function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordContext): PlanWordIssue[];
9137
9131
  /** The words to avoid and the facts never given, in every written text of the plan. */
9138
9132
  declare function planWordIssues(plan: SitePlan, ctx: PlanWordContext): PlanWordIssue[];
9139
9133
 
@@ -10538,28 +10532,7 @@ declare const LIST_TABLE: {
10538
10532
  readonly "phone.stack": "one under another";
10539
10533
  readonly "phone.two-up": "two across";
10540
10534
  };
10541
- readonly waits: {
10542
- readonly "arrange.deck": {
10543
- readonly phase: "LI4";
10544
- readonly drawnAs: "row";
10545
- };
10546
- readonly "who.middle": {
10547
- readonly phase: "LI4";
10548
- readonly drawnAs: "none";
10549
- };
10550
- readonly "how.bigger": {
10551
- readonly phase: "LI4";
10552
- readonly drawnAs: null;
10553
- };
10554
- readonly "how.raised": {
10555
- readonly phase: "LI4";
10556
- readonly drawnAs: null;
10557
- };
10558
- readonly "how.brighter": {
10559
- readonly phase: "LI4";
10560
- readonly drawnAs: null;
10561
- };
10562
- };
10535
+ readonly waits: {};
10563
10536
  readonly defaults: {
10564
10537
  readonly item: "card";
10565
10538
  readonly arrange: "grid";
@@ -10884,5 +10857,5 @@ declare function applyLayoutEdits(page: LayoutPage, edits: ReadonlyArray<LayoutE
10884
10857
  /** The strict format a repair is asked in: `{ edits: [{ op, path, value }] }`, every key required. */
10885
10858
  declare function layoutRepairJsonSchema(): JsonSchema;
10886
10859
 
10887
- export { ACCOUNT_ENTRY_ID, ACTION_START_SCALE, ACTIVE_BUILD_STATUSES, AI_COMPOSED_PAGES_ESTIMATED, AI_PLAN_REASKED_PART, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_PART_TOKENS, AI_STEP_TYPICAL_TOKENS, ART_DIRECTION_PARTS, AiCallStatus, AiCapability, AiFeature, AiGenerationStage, AiKeyMode, AiLimit, AiNextKind, AiProviderId, AiRefusalCode, AiStep, BAR_ITEMS_MAX, BAR_ITEMS_MIN, BASELINE_ROLES, BUILD_STEPS, BaselineRole, BindScope, BuildNoticeCode, BuildStep, CONTENT_ROLE_MEANINGS, CREDITS_PER_USD, CardBindTarget, CheckSeverity, ComposeError, ComposeIssueCode, ContentFieldControl, ContentFieldType, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FIELD_TYPE_OF_CONTROL, FILL_ASPECT, FILM_PATTERN, FINAL_GENERATION_STAGES, FINDING_SEVERITY, FilmUnplaced, GRAMMAR_TOO_LARGE_MESSAGE, GlobalSlot, HEADER_TOKEN, HEBREW_PREFIXES, HeaderIngredient, HeaderMixError, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_CHECK_VIEWPORT, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_DRIFT, LAYOUT_EASING, LAYOUT_ENTRANCE_MAX_MS, LAYOUT_FONT_SIZE, LAYOUT_GUTTER, LAYOUT_HIDDEN_OPACITY, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, LAYOUT_LIST_TOKEN, LAYOUT_MIX_OFFERED, LAYOUT_MIX_WORDS, LAYOUT_OPERATED, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHONE_PADDING, LAYOUT_PHOTO_ASPECT, LAYOUT_READY_MADE_TOKEN, LAYOUT_RISE, LAYOUT_SCREEN_PX, LAYOUT_TEXT_KINDS, LAYOUT_TOOLTIP_TRAIT, LAYOUT_VIEWPORTS, LAYOUT_WIRE_AUTOPLAY_MS, LIST_CARD_PART, LIST_INGREDIENTS, LIST_LONG_WORDS, LIST_ROLE_WORDS, LIST_TABLE, LayoutAlign, LayoutBleed, LayoutButtonVariant, LayoutColour, LayoutColourMode, LayoutDepth, LayoutDial, LayoutEase, LayoutEditOp, LayoutEnter, LayoutGalleryEffect, LayoutGapCode, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMove, LayoutListPhone, LayoutListRole, LayoutListWho, LayoutMendKind, LayoutMixIngredient, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutPhotoSource, LayoutRole, LayoutSectionKind, LayoutSequenceToken, LayoutSide, LayoutSignatureId, LayoutSize, LayoutSourceChoice, LayoutTrackProp, LayoutTransition, LayoutViewport, MAX_SITE_PICTURES, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PHOTO_ANALYSIS_WIDTH, PHOTO_CALM_DETAIL, PHOTO_GRID, PHOTO_LIGHT_LUMINANCE, PICTURE_ASPECTS, PICTURE_NEVER, PICTURE_REAL_PLACE_FAMILIES, PICTURE_REROLL_EVERY, PICTURE_REVIEW_FORMAT, PICTURE_REVIEW_SHAPE, PICTURE_TEXT_CONTRAST, PICTURE_WORLDS, PICTURE_WORLD_IDS, PLAN_EDITS_ANSWER_SHAPES, PLAN_EDITS_PART_SCHEMA_NAMES, PLAN_EDIT_OP_PART, PLAN_EDIT_SHAPE, PLAN_EDIT_WIRE_KEYS, PLAN_PARTS, PLAN_PART_KEYS, PLAN_WIRE_DERIVED, PLAN_WIRE_PART_SCHEMA_NAMES, PLAN_WIRE_SHAPE, PRICING_PATTERN, PROOF_FINGERPRINTS, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PhotoTone, PictureRefusal, PictureWorld, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanPart, PlanWireEntry, PlanWireShapeError, PlanWordIssueCode, PreflightRefusalCode, PriceBindTarget, PublishRefusalCode, PublishScope, RENDER_CHECK, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, SCENE_LEVEL, SCENE_OTHER_PAGES, SCRIM_BACKGROUND, SCRIM_COVER, SCRIM_LEVELS, SHOP_CART_BUTTON_ID, SHOP_CART_DRAWER_ID, SHOP_FIELDS, SHOP_LATEST_LIMIT, SHOP_LIST_LIMIT, SHOP_NEED, SHOP_ONLY_CONTENT_ROLES, SHOP_PRODUCTS_MAX, SHOP_ROLES, SHOP_SLUG_FIELD, SHOWCASE_FILM, SHOWCASE_SHOP, SIGN_IN_DIALOG_ID, SITE_CHECKS, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_LIBRARY, SITE_LOCALES, SITE_NEED_IDS, SITE_PATTERNS, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_ARCHETYPES, SPEC_SITE_COPY_LENGTHS, SPEC_SITE_DENSITY_COPY, SPEC_SITE_FACTS, SPEC_SITE_LAYOUT, SPEC_SITE_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PICTURE_NEVER, SPEC_SITE_PICTURE_WORLDS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, STOCK_INTENT_SUBJECTS, STOCK_ITEM_ASPECT, STOCK_MIN_KEPT, STOCK_PROVIDER_TERMS, STOCK_SEED_MARGIN, STOCK_SUBJECT_WORDS, STORE_CONTACT_CODES, STRICT_SCHEMA_BUDGET, STRICT_SCHEMA_LIMITS, STUDIO_TEMPLATE, ScrimLevel, SectionFallbackLastResort, SectionSwapAction, SectionSwapRule, ShopResource, ShopSourceRole, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, StockIntent, StockOrientation, StockProviderId, StockReviewFlag, StockReviewVerdict, StockSlotKind, StockSubject, WORDS_AREA_DEFAULT_SHARE, WordsEdge, addBarItem, addStockCredits, aiRefusalNext, aiStepParts, applyLayoutEdits, applyOwnPhotoGalleries, applyPictureScrims, applyPlanEdits, applyStockItemPhotos, applyStockPhotos, archetypeIssues, areaLuminance, artDirectionFor, artDirectionIssues, artDirectionPreamble, aspectRatioOf, assertStyleSlots, assertValidSitePlan, auditLayoutMotion, auditSite, barIconForRoute, blocksPublish, brandHueWord, buildKeys, buildStepFacts, buildStepsOf, builtHomePageId, calmParts, calmUnder, checkLayout, checkList, chooseScrim, composeContextOf, composeLayout, composeNavHeader, composePresetForm, composeSection, composeSite, contentTypeOfSource, contentTypePreviewFields, contentTypeToWire, copyLengthOf, costUsd, coverCrop, createSerializedNode, creditsOfUsd, dataSourceToWire, derivedBeats, derivedDataSources, derivedShopSources, describeInventoryForPrompt, describeListShape, describePlanData, describeShapeKey, drawnHeaderMix, driftAt, driftOverlap, emptyAreaPhrase, entranceAction, entranceInteraction, estimatePictures, estimateStepCredits, expandLayoutWire, expandPlanWire, expandWireContentType, expandWireDataSource, expandWireEdit, expandWireField, expandWirePage, expandWireSection, expandWireShop, failedBuildStep, fallBackBySection, fieldToWire, filmOfPlan, filmPlacement, findNavRoot, fingerprintOf, frameWords, headerMeaning, headerMix, headerMixOfNavKind, headerMixOfPlan, headerReferences, headerTokenOf, headerTokenWords, headerWords, isActiveBuild, isLayoutRule, isNonEmptyString, isPictureWorld, isPlainObject, isRtlLocale, isShopResource, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, judgeLayoutRender, layerShownSpans, layoutBandScheme, layoutBoxPx, layoutColumnsVw, layoutDesignOf, layoutDialOf, layoutDriftPhoto, layoutElementStyle, layoutGalleryLists, layoutGallerySources, layoutGlideDepth, layoutHeldStill, layoutListBinding, layoutListShapes, layoutLookChanges, layoutLookOf, layoutMotionOf, layoutNodeClass, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutPathSteps, layoutPhotoIds, layoutPresetColours, layoutPresetOf, layoutRepairJsonSchema, layoutRoomPx, layoutRuleEdge, layoutShapeHasPurpose, layoutStillLine, layoutTextFits, layoutTextWidthEm, layoutToWire, layoutVoidScreens, layoutVoids, layoutWireJsonSchema, layoutWirePartWords, listBuiltWords, listIngredientWords, listMeaning, listTokenOf, listTokensOf, listWait, listWords, luminanceOf, measureLayout, mendLayout, menuAtEveryWidth, modelCanDo, moveBarItem, namedHeaderMix, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, orientationOfRatio, ownPhotoFit, pageListIssues, pageToWire, parseLayoutPhotoId, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternListGap, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneGapBefore, phoneMenuPages, phoneWordsColour, photoInventory, photoShapeOf, pictureAspect, pictureItemsOf, picturePrompt, pictureRefusalOf, pictureRerolls, pictureReviewIssues, pictureReviewJsonSchema, pictureReviewPasses, pictureSlotKey, pictureTargets, pictureTryFits, pixelsUnder, placeFilm, planEditOps, planEditToWire, planEditWireGaps, planEditWireKeys, planEditWireOps, planEditWireShape, planEditsFromWire, planEditsJsonSchema, planEditsToWire, planEntrances, planFromTemplate, planHasShopSource, planLayoutPhotos, planNavShape, planOwnPhotos, planPartOfPath, planPartToWire, planPictures, planSells, planStockPhotos, planToWire, planWireGaps, planWirePartJsonSchema, planWirePartShape, planWordIssues, pricesIn, publishRefusal, publishVerdict, readyMadeColumn, recipeListBinds, recomposeAsks, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, samenessIssues, sampleImageRef, scoreStockPhoto, screenFontSize, screenWordColumns, screenWordMisfit, screenWordOverflowPx, sectionEntrances, sectionPatternIds, sectionToWire, sectionTokenOf, sectionsNamed, sequenceShare, sequenceTokenOf, setStyleProps, shapeKeys, shopCategoriesOf, shopContentType, shopSourceAliases, showcaseGlobals, showcasePages, showcasePlans, showcaseScenes, showcaseStorePages, shownTogether, signatureOf, siteNavPages, siteSells, slotBudget, splitSide, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockFits, stockGroupOf, stockItemSlots, stockKept, stockPhotoRatio, stockPhotoSubject, stockPhotoUsable, stockPhotoWords, stockSlots, stockWord, stockWords, strictSchemaComplexity, strictSchemaRefusal, toneOf, typicalStepTokens, validatePlanEdits, validateSitePlan, variantNamesOf, walkSerialized, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema, wirePageJsonSchema, wireSectionJsonSchema, wireShopProductJsonSchema, withDerivedSources, wordPattern, wordsOverPhotos, wordsOverPicture, writtenTexts };
10860
+ export { ACCOUNT_ENTRY_ID, ACTION_START_SCALE, ACTIVE_BUILD_STATUSES, AI_COMPOSED_PAGES_ESTIMATED, AI_PLAN_REASKED_PART, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_FEATURE, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_PART_TOKENS, AI_STEP_TYPICAL_TOKENS, ART_DIRECTION_PARTS, AiCallStatus, AiCapability, AiFeature, AiGenerationStage, AiKeyMode, AiLimit, AiNextKind, AiProviderId, AiRefusalCode, AiStep, BAR_ITEMS_MAX, BAR_ITEMS_MIN, BASELINE_ROLES, BUILD_STEPS, BaselineRole, BindScope, BuildNoticeCode, BuildStep, CONTENT_ROLE_MEANINGS, CREDITS_PER_USD, CardBindTarget, CheckSeverity, ComposeError, ComposeIssueCode, ContentFieldControl, ContentFieldType, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FIELD_TYPE_OF_CONTROL, FILL_ASPECT, FILM_PATTERN, FINAL_GENERATION_STAGES, FINDING_SEVERITY, FilmUnplaced, GRAMMAR_TOO_LARGE_MESSAGE, GlobalSlot, HEADER_TOKEN, HEBREW_PREFIXES, HeaderIngredient, HeaderMixError, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_CHECK_VIEWPORT, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_DRIFT, LAYOUT_EASING, LAYOUT_ENTRANCE_MAX_MS, LAYOUT_FONT_SIZE, LAYOUT_GUTTER, LAYOUT_HIDDEN_OPACITY, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, LAYOUT_LIST_TOKEN, LAYOUT_MIX_OFFERED, LAYOUT_MIX_WORDS, LAYOUT_OPERATED, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHONE_PADDING, LAYOUT_PHOTO_ASPECT, LAYOUT_READY_MADE_TOKEN, LAYOUT_RISE, LAYOUT_SCREEN_PX, LAYOUT_TEXT_KINDS, LAYOUT_TOOLTIP_TRAIT, LAYOUT_VIEWPORTS, LAYOUT_WIRE_AUTOPLAY_MS, LIST_CARD_PART, LIST_INGREDIENTS, LIST_LONG_WORDS, LIST_ROLE_WORDS, LIST_TABLE, LayoutAlign, LayoutBleed, LayoutButtonVariant, LayoutColour, LayoutColourMode, LayoutDepth, LayoutDial, LayoutEase, LayoutEditOp, LayoutEnter, LayoutGalleryEffect, LayoutGapCode, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMove, LayoutListPhone, LayoutListRole, LayoutListWho, LayoutMendKind, LayoutMixIngredient, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutPhotoSource, LayoutRole, LayoutSectionKind, LayoutSequenceToken, LayoutSide, LayoutSignatureId, LayoutSize, LayoutSourceChoice, LayoutTrackProp, LayoutTransition, LayoutViewport, MAX_SITE_PICTURES, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PHOTO_ANALYSIS_WIDTH, PHOTO_CALM_DETAIL, PHOTO_GRID, PHOTO_LIGHT_LUMINANCE, PICTURE_ASPECTS, PICTURE_NEVER, PICTURE_REAL_PLACE_FAMILIES, PICTURE_REROLL_EVERY, PICTURE_REVIEW_FORMAT, PICTURE_REVIEW_SHAPE, PICTURE_TEXT_CONTRAST, PICTURE_WORLDS, PICTURE_WORLD_IDS, PLAN_EDITS_ANSWER_SHAPES, PLAN_EDITS_PART_SCHEMA_NAMES, PLAN_EDIT_OP_PART, PLAN_EDIT_SHAPE, PLAN_EDIT_WIRE_KEYS, PLAN_PARTS, PLAN_PART_KEYS, PLAN_WIRE_DERIVED, PLAN_WIRE_PART_SCHEMA_NAMES, PLAN_WIRE_SHAPE, PRICING_PATTERN, PROOF_FINGERPRINTS, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PhotoTone, PictureRefusal, PictureWorld, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanPart, PlanWireEntry, PlanWireShapeError, PlanWordIssueCode, PreflightRefusalCode, PriceBindTarget, PublishRefusalCode, PublishScope, RENDER_CHECK, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, SCENE_LEVEL, SCENE_OTHER_PAGES, SCRIM_BACKGROUND, SCRIM_COVER, SCRIM_LEVELS, SHOP_CART_BUTTON_ID, SHOP_CART_DRAWER_ID, SHOP_FIELDS, SHOP_LATEST_LIMIT, SHOP_LIST_LIMIT, SHOP_NEED, SHOP_ONLY_CONTENT_ROLES, SHOP_PRODUCTS_MAX, SHOP_ROLES, SHOP_SLUG_FIELD, SHOWCASE_FILM, SHOWCASE_SHOP, SIGN_IN_DIALOG_ID, SITE_CHECKS, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_LIBRARY, SITE_LOCALES, SITE_NEED_IDS, SITE_PATTERNS, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_ARCHETYPES, SPEC_SITE_COPY_LENGTHS, SPEC_SITE_DENSITY_COPY, SPEC_SITE_FACTS, SPEC_SITE_LAYOUT, SPEC_SITE_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PICTURE_NEVER, SPEC_SITE_PICTURE_WORLDS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, STOCK_INTENT_SUBJECTS, STOCK_ITEM_ASPECT, STOCK_MIN_KEPT, STOCK_PROVIDER_TERMS, STOCK_SEED_MARGIN, STOCK_SUBJECT_WORDS, STORE_CONTACT_CODES, STRICT_SCHEMA_BUDGET, STRICT_SCHEMA_LIMITS, STUDIO_TEMPLATE, ScrimLevel, SectionFallbackLastResort, SectionSwapAction, SectionSwapRule, ShopResource, ShopSourceRole, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, StockIntent, StockOrientation, StockProviderId, StockReviewFlag, StockReviewVerdict, StockSlotKind, StockSubject, WORDS_AREA_DEFAULT_SHARE, WordsEdge, addBarItem, addStockCredits, aiRefusalNext, aiStepParts, applyLayoutEdits, applyOwnPhotoGalleries, applyPictureScrims, applyPlanEdits, applyStockItemPhotos, applyStockPhotos, archetypeIssues, areaLuminance, artDirectionFor, artDirectionIssues, artDirectionPreamble, aspectRatioOf, assertStyleSlots, assertValidSitePlan, auditLayoutMotion, auditSite, barIconForRoute, blocksPublish, brandHueWord, buildKeys, buildStepFacts, buildStepsOf, builtHomePageId, calmParts, calmUnder, checkLayout, checkList, chooseScrim, composeContextOf, composeLayout, composeNavHeader, composePresetForm, composeSection, composeSite, contentTypeOfSource, contentTypePreviewFields, contentTypeToWire, copyLengthOf, costUsd, coverCrop, createSerializedNode, creditsOfUsd, dataSourceToWire, derivedBeats, derivedDataSources, derivedShopSources, describeInventoryForPrompt, describeListShape, describePlanData, describeShapeKey, drawnHeaderMix, driftAt, driftOverlap, emptyAreaPhrase, entranceAction, entranceInteraction, estimatePictures, estimateStepCredits, expandLayoutWire, expandPlanWire, expandWireContentType, expandWireDataSource, expandWireEdit, expandWireField, expandWirePage, expandWireSection, expandWireShop, factIssues, failedBuildStep, fallBackBySection, fieldToWire, filmOfPlan, filmPlacement, findNavRoot, fingerprintOf, frameWords, headerMeaning, headerMix, headerMixOfNavKind, headerMixOfPlan, headerReferences, headerTokenOf, headerTokenWords, headerWords, isActiveBuild, isLayoutRule, isNonEmptyString, isPictureWorld, isPlainObject, isRtlLocale, isShopResource, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, judgeLayoutRender, layerShownSpans, layoutBandScheme, layoutBoxPx, layoutColumnsVw, layoutDesignOf, layoutDialOf, layoutDriftPhoto, layoutElementStyle, layoutGalleryLists, layoutGallerySources, layoutGlideDepth, layoutHeldStill, layoutListBinding, layoutListShapes, layoutLookChanges, layoutLookOf, layoutMotionOf, layoutNodeClass, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutPathSteps, layoutPhotoIds, layoutPresetColours, layoutPresetOf, layoutRepairJsonSchema, layoutRoomPx, layoutRuleEdge, layoutShapeHasPurpose, layoutStillLine, layoutTextFits, layoutTextWidthEm, layoutToWire, layoutVoidScreens, layoutVoids, layoutWireJsonSchema, layoutWirePartWords, listBuiltWords, listIngredientWords, listMeaning, listTokenOf, listTokensOf, listWait, listWords, luminanceOf, measureLayout, mendLayout, menuAtEveryWidth, modelCanDo, moveBarItem, namedHeaderMix, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, orientationOfRatio, ownPhotoFit, pageListIssues, pageToWire, parseLayoutPhotoId, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternListGap, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneGapBefore, phoneMenuPages, phoneWordsColour, photoInventory, photoShapeOf, pictureAspect, pictureItemsOf, picturePrompt, pictureRefusalOf, pictureRerolls, pictureReviewIssues, pictureReviewJsonSchema, pictureReviewPasses, pictureSlotKey, pictureTargets, pictureTryFits, pixelsUnder, placeFilm, planEditOps, planEditToWire, planEditWireGaps, planEditWireKeys, planEditWireOps, planEditWireShape, planEditsFromWire, planEditsJsonSchema, planEditsToWire, planEntrances, planFromTemplate, planHasShopSource, planLayoutPhotos, planNavShape, planOwnPhotos, planPartOfPath, planPartToWire, planPictures, planSells, planStockPhotos, planToWire, planWireGaps, planWirePartJsonSchema, planWirePartShape, planWordIssues, pricesIn, publishRefusal, publishVerdict, readyMadeColumn, recipeListBinds, recomposeAsks, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, samenessIssues, sampleImageRef, scoreStockPhoto, screenFontSize, screenWordColumns, screenWordMisfit, screenWordOverflowPx, sectionEntrances, sectionPatternIds, sectionToWire, sectionTokenOf, sectionsNamed, sequenceShare, sequenceTokenOf, setStyleProps, shapeKeys, shopCategoriesOf, shopContentType, shopSourceAliases, showcaseGlobals, showcasePages, showcasePlans, showcaseScenes, showcaseStorePages, shownTogether, signatureOf, siteNavPages, siteSells, slotBudget, splitSide, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockFits, stockGroupOf, stockItemSlots, stockKept, stockPhotoRatio, stockPhotoSubject, stockPhotoUsable, stockPhotoWords, stockSlots, stockWord, stockWords, strictSchemaComplexity, strictSchemaRefusal, toneOf, typicalStepTokens, validatePlanEdits, validateSitePlan, variantNamesOf, walkSerialized, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema, wirePageJsonSchema, wireSectionJsonSchema, wireShopProductJsonSchema, withDerivedSources, wordPattern, wordsOverPhotos, wordsOverPicture, writtenTexts };
10888
10861
  export type { AddBarItemResult, AiBuyCredits, AiEntitlementsView, AiMeter, AiModelEntry, AiRefusal, AiTokenCounts, AiTokenPrice, AreaLuminance, ArtDirection, AuditPage, AuditPlaceholder, BarItemsEditResult, BuildNotice, BuildStepError, BuildStepFacts, BuildStepRecord, CalmReading, CheckLayoutContext, CmsDataSourcePlan, ComposeContext, ComposeIssue, ComposeLayoutOptions, ComposedDataSource, ComposedItem, ComposedLayout, ComposedNavHeader, ComposedPage, ComposedPlaceholder, ComposedProduct, ComposedRoute, ComposedSection, ComposedShop, ComposedSite, ContentFieldPlan, ContentRoles, ContentSeedPlan, ContentTypePlan, CreateNodeOptions, CreatedRecord, DataSourcePlan, DriftBox, DriftLayer, DriftMeeting, DynamicKeysAsList, EntranceAction, EntranceActionOptions, EntranceInteraction, EntranceMark, EntranceSpec, EntranceStamp, FactKey, FilmPlacement, FilmTarget, FingerprintedPage, FrameRegion, HeaderGap, HeaderMix, JsonSchema, LayoutBandMove, LayoutColours, LayoutEdit, LayoutFingerprint, LayoutForm, LayoutGallery, LayoutGalleryList, LayoutGap, LayoutGivenAway, LayoutIssue, LayoutLayer, LayoutListBinding, LayoutListMix, LayoutListShape, LayoutLook, LayoutMend, LayoutPage, LayoutPhotoAddress, LayoutReadyMade, LayoutRect, LayoutSection, LayoutSite, LayoutTrack, LayoutVoid, LayoutWire, LayoutWireLayer, LayoutWireList, LayoutWireOptions, LayoutWireSection, LayoutWireSlot, LayoutWireTrack, ListIngredient, ListWait, MeasuredLayer, MeasuredLayout, NavHeaderInput, NavHeaderOptions, NavPage, NavShapeOptions, NavShapeResult, NodeBaseline, OwnPhoto, OwnPhotoPlacement, PageArchetype, PageArchetypeId, PageArchetypeSlot, PageData, PageDataLine, PagePlan, PageSectionPlan, PageSeoPlan, PathIssue, PatternManifestEntry, PatternManifestOptions, PatternNode, PatternPath, PatternRoleNeed, PatternTrack, PhotoInventory, PhotoWordsArea, PicturePlan, PicturePlanOptions, PicturePromptContext, PictureReview, PictureSlot, PictureTryBudget, PictureWorldSpec, PicturesEstimate, PixelReading, PlacedFilm, PlainObject, PlanChange, PlanDirection, PlanEdit, PlanEditIssue, PlanEditResult, PlanEditsAnswer, PlanEntrancesInput, PlanFilm, PlanWireContext, PlanWireParts, PlanWordContext, PlanWordIssue, PreflightRefusal, PublishRefusal, RecipeListBinds, RelativeDataSourcePlan, ScrimChoice, SectionEntrances, SectionFallback, SectionInput, SectionJudge, SectionOptions, SectionSwap, SerializedBinding, SerializedNode, SerializedResponsive, ShapeEntry, ShapeIssueCodes, ShopDataSourcePlan, ShopOptionPlan, ShopPlan, ShopProductPlan, ShowcaseInput, SiteAudit, SiteAuditOptions, SiteAuditSnapshot, SiteBuildRun, SiteBusiness, SiteCheck, SiteFinding, SiteNeedId, SitePageRef, SitePattern, SitePlan, SitePlanContext, SitePlanIssue, SitePlanSource, SitePlanValidation, SiteTemplate, StockCredit, StockItemSlot, StockLink, StockNeed, StockPhoto, StockPhotoTraits, StockPlacement, StockPlanOptions, StockProviderTerms, StockReview, StockSlot, StockTarget, StrictSchemaComplexity, StrictSchemaRefusal, TemplatePlanInput, UndoKept, UndoPreview, UndoRecord, WireOptions, WordsArea, WrittenText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.111.0",
3
+ "version": "5.113.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -23,6 +23,10 @@
23
23
  "types": "./actions-core/index.d.ts",
24
24
  "default": "./fesm2022/vectoriox-iox-ui-actions-core.mjs"
25
25
  },
26
+ "./assist-core": {
27
+ "types": "./assist-core/index.d.ts",
28
+ "default": "./fesm2022/vectoriox-iox-ui-assist-core.mjs"
29
+ },
26
30
  "./commerce-core": {
27
31
  "types": "./commerce-core/index.d.ts",
28
32
  "default": "./fesm2022/vectoriox-iox-ui-commerce-core.mjs"
@@ -0,0 +1,73 @@
1
+ import { AssistField } from './content-fields';
2
+ import { isEmptyFieldValue, isPlainRecord } from './field-values';
3
+ import { ContentRecord } from './summarize-item';
4
+
5
+ /**
6
+ * The ONE locale a content-item turn writes in (plan §3c rule 8, trap T5) — decided the same way by the server and the
7
+ * client: a multiLang field gets this key and no other. The sentence decides when it names a language ("translate the
8
+ * summary to English", "תרגם לאנגלית") — matched against the runtime's own language names (`Intl.DisplayNames`) in the
9
+ * languages the admin speaks, never a hand-kept list; the last one named wins. Otherwise the item's own language: the
10
+ * locale most of its multiLang fields are filled in (schema order breaks a tie); else the admin's; else the first.
11
+ */
12
+
13
+ /** The languages whose names a sentence may use — the admin's two UI languages. */
14
+ export const LOCALE_NAME_LANGUAGES: ReadonlyArray<string> = ['en', 'he'];
15
+
16
+ const DISPLAY_TYPE_LANGUAGE = 'language';
17
+
18
+ /** Every locale the type's multiLang fields hold, in schema order. */
19
+ export function itemLocales(fields: ReadonlyArray<AssistField>): string[] {
20
+ return [...new Set(fields.flatMap(f => f.locales ?? []))];
21
+ }
22
+
23
+ function displayName(locale: string, inLanguage: string): string | null {
24
+ try {
25
+ const name = new Intl.DisplayNames([inLanguage], { type: DISPLAY_TYPE_LANGUAGE }).of(locale);
26
+ return name && name !== locale ? name : null;
27
+ } catch {
28
+ return null;
29
+ }
30
+ }
31
+
32
+ function languageNames(locale: string, languages: ReadonlyArray<string>): string[] {
33
+ return languages.flatMap(lang => {
34
+ const name = displayName(locale, lang);
35
+ return name ? [name.toLowerCase()] : [];
36
+ });
37
+ }
38
+
39
+ /** The last position a locale's name appears at in the sentence, or -1. */
40
+ function lastMention(sentence: string, locale: string, languages: ReadonlyArray<string>): number {
41
+ const s = sentence.toLowerCase();
42
+ return Math.max(-1, ...languageNames(locale, languages).map(n => s.lastIndexOf(n)));
43
+ }
44
+
45
+ /** The locale the sentence names; the last one named wins ("the Hebrew summary to English" → en). */
46
+ export function namedLocale(sentence: string, locales: ReadonlyArray<string>, languages: ReadonlyArray<string> = LOCALE_NAME_LANGUAGES): string | null {
47
+ const named = locales
48
+ .map(locale => ({ locale, at: lastMention(sentence, locale, languages) }))
49
+ .filter(m => m.at >= 0)
50
+ .sort((a, b) => b.at - a.at);
51
+ return named[0]?.locale ?? null;
52
+ }
53
+
54
+ /** The locale most of the item's multiLang fields are filled in (schema order breaks a tie); else the UI's; else the first. */
55
+ export function primaryLocale(fields: ReadonlyArray<AssistField>, values: ContentRecord, uiLang: string): string {
56
+ const locales = itemLocales(fields);
57
+ if (!locales.length) return uiLang;
58
+ const filled = (locale: string) => fields.filter(f => {
59
+ const v = values[f.key];
60
+ return f.locales?.includes(locale) && isPlainRecord(v) && !isEmptyFieldValue(v[locale]);
61
+ }).length;
62
+ const best = locales.reduce((a, b) => (filled(b) > filled(a) ? b : a));
63
+ if (filled(best) > 0) return best;
64
+ return locales.includes(uiLang) ? uiLang : locales[0];
65
+ }
66
+
67
+ /** The write locale of a content-item turn. */
68
+ export function turnLocale(sentence: string, fields: ReadonlyArray<AssistField>, values: ContentRecord, uiLang: string): string {
69
+ return namedLocale(sentence, itemLocales(fields)) ?? primaryLocale(fields, values, uiLang);
70
+ }
71
+
72
+ /** The language's own name in the admin's language (`en` → "English" / "אנגלית"). */
73
+ export const languageName = (locale: string, uiLang: string): string => displayName(locale, uiLang) ?? locale;
@@ -0,0 +1,240 @@
1
+ import { AROUND_TEXT_CHARS, MEMORY_TURNS } from './budget';
2
+ import { AssistIssue, AssistIssueCode, Brief, HandleMap } from './brief';
3
+ import { FieldChange } from './field-edits';
4
+ import { FieldEdit } from './fields-schema';
5
+ import { ContentRecord, clipText } from './summarize-item';
6
+ import { AssistSurface, CommitKind, EditFamily, SURFACES, SurfaceStatus } from './surfaces';
7
+
8
+ /**
9
+ * The turn wire (plan §3d) — what cms-client posts and polls and iox-cms stores and answers, ONE definition both sides
10
+ * import (generation-core `ai-run.ts` is the precedent for generations). A turn is a document on the jobs runner:
11
+ * POST answers 202 `{ turnId }`, the client polls the turn every 750 ms until it is terminal.
12
+ */
13
+
14
+ export enum AssistTurnStatus {
15
+ Queued = 'queued',
16
+ Routing = 'routing',
17
+ Editing = 'editing',
18
+ Done = 'done',
19
+ Refused = 'refused',
20
+ Failed = 'failed',
21
+ }
22
+
23
+ const TERMINAL: ReadonlySet<AssistTurnStatus> = new Set([AssistTurnStatus.Done, AssistTurnStatus.Refused, AssistTurnStatus.Failed]);
24
+
25
+ export const isTerminalTurn = (status: AssistTurnStatus): boolean => TERMINAL.has(status);
26
+
27
+ /** Auto = the step's model from Settings ▸ AI ▸ Models (A-D14). */
28
+ export const ASSIST_MODEL_AUTO = 'auto';
29
+
30
+ /** `'auto'` or a model id. */
31
+ export type AssistModelChoice = typeof ASSIST_MODEL_AUTO | string;
32
+
33
+ export const ASSIST_POLL_MS = 750;
34
+
35
+ export const MAX_SENTENCE_CHARS = 2000;
36
+
37
+ export interface AssistTurnRequest {
38
+ readonly surface: AssistSurface;
39
+ /** `assistSessionKey(surface, target)`; the server adds the user. */
40
+ readonly sessionKey: string;
41
+ readonly sentence: string;
42
+ readonly model: AssistModelChoice;
43
+ readonly contentType?: string;
44
+ readonly itemId?: string;
45
+ readonly brief: Brief;
46
+ readonly handles: HandleMap;
47
+ /** A form-fill surface: the form's current values (it may be unsaved) — the edits are checked against them. */
48
+ readonly values?: ContentRecord;
49
+ /** Field keys the owner changed since the last AI turn — kept unless the sentence names them (rule 9). */
50
+ readonly ownerEdited?: ReadonlyArray<string>;
51
+ }
52
+
53
+ /** POST's 202 answer. */
54
+ export interface AssistTurnAccepted {
55
+ readonly turnId: string;
56
+ }
57
+
58
+ /** A turn's own refusals and failures, beside generation-core's `AiRefusalCode`s (credits, plan, key), which a turn returns as they are. */
59
+ export enum AssistRefusalCode {
60
+ /** The turn machinery runs, no model is connected yet. */
61
+ NotConnected = 'ai.assistNotConnected',
62
+ /** The turn spent its own credit cap (trap T8) before a call it still needed. */
63
+ TurnBudget = 'ai.assistTurnBudget',
64
+ /** The routed families need a permission the person who asked does not hold. */
65
+ Permission = 'ai.assistPermission',
66
+ /** A process died during this turn's call more often than one resume allows. */
67
+ Interrupted = 'ai.assistInterrupted',
68
+ /** The provider call threw — the turn ends; the owner may ask again. */
69
+ CallFailed = 'ai.assistCallFailed',
70
+ /** The model's answer broke the check twice (the first time it was re-asked with the issues). */
71
+ InvalidAnswer = 'ai.assistInvalidAnswer',
72
+ /** The chosen model is not on the vetted list for this step, and the turn runs on IOX credits. */
73
+ ModelNotOffered = 'ai.assistModelNotOffered',
74
+ /** The chosen model cannot do the step (on the studio's own key any model may be typed; this one lacks a need). */
75
+ ModelDeclined = 'ai.assistModelDeclined',
76
+ }
77
+
78
+ export interface AssistTurnRefusal {
79
+ /** An `AssistRefusalCode` or an `AiRefusalCode` — a string, so both fit. */
80
+ readonly code: string;
81
+ readonly message: string;
82
+ }
83
+
84
+ export interface AssistTurn {
85
+ readonly id: string;
86
+ readonly surface: AssistSurface;
87
+ readonly sessionKey: string;
88
+ readonly status: AssistTurnStatus;
89
+ readonly sentence: string;
90
+ /** The model it ran on (Auto resolved) — the one the ledger row names (R-H11). */
91
+ readonly model?: string;
92
+ readonly families?: ReadonlyArray<EditFamily>;
93
+ readonly reply?: string;
94
+ readonly edits?: ReadonlyArray<FieldEdit>;
95
+ readonly changes?: ReadonlyArray<FieldChange>;
96
+ readonly kept?: ReadonlyArray<FieldChange>;
97
+ readonly issues?: ReadonlyArray<AssistIssue>;
98
+ readonly refusal?: AssistTurnRefusal;
99
+ readonly credits?: number;
100
+ /** ISO time. */
101
+ readonly createdAt: string;
102
+ }
103
+
104
+ export enum AssistRouteKey {
105
+ Turns = 'turns',
106
+ Turn = 'turn',
107
+ Session = 'session',
108
+ }
109
+
110
+ /** The path templates, `:param` filled by `assistPath` — neither side hand-types a URL. */
111
+ export const ASSIST_ROUTES: Readonly<Record<AssistRouteKey, string>> = {
112
+ [AssistRouteKey.Turns]: 'admin/api/org/:orgId/ai/assist/turns',
113
+ [AssistRouteKey.Turn]: 'admin/api/org/:orgId/ai/assist/turns/:turnId',
114
+ [AssistRouteKey.Session]: 'admin/api/org/:orgId/ai/assist/sessions/:sessionKey',
115
+ };
116
+
117
+ export class AssistPathError extends Error {}
118
+
119
+ /** A route with its params filled, each URL-encoded; a missing param throws. */
120
+ export function assistPath(route: AssistRouteKey, params: Readonly<Record<string, string>>): string {
121
+ return ASSIST_ROUTES[route].replace(/:([A-Za-z]+)/g, (_, name: string) => {
122
+ const value = params[name];
123
+ if (!value) throw new AssistPathError(`${route}: no ${name}`);
124
+ return encodeURIComponent(value);
125
+ });
126
+ }
127
+
128
+ /** What a session is about, beside its surface (A-D9: per user × surface × target). */
129
+ export interface AssistTarget {
130
+ readonly contentType?: string;
131
+ readonly itemId?: string | null;
132
+ readonly pageId?: string;
133
+ readonly submissionId?: string;
134
+ }
135
+
136
+ const SESSION_TARGET_KEYS: Readonly<Record<AssistSurface, ReadonlyArray<keyof AssistTarget>>> = {
137
+ [AssistSurface.BuilderPage]: ['pageId'],
138
+ [AssistSurface.ContentItem]: ['contentType', 'itemId'],
139
+ [AssistSurface.ContentFromPhotos]: ['contentType'],
140
+ [AssistSurface.ContentList]: ['contentType'],
141
+ [AssistSurface.SchemaType]: ['contentType'],
142
+ [AssistSurface.ShopProduct]: ['itemId'],
143
+ [AssistSurface.Media]: [],
144
+ [AssistSurface.BuilderSite]: [],
145
+ [AssistSurface.FormInbox]: ['submissionId'],
146
+ };
147
+
148
+ /** A target not saved yet. */
149
+ export const NEW_TARGET = 'new';
150
+ const SESSION_SEPARATOR = ':';
151
+
152
+ /** `contentItem:projects:<itemId|new>` — each part encoded, so a value never carries the separator. */
153
+ export function assistSessionKey(surface: AssistSurface, target: AssistTarget = {}): string {
154
+ const parts = SESSION_TARGET_KEYS[surface].map(k => encodeURIComponent(target[k] || NEW_TARGET));
155
+ return [surface, ...parts].join(SESSION_SEPARATOR);
156
+ }
157
+
158
+ export interface AssistMemoryLine {
159
+ readonly turnId: string;
160
+ readonly createdAt: string;
161
+ readonly line: string;
162
+ }
163
+
164
+ const SENTENCE_IN_MEMORY_CHARS = 80;
165
+
166
+ function outcome(turn: AssistTurn): string {
167
+ const named = (list: ReadonlyArray<FieldChange> | undefined) =>
168
+ (list ?? []).map(c => (c.locale ? `${c.label} (${c.locale})` : c.label)).join(', ');
169
+ switch (turn.status) {
170
+ case AssistTurnStatus.Refused: return `refused: ${turn.refusal?.message ?? ''}`.trim();
171
+ case AssistTurnStatus.Failed: return 'failed';
172
+ case AssistTurnStatus.Done: {
173
+ const changed = named(turn.changes);
174
+ const kept = named(turn.kept);
175
+ const head = changed ? `changed ${changed}` : `no change${turn.reply ? `: ${turn.reply}` : ''}`;
176
+ return kept ? `${head}; kept ${kept} (the owner edited it)` : head;
177
+ }
178
+ default: return turn.status;
179
+ }
180
+ }
181
+
182
+ /** One line the next turn reads as memory — never a tree, a record or a value. */
183
+ export function memoryLine(turn: AssistTurn): AssistMemoryLine {
184
+ const asked = clipText(turn.sentence.replace(/\s+/g, ' ').trim(), SENTENCE_IN_MEMORY_CHARS);
185
+ return { turnId: turn.id, createdAt: turn.createdAt, line: clipText(`"${asked}" → ${outcome(turn)}`, AROUND_TEXT_CHARS) };
186
+ }
187
+
188
+ /** `GET …/ai/assist/sessions/:sessionKey` — the memory the next turn is sent. */
189
+ export interface AssistSession {
190
+ readonly sessionKey: string;
191
+ readonly lines: ReadonlyArray<AssistMemoryLine>;
192
+ }
193
+
194
+ /** A session's answer from its stored turns (those of another session are ignored). */
195
+ export function assistSession(sessionKey: string, turns: ReadonlyArray<AssistTurn>): AssistSession {
196
+ return { sessionKey, lines: sessionMemory(turns.filter(t => t.sessionKey === sessionKey)) };
197
+ }
198
+
199
+ /** A session's memory: its last `MEMORY_TURNS` finished turns, oldest first. */
200
+ export function sessionMemory(turns: ReadonlyArray<AssistTurn>): AssistMemoryLine[] {
201
+ return turns
202
+ .filter(t => isTerminalTurn(t.status))
203
+ .slice()
204
+ .sort((a, b) => a.createdAt.localeCompare(b.createdAt))
205
+ .slice(-MEMORY_TURNS)
206
+ .map(memoryLine);
207
+ }
208
+
209
+ const isObject = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
210
+ const nonEmpty = (v: unknown): v is string => typeof v === 'string' && v.trim() !== '';
211
+
212
+ /** Absent, or a list of non-empty field keys. */
213
+ const isOwnerEdited = (v: unknown): boolean => v === undefined || (Array.isArray(v) && v.every(nonEmpty));
214
+
215
+ /** A key `assistSessionKey` made for this surface. */
216
+ export const isSessionOf = (key: unknown, surface: AssistSurface): boolean =>
217
+ nonEmpty(key) && (key === surface || key.startsWith(`${surface}${SESSION_SEPARATOR}`));
218
+
219
+ /** What the server refuses in a posted turn before anything runs. Empty = accepted. */
220
+ export function validateTurnRequest(req: unknown): AssistIssue[] {
221
+ const issue = (code: AssistIssueCode, message: string): AssistIssue => ({ code, message });
222
+ if (!isObject(req)) return [issue(AssistIssueCode.BadRequest, 'a turn is an object')];
223
+ const surface = req['surface'] as AssistSurface;
224
+ const spec = Object.prototype.hasOwnProperty.call(SURFACES, surface) ? SURFACES[surface] : undefined;
225
+ if (!spec) return [issue(AssistIssueCode.UnknownSurface, `"${String(surface)}" is not a surface`)];
226
+ const sentence = req['sentence'];
227
+ const brief = req['brief'];
228
+ return [
229
+ ...(spec.status !== SurfaceStatus.Built ? [issue(AssistIssueCode.SurfaceNotBuilt, `${surface} is not built yet`)] : []),
230
+ ...(!isSessionOf(req['sessionKey'], surface) ? [issue(AssistIssueCode.BadRequest, `the session key is not a ${surface} session`)] : []),
231
+ ...(!nonEmpty(sentence) ? [issue(AssistIssueCode.EmptySentence, 'the sentence is empty')] : []),
232
+ ...(nonEmpty(sentence) && sentence.length > MAX_SENTENCE_CHARS ? [issue(AssistIssueCode.SentenceTooLong, `the sentence is over ${MAX_SENTENCE_CHARS} characters`)] : []),
233
+ ...(!nonEmpty(req['model']) ? [issue(AssistIssueCode.BadRequest, 'no model choice (auto or a model id)')] : []),
234
+ ...(!isObject(brief) || brief['surface'] !== surface ? [issue(AssistIssueCode.BadRequest, `the brief is not a ${surface} brief`)] : []),
235
+ ...(!isObject(req['handles']) || !Object.keys(req['handles']).length ? [issue(AssistIssueCode.MissingHandles, 'the brief\'s handles are missing')] : []),
236
+ ...(spec.commit === CommitKind.FormFill && !isObject(req['values']) ? [issue(AssistIssueCode.MissingValues, 'a form-fill turn carries the form\'s values')] : []),
237
+ ...(!isOwnerEdited(req['ownerEdited']) ? [issue(AssistIssueCode.BadRequest, 'ownerEdited is a list of field keys')] : []),
238
+ ...(spec.perContentType && !nonEmpty(req['contentType']) ? [issue(AssistIssueCode.BadRequest, `${surface} names its content type`)] : []),
239
+ ];
240
+ }
@@ -0,0 +1,98 @@
1
+ import { AssistScope, AssistSurface, EditFamily } from './surfaces';
2
+
3
+ /**
4
+ * The brief (plan §3c): what the model is told, built by CODE from what the screen holds, sized by distance from the
5
+ * focus. It names things by HANDLE (`f.summary`, `s2`), never by id (rule 3); the handle map that goes with it is
6
+ * kept by the caller and the server, never sent.
7
+ */
8
+ export interface Brief<TFocus = unknown, TAround = unknown> {
9
+ readonly surface: AssistSurface;
10
+ /** The thing the sentence is about, in full. */
11
+ readonly focus: TFocus;
12
+ /** Its neighbourhood, summarised. */
13
+ readonly around: TAround;
14
+ /** The business reading (kind, voice, facts, languages) — the caller passes it; null when there is none. */
15
+ readonly owner: string | null;
16
+ readonly rules: BriefRules;
17
+ /** The session's last turns, one line each, oldest first. */
18
+ readonly memory: ReadonlyArray<string>;
19
+ }
20
+
21
+ export interface BriefRules {
22
+ /** The families a turn on this focus may answer in. */
23
+ readonly families: ReadonlyArray<EditFamily>;
24
+ /** The locale words are written in (a multiLang field gets this one key). */
25
+ readonly locale: string;
26
+ /** What is never written here, each with why — the model leaves it and says it "needs you". */
27
+ readonly never: ReadonlyArray<NeverWrite>;
28
+ /** The focus rung and the rungs it can widen to. */
29
+ readonly scope: AssistScope;
30
+ readonly widensTo: ReadonlyArray<AssistScope>;
31
+ }
32
+
33
+ export interface NeverWrite {
34
+ readonly handle: string;
35
+ readonly label: string;
36
+ readonly reason: string;
37
+ }
38
+
39
+ /** What a handle stands for. `path` is the key path inside the target; `id` a record the handle names (never sent). */
40
+ export interface HandleTarget {
41
+ readonly key: string;
42
+ readonly path: ReadonlyArray<string>;
43
+ readonly id?: string;
44
+ }
45
+
46
+ export type HandleMap = Readonly<Record<string, HandleTarget>>;
47
+
48
+ export enum AssistIssueCode {
49
+ UnknownHandle = 'unknownHandle',
50
+ NeverWrite = 'neverWrite',
51
+ WrongType = 'wrongType',
52
+ NotAnOption = 'notAnOption',
53
+ Duplicate = 'duplicate',
54
+ WrongLocale = 'wrongLocale',
55
+ HtmlNotAllowed = 'htmlNotAllowed',
56
+ UnknownFamily = 'unknownFamily',
57
+ BadRequest = 'badRequest',
58
+ UnknownSurface = 'unknownSurface',
59
+ SurfaceNotBuilt = 'surfaceNotBuilt',
60
+ EmptySentence = 'emptySentence',
61
+ SentenceTooLong = 'sentenceTooLong',
62
+ MissingHandles = 'missingHandles',
63
+ MissingValues = 'missingValues',
64
+ }
65
+
66
+ export interface AssistIssue {
67
+ readonly code: AssistIssueCode;
68
+ readonly handle?: string;
69
+ readonly message: string;
70
+ }
71
+
72
+ /** A caller's mistake building a brief (a focus that is not on the screen) — never a model answer. */
73
+ export class AssistBriefError extends Error {
74
+ constructor(readonly code: AssistIssueCode, message: string) {
75
+ super(message);
76
+ }
77
+ }
78
+
79
+ export type HandleResolution = { ok: true; target: HandleTarget } | { ok: false; issue: AssistIssue };
80
+
81
+ /** The one way a handle becomes a key: an unknown handle is refused, never guessed (trap T1). */
82
+ export function resolveHandle(handles: HandleMap, handle: string): HandleResolution {
83
+ const target = Object.prototype.hasOwnProperty.call(handles, handle) ? handles[handle] : undefined;
84
+ if (target) return { ok: true, target };
85
+ return { ok: false, issue: { code: AssistIssueCode.UnknownHandle, handle, message: `"${handle}" is not a handle of this brief` } };
86
+ }
87
+
88
+ /** Every handle of the list that the brief does not know. */
89
+ export function unknownHandles(handles: HandleMap, list: ReadonlyArray<string>): AssistIssue[] {
90
+ return list.flatMap(h => {
91
+ const r = resolveHandle(handles, h);
92
+ return 'issue' in r ? [r.issue] : [];
93
+ });
94
+ }
95
+
96
+ export const FIELD_HANDLE_PREFIX = 'f.';
97
+ export const SIBLING_HANDLE_PREFIX = 's';
98
+ export const fieldHandle = (key: string): string => `${FIELD_HANDLE_PREFIX}${key}`;
@@ -0,0 +1,34 @@
1
+ import { JsonSchema, STRICT_SCHEMA_BUDGET, strictSchemaComplexity } from '@vectoriox/iox-ui/generation-core';
2
+
3
+ /** The house budget every Assist request is held to (plan F6, trap T7) — generation-core's, never a copy and never raised. */
4
+ export const MAX_ASSIST_PROPERTIES = STRICT_SCHEMA_BUDGET.properties;
5
+
6
+ /** The route request is small and fast (plan §3a). */
7
+ export const MAX_ROUTE_PROPERTIES = 12;
8
+
9
+ /** Around-layer text is a summary: at most this many characters per value (plan §3c). */
10
+ export const AROUND_TEXT_CHARS = 160;
11
+
12
+ /** Sibling items sent as examples of voice (plan §3c: 3–5). */
13
+ export const AROUND_ITEMS_MAX = 5;
14
+
15
+ /** The session memory sent with a turn: the last turns, one line each (plan §3c). */
16
+ export const MEMORY_TURNS = 6;
17
+
18
+ export class AssistBudgetError extends Error {}
19
+
20
+ /** What a request's strict schemas break of the house budget — empty when it fits. */
21
+ export function assistBudgetIssues(schemas: ReadonlyArray<JsonSchema>, maxProperties: number = MAX_ASSIST_PROPERTIES): string[] {
22
+ const c = strictSchemaComplexity(schemas);
23
+ return [
24
+ ...c.unsupported,
25
+ ...(c.properties > maxProperties ? [`${c.properties} properties (budget ${maxProperties})`] : []),
26
+ ...(c.optional > STRICT_SCHEMA_BUDGET.optional ? [`${c.optional} optional (budget ${STRICT_SCHEMA_BUDGET.optional})`] : []),
27
+ ...(c.unions > STRICT_SCHEMA_BUDGET.unions ? [`${c.unions} unions (budget ${STRICT_SCHEMA_BUDGET.unions})`] : []),
28
+ ];
29
+ }
30
+
31
+ export function assertAssistBudget(name: string, schemas: ReadonlyArray<JsonSchema>, maxProperties?: number): void {
32
+ const issues = assistBudgetIssues(schemas, maxProperties);
33
+ if (issues.length) throw new AssistBudgetError(`${name}: ${issues.join('; ')}`);
34
+ }