@ai-react-markdown/engine 2.9.0 → 2.9.1

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.
@@ -459,16 +459,15 @@ function settleRefsAndEarliestUnresolved(cp) {
459
459
  var TYPE6_NAMES = new Set(import_micromark_util_html_tag_name.htmlBlockNames);
460
460
  var TABLE_PART_NAMES = /* @__PURE__ */ new Set(["td", "th", "tr", "tbody", "thead", "tfoot", "caption", "col", "colgroup"]);
461
461
  var DOCUMENT_STRUCTURE_NAMES = /* @__PURE__ */ new Set(["html", "head", "body", "frameset"]);
462
+ var NO_ELEMENT_NAMES = /* @__PURE__ */ new Set([...DOCUMENT_STRUCTURE_NAMES, "frame", "image"]);
462
463
  var RETROACTIVE_OPENERS = [
463
464
  "<!doctype",
464
- "<html",
465
- "<head",
466
- "<body",
467
- "<frameset",
468
- "</html",
469
- "</head",
470
- "</body",
471
- "</frameset"
465
+ // DERIVED, so the trailing-partial guard cannot drift from the poison the
466
+ // confirmed lines get. It was transcribed until F28, and the transcription
467
+ // was already two names behind by then. `<frame` subsumes `<frameset`,
468
+ // which is why the derived list is SHORTER than the one it replaces and
469
+ // still covers strictly more.
470
+ ...[...NO_ELEMENT_NAMES].flatMap((name) => [`<${name}`, `</${name}`])
472
471
  ];
473
472
  function tailCarriesRetroactive(text) {
474
473
  const lower = text.toLowerCase();
@@ -721,6 +720,7 @@ function freshCheckpoint(defListEnabled, mathFlow, referenceTaint) {
721
720
  tagBalance: /* @__PURE__ */ new Map(),
722
721
  openTotal: 0,
723
722
  p5Tok: { kind: "data" },
723
+ formPointerMaybeSet: false,
724
724
  openStack: [],
725
725
  mdBlock: { kind: "none" },
726
726
  blankRun: 0,
@@ -871,6 +871,7 @@ function sealReleaseDerived(cp, ln, isBlockStart) {
871
871
  if (DEF_RE.test(ln.text) || FOOTNOTE_DEF_RE.test(ln.text)) return false;
872
872
  return true;
873
873
  }
874
+ var sealReleaseEvaluations = 0;
874
875
  function sealReleaseEnumerated(cp, ln, isBlockStart) {
875
876
  const defShapedLine = DEF_RE.test(ln.text) || FOOTNOTE_DEF_RE.test(ln.text) || cp.defBlockMaybeOpen || cp.fnDefResumable && !(isBlockStart && ln.indent <= 3);
876
877
  const commentOnly = ln.text.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!--[\s\S]*$/, " ").replace(/[ \t\r]/g, "") === "";
@@ -885,10 +886,13 @@ function processConfirmedLine(cp, ln, text) {
885
886
  if (cp.p5SealPending && !ln.blank && cp.mdBlock.kind !== "html" && !(cp.p5Tok.kind === "comment" || cp.p5Tok.kind === "bogus")) {
886
887
  if (sealReleaseDerived(cp, ln, isBlockStart)) {
887
888
  cp.p5SealPending = false;
888
- if (!sealReleaseEnumerated(cp, ln, isBlockStart)) {
889
- console.error(
890
- `[ai-react-markdown] seal-release containment broken at offset ${ln.start}: the derived predicate released a line the retired enumeration withheld (${JSON.stringify(ln.text.slice(0, 80))}).`
891
- );
889
+ if (true) {
890
+ sealReleaseEvaluations += 1;
891
+ if (!sealReleaseEnumerated(cp, ln, isBlockStart)) {
892
+ console.error(
893
+ `[ai-react-markdown] seal-release containment broken at offset ${ln.start}: the derived predicate released a line the retired enumeration withheld (${JSON.stringify(ln.text.slice(0, 80))}).`
894
+ );
895
+ }
892
896
  }
893
897
  }
894
898
  }
@@ -917,7 +921,7 @@ function processConfirmedLine(cp, ln, text) {
917
921
  if (tag === "plaintext") cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
918
922
  }
919
923
  }
920
- if (DOCUMENT_STRUCTURE_NAMES.has(tag)) cp.phasePoisonedAt = 0;
924
+ if (NO_ELEMENT_NAMES.has(tag)) cp.phasePoisonedAt = 0;
921
925
  if (tag === "template" && !closing) cp.phasePoisonedAt = 0;
922
926
  if (closing) {
923
927
  let idx = -1;
@@ -933,12 +937,14 @@ function processConfirmedLine(cp, ln, text) {
933
937
  return;
934
938
  }
935
939
  cp.openStack.splice(idx, 1);
940
+ if (tag === "form") cp.formPointerMaybeSet = false;
936
941
  const count = cp.tagBalance.get(tag) ?? 0;
937
942
  if (count > 0) {
938
943
  cp.tagBalance.set(tag, count - 1);
939
944
  cp.openTotal -= 1;
940
945
  }
941
946
  } else {
947
+ if (tag === "form") cp.formPointerMaybeSet = true;
942
948
  cp.openStack.push(tag);
943
949
  cp.tagBalance.set(tag, (cp.tagBalance.get(tag) ?? 0) + 1);
944
950
  cp.openTotal += 1;
@@ -1065,7 +1071,11 @@ function processConfirmedLine(cp, ln, text) {
1065
1071
  // mask suppresses them — which is exactly why `openTotal` reads 0
1066
1072
  // and the candidate looked safe), and the 2-5 interiors are the
1067
1073
  // same construct to both grammars.
1068
- htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus",
1074
+ htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus" && // A form pointer parse5 may still be holding makes a LATER `<form>`
1075
+ // in the tail vanish from the full parse while a split parse opens
1076
+ // it — forward independence fails with every other condition clean.
1077
+ // See the field doc.
1078
+ !cp.formPointerMaybeSet,
1069
1079
  hazard: cp.hazardVerdict,
1070
1080
  seamRisk: cp.p5SealPending,
1071
1081
  defListSettled: null
@@ -1461,6 +1471,11 @@ var SCANNER_NAME_LISTS = [
1461
1471
  ["type6", TYPE6_NAMES],
1462
1472
  ["void", VOID_TAGS],
1463
1473
  ["documentStructure", DOCUMENT_STRUCTURE_NAMES],
1474
+ // Added with F28, and it is the list that would have made F28 visible: the
1475
+ // derived census alphabet partitions names by their membership across THIS
1476
+ // table, so before it existed `frame` shared one 39-name class with `div`
1477
+ // and could never be sampled apart from it.
1478
+ ["noElement", NO_ELEMENT_NAMES],
1464
1479
  ["tablePart", TABLE_PART_NAMES],
1465
1480
  ["scopeBarrier", SCOPE_BARRIER_NAMES],
1466
1481
  ["foreignRoot", new Set(FOREIGN_ROOT_NAMES)]