export interface ElementOrderViolation { /** i:type of the control whose children are out of order. */ controlType: string; /** `` of that control, or '(unnamed)'. */ controlName: string; /** The element that appears too early. */ element: string; /** * The element `element` must come BEFORE but was written AFTER, or `null` for * an `unknown` violation — one this control type carries nowhere in the census. * * The name reads as "the element this one belongs before". Getting the * DIRECTION right in the message matters more than it looks: the first version * said ` must come AFTER `, which is the exact opposite * of the fix, and it shipped — the tests pinned the wrong string, so only * reading the live tool output caught it. */ beforeElement: string | null; /** * `order` — the element is ranked for this type but written too early. * `unknown`— the element was never seen on this type in 309,668 shipped controls, * which in practice means the type does not have that property and * the platform will ignore it. Reported separately because "never * observed" is weaker evidence than "observed in the other order". * Never reported for an EMPTY element (``): it carries no * value for the platform to ignore, and Microsoft ships some (#1093). */ kind: 'order' | 'unknown'; /** 1-based line of `element` in the document, for a clickable message. */ line: number; } /** * How many `` elements a form document actually contains. * * Uses the shared token scanner, so a control written inside an XML COMMENT (the * Workspace pattern template ships two such examples) is not counted as a real * one. Lives here rather than beside its first caller because the number is now * used to answer two different questions: what the scaffold wrote, and whether * the document disagrees with what the metadata provider can see. */ export declare function countFormControls(xml: string): number; /** * Every place a form control writes a child element earlier than the canonical * order for its `i:type` allows. * * Only elements the census actually observed for that type are ranked; anything * else (a property no shipped form of that type carries, or an unknown control * type) is skipped rather than guessed at — the point is to catch a KNOWN * mis-ordering, never to invent one. * * Reports the first offending pair per element so one displaced line yields one * finding, not one per element it jumped over. */ export declare function findControlElementOrderViolations(xml: string): ElementOrderViolation[]; /** * A one-line-per-finding message block for a tool response, or '' when clean. */ export declare function formatElementOrderViolations(violations: ElementOrderViolation[]): string; /** * Gate a form write on element order. * * Mirrors `gateOnFormPatternErrors` deliberately, down to sharing * `FORM_PATTERN_ENFORCE`: both answer the same question — "is this document * structurally sound enough to write?" — and one bypass for form structural * enforcement is better than two. * * Only `kind: 'order'` blocks. That is the finding with a proven consequence: * the element is dropped, and #979 verified it against the live metadata * provider. `kind: 'unknown'` is weaker evidence by construction — "no shipped * control of this type carries this element" — so it warns and never refuses. * * The false-positive rate is measured, not assumed: over the whole shipped * corpus (10,676 AxForm/AxFormExtension files, 309,668 controls) this rule fires * three times, and each of the three is a file where Microsoft itself put an * element where the deserializer drops it. See * tests/validation/formControlElementOrder.test.ts. */ export declare function gateOnControlElementOrder(xmlContent: string, operationDescription: string, enforceEnabled: boolean): { blocked: { isError: true; content: Array<{ type: 'text'; text: string; }>; } | null; warningsText: string | null; }; //# sourceMappingURL=formControlElementOrder.d.ts.map