@aomi-labs/react 0.3.14 → 0.3.16
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 +276 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +275 -106
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AomiClient, SessionOptions, Session, UserState, WalletRequest, WalletRequestResult, AomiSimulateResponse } from '@aomi-labs/client';
|
|
2
|
-
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, DISABLED_PROVIDER_STATE, MAX_AUTO_FEE_WEI, UserState, WalletEip712Payload, WalletRequest, WalletRequestResult, WalletTxPayload, aaModeFromExecutionKind, appendFeeCallToPayload, buildFeeAAWalletCall, executeWalletCalls, hydrateTxPayloadFromUserState, normalizeSimulatedFee, parseChainId, toAAWalletCall, toAAWalletCalls, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
2
|
+
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, DISABLED_PROVIDER_STATE, MAX_AUTO_FEE_WEI, NativeWalletExecutionPolicy, NativeWalletSponsorship, SponsorshipPaymasterServiceContext, UserState, WalletCapabilities, WalletEip712Payload, WalletRequest, WalletRequestResult, WalletTxPayload, aaModeFromExecutionKind, appendFeeCallToPayload, buildFeeAAWalletCall, executeWalletCalls, hydrateTxPayloadFromUserState, normalizeSimulatedFee, parseChainId, toAAWalletCall, toAAWalletCalls, 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';
|
|
@@ -56,9 +56,12 @@ declare function useCurrentThreadMessages(): ThreadMessageLike[];
|
|
|
56
56
|
declare function useCurrentThreadMetadata(): ThreadMetadata | undefined;
|
|
57
57
|
|
|
58
58
|
type ThreadStatus = "regular" | "archived";
|
|
59
|
+
type ModelSelectionMode = "auto" | "manual";
|
|
59
60
|
type ThreadControlState = {
|
|
60
61
|
/** Selected model for this thread (human-readable label) */
|
|
61
62
|
model: string | null;
|
|
63
|
+
/** Whether the selected model should be displayed as auto or explicit */
|
|
64
|
+
modelMode?: ModelSelectionMode;
|
|
62
65
|
/** Selected app for this thread */
|
|
63
66
|
app: string | null;
|
|
64
67
|
/** Whether control state has changed but chat hasn't started yet */
|
|
@@ -327,12 +330,23 @@ declare const SUPPORTED_CHAINS: ChainInfo[];
|
|
|
327
330
|
/** Look up ChainInfo by chain ID. Returns undefined for unknown chains. */
|
|
328
331
|
declare const getChainInfo: (chainId: number | undefined) => ChainInfo | undefined;
|
|
329
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Resolve the actual backend model for auto mode.
|
|
335
|
+
* Prefers known cheaper/performance-oriented models before falling back to the
|
|
336
|
+
* backend order.
|
|
337
|
+
*/
|
|
338
|
+
declare function resolveAutoModel(models: string[]): string | null;
|
|
339
|
+
|
|
330
340
|
/** A stored provider API key (BYOK) */
|
|
331
341
|
type StoredProviderKey = {
|
|
332
342
|
apiKey: string;
|
|
333
343
|
keyPrefix: string;
|
|
334
344
|
label?: string;
|
|
335
345
|
};
|
|
346
|
+
type StoredModelPreference = {
|
|
347
|
+
mode: ModelSelectionMode;
|
|
348
|
+
model: string | null;
|
|
349
|
+
};
|
|
336
350
|
/** Global control state (shared across all threads) */
|
|
337
351
|
type ControlState = {
|
|
338
352
|
/** API key for authenticated requests */
|
|
@@ -376,13 +390,19 @@ type ControlContextApi = {
|
|
|
376
390
|
/** Get the current thread's effective app after auth fallback */
|
|
377
391
|
getCurrentThreadApp: () => string;
|
|
378
392
|
/** Select a model for the current thread (updates metadata + calls backend) */
|
|
379
|
-
onModelSelect: (model: string
|
|
393
|
+
onModelSelect: (model: string, options?: {
|
|
394
|
+
mode?: ModelSelectionMode;
|
|
395
|
+
}) => Promise<void>;
|
|
380
396
|
/** Select an app for the current thread (updates metadata only) */
|
|
381
397
|
onAppSelect: (app: string) => void;
|
|
382
398
|
/** Whether the current thread is processing (disables control switching) */
|
|
383
399
|
isProcessing: boolean;
|
|
384
400
|
/** Mark control state as synced (called after chat starts) */
|
|
385
401
|
markControlSynced: () => void;
|
|
402
|
+
/** Sync pending control state to the backend before sending */
|
|
403
|
+
syncCurrentThreadControl: () => Promise<void>;
|
|
404
|
+
/** Build initial control state for new local threads */
|
|
405
|
+
getPreferredThreadControl: () => ThreadControlState;
|
|
386
406
|
/** Get global control state */
|
|
387
407
|
getControlState: () => ControlState;
|
|
388
408
|
/** Subscribe to global state changes */
|
|
@@ -406,4 +426,4 @@ type ControlContextProviderProps = {
|
|
|
406
426
|
};
|
|
407
427
|
declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
408
428
|
|
|
409
|
-
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, RuntimeUserStateProvider, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|
|
429
|
+
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 ModelSelectionMode, type Notification$1 as Notification, type NotificationApi, NotificationContextProvider, type NotificationContextProviderProps, type NotificationContextApi as NotificationContextValue, type NotificationHandlerConfig, type NotificationType, RuntimeUserStateProvider, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredModelPreference, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, resolveAutoModel, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AomiClient, SessionOptions, Session, UserState, WalletRequest, WalletRequestResult, AomiSimulateResponse } from '@aomi-labs/client';
|
|
2
|
-
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, DISABLED_PROVIDER_STATE, MAX_AUTO_FEE_WEI, UserState, WalletEip712Payload, WalletRequest, WalletRequestResult, WalletTxPayload, aaModeFromExecutionKind, appendFeeCallToPayload, buildFeeAAWalletCall, executeWalletCalls, hydrateTxPayloadFromUserState, normalizeSimulatedFee, parseChainId, toAAWalletCall, toAAWalletCalls, toViemSignTypedDataArgs } from '@aomi-labs/client';
|
|
2
|
+
export { AomiChatResponse, AomiClient, AomiClientOptions, AomiCreateThreadResponse, AomiInterruptResponse, AomiMessage, AomiSSEEvent, AomiStateResponse, AomiSystemEvent, AomiSystemResponse, AomiThread, DISABLED_PROVIDER_STATE, MAX_AUTO_FEE_WEI, NativeWalletExecutionPolicy, NativeWalletSponsorship, SponsorshipPaymasterServiceContext, UserState, WalletCapabilities, WalletEip712Payload, WalletRequest, WalletRequestResult, WalletTxPayload, aaModeFromExecutionKind, appendFeeCallToPayload, buildFeeAAWalletCall, executeWalletCalls, hydrateTxPayloadFromUserState, normalizeSimulatedFee, parseChainId, toAAWalletCall, toAAWalletCalls, 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';
|
|
@@ -56,9 +56,12 @@ declare function useCurrentThreadMessages(): ThreadMessageLike[];
|
|
|
56
56
|
declare function useCurrentThreadMetadata(): ThreadMetadata | undefined;
|
|
57
57
|
|
|
58
58
|
type ThreadStatus = "regular" | "archived";
|
|
59
|
+
type ModelSelectionMode = "auto" | "manual";
|
|
59
60
|
type ThreadControlState = {
|
|
60
61
|
/** Selected model for this thread (human-readable label) */
|
|
61
62
|
model: string | null;
|
|
63
|
+
/** Whether the selected model should be displayed as auto or explicit */
|
|
64
|
+
modelMode?: ModelSelectionMode;
|
|
62
65
|
/** Selected app for this thread */
|
|
63
66
|
app: string | null;
|
|
64
67
|
/** Whether control state has changed but chat hasn't started yet */
|
|
@@ -327,12 +330,23 @@ declare const SUPPORTED_CHAINS: ChainInfo[];
|
|
|
327
330
|
/** Look up ChainInfo by chain ID. Returns undefined for unknown chains. */
|
|
328
331
|
declare const getChainInfo: (chainId: number | undefined) => ChainInfo | undefined;
|
|
329
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Resolve the actual backend model for auto mode.
|
|
335
|
+
* Prefers known cheaper/performance-oriented models before falling back to the
|
|
336
|
+
* backend order.
|
|
337
|
+
*/
|
|
338
|
+
declare function resolveAutoModel(models: string[]): string | null;
|
|
339
|
+
|
|
330
340
|
/** A stored provider API key (BYOK) */
|
|
331
341
|
type StoredProviderKey = {
|
|
332
342
|
apiKey: string;
|
|
333
343
|
keyPrefix: string;
|
|
334
344
|
label?: string;
|
|
335
345
|
};
|
|
346
|
+
type StoredModelPreference = {
|
|
347
|
+
mode: ModelSelectionMode;
|
|
348
|
+
model: string | null;
|
|
349
|
+
};
|
|
336
350
|
/** Global control state (shared across all threads) */
|
|
337
351
|
type ControlState = {
|
|
338
352
|
/** API key for authenticated requests */
|
|
@@ -376,13 +390,19 @@ type ControlContextApi = {
|
|
|
376
390
|
/** Get the current thread's effective app after auth fallback */
|
|
377
391
|
getCurrentThreadApp: () => string;
|
|
378
392
|
/** Select a model for the current thread (updates metadata + calls backend) */
|
|
379
|
-
onModelSelect: (model: string
|
|
393
|
+
onModelSelect: (model: string, options?: {
|
|
394
|
+
mode?: ModelSelectionMode;
|
|
395
|
+
}) => Promise<void>;
|
|
380
396
|
/** Select an app for the current thread (updates metadata only) */
|
|
381
397
|
onAppSelect: (app: string) => void;
|
|
382
398
|
/** Whether the current thread is processing (disables control switching) */
|
|
383
399
|
isProcessing: boolean;
|
|
384
400
|
/** Mark control state as synced (called after chat starts) */
|
|
385
401
|
markControlSynced: () => void;
|
|
402
|
+
/** Sync pending control state to the backend before sending */
|
|
403
|
+
syncCurrentThreadControl: () => Promise<void>;
|
|
404
|
+
/** Build initial control state for new local threads */
|
|
405
|
+
getPreferredThreadControl: () => ThreadControlState;
|
|
386
406
|
/** Get global control state */
|
|
387
407
|
getControlState: () => ControlState;
|
|
388
408
|
/** Subscribe to global state changes */
|
|
@@ -406,4 +426,4 @@ type ControlContextProviderProps = {
|
|
|
406
426
|
};
|
|
407
427
|
declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
408
428
|
|
|
409
|
-
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, RuntimeUserStateProvider, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|
|
429
|
+
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 ModelSelectionMode, type Notification$1 as Notification, type NotificationApi, NotificationContextProvider, type NotificationContextProviderProps, type NotificationContextApi as NotificationContextValue, type NotificationHandlerConfig, type NotificationType, RuntimeUserStateProvider, type SSEStatus, SUPPORTED_CHAINS, type NotificationData as ShowNotificationParams, type StoredModelPreference, type StoredProviderKey, type ThreadContext, ThreadContextProvider, type ThreadControlState, type ThreadMetadata, type UserConfig, UserContextProvider, type WalletHandlerApi, type WalletHandlerConfig, type WalletRequestKind, type WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, resolveAutoModel, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };
|