@aigentyc/chat-sdk 0.2.5 → 0.3.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/bin/aigentyc.mjs +10 -4
- package/bin/lib/skill.mjs +84 -0
- package/claude-skill/README.md +32 -0
- package/claude-skill/aigentyc-chat-sdk/SKILL.md +339 -0
- package/context7.json +1 -1
- package/dist/ChatInterface-B0zbA3Lm.d.cts +64 -0
- package/dist/ChatInterface-f8ftS56n.d.ts +64 -0
- package/dist/{JsonRenderResult-Ftw4AKwb.d.cts → JsonRenderResult-D6ogds0_.d.cts} +8 -1
- package/dist/{JsonRenderResult-Ftw4AKwb.d.ts → JsonRenderResult-D6ogds0_.d.ts} +8 -1
- package/dist/JsonRenderResult-GCNFMZYP.js +6 -0
- package/dist/{JsonRenderResult-ZFJ6VWMS.js.map → JsonRenderResult-GCNFMZYP.js.map} +1 -1
- package/dist/JsonRenderResult-II3IBENS.cjs +15 -0
- package/dist/{JsonRenderResult-GQOYPLVH.cjs.map → JsonRenderResult-II3IBENS.cjs.map} +1 -1
- package/dist/{SlotsContext-CBtt36al.d.ts → SlotsContext-BjiX1mRx.d.ts} +17 -2
- package/dist/{SlotsContext-CHvISDJT.d.cts → SlotsContext-CEOBjzfh.d.cts} +17 -2
- package/dist/ai-elements.cjs +114 -393
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.d.cts +2 -31
- package/dist/ai-elements.d.ts +2 -31
- package/dist/ai-elements.js +9 -291
- package/dist/ai-elements.js.map +1 -1
- package/dist/{chunk-5QSXB6UL.cjs → chunk-3HGOLNGG.cjs} +13 -4
- package/dist/chunk-3HGOLNGG.cjs.map +1 -0
- package/dist/{chunk-KVEJAPWA.js → chunk-3KSMOHNY.js} +48 -62
- package/dist/chunk-3KSMOHNY.js.map +1 -0
- package/dist/chunk-4WOBNRRB.cjs +540 -0
- package/dist/chunk-4WOBNRRB.cjs.map +1 -0
- package/dist/{chunk-MC6QDYB6.cjs → chunk-5XF7KH6B.cjs} +166 -67
- package/dist/chunk-5XF7KH6B.cjs.map +1 -0
- package/dist/chunk-7AZMWPKX.cjs +35 -0
- package/dist/chunk-7AZMWPKX.cjs.map +1 -0
- package/dist/{chunk-DMGYQ6NN.cjs → chunk-7IFBPXT3.cjs} +95 -8
- package/dist/chunk-7IFBPXT3.cjs.map +1 -0
- package/dist/{chunk-U3FXVLUK.js → chunk-AD6XWKWB.js} +93 -6
- package/dist/chunk-AD6XWKWB.js.map +1 -0
- package/dist/chunk-B27JIQ4Z.js +528 -0
- package/dist/chunk-B27JIQ4Z.js.map +1 -0
- package/dist/{chunk-J2K7EJYP.cjs → chunk-BPV66QNM.cjs} +6 -4
- package/dist/chunk-BPV66QNM.cjs.map +1 -0
- package/dist/{chunk-FYPJSHCL.js → chunk-FPQ3UCCJ.js} +6 -4
- package/dist/chunk-FPQ3UCCJ.js.map +1 -0
- package/dist/{chunk-J2H6MLQF.cjs → chunk-H7C3AGA2.cjs} +17 -6
- package/dist/chunk-H7C3AGA2.cjs.map +1 -0
- package/dist/{chunk-7L4FS6G7.js → chunk-JHWSG5IB.js} +17 -3
- package/dist/chunk-JHWSG5IB.js.map +1 -0
- package/dist/{chunk-4FBVV64J.js → chunk-M4YRNNGB.js} +13 -4
- package/dist/chunk-M4YRNNGB.js.map +1 -0
- package/dist/{chunk-QDFPJJ5Y.cjs → chunk-OU5OZKYH.cjs} +50 -65
- package/dist/chunk-OU5OZKYH.cjs.map +1 -0
- package/dist/{chunk-C24QG43M.cjs → chunk-TZ7EM3EG.cjs} +17 -2
- package/dist/chunk-TZ7EM3EG.cjs.map +1 -0
- package/dist/chunk-XEAAB5ZM.js +32 -0
- package/dist/chunk-XEAAB5ZM.js.map +1 -0
- package/dist/{chunk-FOZXDUSZ.js → chunk-YG2COKFR.js} +151 -54
- package/dist/chunk-YG2COKFR.js.map +1 -0
- package/dist/{chunk-RPDJXB3U.js → chunk-ZXP7IYRC.js} +17 -6
- package/dist/chunk-ZXP7IYRC.js.map +1 -0
- package/dist/components.cjs +31 -52
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +4 -34
- package/dist/components.d.ts +4 -34
- package/dist/components.js +18 -42
- package/dist/components.js.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/hooks.cjs +6 -6
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +2 -2
- package/dist/i18n.d.cts +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/index.cjs +45 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -6
- package/dist/index.d.ts +51 -6
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/json-render.cjs +4 -4
- package/dist/json-render.d.cts +1 -1
- package/dist/json-render.d.ts +1 -1
- package/dist/json-render.js +1 -1
- package/dist/llms-full.txt +195 -15
- package/dist/message-feedback-BFh3-qym.d.cts +92 -0
- package/dist/message-feedback-cWR0NVok.d.ts +92 -0
- package/dist/normalize-KzCLLqpU.d.cts +42 -0
- package/dist/normalize-KzCLLqpU.d.ts +42 -0
- package/dist/styles.css +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/tools.cjs +16 -7
- package/dist/tools.d.cts +4 -3
- package/dist/tools.d.ts +4 -3
- package/dist/tools.js +4 -3
- package/dist/{types-DKJ_-nbG.d.ts → types-DlNwk-bG.d.cts} +33 -3
- package/dist/{types-DKJ_-nbG.d.cts → types-DlNwk-bG.d.ts} +33 -3
- package/dist/ui.cjs +45 -45
- package/dist/ui.js +2 -2
- package/llms.txt +175 -5
- package/package.json +2 -1
- package/dist/JsonRenderResult-GQOYPLVH.cjs +0 -15
- package/dist/JsonRenderResult-ZFJ6VWMS.js +0 -6
- package/dist/chunk-4FBVV64J.js.map +0 -1
- package/dist/chunk-5QSXB6UL.cjs.map +0 -1
- package/dist/chunk-7L4FS6G7.js.map +0 -1
- package/dist/chunk-A7PCSWIK.js +0 -219
- package/dist/chunk-A7PCSWIK.js.map +0 -1
- package/dist/chunk-C24QG43M.cjs.map +0 -1
- package/dist/chunk-DMGYQ6NN.cjs.map +0 -1
- package/dist/chunk-FOZXDUSZ.js.map +0 -1
- package/dist/chunk-FYPJSHCL.js.map +0 -1
- package/dist/chunk-J2H6MLQF.cjs.map +0 -1
- package/dist/chunk-J2K7EJYP.cjs.map +0 -1
- package/dist/chunk-KVEJAPWA.js.map +0 -1
- package/dist/chunk-MC6QDYB6.cjs.map +0 -1
- package/dist/chunk-QDFPJJ5Y.cjs.map +0 -1
- package/dist/chunk-RPDJXB3U.js.map +0 -1
- package/dist/chunk-RTVEBPAJ.cjs +0 -230
- package/dist/chunk-RTVEBPAJ.cjs.map +0 -1
- package/dist/chunk-U3FXVLUK.js.map +0 -1
package/dist/llms-full.txt
CHANGED
|
@@ -431,9 +431,33 @@ Peer deps required: `react>=19`, `react-dom>=19`. The CSS import is required for
|
|
|
431
431
|
|
|
432
432
|
## Slots
|
|
433
433
|
|
|
434
|
-
Replace any UI piece via the `slots` prop
|
|
434
|
+
Replace any UI piece via the `slots` prop. Every slot receives `DefaultComponent` as a prop so you can compose with — or fully replace — the built-in UI.
|
|
435
435
|
|
|
436
|
-
|
|
436
|
+
**Available slot names:**
|
|
437
|
+
|
|
438
|
+
- `header`, `footer`, `input`, `welcomePage`, `loader` — layout chrome
|
|
439
|
+
- `assistantMessage`, `userMessage`, `systemMessage` — per-role message rendering
|
|
440
|
+
- `feedback` — thumbs-up/down + copy row under assistant messages
|
|
441
|
+
- `emptyState` — shown when no messages and no welcome
|
|
442
|
+
- `tools` — `Record<toolName, Component>` (keyed by **tool name**, e.g. `searchProducts`)
|
|
443
|
+
- `toolRenderers` — `Record<renderMode, Component>` (keyed by **render mode**, e.g. `visualization`)
|
|
444
|
+
- `liveChatPanel`, `satisfactionRating`, `visitorIdentityForm`, `floatingButton` — live-chat + widget chrome
|
|
445
|
+
|
|
446
|
+
**Common confusion:** `tools` is by **tool name**, `toolRenderers` is by **render mode**. If you want to override a specific tool's display, use `tools`. In dev mode the SDK emits a console warning if a tool name leaks into `toolRenderers`.
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
import type { AssistantMessageSlotProps } from "@aigentyc/chat-sdk";
|
|
450
|
+
|
|
451
|
+
function MyAssistantMsg({ text, DefaultComponent, ...rest }: AssistantMessageSlotProps & { DefaultComponent: any }) {
|
|
452
|
+
return (
|
|
453
|
+
<div className="my-wrapper">
|
|
454
|
+
<DefaultComponent text={text} {...rest} />
|
|
455
|
+
</div>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
<Chat slots={{ assistantMessage: MyAssistantMsg }} projectId="..." apiEndpoint="..." />
|
|
460
|
+
```
|
|
437
461
|
|
|
438
462
|
## Tool rendering
|
|
439
463
|
|
|
@@ -648,17 +672,163 @@ import { useAigentycChat } from "@aigentyc/chat-sdk/hooks";
|
|
|
648
672
|
|
|
649
673
|
const { newConversation, clearMessages } = useAigentycChat({ projectId: "...", apiEndpoint: "..." });
|
|
650
674
|
|
|
651
|
-
<button onClick={newConversation}>New conversation</button> // new sessionId + clears
|
|
652
|
-
<button onClick={clearMessages}>Clear messages</button> // clears, keeps session
|
|
675
|
+
<button onClick={newConversation}>New conversation</button> // new sessionId + clears + returns to welcome
|
|
676
|
+
<button onClick={clearMessages}>Clear messages</button> // clears, keeps session, returns to welcome
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Recipe: headless — full control with every event
|
|
680
|
+
|
|
681
|
+
```tsx
|
|
682
|
+
"use client";
|
|
683
|
+
import { useAigentycChat } from "@aigentyc/chat-sdk/hooks";
|
|
684
|
+
|
|
685
|
+
export default function MyCustomChat() {
|
|
686
|
+
const {
|
|
687
|
+
messages,
|
|
688
|
+
status,
|
|
689
|
+
sendMessage,
|
|
690
|
+
stopGeneration,
|
|
691
|
+
newConversation,
|
|
692
|
+
clearMessages,
|
|
693
|
+
activeTools,
|
|
694
|
+
liveChat,
|
|
695
|
+
sessionId,
|
|
696
|
+
} = useAigentycChat({
|
|
697
|
+
projectId: "proj_...",
|
|
698
|
+
apiEndpoint: "https://app.aigentyc.ai",
|
|
699
|
+
apiKey: "tyco_pk_...",
|
|
700
|
+
onMessageSent: (m) => console.log("sent", m),
|
|
701
|
+
onMessageReceived: (m) => console.log("received", m),
|
|
702
|
+
onStreamStart: () => console.log("stream started"),
|
|
703
|
+
onStreamEnd: () => console.log("stream ended"),
|
|
704
|
+
onToolCall: (name, args) => console.log("tool", name, args),
|
|
705
|
+
onToolResult: (name, result) => console.log("tool result", name, result),
|
|
706
|
+
onNewConversation: (newSessionId) => console.log("new session", newSessionId),
|
|
707
|
+
onStopGeneration: () => console.log("stopped"),
|
|
708
|
+
onClearMessages: () => console.log("cleared"),
|
|
709
|
+
onError: (err) => console.error(err),
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
return (
|
|
713
|
+
<div>
|
|
714
|
+
<div className="history">
|
|
715
|
+
{messages.map((m) => (
|
|
716
|
+
<div key={m.id}>
|
|
717
|
+
<b>{m.role}:</b> {m.content}
|
|
718
|
+
</div>
|
|
719
|
+
))}
|
|
720
|
+
</div>
|
|
721
|
+
{status === "streaming" && <button onClick={stopGeneration}>Stop</button>}
|
|
722
|
+
<button onClick={newConversation}>New</button>
|
|
723
|
+
</div>
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
### Recipe: control message part order (tools-first vs text-first)
|
|
729
|
+
|
|
730
|
+
```tsx
|
|
731
|
+
// Text parts render before tool cards (default, best for Q&A/RAG)
|
|
732
|
+
<Chat messagePartOrder="text-first" projectId="..." apiEndpoint="..." />
|
|
733
|
+
|
|
734
|
+
// Tool cards render before text (best for tool-heavy apps — product cards, forms, etc.)
|
|
735
|
+
<Chat messagePartOrder="tools-first" projectId="..." apiEndpoint="..." />
|
|
736
|
+
|
|
737
|
+
// Render parts in the stream order (whatever the API returns)
|
|
738
|
+
<Chat messagePartOrder="stream-order" projectId="..." apiEndpoint="..." />
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### Recipe: customize MessageFeedback (thumbs up/down) styling
|
|
742
|
+
|
|
743
|
+
```tsx
|
|
744
|
+
import { MessageFeedback } from "@aigentyc/chat-sdk/ai-elements";
|
|
745
|
+
|
|
746
|
+
// Option 1: strip defaults and style from scratch
|
|
747
|
+
<Chat
|
|
748
|
+
slots={{
|
|
749
|
+
feedback: (props) => (
|
|
750
|
+
<MessageFeedback {...props} unstyled classNames={{
|
|
751
|
+
root: "my-feedback-row",
|
|
752
|
+
thumbsUp: "my-thumb-btn",
|
|
753
|
+
thumbsDown: "my-thumb-btn",
|
|
754
|
+
}} />
|
|
755
|
+
),
|
|
756
|
+
}}
|
|
757
|
+
/>
|
|
758
|
+
|
|
759
|
+
// Option 2: full render override
|
|
760
|
+
<Chat
|
|
761
|
+
slots={{
|
|
762
|
+
feedback: (props) => (
|
|
763
|
+
<MessageFeedback
|
|
764
|
+
{...props}
|
|
765
|
+
renderActions={({ onPositive, onNegative, onCopy, feedback }) => (
|
|
766
|
+
<div className="flex gap-2">
|
|
767
|
+
<button onClick={onPositive} className={feedback === "positive" ? "active" : ""}>👍</button>
|
|
768
|
+
<button onClick={onNegative} className={feedback === "negative" ? "active" : ""}>👎</button>
|
|
769
|
+
<button onClick={onCopy}>Copy</button>
|
|
770
|
+
</div>
|
|
771
|
+
)}
|
|
772
|
+
/>
|
|
773
|
+
),
|
|
774
|
+
}}
|
|
775
|
+
/>
|
|
653
776
|
```
|
|
654
777
|
|
|
778
|
+
### Recipe: normalize messy tool data shapes
|
|
779
|
+
|
|
780
|
+
Custom tools (especially `data_store`) can return rows in a few shapes. Use the helper so renderers don't care:
|
|
781
|
+
|
|
782
|
+
```tsx
|
|
783
|
+
import { normalizeToolRows } from "@aigentyc/chat-sdk";
|
|
784
|
+
|
|
785
|
+
function ProductGrid({ result }: ToolRendererProps) {
|
|
786
|
+
// Handles: flat array, { rows: [...] } wrapper, raw DB rows { id, data: {...} }
|
|
787
|
+
const rows = normalizeToolRows(result?.data);
|
|
788
|
+
return (
|
|
789
|
+
<div className="grid grid-cols-2 gap-2">
|
|
790
|
+
{rows.map((row, i) => <div key={i}>{row.name as string} — ${row.price as number}</div>)}
|
|
791
|
+
</div>
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
### Recipe: catch tool-renderer crashes without killing the chat
|
|
797
|
+
|
|
798
|
+
Wrap a risky slot in `ChatErrorBoundary`:
|
|
799
|
+
|
|
800
|
+
```tsx
|
|
801
|
+
import { ChatErrorBoundary } from "@aigentyc/chat-sdk";
|
|
802
|
+
|
|
803
|
+
<Chat
|
|
804
|
+
slots={{
|
|
805
|
+
tools: {
|
|
806
|
+
myRiskyTool: (props) => (
|
|
807
|
+
<ChatErrorBoundary
|
|
808
|
+
label="product grid"
|
|
809
|
+
onError={(e) => Sentry.captureException(e)}
|
|
810
|
+
fallback={(err, retry) => <div>Failed. <button onClick={retry}>Retry</button></div>}
|
|
811
|
+
>
|
|
812
|
+
<MyProductGrid {...props} />
|
|
813
|
+
</ChatErrorBoundary>
|
|
814
|
+
),
|
|
815
|
+
},
|
|
816
|
+
}}
|
|
817
|
+
/>
|
|
818
|
+
```
|
|
819
|
+
The built-in tool dispatcher already wraps each tool in a boundary, so a single broken renderer never takes down the rest of the chat. Use `ChatErrorBoundary` manually only around custom slots you haven't tested in production.
|
|
820
|
+
|
|
655
821
|
## Troubleshooting
|
|
656
822
|
|
|
657
823
|
| Symptom | Likely cause | Fix |
|
|
658
824
|
| --- | --- | --- |
|
|
659
825
|
| Unstyled / broken layout | Missing CSS import | `import "@aigentyc/chat-sdk/theme/styles.css"` |
|
|
660
|
-
| 401 /
|
|
826
|
+
| 401 / "Missing Authorization" on embed | No `apiKey` passed — required for all third-party domain embeds | Pass `apiKey` prop (or `NEXT_PUBLIC_AIGENTYC_API_KEY` / `VITE_AIGENTYC_API_KEY` env var). The "no apiKey needed" path only works inside `app.aigentyc.com` itself (session cookie). |
|
|
827
|
+
| 403 / invalid origin | API key's Allowed Origins list doesn't include your embed domain | Dashboard → Settings → API Keys → edit → add domain |
|
|
661
828
|
| CORS error in browser | Allowed Origins on API key doesn't include current URL | Add `http://localhost:5173` (Vite) or `http://localhost:3000` (Next) to the key's Allowed Origins |
|
|
829
|
+
| Slot override doesn't render | Using `toolRenderers` keyed by tool name | Use `tools` for per-tool overrides; `toolRenderers` is per render mode. Dev console warns automatically. |
|
|
830
|
+
| Welcome doesn't reappear after "new conversation" | Old SDK version (pre-0.2) | Upgrade — `newConversation()` now triggers a bidirectional welcome toggle |
|
|
831
|
+
| Dark mode leaks white backgrounds | Custom CSS / old SDK | As of 0.2, internal components use `bg-background`/`bg-card` vars — upgrade if you see white leaks |
|
|
662
832
|
| `Cannot find module @ai-sdk/react` | Stale install from old SDK version | `rm -rf node_modules package-lock.json && npm install` (peers are bundled now) |
|
|
663
833
|
| Hebrew text shows LTR | Forgot `language="he"` | Pass `language="he"` to `<Chat>` |
|
|
664
834
|
| Tool result shows raw JSON | Custom tool with no renderer | Add `slots.tools[toolName]` or set `uiRenderMode: "hidden"` server-side |
|
|
@@ -695,22 +865,28 @@ Each entry below shows the typed exports for one subpath of the package. Use the
|
|
|
695
865
|
### `@aigentyc/chat-sdk` — Main exports — Chat, ChatWidget, ChatProvider, useAigentycChat
|
|
696
866
|
|
|
697
867
|
```ts
|
|
698
|
-
export { a as ChatConfig, b as ChatEventCallbacks, c as ChatMessage, d as ComponentAction, L as Language, e as LiveChatMessage, f as LiveChatState, Q as QuestionConfig, S as SlotMap, T as ThemeConfig, g as ToolRendererProps, h as ToolResult } from './types-
|
|
868
|
+
export { a as ChatConfig, b as ChatEventCallbacks, c as ChatMessage, d as ComponentAction, L as Language, e as LiveChatMessage, f as LiveChatState, Q as QuestionConfig, S as SlotMap, T as ThemeConfig, g as ToolRendererProps, h as ToolResult } from './types-DlNwk-bG.js';
|
|
699
869
|
|
|
700
|
-
export { L as LiveChatReturn, U as UseAigentycChatOptions,
|
|
870
|
+
export { L as LiveChatReturn, S as SlotComponent, a as SlotName, U as UseAigentycChatOptions, b as UseAigentycChatReturn, r as renderSlot, u as useAigentycChat, c as useChatContext, d as useLiveChat, e as useSlot, f as useSlots } from './SlotsContext-BjiX1mRx.js';
|
|
701
871
|
|
|
702
872
|
export { useTheme } from './theme.js';
|
|
703
873
|
|
|
704
874
|
export { useI18n } from './i18n.js';
|
|
705
875
|
|
|
706
|
-
export {
|
|
876
|
+
export { A as AssistantMessageSlotProps, C as ChatInterfaceProps, U as UserMessageSlotProps } from './ChatInterface-f8ftS56n.js';
|
|
877
|
+
|
|
878
|
+
export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.js';
|
|
879
|
+
|
|
880
|
+
export { F as FeedbackData, M as MessageFeedbackActionsState } from './message-feedback-cWR0NVok.js';
|
|
881
|
+
|
|
882
|
+
export { Chat, ChatErrorBoundary, type ChatProps, ChatProvider, ChatProviderProps, ChatWidget };
|
|
707
883
|
```
|
|
708
884
|
|
|
709
885
|
|
|
710
886
|
### `@aigentyc/chat-sdk/hooks` — Hooks — useAigentycChat, useChatContext, useTheme, useI18n, useLiveChat, useSlots
|
|
711
887
|
|
|
712
888
|
```ts
|
|
713
|
-
export { L as LiveChatReturn, U as UseAigentycChatOptions,
|
|
889
|
+
export { L as LiveChatReturn, U as UseAigentycChatOptions, b as UseAigentycChatReturn, u as useAigentycChat, c as useChatContext, d as useLiveChat, e as useSlot, f as useSlots } from './SlotsContext-BjiX1mRx.js';
|
|
714
890
|
|
|
715
891
|
export { useTheme } from './theme.js';
|
|
716
892
|
|
|
@@ -725,16 +901,20 @@ export { useImageLoader, useIsMobile, useMultiImageLoader, useMultiOrderTracking
|
|
|
725
901
|
### `@aigentyc/chat-sdk/components` — Granular components — ChatInterface, ChatInput, ChatHeader, etc.
|
|
726
902
|
|
|
727
903
|
```ts
|
|
728
|
-
export {
|
|
904
|
+
export { a as ChatInterface } from './ChatInterface-f8ftS56n.js';
|
|
905
|
+
|
|
906
|
+
export { CartDrawer, ChatDrawer, ChatFooter, ChatHeader, ChatInput, ChatInputWithAttachments, FloatingButton, LiveChatHeader, LiveChatPanel, LiveChatQueueBanner, PreviewEmbedPanel, QuickQuestions, SatisfactionRating, SystemMessage, VisitorIdentityForm, WelcomePage };
|
|
729
907
|
```
|
|
730
908
|
|
|
731
909
|
|
|
732
910
|
### `@aigentyc/chat-sdk/tools` — Tool rendering — ToolRenderer, SearchKnowledgeBaseRenderer
|
|
733
911
|
|
|
734
912
|
```ts
|
|
735
|
-
export { d as ComponentAction, h as ToolResult } from './types-
|
|
913
|
+
export { d as ComponentAction, h as ToolResult } from './types-DlNwk-bG.js';
|
|
914
|
+
|
|
915
|
+
export { J as JsonRenderResult } from './JsonRenderResult-D6ogds0_.js';
|
|
736
916
|
|
|
737
|
-
export {
|
|
917
|
+
export { g as getToolDisplayData, n as normalizeToolRows } from './normalize-KzCLLqpU.js';
|
|
738
918
|
|
|
739
919
|
export { ComponentRenderer, SearchKnowledgeBaseRenderer, ToolRenderer, ToolRendererProps, VisualizationRenderer };
|
|
740
920
|
```
|
|
@@ -743,7 +923,7 @@ export { ComponentRenderer, SearchKnowledgeBaseRenderer, ToolRenderer, ToolRende
|
|
|
743
923
|
### `@aigentyc/chat-sdk/theme` — Theming — ThemeProvider
|
|
744
924
|
|
|
745
925
|
```ts
|
|
746
|
-
export { T as ThemeConfig } from './types-
|
|
926
|
+
export { T as ThemeConfig } from './types-DlNwk-bG.js';
|
|
747
927
|
|
|
748
928
|
export { ThemeProvider, useTheme };
|
|
749
929
|
```
|
|
@@ -752,7 +932,7 @@ export { ThemeProvider, useTheme };
|
|
|
752
932
|
### `@aigentyc/chat-sdk/i18n` — Internationalization — addLanguage
|
|
753
933
|
|
|
754
934
|
```ts
|
|
755
|
-
export { L as Language } from './types-
|
|
935
|
+
export { L as Language } from './types-DlNwk-bG.js';
|
|
756
936
|
|
|
757
937
|
export { I18nProvider, type I18nProviderProps, type TranslationKeys, type TranslationMap, addLanguage, isRTL, useI18n };
|
|
758
938
|
```
|
|
@@ -761,7 +941,7 @@ export { I18nProvider, type I18nProviderProps, type TranslationKeys, type Transl
|
|
|
761
941
|
### `@aigentyc/chat-sdk/core` — Core types and utilities
|
|
762
942
|
|
|
763
943
|
```ts
|
|
764
|
-
export { b as ChatEventCallbacks, c as ChatMessage, C as ChatProviderProps, d as ComponentAction, L as Language, e as LiveChatMessage, f as LiveChatState, Q as QuestionConfig, S as SlotMap, i as SlotProps, T as ThemeConfig, g as ToolRendererProps, h as ToolResult } from './types-
|
|
944
|
+
export { b as ChatEventCallbacks, c as ChatMessage, C as ChatProviderProps, d as ComponentAction, L as Language, e as LiveChatMessage, f as LiveChatState, Q as QuestionConfig, S as SlotMap, i as SlotProps, T as ThemeConfig, g as ToolRendererProps, h as ToolResult } from './types-DlNwk-bG.js';
|
|
765
945
|
|
|
766
946
|
export { I as InteractionMetadata, a as InteractionType, T as TrackInteractionParams, U as UseInteractionTrackerOptions, g as generateSessionId, u as useInteractionTracker } from './interaction-tracker-D9P1Oq4j.js';
|
|
767
947
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { T as TrackInteractionParams } from './interaction-tracker-D9P1Oq4j.cjs';
|
|
4
|
+
|
|
5
|
+
declare const REVIEW_TYPES: readonly [{
|
|
6
|
+
readonly value: "wrong_answer";
|
|
7
|
+
readonly labelKey: "wrongAnswer";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "partial_answer";
|
|
10
|
+
readonly labelKey: "partialAnswer";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "hallucination";
|
|
13
|
+
readonly labelKey: "hallucination";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "inappropriate_tone";
|
|
16
|
+
readonly labelKey: "inappropriateTone";
|
|
17
|
+
}];
|
|
18
|
+
type ReviewType = (typeof REVIEW_TYPES)[number]["value"];
|
|
19
|
+
interface FeedbackData {
|
|
20
|
+
isPositive: boolean;
|
|
21
|
+
reviewType?: ReviewType;
|
|
22
|
+
reviewText?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Render-prop state passed to `renderActions`, letting consumers build
|
|
26
|
+
* a fully custom action row while keeping all behaviour (submit, copy,
|
|
27
|
+
* analytics) intact.
|
|
28
|
+
*/
|
|
29
|
+
interface MessageFeedbackActionsState {
|
|
30
|
+
/** Current feedback selection (if any) */
|
|
31
|
+
feedback: "positive" | "negative" | null;
|
|
32
|
+
/** True while a feedback submit is in-flight */
|
|
33
|
+
isSubmitting: boolean;
|
|
34
|
+
/** True briefly after the copy button is used */
|
|
35
|
+
copied: boolean;
|
|
36
|
+
/** Submit positive feedback and fire analytics */
|
|
37
|
+
onPositive: () => void;
|
|
38
|
+
/** Submit negative feedback — opens the review form */
|
|
39
|
+
onNegative: () => void;
|
|
40
|
+
/** Copy the assistant's text content to clipboard */
|
|
41
|
+
onCopy: () => void;
|
|
42
|
+
}
|
|
43
|
+
interface MessageFeedbackProps {
|
|
44
|
+
messageId: string;
|
|
45
|
+
projectId: string;
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
apiEndpoint?: string;
|
|
49
|
+
textContent: string;
|
|
50
|
+
trackInteraction?: (params: TrackInteractionParams) => void;
|
|
51
|
+
/** Optional className merged onto the root wrapper. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/**
|
|
54
|
+
* When true, strip the default Tailwind bubble styling and only render
|
|
55
|
+
* the semantic structure. Ideal if you want to style from scratch with
|
|
56
|
+
* your own design system.
|
|
57
|
+
*/
|
|
58
|
+
unstyled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Per-element className overrides. Merged with defaults via `cn()` so
|
|
61
|
+
* Tailwind utilities can override (e.g. `bg-red-500`).
|
|
62
|
+
*/
|
|
63
|
+
classNames?: {
|
|
64
|
+
root?: string;
|
|
65
|
+
actions?: string;
|
|
66
|
+
thumbsUp?: string;
|
|
67
|
+
thumbsDown?: string;
|
|
68
|
+
copy?: string;
|
|
69
|
+
reviewForm?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Full override of the action button row. Receives the submit handlers
|
|
73
|
+
* + current state. Return any ReactNode. The built-in review form still
|
|
74
|
+
* appears below when the user clicks thumbs-down (unless you handle
|
|
75
|
+
* `onNegative` yourself and never trigger it).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* renderActions={({ onPositive, onNegative, onCopy }) => (
|
|
80
|
+
* <div className="my-custom-row">
|
|
81
|
+
* <MyButton onClick={onPositive}>👍</MyButton>
|
|
82
|
+
* <MyButton onClick={onNegative}>👎</MyButton>
|
|
83
|
+
* <MyButton onClick={onCopy}>Copy</MyButton>
|
|
84
|
+
* </div>
|
|
85
|
+
* )}
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
renderActions?: (state: MessageFeedbackActionsState) => ReactNode;
|
|
89
|
+
}
|
|
90
|
+
declare function MessageFeedback({ messageId, projectId, sessionId, apiKey, apiEndpoint, textContent, trackInteraction, className, unstyled, classNames, renderActions, }: MessageFeedbackProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
|
|
92
|
+
export { type FeedbackData as F, type MessageFeedbackActionsState as M, MessageFeedback as a };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { T as TrackInteractionParams } from './interaction-tracker-D9P1Oq4j.js';
|
|
4
|
+
|
|
5
|
+
declare const REVIEW_TYPES: readonly [{
|
|
6
|
+
readonly value: "wrong_answer";
|
|
7
|
+
readonly labelKey: "wrongAnswer";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: "partial_answer";
|
|
10
|
+
readonly labelKey: "partialAnswer";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "hallucination";
|
|
13
|
+
readonly labelKey: "hallucination";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "inappropriate_tone";
|
|
16
|
+
readonly labelKey: "inappropriateTone";
|
|
17
|
+
}];
|
|
18
|
+
type ReviewType = (typeof REVIEW_TYPES)[number]["value"];
|
|
19
|
+
interface FeedbackData {
|
|
20
|
+
isPositive: boolean;
|
|
21
|
+
reviewType?: ReviewType;
|
|
22
|
+
reviewText?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Render-prop state passed to `renderActions`, letting consumers build
|
|
26
|
+
* a fully custom action row while keeping all behaviour (submit, copy,
|
|
27
|
+
* analytics) intact.
|
|
28
|
+
*/
|
|
29
|
+
interface MessageFeedbackActionsState {
|
|
30
|
+
/** Current feedback selection (if any) */
|
|
31
|
+
feedback: "positive" | "negative" | null;
|
|
32
|
+
/** True while a feedback submit is in-flight */
|
|
33
|
+
isSubmitting: boolean;
|
|
34
|
+
/** True briefly after the copy button is used */
|
|
35
|
+
copied: boolean;
|
|
36
|
+
/** Submit positive feedback and fire analytics */
|
|
37
|
+
onPositive: () => void;
|
|
38
|
+
/** Submit negative feedback — opens the review form */
|
|
39
|
+
onNegative: () => void;
|
|
40
|
+
/** Copy the assistant's text content to clipboard */
|
|
41
|
+
onCopy: () => void;
|
|
42
|
+
}
|
|
43
|
+
interface MessageFeedbackProps {
|
|
44
|
+
messageId: string;
|
|
45
|
+
projectId: string;
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
apiEndpoint?: string;
|
|
49
|
+
textContent: string;
|
|
50
|
+
trackInteraction?: (params: TrackInteractionParams) => void;
|
|
51
|
+
/** Optional className merged onto the root wrapper. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/**
|
|
54
|
+
* When true, strip the default Tailwind bubble styling and only render
|
|
55
|
+
* the semantic structure. Ideal if you want to style from scratch with
|
|
56
|
+
* your own design system.
|
|
57
|
+
*/
|
|
58
|
+
unstyled?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Per-element className overrides. Merged with defaults via `cn()` so
|
|
61
|
+
* Tailwind utilities can override (e.g. `bg-red-500`).
|
|
62
|
+
*/
|
|
63
|
+
classNames?: {
|
|
64
|
+
root?: string;
|
|
65
|
+
actions?: string;
|
|
66
|
+
thumbsUp?: string;
|
|
67
|
+
thumbsDown?: string;
|
|
68
|
+
copy?: string;
|
|
69
|
+
reviewForm?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Full override of the action button row. Receives the submit handlers
|
|
73
|
+
* + current state. Return any ReactNode. The built-in review form still
|
|
74
|
+
* appears below when the user clicks thumbs-down (unless you handle
|
|
75
|
+
* `onNegative` yourself and never trigger it).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* renderActions={({ onPositive, onNegative, onCopy }) => (
|
|
80
|
+
* <div className="my-custom-row">
|
|
81
|
+
* <MyButton onClick={onPositive}>👍</MyButton>
|
|
82
|
+
* <MyButton onClick={onNegative}>👎</MyButton>
|
|
83
|
+
* <MyButton onClick={onCopy}>Copy</MyButton>
|
|
84
|
+
* </div>
|
|
85
|
+
* )}
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
renderActions?: (state: MessageFeedbackActionsState) => ReactNode;
|
|
89
|
+
}
|
|
90
|
+
declare function MessageFeedback({ messageId, projectId, sessionId, apiKey, apiEndpoint, textContent, trackInteraction, className, unstyled, classNames, renderActions, }: MessageFeedbackProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
|
|
92
|
+
export { type FeedbackData as F, type MessageFeedbackActionsState as M, MessageFeedback as a };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool result normalization helpers.
|
|
3
|
+
*
|
|
4
|
+
* Tools (especially `data_store`) can return data in a handful of shapes:
|
|
5
|
+
*
|
|
6
|
+
* 1. Projected flat rows (default `rows_only` mode):
|
|
7
|
+
* `[{ name: "alice", city: "haifa" }, ...]`
|
|
8
|
+
*
|
|
9
|
+
* 2. Full-format wrapper (`responseMode: "full"`):
|
|
10
|
+
* `{ storeName, columns, rows: [...], totalMatches, returned }`
|
|
11
|
+
*
|
|
12
|
+
* 3. Raw DB rows (from custom_execute that echoes the DB layer):
|
|
13
|
+
* `[{ id, dataStoreId, data: { name, city }, sortOrder }]`
|
|
14
|
+
*
|
|
15
|
+
* Custom renderers that want to work with any of these shapes can use
|
|
16
|
+
* `normalizeToolRows()` to get a consistent `Array<Record<string, unknown>>`
|
|
17
|
+
* regardless of upstream shape.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a tool result (or `result.data`) into a flat array of row
|
|
21
|
+
* objects, regardless of which shape the backend returned.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* function MyRenderer({ result }: ToolRendererProps) {
|
|
26
|
+
* const rows = normalizeToolRows(result?.data);
|
|
27
|
+
* return <Table rows={rows} />;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare function normalizeToolRows(input: unknown): Array<Record<string, unknown>>;
|
|
32
|
+
/**
|
|
33
|
+
* Extract the display payload from a tool result, preferring `_displayData`
|
|
34
|
+
* over `data` (matches the ToolRenderer resolution). Useful when you're
|
|
35
|
+
* rendering from outside the built-in dispatcher.
|
|
36
|
+
*/
|
|
37
|
+
declare function getToolDisplayData(result: {
|
|
38
|
+
data?: unknown;
|
|
39
|
+
_displayData?: unknown;
|
|
40
|
+
} | undefined): unknown;
|
|
41
|
+
|
|
42
|
+
export { getToolDisplayData as g, normalizeToolRows as n };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool result normalization helpers.
|
|
3
|
+
*
|
|
4
|
+
* Tools (especially `data_store`) can return data in a handful of shapes:
|
|
5
|
+
*
|
|
6
|
+
* 1. Projected flat rows (default `rows_only` mode):
|
|
7
|
+
* `[{ name: "alice", city: "haifa" }, ...]`
|
|
8
|
+
*
|
|
9
|
+
* 2. Full-format wrapper (`responseMode: "full"`):
|
|
10
|
+
* `{ storeName, columns, rows: [...], totalMatches, returned }`
|
|
11
|
+
*
|
|
12
|
+
* 3. Raw DB rows (from custom_execute that echoes the DB layer):
|
|
13
|
+
* `[{ id, dataStoreId, data: { name, city }, sortOrder }]`
|
|
14
|
+
*
|
|
15
|
+
* Custom renderers that want to work with any of these shapes can use
|
|
16
|
+
* `normalizeToolRows()` to get a consistent `Array<Record<string, unknown>>`
|
|
17
|
+
* regardless of upstream shape.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a tool result (or `result.data`) into a flat array of row
|
|
21
|
+
* objects, regardless of which shape the backend returned.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* function MyRenderer({ result }: ToolRendererProps) {
|
|
26
|
+
* const rows = normalizeToolRows(result?.data);
|
|
27
|
+
* return <Table rows={rows} />;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare function normalizeToolRows(input: unknown): Array<Record<string, unknown>>;
|
|
32
|
+
/**
|
|
33
|
+
* Extract the display payload from a tool result, preferring `_displayData`
|
|
34
|
+
* over `data` (matches the ToolRenderer resolution). Useful when you're
|
|
35
|
+
* rendering from outside the built-in dispatcher.
|
|
36
|
+
*/
|
|
37
|
+
declare function getToolDisplayData(result: {
|
|
38
|
+
data?: unknown;
|
|
39
|
+
_displayData?: unknown;
|
|
40
|
+
} | undefined): unknown;
|
|
41
|
+
|
|
42
|
+
export { getToolDisplayData as g, normalizeToolRows as n };
|