@xynogen/pix-display 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/thinking.ts +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-display",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Pi core extension — paste chip rendering and thinking block display",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/thinking.ts CHANGED
@@ -71,7 +71,7 @@ const PARTIAL_TAIL_RE = /<\/?([a-zA-Z]*)$/;
71
71
  function stripPartialTailTag(text: string): string {
72
72
  const match = text.match(PARTIAL_TAIL_RE);
73
73
  if (!match) return text;
74
- const fragment = match[1].toLowerCase();
74
+ const fragment = (match[1] ?? "").toLowerCase();
75
75
  if (TAG_NAMES.some((tag) => tag.startsWith(fragment))) {
76
76
  return text.slice(0, match.index);
77
77
  }
@@ -120,7 +120,7 @@ function splitThinking(text: string): Block[] {
120
120
  let match = CLOSED_BLOCK_RE.exec(rest);
121
121
  while (match) {
122
122
  pushText(blocks, rest.slice(0, match.index));
123
- pushThinking(blocks, match[2]);
123
+ pushThinking(blocks, match[2] ?? "");
124
124
  rest = rest.slice(match.index + match[0].length);
125
125
  CLOSED_BLOCK_RE.lastIndex = 0;
126
126
  match = CLOSED_BLOCK_RE.exec(rest);
@@ -135,7 +135,7 @@ function splitThinking(text: string): Block[] {
135
135
  blocks,
136
136
  openMatch.input.slice(0, openMatch.index).replace(ORPHAN_TAG_RE, ""),
137
137
  );
138
- pushThinking(blocks, openMatch[2].replace(ORPHAN_TAG_RE, ""));
138
+ pushThinking(blocks, (openMatch[2] ?? "").replace(ORPHAN_TAG_RE, ""));
139
139
  } else {
140
140
  // Strip any orphan tags from the trailing text.
141
141
  pushText(blocks, rest.replace(ORPHAN_TAG_RE, ""));