@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.js CHANGED
@@ -370,16 +370,15 @@ function settleRefsAndEarliestUnresolved(cp) {
370
370
  var TYPE6_NAMES = new Set(htmlBlockNames);
371
371
  var TABLE_PART_NAMES = /* @__PURE__ */ new Set(["td", "th", "tr", "tbody", "thead", "tfoot", "caption", "col", "colgroup"]);
372
372
  var DOCUMENT_STRUCTURE_NAMES = /* @__PURE__ */ new Set(["html", "head", "body", "frameset"]);
373
+ var NO_ELEMENT_NAMES = /* @__PURE__ */ new Set([...DOCUMENT_STRUCTURE_NAMES, "frame", "image"]);
373
374
  var RETROACTIVE_OPENERS = [
374
375
  "<!doctype",
375
- "<html",
376
- "<head",
377
- "<body",
378
- "<frameset",
379
- "</html",
380
- "</head",
381
- "</body",
382
- "</frameset"
376
+ // DERIVED, so the trailing-partial guard cannot drift from the poison the
377
+ // confirmed lines get. It was transcribed until F28, and the transcription
378
+ // was already two names behind by then. `<frame` subsumes `<frameset`,
379
+ // which is why the derived list is SHORTER than the one it replaces and
380
+ // still covers strictly more.
381
+ ...[...NO_ELEMENT_NAMES].flatMap((name) => [`<${name}`, `</${name}`])
383
382
  ];
384
383
  function tailCarriesRetroactive(text) {
385
384
  const lower = text.toLowerCase();
@@ -631,6 +630,7 @@ function freshCheckpoint(defListEnabled, mathFlow, referenceTaint) {
631
630
  tagBalance: /* @__PURE__ */ new Map(),
632
631
  openTotal: 0,
633
632
  p5Tok: { kind: "data" },
633
+ formPointerMaybeSet: false,
634
634
  openStack: [],
635
635
  mdBlock: { kind: "none" },
636
636
  blankRun: 0,
@@ -791,9 +791,12 @@ function processConfirmedLine(cp, ln, text) {
791
791
  if (sealReleaseDerived(cp, ln, isBlockStart)) {
792
792
  cp.p5SealPending = false;
793
793
  if (false) {
794
- console.error(
795
- `[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))}).`
796
- );
794
+ sealReleaseEvaluations += 1;
795
+ if (!sealReleaseEnumerated(cp, ln, isBlockStart)) {
796
+ console.error(
797
+ `[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))}).`
798
+ );
799
+ }
797
800
  }
798
801
  }
799
802
  }
@@ -822,7 +825,7 @@ function processConfirmedLine(cp, ln, text) {
822
825
  if (tag === "plaintext") cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
823
826
  }
824
827
  }
825
- if (DOCUMENT_STRUCTURE_NAMES.has(tag)) cp.phasePoisonedAt = 0;
828
+ if (NO_ELEMENT_NAMES.has(tag)) cp.phasePoisonedAt = 0;
826
829
  if (tag === "template" && !closing) cp.phasePoisonedAt = 0;
827
830
  if (closing) {
828
831
  let idx = -1;
@@ -838,12 +841,14 @@ function processConfirmedLine(cp, ln, text) {
838
841
  return;
839
842
  }
840
843
  cp.openStack.splice(idx, 1);
844
+ if (tag === "form") cp.formPointerMaybeSet = false;
841
845
  const count = cp.tagBalance.get(tag) ?? 0;
842
846
  if (count > 0) {
843
847
  cp.tagBalance.set(tag, count - 1);
844
848
  cp.openTotal -= 1;
845
849
  }
846
850
  } else {
851
+ if (tag === "form") cp.formPointerMaybeSet = true;
847
852
  cp.openStack.push(tag);
848
853
  cp.tagBalance.set(tag, (cp.tagBalance.get(tag) ?? 0) + 1);
849
854
  cp.openTotal += 1;
@@ -970,7 +975,11 @@ function processConfirmedLine(cp, ln, text) {
970
975
  // mask suppresses them — which is exactly why `openTotal` reads 0
971
976
  // and the candidate looked safe), and the 2-5 interiors are the
972
977
  // same construct to both grammars.
973
- htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus",
978
+ htmlBalanced: cp.openTotal === 0 && cp.mdBlock.kind !== "html" && cp.p5Tok.kind !== "bogus" && // A form pointer parse5 may still be holding makes a LATER `<form>`
979
+ // in the tail vanish from the full parse while a split parse opens
980
+ // it — forward independence fails with every other condition clean.
981
+ // See the field doc.
982
+ !cp.formPointerMaybeSet,
974
983
  hazard: cp.hazardVerdict,
975
984
  seamRisk: cp.p5SealPending,
976
985
  defListSettled: null
@@ -1366,6 +1375,11 @@ var SCANNER_NAME_LISTS = [
1366
1375
  ["type6", TYPE6_NAMES],
1367
1376
  ["void", VOID_TAGS],
1368
1377
  ["documentStructure", DOCUMENT_STRUCTURE_NAMES],
1378
+ // Added with F28, and it is the list that would have made F28 visible: the
1379
+ // derived census alphabet partitions names by their membership across THIS
1380
+ // table, so before it existed `frame` shared one 39-name class with `div`
1381
+ // and could never be sampled apart from it.
1382
+ ["noElement", NO_ELEMENT_NAMES],
1369
1383
  ["tablePart", TABLE_PART_NAMES],
1370
1384
  ["scopeBarrier", SCOPE_BARRIER_NAMES],
1371
1385
  ["foreignRoot", new Set(FOREIGN_ROOT_NAMES)]