@fungi.computer/parakeet 0.11.14 → 0.11.16

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { hasVisibleReasoning } from "../core/assistant-visibility.js";
2
3
  import { MarkdownRenderer } from "./MarkdownRenderer.js";
3
4
  import { ThinkingBlock } from "./ThinkingBlock.js";
4
5
  /** User-message admission state, shared by full and compact transcript rows. */
@@ -14,7 +15,8 @@ export function ChatMessage({ children, isError, pending, speaker, thinking, mar
14
15
  }, children: [_jsx(PendingMessageStatus, { pending: pending }), _jsx("div", { className: "message-body text-base-content", children: content })] }));
15
16
  }
16
17
  const hasText = children.trim().length > 0;
17
- if (!hasText && !thinking)
18
+ const hasThinking = hasVisibleReasoning(thinking);
19
+ if (!hasText && !hasThinking)
18
20
  return null;
19
- return (_jsxs("div", { "data-speaker": "agent", "data-pending": pending ? "true" : undefined, children: [thinking ? _jsx(ThinkingBlock, { thinking: thinking }) : null, hasText ? (_jsx("div", { className: `px-3 py-2 ${isError ? "text-error" : "text-base-content"}`, children: content })) : null] }));
21
+ return (_jsxs("div", { "data-speaker": "agent", "data-pending": pending ? "true" : undefined, children: [hasThinking && thinking !== undefined ? (_jsx(ThinkingBlock, { thinking: thinking })) : null, hasText ? (_jsx("div", { className: `px-3 py-2 ${isError ? "text-error" : "text-base-content"}`, children: content })) : null] }));
20
22
  }
@@ -71,7 +71,9 @@ function CallRow({ call, tool, disclosureId, size, disclosure, onToggle, renderT
71
71
  onToggle(disclosureId, defaultOpen);
72
72
  }, open: open, size: size, summary: _jsxs(_Fragment, { children: [_jsx("span", { className: "text-base-content", children: running ? call.activeVerb : call.verb }), " ", _jsx("span", { className: "font-mono", children: call.label })] }), tone: call.status === "error" && call.recovered !== true
73
73
  ? "error"
74
- : "neutral", trailing: _jsxs(_Fragment, { children: [call.recovered === true ? _jsx("span", { children: "recovered" }) : null, call.exitCode === undefined ? null : (_jsxs(Badge, { size: "sm", tone: call.recovered === true ? "neutral" : "error", children: ["exit ", String(call.exitCode)] })), call.durationMs === undefined ? null : (_jsx("span", { children: formatToolDuration(call.durationMs) })), _jsx(Status, { motion: running ? "bounce" : "none", title: call.status === "unknown" ? "result unavailable" : call.status, tone: statusTone(call.status, call.recovered === true) })] }), children: _jsx(CallBody, { call: call, disclosure: disclosure, onToggle: onToggle, mediaClaimed: tool !== undefined && claimsToolMedia?.(tool) === true, tool: tool }) }), call.live === undefined ? null : (_jsx("pre", { className: monoBlock, "aria-label": "Live tool output", children: toolLiveLines(call, open).map((line, index) => (_jsx("span", { className: "block whitespace-pre", children: line || "\u00a0" }, String(index)))) })), call.status === "completed" && tool?.result !== undefined
74
+ : "neutral", trailing: _jsxs(_Fragment, { children: [call.recovered === true ? _jsx("span", { children: "recovered" }) : null, call.exitCode === undefined ? null : (_jsxs(Badge, { size: "sm", tone: call.status === "error" && call.recovered !== true
75
+ ? "error"
76
+ : "neutral", children: ["exit ", String(call.exitCode)] })), call.durationMs === undefined ? null : (_jsx("span", { children: formatToolDuration(call.durationMs) })), _jsx(Status, { motion: running ? "bounce" : "none", title: call.status === "unknown" ? "result unavailable" : call.status, tone: statusTone(call.status, call.recovered === true) })] }), children: _jsx(CallBody, { call: call, disclosure: disclosure, onToggle: onToggle, mediaClaimed: tool !== undefined && claimsToolMedia?.(tool) === true, tool: tool }) }), call.live === undefined ? null : (_jsx("pre", { className: monoBlock, "aria-label": "Live tool output", children: toolLiveLines(call, open).map((line, index) => (_jsx("span", { className: "block whitespace-pre", children: line || "\u00a0" }, String(index)))) })), call.status === "completed" && tool?.result !== undefined
75
77
  ? renderToolActions?.(tool)
76
78
  : null] }));
77
79
  }
@@ -83,8 +85,8 @@ export const ToolGroup = memo(function ToolGroup({ group, disclosure, onToggle,
83
85
  const active = group.active;
84
86
  const single = group.calls.length === 1 ? group.calls[0] : undefined;
85
87
  if (single !== undefined)
86
- return (_jsx("div", { className: "px-1", children: _jsx(CallRow, { call: single, disclosure: disclosure, disclosureId: single.id, onToggle: onToggle, renderToolActions: renderToolActions, claimsToolMedia: claimsToolMedia, size: "row", tool: group.tools[0] }) }));
87
- return (_jsxs("div", { className: "px-1", children: [_jsx(Disclosure, { className: "[&>.caps-disclosure-panel]:hidden", leading: _jsx(Sigil, { name: "list", size: 16 }), onOpenChange: () => {
88
+ return (_jsx("div", { children: _jsx(CallRow, { call: single, disclosure: disclosure, disclosureId: single.id, onToggle: onToggle, renderToolActions: renderToolActions, claimsToolMedia: claimsToolMedia, size: "row", tool: group.tools[0] }) }));
89
+ return (_jsxs("div", { children: [_jsx(Disclosure, { className: "[&>.caps-disclosure-panel]:hidden", leading: _jsx(Sigil, { name: "list", size: 16 }), onOpenChange: () => {
88
90
  onToggle(group.id, defaultOpen);
89
91
  }, open: open, summary: running && active !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-base-content", children: active.activeVerb }), " ", _jsx("span", { className: "font-mono", children: active.label }), " \u00B7", " ", String(group.calls.length), " ", group.calls.length === 1 ? "call" : "calls"] })) : (_jsxs("span", { className: "text-base-content", children: [group.summary, " \u00B7 ", String(group.calls.length), " ", group.calls.length === 1 ? "call" : "calls"] })), tone: group.status === "error" ? "error" : "neutral", trailing: _jsxs(_Fragment, { children: [group.failedCount > 0 ? (_jsxs("span", { className: "text-error", children: [String(group.failedCount), " failed"] })) : null, group.recoveredCount > 0 ? (_jsxs("span", { children: [String(group.recoveredCount), " recovered"] })) : null, group.durationMs === undefined ? null : (_jsx("span", { children: formatToolDuration(group.durationMs) })), _jsx(Status, { motion: running ? "bounce" : "none", title: group.status === "unknown" ? "result unavailable" : group.status, tone: statusTone(group.status) })] }) }), visibleToolCalls(group, open).map((call) => (_jsx(CallRow, { call: call, disclosure: disclosure, disclosureId: call.id, onToggle: onToggle, renderToolActions: renderToolActions, claimsToolMedia: claimsToolMedia, size: "row", tool: group.tools.find((tool) => tool.id === call.id) }, call.id))), group.status === "completed" && group.calls.length > 3 ? (_jsx("button", { "aria-expanded": open, className: "btn btn-ghost btn-xs text-dim", onClick: () => {
90
92
  onToggle(group.id, defaultOpen);
@@ -1,3 +1,9 @@
1
1
  import type { AssistantMessageItem } from "../store/types.js";
2
+ /**
3
+ * Whether reasoning text shows anything a reader can see. Whitespace and
4
+ * invisible format characters (zero-width spaces and joiners, byte-order
5
+ * marks) are not text; a thinking row made only of them renders nothing.
6
+ */
7
+ export declare function hasVisibleReasoning(thinking: string | undefined): boolean;
2
8
  /** One rule for whether an assistant row has content either renderer shows. */
3
9
  export declare function assistantMessageVisible(item: AssistantMessageItem): boolean;
@@ -1,4 +1,12 @@
1
+ /**
2
+ * Whether reasoning text shows anything a reader can see. Whitespace and
3
+ * invisible format characters (zero-width spaces and joiners, byte-order
4
+ * marks) are not text; a thinking row made only of them renders nothing.
5
+ */
6
+ export function hasVisibleReasoning(thinking) {
7
+ return thinking !== undefined && /[^\s\p{Cf}]/u.test(thinking);
8
+ }
1
9
  /** One rule for whether an assistant row has content either renderer shows. */
2
10
  export function assistantMessageVisible(item) {
3
- return item.text.trim() !== "" || (item.thinking?.trim() ?? "") !== "";
11
+ return item.text.trim() !== "" || hasVisibleReasoning(item.thinking);
4
12
  }
@@ -69,7 +69,8 @@ function collectAssistantBlocks(value) {
69
69
  for (const block of value.content) {
70
70
  if (block.type === "text")
71
71
  text.push(block.text);
72
- if (block.type === "thinking")
72
+ // Redacted reasoning carries a placeholder, not text a reader can read.
73
+ if (block.type === "thinking" && block.redacted !== true)
73
74
  thinking.push(block.thinking);
74
75
  if (block.type === "toolCall")
75
76
  tools.push(toolItem(block, value.timestamp));
package/dist/parakeet.js CHANGED
@@ -214,6 +214,9 @@ function ConversationTimeline({ disambiguateAuthors, clientActions, onOpen, focu
214
214
  ? "error"
215
215
  : undefined, ref: timeline.measureElement, style: {
216
216
  left: 0,
217
+ // The last row keeps room for the jump-to-bottom control
218
+ // (2rem plus its 1rem offset) so it can scroll clear of it.
219
+ paddingBottom: virtualItem.index === count - 1 ? 48 : undefined,
217
220
  position: "absolute",
218
221
  top: 0,
219
222
  transform: `translateY(${String(virtualItem.start)}px)`,
@@ -239,8 +242,8 @@ function ConversationTimeline({ disambiguateAuthors, clientActions, onOpen, focu
239
242
  }) })) : before.length > 0 ? (before) : hasMoreHistory || modelSetup?.state === "missing" ? null : ((empty ?? _jsx(ConversationStarters, {}))), modelSetup?.state === "missing" ? (_jsx("div", { className: `flex items-center justify-center p-6 ${count === 0 ? "h-full" : "min-h-64"}`, children: _jsx(SetupNotice, { need: "Connect a model to start", cause: "Agents answer with a model, and none is connected yet.", fix: modelSetup.fix, variant: "panel" }) })) : null] }), count > 0 ? (_jsx(ScrollToBottomBlob, { direction: "forward", unread: unread, focusAfterJump: focusAfterJump, onJump: jumpToBottom, scrollerRef: scrollerRef })) : null] }));
240
243
  }
241
244
  const stoppedMessages = {
242
- failed: "The run stopped. Your prompt is still here.",
243
- interrupted: "The worker stopped before this run finished. Your prompt is still here.",
245
+ failed: "The run stopped.",
246
+ interrupted: "The worker stopped before this run finished.",
244
247
  cancelled: "The run was cancelled. Send a new prompt when you’re ready.",
245
248
  };
246
249
  /**
@@ -264,13 +267,13 @@ function RunStopped({ failure, cause, lastItem, onRetry, }) {
264
267
  const publicCause = bounded !== undefined &&
265
268
  !bounded.startsWith("reason_unavailable:") &&
266
269
  !/\b(?:run|session)=/iu.test(bounded)
267
- ? bounded
270
+ ? bounded.replace(/[.\s]+$/u, "")
268
271
  : undefined;
269
272
  const message = publicCause === undefined || failure === "cancelled"
270
273
  ? stoppedMessages[failure]
271
274
  : failure === "interrupted"
272
- ? `This turn stopped before it finished: ${publicCause}. Your prompt is still here.`
273
- : `The run stopped: ${publicCause}. Your prompt is still here.`;
275
+ ? `This turn stopped before it finished: ${publicCause}.`
276
+ : `The run stopped: ${publicCause}.`;
274
277
  return (_jsx(FailureLine, { message: message, role: "alert", ...(failure === "cancelled"
275
278
  ? {}
276
279
  : { onRetry, retryAriaLabel: "Retry prompt" }) }));
package/dist/styles.css CHANGED
@@ -6881,9 +6881,6 @@
6881
6881
  padding-inline: var(--spacing-sm);
6882
6882
  }
6883
6883
  }
6884
- .px-1 {
6885
- padding-inline: calc(var(--spacing) * 1);
6886
- }
6887
6884
  .px-2 {
6888
6885
  padding-inline: calc(var(--spacing) * 2);
6889
6886
  }
@@ -19569,7 +19566,8 @@
19569
19566
  }
19570
19567
  @container (max-width: 26rem) {
19571
19568
  .parakeet-composer-row .parakeet-composer-model-key {
19572
- max-width: 7rem;
19569
+ min-width: 0;
19570
+ max-width: none;
19573
19571
  }
19574
19572
  }
19575
19573
  :root {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/parakeet",
3
- "version": "0.11.14",
3
+ "version": "0.11.16",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "private": false,
6
6
  "description": "Standalone React composer for a typed Shiitake Session",
@@ -120,6 +120,7 @@
120
120
 
121
121
  @container (max-width: 26rem) {
122
122
  .parakeet-composer-row .parakeet-composer-model-key {
123
- max-width: 7rem;
123
+ min-width: 0;
124
+ max-width: none;
124
125
  }
125
126
  }