@crazyhappyone/dsh-tui 0.1.0-alpha.47 → 0.1.0-alpha.48

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/dist/index.js +40 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58835,7 +58835,7 @@ function escapeContent(text4) {
58835
58835
  (char) => `\\x${char.charCodeAt(0).toString(16).padStart(2, "0")}`
58836
58836
  ).replace(/\u001B/g, "\\x1b");
58837
58837
  }
58838
- var WIDE_SYMBOLS_OR_EMOJIS = /[\u26A0\u2699\u2139\u23F1\u2328\u2709\u270F\u2712\u2702\u26C8\u2764]/gu;
58838
+ var EMOJI_OR_PICTOGRAPHIC = /\p{Extended_Pictographic}/u;
58839
58839
  function displayWidth(text4) {
58840
58840
  if (text4 === "") return 0;
58841
58841
  let cols = 0;
@@ -58853,16 +58853,15 @@ function displayWidth(text4) {
58853
58853
  }
58854
58854
  if (simple) return cols;
58855
58855
  const base = stringWidth(text4);
58856
- if (!/[\u26A0\u2699\u2139\u23F1\u2328\u2709\u270F\u2712\u2702\u26C8\u2764]/u.test(text4)) {
58856
+ if (!/[\u{1F300}-\u{1FAFF}\u2000-\u2BFF]/u.test(text4)) {
58857
58857
  return base;
58858
58858
  }
58859
58859
  let extra2 = 0;
58860
- for (const match of text4.matchAll(WIDE_SYMBOLS_OR_EMOJIS)) {
58861
- const nextCode = text4.charCodeAt(match.index + 1);
58862
- if (nextCode === 65039 || nextCode === 65038) {
58863
- continue;
58860
+ for (const { segment: segment2 } of GRAPHEME.segment(text4)) {
58861
+ if (segment2.includes("\uFE0E")) continue;
58862
+ if (EMOJI_OR_PICTOGRAPHIC.test(segment2) && stringWidth(segment2) === 1) {
58863
+ extra2 += 1;
58864
58864
  }
58865
- extra2 += 1;
58866
58865
  }
58867
58866
  return base + extra2;
58868
58867
  }
@@ -58917,7 +58916,7 @@ function formatSymbolSpacing(text4) {
58917
58916
  "$1 $2"
58918
58917
  );
58919
58918
  res = res.replace(
58920
- /([\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u303F\uFF01-\uFF60])([\u{1F300}-\u{1FAFF}\u2600-\u27BF])/gu,
58919
+ /([\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u303F\uFF01-\uFF60])([\u{1F300}-\u{1FAFF}\u2600-\u27BF][\uFE0E\uFE0F]?)/gu,
58921
58920
  "$1 $2"
58922
58921
  );
58923
58922
  return res;
@@ -69334,7 +69333,10 @@ function wrapRow(row, widths, header) {
69334
69333
  const cells = row.map((cell, col) => {
69335
69334
  const linesForCell = wrapped[col];
69336
69335
  const lineText = linesForCell[lineIndex] ?? "";
69337
- const text4 = padDisplayEnd(lineText, widths[col]);
69336
+ const colWidth = widths[col];
69337
+ const padded = padDisplayEnd(lineText, colWidth);
69338
+ const fitted = displayWidth(padded) > colWidth ? wcwidthSafeSlice(padded, colWidth) : padded;
69339
+ const text4 = padDisplayEnd(fitted, colWidth);
69338
69340
  return { text: text4, width: displayWidth(text4), column: cell.column, row: cell.row };
69339
69341
  });
69340
69342
  out.push({ kind: "row", header, cells });
@@ -69581,15 +69583,32 @@ function renderBlockquote(children, width, rowOffset, sourceStart, hyperlinks2)
69581
69583
  return freezeLine(buffer, rowOffset + index2, index2 === 0 ? sourceStart : -1);
69582
69584
  });
69583
69585
  }
69584
- function renderList(list2, width, rowOffset, sourceStart, hyperlinks2) {
69586
+ function renderList(list2, width, rowOffset, sourceStart, hyperlinks2, depth = 0) {
69585
69587
  const lines = [];
69586
69588
  const ordered = list2.ordered === true;
69589
+ const indent2 = " ".repeat(depth);
69587
69590
  list2.children.forEach((item, index2) => {
69588
- const marker = ordered ? `${(list2.start ?? 1) + index2}. ` : "- ";
69591
+ const marker = `${indent2}${ordered ? `${String((list2.start ?? 1) + index2)}. ` : "- "}`;
69589
69592
  const segments = [{ text: marker, token: "fg", bold: false }];
69590
- const children = item.children;
69591
- for (const child of children) segments.push(...inlineToSegments(child, hyperlinks2));
69592
- lines.push(...wrapInlineSegments(segments, width, rowOffset + lines.length, index2 === 0 ? sourceStart : -1));
69593
+ for (const child of item.children) {
69594
+ if (child.type === "list") {
69595
+ if (segments.length > 1) {
69596
+ lines.push(...wrapInlineSegments(segments, width, rowOffset + lines.length, index2 === 0 ? sourceStart : -1));
69597
+ segments.length = 0;
69598
+ }
69599
+ lines.push(...renderList(child, width, rowOffset + lines.length, -1, hyperlinks2, depth + 1));
69600
+ } else if ("children" in child && Array.isArray(child.children)) {
69601
+ const phrasingChildren = child.children;
69602
+ for (const grandchild of phrasingChildren) {
69603
+ segments.push(...inlineToSegments(grandchild, hyperlinks2));
69604
+ }
69605
+ } else {
69606
+ segments.push(...inlineToSegments(child, hyperlinks2));
69607
+ }
69608
+ }
69609
+ if (segments.length > 1 || segments.length === 1 && segments[0]?.text !== marker) {
69610
+ lines.push(...wrapInlineSegments(segments, width, rowOffset + lines.length, index2 === 0 ? sourceStart : -1));
69611
+ }
69593
69612
  });
69594
69613
  return lines;
69595
69614
  }
@@ -69870,8 +69889,11 @@ function renderGridRow(row, widths, header, rowOffset, sourceStart) {
69870
69889
  for (let column = 0; column < widths.length; column += 1) {
69871
69890
  if (column > 0) appendSegment(buffer, { text: " \u2502 ", token: "fgDim", bold: false });
69872
69891
  const text4 = wrapped[column]?.[lineIndex] ?? "";
69892
+ const cellWidth = widths[column];
69893
+ const padded = padDisplayEnd(text4, cellWidth);
69894
+ const fitted = displayWidth(padded) > cellWidth ? wcwidthSafeSlice(padded, cellWidth) : padded;
69873
69895
  appendSegment(buffer, {
69874
- text: padDisplayEnd(text4, widths[column]),
69896
+ text: padDisplayEnd(fitted, cellWidth),
69875
69897
  token: header ? "accentText" : "fg",
69876
69898
  bold: header
69877
69899
  });
@@ -81372,6 +81394,9 @@ function formatTurnError(error51) {
81372
81394
  }
81373
81395
  const lowered = rawMessage.toLowerCase();
81374
81396
  const antigravity = lowered.includes("antigravity") || rawMessage.includes("/anti");
81397
+ if (code2 === "CANCELLED" || lowered.includes("cancelled") || lowered.includes("canceled")) {
81398
+ return antigravity ? `\u26A0\uFE0F **Antigravity \u5DF2\u505C\u6B62**\uFF1A${rawMessage}\u3002\u8FD9\u662F\u7528\u6237\u4E2D\u65AD\uFF0C\u4E0D\u662F\u767B\u5F55\u5931\u6548\u3002\u76F4\u63A5\u518D\u53D1\u4E00\u6761\u5373\u53EF\uFF1B\u4E0D\u5FC5\u6267\u884C \`/anti login\`\uFF0C\u4E5F\u4E0D\u8981\u4F7F\u7528 \`/key\`\u3002` : `\u26A0\uFE0F **\u5DF2\u505C\u6B62\u751F\u6210**\uFF1A${rawMessage}\u3002\u53EF\u4EE5\u76F4\u63A5\u518D\u53D1\u4E00\u6761\u3002`;
81399
+ }
81375
81400
  if (code2 === "TIMEOUT" || lowered.includes("timed out") || lowered.includes("timeout") || lowered.includes("stalled") || rawMessage.includes("ETIMEDOUT")) {
81376
81401
  return antigravity ? `\u26A0\uFE0F **Antigravity \u8BF7\u6C42\u8D85\u65F6**\uFF1A${rawMessage}\u3002\u8FD9\u662F\u94FE\u8DEF\u6216\u6D41\u8D85\u65F6\uFF0C\u4E0D\u662F\u767B\u5F55\u5931\u6548\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF1B\u4E0D\u5FC5\u6267\u884C \`/anti login\`\uFF0C\u4E5F\u4E0D\u8981\u4F7F\u7528 \`/key\`\u3002` : `\u26A0\uFE0F **\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25**\uFF1A\u65E0\u6CD5\u8FDE\u63A5\u5230\u6A21\u578B\u670D\u52A1\uFF08${rawMessage}\uFF09\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u6216\u4EE3\u7406\u914D\u7F6E\u3002`;
81377
81402
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crazyhappyone/dsh-tui",
3
- "version": "0.1.0-alpha.47",
3
+ "version": "0.1.0-alpha.48",
4
4
  "description": "Source-runtime launcher for the DeepSeek Harness terminal interface",
5
5
  "type": "module",
6
6
  "license": "MIT",