@gr33n-ai/jade-sdk-client 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/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # @gr33n-ai/jade-sdk-client
2
+
3
+ TypeScript/React client for [Jade AI](https://jade.gr33n.ai) - generate images, videos, and audio with AI.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @gr33n-ai/jade-sdk-client
9
+ # or
10
+ yarn add @gr33n-ai/jade-sdk-client
11
+ # or
12
+ pnpm add @gr33n-ai/jade-sdk-client
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```tsx
18
+ import { JadeProvider, useJadeSession } from '@gr33n-ai/jade-sdk-client/react';
19
+
20
+ function App() {
21
+ return (
22
+ <JadeProvider
23
+ config={{
24
+ endpoint: 'https://api.jade.gr33n.ai',
25
+ getAuthToken: () => 'your-api-key',
26
+ }}
27
+ >
28
+ <Chat />
29
+ </JadeProvider>
30
+ );
31
+ }
32
+
33
+ function Chat() {
34
+ const { processedConversation, sendMessage, media, isStreaming } = useJadeSession();
35
+
36
+ return (
37
+ <div>
38
+ {processedConversation.map((entry, i) => (
39
+ <div key={i}>
40
+ {entry.entry.text}
41
+ {entry.mediaUrls?.map(url => <img key={url} src={url} />)}
42
+ </div>
43
+ ))}
44
+ <button onClick={() => sendMessage('Generate an image of a sunset')}>
45
+ Generate
46
+ </button>
47
+ </div>
48
+ );
49
+ }
50
+ ```
51
+
52
+ ## Features
53
+
54
+ - **Real-time Streaming**: Server-sent events for instant feedback
55
+ - **Media Generation**: Generate images, videos, and audio
56
+ - **Session Management**: Persistent conversations with history
57
+ - **Type-Safe**: Full TypeScript support
58
+ - **React Hooks**: Easy integration with `useJadeSession`
59
+
60
+ ## Documentation
61
+
62
+ Full documentation available at [docs.gr33n.ai](https://docs.gr33n.ai)
63
+
64
+ - [TypeScript Quickstart](https://docs.gr33n.ai/quickstart/typescript)
65
+ - [React Hooks Reference](https://docs.gr33n.ai/react/use-jade-session)
66
+ - [API Reference](https://docs.gr33n.ai/api-reference/client)
67
+
68
+ ## API
69
+
70
+ ### JadeProvider
71
+
72
+ Wrap your app with `JadeProvider` to enable Jade hooks:
73
+
74
+ ```tsx
75
+ <JadeProvider
76
+ config={{
77
+ endpoint: 'https://api.jade.gr33n.ai',
78
+ getAuthToken: () => apiKey,
79
+ organizationId: 'org_123', // optional
80
+ }}
81
+ >
82
+ <App />
83
+ </JadeProvider>
84
+ ```
85
+
86
+ ### useJadeSession
87
+
88
+ Main hook for chat functionality:
89
+
90
+ ```tsx
91
+ const {
92
+ // State
93
+ processedConversation, // Processed entries ready for display
94
+ media, // All generated media
95
+ isStreaming, // Currently generating
96
+ sessionId, // Current session ID
97
+
98
+ // Actions
99
+ sendMessage, // Send a message
100
+ cancel, // Cancel streaming
101
+ clear, // Clear conversation
102
+ loadSession, // Load previous session
103
+ reconnect, // Reconnect to session
104
+ } = useJadeSession();
105
+ ```
106
+
107
+ ### useMedia
108
+
109
+ Extract media from conversation:
110
+
111
+ ```tsx
112
+ const media = useMedia(conversation);
113
+ // Returns: MediaInfo[] with url, type, prompt, model, etc.
114
+ ```
115
+
116
+ ## Requirements
117
+
118
+ - React 18+
119
+ - Node.js 18+ (for SSE support)
120
+
121
+ ## License
122
+
123
+ MIT