@aigentyc/chat-sdk 0.1.3 → 0.1.5

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.
Files changed (43) hide show
  1. package/AGENTS.md +187 -0
  2. package/dist/ai-elements.cjs +119 -162
  3. package/dist/ai-elements.cjs.map +1 -1
  4. package/dist/ai-elements.js +5 -60
  5. package/dist/ai-elements.js.map +1 -1
  6. package/dist/{chunk-PKGD6CTD.js → chunk-2677FDTG.js} +107 -59
  7. package/dist/chunk-2677FDTG.js.map +1 -0
  8. package/dist/{chunk-42ARGQXE.js → chunk-7L4FS6G7.js} +7 -3
  9. package/dist/chunk-7L4FS6G7.js.map +1 -0
  10. package/dist/{chunk-VS3NZ7FX.js → chunk-A7PCSWIK.js} +60 -5
  11. package/dist/chunk-A7PCSWIK.js.map +1 -0
  12. package/dist/{chunk-WZLWAVSS.cjs → chunk-C24QG43M.cjs} +10 -2
  13. package/dist/chunk-C24QG43M.cjs.map +1 -0
  14. package/dist/{chunk-NW2ESHRV.js → chunk-KVEJAPWA.js} +4 -8
  15. package/dist/chunk-KVEJAPWA.js.map +1 -0
  16. package/dist/{chunk-X5YEOOPK.cjs → chunk-QDFPJJ5Y.cjs} +5 -13
  17. package/dist/chunk-QDFPJJ5Y.cjs.map +1 -0
  18. package/dist/{chunk-FQN6OBGN.cjs → chunk-RTVEBPAJ.cjs} +63 -4
  19. package/dist/chunk-RTVEBPAJ.cjs.map +1 -0
  20. package/dist/{chunk-IWIGM3RY.cjs → chunk-WQARQ2FJ.cjs} +109 -61
  21. package/dist/chunk-WQARQ2FJ.cjs.map +1 -0
  22. package/dist/components.cjs +14 -14
  23. package/dist/components.d.cts +5 -0
  24. package/dist/components.d.ts +5 -0
  25. package/dist/components.js +4 -4
  26. package/dist/index.cjs +14 -12
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +8 -1
  29. package/dist/index.d.ts +8 -1
  30. package/dist/index.js +8 -6
  31. package/dist/index.js.map +1 -1
  32. package/dist/ui.cjs +51 -51
  33. package/dist/ui.js +2 -2
  34. package/llms.txt +128 -0
  35. package/package.json +4 -1
  36. package/dist/chunk-42ARGQXE.js.map +0 -1
  37. package/dist/chunk-FQN6OBGN.cjs.map +0 -1
  38. package/dist/chunk-IWIGM3RY.cjs.map +0 -1
  39. package/dist/chunk-NW2ESHRV.js.map +0 -1
  40. package/dist/chunk-PKGD6CTD.js.map +0 -1
  41. package/dist/chunk-VS3NZ7FX.js.map +0 -1
  42. package/dist/chunk-WZLWAVSS.cjs.map +0 -1
  43. package/dist/chunk-X5YEOOPK.cjs.map +0 -1
package/AGENTS.md ADDED
@@ -0,0 +1,187 @@
1
+ # AGENTS.md — @aigentyc/chat-sdk
2
+
3
+ Guide for AI coding assistants (Claude Code, Cursor, Windsurf, v0, Lovable, Bolt) using or contributing to this SDK. Humans: read `README.md` first.
4
+
5
+ ---
6
+
7
+ ## What this package is
8
+
9
+ React 19 SDK for embedding an AI chat UI backed by the Aigentyc platform. Ships as a set of subpath exports so consumers only pull what they need.
10
+
11
+ - Package name: `@aigentyc/chat-sdk`
12
+ - Peer deps (required): `react>=19`, `react-dom>=19`
13
+ - Bundled internally (no install needed): `@ai-sdk/react`, `ai`
14
+ - Peer deps (optional, install only for that feature): `socket.io-client` (live chat), `recharts` (viz), `@json-render/*` + `zod` (json-render)
15
+ - SSR: all client components emit `"use client"`; safe for Next.js App Router.
16
+
17
+ ---
18
+
19
+ ## Canonical install + usage (paste-ready)
20
+
21
+ **New project?** Use the scaffolder — it's the lowest-risk path:
22
+
23
+ ```bash
24
+ npm create aigentyc-chat@latest my-app -- --template=next --project-id=YOUR_ID
25
+ ```
26
+
27
+ **Adding to an existing app:**
28
+
29
+ ```bash
30
+ npm install @aigentyc/chat-sdk
31
+ ```
32
+
33
+ ```tsx
34
+ import { Chat } from "@aigentyc/chat-sdk"
35
+ import "@aigentyc/chat-sdk/theme/styles.css"
36
+
37
+ export default function Page() {
38
+ return (
39
+ <Chat
40
+ projectId="YOUR_PROJECT_ID"
41
+ apiEndpoint="https://api.aigentyc.com"
42
+ apiKey="YOUR_API_KEY"
43
+ />
44
+ )
45
+ }
46
+ ```
47
+
48
+ **Required:** the CSS import. Without it the chat renders unstyled.
49
+
50
+ ---
51
+
52
+ ## Decision tree: which API to use
53
+
54
+ ```
55
+ Need a full chat UI with zero config? → <Chat />
56
+ Need a floating bubble widget? → <ChatWidget />
57
+ Need to customize header/input/messages only? → <Chat slots={{...}} />
58
+ Need custom layout around the chat? → <ChatProvider> + <ChatInterface /> + <ChatInput />
59
+ Need your own UI entirely? → useAigentycChat() (headless)
60
+ Need to override one tool's rendering? → slots.tools[toolName]
61
+ ```
62
+
63
+ Don't reach for the headless hook just to change styling — use `theme` or `slots` first.
64
+
65
+ ---
66
+
67
+ ## Entry points (import from these, never from `dist/`)
68
+
69
+ | Import | What you get |
70
+ | --- | --- |
71
+ | `@aigentyc/chat-sdk` | `Chat`, `ChatWidget`, `ChatProvider` |
72
+ | `@aigentyc/chat-sdk/hooks` | `useAigentycChat`, other hooks |
73
+ | `@aigentyc/chat-sdk/components` | Granular composable chat pieces |
74
+ | `@aigentyc/chat-sdk/ai-elements` | `Message`, `Conversation` primitives |
75
+ | `@aigentyc/chat-sdk/tools` | `ToolRenderer`, `VisualizationRenderer` |
76
+ | `@aigentyc/chat-sdk/json-render` | json-render integration |
77
+ | `@aigentyc/chat-sdk/ui` | shadcn-style primitives |
78
+ | `@aigentyc/chat-sdk/theme` | `ThemeProvider`; CSS at `.../theme/styles.css` |
79
+ | `@aigentyc/chat-sdk/i18n` | `addLanguage`, built-in `en`, `he` |
80
+ | `@aigentyc/chat-sdk/core` | Types, transport, utilities |
81
+
82
+ ---
83
+
84
+ ## Slots
85
+
86
+ `slots` prop on `<Chat>` / `<ChatWidget>`:
87
+
88
+ - `header`, `welcome`, `message`, `input`, `footer`, `loader`, `suggestions`
89
+ - `tools`: `Record<toolName, ComponentType>` — override per-tool rendering
90
+
91
+ Each slot receives typed props — consult `.d.ts` of the entry points for exact signatures. Don't invent prop names.
92
+
93
+ ---
94
+
95
+ ## Tool rendering
96
+
97
+ Tool results come back from the backend with a `uiRenderMode`:
98
+
99
+ - `visualization` → recharts (requires `recharts` peer)
100
+ - `json_render` → `@json-render/shadcn` (requires `@json-render/*` + `zod` peers)
101
+ - `legacy` → HTML/CSS template from backend
102
+ - `preset` → built-in renderer
103
+
104
+ If a peer is missing, that tool's UI falls back; install the peer or override via `slots.tools[name]`.
105
+
106
+ ---
107
+
108
+ ## Theming
109
+
110
+ CSS variables scoped under `[data-aigentyc-chat]`. Two ways to customize:
111
+
112
+ ```tsx
113
+ <Chat theme={{ primaryColor: "#3b82f6" }} />
114
+ ```
115
+
116
+ or plain CSS targeting `[data-aigentyc-chat]`. Do **not** edit `dist/styles.css` directly.
117
+
118
+ ---
119
+
120
+ ## i18n
121
+
122
+ Built-in: `en`, `he`. Add more:
123
+
124
+ ```tsx
125
+ import { addLanguage } from "@aigentyc/chat-sdk/i18n"
126
+ addLanguage("fr", { welcomeTitle: "Bienvenue" })
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Live chat handoff
132
+
133
+ ```tsx
134
+ <Chat enableLiveChat chatServiceUrl="wss://..." />
135
+ ```
136
+
137
+ Requires `socket.io-client`. Omit both props for AI-only mode.
138
+
139
+ ---
140
+
141
+ ## Rules for agents editing consumer projects
142
+
143
+ **Do:**
144
+ - Use the canonical quick start above verbatim for first-time setup.
145
+ - Import CSS once, at the app root or layout file.
146
+ - Prefer `slots` + `theme` before going headless.
147
+ - Use React 19 features (Actions, `use`) — this SDK targets React 19.
148
+ - Check `.d.ts` files under the published package for exact prop types.
149
+
150
+ **Don't:**
151
+ - Don't install React 18 — peer is `>=19`. If the project is on React 18, warn the user and stop.
152
+ - Don't import from `@aigentyc/chat-sdk/dist/*` — those paths are not public API.
153
+ - Don't reimplement message rendering when `slots.message` exists.
154
+ - Don't call the Aigentyc API directly from the client — the SDK owns transport.
155
+ - Don't add `"use client"` to files that wrap the SDK unnecessarily; it's already inside.
156
+ - Don't commit `apiKey` to source control; use env vars (`NEXT_PUBLIC_*` only if the project is OK exposing it; otherwise proxy through a server route).
157
+
158
+ ---
159
+
160
+ ## Troubleshooting quick table
161
+
162
+ | Symptom | Likely cause |
163
+ | --- | --- |
164
+ | Unstyled / broken layout | Missing `import "@aigentyc/chat-sdk/theme/styles.css"` |
165
+ | "Cannot find module @ai-sdk/react" | Stale install — delete `node_modules` and reinstall (these are now bundled) |
166
+ | Tool renders blank | Peer for that `uiRenderMode` not installed |
167
+ | SSR hydration warning | Wrapping `<Chat>` in a non-client component — it's fine, the SDK handles `"use client"` internally; check for other client-only code in the tree |
168
+ | React version error | Upgrade to React 19 |
169
+
170
+ ---
171
+
172
+ ## Repository layout (for contributors)
173
+
174
+ - `src/` — source; barrel files per entry point
175
+ - `dist/` — build output (tsup); do not edit
176
+ - `stories/` — Storybook
177
+ - `demo/` — local demo app (standalone Vite)
178
+ - `src/styles/index.css` — Tailwind entry compiled to `dist/styles.css`
179
+
180
+ Scripts: `pnpm build`, `pnpm storybook`, `pnpm test`, `pnpm lint`.
181
+
182
+ ---
183
+
184
+ ## Versioning
185
+
186
+ - Current: `0.1.0` (pre-1.0 — API may shift).
187
+ - Pin exact versions in consumer projects until 1.0.