reifyui 0.15.0 → 0.15.1

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.d.ts CHANGED
@@ -21,7 +21,8 @@ export interface ResponseHandlers {
21
21
  onReasoningDelta?(text: string): void;
22
22
  onTextDelta?(text: string): void;
23
23
  onToolCall?(name: string, args: string, callId: string): void;
24
- onToolResult?(callId: string, output: string): void;
24
+ /** isError: the result item said the tool failed (`is_error: true`). */
25
+ onToolResult?(callId: string, output: string, isError?: boolean): void;
25
26
  onFile?(file: { container_id: string; file_id: string; filename: string }): void;
26
27
  /** Terminal event. `status` distinguishes completed / incomplete / failed (incl. cancels). */
27
28
  onDone?(status: string, response: unknown): void;
package/dist/index.js CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  newTurn,
4
4
  reduceTurn,
5
5
  turnFromMessage
6
- } from "./chunk-6CJPYMR2.js";
6
+ } from "./chunk-S46J7CLH.js";
7
7
  import {
8
8
  createResponsesDispatcher,
9
9
  pumpResponsesStream,
10
10
  readSSEStream,
11
11
  turnsToMessages
12
- } from "./chunk-NTIWFHR4.js";
12
+ } from "./chunk-KJY3FVGZ.js";
13
13
  import {
14
14
  MentionInput,
15
15
  MentionText,
@@ -74,8 +74,8 @@ function withStep(blocks, step) {
74
74
  else out.push({ kind: "tools", reasoning: "", steps: [step] });
75
75
  return out;
76
76
  }
77
- function withResult(blocks, callId, output) {
78
- return blocks.map((b) => b.kind !== "tools" ? b : { ...b, steps: b.steps.map((t) => t.callId && t.callId === callId && t.result === void 0 ? { ...t, result: output } : t) });
77
+ function withResult(blocks, callId, output, isError = false) {
78
+ return blocks.map((b) => b.kind !== "tools" ? b : { ...b, steps: b.steps.map((t) => t.callId && t.callId === callId && t.result === void 0 ? { ...t, result: output, ...isError ? { isError: true } : {} } : t) });
79
79
  }
80
80
  function asstText(a) {
81
81
  return a.blocks.filter((b) => b.kind === "text").map((b) => b.text).join("\n\n");
@@ -326,17 +326,18 @@ function ToolGroup(props) {
326
326
  ] });
327
327
  }
328
328
  function ToolRow(props) {
329
- const { step, requestLabel = "Request", resultLabel = "Result" } = props;
329
+ const { step, requestLabel = "Request", resultLabel = "Result", failedLabel = "Failed" } = props;
330
330
  const [open, setOpen] = useState(false);
331
331
  const meta = toolMeta(step.name, step.args);
332
332
  const Icon = meta.Icon;
333
333
  const hasDetail = !!(step.args && step.args !== "{}") || step.result !== void 0;
334
- return /* @__PURE__ */ jsxs("div", { className: "wbx-act", children: [
334
+ return /* @__PURE__ */ jsxs("div", { className: "wbx-act" + (step.isError ? " is-failed" : ""), children: [
335
335
  /* @__PURE__ */ jsx("span", { className: "wbx-act-ic-t", children: /* @__PURE__ */ jsx(Icon, {}) }),
336
336
  /* @__PURE__ */ jsxs("div", { className: "wbx-act-main", children: [
337
337
  /* @__PURE__ */ jsxs("button", { className: "wbx-act-row" + (open ? " open" : ""), disabled: !hasDetail, onClick: () => setOpen((v) => !v), children: [
338
338
  /* @__PURE__ */ jsx("span", { className: "wbx-act-k", children: meta.label }),
339
339
  meta.chip && /* @__PURE__ */ jsx("span", { className: "wbx-act-chip", children: meta.chip }),
340
+ step.isError && /* @__PURE__ */ jsx("span", { className: "wbx-act-failed", children: failedLabel }),
340
341
  hasDetail && /* @__PURE__ */ jsx("span", { className: "wbx-act-exp", children: /* @__PURE__ */ jsx(Chevron, { dir: open ? "down" : "right", size: 12 }) })
341
342
  ] }),
342
343
  open && /* @__PURE__ */ jsxs("div", { className: "wbx-act-detail", children: [
@@ -841,7 +842,7 @@ function ChatPanel(props) {
841
842
  },
842
843
  onReasoningDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withReasoning(a.blocks, d) })),
843
844
  onToolCall: (name, args, callId) => updateLastAsst((a) => ({ ...a, blocks: withStep(a.blocks, { name, args, callId }) })),
844
- onToolResult: (callId, output) => updateLastAsst((a) => ({ ...a, blocks: withResult(a.blocks, callId, output) })),
845
+ onToolResult: (callId, output, isError) => updateLastAsst((a) => ({ ...a, blocks: withResult(a.blocks, callId, output, isError) })),
845
846
  onTextDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withText(a.blocks, d) })),
846
847
  onDone: (status) => updateLastAsst((a) => ({ ...a, status: status === "completed" ? "done" : status })),
847
848
  onError: () => updateLastAsst((a) => ({