@vectoriox/iox-ui 5.60.0 → 5.61.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.
@@ -5897,57 +5897,129 @@ declare enum AiCallStatus {
5897
5897
  }
5898
5898
 
5899
5899
  /**
5900
- * The structured-output format a model writes a Site Plan in (AI plan §3d step 4, M1-3) — built from the SAME shape
5901
- * table `validateSitePlan` reads (`SPEC_SITE_PLAN_SHAPE`) and the SAME pattern library, so the plan a model is told
5902
- * about is the plan the gate refuses. ONE source: a key the table gains breaks this builder until it is written here.
5900
+ * The plan WIRE (AI plan M1-3, vectoriox/iox-cms#45): what a model writes when it plans a site — a compact format inside
5901
+ * the Claude API's structured-output limits (≤ 24 optional parameters and ≤ 16 unions per request; `strict-schema.ts`).
5902
+ * The Site Plan itself (`SPEC_SITE_PLAN_SHAPE`) has 213 optional keys once every pattern is a branch, so the model never
5903
+ * writes it: it writes this, and ONE pure `expandPlanWire` turns it into the Site Plan that `validateSitePlan` and the
5904
+ * stage's gate judge exactly as before.
5903
5905
  *
5904
- * Two maps of the shape are written as LISTS on the wire, because no strict mode can say "any key": a section's
5905
- * `slots` (`[{ slot, text }]`, the slot names closed per pattern) and a seed's field values (`values: [{ field,
5906
- * value }]`). `sitePlanFromWire` turns them back; nothing else differs. Every section is one `anyOf` branch per
5907
- * pattern — its id, its declared slots, its optional parts, a binding only when it takes one — and the design, the
5908
- * source and the version are PINNED to the owner's pick and this run (one-value enums), so the provider cannot let
5909
- * a model change the look. The gate still checks both (`plan.design` deep-equals the pick).
5906
+ * - **Every key required.** A plan key that may be absent is written with its stated "none" — `''`, `0`, `false`, `[]`.
5907
+ * - **Closed lists as enums** (patterns, page types, needs, slots, parts, forms, entrances, header/footer), from the
5908
+ * contract — never per-pattern branches: the gate refuses a slot or a part the chosen pattern does not have, with its path.
5909
+ * - **Maps as lists:** slots `[{ slot, text }]`, links `[{ slot, route }]`, seed values `[{ field, value }]`, roles fixed.
5910
+ * - **One data source object** for both kinds; `type` says which keys are read (the other kind's hold their none).
5911
+ * - **What the model does not decide is not on the wire** (`PLAN_WIRE_DERIVED`): the look (the owner's pick), the run,
5912
+ * the language (the reading's), the facts (the owner's own, verbatim), the version, the home page (the page at `/`).
5913
+ * So the format is the same for every studio and every run — one compiled grammar, cached by the provider.
5914
+ *
5915
+ * ONE source: every wire key names the plan keys it carries (`refs`) and is described in the plan table's own words, and
5916
+ * every plan key is either carried or derived (`planWireGaps()`); a key the plan shape gains breaks the builder until it
5917
+ * is placed. The expanders translate, never repair: a value the model got wrong stays wrong, for the gate to refuse.
5910
5918
  */
5911
- declare const SITE_PLAN_SCHEMA_NAME = "site_plan";
5912
- /** The wire keys of the two maps written as lists. */
5913
- declare enum SitePlanWireKey {
5914
- SlotName = "slot",
5915
- SlotText = "text",
5916
- SeedValues = "values",
5917
- SeedField = "field",
5918
- SeedValue = "value"
5919
- }
5920
- interface SitePlanSchemaPin {
5921
- /** The owner's pick, verbatim — every design key becomes a one-value enum. */
5922
- design: DesignChoices;
5923
- /** This generation. */
5924
- source: SitePlanSource;
5919
+ declare const PLAN_WIRE_SCHEMA_NAME = "site_plan";
5920
+ declare enum PlanWireEntry {
5921
+ Plan = "plan",
5922
+ Business = "business",
5923
+ ContentType = "contentType",
5924
+ Roles = "roles",
5925
+ Field = "field",
5926
+ Seed = "seed",
5927
+ SeedValue = "seedValue",
5928
+ DataSource = "dataSource",
5929
+ Page = "page",
5930
+ PageSeo = "pageSeo",
5931
+ Section = "section",
5932
+ SlotText = "slotText",
5933
+ SlotLink = "slotLink",
5934
+ Globals = "globals"
5935
+ }
5936
+ /** The plan keys the model does not write, and where the expander takes each from. */
5937
+ declare const PLAN_WIRE_DERIVED: Readonly<Record<string, string>>;
5938
+ /** The wire's shape table, in the plan table's words — what the model reads, and what the format is built from. */
5939
+ declare const PLAN_WIRE_SHAPE: Readonly<Record<`${PlanWireEntry}`, ShapeEntry>>;
5940
+ /** Plan keys neither carried by a wire key nor derived — always empty (a spec and the builder hold it). */
5941
+ declare function planWireGaps(): string[];
5942
+ declare class PlanWireShapeError extends Error {
5925
5943
  }
5926
- /** A content type's field. */
5927
- declare function fieldJsonSchema(): JsonSchema;
5928
- /** A content type, its seed's field values as a list (`values: [{ field, value }]`). */
5929
- declare function contentTypeJsonSchema(): JsonSchema;
5930
- /** A data source: a cms list / single item, or a relative one. */
5931
- declare function dataSourceJsonSchema(): JsonSchema;
5932
5944
  /** The patterns a page section may use (every non-global one), in library order. */
5933
5945
  declare function sectionPatternIds(): string[];
5934
- /** A page section: one branch per pattern. */
5935
- declare function sectionJsonSchema(): JsonSchema;
5936
- /** A page. */
5937
- declare function pageJsonSchema(): JsonSchema;
5938
- /** The Site Plan format, pinned to the owner's pick and this run. */
5939
- declare function sitePlanJsonSchema(pin: SitePlanSchemaPin): JsonSchema;
5940
- /** A section off the wire: its slots back to a map; a key the pattern has nothing for (`{}`) dropped. */
5941
- declare function sectionFromWire(section: unknown): unknown;
5942
- /** A content type off the wire: its seed's `values` list back to field keys. */
5943
- declare function contentTypeFromWire(type: unknown): unknown;
5946
+ declare function wireFieldJsonSchema(): JsonSchema;
5947
+ declare function wireContentTypeJsonSchema(): JsonSchema;
5948
+ declare function wireDataSourceJsonSchema(): JsonSchema;
5949
+ declare function wireSectionJsonSchema(): JsonSchema;
5950
+ declare function wirePageJsonSchema(): JsonSchema;
5951
+ /** The format a model writes a plan in. The same for every studio and run: nothing in it is pinned. */
5952
+ declare function planWireJsonSchema(): JsonSchema;
5953
+ /** What the plan takes from the generation, not from the model. */
5954
+ interface PlanWireContext {
5955
+ design: DesignChoices;
5956
+ source: SitePlanSource;
5957
+ /** The owner's own facts (the analysis's, as corrected), verbatim. */
5958
+ facts?: Readonly<Partial<Record<FactKey, string>>>;
5959
+ locale?: `${SiteLocale}`;
5960
+ }
5961
+ declare function expandWireField(wire: unknown): ContentFieldPlan | unknown;
5962
+ declare function expandWireContentType(wire: unknown): ContentTypePlan | unknown;
5963
+ declare function expandWireDataSource(wire: unknown): DataSourcePlan | unknown;
5964
+ declare function expandWireSection(wire: unknown): PageSectionPlan | unknown;
5965
+ declare function expandWirePage(wire: unknown): PagePlan | unknown;
5966
+ /**
5967
+ * A model's plan (the wire) + what the generation decides (the look, the run, the language, the owner's facts) → the
5968
+ * Site Plan. Pure. Translates, never repairs: whatever the answer got wrong is still wrong, for `validateSitePlan`.
5969
+ */
5970
+ declare function expandPlanWire(wire: unknown, context: PlanWireContext): SitePlan | unknown;
5971
+ declare function fieldToWire(field: ContentFieldPlan): PlainObject;
5972
+ declare function contentTypeToWire(type: ContentTypePlan): PlainObject;
5973
+ declare function dataSourceToWire(source: DataSourcePlan): PlainObject;
5974
+ declare function sectionToWire(section: PageSectionPlan): PlainObject;
5975
+ declare function pageToWire(page: PagePlan): PlainObject;
5976
+ /** The plan → the wire: what a model would have written (the plan edits' prompt shows it; fakes and evals write it). */
5977
+ declare function planToWire(plan: SitePlan): PlainObject;
5978
+
5979
+ /**
5980
+ * What a structured-output request costs the provider's grammar compiler, counted the way the Claude API counts it
5981
+ * (platform.claude.com/docs/en/build-with-claude/structured-outputs, "Schema complexity limits", read 2026-10-27):
5982
+ * "Total optional parameters across all strict tool schemas and JSON output schemas. Each parameter not listed in
5983
+ * `required` counts toward this limit" (24); "Total parameters that use `anyOf` or type arrays (for example,
5984
+ * `"type": ["string", "null"]`) across all strict schemas" (16); "Maximum number of tools with `strict: true`" (20).
5985
+ * The limits are per REQUEST — every strict schema in it together. The ONE counter: the specs hold every schema iox-cms
5986
+ * sends to it, and the fake Claude API refuses with it exactly as Claude does — the plan stage once sent 213 optional
5987
+ * parameters and every suite stayed green because the fake accepted anything (vectoriox/iox-cms#45).
5988
+ */
5989
+ declare const STRICT_SCHEMA_LIMITS: {
5990
+ readonly strictTools: 20;
5991
+ readonly optional: 24;
5992
+ readonly unions: 16;
5993
+ };
5994
+ /** What a schema iox-cms sends may use — half of each limit, so a step can gain a field (or a strict tool) without a 400. */
5995
+ declare const STRICT_SCHEMA_BUDGET: {
5996
+ readonly optional: 12;
5997
+ readonly unions: 8;
5998
+ };
5999
+ interface StrictSchemaComplexity {
6000
+ /** Properties not listed in their object's `required`, every object of every schema. */
6001
+ optional: number;
6002
+ /** Nodes using `anyOf` or a type array. */
6003
+ unions: number;
6004
+ /** Tools with `strict: true` (a JSON output format is not a tool). */
6005
+ strictTools: number;
6006
+ /** What the strict mode does not support, each with its path (`pages.items.properties.route: minLength`). */
6007
+ unsupported: string[];
6008
+ }
6009
+ /** The cost of ONE request's strict schemas together: its JSON output format and its strict tools' input schemas. */
6010
+ declare function strictSchemaComplexity(schemas: ReadonlyArray<JsonSchema>, strictTools?: number): StrictSchemaComplexity;
6011
+ /** A refusal shaped like the Claude API's (HTTP 400, `invalid_request_error`). */
6012
+ interface StrictSchemaRefusal {
6013
+ status: 400;
6014
+ type: 'invalid_request_error';
6015
+ message: string;
6016
+ }
5944
6017
  /**
5945
- * A model's answer → a Site Plan: the two listed maps back to maps, nothing else touched. Never repairs — whatever the
5946
- * answer got wrong is still wrong, for `validateSitePlan` to refuse with a path.
6018
+ * The 400 the Claude API answers a request over its limits with, or null. The optional-parameter message is the one
6019
+ * Claude answered on 2026-10-27, verbatim; the union, strict-tool and unsupported messages follow its shape (not yet
6020
+ * captured).
5947
6021
  */
5948
- declare function sitePlanFromWire(wire: unknown): SitePlan | unknown;
5949
- /** The plan → the wire (what a re-ask shows the model, and what the plan edits' prompt carries). */
5950
- declare function sitePlanToWire(plan: SitePlan): PlainObject;
6022
+ declare function strictSchemaRefusal(complexity: StrictSchemaComplexity): StrictSchemaRefusal | null;
5951
6023
 
5952
6024
  /**
5953
6025
  * Changing a plan by sentence (AI plan §3d "The Plan prompt box", M1-5; reused by M2 after a build): the CLOSED list
@@ -6106,9 +6178,21 @@ interface PlanEditsAnswer {
6106
6178
  }
6107
6179
  /** The answer's own keys, explained. */
6108
6180
  declare const PLAN_EDITS_ANSWER_SHAPE: ShapeEntry;
6109
- /** The format a sentence's answer is written in: the outcome, the edits (one `anyOf` branch per op), the reason. */
6181
+ /** Each op's keys (`PLAN_EDIT_SHAPE`) → the wire key that carries it. */
6182
+ declare const PLAN_EDIT_WIRE_KEYS: Readonly<Record<`${PlanEditOp}`, Readonly<Record<string, string>>>>;
6183
+ /** The flat edit's shape table: every key required, each with its none. */
6184
+ declare const PLAN_EDIT_WIRE_SHAPE: ShapeEntry;
6185
+ /** Per op, the wire keys it reads, in `PLAN_EDIT_SHAPE`'s words (`?` = may hold its none) — what the model reads. */
6186
+ declare function planEditWireOps(): Record<string, Record<string, string>>;
6187
+ /** Op keys no wire key carries, or wire keys that do not exist — always empty (a spec and the builder hold it). */
6188
+ declare function planEditWireGaps(): string[];
6189
+ /** The format a sentence's answer is written in: the outcome, the flat edits, the reason. */
6110
6190
  declare function planEditsJsonSchema(): JsonSchema;
6111
- /** A model's answer → edits (sections and content types off the wire); never repaired. */
6191
+ /** One flat edit → the op's edit: the keys it reads, a none left out where the op may go without it. Never repaired. */
6192
+ declare function expandWireEdit(wire: unknown): PlanEdit | unknown;
6193
+ /** An edit → the flat wire edit (what a model would write — fakes and specs write it). */
6194
+ declare function planEditToWire(edit: PlanEdit): PlainObject;
6195
+ /** A model's answer → edits (each flat edit expanded); never repaired. */
6112
6196
  declare function planEditsFromWire(answer: unknown): PlanEditsAnswer | unknown;
6113
6197
 
6114
6198
  /**
@@ -6388,5 +6472,5 @@ declare function stockCreditNode(index: number, credit: StockLink): SerializedNo
6388
6472
  /** Append the credit lines to the footer root (once each). Returns how many it added. */
6389
6473
  declare function addStockCredits(footer: SerializedNode, credits: ReadonlyArray<StockLink>): number;
6390
6474
 
6391
- export { ACTIVE_BUILD_STATUSES, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_TYPICAL_TOKENS, 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, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FINAL_GENERATION_STAGES, FINDING_SEVERITY, GlobalSlot, HEBREW_PREFIXES, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PLAN_EDITS_ANSWER_SHAPE, PLAN_EDITS_SCHEMA_NAME, PLAN_EDIT_SHAPE, PRICING_PATTERN, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanWordIssueCode, PreflightRefusalCode, PublishRefusalCode, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, SITE_CHECKS, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_LIBRARY, SITE_LOCALES, SITE_NEED_IDS, SITE_PATTERNS, SITE_PLAN_SCHEMA_NAME, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_ARCHETYPES, SPEC_SITE_COPY_LENGTHS, SPEC_SITE_DENSITY_COPY, SPEC_SITE_FACTS, SPEC_SITE_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_PROVIDER_TERMS, STUDIO_TEMPLATE, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SitePlanWireKey, SiteTemplateError, SiteTemplateId, StepState, StockProviderId, addBarItem, addStockCredits, applyPlanEdits, applyStockPhotos, archetypeIssues, assertStyleSlots, assertValidSitePlan, auditSite, barIconForRoute, blocksPublish, buildKeys, buildStepFacts, builtHomePageId, composeNavHeader, composeSection, composeSite, contentTypeFromWire, contentTypeJsonSchema, contentTypePreviewFields, copyLengthOf, costUsd, createSerializedNode, creditsOfUsd, dataSourceJsonSchema, describePlanData, describeShapeKey, entranceAction, entranceInteraction, estimateStepCredits, failedBuildStep, fieldJsonSchema, findNavRoot, isActiveBuild, isNonEmptyString, isPlainObject, isRtlLocale, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, modelCanDo, moveBarItem, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, pageJsonSchema, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneMenuPages, planEditsFromWire, planEditsJsonSchema, planEntrances, planFromTemplate, planNavShape, planStockPhotos, planWordIssues, publishRefusal, publishVerdict, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, sampleImageRef, sectionEntrances, sectionFromWire, sectionJsonSchema, sectionPatternIds, setStyleProps, shapeKeys, showcaseGlobals, showcasePages, showcasePlans, siteNavPages, sitePlanFromWire, sitePlanJsonSchema, sitePlanToWire, slotBudget, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockSlots, validatePlanEdits, validateSitePlan, walkSerialized, wordPattern, writtenTexts };
6392
- export type { AddBarItemResult, AiEntitlementsView, AiMeter, AiModelEntry, AiRefusal, AiTokenCounts, AiTokenPrice, AuditPage, AuditPlaceholder, BarItemsEditResult, BuildNotice, BuildStepError, BuildStepFacts, BuildStepRecord, CmsDataSourcePlan, ComposeContext, ComposeIssue, ComposedDataSource, ComposedItem, ComposedNavHeader, ComposedPage, ComposedPlaceholder, ComposedRoute, ComposedSection, ComposedSite, ContentFieldPlan, ContentRoles, ContentSeedPlan, ContentTypePlan, CreateNodeOptions, CreatedRecord, DataSourcePlan, DynamicKeysAsList, EntranceAction, EntranceActionOptions, EntranceInteraction, EntranceMark, EntranceSpec, EntranceStamp, FactKey, JsonSchema, NavHeaderInput, NavHeaderOptions, NavPage, NavShapeOptions, NavShapeResult, NodeBaseline, PageArchetype, PageArchetypeId, PageArchetypeSlot, PageData, PageDataLine, PagePlan, PageSectionPlan, PageSeoPlan, PathIssue, PatternManifestEntry, PatternNode, PatternPath, PatternRoleNeed, PlainObject, PlanChange, PlanEdit, PlanEditIssue, PlanEditResult, PlanEditsAnswer, PlanEntrancesInput, PlanWordContext, PlanWordIssue, PreflightRefusal, PublishRefusal, RelativeDataSourcePlan, SectionEntrances, SectionInput, SectionOptions, SerializedBinding, SerializedNode, SerializedResponsive, ShapeEntry, ShapeIssueCodes, ShowcaseInput, SiteAudit, SiteAuditOptions, SiteAuditSnapshot, SiteBuildRun, SiteBusiness, SiteCheck, SiteFinding, SiteNeedId, SitePageRef, SitePattern, SitePlan, SitePlanIssue, SitePlanSchemaPin, SitePlanSource, SitePlanValidation, SiteTemplate, StockCredit, StockLink, StockPhoto, StockPlacement, StockProviderTerms, StockSlot, TemplatePlanInput, UndoKept, UndoPreview, UndoRecord, WrittenText };
6475
+ export { ACTIVE_BUILD_STATUSES, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_TYPICAL_TOKENS, 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, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FINAL_GENERATION_STAGES, FINDING_SEVERITY, GlobalSlot, HEBREW_PREFIXES, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PLAN_EDITS_ANSWER_SHAPE, PLAN_EDITS_SCHEMA_NAME, PLAN_EDIT_SHAPE, PLAN_EDIT_WIRE_KEYS, PLAN_EDIT_WIRE_SHAPE, PLAN_WIRE_DERIVED, PLAN_WIRE_SCHEMA_NAME, PLAN_WIRE_SHAPE, PRICING_PATTERN, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanWireEntry, PlanWireShapeError, PlanWordIssueCode, PreflightRefusalCode, PublishRefusalCode, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, 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_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_PROVIDER_TERMS, STRICT_SCHEMA_BUDGET, STRICT_SCHEMA_LIMITS, STUDIO_TEMPLATE, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, StockProviderId, addBarItem, addStockCredits, applyPlanEdits, applyStockPhotos, archetypeIssues, assertStyleSlots, assertValidSitePlan, auditSite, barIconForRoute, blocksPublish, buildKeys, buildStepFacts, builtHomePageId, composeNavHeader, composeSection, composeSite, contentTypePreviewFields, contentTypeToWire, copyLengthOf, costUsd, createSerializedNode, creditsOfUsd, dataSourceToWire, describePlanData, describeShapeKey, entranceAction, entranceInteraction, estimateStepCredits, expandPlanWire, expandWireContentType, expandWireDataSource, expandWireEdit, expandWireField, expandWirePage, expandWireSection, failedBuildStep, fieldToWire, findNavRoot, isActiveBuild, isNonEmptyString, isPlainObject, isRtlLocale, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, modelCanDo, moveBarItem, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, pageToWire, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneMenuPages, planEditToWire, planEditWireGaps, planEditWireOps, planEditsFromWire, planEditsJsonSchema, planEntrances, planFromTemplate, planNavShape, planStockPhotos, planToWire, planWireGaps, planWireJsonSchema, planWordIssues, publishRefusal, publishVerdict, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, sampleImageRef, sectionEntrances, sectionPatternIds, sectionToWire, setStyleProps, shapeKeys, showcaseGlobals, showcasePages, showcasePlans, siteNavPages, slotBudget, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockSlots, strictSchemaComplexity, strictSchemaRefusal, validatePlanEdits, validateSitePlan, walkSerialized, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema, wirePageJsonSchema, wireSectionJsonSchema, wordPattern, writtenTexts };
6476
+ export type { AddBarItemResult, AiEntitlementsView, AiMeter, AiModelEntry, AiRefusal, AiTokenCounts, AiTokenPrice, AuditPage, AuditPlaceholder, BarItemsEditResult, BuildNotice, BuildStepError, BuildStepFacts, BuildStepRecord, CmsDataSourcePlan, ComposeContext, ComposeIssue, ComposedDataSource, ComposedItem, ComposedNavHeader, ComposedPage, ComposedPlaceholder, ComposedRoute, ComposedSection, ComposedSite, ContentFieldPlan, ContentRoles, ContentSeedPlan, ContentTypePlan, CreateNodeOptions, CreatedRecord, DataSourcePlan, DynamicKeysAsList, EntranceAction, EntranceActionOptions, EntranceInteraction, EntranceMark, EntranceSpec, EntranceStamp, FactKey, JsonSchema, NavHeaderInput, NavHeaderOptions, NavPage, NavShapeOptions, NavShapeResult, NodeBaseline, PageArchetype, PageArchetypeId, PageArchetypeSlot, PageData, PageDataLine, PagePlan, PageSectionPlan, PageSeoPlan, PathIssue, PatternManifestEntry, PatternNode, PatternPath, PatternRoleNeed, PlainObject, PlanChange, PlanEdit, PlanEditIssue, PlanEditResult, PlanEditsAnswer, PlanEntrancesInput, PlanWireContext, PlanWordContext, PlanWordIssue, PreflightRefusal, PublishRefusal, RelativeDataSourcePlan, SectionEntrances, SectionInput, SectionOptions, SerializedBinding, SerializedNode, SerializedResponsive, ShapeEntry, ShapeIssueCodes, ShowcaseInput, SiteAudit, SiteAuditOptions, SiteAuditSnapshot, SiteBuildRun, SiteBusiness, SiteCheck, SiteFinding, SiteNeedId, SitePageRef, SitePattern, SitePlan, SitePlanIssue, SitePlanSource, SitePlanValidation, SiteTemplate, StockCredit, StockLink, StockPhoto, StockPlacement, StockProviderTerms, StockSlot, StrictSchemaComplexity, StrictSchemaRefusal, TemplatePlanInput, UndoKept, UndoPreview, UndoRecord, WrittenText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.60.0",
3
+ "version": "5.61.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -3,9 +3,10 @@ import {
3
3
  } from './json-schema';
4
4
  import { patternById, patternOptionalParts, patternSlots, patternTakesBinding } from './patterns';
5
5
  import {
6
- contentTypeFromWire, contentTypeJsonSchema, dataSourceJsonSchema, fieldJsonSchema, pageJsonSchema, sectionFromWire, sectionJsonSchema,
7
- sectionPatternIds,
8
- } from './site-plan-schema';
6
+ contentTypeToWire, dataSourceToWire, expandWireContentType, expandWireDataSource, expandWireField, expandWirePage, expandWireSection, fieldToWire,
7
+ pageToWire, PlanWireShapeError, sectionPatternIds, sectionToWire, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema,
8
+ wirePageJsonSchema, wireSectionJsonSchema,
9
+ } from './plan-wire';
9
10
  import {
10
11
  ContentFieldPlan, ContentTypePlan, DataSourcePlan, PagePlan, PageSectionPlan, PlanDataSourceMode, PlanDataSourceType, SitePlan,
11
12
  } from './site-plan.model';
@@ -209,7 +210,7 @@ const setSections = (d: Draft, at: number, sections: PageSectionPlan[]) => { d.p
209
210
  /** One handler per op — a data table, never an if-chain. */
210
211
  const APPLY: Readonly<Record<`${PlanEditOp}`, Apply>> = {
211
212
  [PlanEditOp.AddPage]: (d, e, c, path, changed) => {
212
- const page = { ...(e.page as PagePlan), sections: (e.page.sections ?? []).map(sectionFromWire) } as PagePlan;
213
+ const page = e.page as PagePlan;
213
214
  if (pageIndex(d, page.key) >= 0) return c.add(PlanEditIssueCode.Duplicate, `${path}.page.key`, `page "${page.key}" is already in the plan`);
214
215
  const after = e.after === undefined ? d.pages.length - 1 : findPage(d, e.after, c, `${path}.after`);
215
216
  if (after < 0 && e.after !== undefined) return;
@@ -257,7 +258,7 @@ const APPLY: Readonly<Record<`${PlanEditOp}`, Apply>> = {
257
258
  if (at < 0) return;
258
259
  const sections = [...d.pages[at].sections];
259
260
  const index = e.at === undefined ? sections.length : clamp(e.at, sections.length);
260
- sections.splice(index, 0, sectionFromWire(e.section) as PageSectionPlan);
261
+ sections.splice(index, 0, e.section as PageSectionPlan);
261
262
  setSections(d, at, sections);
262
263
  changed.push({ kind: PlanChangeKind.Section, action: PlanChangeAction.Added, page: d.pages[at].key, index });
263
264
  },
@@ -304,7 +305,7 @@ const APPLY: Readonly<Record<`${PlanEditOp}`, Apply>> = {
304
305
  changed.push({ kind: PlanChangeKind.Section, action: PlanChangeAction.Changed, page: d.pages[at].key, index: e.index });
305
306
  },
306
307
  [PlanEditOp.AddContentType]: (d, e, c, path, changed) => {
307
- const type = contentTypeFromWire(e.contentType) as ContentTypePlan;
308
+ const type = e.contentType as ContentTypePlan;
308
309
  if (d.contentTypes.some(t => t.name === type.name)) return c.add(PlanEditIssueCode.Duplicate, `${path}.contentType.name`, `content type "${type.name}" is already in the plan`);
309
310
  d.contentTypes.push(type);
310
311
  changed.push({ kind: PlanChangeKind.ContentType, action: PlanChangeAction.Added, name: type.name });
@@ -382,47 +383,164 @@ export const PLAN_EDITS_ANSWER_SHAPE: ShapeEntry = {
382
383
  reason: "string — when cannot, ONE short line for the owner in their language (what to do instead); else ''",
383
384
  };
384
385
 
385
- const one = (value: string): JsonSchema => jsonOneOf([value]);
386
-
387
- /** The schema of each op's value types (what `PLAN_EDIT_SHAPE` names). */
388
- function opSchema(op: `${PlanEditOp}`): JsonSchema {
389
- const entry = PLAN_EDIT_SHAPE[op];
390
- const valueOf = (key: string): JsonSchema => {
391
- const text = entry[key] ?? entry[`${key}?`];
392
- if (key === 'op') return one(op);
393
- if (key === 'pattern') return jsonOneOf(sectionPatternIds());
394
- const head = text.split(' ')[0];
395
- const table: Record<string, () => JsonSchema> = {
396
- page: pageJsonSchema, section: sectionJsonSchema, contentType: contentTypeJsonSchema, field: fieldJsonSchema,
397
- 'dataSource[]': () => jsonListOf(dataSourceJsonSchema()), integer: jsonInteger, string: jsonText,
398
- };
399
- if (text.startsWith('string | string[]')) return jsonAnyOf([jsonText(), jsonListOf(jsonText())]);
400
- return (table[head] ?? jsonText)();
401
- };
402
- return jsonShapedObject(entry, Object.fromEntries(shapeKeys(entry).map(key => [key, valueOf(key)])), op);
386
+ /**
387
+ * ONE edit on the wire (vectoriox/iox-cms#45): a flat object whose keys are ALL required — the 13 ops as `anyOf`
388
+ * branches, each embedding whole pages, sections and content types, came to 395 optional parameters against the Claude
389
+ * API's 24. `op` says which keys are read (`PLAN_EDIT_WIRE_KEYS`, from `PLAN_EDIT_SHAPE`); every other key holds its
390
+ * none. A whole page, section, content type or field travels as a list of exactly one, in the plan wire's format.
391
+ */
392
+ interface EditWireKey {
393
+ text: string;
394
+ none: unknown;
395
+ schema(): JsonSchema;
396
+ /** The wire value → the edit's (default: as written). */
397
+ expand?(value: unknown): unknown;
398
+ /** The edit's value → the wire's (default: as is). */
399
+ toWire?(value: any): unknown;
400
+ }
401
+
402
+ const NO_INDEX = -1;
403
+
404
+ /** A list holding exactly one object: none → absent, one → it (expanded), more → the list (the gate refuses it). */
405
+ const oneOf = (schema: () => JsonSchema, expand: (v: unknown) => unknown, toWire: (v: any) => unknown, what: string): EditWireKey => ({
406
+ text: `${what}[] — exactly one when the op takes it`,
407
+ none: [],
408
+ schema: () => jsonListOf(schema()),
409
+ expand: v => (Array.isArray(v) ? (v.length === 0 ? undefined : v.length === 1 ? expand(v[0]) : v) : v),
410
+ toWire: v => [toWire(v)],
411
+ });
412
+
413
+ const textKey = (text: string): EditWireKey => ({ text: `string — ${text}`, none: '', schema: jsonText });
414
+ const indexKey = (text: string): EditWireKey => ({ text: `integer — ${text}`, none: NO_INDEX, schema: jsonInteger });
415
+
416
+ const EDIT_WIRE: Readonly<Record<string, EditWireKey>> = {
417
+ page: textKey('a page key'),
418
+ name: textKey('renamePage: its new name (the menu label)'),
419
+ route: textKey('renamePage: its new route'),
420
+ after: textKey('addPage: the key of the page it follows in the menu'),
421
+ into: textKey('mergePages: the page that stays'),
422
+ from: textKey('mergePages: the page whose sections move into it, then removed'),
423
+ index: indexKey('the section, 0-based on its page'),
424
+ to: indexKey('movePage / moveSection: the new 0-based place'),
425
+ at: indexKey('addSection: its 0-based place on the page'),
426
+ pattern: { text: 'string — swapPattern: the section pattern it becomes', none: '', schema: () => jsonOneOf(['', ...sectionPatternIds()]) },
427
+ slot: textKey("setSlot: one of the pattern's slots"),
428
+ text: textKey("setSlot: the words, in the owner's language and voice"),
429
+ binding: textKey('setSectionData: the list source the section repeats'),
430
+ contentType: textKey('addField: a content type of the plan'),
431
+ newPage: oneOf(wirePageJsonSchema, expandWirePage, pageToWire, 'page'),
432
+ newSection: oneOf(wireSectionJsonSchema, expandWireSection, sectionToWire, 'section'),
433
+ newContentType: oneOf(wireContentTypeJsonSchema, expandWireContentType, contentTypeToWire, 'contentType'),
434
+ dataSources: {
435
+ text: 'dataSource[] — addContentType: the list / single sources its pages read', none: [],
436
+ schema: () => jsonListOf(wireDataSourceJsonSchema()),
437
+ expand: v => (Array.isArray(v) ? v.map(expandWireDataSource) : v),
438
+ toWire: (v: DataSourcePlan[]) => v.map(dataSourceToWire),
439
+ },
440
+ newField: oneOf(wireFieldJsonSchema, expandWireField, fieldToWire, 'field'),
441
+ sample: { text: "string | string[] — addField: the samples' value for it", none: '', schema: () => jsonAnyOf([jsonText(), jsonListOf(jsonText())]) },
442
+ };
443
+
444
+ /** Each op's keys (`PLAN_EDIT_SHAPE`) → the wire key that carries it. */
445
+ export const PLAN_EDIT_WIRE_KEYS: Readonly<Record<`${PlanEditOp}`, Readonly<Record<string, string>>>> = {
446
+ [PlanEditOp.AddPage]: { page: 'newPage', after: 'after' },
447
+ [PlanEditOp.RemovePage]: { page: 'page' },
448
+ [PlanEditOp.RenamePage]: { page: 'page', name: 'name', route: 'route' },
449
+ [PlanEditOp.MergePages]: { into: 'into', from: 'from' },
450
+ [PlanEditOp.MovePage]: { page: 'page', to: 'to' },
451
+ [PlanEditOp.AddSection]: { page: 'page', section: 'newSection', at: 'at' },
452
+ [PlanEditOp.RemoveSection]: { page: 'page', index: 'index' },
453
+ [PlanEditOp.MoveSection]: { page: 'page', from: 'index', to: 'to' },
454
+ [PlanEditOp.SwapPattern]: { page: 'page', index: 'index', pattern: 'pattern' },
455
+ [PlanEditOp.SetSlot]: { page: 'page', index: 'index', slot: 'slot', text: 'text' },
456
+ [PlanEditOp.AddContentType]: { contentType: 'newContentType', dataSources: 'dataSources' },
457
+ [PlanEditOp.AddField]: { contentType: 'contentType', field: 'newField', sample: 'sample' },
458
+ [PlanEditOp.SetSectionData]: { page: 'page', index: 'index', binding: 'binding' },
459
+ };
460
+
461
+ const isEditWireNone = (wireKey: string, v: unknown) => {
462
+ const none = EDIT_WIRE[wireKey].none;
463
+ return v === undefined || (Array.isArray(none) ? Array.isArray(v) && v.length === 0 : v === none) || (wireKey === 'sample' && Array.isArray(v) && v.length === 0);
464
+ };
465
+ const noneText = (none: unknown) => (Array.isArray(none) ? '[]' : typeof none === 'string' ? "''" : String(none));
466
+
467
+ /** The flat edit's shape table: every key required, each with its none. */
468
+ export const PLAN_EDIT_WIRE_SHAPE: ShapeEntry = {
469
+ op: `${OPS.map(op => `'${op}'`).join(' | ')} — which keys below are read`,
470
+ ...Object.fromEntries(Object.entries(EDIT_WIRE).map(([k, spec]) => [k, `${spec.text} — ${noneText(spec.none)} when the op does not read it`])),
471
+ };
472
+
473
+ /** Per op, the wire keys it reads, in `PLAN_EDIT_SHAPE`'s words (`?` = may hold its none) — what the model reads. */
474
+ export function planEditWireOps(): Record<string, Record<string, string>> {
475
+ return Object.fromEntries(OPS.map(op => {
476
+ const entry = PLAN_EDIT_SHAPE[op as PlanEditOp];
477
+ const keys = PLAN_EDIT_WIRE_KEYS[op as PlanEditOp];
478
+ return [op, Object.fromEntries(Object.entries(keys).map(([planKey, wireKey]) => {
479
+ const optionalKey = `${planKey}?` in entry;
480
+ return [`${wireKey}${optionalKey ? '?' : ''}`, entry[optionalKey ? `${planKey}?` : planKey]];
481
+ }))];
482
+ }));
403
483
  }
404
484
 
405
- /** The format a sentence's answer is written in: the outcome, the edits (one `anyOf` branch per op), the reason. */
485
+ /** Op keys no wire key carries, or wire keys that do not exist — always empty (a spec and the builder hold it). */
486
+ export function planEditWireGaps(): string[] {
487
+ const gaps: string[] = [];
488
+ for (const op of OPS) {
489
+ const keys = PLAN_EDIT_WIRE_KEYS[op as PlanEditOp] ?? {};
490
+ for (const planKey of shapeKeys(PLAN_EDIT_SHAPE[op as PlanEditOp])) {
491
+ if (planKey === 'op') continue;
492
+ if (!keys[planKey]) gaps.push(`${op}.${planKey}`);
493
+ else if (!EDIT_WIRE[keys[planKey]]) gaps.push(`${op}.${planKey} → ${keys[planKey]}`);
494
+ }
495
+ for (const planKey of Object.keys(keys)) if (!shapeKeys(PLAN_EDIT_SHAPE[op as PlanEditOp]).includes(planKey)) gaps.push(`${op}.${planKey} (not an op key)`);
496
+ }
497
+ return gaps;
498
+ }
499
+
500
+ /** The format a sentence's answer is written in: the outcome, the flat edits, the reason. */
406
501
  export function planEditsJsonSchema(): JsonSchema {
502
+ const gaps = planEditWireGaps();
503
+ if (gaps.length) throw new PlanWireShapeError(`the plan edits wire does not carry ${gaps.join(', ')}`);
504
+ const edit = jsonShapedObject(PLAN_EDIT_WIRE_SHAPE, {
505
+ op: jsonOneOf(OPS),
506
+ ...Object.fromEntries(Object.entries(EDIT_WIRE).map(([k, spec]) => [k, spec.schema()])),
507
+ }, 'edit');
407
508
  return jsonShapedObject(PLAN_EDITS_ANSWER_SHAPE, {
408
509
  outcome: jsonOneOf(Object.values(PlanEditsOutcome)),
409
- edits: jsonListOf(jsonAnyOf(OPS.map(op => opSchema(op as PlanEditOp)))),
510
+ edits: jsonListOf(edit),
410
511
  reason: jsonText(),
411
512
  }, 'planEdits');
412
513
  }
413
514
 
414
- /** A model's answer → edits (sections and content types off the wire); never repaired. */
515
+ /** One flat edit → the op's edit: the keys it reads, a none left out where the op may go without it. Never repaired. */
516
+ export function expandWireEdit(wire: unknown): PlanEdit | unknown {
517
+ if (!isPlainObject(wire)) return wire;
518
+ const keys = PLAN_EDIT_WIRE_KEYS[wire['op'] as PlanEditOp];
519
+ if (!keys) return wire;
520
+ const entry = PLAN_EDIT_SHAPE[wire['op'] as PlanEditOp];
521
+ const out: PlainObject = Object.fromEntries(Object.entries(wire).filter(([k]) => k === 'op' || !(k in EDIT_WIRE)));
522
+ for (const [planKey, wireKey] of Object.entries(keys)) {
523
+ const raw = wire[wireKey];
524
+ if (`${planKey}?` in entry && isEditWireNone(wireKey, raw)) continue;
525
+ const value = EDIT_WIRE[wireKey].expand ? EDIT_WIRE[wireKey].expand!(raw) : raw;
526
+ if (value !== undefined) out[planKey] = value;
527
+ }
528
+ return out;
529
+ }
530
+
531
+ /** An edit → the flat wire edit (what a model would write — fakes and specs write it). */
532
+ export function planEditToWire(edit: PlanEdit): PlainObject {
533
+ const out: PlainObject = { op: edit.op, ...Object.fromEntries(Object.entries(EDIT_WIRE).map(([k, spec]) => [k, Array.isArray(spec.none) ? [] : spec.none])) };
534
+ for (const [planKey, wireKey] of Object.entries(PLAN_EDIT_WIRE_KEYS[edit.op])) {
535
+ const value = (edit as unknown as PlainObject)[planKey];
536
+ if (value === undefined) continue;
537
+ out[wireKey] = EDIT_WIRE[wireKey].toWire ? EDIT_WIRE[wireKey].toWire!(value) : value;
538
+ }
539
+ return out;
540
+ }
541
+
542
+ /** A model's answer → edits (each flat edit expanded); never repaired. */
415
543
  export function planEditsFromWire(answer: unknown): PlanEditsAnswer | unknown {
416
544
  if (!isPlainObject(answer) || !Array.isArray(answer['edits'])) return answer;
417
- const edits = (answer['edits'] as unknown[]).map(raw => {
418
- if (!isPlainObject(raw)) return raw;
419
- const e: PlainObject = { ...raw };
420
- if (isPlainObject(e['page']) && Array.isArray((e['page'] as PlainObject)['sections'])) {
421
- e['page'] = { ...(e['page'] as PlainObject), sections: ((e['page'] as PlainObject)['sections'] as unknown[]).map(sectionFromWire) };
422
- }
423
- if (isPlainObject(e['section'])) e['section'] = sectionFromWire(e['section']);
424
- if (isPlainObject(e['contentType'])) e['contentType'] = contentTypeFromWire(e['contentType']);
425
- return e;
426
- });
427
- return { ...answer, edits };
545
+ return { ...answer, edits: (answer['edits'] as unknown[]).map(expandWireEdit) };
428
546
  }