@agentuity/react 1.0.48 → 2.0.0-beta.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/AGENTS.md +26 -45
- package/README.md +28 -182
- package/dist/client-entrypoint.d.ts +8 -12
- package/dist/client-entrypoint.d.ts.map +1 -1
- package/dist/client-entrypoint.js +8 -15
- package/dist/client-entrypoint.js.map +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -12
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +6 -14
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -10
- package/dist/server.js.map +1 -1
- package/dist/webrtc.d.ts.map +1 -1
- package/dist/webrtc.js +2 -2
- package/dist/webrtc.js.map +1 -1
- package/package.json +5 -5
- package/src/client-entrypoint.tsx +8 -22
- package/src/context.tsx +3 -14
- package/src/index.ts +1 -52
- package/src/server.ts +5 -43
- package/src/webrtc.tsx +2 -1
- package/dist/api.d.ts +0 -302
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -487
- package/dist/api.js.map +0 -1
- package/dist/client.d.ts +0 -75
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -102
- package/dist/client.js.map +0 -1
- package/dist/eventstream.d.ts +0 -79
- package/dist/eventstream.d.ts.map +0 -1
- package/dist/eventstream.js +0 -122
- package/dist/eventstream.js.map +0 -1
- package/dist/types.d.ts +0 -18
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -18
- package/dist/types.js.map +0 -1
- package/dist/websocket.d.ts +0 -88
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -151
- package/dist/websocket.js.map +0 -1
- package/src/api.ts +0 -954
- package/src/client.ts +0 -136
- package/src/eventstream.ts +0 -188
- package/src/types.ts +0 -23
- package/src/websocket.ts +0 -241
package/AGENTS.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Package Overview
|
|
4
4
|
|
|
5
|
-
React hooks for building Agentuity web applications. Provides
|
|
5
|
+
React hooks for building Agentuity web applications. Provides context, auth, WebRTC, and analytics hooks.
|
|
6
|
+
|
|
7
|
+
For type-safe API calls, use Hono's `hc()` client directly from `hono/client`.
|
|
6
8
|
|
|
7
9
|
## Commands
|
|
8
10
|
|
|
@@ -20,66 +22,44 @@ React hooks for building Agentuity web applications. Provides type-safe hooks fo
|
|
|
20
22
|
|
|
21
23
|
```text
|
|
22
24
|
src/
|
|
23
|
-
├── index.ts
|
|
24
|
-
├── server.ts
|
|
25
|
-
├──
|
|
26
|
-
├──
|
|
27
|
-
├──
|
|
28
|
-
├──
|
|
29
|
-
|
|
30
|
-
├── analytics.tsx # useAnalytics, useTrackOnMount, withPageTracking
|
|
31
|
-
└── memo.ts # useJsonMemo
|
|
25
|
+
├── index.ts # Main exports (client-side)
|
|
26
|
+
├── server.ts # Server-side entry point (SSR, server components)
|
|
27
|
+
├── client-entrypoint.tsx # Client entry point with 'use client' directive
|
|
28
|
+
├── context.tsx # AgentuityProvider, useAgentuity, useAuth
|
|
29
|
+
├── webrtc.tsx # useWebRTCCall hook
|
|
30
|
+
├── analytics.tsx # useAnalytics, useTrackOnMount, withPageTracking
|
|
31
|
+
└── memo.ts # useJsonMemo
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**Entry points:**
|
|
35
35
|
|
|
36
36
|
- `@agentuity/react` - Client-side hooks (browser only)
|
|
37
37
|
- `@agentuity/react/server` - Server-safe exports (SSR, server components)
|
|
38
|
+
- `@agentuity/react/client` - Client entry with 'use client' directive
|
|
38
39
|
|
|
39
40
|
## Code Conventions
|
|
40
41
|
|
|
41
42
|
- **Provider required** - All hooks must be used within `AgentuityProvider`
|
|
42
|
-
- **Type inference** - Types inferred from generated registries (RouteRegistry, etc.)
|
|
43
43
|
- **SSR safe** - All hooks include SSR guards
|
|
44
44
|
|
|
45
45
|
## Hooks API
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### useAuth
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
|
-
|
|
51
|
-
const { data, isLoading, error, refetch } = useAPI('GET /users');
|
|
52
|
-
|
|
53
|
-
// POST/PUT/PATCH/DELETE manual via invoke()
|
|
54
|
-
const { data, invoke } = useAPI('POST /users');
|
|
55
|
-
await invoke({ name: 'Alice' });
|
|
50
|
+
const { isAuthenticated, authHeader, setAuthHeader, authLoading } = useAuth();
|
|
56
51
|
```
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### useWebsocket
|
|
53
|
+
### useAgentuity
|
|
61
54
|
|
|
62
55
|
```typescript
|
|
63
|
-
const {
|
|
64
|
-
send({ message: 'Hello' });
|
|
56
|
+
const { baseUrl } = useAgentuity();
|
|
65
57
|
```
|
|
66
58
|
|
|
67
|
-
|
|
68
|
-
- Auto-reconnection on connection loss
|
|
69
|
-
|
|
70
|
-
### useEventStream (SSE)
|
|
59
|
+
### useWebRTCCall
|
|
71
60
|
|
|
72
61
|
```typescript
|
|
73
|
-
const {
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
- Auto-reconnection on connection loss
|
|
77
|
-
- `data` = latest event (with JSON memoization)
|
|
78
|
-
|
|
79
|
-
### useAuth
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
const { isAuthenticated, authHeader, setAuthHeader, authLoading } = useAuth();
|
|
62
|
+
const { state, connect, disconnect } = useWebRTCCall(options);
|
|
83
63
|
```
|
|
84
64
|
|
|
85
65
|
### useAnalytics
|
|
@@ -91,21 +71,22 @@ track('event_name', { prop: 'value' });
|
|
|
91
71
|
|
|
92
72
|
### Other Hooks
|
|
93
73
|
|
|
94
|
-
- `useAgentuity()` - Access baseUrl
|
|
95
74
|
- `useTrackOnMount(options)` - Track event on mount
|
|
96
75
|
- `useJsonMemo(value)` - Deep equality memoization
|
|
97
76
|
- `withPageTracking(Component, pageName)` - HOC for page tracking
|
|
98
77
|
|
|
99
|
-
##
|
|
78
|
+
## Type-Safe API Calls
|
|
100
79
|
|
|
101
|
-
|
|
102
|
-
const api = createAPIClient();
|
|
103
|
-
await api.hello.post({ name: 'World' });
|
|
104
|
-
```
|
|
80
|
+
Use Hono's `hc()` client for type-safe API calls:
|
|
105
81
|
|
|
106
|
-
|
|
82
|
+
```typescript
|
|
83
|
+
import { hc } from 'hono/client';
|
|
84
|
+
import type { AppType } from './src/api/router';
|
|
107
85
|
|
|
108
|
-
|
|
86
|
+
const client = hc<AppType>('/');
|
|
87
|
+
const res = await client.api.hello.$post({ json: { name: 'World' } });
|
|
88
|
+
const data = await res.json();
|
|
89
|
+
```
|
|
109
90
|
|
|
110
91
|
## Publishing
|
|
111
92
|
|
package/README.md
CHANGED
|
@@ -8,206 +8,52 @@ React hooks and components for building Agentuity web applications.
|
|
|
8
8
|
bun add @agentuity/react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
`@agentuity/react` provides React hooks and context providers for seamlessly integrating with Agentuity agents from your frontend application.
|
|
14
|
-
|
|
15
|
-
## Features
|
|
16
|
-
|
|
17
|
-
- **Type-safe agent calls** - Fully typed React hooks for calling agents
|
|
18
|
-
- **WebSocket support** - Real-time bidirectional communication with agents
|
|
19
|
-
- **Context provider** - Simple setup with React Context
|
|
20
|
-
- **Automatic data management** - Built-in state management for agent responses
|
|
21
|
-
|
|
22
11
|
## Quick Start
|
|
23
12
|
|
|
24
|
-
### 1. Setup Provider
|
|
25
|
-
|
|
26
|
-
Wrap your app with the `AgentuityProvider`:
|
|
27
|
-
|
|
28
13
|
```tsx
|
|
29
|
-
import { AgentuityProvider } from '@agentuity/react';
|
|
14
|
+
import { AgentuityProvider, useAuth } from '@agentuity/react';
|
|
30
15
|
|
|
31
16
|
function App() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
return (
|
|
18
|
+
<AgentuityProvider>
|
|
19
|
+
<MyComponent />
|
|
20
|
+
</AgentuityProvider>
|
|
21
|
+
);
|
|
37
22
|
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 2. Use Agents
|
|
41
|
-
|
|
42
|
-
Call agents with type-safety using the `useAgent` hook:
|
|
43
|
-
|
|
44
|
-
```tsx
|
|
45
|
-
import { useAgent } from '@agentuity/react';
|
|
46
23
|
|
|
47
24
|
function MyComponent() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const handleClick = async () => {
|
|
51
|
-
const result = await run({ message: 'Hello' });
|
|
52
|
-
console.log(result);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<div>
|
|
57
|
-
<button onClick={handleClick}>Call Agent</button>
|
|
58
|
-
{data && <div>Response: {JSON.stringify(data)}</div>}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 3. WebSocket Communication
|
|
65
|
-
|
|
66
|
-
For real-time communication:
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
import { useWebsocket } from '@agentuity/react';
|
|
70
|
-
|
|
71
|
-
function ChatComponent() {
|
|
72
|
-
const { connected, send, setHandler } = useWebsocket('/chat');
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
setHandler((message) => {
|
|
76
|
-
console.log('Received:', message);
|
|
77
|
-
});
|
|
78
|
-
}, []);
|
|
79
|
-
|
|
80
|
-
const sendMessage = () => {
|
|
81
|
-
send({ text: 'Hello, agent!' });
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div>
|
|
86
|
-
<div>Status: {connected ? 'Connected' : 'Disconnected'}</div>
|
|
87
|
-
<button onClick={sendMessage} disabled={!connected}>
|
|
88
|
-
Send Message
|
|
89
|
-
</button>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
25
|
+
const { isAuthenticated } = useAuth();
|
|
26
|
+
return <div>{isAuthenticated ? 'Logged in' : 'Not logged in'}</div>;
|
|
92
27
|
}
|
|
93
28
|
```
|
|
94
29
|
|
|
95
|
-
|
|
30
|
+
## Type-Safe API Calls
|
|
96
31
|
|
|
97
|
-
|
|
32
|
+
Use Hono's `hc()` client for type-safe API calls:
|
|
98
33
|
|
|
99
34
|
```tsx
|
|
100
|
-
import {
|
|
101
|
-
|
|
102
|
-
function VideoChat() {
|
|
103
|
-
const {
|
|
104
|
-
state,
|
|
105
|
-
localVideoRef,
|
|
106
|
-
remoteStreams,
|
|
107
|
-
remotePeerIds,
|
|
108
|
-
connect,
|
|
109
|
-
hangup,
|
|
110
|
-
muteAudio,
|
|
111
|
-
muteVideo,
|
|
112
|
-
sendJSON,
|
|
113
|
-
isAudioMuted,
|
|
114
|
-
isVideoMuted,
|
|
115
|
-
} = useWebRTCCall({
|
|
116
|
-
roomId: 'my-room',
|
|
117
|
-
signalUrl: '/api/webrtc/signal',
|
|
118
|
-
media: { video: true, audio: true },
|
|
119
|
-
dataChannels: [{ label: 'chat' }],
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<div>
|
|
124
|
-
<div>Status: {state}</div>
|
|
125
|
-
<video ref={localVideoRef} autoPlay muted playsInline />
|
|
126
|
-
{remotePeerIds.map((peerId) => (
|
|
127
|
-
<video
|
|
128
|
-
key={peerId}
|
|
129
|
-
ref={(el) => el && (el.srcObject = remoteStreams.get(peerId) || null)}
|
|
130
|
-
autoPlay
|
|
131
|
-
playsInline
|
|
132
|
-
/>
|
|
133
|
-
))}
|
|
134
|
-
<button onClick={connect}>Join</button>
|
|
135
|
-
<button onClick={hangup}>Leave</button>
|
|
136
|
-
<button onClick={() => muteAudio(!isAudioMuted)}>
|
|
137
|
-
{isAudioMuted ? 'Unmute' : 'Mute'}
|
|
138
|
-
</button>
|
|
139
|
-
<button onClick={() => sendJSON('chat', { text: 'Hello!' })}>Send</button>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
For detailed architecture, see [docs/webrtc-architecture.md](../../docs/webrtc-architecture.md).
|
|
35
|
+
import { hc } from 'hono/client';
|
|
36
|
+
import type { AppType } from './src/api/router';
|
|
146
37
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Context provider for Agentuity configuration.
|
|
152
|
-
|
|
153
|
-
**Props:**
|
|
154
|
-
|
|
155
|
-
- `baseUrl?: string` - Base URL for agent API calls (defaults to current origin)
|
|
156
|
-
- `children: ReactNode` - Child components
|
|
157
|
-
|
|
158
|
-
### useAgent
|
|
159
|
-
|
|
160
|
-
Hook for calling agents via HTTP.
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
const { data, run } = useAgent<TName>(name);
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**Parameters:**
|
|
167
|
-
|
|
168
|
-
- `name: string` - Agent name
|
|
169
|
-
|
|
170
|
-
**Returns:**
|
|
171
|
-
|
|
172
|
-
- `data?: TOutput` - Last response data
|
|
173
|
-
- `run: (input: TInput, options?: RunArgs) => Promise<TOutput>` - Function to invoke the agent
|
|
174
|
-
|
|
175
|
-
**RunArgs:**
|
|
176
|
-
|
|
177
|
-
- `query?: URLSearchParams` - Query parameters
|
|
178
|
-
- `headers?: Record<string, string>` - Custom headers
|
|
179
|
-
- `subpath?: string` - Subpath to append to agent URL
|
|
180
|
-
- `method?: string` - HTTP method (default: POST)
|
|
181
|
-
- `signal?: AbortSignal` - Abort signal for cancellation
|
|
182
|
-
|
|
183
|
-
### useWebsocket
|
|
184
|
-
|
|
185
|
-
Hook for WebSocket connections to agents.
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
const { connected, send, setHandler, readyState, close } = useWebsocket<TInput, TOutput>(
|
|
189
|
-
path,
|
|
190
|
-
options
|
|
191
|
-
);
|
|
38
|
+
const client = hc<AppType>('/');
|
|
39
|
+
const res = await client.api.hello.$post({ json: { name: 'World' } });
|
|
40
|
+
const data = await res.json();
|
|
192
41
|
```
|
|
193
42
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
- `path: string` - WebSocket path
|
|
197
|
-
- `options?: WebsocketArgs` - Connection options
|
|
198
|
-
|
|
199
|
-
**Returns:**
|
|
200
|
-
|
|
201
|
-
- `connected: boolean` - Connection status
|
|
202
|
-
- `send: (data: TInput) => void` - Send data to server
|
|
203
|
-
- `setHandler: (handler: (data: TOutput) => void) => void` - Set message handler
|
|
204
|
-
- `readyState: number` - WebSocket ready state
|
|
205
|
-
- `close: () => void` - Close connection
|
|
43
|
+
## Available Hooks
|
|
206
44
|
|
|
207
|
-
|
|
45
|
+
- `useAgentuity()` - Access base URL and context
|
|
46
|
+
- `useAuth()` - Authentication state management
|
|
47
|
+
- `useWebRTCCall()` - WebRTC connections
|
|
48
|
+
- `useAnalytics()` - Event tracking
|
|
49
|
+
- `useTrackOnMount()` - Track event on component mount
|
|
50
|
+
- `useJsonMemo()` - Deep equality memoization
|
|
208
51
|
|
|
209
|
-
|
|
52
|
+
## Re-exported Utilities
|
|
210
53
|
|
|
211
|
-
|
|
54
|
+
From `@agentuity/frontend`:
|
|
212
55
|
|
|
213
|
-
|
|
56
|
+
- `WebSocketManager` - Framework-agnostic WebSocket manager
|
|
57
|
+
- `EventStreamManager` - Framework-agnostic SSE manager
|
|
58
|
+
- `WebRTCManager` - Framework-agnostic WebRTC manager
|
|
59
|
+
- `buildUrl`, `defaultBaseUrl`, `deserializeData`, `jsonEqual`
|
|
@@ -9,24 +9,20 @@
|
|
|
9
9
|
* ```tsx
|
|
10
10
|
* 'use client';
|
|
11
11
|
*
|
|
12
|
-
* import {
|
|
13
|
-
*
|
|
14
|
-
* export function MyComponent() {
|
|
15
|
-
* const { data } = useAPI({ route: 'GET /users' });
|
|
16
|
-
* return <div>{JSON.stringify(data)}</div>;
|
|
17
|
-
* }
|
|
12
|
+
* import { AgentuityProvider } from '@agentuity/react/client';
|
|
18
13
|
* ```
|
|
19
14
|
*
|
|
20
15
|
* @remarks
|
|
21
|
-
* For
|
|
22
|
-
*
|
|
16
|
+
* For type-safe API calls, use Hono's `hc()` client directly:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { hc } from 'hono/client';
|
|
19
|
+
* import type router from './src/api/router';
|
|
20
|
+
* const client = hc<typeof router>('http://localhost:3000');
|
|
21
|
+
* ```
|
|
23
22
|
*/
|
|
24
23
|
export * from './server';
|
|
25
24
|
export { AgentuityContext, AgentuityProvider, useAgentuity, useAuth, type ContextProviderArgs, type AgentuityContextValue, type AgentuityHookValue, type AuthContextValue, } from './context';
|
|
26
|
-
export { useAPI, type UseAPIOptions, type UseAPIResult } from './api';
|
|
27
|
-
export { useWebsocket, type WebsocketOptions } from './websocket';
|
|
28
|
-
export { useEventStream, type EventStreamOptions } from './eventstream';
|
|
29
25
|
export { useJsonMemo } from './memo';
|
|
30
26
|
export { useAnalytics, useTrackOnMount, withPageTracking, type UseAnalyticsResult, type TrackOnMountOptions, } from './analytics';
|
|
31
|
-
export { createReconnectManager, WebSocketManager, EventStreamManager, type ReconnectOptions, type ReconnectManager, type WebSocketMessageHandler, type WebSocketCallbacks, type WebSocketManagerOptions, type WebSocketManagerState, type EventStreamMessageHandler, type EventStreamCallbacks, type EventStreamManagerOptions, type EventStreamManagerState,
|
|
27
|
+
export { createReconnectManager, WebSocketManager, EventStreamManager, type ReconnectOptions, type ReconnectManager, type WebSocketMessageHandler, type WebSocketCallbacks, type WebSocketManagerOptions, type WebSocketManagerState, type EventStreamMessageHandler, type EventStreamCallbacks, type EventStreamManagerOptions, type EventStreamManagerState, } from '@agentuity/frontend';
|
|
32
28
|
//# sourceMappingURL=client-entrypoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-entrypoint.d.ts","sourceRoot":"","sources":["../src/client-entrypoint.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"client-entrypoint.d.ts","sourceRoot":"","sources":["../src/client-entrypoint.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,cAAc,UAAU,CAAC;AAGzB,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACrB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,EACN,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC5B,MAAM,qBAAqB,CAAC"}
|
|
@@ -10,28 +10,21 @@
|
|
|
10
10
|
* ```tsx
|
|
11
11
|
* 'use client';
|
|
12
12
|
*
|
|
13
|
-
* import {
|
|
14
|
-
*
|
|
15
|
-
* export function MyComponent() {
|
|
16
|
-
* const { data } = useAPI({ route: 'GET /users' });
|
|
17
|
-
* return <div>{JSON.stringify(data)}</div>;
|
|
18
|
-
* }
|
|
13
|
+
* import { AgentuityProvider } from '@agentuity/react/client';
|
|
19
14
|
* ```
|
|
20
15
|
*
|
|
21
16
|
* @remarks
|
|
22
|
-
* For
|
|
23
|
-
*
|
|
17
|
+
* For type-safe API calls, use Hono's `hc()` client directly:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { hc } from 'hono/client';
|
|
20
|
+
* import type router from './src/api/router';
|
|
21
|
+
* const client = hc<typeof router>('http://localhost:3000');
|
|
22
|
+
* ```
|
|
24
23
|
*/
|
|
25
|
-
// Re-export everything from server (
|
|
24
|
+
// Re-export everything from server (utilities)
|
|
26
25
|
export * from './server';
|
|
27
26
|
// Context and Provider
|
|
28
27
|
export { AgentuityContext, AgentuityProvider, useAgentuity, useAuth, } from './context';
|
|
29
|
-
// API hook
|
|
30
|
-
export { useAPI } from './api';
|
|
31
|
-
// WebSocket hook
|
|
32
|
-
export { useWebsocket } from './websocket';
|
|
33
|
-
// EventStream hook
|
|
34
|
-
export { useEventStream } from './eventstream';
|
|
35
28
|
// JSON memo hook
|
|
36
29
|
export { useJsonMemo } from './memo';
|
|
37
30
|
// Analytics hooks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-entrypoint.js","sourceRoot":"","sources":["../src/client-entrypoint.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb
|
|
1
|
+
{"version":3,"file":"client-entrypoint.js","sourceRoot":"","sources":["../src/client-entrypoint.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,+CAA+C;AAC/C,cAAc,UAAU,CAAC;AAEzB,uBAAuB;AACvB,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,GAKP,MAAM,WAAW,CAAC;AAEnB,iBAAiB;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,kBAAkB;AAClB,OAAO,EACN,YAAY,EACZ,eAAe,EACf,gBAAgB,GAGhB,MAAM,aAAa,CAAC;AAErB,8DAA8D;AAC9D,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GAWlB,MAAM,qBAAqB,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface AuthContextValue {
|
|
|
35
35
|
* Low-level hook for Agentuity's transport auth.
|
|
36
36
|
*
|
|
37
37
|
* This hook exposes the Authorization header and loading state used by
|
|
38
|
-
* Agentuity's API clients
|
|
38
|
+
* Agentuity's API clients.
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```tsx
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,EAA6B,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,qBAAqB,GAAG,IAAI,CACjB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,GAAI,oDAI/B,mBAAmB,KAAG,KAAK,CAAC,GAAG,CAAC,OAoClC,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,kBAAkB,CASjD;AAED,MAAM,WAAW,gBAAgB;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,IAAI,gBAAgB,CAgB1C"}
|
package/dist/context.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState,
|
|
2
|
+
import { useState, useLayoutEffect, useMemo, useCallback } from 'react';
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
4
|
import { defaultBaseUrl } from '@agentuity/frontend';
|
|
5
|
-
import { setGlobalBaseUrl, setGlobalAuthHeader } from './client';
|
|
6
5
|
export const AgentuityContext = createContext(null);
|
|
7
6
|
export const AgentuityProvider = ({ baseUrl, authHeader: authHeaderProp, children, }) => {
|
|
8
7
|
const [authHeader, setAuthHeaderState] = useState(authHeaderProp ?? null);
|
|
@@ -15,17 +14,9 @@ export const AgentuityProvider = ({ baseUrl, authHeader: authHeaderProp, childre
|
|
|
15
14
|
const setAuthLoading = useCallback((loading) => {
|
|
16
15
|
setAuthLoadingState(loading);
|
|
17
16
|
}, []);
|
|
18
|
-
// Set global baseUrl for RPC clients
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
setGlobalBaseUrl(resolvedBaseUrl);
|
|
21
|
-
}, [resolvedBaseUrl]);
|
|
22
|
-
// Sync authHeader to global state for RPC clients
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
setGlobalAuthHeader(authHeader);
|
|
25
|
-
}, [authHeader]);
|
|
26
17
|
// Sync authHeader prop changes to state synchronously
|
|
27
18
|
// useLayoutEffect ensures the state is updated before child effects run,
|
|
28
|
-
// preventing race conditions where
|
|
19
|
+
// preventing race conditions where API hooks make requests before auth is set (issue #732)
|
|
29
20
|
useLayoutEffect(() => {
|
|
30
21
|
if (authHeaderProp !== undefined) {
|
|
31
22
|
setAuthHeaderState(authHeaderProp);
|
|
@@ -60,7 +51,7 @@ export function useAgentuity() {
|
|
|
60
51
|
* Low-level hook for Agentuity's transport auth.
|
|
61
52
|
*
|
|
62
53
|
* This hook exposes the Authorization header and loading state used by
|
|
63
|
-
* Agentuity's API clients
|
|
54
|
+
* Agentuity's API clients.
|
|
64
55
|
*
|
|
65
56
|
* @example
|
|
66
57
|
* ```tsx
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAgB,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBrD,MAAM,CAAC,MAAM,gBAAgB,GAC5B,aAAa,CAA+B,IAAI,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EACjC,OAAO,EACP,UAAU,EAAE,cAAc,EAC1B,QAAQ,GACa,EAAqB,EAAE;IAC5C,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAgB,cAAc,IAAI,IAAI,CAAC,CAAC;IACzF,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,OAAO,IAAI,cAAc,CAAC;IAElD,6DAA6D;IAC7D,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,KAAoB,EAAE,EAAE;QAC1D,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,OAAgB,EAAE,EAAE;QACvD,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,sDAAsD;IACtD,yEAAyE;IACzE,2FAA2F;IAC3F,eAAe,CAAC,GAAG,EAAE;QACpB,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YAClC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;IACF,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,0DAA0D;IAC1D,MAAM,YAAY,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC;QACN,OAAO,EAAE,eAAe;QACxB,UAAU;QACV,aAAa;QACb,WAAW;QACX,cAAc;KACd,CAAC,EACF,CAAC,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,CAAC,CACzE,CAAC;IAEF,OAAO,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,QAAQ,GAA6B,CAAC;AAC/F,CAAC,CAAC;AAMF;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;KACxB,CAAC;AACH,CAAC;AAUD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO;IACtB,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;IAED,kEAAkE;IAClE,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAErE,OAAO;QACN,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,eAAe;KACf,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export { AgentuityContext, AgentuityProvider, useAgentuity, useAuth, type ContextProviderArgs, type AgentuityContextValue, type AgentuityHookValue, type AuthContextValue, } from './context';
|
|
2
|
-
export { createClient, createAPIClient, setGlobalBaseUrl, getGlobalBaseUrl, setGlobalAuthHeader, getGlobalAuthHeader, } from './client';
|
|
3
|
-
export { useWebsocket, type WebSocketRouteKey, type WebSocketRouteInput, type WebSocketRouteOutput, type WebsocketOptions, } from './websocket';
|
|
4
|
-
export { useEventStream, type SSERouteKey, type SSERouteOutput, type EventStreamOptions, } from './eventstream';
|
|
5
2
|
export { useWebRTCCall, type UseWebRTCCallOptions, type UseWebRTCCallResult, type WebRTCConnectionState, type WebRTCClientCallbacks, } from './webrtc';
|
|
6
|
-
export { useAPI, type RouteKey, type ExtractMethod, type RouteIsStream, type RouteInput, type RouteOutput, type RoutePathParams, type UseAPIOptions, type UseAPIResult, type InvokeOptions, } from './api';
|
|
7
3
|
export { useJsonMemo } from './memo';
|
|
8
4
|
export { useAnalytics, useTrackOnMount, withPageTracking, type UseAnalyticsResult, type TrackOnMountOptions, } from './analytics.js';
|
|
9
|
-
export type
|
|
10
|
-
export { buildUrl, defaultBaseUrl, deserializeData, createReconnectManager, jsonEqual, getProcessEnv, WebSocketManager, EventStreamManager, type ReconnectOptions, type ReconnectManager, type WebSocketMessageHandler, type WebSocketCallbacks, type WebSocketManagerOptions, type WebSocketManagerState, type EventStreamMessageHandler, type EventStreamCallbacks, type EventStreamManagerOptions, type EventStreamManagerState, WebRTCManager, UserMediaSource, DisplayMediaSource, CustomStreamSource, type WebRTCManagerOptions, type WebRTCManagerState, type WebRTCDisconnectReason, type Client, type ClientOptions, type RouteEndpoint, type WebSocketClient, type EventStreamClient, type StreamClient, type EventHandler, } from '@agentuity/frontend';
|
|
5
|
+
export { buildUrl, defaultBaseUrl, deserializeData, createReconnectManager, jsonEqual, getProcessEnv, WebSocketManager, EventStreamManager, type ReconnectOptions, type ReconnectManager, type WebSocketMessageHandler, type WebSocketCallbacks, type WebSocketManagerOptions, type WebSocketManagerState, type EventStreamMessageHandler, type EventStreamCallbacks, type EventStreamManagerOptions, type EventStreamManagerState, WebRTCManager, UserMediaSource, DisplayMediaSource, CustomStreamSource, type WebRTCManagerOptions, type WebRTCManagerState, type WebRTCDisconnectReason, } from '@agentuity/frontend';
|
|
11
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,EACN,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACN,QAAQ,EACR,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC3B,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export { AgentuityContext, AgentuityProvider, useAgentuity, useAuth, } from './context';
|
|
2
|
-
export { createClient, createAPIClient, setGlobalBaseUrl, getGlobalBaseUrl, setGlobalAuthHeader, getGlobalAuthHeader, } from './client';
|
|
3
|
-
export { useWebsocket, } from './websocket';
|
|
4
|
-
export { useEventStream, } from './eventstream';
|
|
5
2
|
export { useWebRTCCall, } from './webrtc';
|
|
6
|
-
export { useAPI, } from './api';
|
|
7
3
|
export { useJsonMemo } from './memo';
|
|
8
4
|
// Analytics
|
|
9
5
|
export { useAnalytics, useTrackOnMount, withPageTracking, } from './analytics.js';
|
|
10
|
-
// Re-export web utilities
|
|
6
|
+
// Re-export web utilities from @agentuity/frontend
|
|
11
7
|
export { buildUrl, defaultBaseUrl, deserializeData, createReconnectManager, jsonEqual, getProcessEnv, WebSocketManager, EventStreamManager, WebRTCManager, UserMediaSource, DisplayMediaSource, CustomStreamSource, } from '@agentuity/frontend';
|
|
12
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,GAKP,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,OAAO,GAKP,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,aAAa,GAKb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,YAAY;AACZ,OAAO,EACN,YAAY,EACZ,eAAe,EACf,gBAAgB,GAGhB,MAAM,gBAAgB,CAAC;AAExB,mDAAmD;AACnD,OAAO,EACN,QAAQ,EACR,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAWlB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GAIlB,MAAM,qBAAqB,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -5,23 +5,15 @@
|
|
|
5
5
|
* (SSR, server components, API routes, loaders, etc.). It does NOT include React
|
|
6
6
|
* hooks, which require a browser environment.
|
|
7
7
|
*
|
|
8
|
+
* For type-safe API calls, use Hono's `hc()` client directly:
|
|
9
|
+
*
|
|
8
10
|
* @example
|
|
9
11
|
* ```typescript
|
|
10
|
-
*
|
|
11
|
-
* import
|
|
12
|
+
* import { hc } from 'hono/client';
|
|
13
|
+
* import type router from './src/api/router';
|
|
12
14
|
*
|
|
13
|
-
* const client =
|
|
14
|
-
* const data = await client.users.get();
|
|
15
|
+
* const client = hc<typeof router>('http://localhost:3000');
|
|
15
16
|
* ```
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* For client-side React components that need hooks like useAPI, useWebsocket, etc.,
|
|
19
|
-
* import from '@agentuity/react/client' instead.
|
|
20
17
|
*/
|
|
21
|
-
export {
|
|
22
|
-
export type { RouteRegistry, WebSocketRouteRegistry, SSERouteRegistry, RPCRouteRegistry, } from '@agentuity/frontend';
|
|
23
|
-
export { buildUrl, defaultBaseUrl, deserializeData, jsonEqual, getProcessEnv, type Client, type ClientOptions, type RouteEndpoint, } from '@agentuity/frontend';
|
|
24
|
-
export type { RouteKey, ExtractMethod, RouteIsStream, RouteInput, RouteOutput, RoutePathParams, } from './api';
|
|
25
|
-
export type { WebSocketRouteKey, WebSocketRouteInput, WebSocketRouteOutput } from './websocket';
|
|
26
|
-
export type { SSERouteKey, SSERouteOutput } from './eventstream';
|
|
18
|
+
export { buildUrl, defaultBaseUrl, deserializeData, jsonEqual, getProcessEnv, } from '@agentuity/frontend';
|
|
27
19
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,eAAe,EACf,SAAS,EACT,aAAa,GACb,MAAM,qBAAqB,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -5,21 +5,16 @@
|
|
|
5
5
|
* (SSR, server components, API routes, loaders, etc.). It does NOT include React
|
|
6
6
|
* hooks, which require a browser environment.
|
|
7
7
|
*
|
|
8
|
+
* For type-safe API calls, use Hono's `hc()` client directly:
|
|
9
|
+
*
|
|
8
10
|
* @example
|
|
9
11
|
* ```typescript
|
|
10
|
-
*
|
|
11
|
-
* import
|
|
12
|
+
* import { hc } from 'hono/client';
|
|
13
|
+
* import type router from './src/api/router';
|
|
12
14
|
*
|
|
13
|
-
* const client =
|
|
14
|
-
* const data = await client.users.get();
|
|
15
|
+
* const client = hc<typeof router>('http://localhost:3000');
|
|
15
16
|
* ```
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* For client-side React components that need hooks like useAPI, useWebsocket, etc.,
|
|
19
|
-
* import from '@agentuity/react/client' instead.
|
|
20
17
|
*/
|
|
21
|
-
// Client creation utilities
|
|
22
|
-
export { createClient, createAPIClient, setGlobalBaseUrl, getGlobalBaseUrl, setGlobalAuthHeader, getGlobalAuthHeader, } from './client';
|
|
23
18
|
// Re-export useful utilities from @agentuity/frontend
|
|
24
19
|
export { buildUrl, defaultBaseUrl, deserializeData, jsonEqual, getProcessEnv, } from '@agentuity/frontend';
|
|
25
20
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,OAAO,EACN,QAAQ,EACR,cAAc,EACd,eAAe,EACf,SAAS,EACT,aAAa,GACb,MAAM,qBAAqB,CAAC"}
|