@gr33n-ai/jade-sdk-rn-client 0.1.0 → 0.1.3

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/dist/index.d.ts CHANGED
@@ -1,6 +1,339 @@
1
- export * from '@gr33n-ai/jade-sdk-client';
2
- export { ConversationEntry, MediaInfo, ProcessedEntry, ProcessingOptions, SessionMetadata, SkillMetadata, StreamingToolCall } from '@gr33n-ai/jade-sdk-client';
3
- export { R as AgentClient, R as RNAgentClient, RNAgentProvider, RNAgentProviderProps, STORAGE_KEYS, StorageAdapter, UseJadeSessionOptions, UseJadeSessionReturn, UseRNAgentSessionOptions, UseRNAgentSessionReturn, createAsyncStorageAdapter, createMMKVAdapter, createMemoryStorageAdapter, useAppState, useJadeSession, useRNAgentClient, useRNAgentSession, useStorage } from './react-native/index.js';
4
- import 'react/jsx-runtime';
5
- import 'react';
6
- import 'react-native';
1
+ import { AgentClientConfig, MessagesRequest, AgentEventEmitter, SessionListResponse, SessionConversationResponse, SessionContentResponse, SessionStatusResponse, UpdateSessionRequest, SuccessResponse, CancelResponse, SkillListResponse, SaveSkillRequest, PluginManifestResponse, PluginBundleResponse, ConversationEntry, StreamingToolCall, ProcessingOptions, ProcessedEntry, MediaInfo } from '@gr33n-ai/jade-sdk-client';
2
+ export { AgentClientConfig, AgentEventEmitter, CancelResponse, ConversationEntry, MediaInfo, MessagesRequest, ParsedSuggestion, ParsedToolInput, ParsedToolResult, PluginBundleResponse, PluginManifestResponse, ProcessedEntry, ProcessingOptions, SaveSkillRequest, SessionContentResponse, SessionConversationResponse, SessionListResponse, SessionMetadata, SessionStatusResponse, SkillListResponse, SkillMetadata, StreamingToolCall, SuccessResponse, TOOL_REGISTRY, TextSegment, ToolDefinition, UpdateSessionRequest, extractMedia, getToolDefinition, processConversation } from '@gr33n-ai/jade-sdk-client';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import React from 'react';
5
+ import { AppStateStatus } from 'react-native';
6
+
7
+ /**
8
+ * JadeClient - React Native client for the Jade SDK API.
9
+ * Uses react-native-sse for streaming instead of @microsoft/fetch-event-source.
10
+ */
11
+
12
+ declare class JadeClient {
13
+ private config;
14
+ private baseClient;
15
+ private activeStreams;
16
+ constructor(config: AgentClientConfig);
17
+ /** Whether org context is configured (orgId is set) */
18
+ get hasOrgContext(): boolean;
19
+ private get baseUrl();
20
+ private getHeaders;
21
+ /**
22
+ * Send a message and stream responses using React Native SSE.
23
+ * @returns Object with event emitter and abort function
24
+ */
25
+ stream(request: MessagesRequest): {
26
+ emitter: AgentEventEmitter;
27
+ abort: () => void;
28
+ };
29
+ /**
30
+ * Reconnect to an active streaming session using React Native SSE.
31
+ * @returns Object with event emitter and abort function
32
+ */
33
+ reconnect(sessionId: string, lastEventId?: number): {
34
+ emitter: AgentEventEmitter;
35
+ abort: () => void;
36
+ };
37
+ /**
38
+ * List all sessions for the authenticated user.
39
+ */
40
+ listSessions(): Promise<SessionListResponse>;
41
+ /**
42
+ * Get session content in display format.
43
+ */
44
+ getSession(sessionId: string): Promise<SessionConversationResponse>;
45
+ /**
46
+ * Get session content as raw JSONL.
47
+ */
48
+ getSessionRaw(sessionId: string): Promise<SessionContentResponse>;
49
+ /**
50
+ * Check if a session is actively streaming.
51
+ */
52
+ getSessionStatus(sessionId: string): Promise<SessionStatusResponse>;
53
+ /**
54
+ * Update session metadata (name).
55
+ */
56
+ updateSession(sessionId: string, updates: UpdateSessionRequest): Promise<SuccessResponse>;
57
+ /**
58
+ * Delete a session.
59
+ */
60
+ deleteSession(sessionId: string): Promise<SuccessResponse>;
61
+ /**
62
+ * Cancel an active session query.
63
+ */
64
+ cancelSession(sessionId: string): Promise<CancelResponse>;
65
+ /**
66
+ * List personal skills.
67
+ */
68
+ listSkills(): Promise<SkillListResponse>;
69
+ /**
70
+ * Get personal skill content.
71
+ */
72
+ getSkill(name: string): Promise<Uint8Array>;
73
+ /**
74
+ * Create or update a personal skill.
75
+ */
76
+ saveSkill(skill: SaveSkillRequest): Promise<SuccessResponse>;
77
+ /**
78
+ * Delete a personal skill.
79
+ */
80
+ deleteSkill(name: string): Promise<SuccessResponse>;
81
+ /**
82
+ * List organization skills.
83
+ */
84
+ listOrgSkills(): Promise<SkillListResponse>;
85
+ /**
86
+ * Get organization skill content.
87
+ */
88
+ getOrgSkill(name: string): Promise<Uint8Array>;
89
+ /**
90
+ * Create or update an organization skill.
91
+ */
92
+ saveOrgSkill(skill: SaveSkillRequest): Promise<SuccessResponse>;
93
+ /**
94
+ * Delete an organization skill.
95
+ */
96
+ deleteOrgSkill(name: string): Promise<SuccessResponse>;
97
+ /**
98
+ * Get plugin manifest for client sync.
99
+ */
100
+ getPluginManifest(): Promise<PluginManifestResponse>;
101
+ /**
102
+ * Download plugin bundle.
103
+ */
104
+ getPluginBundle(skills?: string[]): Promise<PluginBundleResponse>;
105
+ }
106
+
107
+ /**
108
+ * Storage adapter for React Native.
109
+ * Provides AsyncStorage and MMKV implementations.
110
+ */
111
+ interface StorageAdapter {
112
+ getItem(key: string): Promise<string | null>;
113
+ setItem(key: string, value: string): Promise<void>;
114
+ removeItem(key: string): Promise<void>;
115
+ }
116
+ /**
117
+ * Create a storage adapter using @react-native-async-storage/async-storage.
118
+ * AsyncStorage must be passed in to avoid requiring it as a direct dependency.
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * import AsyncStorage from '@react-native-async-storage/async-storage';
123
+ * const storage = createAsyncStorageAdapter(AsyncStorage);
124
+ * ```
125
+ */
126
+ declare function createAsyncStorageAdapter(asyncStorage: {
127
+ getItem: (key: string) => Promise<string | null>;
128
+ setItem: (key: string, value: string) => Promise<void>;
129
+ removeItem: (key: string) => Promise<void>;
130
+ }): StorageAdapter;
131
+ /**
132
+ * Create a storage adapter using react-native-mmkv.
133
+ * MMKV instance must be passed in to avoid requiring it as a direct dependency.
134
+ *
135
+ * @example
136
+ * ```typescript
137
+ * import { MMKV } from 'react-native-mmkv';
138
+ * const mmkv = new MMKV();
139
+ * const storage = createMMKVAdapter(mmkv);
140
+ * ```
141
+ */
142
+ declare function createMMKVAdapter(mmkv: {
143
+ getString: (key: string) => string | undefined;
144
+ set: (key: string, value: string) => void;
145
+ delete: (key: string) => void;
146
+ }): StorageAdapter;
147
+ /**
148
+ * Create an in-memory storage adapter for testing.
149
+ */
150
+ declare function createMemoryStorageAdapter(): StorageAdapter;
151
+ /**
152
+ * Standard storage keys used by the Jade SDK.
153
+ */
154
+ declare const STORAGE_KEYS: {
155
+ readonly AUTH_TOKEN: "@gr33n-ai/auth-token";
156
+ readonly ENDPOINT: "@gr33n-ai/endpoint";
157
+ readonly ORG_ID: "@gr33n-ai/org-id";
158
+ readonly LAST_SESSION_ID: "@gr33n-ai/last-session-id";
159
+ readonly USER_PREFERENCES: "@gr33n-ai/user-preferences";
160
+ };
161
+
162
+ interface JadeProviderProps {
163
+ children: React.ReactNode;
164
+ /** Client configuration */
165
+ config: AgentClientConfig;
166
+ /** Optional storage adapter for persisting auth tokens, etc. */
167
+ storage?: StorageAdapter;
168
+ /** Pause streaming when app goes to background (default: true) */
169
+ pauseOnBackground?: boolean;
170
+ }
171
+ /**
172
+ * Provider component for the React Native Jade SDK client.
173
+ * Wrap your app with this to use the Jade hooks.
174
+ *
175
+ * Features:
176
+ * - AppState-aware (tracks foreground/background)
177
+ * - Optional storage adapter for persistence
178
+ *
179
+ * @example
180
+ * ```tsx
181
+ * import AsyncStorage from '@react-native-async-storage/async-storage';
182
+ * import { createAsyncStorageAdapter } from '@gr33n-ai/jade-sdk-rn-client';
183
+ *
184
+ * const storage = createAsyncStorageAdapter(AsyncStorage);
185
+ *
186
+ * <JadeProvider
187
+ * config={{
188
+ * endpoint: 'https://api.example.com',
189
+ * getAuthToken: async () => storage.getItem('@gr33n-ai/auth-token'),
190
+ * }}
191
+ * storage={storage}
192
+ * >
193
+ * <App />
194
+ * </JadeProvider>
195
+ * ```
196
+ */
197
+ declare function JadeProvider({ children, config, storage, pauseOnBackground, }: JadeProviderProps): react_jsx_runtime.JSX.Element;
198
+ /**
199
+ * Get the Jade SDK client instance.
200
+ * Must be used within a JadeProvider.
201
+ *
202
+ * @example
203
+ * ```tsx
204
+ * const client = useJadeClient();
205
+ * const sessions = await client.listSessions();
206
+ * ```
207
+ */
208
+ declare function useJadeClient(): JadeClient;
209
+ /**
210
+ * Get the storage adapter instance.
211
+ * Must be used within a JadeProvider.
212
+ *
213
+ * @example
214
+ * ```tsx
215
+ * const storage = useStorage();
216
+ * if (storage) {
217
+ * await storage.setItem('@gr33n-ai/last-session', sessionId);
218
+ * }
219
+ * ```
220
+ */
221
+ declare function useStorage(): StorageAdapter | undefined;
222
+ /**
223
+ * Get the current app state (active, background, inactive).
224
+ * Useful for pausing/resuming operations based on app visibility.
225
+ *
226
+ * @example
227
+ * ```tsx
228
+ * const appState = useAppState();
229
+ * useEffect(() => {
230
+ * if (appState === 'active') {
231
+ * // Resume operations
232
+ * }
233
+ * }, [appState]);
234
+ * ```
235
+ */
236
+ declare function useAppState(): AppStateStatus;
237
+
238
+ /**
239
+ * useJadeSessionCore hook for React Native.
240
+ * Manages Jade sessions with streaming support using the JadeClient.
241
+ */
242
+
243
+ interface UseJadeSessionCoreOptions {
244
+ /** Initial session ID */
245
+ initialSessionId?: string;
246
+ /** Initial conversation entries */
247
+ initialConversation?: ConversationEntry[];
248
+ /** Callback when media is generated (image/video/audio) */
249
+ onMediaGenerated?: (urls: string[], type: 'image' | 'video' | 'audio') => void;
250
+ /** Pause streaming when app goes to background (default: true) */
251
+ pauseOnBackground?: boolean;
252
+ }
253
+ interface UseJadeSessionCoreReturn {
254
+ sessionId: string | undefined;
255
+ conversation: ConversationEntry[];
256
+ isStreaming: boolean;
257
+ streamingText: string | undefined;
258
+ streamingToolCall: StreamingToolCall | undefined;
259
+ showTinkering: boolean;
260
+ sendMessage: (prompt: string, skills?: string[]) => Promise<void>;
261
+ cancel: () => Promise<void>;
262
+ clear: () => void;
263
+ reconnect: (sessionId: string, freshConversation?: ConversationEntry[], streamingPrompt?: string) => Promise<void>;
264
+ setSessionId: (id: string | undefined) => void;
265
+ setConversation: (entries: ConversationEntry[], sessionId?: string) => void;
266
+ loadSession: (sessionId: string) => Promise<ConversationEntry[]>;
267
+ }
268
+ /**
269
+ * Hook for managing Jade sessions with streaming support in React Native.
270
+ *
271
+ * Features:
272
+ * - Streaming with RN-specific SSE implementation
273
+ * - AppState-aware (can pause on background)
274
+ * - Same API as useAgentSession from agent-sdk-client
275
+ *
276
+ * @example
277
+ * ```tsx
278
+ * const {
279
+ * conversation,
280
+ * isStreaming,
281
+ * streamingText,
282
+ * sendMessage,
283
+ * cancel,
284
+ * } = useJadeSessionCore();
285
+ *
286
+ * await sendMessage('Hello!');
287
+ * ```
288
+ */
289
+ declare function useJadeSessionCore(options?: UseJadeSessionCoreOptions): UseJadeSessionCoreReturn;
290
+
291
+ /**
292
+ * useJadeSession hook for React Native.
293
+ * Extends useJadeSessionCore with processed conversation and media extraction.
294
+ */
295
+
296
+ interface UseJadeSessionOptions extends UseJadeSessionCoreOptions {
297
+ /** Skip Skill context injection entries (default: true) */
298
+ skipSkillContext?: boolean;
299
+ /** Processing options */
300
+ processingOptions?: ProcessingOptions;
301
+ }
302
+ interface UseJadeSessionReturn extends UseJadeSessionCoreReturn {
303
+ /** Processed conversation entries with tool pairing and parsing */
304
+ processedConversation: ProcessedEntry[];
305
+ /** All media extracted from conversation (deduplicated, sorted by timestamp) */
306
+ media: MediaInfo[];
307
+ }
308
+ /**
309
+ * Hook for managing Jade sessions with enhanced conversation processing.
310
+ * React Native version using JadeClient for streaming.
311
+ *
312
+ * Extends useJadeSessionCore with:
313
+ * - Processed conversation (tool call/result pairing, parsed inputs/results)
314
+ * - Media extraction from generated content
315
+ *
316
+ * @example
317
+ * ```tsx
318
+ * const {
319
+ * conversation,
320
+ * processedConversation,
321
+ * media,
322
+ * isStreaming,
323
+ * sendMessage,
324
+ * } = useJadeSession();
325
+ *
326
+ * // Render processed entries
327
+ * {processedConversation.map((entry, i) => (
328
+ * <MessageRenderer key={i} entry={entry} />
329
+ * ))}
330
+ *
331
+ * // Show media gallery
332
+ * {media.map((item) => (
333
+ * <MediaThumbnail key={item.url} {...item} />
334
+ * ))}
335
+ * ```
336
+ */
337
+ declare function useJadeSession(options?: UseJadeSessionOptions): UseJadeSessionReturn;
338
+
339
+ export { JadeClient, JadeProvider, type JadeProviderProps, STORAGE_KEYS, type StorageAdapter, type UseJadeSessionCoreOptions, type UseJadeSessionCoreReturn, type UseJadeSessionOptions, type UseJadeSessionReturn, createAsyncStorageAdapter, createMMKVAdapter, createMemoryStorageAdapter, useAppState, useJadeClient, useJadeSession, useJadeSessionCore, useStorage };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var reactNative = require('react-native');
5
4
  var jsxRuntime = require('react/jsx-runtime');
5
+ var reactNative = require('react-native');
6
6
 
7
7
  var __create = Object.create;
8
8
  var __defProp = Object.defineProperty;
@@ -322,8 +322,6 @@ var require_react_native_sse = __commonJS({
322
322
  module.exports = EventSource3;
323
323
  }
324
324
  });
325
-
326
- // ../ts-client/dist/index.js
327
325
  async function getBytes(stream, onChunk) {
328
326
  const reader = stream.getReader();
329
327
  let result;
@@ -1573,14 +1571,6 @@ var TOOL_REGISTRY = {
1573
1571
  function getToolDefinition(toolName) {
1574
1572
  return TOOL_REGISTRY[toolName];
1575
1573
  }
1576
- function getToolIconName(toolName, toolInput) {
1577
- const def = getToolDefinition(toolName);
1578
- if (!def) return "Wrench";
1579
- if (def.iconVariant && toolInput) {
1580
- return def.iconVariant(toolInput);
1581
- }
1582
- return def.iconName;
1583
- }
1584
1574
  var SUGGESTION_REGEX = /<gr3\.suggestion>([\s\S]*?)<\/gr3\.suggestion>/g;
1585
1575
  function parseSuggestions(text) {
1586
1576
  const suggestions = [];
@@ -1980,6 +1970,7 @@ function extractMedia(conversation) {
1980
1970
  mediaArray.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
1981
1971
  return mediaArray;
1982
1972
  }
1973
+ react.createContext(null);
1983
1974
 
1984
1975
  // src/react-native/sse-adapter.ts
1985
1976
  var import_react_native_sse = __toESM(require_react_native_sse());
@@ -2047,7 +2038,7 @@ async function createRNSSEStream(options) {
2047
2038
  ];
2048
2039
  for (const eventType of eventTypes) {
2049
2040
  es.addEventListener(eventType, (event) => {
2050
- console.log(`[RN-SSE] Received ${eventType} event:`, event.data?.substring?.(0, 100) || event.data);
2041
+ console.log(`[Jade-SSE] Received ${eventType} event:`, event.data?.substring?.(0, 100) || event.data);
2051
2042
  const eventData = {
2052
2043
  data: event.data,
2053
2044
  lastEventId: event.lastEventId ?? void 0
@@ -2056,7 +2047,7 @@ async function createRNSSEStream(options) {
2056
2047
  });
2057
2048
  }
2058
2049
  es.addEventListener("message", (event) => {
2059
- console.log("[RN-SSE] Received message event:", event.data?.substring?.(0, 100) || event.data);
2050
+ console.log("[Jade-SSE] Received message event:", event.data?.substring?.(0, 100) || event.data);
2060
2051
  const eventData = {
2061
2052
  data: event.data,
2062
2053
  lastEventId: event.lastEventId ?? void 0
@@ -2064,7 +2055,7 @@ async function createRNSSEStream(options) {
2064
2055
  handleSSEEvent("message", eventData, emitter, processedIds);
2065
2056
  });
2066
2057
  es.addEventListener("error", (event) => {
2067
- console.log("[RN-SSE] Error event:", JSON.stringify(event));
2058
+ console.log("[Jade-SSE] Error event:", JSON.stringify(event));
2068
2059
  if (signal?.aborted || isClosed) {
2069
2060
  cleanup();
2070
2061
  return;
@@ -2073,7 +2064,7 @@ async function createRNSSEStream(options) {
2073
2064
  const status = event.xhrStatus;
2074
2065
  if (status === 401 || status === 403 || errorMessage.includes("401") || errorMessage.includes("403") || errorMessage.includes("Authentication")) {
2075
2066
  const authError = `Authentication failed (${status || "unknown"}): ${errorMessage}`;
2076
- console.log("[RN-SSE] Auth error detected:", authError);
2067
+ console.log("[Jade-SSE] Auth error detected:", authError);
2077
2068
  emitter.emit("error", { error: authError });
2078
2069
  cleanup();
2079
2070
  reject(new Error(authError));
@@ -2103,7 +2094,7 @@ async function createRNSSEStream(options) {
2103
2094
  INITIAL_RETRY_DELAY2 * Math.pow(2, retryCount - 1),
2104
2095
  MAX_RETRY_DELAY2
2105
2096
  );
2106
- console.log(`[RN-SSE] Retry ${retryCount}/${MAX_RETRIES2} in ${delay}ms`);
2097
+ console.log(`[Jade-SSE] Retry ${retryCount}/${MAX_RETRIES2} in ${delay}ms`);
2107
2098
  es?.close();
2108
2099
  setTimeout(connect, delay);
2109
2100
  });
@@ -2164,7 +2155,7 @@ function handleSSEEvent(eventType, event, emitter, processedIds) {
2164
2155
  break;
2165
2156
  }
2166
2157
  } catch (e) {
2167
- console.error("[RN-SSE] Failed to parse event:", event.data, e);
2158
+ console.error("[Jade-SSE] Failed to parse event:", event.data, e);
2168
2159
  }
2169
2160
  }
2170
2161
  function handleStreamEvent2(data, emitter) {
@@ -2184,7 +2175,7 @@ function handleStreamEvent2(data, emitter) {
2184
2175
  }
2185
2176
 
2186
2177
  // src/react-native/client.ts
2187
- var RNAgentClient = class {
2178
+ var JadeClient = class {
2188
2179
  config;
2189
2180
  baseClient;
2190
2181
  activeStreams = /* @__PURE__ */ new Map();
@@ -2399,8 +2390,8 @@ var RNAgentClient = class {
2399
2390
  return this.baseClient.getPluginBundle(skills);
2400
2391
  }
2401
2392
  };
2402
- var RNAgentContext = react.createContext(null);
2403
- function RNAgentProvider({
2393
+ var JadeContext = react.createContext(null);
2394
+ function JadeProvider({
2404
2395
  children,
2405
2396
  config,
2406
2397
  storage,
@@ -2415,7 +2406,7 @@ function RNAgentProvider({
2415
2406
  return () => subscription.remove();
2416
2407
  }, [pauseOnBackground]);
2417
2408
  const client = react.useMemo(
2418
- () => new RNAgentClient(config),
2409
+ () => new JadeClient(config),
2419
2410
  // Only recreate client if endpoint changes
2420
2411
  [config.endpoint, config.apiVersion, config.timeout]
2421
2412
  );
@@ -2423,31 +2414,31 @@ function RNAgentProvider({
2423
2414
  () => ({ client, storage, appState }),
2424
2415
  [client, storage, appState]
2425
2416
  );
2426
- return /* @__PURE__ */ jsxRuntime.jsx(RNAgentContext.Provider, { value, children });
2417
+ return /* @__PURE__ */ jsxRuntime.jsx(JadeContext.Provider, { value, children });
2427
2418
  }
2428
- function useRNAgentClient() {
2429
- const context = react.useContext(RNAgentContext);
2419
+ function useJadeClient() {
2420
+ const context = react.useContext(JadeContext);
2430
2421
  if (!context) {
2431
- throw new Error("useRNAgentClient must be used within an RNAgentProvider");
2422
+ throw new Error("useJadeClient must be used within a JadeProvider");
2432
2423
  }
2433
2424
  return context.client;
2434
2425
  }
2435
2426
  function useStorage() {
2436
- const context = react.useContext(RNAgentContext);
2427
+ const context = react.useContext(JadeContext);
2437
2428
  if (!context) {
2438
- throw new Error("useStorage must be used within an RNAgentProvider");
2429
+ throw new Error("useStorage must be used within a JadeProvider");
2439
2430
  }
2440
2431
  return context.storage;
2441
2432
  }
2442
2433
  function useAppState() {
2443
- const context = react.useContext(RNAgentContext);
2434
+ const context = react.useContext(JadeContext);
2444
2435
  if (!context) {
2445
- throw new Error("useAppState must be used within an RNAgentProvider");
2436
+ throw new Error("useAppState must be used within a JadeProvider");
2446
2437
  }
2447
2438
  return context.appState;
2448
2439
  }
2449
- function useRNAgentSession(options = {}) {
2450
- const client = useRNAgentClient();
2440
+ function useJadeSessionCore(options = {}) {
2441
+ const client = useJadeClient();
2451
2442
  const appState = useAppState();
2452
2443
  const {
2453
2444
  initialSessionId,
@@ -2465,7 +2456,7 @@ function useRNAgentSession(options = {}) {
2465
2456
  const accumulatedTextRef = react.useRef({});
2466
2457
  react.useEffect(() => {
2467
2458
  if (pauseOnBackground && appState !== "active" && session.isStreaming) {
2468
- console.log("[RNAgentSession] App went to background while streaming");
2459
+ console.log("[JadeSession] App went to background while streaming");
2469
2460
  }
2470
2461
  }, [appState, pauseOnBackground, session.isStreaming]);
2471
2462
  const setupEventHandlers = react.useCallback(
@@ -2610,10 +2601,10 @@ function useRNAgentSession(options = {}) {
2610
2601
  try {
2611
2602
  await client.cancelSession(session.sessionId);
2612
2603
  } catch (error) {
2613
- console.error("[RNAgentSession] Server-side cancel failed:", error);
2604
+ console.error("[JadeSession] Server-side cancel failed:", error);
2614
2605
  }
2615
2606
  } else {
2616
- console.warn("[RNAgentSession] No sessionId available for server-side cancel");
2607
+ console.warn("[JadeSession] No sessionId available for server-side cancel");
2617
2608
  }
2618
2609
  if (abortRef.current) {
2619
2610
  abortRef.current();
@@ -2737,7 +2728,7 @@ function useJadeSession(options = {}) {
2737
2728
  processingOptions,
2738
2729
  ...agentOptions
2739
2730
  } = options;
2740
- const session = useRNAgentSession(agentOptions);
2731
+ const session = useJadeSessionCore(agentOptions);
2741
2732
  const processedConversation = react.useMemo(() => {
2742
2733
  return processConversation(session.conversation, {
2743
2734
  skipSkillContext,
@@ -2791,34 +2782,18 @@ var STORAGE_KEYS = {
2791
2782
  USER_PREFERENCES: "@gr33n-ai/user-preferences"
2792
2783
  };
2793
2784
 
2794
- exports.AgentClient = RNAgentClient;
2795
- exports.AgentClientError = AgentClientError;
2796
- exports.AgentEventEmitter = AgentEventEmitter;
2797
- exports.AuthenticationError = AuthenticationError;
2798
- exports.RNAgentClient = RNAgentClient;
2799
- exports.RNAgentProvider = RNAgentProvider;
2800
- exports.RequestError = RequestError;
2785
+ exports.JadeClient = JadeClient;
2786
+ exports.JadeProvider = JadeProvider;
2801
2787
  exports.STORAGE_KEYS = STORAGE_KEYS;
2802
- exports.SessionNotFoundError = SessionNotFoundError;
2803
- exports.SkillNotFoundError = SkillNotFoundError;
2804
2788
  exports.TOOL_REGISTRY = TOOL_REGISTRY;
2805
2789
  exports.createAsyncStorageAdapter = createAsyncStorageAdapter;
2806
2790
  exports.createMMKVAdapter = createMMKVAdapter;
2807
- exports.createMediaParseResult = createMediaParseResult;
2808
2791
  exports.createMemoryStorageAdapter = createMemoryStorageAdapter;
2809
2792
  exports.extractMedia = extractMedia;
2810
- exports.extractMediaInfo = extractMediaInfo;
2811
- exports.extractMediaInfoFromToolResult = extractMediaInfoFromToolResult;
2812
- exports.getMediaTypeFromExtension = getMediaTypeFromExtension;
2813
- exports.getMediaTypeFromUrl = getMediaTypeFromUrl;
2814
2793
  exports.getToolDefinition = getToolDefinition;
2815
- exports.getToolIconName = getToolIconName;
2816
- exports.hasSuggestions = hasSuggestions;
2817
- exports.parseSuggestions = parseSuggestions;
2818
- exports.parseToolResultContent = parseToolResultContent;
2819
2794
  exports.processConversation = processConversation;
2820
2795
  exports.useAppState = useAppState;
2796
+ exports.useJadeClient = useJadeClient;
2821
2797
  exports.useJadeSession = useJadeSession;
2822
- exports.useRNAgentClient = useRNAgentClient;
2823
- exports.useRNAgentSession = useRNAgentSession;
2798
+ exports.useJadeSessionCore = useJadeSessionCore;
2824
2799
  exports.useStorage = useStorage;