@dudousxd/nestjs-agent-react 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Davide Carvalho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # `@dudousxd/nestjs-agent-react`
2
+
3
+ > 🪺 Part of the [Aviary](https://davidecarvalho.github.io/aviary) · the React frontend for [`@dudousxd/nestjs-agent`](https://www.npmjs.com/package/@dudousxd/nestjs-agent).
4
+
5
+ `useAgentChat` wraps the Vercel **AI SDK v7** `useChat` with a transport for the agent's `/agent/chat`
6
+ SSE, plus threads, personas, quota, cancel, and human-in-the-loop approve/reject. Ships styling-agnostic
7
+ chat components (every action is a callback; all styling via `classNames`) and an optional rich-markdown
8
+ subpath.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pnpm add @dudousxd/nestjs-agent-react @ai-sdk/react ai react
14
+ ```
15
+
16
+ ## Use
17
+
18
+ ```tsx
19
+ import { useAgentChat, MessageList, ChatInput } from '@dudousxd/nestjs-agent-react';
20
+
21
+ function Chat() {
22
+ const chat = useAgentChat({
23
+ baseUrl: '/agent',
24
+ getHeaders: () => ({ 'x-actor-id': me.id, 'x-actor-role': me.roles.join(',') }),
25
+ });
26
+ return (
27
+ <>
28
+ <MessageList
29
+ messages={chat.messages}
30
+ status={chat.status}
31
+ regeneratable
32
+ onRegenerate={() => chat.regenerate()}
33
+ />
34
+ <ChatInput onSubmit={(text) => chat.sendMessage({ text })} />
35
+ </>
36
+ );
37
+ }
38
+ ```
39
+
40
+ ### Optional markdown subpath
41
+
42
+ ```tsx
43
+ import { AgentMarkdown } from '@dudousxd/nestjs-agent-react/markdown';
44
+ // <MessageList renderText={(text, { isStreaming }) => <AgentMarkdown isStreaming={isStreaming}>{text}</AgentMarkdown>} />
45
+ ```
46
+
47
+ `AgentMarkdown` ships the full streamdown stack (GFM, KaTeX, syntax-highlighted code, Mermaid) — those
48
+ renderers are **optional peer dependencies**, so the base package stays light for apps that don't need them.
49
+
50
+ ## License
51
+
52
+ MIT © Davide Carvalho