@usecrow/ui 0.1.11 → 0.1.12
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.cjs +43 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -790,7 +790,7 @@ interface ReasoningTraceProps {
|
|
|
790
790
|
toolCalls?: ToolCall[];
|
|
791
791
|
isWaiting?: boolean;
|
|
792
792
|
}
|
|
793
|
-
declare function ReasoningTrace({ thinking, isComplete, toolCalls, isWaiting }: ReasoningTraceProps): react_jsx_runtime.JSX.Element | null;
|
|
793
|
+
declare function ReasoningTrace({ thinking, isComplete, toolCalls, isWaiting, }: ReasoningTraceProps): react_jsx_runtime.JSX.Element | null;
|
|
794
794
|
|
|
795
795
|
interface MessageBubbleProps {
|
|
796
796
|
message: Message;
|
package/dist/index.d.ts
CHANGED
|
@@ -790,7 +790,7 @@ interface ReasoningTraceProps {
|
|
|
790
790
|
toolCalls?: ToolCall[];
|
|
791
791
|
isWaiting?: boolean;
|
|
792
792
|
}
|
|
793
|
-
declare function ReasoningTrace({ thinking, isComplete, toolCalls, isWaiting }: ReasoningTraceProps): react_jsx_runtime.JSX.Element | null;
|
|
793
|
+
declare function ReasoningTrace({ thinking, isComplete, toolCalls, isWaiting, }: ReasoningTraceProps): react_jsx_runtime.JSX.Element | null;
|
|
794
794
|
|
|
795
795
|
interface MessageBubbleProps {
|
|
796
796
|
message: Message;
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,9 @@ function useChat({
|
|
|
93
93
|
message,
|
|
94
94
|
conversation_id: conversationId,
|
|
95
95
|
identity_token: identityToken,
|
|
96
|
-
model: selectedModel
|
|
96
|
+
model: selectedModel,
|
|
97
|
+
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
98
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
97
99
|
}),
|
|
98
100
|
signal: abortControllerRef.current.signal
|
|
99
101
|
});
|
|
@@ -363,7 +365,9 @@ function useChat({
|
|
|
363
365
|
tool_name: toolName,
|
|
364
366
|
result,
|
|
365
367
|
identity_token: identityToken,
|
|
366
|
-
model: selectedModel
|
|
368
|
+
model: selectedModel,
|
|
369
|
+
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
370
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
367
371
|
})
|
|
368
372
|
});
|
|
369
373
|
if (!response.ok) {
|
|
@@ -622,6 +626,16 @@ function useWorkflow({
|
|
|
622
626
|
exitWorkflow
|
|
623
627
|
};
|
|
624
628
|
}
|
|
629
|
+
var SDK_DEFAULT_TOOLS = {
|
|
630
|
+
refreshPage: async () => {
|
|
631
|
+
try {
|
|
632
|
+
window.location.reload();
|
|
633
|
+
return { status: "success", data: { message: "Page refresh initiated" } };
|
|
634
|
+
} catch (error) {
|
|
635
|
+
return { status: "error", error: String(error) };
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
};
|
|
625
639
|
function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
626
640
|
const onIdentifiedRef = useRef(onIdentified);
|
|
627
641
|
const onResetRef = useRef(onReset);
|
|
@@ -631,6 +645,15 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
631
645
|
onResetRef.current = onReset;
|
|
632
646
|
});
|
|
633
647
|
useEffect(() => {
|
|
648
|
+
if (!window.__crow_client_tools) {
|
|
649
|
+
window.__crow_client_tools = {};
|
|
650
|
+
}
|
|
651
|
+
for (const [toolName, handler] of Object.entries(SDK_DEFAULT_TOOLS)) {
|
|
652
|
+
if (!window.__crow_client_tools[toolName]) {
|
|
653
|
+
window.__crow_client_tools[toolName] = handler;
|
|
654
|
+
console.log(`[Crow] Registered default tool: ${toolName}`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
634
657
|
window.crow = function(command, options) {
|
|
635
658
|
const opts = options;
|
|
636
659
|
switch (command) {
|
|
@@ -1404,7 +1427,14 @@ function StreamingText({
|
|
|
1404
1427
|
...props,
|
|
1405
1428
|
children
|
|
1406
1429
|
}
|
|
1407
|
-
) : /* @__PURE__ */ jsx(
|
|
1430
|
+
) : /* @__PURE__ */ jsx(
|
|
1431
|
+
"code",
|
|
1432
|
+
{
|
|
1433
|
+
className: `crow-text-gray-200 ${className || ""}`,
|
|
1434
|
+
...props,
|
|
1435
|
+
children
|
|
1436
|
+
}
|
|
1437
|
+
);
|
|
1408
1438
|
},
|
|
1409
1439
|
pre: ({ children }) => /* @__PURE__ */ jsx("pre", { className: "crow-bg-gray-800 crow-text-gray-200 crow-p-3 crow-rounded-lg crow-my-2 crow-overflow-x-auto crow-text-sm", children })
|
|
1410
1440
|
},
|
|
@@ -1518,7 +1548,12 @@ function ShimmeringContent({ children }) {
|
|
|
1518
1548
|
}
|
|
1519
1549
|
);
|
|
1520
1550
|
}
|
|
1521
|
-
function ReasoningTrace({
|
|
1551
|
+
function ReasoningTrace({
|
|
1552
|
+
thinking,
|
|
1553
|
+
isComplete,
|
|
1554
|
+
toolCalls = [],
|
|
1555
|
+
isWaiting = false
|
|
1556
|
+
}) {
|
|
1522
1557
|
const hasThinking = !!thinking && thinking.trim().length > 0;
|
|
1523
1558
|
const hasToolCalls = toolCalls.length > 0;
|
|
1524
1559
|
if (!isWaiting && !hasThinking && !hasToolCalls) return null;
|
|
@@ -1534,7 +1569,10 @@ function WaitingIndicator() {
|
|
|
1534
1569
|
/* @__PURE__ */ jsx("span", { className: "crow-font-medium", children: /* @__PURE__ */ jsx(ShimmeringContent, { children: getRandomThinkingMessage() }) })
|
|
1535
1570
|
] });
|
|
1536
1571
|
}
|
|
1537
|
-
function ThinkingBlock({
|
|
1572
|
+
function ThinkingBlock({
|
|
1573
|
+
thinking,
|
|
1574
|
+
isComplete
|
|
1575
|
+
}) {
|
|
1538
1576
|
const [isExpanded, setIsExpanded] = useState(!isComplete);
|
|
1539
1577
|
useLayoutEffect(() => {
|
|
1540
1578
|
setIsExpanded(!isComplete);
|