@hasna/assistants 0.6.29 → 0.6.31

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
@@ -47631,6 +47631,8 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
47631
47631
  };
47632
47632
  const visibleSkills = getVisibleItems(filteredSkills);
47633
47633
  const visibleCommands = getVisibleItems(filteredCommands);
47634
+ const { stdout } = use_stdout_default();
47635
+ const terminalWidth = stdout?.columns ?? 80;
47634
47636
  const lines = value.split(`
47635
47637
  `);
47636
47638
  const lineCount = lines.length;
@@ -47641,7 +47643,7 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
47641
47643
  /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
47642
47644
  children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
47643
47645
  dimColor: true,
47644
- children: "\u2500".repeat(80)
47646
+ children: "\u2500".repeat(terminalWidth)
47645
47647
  }, undefined, false, undefined, this)
47646
47648
  }, undefined, false, undefined, this),
47647
47649
  /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
@@ -47677,7 +47679,7 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
47677
47679
  /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
47678
47680
  children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
47679
47681
  dimColor: true,
47680
- children: "\u2500".repeat(80)
47682
+ children: "\u2500".repeat(terminalWidth)
47681
47683
  }, undefined, false, undefined, this)
47682
47684
  }, undefined, false, undefined, this),
47683
47685
  isProcessing && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
@@ -48688,7 +48690,9 @@ function estimateMessageLines(message, maxWidth) {
48688
48690
  const contentLines = content.length > 0 ? content.split(`
48689
48691
  `) : [];
48690
48692
  const hasContent = contentLines.length > 0;
48691
- const wrappedLines = contentLines.length > 0 ? countWrappedLines(contentLines, maxWidth) : 0;
48693
+ const prefixWidth = message.role === "user" || message.role === "assistant" ? 2 : 0;
48694
+ const effectiveWidth = maxWidth ? Math.max(1, maxWidth - prefixWidth) : maxWidth;
48695
+ const wrappedLines = contentLines.length > 0 ? countWrappedLines(contentLines, effectiveWidth) : 0;
48692
48696
  let lines = hasContent ? Math.max(1, wrappedLines) : 0;
48693
48697
  if (message.role === "assistant" && message.toolCalls?.length) {
48694
48698
  lines += estimateToolPanelLines(message.toolCalls, message.toolResults, hasContent);
@@ -48716,6 +48720,7 @@ function stripAnsi4(text) {
48716
48720
  return text.replace(/\x1B\[[0-9;]*m/g, "");
48717
48721
  }
48718
48722
  function estimateActivityEntryLines(entry, wrapWidth, renderWidth) {
48723
+ const effectiveWidth = Math.max(1, wrapWidth - 2);
48719
48724
  if (entry.type === "text") {
48720
48725
  const content = entry.content ?? "";
48721
48726
  if (!content.trim())
@@ -48723,7 +48728,7 @@ function estimateActivityEntryLines(entry, wrapWidth, renderWidth) {
48723
48728
  const rendered = renderMarkdown(content, { maxWidth: renderWidth });
48724
48729
  const lines = stripAnsi4(rendered).split(`
48725
48730
  `);
48726
- const wrapped = countWrappedLines(lines, wrapWidth);
48731
+ const wrapped = countWrappedLines(lines, effectiveWidth);
48727
48732
  return Math.max(1, wrapped) + 2;
48728
48733
  }
48729
48734
  if (entry.type === "tool_call") {
@@ -48733,7 +48738,7 @@ function estimateActivityEntryLines(entry, wrapWidth, renderWidth) {
48733
48738
  const content = entry.toolResult ? truncateToolResult(entry.toolResult) : "";
48734
48739
  const lines = content.split(`
48735
48740
  `);
48736
- const wrapped = countWrappedLines(lines, wrapWidth);
48741
+ const wrapped = countWrappedLines(lines, effectiveWidth);
48737
48742
  return Math.max(1, wrapped) + 2;
48738
48743
  }
48739
48744
  return 0;
@@ -49861,24 +49866,35 @@ function buildDisplayMessages(messages, chunkLines, wrapChars, options) {
49861
49866
  display.push(msg);
49862
49867
  continue;
49863
49868
  }
49869
+ if (msg.role === "assistant") {
49870
+ const rendered = renderMarkdown(content, { maxWidth: options?.maxWidth });
49871
+ const renderedLines = rendered.split(`
49872
+ `);
49873
+ if (renderedLines.length <= chunkLines) {
49874
+ display.push({ ...msg, content: rendered, __rendered: true });
49875
+ continue;
49876
+ }
49877
+ const chunks2 = chunkRenderedLines(renderedLines, chunkLines);
49878
+ for (let i = 0;i < chunks2.length; i++) {
49879
+ const chunkContent = chunks2[i].join(`
49880
+ `);
49881
+ display.push({
49882
+ ...msg,
49883
+ id: `${msg.id}::chunk-${i}`,
49884
+ content: chunkContent,
49885
+ __rendered: true,
49886
+ toolCalls: i === chunks2.length - 1 ? msg.toolCalls : undefined,
49887
+ toolResults: i === chunks2.length - 1 ? msg.toolResults : undefined
49888
+ });
49889
+ }
49890
+ continue;
49891
+ }
49864
49892
  const lines = wrapTextLines(content, wrapChars);
49865
49893
  if (lines.length <= chunkLines) {
49866
- if (msg.role === "assistant") {
49867
- const rendered2 = renderMarkdown(lines.join(`
49868
- `), { maxWidth: options?.maxWidth });
49869
- display.push({ ...msg, content: rendered2, __rendered: true });
49870
- } else {
49871
- display.push(msg);
49872
- }
49894
+ display.push(msg);
49873
49895
  continue;
49874
49896
  }
49875
- const baseContent = lines.join(`
49876
- `);
49877
- const renderAssistant = msg.role === "assistant";
49878
- const rendered = renderAssistant ? renderMarkdown(baseContent, { maxWidth: options?.maxWidth }) : baseContent;
49879
- const renderedLines = rendered.split(`
49880
- `);
49881
- const chunks = chunkRenderedLines(renderedLines, chunkLines);
49897
+ const chunks = chunkRenderedLines(lines, chunkLines);
49882
49898
  for (let i = 0;i < chunks.length; i++) {
49883
49899
  const chunkContent = chunks[i].join(`
49884
49900
  `);
@@ -49886,7 +49902,6 @@ function buildDisplayMessages(messages, chunkLines, wrapChars, options) {
49886
49902
  ...msg,
49887
49903
  id: `${msg.id}::chunk-${i}`,
49888
49904
  content: chunkContent,
49889
- __rendered: renderAssistant,
49890
49905
  toolCalls: i === chunks.length - 1 ? msg.toolCalls : undefined,
49891
49906
  toolResults: i === chunks.length - 1 ? msg.toolResults : undefined
49892
49907
  });
@@ -50949,7 +50964,7 @@ function formatStreamEvent(chunk) {
50949
50964
 
50950
50965
  // packages/terminal/src/index.tsx
50951
50966
  var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
50952
- var VERSION3 = "0.6.22";
50967
+ var VERSION3 = "0.6.31";
50953
50968
  process.env.ASSISTANTS_VERSION ??= VERSION3;
50954
50969
  function parseArgs(argv) {
50955
50970
  const args = argv.slice(2);
@@ -51105,4 +51120,4 @@ if (options.print !== null) {
51105
51120
  });
51106
51121
  }
51107
51122
 
51108
- //# debugId=635A1CBC05837E5664756E2164756E21
51123
+ //# debugId=656AEF3B850A245D64756E2164756E21