@agentiffai/design 1.4.3 → 1.4.4
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/{Window-DTASLUB2.d.cts → Window-Dm_I5m8i.d.cts} +2 -20
- package/dist/{Window-DTASLUB2.d.ts → Window-Dm_I5m8i.d.ts} +2 -20
- package/dist/copilotkit/index.cjs +463 -498
- package/dist/copilotkit/index.cjs.map +1 -1
- package/dist/copilotkit/index.d.cts +8 -98
- package/dist/copilotkit/index.d.ts +8 -98
- package/dist/copilotkit/index.js +454 -491
- package/dist/copilotkit/index.js.map +1 -1
- package/dist/index.cjs +2 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/copilotkit/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { useButton } from '@react-aria/button';
|
|
2
|
-
import React, { memo,
|
|
2
|
+
import React, { memo, useRef, useEffect, useMemo, useState, useCallback } from 'react';
|
|
3
3
|
import styled9, { css, keyframes, createGlobalStyle } from 'styled-components';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import {
|
|
5
|
+
import { useCopilotChat } from '@copilotkit/react-core';
|
|
6
|
+
import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
|
|
7
|
+
export { useChatContext } from '@copilotkit/react-ui';
|
|
6
8
|
import { useTextField } from '@react-aria/textfield';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
10
|
+
// src/components/copilotkit/Button/Button.tsx
|
|
14
11
|
|
|
15
12
|
// src/theme/tokens.ts
|
|
16
13
|
var tokens = {
|
|
@@ -1417,22 +1414,6 @@ var AssistantMessageBase = ({
|
|
|
1417
1414
|
};
|
|
1418
1415
|
var AssistantMessage = memo(AssistantMessageBase);
|
|
1419
1416
|
AssistantMessage.displayName = "AssistantMessage";
|
|
1420
|
-
var _useAgent;
|
|
1421
|
-
try {
|
|
1422
|
-
_useAgent = __require("@copilotkit/react-core/v2").useAgent;
|
|
1423
|
-
} catch {
|
|
1424
|
-
}
|
|
1425
|
-
function useVisibleMessages() {
|
|
1426
|
-
if (_useAgent) {
|
|
1427
|
-
try {
|
|
1428
|
-
const { agent } = _useAgent({ agentId: "default" });
|
|
1429
|
-
return agent.messages ?? [];
|
|
1430
|
-
} catch {
|
|
1431
|
-
return [];
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
return [];
|
|
1435
|
-
}
|
|
1436
1417
|
var REGISTRY_KEY = "__agentiffai_tool_call_registry__";
|
|
1437
1418
|
var TOOL_CALL_TTL_MS = 5 * 60 * 1e3;
|
|
1438
1419
|
function getRegistryMap() {
|
|
@@ -1707,7 +1688,7 @@ function createAssistantMessageAdapterWithErrorReporting(onReportIssue, Thinking
|
|
|
1707
1688
|
isGenerating
|
|
1708
1689
|
}) => {
|
|
1709
1690
|
const lastGenerativeUIRef = useRef(null);
|
|
1710
|
-
const visibleMessages =
|
|
1691
|
+
const { visibleMessages } = useCopilotChat();
|
|
1711
1692
|
const rawContent = Array.isArray(message?.content) ? message.content.join("") : message?.content || "";
|
|
1712
1693
|
const content = stripToolCallMarkers(rawContent);
|
|
1713
1694
|
const toolCallNames = useMemo(() => {
|
|
@@ -2341,24 +2322,6 @@ var UserMessageAdapterBase = ({ message, ImageRenderer }) => {
|
|
|
2341
2322
|
};
|
|
2342
2323
|
var UserMessageAdapter = memo(UserMessageAdapterBase);
|
|
2343
2324
|
UserMessageAdapter.displayName = "UserMessageAdapter";
|
|
2344
|
-
var ChatContext = createContext(void 0);
|
|
2345
|
-
function useChatContext() {
|
|
2346
|
-
const ctx = useContext(ChatContext);
|
|
2347
|
-
if (ctx) return ctx;
|
|
2348
|
-
try {
|
|
2349
|
-
const v1 = __require("@copilotkit/react-ui");
|
|
2350
|
-
if (v1?.useChatContext) {
|
|
2351
|
-
return v1.useChatContext();
|
|
2352
|
-
}
|
|
2353
|
-
} catch {
|
|
2354
|
-
}
|
|
2355
|
-
return {
|
|
2356
|
-
open: false,
|
|
2357
|
-
setOpen: () => {
|
|
2358
|
-
console.warn("[useChatContext shim] setOpen called but no ChatContext provider found");
|
|
2359
|
-
}
|
|
2360
|
-
};
|
|
2361
|
-
}
|
|
2362
2325
|
var pulse3 = keyframes`
|
|
2363
2326
|
0%, 100% {
|
|
2364
2327
|
opacity: 1;
|
|
@@ -2717,6 +2680,35 @@ var Header = ({
|
|
|
2717
2680
|
] });
|
|
2718
2681
|
};
|
|
2719
2682
|
Header.displayName = "Header";
|
|
2683
|
+
var MessagesContainer = styled9.div`
|
|
2684
|
+
display: flex;
|
|
2685
|
+
flex-direction: column;
|
|
2686
|
+
flex: 1;
|
|
2687
|
+
overflow: hidden;
|
|
2688
|
+
/* Gradient background - brand aligned */
|
|
2689
|
+
background: linear-gradient(
|
|
2690
|
+
to right bottom,
|
|
2691
|
+
${tokens.colors.background.dark},
|
|
2692
|
+
${tokens.colors.background.darker},
|
|
2693
|
+
${tokens.colors.background.darkest}
|
|
2694
|
+
);
|
|
2695
|
+
/* Minimal horizontal padding to maximize message width */
|
|
2696
|
+
padding: ${tokens.spacing.sm} ${tokens.spacing.xs};
|
|
2697
|
+
gap: ${tokens.spacing.sm};
|
|
2698
|
+
box-sizing: border-box;
|
|
2699
|
+
|
|
2700
|
+
/* Ensure proper scrolling behavior for child components */
|
|
2701
|
+
position: relative;
|
|
2702
|
+
min-height: 0;
|
|
2703
|
+
`;
|
|
2704
|
+
var Messages = ({
|
|
2705
|
+
children,
|
|
2706
|
+
className,
|
|
2707
|
+
ariaLabel = "Messages"
|
|
2708
|
+
}) => {
|
|
2709
|
+
return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
|
|
2710
|
+
};
|
|
2711
|
+
Messages.displayName = "Messages";
|
|
2720
2712
|
var WindowContainer = styled9.div`
|
|
2721
2713
|
display: flex;
|
|
2722
2714
|
flex-direction: column;
|
|
@@ -2811,197 +2803,64 @@ var Window = ({
|
|
|
2811
2803
|
};
|
|
2812
2804
|
Window.displayName = "Window";
|
|
2813
2805
|
var GlobalSidebarStyles = createGlobalStyle`
|
|
2814
|
-
/* Override CopilotKit's
|
|
2815
|
-
@media (orientation: landscape) {
|
|
2816
|
-
.copilotKitSidebarContentWrapper {
|
|
2817
|
-
right: var(--safe-area-right, 0px) !important;
|
|
2818
|
-
left: var(--safe-area-left, 0px) !important;
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
|
|
2822
|
-
/* Override CopilotKit's default positioning - keep sidebar container in place */
|
|
2823
|
-
/* z-index must be higher than NavHorizontal (sticky: 1020) for button to show above nav */
|
|
2806
|
+
/* Override CopilotKit's default positioning - start off-screen */
|
|
2824
2807
|
.copilotKitSidebar {
|
|
2825
2808
|
position: fixed !important;
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
left: calc(var(--safe-area-left, 0px) + 8px) !important;
|
|
2830
|
-
width: auto !important;
|
|
2831
|
-
height: auto !important;
|
|
2832
|
-
pointer-events: none !important;
|
|
2833
|
-
z-index: ${tokens.zIndex.fixed} !important;
|
|
2809
|
+
right: -100vw !important;
|
|
2810
|
+
bottom: 0 !important;
|
|
2811
|
+
transition: right 0.3s ease !important;
|
|
2834
2812
|
}
|
|
2835
2813
|
|
|
2836
|
-
/*
|
|
2814
|
+
/* Move sidebar container into view when expanded */
|
|
2837
2815
|
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {
|
|
2838
|
-
|
|
2816
|
+
right: 0 !important;
|
|
2839
2817
|
}
|
|
2840
2818
|
|
|
2841
|
-
/* Mobile-first:
|
|
2842
|
-
|
|
2843
|
-
.copilotKitSidebar [role="dialog"] {
|
|
2844
|
-
/* Override CopilotKit defaults for mobile */
|
|
2819
|
+
/* Mobile-first: Full viewport sidebar */
|
|
2820
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
2845
2821
|
position: fixed !important;
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
/* Let left + right define width, top + bottom define height — no explicit values needed */
|
|
2855
|
-
width: auto !important;
|
|
2856
|
-
height: auto !important;
|
|
2857
|
-
max-width: none !important;
|
|
2858
|
-
max-height: none !important;
|
|
2822
|
+
top: 0 !important;
|
|
2823
|
+
right: 0 !important;
|
|
2824
|
+
bottom: 0 !important;
|
|
2825
|
+
left: auto !important;
|
|
2826
|
+
width: 100vw !important;
|
|
2827
|
+
height: 100vh !important;
|
|
2828
|
+
max-width: 100vw !important;
|
|
2829
|
+
max-height: 100vh !important;
|
|
2859
2830
|
margin: 0 !important;
|
|
2860
|
-
border-radius:
|
|
2861
|
-
|
|
2862
|
-
/* Glassmorphism effect */
|
|
2863
|
-
background: ${tokens.colors.surface.glass} !important;
|
|
2864
|
-
box-shadow: ${tokens.shadows.lg} !important;
|
|
2865
|
-
backdrop-filter: blur(11.1px) !important;
|
|
2866
|
-
-webkit-backdrop-filter: blur(11.1px) !important;
|
|
2867
|
-
border: 1px solid ${tokens.colors.surface.glassBorder} !important;
|
|
2868
|
-
|
|
2869
|
-
/* Smooth slide transition */
|
|
2870
|
-
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
2871
|
-
z-index: ${tokens.zIndex.modal} !important;
|
|
2872
|
-
}
|
|
2831
|
+
border-radius: 0 !important;
|
|
2832
|
+
z-index: 1001 !important;
|
|
2873
2833
|
|
|
2874
|
-
/* Hidden by default */
|
|
2875
|
-
.copilotKitSidebarContentWrapper:not(.sidebarExpanded) .copilotKitSidebar [role="dialog"] {
|
|
2876
2834
|
transform: translateX(100%) !important;
|
|
2877
2835
|
visibility: hidden !important;
|
|
2878
2836
|
pointer-events: none !important;
|
|
2879
2837
|
opacity: 0 !important;
|
|
2838
|
+
display: none !important;
|
|
2839
|
+
|
|
2840
|
+
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
2880
2841
|
}
|
|
2881
2842
|
|
|
2882
|
-
/*
|
|
2883
|
-
.
|
|
2843
|
+
/* When window has .open class (CopilotKit's native class), show it */
|
|
2844
|
+
.copilotKitSidebar .copilotKitWindow.open {
|
|
2845
|
+
display: flex !important;
|
|
2884
2846
|
transform: translateX(0) !important;
|
|
2885
2847
|
visibility: visible !important;
|
|
2886
2848
|
pointer-events: auto !important;
|
|
2887
2849
|
opacity: 1 !important;
|
|
2888
2850
|
}
|
|
2889
2851
|
|
|
2890
|
-
/* Desktop: Sidebar panel on the right
|
|
2891
|
-
@media (min-width:
|
|
2892
|
-
.copilotKitSidebar
|
|
2852
|
+
/* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */
|
|
2853
|
+
@media (min-width: 640px) {
|
|
2854
|
+
.copilotKitSidebar .copilotKitWindow {
|
|
2893
2855
|
inset: auto !important;
|
|
2894
|
-
/* TOP: Account for status bar safe area */
|
|
2895
|
-
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
2896
|
-
/* RIGHT: Account for landscape notch on right side */
|
|
2897
|
-
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
2898
|
-
/* BOTTOM: Account for horizontal navbar (52px) + safe area */
|
|
2899
|
-
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
2900
|
-
left: auto !important;
|
|
2901
|
-
width: 28rem !important;
|
|
2902
|
-
/* Let top + bottom define height — no explicit value needed */
|
|
2903
|
-
height: auto !important;
|
|
2904
|
-
max-width: 28rem !important;
|
|
2905
|
-
max-height: none !important;
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
|
|
2909
|
-
/* Mobile landscape: sidebar on right side, allow background interaction */
|
|
2910
|
-
@media (orientation: landscape) and (max-height: 500px) {
|
|
2911
|
-
/* Account for vertical nav (60px) in landscape */
|
|
2912
|
-
.copilotKitSidebarContentWrapper {
|
|
2913
|
-
left: 60px !important;
|
|
2914
|
-
width: calc(100% - 60px) !important;
|
|
2915
|
-
}
|
|
2916
|
-
|
|
2917
|
-
/* Sidebar container covers right portion — full height, no gaps */
|
|
2918
|
-
.copilotKitSidebar {
|
|
2919
2856
|
top: 0 !important;
|
|
2920
|
-
bottom: 0 !important;
|
|
2921
|
-
right: 0 !important;
|
|
2922
|
-
left: 50vw !important;
|
|
2923
|
-
width: auto !important;
|
|
2924
|
-
height: 100vh !important;
|
|
2925
|
-
}
|
|
2926
|
-
|
|
2927
|
-
/* Offset the expanded sidebar wrapper to leave space for main content */
|
|
2928
|
-
.copilotKitSidebarContentWrapper.sidebarExpanded {
|
|
2929
|
-
margin-right: 30vw !important;
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2932
|
-
.copilotKitSidebar [role="dialog"] {
|
|
2933
|
-
width: min(50vw, 22rem) !important;
|
|
2934
|
-
max-width: min(50vw, 22rem) !important;
|
|
2935
|
-
left: auto !important;
|
|
2936
|
-
/* Flush with right edge — safe area handled via internal padding */
|
|
2937
2857
|
right: 0 !important;
|
|
2938
|
-
/* Fill ALL vertical space — overlay the bottom nav for maximum chat area */
|
|
2939
|
-
/* Keep top safe area so dialog doesn't go behind status bar (battery/wifi) */
|
|
2940
|
-
top: var(--safe-area-top, 0px) !important;
|
|
2941
2858
|
bottom: 0 !important;
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
border-radius: 0 !important;
|
|
2948
|
-
border-top-left-radius: ${tokens.borderRadius.xl} !important;
|
|
2949
|
-
border-bottom-left-radius: ${tokens.borderRadius.xl} !important;
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
|
-
/* Compact header in landscape - hide title text but keep close button */
|
|
2953
|
-
/* Safe area top padding applied here so content avoids status bar */
|
|
2954
|
-
.copilotKitSidebar [role="dialog"] header,
|
|
2955
|
-
.copilotKitSidebar [role="dialog"] [data-testid="chat-header"],
|
|
2956
|
-
.copilotKitSidebar [role="dialog"] > div:first-child {
|
|
2957
|
-
padding: 0.25rem 0.5rem 0.25rem !important;
|
|
2958
|
-
min-height: auto !important;
|
|
2959
|
-
height: auto !important;
|
|
2960
|
-
padding-right: calc(1.5rem + var(--safe-area-right, 0px)) !important;
|
|
2961
|
-
}
|
|
2962
|
-
|
|
2963
|
-
/* Hide the title text but keep close button visible */
|
|
2964
|
-
.copilotKitSidebar [role="dialog"] header h1,
|
|
2965
|
-
.copilotKitSidebar [role="dialog"] header h2,
|
|
2966
|
-
.copilotKitSidebar [role="dialog"] header span:not(:last-child),
|
|
2967
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > span,
|
|
2968
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > h1,
|
|
2969
|
-
.copilotKitSidebar [role="dialog"] > div:first-child > h2 {
|
|
2970
|
-
display: none !important;
|
|
2971
|
-
}
|
|
2972
|
-
|
|
2973
|
-
/* Reduce vertical padding inside chat — right safe area for notch */
|
|
2974
|
-
.copilotKitMessages {
|
|
2975
|
-
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
|
-
.copilotKitMessage {
|
|
2979
|
-
padding: ${tokens.spacing.xs} 0 !important;
|
|
2980
|
-
margin: ${tokens.spacing.xs} 0 !important;
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
/* Reduce gap between messages */
|
|
2984
|
-
.copilotKitMessages > div {
|
|
2985
|
-
gap: 0.25rem !important;
|
|
2986
|
-
padding-bottom: 0;
|
|
2987
|
-
}
|
|
2988
|
-
|
|
2989
|
-
/* Compact input area — safe area padding for bottom gesture bar and right notch */
|
|
2990
|
-
.copilotKitInput {
|
|
2991
|
-
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) calc(${tokens.spacing.xs} + var(--safe-area-bottom, 0px)) ${tokens.spacing.sm} !important;
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
|
-
/* Compact suggested prompts in landscape */
|
|
2995
|
-
div[role="list"][aria-label*="Suggested"] {
|
|
2996
|
-
margin: 0 !important;
|
|
2997
|
-
padding: 1px !important;
|
|
2998
|
-
min-height: auto !important;
|
|
2999
|
-
max-height: 32px !important;
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
/* Suggestions container — safe area padding for bottom and right */
|
|
3003
|
-
.copilotKitSidebar [role="dialog"] > div:last-child {
|
|
3004
|
-
padding: 1px calc(1px + var(--safe-area-right, 0px)) calc(1px + var(--safe-area-bottom, 0px)) 1px !important;
|
|
2859
|
+
left: auto !important;
|
|
2860
|
+
width: 28rem !important;
|
|
2861
|
+
height: 100vh !important;
|
|
2862
|
+
max-width: 28rem !important;
|
|
2863
|
+
max-height: 100vh !important;
|
|
3005
2864
|
}
|
|
3006
2865
|
}
|
|
3007
2866
|
|
|
@@ -3021,131 +2880,106 @@ var GlobalSidebarStyles = createGlobalStyle`
|
|
|
3021
2880
|
}
|
|
3022
2881
|
}
|
|
3023
2882
|
|
|
3024
|
-
/*
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
z-index: 2000 !important;
|
|
3032
|
-
}
|
|
2883
|
+
/* Override CopilotKit's default message styles with our custom components */
|
|
2884
|
+
.copilotKitSidebar {
|
|
2885
|
+
/* Reset all default CopilotKit message styling */
|
|
2886
|
+
[class*="copilotKitMessage"],
|
|
2887
|
+
[class*="Message-module"] {
|
|
2888
|
+
all: unset !important;
|
|
2889
|
+
display: contents !important;
|
|
3033
2890
|
}
|
|
3034
|
-
}
|
|
3035
2891
|
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
/* Performance optimization for messages - no animations to reduce jitter during streaming */
|
|
3042
|
-
.copilotKitMessage {
|
|
3043
|
-
/* contain: content isolates layout/paint to this element */
|
|
3044
|
-
contain: content;
|
|
3045
|
-
}
|
|
3046
|
-
|
|
3047
|
-
/* Override CopilotKit suggestions to be single-row with horizontal scroll */
|
|
3048
|
-
div[role="list"][aria-label*="Suggested"] {
|
|
3049
|
-
display: flex !important;
|
|
3050
|
-
flex-wrap: nowrap !important; /* Force single row */
|
|
3051
|
-
gap: ${tokens.spacing.sm} !important;
|
|
3052
|
-
padding: ${tokens.spacing.xs} 0 !important;
|
|
3053
|
-
|
|
3054
|
-
/* Horizontal scrolling */
|
|
3055
|
-
overflow-x: auto !important;
|
|
3056
|
-
overflow-y: hidden !important;
|
|
3057
|
-
|
|
3058
|
-
/* Smooth scrolling */
|
|
3059
|
-
-webkit-overflow-scrolling: touch;
|
|
3060
|
-
scroll-behavior: smooth;
|
|
3061
|
-
|
|
3062
|
-
/* Fixed height for one suggestion */
|
|
3063
|
-
max-height: 40px !important;
|
|
3064
|
-
min-height: 40px !important;
|
|
3065
|
-
align-items: center !important;
|
|
3066
|
-
|
|
3067
|
-
/* Hide scrollbar */
|
|
3068
|
-
scrollbar-width: none !important;
|
|
3069
|
-
-ms-overflow-style: none !important;
|
|
3070
|
-
|
|
3071
|
-
&::-webkit-scrollbar {
|
|
3072
|
-
display: none !important;
|
|
2892
|
+
/* Ensure our custom UserMessage gradient pill shows through */
|
|
2893
|
+
button[role="presentation"] {
|
|
2894
|
+
all: revert !important;
|
|
2895
|
+
display: inline-flex !important;
|
|
3073
2896
|
}
|
|
3074
|
-
}
|
|
3075
2897
|
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
2898
|
+
/* Reset input styles to allow our custom ChatInput */
|
|
2899
|
+
[class*="Input-module"],
|
|
2900
|
+
[class*="copilotKitInput"] {
|
|
2901
|
+
all: unset !important;
|
|
2902
|
+
display: contents !important;
|
|
2903
|
+
}
|
|
3081
2904
|
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
.copilotKitSidebar textarea:focus-visible {
|
|
3089
|
-
outline: none !important;
|
|
3090
|
-
outline-color: transparent !important;
|
|
3091
|
-
box-shadow: none !important;
|
|
2905
|
+
/* Reset header styles */
|
|
2906
|
+
[class*="Header-module"],
|
|
2907
|
+
[class*="copilotKitHeader"] {
|
|
2908
|
+
all: unset !important;
|
|
2909
|
+
display: contents !important;
|
|
2910
|
+
}
|
|
3092
2911
|
}
|
|
3093
2912
|
`;
|
|
3094
2913
|
var StyledChatButton = styled9.button`
|
|
3095
2914
|
position: fixed;
|
|
3096
|
-
bottom:
|
|
3097
|
-
right:
|
|
2915
|
+
bottom: 8px;
|
|
2916
|
+
right: 8px;
|
|
3098
2917
|
width: 36px;
|
|
3099
2918
|
height: 36px;
|
|
3100
|
-
border-radius:
|
|
2919
|
+
border-radius: 18px;
|
|
3101
2920
|
border: none;
|
|
3102
2921
|
background: linear-gradient(135deg, ${tokens.colors.primary} 0%, ${tokens.colors.accent} 100%);
|
|
3103
|
-
box-shadow:
|
|
2922
|
+
box-shadow: 0 4px 12px rgba(44, 176, 171, 0.4);
|
|
3104
2923
|
display: flex;
|
|
3105
2924
|
align-items: center;
|
|
3106
2925
|
justify-content: center;
|
|
3107
|
-
cursor:
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
z-index: ${tokens.zIndex.fixed};
|
|
3111
|
-
transition: all ${tokens.transitions.fast};
|
|
2926
|
+
cursor: pointer;
|
|
2927
|
+
z-index: 1000;
|
|
2928
|
+
transition: all 0.2s ease;
|
|
3112
2929
|
|
|
3113
|
-
&:hover
|
|
2930
|
+
&:hover {
|
|
3114
2931
|
transform: scale(1.05);
|
|
3115
|
-
box-shadow:
|
|
2932
|
+
box-shadow: 0 6px 16px rgba(44, 176, 171, 0.5);
|
|
3116
2933
|
}
|
|
3117
2934
|
|
|
3118
|
-
&:active
|
|
2935
|
+
&:active {
|
|
3119
2936
|
transform: scale(0.95);
|
|
3120
2937
|
}
|
|
3121
2938
|
|
|
3122
2939
|
svg {
|
|
3123
2940
|
width: 20px;
|
|
3124
2941
|
height: 20px;
|
|
3125
|
-
fill:
|
|
2942
|
+
fill: white;
|
|
3126
2943
|
}
|
|
3127
2944
|
`;
|
|
3128
|
-
var
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
2945
|
+
var CustomCopilotSidebar = ({
|
|
2946
|
+
children,
|
|
2947
|
+
instructions = "You are a helpful AI assistant.",
|
|
2948
|
+
labels,
|
|
2949
|
+
icons,
|
|
2950
|
+
defaultOpen = false,
|
|
2951
|
+
clickOutsideToClose = true,
|
|
2952
|
+
hitEscapeToClose = true,
|
|
2953
|
+
shortcut = "/",
|
|
2954
|
+
onSetOpen,
|
|
2955
|
+
className
|
|
2956
|
+
}) => {
|
|
2957
|
+
const HeaderAdapter = (_props) => {
|
|
3134
2958
|
const { setOpen } = useChatContext();
|
|
3135
2959
|
const handleClose = () => {
|
|
3136
2960
|
setOpen(false);
|
|
3137
2961
|
onSetOpen?.(false);
|
|
3138
2962
|
};
|
|
3139
|
-
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", onClose: handleClose });
|
|
2963
|
+
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
|
|
2964
|
+
};
|
|
2965
|
+
const WindowAdapter2 = (props) => {
|
|
2966
|
+
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
2967
|
+
};
|
|
2968
|
+
const MessagesAdapter = (props) => {
|
|
2969
|
+
return /* @__PURE__ */ jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsx(
|
|
2970
|
+
props.RenderMessage,
|
|
2971
|
+
{
|
|
2972
|
+
message,
|
|
2973
|
+
inProgress: props.inProgress,
|
|
2974
|
+
index,
|
|
2975
|
+
isCurrentMessage: index === props.messages.length - 1
|
|
2976
|
+
},
|
|
2977
|
+
message.id || `message-${index}`
|
|
2978
|
+
)) });
|
|
3140
2979
|
};
|
|
3141
|
-
HeaderAdapterWithClose.displayName = "HeaderAdapterWithClose";
|
|
3142
|
-
return HeaderAdapterWithClose;
|
|
3143
|
-
}
|
|
3144
|
-
function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
3145
2980
|
const CustomButton = (_props) => {
|
|
3146
2981
|
const { open, setOpen } = useChatContext();
|
|
3147
2982
|
const handleClick = () => {
|
|
3148
|
-
if (disabled) return;
|
|
3149
2983
|
const newOpenState = !open;
|
|
3150
2984
|
setOpen(newOpenState);
|
|
3151
2985
|
onSetOpen?.(newOpenState);
|
|
@@ -3154,11 +2988,8 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3154
2988
|
StyledChatButton,
|
|
3155
2989
|
{
|
|
3156
2990
|
onClick: handleClick,
|
|
3157
|
-
"aria-label":
|
|
3158
|
-
"aria-disabled": disabled,
|
|
3159
|
-
title: disabled ? disabledReason : void 0,
|
|
2991
|
+
"aria-label": open ? "Close chat" : "Open chat",
|
|
3160
2992
|
type: "button",
|
|
3161
|
-
$disabled: disabled,
|
|
3162
2993
|
children: /* @__PURE__ */ jsxs(
|
|
3163
2994
|
"svg",
|
|
3164
2995
|
{
|
|
@@ -3168,7 +2999,7 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3168
2999
|
fill: "currentColor",
|
|
3169
3000
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3170
3001
|
role: "img",
|
|
3171
|
-
"aria-
|
|
3002
|
+
"aria-label": "Chat icon",
|
|
3172
3003
|
children: [
|
|
3173
3004
|
/* @__PURE__ */ jsx("title", { children: "Chat" }),
|
|
3174
3005
|
/* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" })
|
|
@@ -3178,151 +3009,229 @@ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
|
3178
3009
|
}
|
|
3179
3010
|
);
|
|
3180
3011
|
};
|
|
3181
|
-
|
|
3182
|
-
return CustomButton;
|
|
3183
|
-
}
|
|
3184
|
-
function CustomCopilotSidebar({
|
|
3185
|
-
children,
|
|
3186
|
-
defaultOpen = false,
|
|
3187
|
-
onSetOpen,
|
|
3188
|
-
instructions,
|
|
3189
|
-
className,
|
|
3190
|
-
disabled = false,
|
|
3191
|
-
disabledReason = "Start a free trial to enable AI chat",
|
|
3192
|
-
onError,
|
|
3193
|
-
renderError,
|
|
3194
|
-
ThinkingIndicator,
|
|
3195
|
-
ToolCallsComponent,
|
|
3196
|
-
onReportIssue
|
|
3197
|
-
}) {
|
|
3198
|
-
const HeaderAdapterWithClose = useMemo(() => createHeaderAdapter(onSetOpen), [onSetOpen]);
|
|
3199
|
-
const CustomButton = useMemo(
|
|
3200
|
-
() => createButtonAdapter(disabled, disabledReason, onSetOpen),
|
|
3201
|
-
[disabled, disabledReason, onSetOpen]
|
|
3202
|
-
);
|
|
3203
|
-
const AssistantMessageAdapterMemo = useMemo(
|
|
3204
|
-
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(
|
|
3205
|
-
onReportIssue,
|
|
3206
|
-
ThinkingIndicator) : ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator) : AssistantMessageAdapter,
|
|
3207
|
-
[ThinkingIndicator, ToolCallsComponent, onReportIssue]
|
|
3208
|
-
);
|
|
3209
|
-
return /* @__PURE__ */ jsxs("div", { "data-testid": "copilot-sidebar", children: [
|
|
3012
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3210
3013
|
/* @__PURE__ */ jsx(GlobalSidebarStyles, {}),
|
|
3211
3014
|
/* @__PURE__ */ jsx(
|
|
3212
3015
|
CopilotSidebar,
|
|
3213
3016
|
{
|
|
3214
|
-
AssistantMessage:
|
|
3017
|
+
AssistantMessage: AssistantMessageAdapter,
|
|
3215
3018
|
UserMessage: UserMessageAdapter,
|
|
3216
3019
|
Input: InputAdapter,
|
|
3217
|
-
Header:
|
|
3218
|
-
Window:
|
|
3020
|
+
Header: HeaderAdapter,
|
|
3021
|
+
Window: WindowAdapter2,
|
|
3022
|
+
Messages: MessagesAdapter,
|
|
3219
3023
|
Button: CustomButton,
|
|
3220
3024
|
instructions,
|
|
3221
3025
|
labels: {
|
|
3222
3026
|
title: "AI Assistant",
|
|
3223
|
-
initial: "Hi! How can I help you today?"
|
|
3027
|
+
initial: "Hi! How can I help you today?",
|
|
3028
|
+
...labels
|
|
3224
3029
|
},
|
|
3030
|
+
icons,
|
|
3225
3031
|
defaultOpen,
|
|
3226
|
-
clickOutsideToClose
|
|
3227
|
-
hitEscapeToClose
|
|
3032
|
+
clickOutsideToClose,
|
|
3033
|
+
hitEscapeToClose,
|
|
3034
|
+
shortcut,
|
|
3228
3035
|
onSetOpen,
|
|
3229
|
-
onError,
|
|
3230
|
-
renderError,
|
|
3231
3036
|
className,
|
|
3232
3037
|
children
|
|
3233
3038
|
}
|
|
3234
3039
|
)
|
|
3235
3040
|
] });
|
|
3236
|
-
}
|
|
3237
|
-
CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
|
|
3238
|
-
var MessagesContainer = styled9.div`
|
|
3239
|
-
display: flex;
|
|
3240
|
-
flex-direction: column;
|
|
3241
|
-
flex: 1;
|
|
3242
|
-
overflow: hidden;
|
|
3243
|
-
/* Gradient background - brand aligned */
|
|
3244
|
-
background: linear-gradient(
|
|
3245
|
-
to right bottom,
|
|
3246
|
-
${tokens.colors.background.dark},
|
|
3247
|
-
${tokens.colors.background.darker},
|
|
3248
|
-
${tokens.colors.background.darkest}
|
|
3249
|
-
);
|
|
3250
|
-
/* Minimal horizontal padding to maximize message width */
|
|
3251
|
-
padding: ${tokens.spacing.sm} ${tokens.spacing.xs};
|
|
3252
|
-
gap: ${tokens.spacing.sm};
|
|
3253
|
-
box-sizing: border-box;
|
|
3254
|
-
|
|
3255
|
-
/* Ensure proper scrolling behavior for child components */
|
|
3256
|
-
position: relative;
|
|
3257
|
-
min-height: 0;
|
|
3258
|
-
`;
|
|
3259
|
-
var Messages = ({
|
|
3260
|
-
children,
|
|
3261
|
-
className,
|
|
3262
|
-
ariaLabel = "Messages"
|
|
3263
|
-
}) => {
|
|
3264
|
-
return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
|
|
3265
3041
|
};
|
|
3266
|
-
|
|
3042
|
+
CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
|
|
3267
3043
|
var GlobalSidebarStyles2 = createGlobalStyle`
|
|
3268
|
-
/* Override CopilotKit's
|
|
3044
|
+
/* Override CopilotKit's content wrapper to respect safe areas in landscape */
|
|
3045
|
+
@media (orientation: landscape) {
|
|
3046
|
+
.copilotKitSidebarContentWrapper {
|
|
3047
|
+
right: var(--safe-area-right, 0px) !important;
|
|
3048
|
+
left: var(--safe-area-left, 0px) !important;
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
/* Override CopilotKit's default positioning - keep sidebar container in place */
|
|
3053
|
+
/* z-index must be higher than NavHorizontal (sticky: 1020) for button to show above nav */
|
|
3269
3054
|
.copilotKitSidebar {
|
|
3270
3055
|
position: fixed !important;
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3056
|
+
top: calc(var(--safe-area-top, 0px) + 8px) !important;
|
|
3057
|
+
right: calc(var(--safe-area-right, 0px) + 8px) !important;
|
|
3058
|
+
bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
|
|
3059
|
+
left: calc(var(--safe-area-left, 0px) + 8px) !important;
|
|
3060
|
+
width: auto !important;
|
|
3061
|
+
height: auto !important;
|
|
3062
|
+
pointer-events: none !important;
|
|
3063
|
+
z-index: ${tokens.zIndex.fixed} !important;
|
|
3274
3064
|
}
|
|
3275
3065
|
|
|
3276
|
-
/*
|
|
3066
|
+
/* Keep sidebar container always visible (the window inside will animate) */
|
|
3277
3067
|
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {
|
|
3278
|
-
|
|
3068
|
+
pointer-events: auto !important;
|
|
3279
3069
|
}
|
|
3280
3070
|
|
|
3281
|
-
/* Mobile-first:
|
|
3282
|
-
|
|
3071
|
+
/* Mobile-first: Glassmorphism sidebar with rounded corners */
|
|
3072
|
+
/* Target the actual dialog element that gets rendered */
|
|
3073
|
+
.copilotKitSidebar [role="dialog"] {
|
|
3074
|
+
/* Override CopilotKit defaults for mobile */
|
|
3283
3075
|
position: fixed !important;
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3076
|
+
/* TOP: Account for status bar safe area (Android notch/status bar) */
|
|
3077
|
+
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
3078
|
+
/* RIGHT: Account for landscape notch on right side */
|
|
3079
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
3080
|
+
/* BOTTOM: Account for horizontal navbar (52px) + safe area for Android nav buttons */
|
|
3081
|
+
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
3082
|
+
/* LEFT: Account for landscape notch on left side */
|
|
3083
|
+
left: calc(${tokens.spacing.sm} + var(--safe-area-left, 0px)) !important;
|
|
3084
|
+
/* Let left + right define width, top + bottom define height — no explicit values needed */
|
|
3085
|
+
width: auto !important;
|
|
3086
|
+
height: auto !important;
|
|
3087
|
+
max-width: none !important;
|
|
3088
|
+
max-height: none !important;
|
|
3292
3089
|
margin: 0 !important;
|
|
3293
|
-
border-radius:
|
|
3294
|
-
|
|
3090
|
+
border-radius: ${tokens.borderRadius.xl} !important;
|
|
3091
|
+
|
|
3092
|
+
/* Glassmorphism effect */
|
|
3093
|
+
background: ${tokens.colors.surface.glass} !important;
|
|
3094
|
+
box-shadow: ${tokens.shadows.lg} !important;
|
|
3095
|
+
backdrop-filter: blur(11.1px) !important;
|
|
3096
|
+
-webkit-backdrop-filter: blur(11.1px) !important;
|
|
3097
|
+
border: 1px solid ${tokens.colors.surface.glassBorder} !important;
|
|
3098
|
+
|
|
3099
|
+
/* Smooth slide transition */
|
|
3100
|
+
transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
|
|
3101
|
+
z-index: ${tokens.zIndex.modal} !important;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
/* Hidden by default */
|
|
3105
|
+
.copilotKitSidebarContentWrapper:not(.sidebarExpanded) .copilotKitSidebar [role="dialog"] {
|
|
3106
|
+
transform: translateX(100%) !important;
|
|
3107
|
+
visibility: hidden !important;
|
|
3108
|
+
pointer-events: none !important;
|
|
3109
|
+
opacity: 0 !important;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
/* Visible when expanded */
|
|
3113
|
+
.copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar [role="dialog"] {
|
|
3114
|
+
transform: translateX(0) !important;
|
|
3115
|
+
visibility: visible !important;
|
|
3116
|
+
pointer-events: auto !important;
|
|
3117
|
+
opacity: 1 !important;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
/* Desktop: Sidebar panel on the right with glassmorphism (640px = CopilotKit's breakpoint) */
|
|
3121
|
+
@media (min-width: ${tokens.breakpoints.mobile}px) {
|
|
3122
|
+
.copilotKitSidebar [role="dialog"] {
|
|
3123
|
+
inset: auto !important;
|
|
3124
|
+
/* TOP: Account for status bar safe area */
|
|
3125
|
+
top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
|
|
3126
|
+
/* RIGHT: Account for landscape notch on right side */
|
|
3127
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
|
|
3128
|
+
/* BOTTOM: Account for horizontal navbar (52px) + safe area */
|
|
3129
|
+
bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
|
|
3130
|
+
left: auto !important;
|
|
3131
|
+
width: 28rem !important;
|
|
3132
|
+
/* Let top + bottom define height — no explicit value needed */
|
|
3133
|
+
height: auto !important;
|
|
3134
|
+
max-width: 28rem !important;
|
|
3135
|
+
max-height: none !important;
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
/* Mobile landscape: sidebar on right side, allow background interaction */
|
|
3140
|
+
@media (orientation: landscape) and (max-height: 500px) {
|
|
3141
|
+
/* Account for vertical nav (60px) in landscape */
|
|
3142
|
+
.copilotKitSidebarContentWrapper {
|
|
3143
|
+
left: 60px !important;
|
|
3144
|
+
width: calc(100% - 60px) !important;
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
/* Sidebar container covers right portion — full height, no gaps */
|
|
3148
|
+
.copilotKitSidebar {
|
|
3149
|
+
top: 0 !important;
|
|
3150
|
+
bottom: 0 !important;
|
|
3151
|
+
right: 0 !important;
|
|
3152
|
+
left: 50vw !important;
|
|
3153
|
+
width: auto !important;
|
|
3154
|
+
height: 100vh !important;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
/* Offset the expanded sidebar wrapper to leave space for main content */
|
|
3158
|
+
.copilotKitSidebarContentWrapper.sidebarExpanded {
|
|
3159
|
+
margin-right: 30vw !important;
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
.copilotKitSidebar [role="dialog"] {
|
|
3163
|
+
width: min(50vw, 22rem) !important;
|
|
3164
|
+
max-width: min(50vw, 22rem) !important;
|
|
3165
|
+
left: auto !important;
|
|
3166
|
+
/* Flush with right edge — safe area handled via internal padding */
|
|
3167
|
+
right: 0 !important;
|
|
3168
|
+
/* Fill ALL vertical space — overlay the bottom nav for maximum chat area */
|
|
3169
|
+
/* Keep top safe area so dialog doesn't go behind status bar (battery/wifi) */
|
|
3170
|
+
top: var(--safe-area-top, 0px) !important;
|
|
3171
|
+
bottom: 0 !important;
|
|
3172
|
+
/* Let top/bottom define height */
|
|
3173
|
+
height: auto !important;
|
|
3174
|
+
max-height: none !important;
|
|
3175
|
+
margin: 0 !important;
|
|
3176
|
+
/* Only round the left edges since right is flush with viewport */
|
|
3177
|
+
border-radius: 0 !important;
|
|
3178
|
+
border-top-left-radius: ${tokens.borderRadius.xl} !important;
|
|
3179
|
+
border-bottom-left-radius: ${tokens.borderRadius.xl} !important;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
/* Compact header in landscape - hide title text but keep close button */
|
|
3183
|
+
/* Safe area top padding applied here so content avoids status bar */
|
|
3184
|
+
.copilotKitSidebar [role="dialog"] header,
|
|
3185
|
+
.copilotKitSidebar [role="dialog"] [data-testid="chat-header"],
|
|
3186
|
+
.copilotKitSidebar [role="dialog"] > div:first-child {
|
|
3187
|
+
padding: 0.25rem 0.5rem 0.25rem !important;
|
|
3188
|
+
min-height: auto !important;
|
|
3189
|
+
height: auto !important;
|
|
3190
|
+
padding-right: calc(1.5rem + var(--safe-area-right, 0px)) !important;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
/* Hide the title text but keep close button visible */
|
|
3194
|
+
.copilotKitSidebar [role="dialog"] header h1,
|
|
3195
|
+
.copilotKitSidebar [role="dialog"] header h2,
|
|
3196
|
+
.copilotKitSidebar [role="dialog"] header span:not(:last-child),
|
|
3197
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > span,
|
|
3198
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > h1,
|
|
3199
|
+
.copilotKitSidebar [role="dialog"] > div:first-child > h2 {
|
|
3200
|
+
display: none !important;
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
/* Reduce vertical padding inside chat — right safe area for notch */
|
|
3204
|
+
.copilotKitMessages {
|
|
3205
|
+
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
.copilotKitMessage {
|
|
3209
|
+
padding: ${tokens.spacing.xs} 0 !important;
|
|
3210
|
+
margin: ${tokens.spacing.xs} 0 !important;
|
|
3211
|
+
}
|
|
3295
3212
|
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3213
|
+
/* Reduce gap between messages */
|
|
3214
|
+
.copilotKitMessages > div {
|
|
3215
|
+
gap: 0.25rem !important;
|
|
3216
|
+
padding-bottom: 0;
|
|
3217
|
+
}
|
|
3301
3218
|
|
|
3302
|
-
|
|
3303
|
-
|
|
3219
|
+
/* Compact input area — safe area padding for bottom gesture bar and right notch */
|
|
3220
|
+
.copilotKitInput {
|
|
3221
|
+
padding: ${tokens.spacing.xs} calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) calc(${tokens.spacing.xs} + var(--safe-area-bottom, 0px)) ${tokens.spacing.sm} !important;
|
|
3222
|
+
}
|
|
3304
3223
|
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
}
|
|
3224
|
+
/* Compact suggested prompts in landscape */
|
|
3225
|
+
div[role="list"][aria-label*="Suggested"] {
|
|
3226
|
+
margin: 0 !important;
|
|
3227
|
+
padding: 1px !important;
|
|
3228
|
+
min-height: auto !important;
|
|
3229
|
+
max-height: 32px !important;
|
|
3230
|
+
}
|
|
3313
3231
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
inset: auto !important;
|
|
3318
|
-
top: 0 !important;
|
|
3319
|
-
right: 0 !important;
|
|
3320
|
-
bottom: 0 !important;
|
|
3321
|
-
left: auto !important;
|
|
3322
|
-
width: 28rem !important;
|
|
3323
|
-
height: 100vh !important;
|
|
3324
|
-
max-width: 28rem !important;
|
|
3325
|
-
max-height: 100vh !important;
|
|
3232
|
+
/* Suggestions container — safe area padding for bottom and right */
|
|
3233
|
+
.copilotKitSidebar [role="dialog"] > div:last-child {
|
|
3234
|
+
padding: 1px calc(1px + var(--safe-area-right, 0px)) calc(1px + var(--safe-area-bottom, 0px)) 1px !important;
|
|
3326
3235
|
}
|
|
3327
3236
|
}
|
|
3328
3237
|
|
|
@@ -3342,106 +3251,131 @@ var GlobalSidebarStyles2 = createGlobalStyle`
|
|
|
3342
3251
|
}
|
|
3343
3252
|
}
|
|
3344
3253
|
|
|
3345
|
-
/*
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3254
|
+
/* Position chat button with safe area on landscape (right side for Android controls) */
|
|
3255
|
+
@media (orientation: landscape) {
|
|
3256
|
+
.copilotKitSidebarContentWrapper {
|
|
3257
|
+
button[aria-label="Open chat"],
|
|
3258
|
+
button[aria-label="Close chat"] {
|
|
3259
|
+
bottom: calc(var(--safe-area-bottom, 0px) + 8px) !important;
|
|
3260
|
+
right: calc(var(--safe-area-right, 0px) + 8px) !important;
|
|
3261
|
+
z-index: 2000 !important;
|
|
3262
|
+
}
|
|
3352
3263
|
}
|
|
3264
|
+
}
|
|
3353
3265
|
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
}
|
|
3266
|
+
/* Fix messages container background */
|
|
3267
|
+
.copilotKitMessages {
|
|
3268
|
+
background-color: transparent !important;
|
|
3269
|
+
}
|
|
3359
3270
|
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
}
|
|
3271
|
+
/* Performance optimization for messages - no animations to reduce jitter during streaming */
|
|
3272
|
+
.copilotKitMessage {
|
|
3273
|
+
/* contain: content isolates layout/paint to this element */
|
|
3274
|
+
contain: content;
|
|
3275
|
+
}
|
|
3366
3276
|
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3277
|
+
/* Override CopilotKit suggestions to be single-row with horizontal scroll */
|
|
3278
|
+
div[role="list"][aria-label*="Suggested"] {
|
|
3279
|
+
display: flex !important;
|
|
3280
|
+
flex-wrap: nowrap !important; /* Force single row */
|
|
3281
|
+
gap: ${tokens.spacing.sm} !important;
|
|
3282
|
+
padding: ${tokens.spacing.xs} 0 !important;
|
|
3283
|
+
|
|
3284
|
+
/* Horizontal scrolling */
|
|
3285
|
+
overflow-x: auto !important;
|
|
3286
|
+
overflow-y: hidden !important;
|
|
3287
|
+
|
|
3288
|
+
/* Smooth scrolling */
|
|
3289
|
+
-webkit-overflow-scrolling: touch;
|
|
3290
|
+
scroll-behavior: smooth;
|
|
3291
|
+
|
|
3292
|
+
/* Fixed height for one suggestion */
|
|
3293
|
+
max-height: 40px !important;
|
|
3294
|
+
min-height: 40px !important;
|
|
3295
|
+
align-items: center !important;
|
|
3296
|
+
|
|
3297
|
+
/* Hide scrollbar */
|
|
3298
|
+
scrollbar-width: none !important;
|
|
3299
|
+
-ms-overflow-style: none !important;
|
|
3300
|
+
|
|
3301
|
+
&::-webkit-scrollbar {
|
|
3302
|
+
display: none !important;
|
|
3372
3303
|
}
|
|
3373
3304
|
}
|
|
3305
|
+
|
|
3306
|
+
/* Ensure suggestion buttons don't wrap or shrink */
|
|
3307
|
+
div[role="list"][aria-label*="Suggested"] button {
|
|
3308
|
+
flex-shrink: 0 !important;
|
|
3309
|
+
white-space: nowrap !important;
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
/* Remove teal/cyan outline from all inputs */
|
|
3313
|
+
.copilotKitSidebar input,
|
|
3314
|
+
.copilotKitSidebar input:focus,
|
|
3315
|
+
.copilotKitSidebar input:focus-visible,
|
|
3316
|
+
.copilotKitSidebar textarea,
|
|
3317
|
+
.copilotKitSidebar textarea:focus,
|
|
3318
|
+
.copilotKitSidebar textarea:focus-visible {
|
|
3319
|
+
outline: none !important;
|
|
3320
|
+
outline-color: transparent !important;
|
|
3321
|
+
box-shadow: none !important;
|
|
3322
|
+
}
|
|
3374
3323
|
`;
|
|
3375
3324
|
var StyledChatButton2 = styled9.button`
|
|
3376
3325
|
position: fixed;
|
|
3377
|
-
bottom:
|
|
3378
|
-
right:
|
|
3326
|
+
bottom: calc(${tokens.spacing.sm} + var(--safe-area-bottom, 0px));
|
|
3327
|
+
right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px));
|
|
3379
3328
|
width: 36px;
|
|
3380
3329
|
height: 36px;
|
|
3381
|
-
border-radius:
|
|
3330
|
+
border-radius: ${tokens.borderRadius.full};
|
|
3382
3331
|
border: none;
|
|
3383
3332
|
background: linear-gradient(135deg, ${tokens.colors.primary} 0%, ${tokens.colors.accent} 100%);
|
|
3384
|
-
box-shadow:
|
|
3333
|
+
box-shadow: ${({ $disabled }) => $disabled ? "none" : tokens.shadows.glow.primary};
|
|
3385
3334
|
display: flex;
|
|
3386
3335
|
align-items: center;
|
|
3387
3336
|
justify-content: center;
|
|
3388
|
-
cursor: pointer;
|
|
3389
|
-
|
|
3390
|
-
|
|
3337
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
|
|
3338
|
+
opacity: ${({ $disabled }) => $disabled ? 0.5 : 1};
|
|
3339
|
+
filter: ${({ $disabled }) => $disabled ? "grayscale(0.6)" : "none"};
|
|
3340
|
+
z-index: ${tokens.zIndex.fixed};
|
|
3341
|
+
transition: all ${tokens.transitions.fast};
|
|
3391
3342
|
|
|
3392
|
-
&:hover {
|
|
3343
|
+
&:hover:not([aria-disabled='true']) {
|
|
3393
3344
|
transform: scale(1.05);
|
|
3394
|
-
box-shadow:
|
|
3345
|
+
box-shadow: ${tokens.shadows.glow.accent};
|
|
3395
3346
|
}
|
|
3396
3347
|
|
|
3397
|
-
&:active {
|
|
3348
|
+
&:active:not([aria-disabled='true']) {
|
|
3398
3349
|
transform: scale(0.95);
|
|
3399
3350
|
}
|
|
3400
3351
|
|
|
3401
3352
|
svg {
|
|
3402
3353
|
width: 20px;
|
|
3403
3354
|
height: 20px;
|
|
3404
|
-
fill:
|
|
3355
|
+
fill: ${tokens.colors.text.primary};
|
|
3405
3356
|
}
|
|
3406
3357
|
`;
|
|
3407
|
-
var
|
|
3408
|
-
children
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
clickOutsideToClose = true,
|
|
3414
|
-
hitEscapeToClose = true,
|
|
3415
|
-
shortcut = "/",
|
|
3416
|
-
onSetOpen,
|
|
3417
|
-
className
|
|
3418
|
-
}) => {
|
|
3419
|
-
const HeaderAdapter = (_props) => {
|
|
3358
|
+
var WindowAdapter = (props) => {
|
|
3359
|
+
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
3360
|
+
};
|
|
3361
|
+
WindowAdapter.displayName = "WindowAdapter";
|
|
3362
|
+
function createHeaderAdapter(onSetOpen) {
|
|
3363
|
+
const HeaderAdapterWithClose = (_props) => {
|
|
3420
3364
|
const { setOpen } = useChatContext();
|
|
3421
3365
|
const handleClose = () => {
|
|
3422
3366
|
setOpen(false);
|
|
3423
3367
|
onSetOpen?.(false);
|
|
3424
3368
|
};
|
|
3425
|
-
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant",
|
|
3426
|
-
};
|
|
3427
|
-
const WindowAdapter2 = (props) => {
|
|
3428
|
-
return /* @__PURE__ */ jsx(Window, { children: props.children });
|
|
3429
|
-
};
|
|
3430
|
-
const MessagesAdapter = (props) => {
|
|
3431
|
-
return /* @__PURE__ */ jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsx(
|
|
3432
|
-
props.RenderMessage,
|
|
3433
|
-
{
|
|
3434
|
-
message,
|
|
3435
|
-
inProgress: props.inProgress,
|
|
3436
|
-
index,
|
|
3437
|
-
isCurrentMessage: index === props.messages.length - 1
|
|
3438
|
-
},
|
|
3439
|
-
message.id || `message-${index}`
|
|
3440
|
-
)) });
|
|
3369
|
+
return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", onClose: handleClose });
|
|
3441
3370
|
};
|
|
3371
|
+
HeaderAdapterWithClose.displayName = "HeaderAdapterWithClose";
|
|
3372
|
+
return HeaderAdapterWithClose;
|
|
3373
|
+
}
|
|
3374
|
+
function createButtonAdapter(disabled, disabledReason, onSetOpen) {
|
|
3442
3375
|
const CustomButton = (_props) => {
|
|
3443
3376
|
const { open, setOpen } = useChatContext();
|
|
3444
3377
|
const handleClick = () => {
|
|
3378
|
+
if (disabled) return;
|
|
3445
3379
|
const newOpenState = !open;
|
|
3446
3380
|
setOpen(newOpenState);
|
|
3447
3381
|
onSetOpen?.(newOpenState);
|
|
@@ -3450,8 +3384,11 @@ var CustomCopilotSidebar2 = ({
|
|
|
3450
3384
|
StyledChatButton2,
|
|
3451
3385
|
{
|
|
3452
3386
|
onClick: handleClick,
|
|
3453
|
-
"aria-label": open ? "Close chat" : "Open chat",
|
|
3387
|
+
"aria-label": disabled ? disabledReason : open ? "Close chat" : "Open chat",
|
|
3388
|
+
"aria-disabled": disabled,
|
|
3389
|
+
title: disabled ? disabledReason : void 0,
|
|
3454
3390
|
type: "button",
|
|
3391
|
+
$disabled: disabled,
|
|
3455
3392
|
children: /* @__PURE__ */ jsxs(
|
|
3456
3393
|
"svg",
|
|
3457
3394
|
{
|
|
@@ -3461,7 +3398,7 @@ var CustomCopilotSidebar2 = ({
|
|
|
3461
3398
|
fill: "currentColor",
|
|
3462
3399
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3463
3400
|
role: "img",
|
|
3464
|
-
"aria-
|
|
3401
|
+
"aria-hidden": "true",
|
|
3465
3402
|
children: [
|
|
3466
3403
|
/* @__PURE__ */ jsx("title", { children: "Chat" }),
|
|
3467
3404
|
/* @__PURE__ */ jsx("path", { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" })
|
|
@@ -3471,36 +3408,62 @@ var CustomCopilotSidebar2 = ({
|
|
|
3471
3408
|
}
|
|
3472
3409
|
);
|
|
3473
3410
|
};
|
|
3474
|
-
|
|
3411
|
+
CustomButton.displayName = "CustomButton";
|
|
3412
|
+
return CustomButton;
|
|
3413
|
+
}
|
|
3414
|
+
function CustomCopilotSidebar2({
|
|
3415
|
+
children,
|
|
3416
|
+
defaultOpen = false,
|
|
3417
|
+
onSetOpen,
|
|
3418
|
+
instructions,
|
|
3419
|
+
className,
|
|
3420
|
+
disabled = false,
|
|
3421
|
+
disabledReason = "Start a free trial to enable AI chat",
|
|
3422
|
+
onError,
|
|
3423
|
+
renderError,
|
|
3424
|
+
ThinkingIndicator,
|
|
3425
|
+
ToolCallsComponent,
|
|
3426
|
+
onReportIssue
|
|
3427
|
+
}) {
|
|
3428
|
+
const HeaderAdapterWithClose = useMemo(() => createHeaderAdapter(onSetOpen), [onSetOpen]);
|
|
3429
|
+
const CustomButton = useMemo(
|
|
3430
|
+
() => createButtonAdapter(disabled, disabledReason, onSetOpen),
|
|
3431
|
+
[disabled, disabledReason, onSetOpen]
|
|
3432
|
+
);
|
|
3433
|
+
const AssistantMessageAdapterMemo = useMemo(
|
|
3434
|
+
() => onReportIssue ? createAssistantMessageAdapterWithErrorReporting(
|
|
3435
|
+
onReportIssue,
|
|
3436
|
+
ThinkingIndicator) : ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator) : AssistantMessageAdapter,
|
|
3437
|
+
[ThinkingIndicator, ToolCallsComponent, onReportIssue]
|
|
3438
|
+
);
|
|
3439
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "copilot-sidebar", children: [
|
|
3475
3440
|
/* @__PURE__ */ jsx(GlobalSidebarStyles2, {}),
|
|
3476
3441
|
/* @__PURE__ */ jsx(
|
|
3477
3442
|
CopilotSidebar,
|
|
3478
3443
|
{
|
|
3479
|
-
AssistantMessage:
|
|
3444
|
+
AssistantMessage: AssistantMessageAdapterMemo,
|
|
3480
3445
|
UserMessage: UserMessageAdapter,
|
|
3481
3446
|
Input: InputAdapter,
|
|
3482
|
-
Header:
|
|
3483
|
-
Window:
|
|
3484
|
-
Messages: MessagesAdapter,
|
|
3447
|
+
Header: HeaderAdapterWithClose,
|
|
3448
|
+
Window: WindowAdapter,
|
|
3485
3449
|
Button: CustomButton,
|
|
3486
3450
|
instructions,
|
|
3487
3451
|
labels: {
|
|
3488
3452
|
title: "AI Assistant",
|
|
3489
|
-
initial: "Hi! How can I help you today?"
|
|
3490
|
-
...labels
|
|
3453
|
+
initial: "Hi! How can I help you today?"
|
|
3491
3454
|
},
|
|
3492
|
-
icons,
|
|
3493
3455
|
defaultOpen,
|
|
3494
|
-
clickOutsideToClose,
|
|
3495
|
-
hitEscapeToClose,
|
|
3496
|
-
shortcut,
|
|
3456
|
+
clickOutsideToClose: true,
|
|
3457
|
+
hitEscapeToClose: true,
|
|
3497
3458
|
onSetOpen,
|
|
3459
|
+
onError,
|
|
3460
|
+
renderError,
|
|
3498
3461
|
className,
|
|
3499
3462
|
children
|
|
3500
3463
|
}
|
|
3501
3464
|
)
|
|
3502
3465
|
] });
|
|
3503
|
-
}
|
|
3466
|
+
}
|
|
3504
3467
|
CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
|
|
3505
3468
|
var FooterContainer = styled9.footer`
|
|
3506
3469
|
display: flex;
|
|
@@ -4312,6 +4275,6 @@ function SuggestionChip({ suggestion, onSelect }) {
|
|
|
4312
4275
|
}
|
|
4313
4276
|
Suggestions.displayName = "Suggestions";
|
|
4314
4277
|
|
|
4315
|
-
export { ActionExecutionAdapter, Actions, AgentState, AssistantMessage, AssistantMessageAdapter, Button, CustomCopilotSidebar, FileAttachment, Footer, Header, Input, InputAdapter,
|
|
4278
|
+
export { ActionExecutionAdapter, Actions, AgentState, AssistantMessage, AssistantMessageAdapter, Button, CustomCopilotSidebar2 as CustomCopilotSidebar, FileAttachment, Footer, Header, Input, InputAdapter, CustomCopilotSidebar as IntegratedSidebar, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, StreamErrorMessage, StreamStatusIndicator, StreamingText2 as StreamingText, Suggestions, UserMessage2 as UserMessage, UserMessageAdapter, Window, clearToolCalls, registerToolCall };
|
|
4316
4279
|
//# sourceMappingURL=index.js.map
|
|
4317
4280
|
//# sourceMappingURL=index.js.map
|