@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.
package/dist/index.cjs CHANGED
@@ -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();
@@ -720,6 +719,7 @@ function freshCheckpoint(defListEnabled, mathFlow, referenceTaint) {
720
719
  tagBalance: /* @__PURE__ */ new Map(),
721
720
  openTotal: 0,
722
721
  p5Tok: { kind: "data" },
722
+ formPointerMaybeSet: false,
723
723
  openStack: [],
724
724
  mdBlock: { kind: "none" },
725
725
  blankRun: 0,
@@ -880,9 +880,12 @@ function processConfirmedLine(cp, ln, text) {
880
880
  if (sealReleaseDerived(cp, ln, isBlockStart)) {
881
881
  cp.p5SealPending = false;
882
882
  if (false) {
883
- console.error(
884
- `[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))}).`
885
- );
883
+ sealReleaseEvaluations += 1;
884
+ if (!sealReleaseEnumerated(cp, ln, isBlockStart)) {
885
+ console.error(
886
+ `[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))}).`
887
+ );
888
+ }
886
889
  }
887
890
  }
888
891
  }
@@ -911,7 +914,7 @@ function processConfirmedLine(cp, ln, text) {
911
914
  if (tag === "plaintext") cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
912
915
  }
913
916
  }
914
- if (DOCUMENT_STRUCTURE_NAMES.has(tag)) cp.phasePoisonedAt = 0;
917
+ if (NO_ELEMENT_NAMES.has(tag)) cp.phasePoisonedAt = 0;
915
918
  if (tag === "template" && !closing) cp.phasePoisonedAt = 0;
916
919
  if (closing) {
917
920
  let idx = -1;
@@ -927,12 +930,14 @@ function processConfirmedLine(cp, ln, text) {
927
930
  return;
928
931
  }
929
932
  cp.openStack.splice(idx, 1);
933
+ if (tag === "form") cp.formPointerMaybeSet = false;
930
934
  const count = cp.tagBalance.get(tag) ?? 0;
931
935
  if (count > 0) {
932
936
  cp.tagBalance.set(tag, count - 1);
933
937
  cp.openTotal -= 1;
934
938
  }
935
939
  } else {
940
+ if (tag === "form") cp.formPointerMaybeSet = true;
936
941
  cp.openStack.push(tag);
937
942
  cp.tagBalance.set(tag, (cp.tagBalance.get(tag) ?? 0) + 1);
938
943
  cp.openTotal += 1;
@@ -1059,7 +1064,11 @@ function processConfirmedLine(cp, ln, text) {
1059
1064
  // mask suppresses them — which is exactly why `openTotal` reads 0
1060
1065
  // and the candidate looked safe), and the 2-5 interiors are the
1061
1066
  // same construct to both grammars.
1062
- htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus",
1067
+ htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus" && // A form pointer parse5 may still be holding makes a LATER `<form>`
1068
+ // in the tail vanish from the full parse while a split parse opens
1069
+ // it — forward independence fails with every other condition clean.
1070
+ // See the field doc.
1071
+ !cp.formPointerMaybeSet,
1063
1072
  hazard: cp.hazardVerdict,
1064
1073
  seamRisk: cp.p5SealPending,
1065
1074
  defListSettled: null
@@ -1455,6 +1464,11 @@ var SCANNER_NAME_LISTS = [
1455
1464
  ["type6", TYPE6_NAMES],
1456
1465
  ["void", VOID_TAGS],
1457
1466
  ["documentStructure", DOCUMENT_STRUCTURE_NAMES],
1467
+ // Added with F28, and it is the list that would have made F28 visible: the
1468
+ // derived census alphabet partitions names by their membership across THIS
1469
+ // table, so before it existed `frame` shared one 39-name class with `div`
1470
+ // and could never be sampled apart from it.
1471
+ ["noElement", NO_ELEMENT_NAMES],
1458
1472
  ["tablePart", TABLE_PART_NAMES],
1459
1473
  ["scopeBarrier", SCOPE_BARRIER_NAMES],
1460
1474
  ["foreignRoot", new Set(FOREIGN_ROOT_NAMES)]