@crazyhappyone/dsh-tui 0.1.0-alpha.53 → 0.1.0-alpha.54

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 +64 -73
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -39537,91 +39537,76 @@ function padDisplayEnd(text4, width) {
39537
39537
  return `${text4}${" ".repeat(width - cols)}`;
39538
39538
  }
39539
39539
  function wrapDisplayLines(text4, maxCols) {
39540
- return wrapDisplayLinesLimited(text4, maxCols, Number.POSITIVE_INFINITY).lines;
39541
- }
39542
- function wrapDisplayLinesLimited(text4, maxCols, limit) {
39543
- const bounded = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : Number.POSITIVE_INFINITY;
39544
39540
  const source = text4.split("\n");
39545
- if (bounded === 0) return { lines: [], truncated: text4 !== "" };
39546
- if (maxCols <= 0) {
39547
- const lines = source.slice(0, bounded);
39548
- return { lines, truncated: source.length > lines.length };
39549
- }
39541
+ if (maxCols <= 0) return source;
39550
39542
  const out = [];
39551
- const room = () => out.length < bounded;
39552
- const mark2 = (line5) => {
39553
- const marker = `${wcwidthSafeSlice(line5, Math.max(0, maxCols - 1))}\u2026`;
39554
- if (out.length < bounded) out.push(marker);
39555
- else out[out.length - 1] = marker;
39556
- };
39557
- for (let lineIndex = 0; lineIndex < source.length; lineIndex += 1) {
39558
- const line5 = source[lineIndex] ?? "";
39559
- const laterLine = lineIndex < source.length - 1;
39543
+ for (const line5 of source) {
39560
39544
  if (line5 === "" || displayWidth(line5) <= maxCols) {
39561
- if (!room()) {
39562
- mark2("");
39563
- return { lines: out, truncated: true };
39564
- }
39565
- if (out.length + 1 === bounded && laterLine) {
39566
- mark2(line5);
39567
- return { lines: out, truncated: true };
39568
- }
39569
39545
  out.push(line5);
39570
39546
  continue;
39571
39547
  }
39572
39548
  if (/^[\x20-\x7e]*$/u.test(line5)) {
39573
39549
  for (let i2 = 0; i2 < line5.length; i2 += maxCols) {
39574
- const piece = line5.slice(i2, i2 + maxCols);
39575
- const continues = i2 + maxCols < line5.length || laterLine;
39576
- if (!room()) {
39577
- mark2(piece);
39578
- return { lines: out, truncated: true };
39579
- }
39580
- if (out.length + 1 === bounded && continues) {
39581
- mark2(piece);
39582
- return { lines: out, truncated: true };
39583
- }
39584
- out.push(piece);
39550
+ out.push(line5.slice(i2, i2 + maxCols));
39585
39551
  }
39586
39552
  continue;
39587
39553
  }
39588
39554
  let curLine = "";
39589
39555
  let curCols = 0;
39590
- const segments = [...GRAPHEME.segment(line5)];
39591
- for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex += 1) {
39592
- const segment2 = segments[segmentIndex]?.segment ?? "";
39556
+ for (const { segment: segment2 } of GRAPHEME.segment(line5)) {
39593
39557
  const width = displayWidth(segment2);
39594
- if (curCols + width <= maxCols || curLine === "") {
39558
+ if (curCols + width > maxCols && curLine !== "") {
39559
+ out.push(curLine);
39560
+ curLine = segment2;
39561
+ curCols = width;
39562
+ } else {
39595
39563
  curLine += segment2;
39596
39564
  curCols += width;
39597
- continue;
39598
- }
39599
- if (!room()) {
39600
- mark2(curLine);
39601
- return { lines: out, truncated: true };
39602
39565
  }
39603
- const continues = segmentIndex < segments.length || laterLine;
39604
- if (out.length + 1 === bounded && continues) {
39605
- mark2(curLine);
39606
- return { lines: out, truncated: true };
39607
- }
39608
- out.push(curLine);
39609
- curLine = segment2;
39610
- curCols = width;
39611
39566
  }
39612
39567
  if (curLine !== "") {
39613
- if (!room()) {
39614
- mark2(curLine);
39615
- return { lines: out, truncated: true };
39616
- }
39617
- if (out.length + 1 === bounded && laterLine) {
39618
- mark2(curLine);
39619
- return { lines: out, truncated: true };
39620
- }
39621
39568
  out.push(curLine);
39622
39569
  }
39623
39570
  }
39624
- return { lines: out, truncated: false };
39571
+ return out;
39572
+ }
39573
+ function wrapDisplayLinesLimited(text4, maxCols, limit) {
39574
+ const bounded = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : Number.POSITIVE_INFINITY;
39575
+ if (bounded === 0) return { lines: [], truncated: text4 !== "" };
39576
+ if (bounded === Number.POSITIVE_INFINITY) return { lines: wrapDisplayLines(text4, maxCols), truncated: false };
39577
+ if (maxCols <= 0) {
39578
+ const lines2 = text4.split("\n", bounded + 1);
39579
+ const truncated2 = lines2.length > bounded;
39580
+ if (truncated2) lines2.pop();
39581
+ return { lines: lines2, truncated: truncated2 };
39582
+ }
39583
+ const lines = [];
39584
+ let row = "";
39585
+ let columns = 0;
39586
+ const truncated = () => ({
39587
+ lines: [...lines, `${wcwidthSafeSlice(row, Math.max(0, maxCols - 1))}\u2026`],
39588
+ truncated: true
39589
+ });
39590
+ for (const { segment: segment2 } of GRAPHEME.segment(text4)) {
39591
+ if (segment2 === "\n") {
39592
+ if (lines.length + 1 === bounded) return truncated();
39593
+ lines.push(row);
39594
+ row = "";
39595
+ columns = 0;
39596
+ continue;
39597
+ }
39598
+ const width = displayWidth(segment2);
39599
+ if (columns + width > maxCols && row !== "") {
39600
+ if (lines.length + 1 === bounded) return truncated();
39601
+ lines.push(row);
39602
+ row = "";
39603
+ columns = 0;
39604
+ }
39605
+ row += segment2;
39606
+ columns += width;
39607
+ }
39608
+ lines.push(row);
39609
+ return { lines, truncated: false };
39625
39610
  }
39626
39611
 
39627
39612
  // packages/tui/tui-render/src/terminal-capabilities.ts
@@ -56405,7 +56390,7 @@ function settledProjectionSignature(row, revisions, options) {
56405
56390
  transcriptBlockVersion(row, revisions),
56406
56391
  options.hasSubsequent ? "gap" : "tail",
56407
56392
  options.isLatestAssistant ? "latest" : "",
56408
- options.expandedCompactionId ?? ""
56393
+ row.kind === "compaction" && options.expandedCompactionId === row.divider.compactionId ? "expanded" : ""
56409
56394
  ].join("\0");
56410
56395
  }
56411
56396
  function activeTurnVersion(turn, revisions) {
@@ -57153,7 +57138,6 @@ function StreamView({
57153
57138
  const toolSticky = /* @__PURE__ */ new Map();
57154
57139
  const userSticky = /* @__PURE__ */ new Map();
57155
57140
  const projectorCache = projectorStates.current;
57156
- const project = makeBlockProjector({ toolRows, plainRows, locale }, storeBlocks);
57157
57141
  const latestAssistant = hasActiveTurn ? void 0 : latestAssistantId(history, void 0);
57158
57142
  for (const [index2, row] of transcript.entries()) {
57159
57143
  const id = transcriptBlockId(row);
@@ -57174,7 +57158,13 @@ function StreamView({
57174
57158
  nextCache.set(id, cached2);
57175
57159
  continue;
57176
57160
  }
57177
- const blocksBefore = storeBlocks.size;
57161
+ const rowBlocks = /* @__PURE__ */ new Map();
57162
+ const project = makeBlockProjector({ toolRows, plainRows, locale }, rowBlocks);
57163
+ const collectBlocks = () => {
57164
+ const blocks = [...rowBlocks.values()];
57165
+ for (const block of blocks) storeBlocks.set(block.entry.id, block);
57166
+ return blocks;
57167
+ };
57178
57168
  if (row.kind === "compaction") {
57179
57169
  const meta3 = {
57180
57170
  compactionSummary: row.divider.summary,
@@ -57193,7 +57183,7 @@ function StreamView({
57193
57183
  signature,
57194
57184
  lines: projection.lines,
57195
57185
  textRanges: void 0,
57196
- storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57186
+ storeBlocks: collectBlocks(),
57197
57187
  reasoningSticky: void 0,
57198
57188
  toolSticky: void 0,
57199
57189
  userSticky: void 0
@@ -57214,7 +57204,7 @@ function StreamView({
57214
57204
  signature,
57215
57205
  lines: projection.lines,
57216
57206
  textRanges: void 0,
57217
- storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57207
+ storeBlocks: collectBlocks(),
57218
57208
  reasoningSticky: void 0,
57219
57209
  toolSticky: void 0,
57220
57210
  userSticky: sticky
@@ -57329,7 +57319,7 @@ function StreamView({
57329
57319
  signature,
57330
57320
  lines: built,
57331
57321
  textRanges: ranges.length > 0 ? ranges : void 0,
57332
- storeBlocks: [...storeBlocks.values()].slice(blocksBefore),
57322
+ storeBlocks: collectBlocks(),
57333
57323
  reasoningSticky: reasoningSticky.get(id),
57334
57324
  toolSticky: toolSticky.get(id),
57335
57325
  userSticky: void 0
@@ -59123,7 +59113,8 @@ var SETTINGS_GROUP_LABELS = {
59123
59113
  var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
59124
59114
  function fit(text4, width) {
59125
59115
  const safe = escapeContent(text4).replace(/\n/gu, " \u21B5 ");
59126
- return displayWidth(safe) <= width ? safe : `${wcwidthSafeSlice(safe, Math.max(0, width - 1))}\u2026`;
59116
+ const prefix = wcwidthSafeSlice(safe, width);
59117
+ return prefix.length === safe.length ? safe : `${wcwidthSafeSlice(prefix, Math.max(0, width - 1))}\u2026`;
59127
59118
  }
59128
59119
  function canToggleSetting(row) {
59129
59120
  return row !== void 0 && row.navigable !== true && row.editable !== false && (row.value === "true" || row.value === "false" || row.namespace === "tui" && ["brandAnimation", "locale", "theme", "colorTier"].includes(row.field));
@@ -99818,7 +99809,6 @@ function settingsTreeFromDescribe(descriptors, credentials) {
99818
99809
  const modelId = record2(value).id;
99819
99810
  const identity = Array.isArray(parentValue) && typeof modelId === "string" && parentValue.filter((entry) => record2(entry).id === modelId).length === 1 ? `id:${modelId}` : key;
99820
99811
  const id = `${parentId}:${JSON.stringify(identity)}`;
99821
- const nested = value !== null && typeof value === "object";
99822
99812
  const navigable = navigableValue(value);
99823
99813
  const meta3 = record2(record2(schema).meta);
99824
99814
  const label = Array.isArray(parentValue) ? String(record2(value).id ?? record2(value).name ?? key) : key;
@@ -107027,14 +107017,15 @@ ${row.hint ?? ""}` });
107027
107017
  if (this.closed) return;
107028
107018
  this.settingsMovePending = true;
107029
107019
  if (this.settingsMoveEmit !== void 0) return;
107030
- const token = queueMicrotask(() => {
107020
+ const token = {};
107021
+ this.settingsMoveEmit = token;
107022
+ queueMicrotask(() => {
107031
107023
  if (this.settingsMoveEmit !== token || this.closed || !this.settingsMovePending) return;
107032
107024
  this.settingsMoveEmit = void 0;
107033
107025
  this.settingsMovePending = false;
107034
107026
  if (this.emitTimer !== void 0) this.emitPending = true;
107035
107027
  else this.notifyListeners();
107036
107028
  });
107037
- this.settingsMoveEmit = token;
107038
107029
  }
107039
107030
  emit() {
107040
107031
  if (this.closed) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crazyhappyone/dsh-tui",
3
- "version": "0.1.0-alpha.53",
3
+ "version": "0.1.0-alpha.54",
4
4
  "description": "DeepSeek Harness terminal interface: a dsh plugin bundle plus its launcher",
5
5
  "type": "module",
6
6
  "license": "MIT",