@aomi-labs/react 0.3.5 → 0.3.7
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.cjs +426 -619
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -57
- package/dist/index.d.ts +58 -57
- package/dist/index.js +443 -646
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, WalletEip712Payload, WalletTxPayload, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
1
|
+
import { AomiClient, Session, WalletRequest } from '@aomi-labs/client';
|
|
2
|
+
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, WalletEip712Payload, WalletRequest, WalletTxPayload, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, SetStateAction } from 'react';
|
|
5
5
|
import { ThreadMessageLike } from '@assistant-ui/react';
|
|
@@ -80,24 +80,37 @@ type InboundEvent = {
|
|
|
80
80
|
type: string;
|
|
81
81
|
sessionId: string;
|
|
82
82
|
payload?: unknown;
|
|
83
|
-
status: "pending" | "fetched";
|
|
84
|
-
timestamp: number;
|
|
85
|
-
};
|
|
86
|
-
type OutboundEvent = {
|
|
87
|
-
type: string;
|
|
88
|
-
sessionId: string;
|
|
89
|
-
payload: unknown;
|
|
90
|
-
timestamp: number;
|
|
91
83
|
};
|
|
92
84
|
type SSEStatus = "connected" | "connecting" | "disconnected";
|
|
93
85
|
type EventSubscriber = (event: InboundEvent) => void;
|
|
94
|
-
type
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
type EventContext = {
|
|
87
|
+
/** Subscribe to events by type. Returns unsubscribe function. */
|
|
88
|
+
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
89
|
+
/** Dispatch an event to all matching subscribers (used by orchestrator) */
|
|
90
|
+
dispatch: (event: InboundEvent) => void;
|
|
91
|
+
/** Send an outbound system message to backend */
|
|
92
|
+
sendOutboundSystem: (event: {
|
|
93
|
+
type: string;
|
|
94
|
+
sessionId: string;
|
|
95
|
+
payload: unknown;
|
|
96
|
+
}) => Promise<void>;
|
|
97
|
+
/** Current SSE connection status */
|
|
97
98
|
sseStatus: SSEStatus;
|
|
98
|
-
lastEventId: string | null;
|
|
99
|
-
subscribers: Map<string, Set<EventSubscriber>>;
|
|
100
99
|
};
|
|
100
|
+
declare function useEventContext(): EventContext;
|
|
101
|
+
type EventContextProviderProps = {
|
|
102
|
+
children: ReactNode;
|
|
103
|
+
aomiClient: AomiClient;
|
|
104
|
+
sessionId: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Simplified EventContext — a pure pub/sub relay.
|
|
108
|
+
*
|
|
109
|
+
* SSE subscription and system event unwrapping are now handled by ClientSession
|
|
110
|
+
* in the orchestrator. This provider just maintains the subscriber registry
|
|
111
|
+
* and sendOutboundSystem for direct system messages.
|
|
112
|
+
*/
|
|
113
|
+
declare function EventContextProvider({ children, aomiClient, sessionId, }: EventContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
101
114
|
|
|
102
115
|
type NotificationType = "notice" | "success" | "error" | "wallet";
|
|
103
116
|
type Notification$1 = {
|
|
@@ -127,40 +140,26 @@ declare function NotificationContextProvider({ children, }: NotificationContextP
|
|
|
127
140
|
|
|
128
141
|
type WalletRequestKind = "transaction" | "eip712_sign";
|
|
129
142
|
type WalletRequestStatus = "pending" | "processing";
|
|
130
|
-
type WalletRequest = {
|
|
131
|
-
id: string;
|
|
132
|
-
kind: WalletRequestKind;
|
|
133
|
-
payload: WalletTxPayload | WalletEip712Payload;
|
|
134
|
-
status: WalletRequestStatus;
|
|
135
|
-
timestamp: number;
|
|
136
|
-
};
|
|
137
|
-
type WalletBuffer = {
|
|
138
|
-
queue: WalletRequest[];
|
|
139
|
-
nextId: number;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
143
|
type WalletRequestResult = {
|
|
143
144
|
txHash?: string;
|
|
144
145
|
signature?: string;
|
|
145
146
|
amount?: string;
|
|
146
147
|
};
|
|
147
148
|
type WalletHandlerConfig = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* Used by core.tsx to start polling for the AI's response. */
|
|
151
|
-
onRequestComplete?: () => void;
|
|
149
|
+
/** Get the ClientSession for the current thread. */
|
|
150
|
+
getSession: () => Session | undefined;
|
|
152
151
|
};
|
|
153
152
|
type WalletHandlerApi = {
|
|
154
153
|
/** All queued wallet requests (tx + eip712) */
|
|
155
154
|
pendingRequests: WalletRequest[];
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
/** Complete a request successfully —
|
|
155
|
+
/** Enqueue a wallet request (called by orchestrator on ClientSession events) */
|
|
156
|
+
enqueueRequest: (request: WalletRequest) => void;
|
|
157
|
+
/** Complete a request successfully — sends response to backend via ClientSession */
|
|
159
158
|
resolveRequest: (id: string, result: WalletRequestResult) => void;
|
|
160
|
-
/** Fail a request —
|
|
159
|
+
/** Fail a request — sends error to backend via ClientSession */
|
|
161
160
|
rejectRequest: (id: string, error?: string) => void;
|
|
162
161
|
};
|
|
163
|
-
declare function useWalletHandler({
|
|
162
|
+
declare function useWalletHandler({ getSession, }: WalletHandlerConfig): WalletHandlerApi;
|
|
164
163
|
|
|
165
164
|
type AomiRuntimeApi = {
|
|
166
165
|
/** Current user state (wallet connection, address, chain, etc.) */
|
|
@@ -220,7 +219,11 @@ type AomiRuntimeApi = {
|
|
|
220
219
|
/** Subscribe to inbound events by type. Returns unsubscribe function. */
|
|
221
220
|
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
222
221
|
/** Send a system command to the backend */
|
|
223
|
-
sendSystemCommand: (event:
|
|
222
|
+
sendSystemCommand: (event: {
|
|
223
|
+
type: string;
|
|
224
|
+
sessionId: string;
|
|
225
|
+
payload: unknown;
|
|
226
|
+
}) => Promise<void>;
|
|
224
227
|
/** Current SSE connection status */
|
|
225
228
|
sseStatus: SSEStatus;
|
|
226
229
|
};
|
|
@@ -254,24 +257,6 @@ type AomiRuntimeApi = {
|
|
|
254
257
|
*/
|
|
255
258
|
declare function useAomiRuntime(): AomiRuntimeApi;
|
|
256
259
|
|
|
257
|
-
type EventContext = {
|
|
258
|
-
/** Subscribe to inbound events by type. Returns unsubscribe function. */
|
|
259
|
-
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
260
|
-
/** Send an outbound event to backend immediately */
|
|
261
|
-
sendOutboundSystem: (event: Omit<OutboundEvent, "timestamp">) => Promise<void>;
|
|
262
|
-
/** Dispatch system events from HTTP polling into the event buffer */
|
|
263
|
-
dispatchInboundSystem: (sessionId: string, events: AomiSystemEvent[]) => void;
|
|
264
|
-
/** Current SSE connection status */
|
|
265
|
-
sseStatus: SSEStatus;
|
|
266
|
-
};
|
|
267
|
-
declare function useEventContext(): EventContext;
|
|
268
|
-
type EventContextProviderProps = {
|
|
269
|
-
children: ReactNode;
|
|
270
|
-
aomiClient: AomiClient;
|
|
271
|
-
sessionId: string;
|
|
272
|
-
};
|
|
273
|
-
declare function EventContextProvider({ children, aomiClient, sessionId, }: EventContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
274
|
-
|
|
275
260
|
type Notification = {
|
|
276
261
|
id: string;
|
|
277
262
|
type: string;
|
|
@@ -321,11 +306,17 @@ declare const SUPPORTED_CHAINS: ChainInfo[];
|
|
|
321
306
|
/** Look up ChainInfo by chain ID. Returns undefined for unknown chains. */
|
|
322
307
|
declare const getChainInfo: (chainId: number | undefined) => ChainInfo | undefined;
|
|
323
308
|
|
|
309
|
+
/** A stored provider API key (BYOK) */
|
|
310
|
+
type StoredProviderKey = {
|
|
311
|
+
apiKey: string;
|
|
312
|
+
keyPrefix: string;
|
|
313
|
+
label?: string;
|
|
314
|
+
};
|
|
324
315
|
/** Global control state (shared across all threads) */
|
|
325
316
|
type ControlState = {
|
|
326
317
|
/** API key for authenticated requests */
|
|
327
318
|
apiKey: string | null;
|
|
328
|
-
/** Stable client identifier for this browser
|
|
319
|
+
/** Stable client identifier for this browser profile (associates sessions with secrets) */
|
|
329
320
|
clientId: string | null;
|
|
330
321
|
/** Available models fetched from backend */
|
|
331
322
|
availableModels: string[];
|
|
@@ -335,6 +326,8 @@ type ControlState = {
|
|
|
335
326
|
defaultModel: string | null;
|
|
336
327
|
/** Default app (from authorizedApps) */
|
|
337
328
|
defaultApp: string | null;
|
|
329
|
+
/** Provider API keys stored locally (BYOK) — keyed by provider name */
|
|
330
|
+
providerKeys: Record<string, StoredProviderKey>;
|
|
338
331
|
};
|
|
339
332
|
type ControlContextApi = {
|
|
340
333
|
/** Global state (apiKey, clientId, available models/apps) */
|
|
@@ -345,6 +338,14 @@ type ControlContextApi = {
|
|
|
345
338
|
ingestSecrets: (secrets: Record<string, string>) => Promise<Record<string, string>>;
|
|
346
339
|
/** Clear all secrets from the backend vault */
|
|
347
340
|
clearSecrets: () => Promise<void>;
|
|
341
|
+
/** Store a provider API key (BYOK) in localStorage and ingest into backend vault */
|
|
342
|
+
setProviderKey: (provider: string, apiKey: string, label?: string) => Promise<void>;
|
|
343
|
+
/** Remove a provider API key from localStorage and backend vault */
|
|
344
|
+
removeProviderKey: (provider: string) => Promise<void>;
|
|
345
|
+
/** Get all stored provider keys (metadata only — keys are in state.providerKeys) */
|
|
346
|
+
getProviderKeys: () => Record<string, StoredProviderKey>;
|
|
347
|
+
/** Check if a provider key is stored */
|
|
348
|
+
hasProviderKey: (provider?: string) => boolean;
|
|
348
349
|
/** Fetch available models from backend */
|
|
349
350
|
getAvailableModels: () => Promise<string[]>;
|
|
350
351
|
/** Fetch authorized apps from backend */
|
|
@@ -384,4 +385,4 @@ type ControlContextProviderProps = {
|
|
|
384
385
|
};
|
|
385
386
|
declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
386
387
|
|
|
387
|
-
export { type AomiRuntimeApi, AomiRuntimeProvider, type AomiRuntimeProviderProps, type ChainInfo, type ControlContextApi, ControlContextProvider, type ControlContextProviderProps, type ControlState, type
|
|
388
|
+
export { type AomiRuntimeApi, AomiRuntimeProvider, type AomiRuntimeProviderProps, type ChainInfo, type ControlContextApi, ControlContextProvider, type ControlContextProviderProps, type ControlState, type EventContext, EventContextProvider, type EventContextProviderProps, type EventSubscriber, type InboundEvent, type Notification$1 as Notification, type NotificationApi, NotificationContextProvider, type NotificationContextProviderProps, type NotificationContextApi as NotificationContextValue, type NotificationHandlerConfig, type NotificationType, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type UserState, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestResult, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, WalletEip712Payload, WalletTxPayload, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
1
|
+
import { AomiClient, Session, WalletRequest } from '@aomi-labs/client';
|
|
2
|
+
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, WalletEip712Payload, WalletRequest, WalletTxPayload, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode, SetStateAction } from 'react';
|
|
5
5
|
import { ThreadMessageLike } from '@assistant-ui/react';
|
|
@@ -80,24 +80,37 @@ type InboundEvent = {
|
|
|
80
80
|
type: string;
|
|
81
81
|
sessionId: string;
|
|
82
82
|
payload?: unknown;
|
|
83
|
-
status: "pending" | "fetched";
|
|
84
|
-
timestamp: number;
|
|
85
|
-
};
|
|
86
|
-
type OutboundEvent = {
|
|
87
|
-
type: string;
|
|
88
|
-
sessionId: string;
|
|
89
|
-
payload: unknown;
|
|
90
|
-
timestamp: number;
|
|
91
83
|
};
|
|
92
84
|
type SSEStatus = "connected" | "connecting" | "disconnected";
|
|
93
85
|
type EventSubscriber = (event: InboundEvent) => void;
|
|
94
|
-
type
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
type EventContext = {
|
|
87
|
+
/** Subscribe to events by type. Returns unsubscribe function. */
|
|
88
|
+
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
89
|
+
/** Dispatch an event to all matching subscribers (used by orchestrator) */
|
|
90
|
+
dispatch: (event: InboundEvent) => void;
|
|
91
|
+
/** Send an outbound system message to backend */
|
|
92
|
+
sendOutboundSystem: (event: {
|
|
93
|
+
type: string;
|
|
94
|
+
sessionId: string;
|
|
95
|
+
payload: unknown;
|
|
96
|
+
}) => Promise<void>;
|
|
97
|
+
/** Current SSE connection status */
|
|
97
98
|
sseStatus: SSEStatus;
|
|
98
|
-
lastEventId: string | null;
|
|
99
|
-
subscribers: Map<string, Set<EventSubscriber>>;
|
|
100
99
|
};
|
|
100
|
+
declare function useEventContext(): EventContext;
|
|
101
|
+
type EventContextProviderProps = {
|
|
102
|
+
children: ReactNode;
|
|
103
|
+
aomiClient: AomiClient;
|
|
104
|
+
sessionId: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Simplified EventContext — a pure pub/sub relay.
|
|
108
|
+
*
|
|
109
|
+
* SSE subscription and system event unwrapping are now handled by ClientSession
|
|
110
|
+
* in the orchestrator. This provider just maintains the subscriber registry
|
|
111
|
+
* and sendOutboundSystem for direct system messages.
|
|
112
|
+
*/
|
|
113
|
+
declare function EventContextProvider({ children, aomiClient, sessionId, }: EventContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
101
114
|
|
|
102
115
|
type NotificationType = "notice" | "success" | "error" | "wallet";
|
|
103
116
|
type Notification$1 = {
|
|
@@ -127,40 +140,26 @@ declare function NotificationContextProvider({ children, }: NotificationContextP
|
|
|
127
140
|
|
|
128
141
|
type WalletRequestKind = "transaction" | "eip712_sign";
|
|
129
142
|
type WalletRequestStatus = "pending" | "processing";
|
|
130
|
-
type WalletRequest = {
|
|
131
|
-
id: string;
|
|
132
|
-
kind: WalletRequestKind;
|
|
133
|
-
payload: WalletTxPayload | WalletEip712Payload;
|
|
134
|
-
status: WalletRequestStatus;
|
|
135
|
-
timestamp: number;
|
|
136
|
-
};
|
|
137
|
-
type WalletBuffer = {
|
|
138
|
-
queue: WalletRequest[];
|
|
139
|
-
nextId: number;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
143
|
type WalletRequestResult = {
|
|
143
144
|
txHash?: string;
|
|
144
145
|
signature?: string;
|
|
145
146
|
amount?: string;
|
|
146
147
|
};
|
|
147
148
|
type WalletHandlerConfig = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* Used by core.tsx to start polling for the AI's response. */
|
|
151
|
-
onRequestComplete?: () => void;
|
|
149
|
+
/** Get the ClientSession for the current thread. */
|
|
150
|
+
getSession: () => Session | undefined;
|
|
152
151
|
};
|
|
153
152
|
type WalletHandlerApi = {
|
|
154
153
|
/** All queued wallet requests (tx + eip712) */
|
|
155
154
|
pendingRequests: WalletRequest[];
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
/** Complete a request successfully —
|
|
155
|
+
/** Enqueue a wallet request (called by orchestrator on ClientSession events) */
|
|
156
|
+
enqueueRequest: (request: WalletRequest) => void;
|
|
157
|
+
/** Complete a request successfully — sends response to backend via ClientSession */
|
|
159
158
|
resolveRequest: (id: string, result: WalletRequestResult) => void;
|
|
160
|
-
/** Fail a request —
|
|
159
|
+
/** Fail a request — sends error to backend via ClientSession */
|
|
161
160
|
rejectRequest: (id: string, error?: string) => void;
|
|
162
161
|
};
|
|
163
|
-
declare function useWalletHandler({
|
|
162
|
+
declare function useWalletHandler({ getSession, }: WalletHandlerConfig): WalletHandlerApi;
|
|
164
163
|
|
|
165
164
|
type AomiRuntimeApi = {
|
|
166
165
|
/** Current user state (wallet connection, address, chain, etc.) */
|
|
@@ -220,7 +219,11 @@ type AomiRuntimeApi = {
|
|
|
220
219
|
/** Subscribe to inbound events by type. Returns unsubscribe function. */
|
|
221
220
|
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
222
221
|
/** Send a system command to the backend */
|
|
223
|
-
sendSystemCommand: (event:
|
|
222
|
+
sendSystemCommand: (event: {
|
|
223
|
+
type: string;
|
|
224
|
+
sessionId: string;
|
|
225
|
+
payload: unknown;
|
|
226
|
+
}) => Promise<void>;
|
|
224
227
|
/** Current SSE connection status */
|
|
225
228
|
sseStatus: SSEStatus;
|
|
226
229
|
};
|
|
@@ -254,24 +257,6 @@ type AomiRuntimeApi = {
|
|
|
254
257
|
*/
|
|
255
258
|
declare function useAomiRuntime(): AomiRuntimeApi;
|
|
256
259
|
|
|
257
|
-
type EventContext = {
|
|
258
|
-
/** Subscribe to inbound events by type. Returns unsubscribe function. */
|
|
259
|
-
subscribe: (type: string, callback: EventSubscriber) => () => void;
|
|
260
|
-
/** Send an outbound event to backend immediately */
|
|
261
|
-
sendOutboundSystem: (event: Omit<OutboundEvent, "timestamp">) => Promise<void>;
|
|
262
|
-
/** Dispatch system events from HTTP polling into the event buffer */
|
|
263
|
-
dispatchInboundSystem: (sessionId: string, events: AomiSystemEvent[]) => void;
|
|
264
|
-
/** Current SSE connection status */
|
|
265
|
-
sseStatus: SSEStatus;
|
|
266
|
-
};
|
|
267
|
-
declare function useEventContext(): EventContext;
|
|
268
|
-
type EventContextProviderProps = {
|
|
269
|
-
children: ReactNode;
|
|
270
|
-
aomiClient: AomiClient;
|
|
271
|
-
sessionId: string;
|
|
272
|
-
};
|
|
273
|
-
declare function EventContextProvider({ children, aomiClient, sessionId, }: EventContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
274
|
-
|
|
275
260
|
type Notification = {
|
|
276
261
|
id: string;
|
|
277
262
|
type: string;
|
|
@@ -321,11 +306,17 @@ declare const SUPPORTED_CHAINS: ChainInfo[];
|
|
|
321
306
|
/** Look up ChainInfo by chain ID. Returns undefined for unknown chains. */
|
|
322
307
|
declare const getChainInfo: (chainId: number | undefined) => ChainInfo | undefined;
|
|
323
308
|
|
|
309
|
+
/** A stored provider API key (BYOK) */
|
|
310
|
+
type StoredProviderKey = {
|
|
311
|
+
apiKey: string;
|
|
312
|
+
keyPrefix: string;
|
|
313
|
+
label?: string;
|
|
314
|
+
};
|
|
324
315
|
/** Global control state (shared across all threads) */
|
|
325
316
|
type ControlState = {
|
|
326
317
|
/** API key for authenticated requests */
|
|
327
318
|
apiKey: string | null;
|
|
328
|
-
/** Stable client identifier for this browser
|
|
319
|
+
/** Stable client identifier for this browser profile (associates sessions with secrets) */
|
|
329
320
|
clientId: string | null;
|
|
330
321
|
/** Available models fetched from backend */
|
|
331
322
|
availableModels: string[];
|
|
@@ -335,6 +326,8 @@ type ControlState = {
|
|
|
335
326
|
defaultModel: string | null;
|
|
336
327
|
/** Default app (from authorizedApps) */
|
|
337
328
|
defaultApp: string | null;
|
|
329
|
+
/** Provider API keys stored locally (BYOK) — keyed by provider name */
|
|
330
|
+
providerKeys: Record<string, StoredProviderKey>;
|
|
338
331
|
};
|
|
339
332
|
type ControlContextApi = {
|
|
340
333
|
/** Global state (apiKey, clientId, available models/apps) */
|
|
@@ -345,6 +338,14 @@ type ControlContextApi = {
|
|
|
345
338
|
ingestSecrets: (secrets: Record<string, string>) => Promise<Record<string, string>>;
|
|
346
339
|
/** Clear all secrets from the backend vault */
|
|
347
340
|
clearSecrets: () => Promise<void>;
|
|
341
|
+
/** Store a provider API key (BYOK) in localStorage and ingest into backend vault */
|
|
342
|
+
setProviderKey: (provider: string, apiKey: string, label?: string) => Promise<void>;
|
|
343
|
+
/** Remove a provider API key from localStorage and backend vault */
|
|
344
|
+
removeProviderKey: (provider: string) => Promise<void>;
|
|
345
|
+
/** Get all stored provider keys (metadata only — keys are in state.providerKeys) */
|
|
346
|
+
getProviderKeys: () => Record<string, StoredProviderKey>;
|
|
347
|
+
/** Check if a provider key is stored */
|
|
348
|
+
hasProviderKey: (provider?: string) => boolean;
|
|
348
349
|
/** Fetch available models from backend */
|
|
349
350
|
getAvailableModels: () => Promise<string[]>;
|
|
350
351
|
/** Fetch authorized apps from backend */
|
|
@@ -384,4 +385,4 @@ type ControlContextProviderProps = {
|
|
|
384
385
|
};
|
|
385
386
|
declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
386
387
|
|
|
387
|
-
export { type AomiRuntimeApi, AomiRuntimeProvider, type AomiRuntimeProviderProps, type ChainInfo, type ControlContextApi, ControlContextProvider, type ControlContextProviderProps, type ControlState, type
|
|
388
|
+
export { type AomiRuntimeApi, AomiRuntimeProvider, type AomiRuntimeProviderProps, type ChainInfo, type ControlContextApi, ControlContextProvider, type ControlContextProviderProps, type ControlState, type EventContext, EventContextProvider, type EventContextProviderProps, type EventSubscriber, type InboundEvent, type Notification$1 as Notification, type NotificationApi, NotificationContextProvider, type NotificationContextProviderProps, type NotificationContextApi as NotificationContextValue, type NotificationHandlerConfig, type NotificationType, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type UserState, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestResult, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|