@agentick/react 0.0.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/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/context.d.ts +90 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +120 -0
- package/dist/context.js.map +1 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +442 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +212 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
- package/src/__tests__/hooks.spec.tsx +426 -0
- package/src/context.tsx +133 -0
- package/src/hooks.ts +612 -0
- package/src/index.ts +123 -0
- package/src/types.ts +271 -0
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hooks for Agentick.
|
|
3
|
+
*
|
|
4
|
+
* @module @agentick/react/hooks
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useEffect, useCallback, useRef, useSyncExternalStore, useMemo, useContext, } from "react";
|
|
7
|
+
import { AgentickContext } from "./context";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// useClient
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Access the Agentick client from context.
|
|
13
|
+
*
|
|
14
|
+
* @throws If used outside of AgentickProvider
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { useClient } from '@agentick/react';
|
|
19
|
+
*
|
|
20
|
+
* function MyComponent() {
|
|
21
|
+
* const client = useClient();
|
|
22
|
+
*
|
|
23
|
+
* // Direct client access for advanced use cases
|
|
24
|
+
* const handleCustomChannel = () => {
|
|
25
|
+
* const session = client.session('conv-123');
|
|
26
|
+
* const channel = session.channel('custom');
|
|
27
|
+
* channel.publish('event', { data: 'value' });
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* return <button onClick={handleCustomChannel}>Send</button>;
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function useClient() {
|
|
35
|
+
const context = useContext(AgentickContext);
|
|
36
|
+
if (!context) {
|
|
37
|
+
throw new Error("useClient must be used within a AgentickProvider");
|
|
38
|
+
}
|
|
39
|
+
return context.client;
|
|
40
|
+
}
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// useConnectionState (alias for useConnection)
|
|
43
|
+
// ============================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Subscribe to connection state changes.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* import { useConnectionState } from '@agentick/react';
|
|
50
|
+
*
|
|
51
|
+
* function ConnectionIndicator() {
|
|
52
|
+
* const state = useConnectionState();
|
|
53
|
+
*
|
|
54
|
+
* return (
|
|
55
|
+
* <div className={`indicator ${state}`}>
|
|
56
|
+
* {state === 'connected' ? 'Online' : 'Offline'}
|
|
57
|
+
* </div>
|
|
58
|
+
* );
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function useConnectionState() {
|
|
63
|
+
const client = useClient();
|
|
64
|
+
const [state, setState] = useState(client.state);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
// Sync initial state
|
|
67
|
+
setState(client.state);
|
|
68
|
+
// Subscribe to changes
|
|
69
|
+
const unsubscribe = client.onConnectionChange(setState);
|
|
70
|
+
return unsubscribe;
|
|
71
|
+
}, [client]);
|
|
72
|
+
return state;
|
|
73
|
+
}
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// useConnection
|
|
76
|
+
// ============================================================================
|
|
77
|
+
/**
|
|
78
|
+
* Read the SSE connection state.
|
|
79
|
+
*/
|
|
80
|
+
export function useConnection(_options = {}) {
|
|
81
|
+
const client = useClient();
|
|
82
|
+
const [state, setState] = useState(client.state);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setState(client.state);
|
|
85
|
+
return client.onConnectionChange(setState);
|
|
86
|
+
}, [client]);
|
|
87
|
+
return {
|
|
88
|
+
state,
|
|
89
|
+
isConnected: state === "connected",
|
|
90
|
+
isConnecting: state === "connecting",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// useSession
|
|
95
|
+
// ============================================================================
|
|
96
|
+
/**
|
|
97
|
+
* Work with a specific session.
|
|
98
|
+
*
|
|
99
|
+
* @example Basic usage with session ID
|
|
100
|
+
* ```tsx
|
|
101
|
+
* import { useSession } from '@agentick/react';
|
|
102
|
+
*
|
|
103
|
+
* function Chat({ sessionId }: { sessionId: string }) {
|
|
104
|
+
* const { send, isSubscribed, subscribe } = useSession({ sessionId });
|
|
105
|
+
* const [input, setInput] = useState('');
|
|
106
|
+
*
|
|
107
|
+
* // Subscribe on mount
|
|
108
|
+
* useEffect(() => {
|
|
109
|
+
* subscribe();
|
|
110
|
+
* }, [subscribe]);
|
|
111
|
+
*
|
|
112
|
+
* const handleSend = async () => {
|
|
113
|
+
* await send(input);
|
|
114
|
+
* setInput('');
|
|
115
|
+
* };
|
|
116
|
+
*
|
|
117
|
+
* return (
|
|
118
|
+
* <div>
|
|
119
|
+
* <input value={input} onChange={(e) => setInput(e.target.value)} />
|
|
120
|
+
* <button onClick={handleSend}>Send</button>
|
|
121
|
+
* </div>
|
|
122
|
+
* );
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @example Ephemeral session (no sessionId)
|
|
127
|
+
* ```tsx
|
|
128
|
+
* function QuickChat() {
|
|
129
|
+
* const { send } = useSession();
|
|
130
|
+
*
|
|
131
|
+
* // Each send creates/uses an ephemeral session
|
|
132
|
+
* const handleSend = () => send('Hello!');
|
|
133
|
+
*
|
|
134
|
+
* return <button onClick={handleSend}>Ask</button>;
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* @example Auto-subscribe
|
|
139
|
+
* ```tsx
|
|
140
|
+
* function Chat({ sessionId }: { sessionId: string }) {
|
|
141
|
+
* const { send, isSubscribed } = useSession({
|
|
142
|
+
* sessionId,
|
|
143
|
+
* autoSubscribe: true,
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* if (!isSubscribed) return <div>Subscribing...</div>;
|
|
147
|
+
*
|
|
148
|
+
* return <ChatInterface />;
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export function useSession(options = {}) {
|
|
153
|
+
const { sessionId, autoSubscribe = false } = options;
|
|
154
|
+
const client = useClient();
|
|
155
|
+
const mountedRef = useRef(true);
|
|
156
|
+
// Get or create session accessor
|
|
157
|
+
const accessor = useMemo(() => {
|
|
158
|
+
if (!sessionId)
|
|
159
|
+
return undefined;
|
|
160
|
+
return client.session(sessionId);
|
|
161
|
+
}, [client, sessionId]);
|
|
162
|
+
const [isSubscribed, setIsSubscribed] = useState(false);
|
|
163
|
+
// Cleanup on unmount
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
mountedRef.current = true;
|
|
166
|
+
return () => {
|
|
167
|
+
mountedRef.current = false;
|
|
168
|
+
};
|
|
169
|
+
}, []);
|
|
170
|
+
// Subscribe function
|
|
171
|
+
const subscribe = useCallback(() => {
|
|
172
|
+
if (!accessor)
|
|
173
|
+
return;
|
|
174
|
+
accessor.subscribe();
|
|
175
|
+
if (mountedRef.current) {
|
|
176
|
+
setIsSubscribed(true);
|
|
177
|
+
}
|
|
178
|
+
}, [accessor]);
|
|
179
|
+
// Unsubscribe function
|
|
180
|
+
const unsubscribe = useCallback(() => {
|
|
181
|
+
if (!accessor)
|
|
182
|
+
return;
|
|
183
|
+
accessor.unsubscribe();
|
|
184
|
+
if (mountedRef.current) {
|
|
185
|
+
setIsSubscribed(false);
|
|
186
|
+
}
|
|
187
|
+
}, [accessor]);
|
|
188
|
+
// Auto-subscribe
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (autoSubscribe && accessor && !isSubscribed) {
|
|
191
|
+
subscribe();
|
|
192
|
+
}
|
|
193
|
+
}, [autoSubscribe, accessor, isSubscribed, subscribe]);
|
|
194
|
+
// Send function
|
|
195
|
+
const send = useCallback((input) => {
|
|
196
|
+
if (accessor) {
|
|
197
|
+
const normalizedInput = typeof input === "string"
|
|
198
|
+
? {
|
|
199
|
+
message: {
|
|
200
|
+
role: "user",
|
|
201
|
+
content: [{ type: "text", text: input }],
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
: input;
|
|
205
|
+
return accessor.send(normalizedInput);
|
|
206
|
+
}
|
|
207
|
+
return client.send(input);
|
|
208
|
+
}, [client, accessor]);
|
|
209
|
+
// Abort function
|
|
210
|
+
const abort = useCallback(async (reason) => {
|
|
211
|
+
if (accessor) {
|
|
212
|
+
await accessor.abort(reason);
|
|
213
|
+
}
|
|
214
|
+
else if (sessionId) {
|
|
215
|
+
await client.abort(sessionId, reason);
|
|
216
|
+
}
|
|
217
|
+
}, [client, accessor, sessionId]);
|
|
218
|
+
// Close function
|
|
219
|
+
const close = useCallback(async () => {
|
|
220
|
+
if (accessor) {
|
|
221
|
+
await accessor.close();
|
|
222
|
+
}
|
|
223
|
+
else if (sessionId) {
|
|
224
|
+
await client.closeSession(sessionId);
|
|
225
|
+
}
|
|
226
|
+
}, [client, accessor, sessionId]);
|
|
227
|
+
return {
|
|
228
|
+
sessionId,
|
|
229
|
+
isSubscribed,
|
|
230
|
+
subscribe,
|
|
231
|
+
unsubscribe,
|
|
232
|
+
send,
|
|
233
|
+
abort,
|
|
234
|
+
close,
|
|
235
|
+
accessor,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
// ============================================================================
|
|
239
|
+
// useEvents
|
|
240
|
+
// ============================================================================
|
|
241
|
+
/**
|
|
242
|
+
* Subscribe to stream events.
|
|
243
|
+
*
|
|
244
|
+
* Returns the latest event (not accumulated). Use useStreamingText
|
|
245
|
+
* for accumulated text from content_delta events.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```tsx
|
|
249
|
+
* import { useEvents } from '@agentick/react';
|
|
250
|
+
*
|
|
251
|
+
* function EventLog() {
|
|
252
|
+
* const { event } = useEvents();
|
|
253
|
+
*
|
|
254
|
+
* useEffect(() => {
|
|
255
|
+
* if (event) {
|
|
256
|
+
* console.log('Event:', event.type, event);
|
|
257
|
+
* }
|
|
258
|
+
* }, [event]);
|
|
259
|
+
*
|
|
260
|
+
* return <div>Latest: {event?.type}</div>;
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* @example With filter
|
|
265
|
+
* ```tsx
|
|
266
|
+
* function ToolCalls() {
|
|
267
|
+
* const { event } = useEvents({ filter: ['tool_call', 'tool_result'] });
|
|
268
|
+
*
|
|
269
|
+
* if (!event) return null;
|
|
270
|
+
*
|
|
271
|
+
* return <div>Tool: {event.type === 'tool_call' ? event.name : 'result'}</div>;
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* @example Session-specific events
|
|
276
|
+
* ```tsx
|
|
277
|
+
* function SessionEvents({ sessionId }: { sessionId: string }) {
|
|
278
|
+
* const { event } = useEvents({ sessionId });
|
|
279
|
+
* // Only receives events for this session
|
|
280
|
+
* return <div>{event?.type}</div>;
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
export function useEvents(options = {}) {
|
|
285
|
+
const { filter, sessionId, enabled = true } = options;
|
|
286
|
+
const client = useClient();
|
|
287
|
+
const [event, setEvent] = useState();
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
if (!enabled)
|
|
290
|
+
return;
|
|
291
|
+
// Use session-specific subscription if sessionId provided
|
|
292
|
+
if (sessionId) {
|
|
293
|
+
const accessor = client.session(sessionId);
|
|
294
|
+
const unsubscribe = accessor.onEvent((incoming) => {
|
|
295
|
+
if (filter && !filter.includes(incoming.type)) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
setEvent(incoming);
|
|
299
|
+
});
|
|
300
|
+
return unsubscribe;
|
|
301
|
+
}
|
|
302
|
+
// Global subscription
|
|
303
|
+
const unsubscribe = client.onEvent((incoming) => {
|
|
304
|
+
if (filter && !filter.includes(incoming.type)) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
setEvent(incoming);
|
|
308
|
+
});
|
|
309
|
+
return unsubscribe;
|
|
310
|
+
}, [client, sessionId, enabled, filter]);
|
|
311
|
+
const clear = useCallback(() => {
|
|
312
|
+
setEvent(undefined);
|
|
313
|
+
}, []);
|
|
314
|
+
return { event, clear };
|
|
315
|
+
}
|
|
316
|
+
// ============================================================================
|
|
317
|
+
// useStreamingText
|
|
318
|
+
// ============================================================================
|
|
319
|
+
/**
|
|
320
|
+
* Subscribe to streaming text from the client.
|
|
321
|
+
*
|
|
322
|
+
* Uses the client's built-in streaming text accumulation which handles
|
|
323
|
+
* tick_start, content_delta, tick_end, and execution_end events.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```tsx
|
|
327
|
+
* import { useStreamingText } from '@agentick/react';
|
|
328
|
+
*
|
|
329
|
+
* function StreamingResponse() {
|
|
330
|
+
* const { text, isStreaming } = useStreamingText();
|
|
331
|
+
*
|
|
332
|
+
* return (
|
|
333
|
+
* <div>
|
|
334
|
+
* <p>{text}</p>
|
|
335
|
+
* {isStreaming && <span className="cursor">|</span>}
|
|
336
|
+
* </div>
|
|
337
|
+
* );
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
export function useStreamingText(options = {}) {
|
|
342
|
+
const { enabled = true } = options;
|
|
343
|
+
const client = useClient();
|
|
344
|
+
// Use useSyncExternalStore for concurrent-safe subscription
|
|
345
|
+
const state = useSyncExternalStore(useCallback((onStoreChange) => {
|
|
346
|
+
if (!enabled)
|
|
347
|
+
return () => { };
|
|
348
|
+
return client.onStreamingText(onStoreChange);
|
|
349
|
+
}, [client, enabled]), () => (enabled ? client.streamingText : { text: "", isStreaming: false }), () => ({ text: "", isStreaming: false }));
|
|
350
|
+
const clear = useCallback(() => {
|
|
351
|
+
client.clearStreamingText();
|
|
352
|
+
}, [client]);
|
|
353
|
+
return { text: state.text, isStreaming: state.isStreaming, clear };
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Subscribe to context utilization info from the server.
|
|
357
|
+
*
|
|
358
|
+
* Receives context_update events after each tick with:
|
|
359
|
+
* - Token usage (input, output, total)
|
|
360
|
+
* - Context utilization percentage
|
|
361
|
+
* - Model capabilities (vision, tools, reasoning)
|
|
362
|
+
* - Cumulative usage across ticks
|
|
363
|
+
*
|
|
364
|
+
* @example Basic usage
|
|
365
|
+
* ```tsx
|
|
366
|
+
* import { useContextInfo } from '@agentick/react';
|
|
367
|
+
*
|
|
368
|
+
* function ContextBar() {
|
|
369
|
+
* const { contextInfo } = useContextInfo();
|
|
370
|
+
*
|
|
371
|
+
* if (!contextInfo) return null;
|
|
372
|
+
*
|
|
373
|
+
* return (
|
|
374
|
+
* <div className="context-bar">
|
|
375
|
+
* <span>{contextInfo.modelId}</span>
|
|
376
|
+
* <span>{contextInfo.utilization?.toFixed(1)}% used</span>
|
|
377
|
+
* <progress value={contextInfo.utilization} max={100} />
|
|
378
|
+
* </div>
|
|
379
|
+
* );
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @example Session-specific context info
|
|
384
|
+
* ```tsx
|
|
385
|
+
* function SessionContext({ sessionId }: { sessionId: string }) {
|
|
386
|
+
* const { contextInfo } = useContextInfo({ sessionId });
|
|
387
|
+
*
|
|
388
|
+
* if (!contextInfo) return <span>No context yet</span>;
|
|
389
|
+
*
|
|
390
|
+
* return (
|
|
391
|
+
* <span>
|
|
392
|
+
* {contextInfo.inputTokens.toLocaleString()} /
|
|
393
|
+
* {contextInfo.contextWindow?.toLocaleString() ?? '?'} tokens
|
|
394
|
+
* </span>
|
|
395
|
+
* );
|
|
396
|
+
* }
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
export function useContextInfo(options = {}) {
|
|
400
|
+
const { sessionId, enabled = true } = options;
|
|
401
|
+
const client = useClient();
|
|
402
|
+
const [contextInfo, setContextInfo] = useState(null);
|
|
403
|
+
useEffect(() => {
|
|
404
|
+
if (!enabled)
|
|
405
|
+
return;
|
|
406
|
+
// Subscribe to context_update events
|
|
407
|
+
const handleEvent = (event) => {
|
|
408
|
+
if (event.type !== "context_update")
|
|
409
|
+
return;
|
|
410
|
+
// Type assertion since we filtered by type
|
|
411
|
+
const ctxEvent = event;
|
|
412
|
+
setContextInfo({
|
|
413
|
+
modelId: ctxEvent.modelId,
|
|
414
|
+
modelName: ctxEvent.modelName,
|
|
415
|
+
provider: ctxEvent.provider,
|
|
416
|
+
contextWindow: ctxEvent.contextWindow,
|
|
417
|
+
inputTokens: ctxEvent.inputTokens,
|
|
418
|
+
outputTokens: ctxEvent.outputTokens,
|
|
419
|
+
totalTokens: ctxEvent.totalTokens,
|
|
420
|
+
utilization: ctxEvent.utilization,
|
|
421
|
+
maxOutputTokens: ctxEvent.maxOutputTokens,
|
|
422
|
+
supportsVision: ctxEvent.supportsVision,
|
|
423
|
+
supportsToolUse: ctxEvent.supportsToolUse,
|
|
424
|
+
isReasoningModel: ctxEvent.isReasoningModel,
|
|
425
|
+
tick: ctxEvent.tick,
|
|
426
|
+
cumulativeUsage: ctxEvent.cumulativeUsage,
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
// Use session-specific subscription if sessionId provided
|
|
430
|
+
if (sessionId) {
|
|
431
|
+
const accessor = client.session(sessionId);
|
|
432
|
+
return accessor.onEvent(handleEvent);
|
|
433
|
+
}
|
|
434
|
+
// Global subscription
|
|
435
|
+
return client.onEvent(handleEvent);
|
|
436
|
+
}, [client, sessionId, enabled]);
|
|
437
|
+
const clear = useCallback(() => {
|
|
438
|
+
setContextInfo(null);
|
|
439
|
+
}, []);
|
|
440
|
+
return { contextInfo, clear };
|
|
441
|
+
}
|
|
442
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,oBAAoB,EACpB,OAAO,EACP,UAAU,GACX,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAY5C,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC;AAED,+EAA+E;AAC/E,+CAA+C;AAC/C,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAkB,MAAM,CAAC,KAAK,CAAC,CAAC;IAElE,SAAS,CAAC,GAAG,EAAE;QACb,qBAAqB;QACrB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEvB,uBAAuB;QACvB,MAAM,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxD,OAAO,WAAW,CAAC;IACrB,CAAC,EAAE,CAAC,MAAM,CAA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C,CAAC;IAEjC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,cAAc,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentick/react - React hooks and components for Agentick
|
|
3
|
+
*
|
|
4
|
+
* Provides React bindings for connecting to Agentick servers.
|
|
5
|
+
* Wraps @agentick/client with idiomatic React patterns.
|
|
6
|
+
*
|
|
7
|
+
* @example Quick start
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { AgentickProvider, useSession, useStreamingText } from '@agentick/react';
|
|
10
|
+
*
|
|
11
|
+
* function App() {
|
|
12
|
+
* return (
|
|
13
|
+
* <AgentickProvider clientConfig={{ baseUrl: 'https://api.example.com' }}>
|
|
14
|
+
* <Chat />
|
|
15
|
+
* </AgentickProvider>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* function Chat() {
|
|
20
|
+
* const { send } = useSession({ sessionId: 'my-session' });
|
|
21
|
+
* const { text, isStreaming } = useStreamingText();
|
|
22
|
+
* const [input, setInput] = useState('');
|
|
23
|
+
*
|
|
24
|
+
* const handleSend = async () => {
|
|
25
|
+
* await send(input);
|
|
26
|
+
* setInput('');
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <div>
|
|
31
|
+
* <div className="response">
|
|
32
|
+
* {text}
|
|
33
|
+
* {isStreaming && <span className="cursor">|</span>}
|
|
34
|
+
* </div>
|
|
35
|
+
* <input value={input} onChange={(e) => setInput(e.target.value)} />
|
|
36
|
+
* <button onClick={handleSend}>Send</button>
|
|
37
|
+
* </div>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example With authentication
|
|
43
|
+
* ```tsx
|
|
44
|
+
* function App() {
|
|
45
|
+
* const { token } = useAuth();
|
|
46
|
+
*
|
|
47
|
+
* return (
|
|
48
|
+
* <AgentickProvider
|
|
49
|
+
* clientConfig={{
|
|
50
|
+
* baseUrl: 'https://api.example.com',
|
|
51
|
+
* token,
|
|
52
|
+
* }}
|
|
53
|
+
* >
|
|
54
|
+
* <Chat />
|
|
55
|
+
* </AgentickProvider>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* ## Hooks
|
|
61
|
+
*
|
|
62
|
+
* | Hook | Purpose |
|
|
63
|
+
* |------|---------|
|
|
64
|
+
* | `useClient()` | Direct client access |
|
|
65
|
+
* | `useConnection()` | SSE connection state |
|
|
66
|
+
* | `useSession(opts?)` | Session accessor (send, abort, close) |
|
|
67
|
+
* | `useConnectionState()` | Connection state subscription |
|
|
68
|
+
* | `useEvents(opts?)` | Stream event subscription |
|
|
69
|
+
* | `useStreamingText(opts?)` | Accumulated text from deltas |
|
|
70
|
+
* | `useEvents(opts?)` | Stream event subscription |
|
|
71
|
+
*
|
|
72
|
+
* @module @agentick/react
|
|
73
|
+
*/
|
|
74
|
+
export { AgentickProvider } from "./context";
|
|
75
|
+
export { useClient, useConnection, useSession, useConnectionState, useEvents, useStreamingText, useContextInfo, type ContextInfo, type UseContextInfoOptions, type UseContextInfoResult, } from "./hooks";
|
|
76
|
+
export type { AgentickProviderProps, AgentickContextValue, TransportConfig, UseConnectionOptions, UseConnectionResult, UseSessionOptions, UseSessionResult, UseEventsOptions, UseEventsResult, UseStreamingTextOptions, UseStreamingTextResult, } from "./types.js";
|
|
77
|
+
export type { AgentickClient, ConnectionState, StreamEvent, SessionAccessor, SendInput, ClientExecutionHandle, SessionStreamEvent, ClientTransport, } from "@agentick/client";
|
|
78
|
+
export { createClient } from "@agentick/client";
|
|
79
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,SAAS,CAAC;AAGjB,YAAY,EAEV,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EAGf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentick/react - React hooks and components for Agentick
|
|
3
|
+
*
|
|
4
|
+
* Provides React bindings for connecting to Agentick servers.
|
|
5
|
+
* Wraps @agentick/client with idiomatic React patterns.
|
|
6
|
+
*
|
|
7
|
+
* @example Quick start
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { AgentickProvider, useSession, useStreamingText } from '@agentick/react';
|
|
10
|
+
*
|
|
11
|
+
* function App() {
|
|
12
|
+
* return (
|
|
13
|
+
* <AgentickProvider clientConfig={{ baseUrl: 'https://api.example.com' }}>
|
|
14
|
+
* <Chat />
|
|
15
|
+
* </AgentickProvider>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* function Chat() {
|
|
20
|
+
* const { send } = useSession({ sessionId: 'my-session' });
|
|
21
|
+
* const { text, isStreaming } = useStreamingText();
|
|
22
|
+
* const [input, setInput] = useState('');
|
|
23
|
+
*
|
|
24
|
+
* const handleSend = async () => {
|
|
25
|
+
* await send(input);
|
|
26
|
+
* setInput('');
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <div>
|
|
31
|
+
* <div className="response">
|
|
32
|
+
* {text}
|
|
33
|
+
* {isStreaming && <span className="cursor">|</span>}
|
|
34
|
+
* </div>
|
|
35
|
+
* <input value={input} onChange={(e) => setInput(e.target.value)} />
|
|
36
|
+
* <button onClick={handleSend}>Send</button>
|
|
37
|
+
* </div>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example With authentication
|
|
43
|
+
* ```tsx
|
|
44
|
+
* function App() {
|
|
45
|
+
* const { token } = useAuth();
|
|
46
|
+
*
|
|
47
|
+
* return (
|
|
48
|
+
* <AgentickProvider
|
|
49
|
+
* clientConfig={{
|
|
50
|
+
* baseUrl: 'https://api.example.com',
|
|
51
|
+
* token,
|
|
52
|
+
* }}
|
|
53
|
+
* >
|
|
54
|
+
* <Chat />
|
|
55
|
+
* </AgentickProvider>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* ## Hooks
|
|
61
|
+
*
|
|
62
|
+
* | Hook | Purpose |
|
|
63
|
+
* |------|---------|
|
|
64
|
+
* | `useClient()` | Direct client access |
|
|
65
|
+
* | `useConnection()` | SSE connection state |
|
|
66
|
+
* | `useSession(opts?)` | Session accessor (send, abort, close) |
|
|
67
|
+
* | `useConnectionState()` | Connection state subscription |
|
|
68
|
+
* | `useEvents(opts?)` | Stream event subscription |
|
|
69
|
+
* | `useStreamingText(opts?)` | Accumulated text from deltas |
|
|
70
|
+
* | `useEvents(opts?)` | Stream event subscription |
|
|
71
|
+
*
|
|
72
|
+
* @module @agentick/react
|
|
73
|
+
*/
|
|
74
|
+
// Provider
|
|
75
|
+
export { AgentickProvider } from "./context";
|
|
76
|
+
// Hooks
|
|
77
|
+
export { useClient, useConnection, useSession, useConnectionState, useEvents, useStreamingText, useContextInfo, } from "./hooks";
|
|
78
|
+
// Re-export createClient for users who want to create a client manually
|
|
79
|
+
export { createClient } from "@agentick/client";
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,QAAQ;AACR,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,cAAc,GAIf,MAAM,SAAS,CAAC;AAgCjB,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|