@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.cjs
CHANGED
|
@@ -119,7 +119,9 @@ function useChat({
|
|
|
119
119
|
message,
|
|
120
120
|
conversation_id: conversationId,
|
|
121
121
|
identity_token: identityToken,
|
|
122
|
-
model: selectedModel
|
|
122
|
+
model: selectedModel,
|
|
123
|
+
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
124
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
123
125
|
}),
|
|
124
126
|
signal: abortControllerRef.current.signal
|
|
125
127
|
});
|
|
@@ -389,7 +391,9 @@ function useChat({
|
|
|
389
391
|
tool_name: toolName,
|
|
390
392
|
result,
|
|
391
393
|
identity_token: identityToken,
|
|
392
|
-
model: selectedModel
|
|
394
|
+
model: selectedModel,
|
|
395
|
+
user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
396
|
+
user_local_time: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
393
397
|
})
|
|
394
398
|
});
|
|
395
399
|
if (!response.ok) {
|
|
@@ -648,6 +652,16 @@ function useWorkflow({
|
|
|
648
652
|
exitWorkflow
|
|
649
653
|
};
|
|
650
654
|
}
|
|
655
|
+
var SDK_DEFAULT_TOOLS = {
|
|
656
|
+
refreshPage: async () => {
|
|
657
|
+
try {
|
|
658
|
+
window.location.reload();
|
|
659
|
+
return { status: "success", data: { message: "Page refresh initiated" } };
|
|
660
|
+
} catch (error) {
|
|
661
|
+
return { status: "error", error: String(error) };
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
651
665
|
function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
652
666
|
const onIdentifiedRef = React3.useRef(onIdentified);
|
|
653
667
|
const onResetRef = React3.useRef(onReset);
|
|
@@ -657,6 +671,15 @@ function useCrowAPI({ onIdentified, onReset } = {}) {
|
|
|
657
671
|
onResetRef.current = onReset;
|
|
658
672
|
});
|
|
659
673
|
React3.useEffect(() => {
|
|
674
|
+
if (!window.__crow_client_tools) {
|
|
675
|
+
window.__crow_client_tools = {};
|
|
676
|
+
}
|
|
677
|
+
for (const [toolName, handler] of Object.entries(SDK_DEFAULT_TOOLS)) {
|
|
678
|
+
if (!window.__crow_client_tools[toolName]) {
|
|
679
|
+
window.__crow_client_tools[toolName] = handler;
|
|
680
|
+
console.log(`[Crow] Registered default tool: ${toolName}`);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
660
683
|
window.crow = function(command, options) {
|
|
661
684
|
const opts = options;
|
|
662
685
|
switch (command) {
|
|
@@ -1430,7 +1453,14 @@ function StreamingText({
|
|
|
1430
1453
|
...props,
|
|
1431
1454
|
children
|
|
1432
1455
|
}
|
|
1433
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1456
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1457
|
+
"code",
|
|
1458
|
+
{
|
|
1459
|
+
className: `crow-text-gray-200 ${className || ""}`,
|
|
1460
|
+
...props,
|
|
1461
|
+
children
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1434
1464
|
},
|
|
1435
1465
|
pre: ({ children }) => /* @__PURE__ */ jsxRuntime.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 })
|
|
1436
1466
|
},
|
|
@@ -1544,7 +1574,12 @@ function ShimmeringContent({ children }) {
|
|
|
1544
1574
|
}
|
|
1545
1575
|
);
|
|
1546
1576
|
}
|
|
1547
|
-
function ReasoningTrace({
|
|
1577
|
+
function ReasoningTrace({
|
|
1578
|
+
thinking,
|
|
1579
|
+
isComplete,
|
|
1580
|
+
toolCalls = [],
|
|
1581
|
+
isWaiting = false
|
|
1582
|
+
}) {
|
|
1548
1583
|
const hasThinking = !!thinking && thinking.trim().length > 0;
|
|
1549
1584
|
const hasToolCalls = toolCalls.length > 0;
|
|
1550
1585
|
if (!isWaiting && !hasThinking && !hasToolCalls) return null;
|
|
@@ -1560,7 +1595,10 @@ function WaitingIndicator() {
|
|
|
1560
1595
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "crow-font-medium", children: /* @__PURE__ */ jsxRuntime.jsx(ShimmeringContent, { children: getRandomThinkingMessage() }) })
|
|
1561
1596
|
] });
|
|
1562
1597
|
}
|
|
1563
|
-
function ThinkingBlock({
|
|
1598
|
+
function ThinkingBlock({
|
|
1599
|
+
thinking,
|
|
1600
|
+
isComplete
|
|
1601
|
+
}) {
|
|
1564
1602
|
const [isExpanded, setIsExpanded] = React3.useState(!isComplete);
|
|
1565
1603
|
React3.useLayoutEffect(() => {
|
|
1566
1604
|
setIsExpanded(!isComplete);
|