@usecrow/ui 0.1.22 → 0.1.24

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.cts CHANGED
@@ -433,6 +433,11 @@ declare function injectStyles(target?: Document | ShadowRoot): void;
433
433
  /**
434
434
  * Shared TypeScript interfaces for the widget and copilot
435
435
  */
436
+ interface ToolResultLink {
437
+ url: string;
438
+ label: string;
439
+ type?: "primary" | "secondary";
440
+ }
436
441
  interface Message {
437
442
  id: string;
438
443
  content: string;
@@ -441,6 +446,7 @@ interface Message {
441
446
  citations?: Citation[];
442
447
  thinking?: string;
443
448
  thinkingComplete?: boolean;
449
+ links?: ToolResultLink[];
444
450
  }
445
451
  interface Citation {
446
452
  document_id: string;
package/dist/index.d.ts CHANGED
@@ -433,6 +433,11 @@ declare function injectStyles(target?: Document | ShadowRoot): void;
433
433
  /**
434
434
  * Shared TypeScript interfaces for the widget and copilot
435
435
  */
436
+ interface ToolResultLink {
437
+ url: string;
438
+ label: string;
439
+ type?: "primary" | "secondary";
440
+ }
436
441
  interface Message {
437
442
  id: string;
438
443
  content: string;
@@ -441,6 +446,7 @@ interface Message {
441
446
  citations?: Citation[];
442
447
  thinking?: string;
443
448
  thinkingComplete?: boolean;
449
+ links?: ToolResultLink[];
444
450
  }
445
451
  interface Citation {
446
452
  document_id: string;
package/dist/index.js CHANGED
@@ -126,6 +126,9 @@ function useChat({
126
126
  signal: abortControllerRef.current.signal
127
127
  });
128
128
  if (!response.ok) {
129
+ if (response.status === 401 && typeof window !== "undefined") {
130
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
131
+ }
129
132
  throw new Error(`HTTP error! status: ${response.status}`);
130
133
  }
131
134
  const reader = response.body?.getReader();
@@ -246,6 +249,15 @@ function useChat({
246
249
  )
247
250
  );
248
251
  break;
252
+ case "tool_result_links":
253
+ if (parsed.links && Array.isArray(parsed.links)) {
254
+ setMessages(
255
+ (prev) => prev.map(
256
+ (msg) => msg.id === botMsgId ? { ...msg, links: [...msg.links || [], ...parsed.links] } : msg
257
+ )
258
+ );
259
+ }
260
+ break;
249
261
  case "client_tool_call":
250
262
  pendingClientTools.push({
251
263
  toolName: parsed.tool_name,
@@ -399,6 +411,9 @@ function useChat({
399
411
  })
400
412
  });
401
413
  if (!response.ok) {
414
+ if (response.status === 401 && typeof window !== "undefined") {
415
+ window.dispatchEvent(new CustomEvent("crow:token-refresh-needed"));
416
+ }
402
417
  throw new Error(`HTTP error! status: ${response.status}`);
403
418
  }
404
419
  const reader = response.body?.getReader();