@aomi-labs/react 0.3.17 → 0.3.18

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.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AomiClientOptions, 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, NativeWalletExecutionPolicy, NativeWalletSponsorship, SponsorshipPaymasterServiceContext, UserState, WalletCapabilities, 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, WalletRequestKind, WalletRequestResult, WalletSolanaSignPayload, 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';
@@ -145,20 +145,31 @@ type NotificationContextProviderProps = {
145
145
  };
146
146
  declare function NotificationContextProvider({ children, }: NotificationContextProviderProps): react_jsx_runtime.JSX.Element;
147
147
 
148
- type WalletRequestKind = "transaction" | "eip712_sign";
149
148
  type WalletRequestStatus = "pending" | "processing";
150
149
  type WalletHandlerConfig = {
151
150
  /** Get the ClientSession for the current thread. */
152
151
  getSession: () => Session | undefined;
153
152
  };
154
153
  type WalletHandlerApi = {
155
- /** All queued wallet requests (tx + eip712) */
154
+ /**
155
+ * All queued wallet requests across every supported kind: EVM txs
156
+ * (`kind: "transaction"`), EIP-712 signs (`kind: "eip712_sign"`), and
157
+ * Solana signs (`kind: "solana_sign"`). Consumers should narrow on
158
+ * `request.kind` before reading `request.payload` — the discriminated
159
+ * union auto-narrows the payload type.
160
+ */
156
161
  pendingRequests: WalletRequest[];
157
162
  /** Replace pending requests with the session's authoritative snapshot. */
158
163
  setRequests: (requests: WalletRequest[]) => void;
159
164
  /** Mark a request as in-flight so it is not replayed while awaiting backend ack. */
160
165
  startRequest: (id: string) => void;
161
- /** Complete a request successfully — sends response to backend via ClientSession */
166
+ /**
167
+ * Complete a request successfully — sends the response wire event to
168
+ * the backend via ClientSession. The `result.kind` discriminator must
169
+ * match the originating request's kind (e.g. `{ kind: "solana_sign",
170
+ * signedTx: "..." }` for a Solana request); ClientSession runtime-checks
171
+ * this and throws on mismatch.
172
+ */
162
173
  resolveRequest: (id: string, result: WalletRequestResult) => Promise<void>;
163
174
  /** Fail a request — sends error to backend via ClientSession */
164
175
  rejectRequest: (id: string, error?: string) => Promise<void>;
@@ -430,4 +441,4 @@ type ControlContextProviderProps = {
430
441
  };
431
442
  declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
432
443
 
433
- 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 };
444
+ 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 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 { AomiClientOptions, 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, NativeWalletExecutionPolicy, NativeWalletSponsorship, SponsorshipPaymasterServiceContext, UserState, WalletCapabilities, 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, WalletRequestKind, WalletRequestResult, WalletSolanaSignPayload, 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';
@@ -145,20 +145,31 @@ type NotificationContextProviderProps = {
145
145
  };
146
146
  declare function NotificationContextProvider({ children, }: NotificationContextProviderProps): react_jsx_runtime.JSX.Element;
147
147
 
148
- type WalletRequestKind = "transaction" | "eip712_sign";
149
148
  type WalletRequestStatus = "pending" | "processing";
150
149
  type WalletHandlerConfig = {
151
150
  /** Get the ClientSession for the current thread. */
152
151
  getSession: () => Session | undefined;
153
152
  };
154
153
  type WalletHandlerApi = {
155
- /** All queued wallet requests (tx + eip712) */
154
+ /**
155
+ * All queued wallet requests across every supported kind: EVM txs
156
+ * (`kind: "transaction"`), EIP-712 signs (`kind: "eip712_sign"`), and
157
+ * Solana signs (`kind: "solana_sign"`). Consumers should narrow on
158
+ * `request.kind` before reading `request.payload` — the discriminated
159
+ * union auto-narrows the payload type.
160
+ */
156
161
  pendingRequests: WalletRequest[];
157
162
  /** Replace pending requests with the session's authoritative snapshot. */
158
163
  setRequests: (requests: WalletRequest[]) => void;
159
164
  /** Mark a request as in-flight so it is not replayed while awaiting backend ack. */
160
165
  startRequest: (id: string) => void;
161
- /** Complete a request successfully — sends response to backend via ClientSession */
166
+ /**
167
+ * Complete a request successfully — sends the response wire event to
168
+ * the backend via ClientSession. The `result.kind` discriminator must
169
+ * match the originating request's kind (e.g. `{ kind: "solana_sign",
170
+ * signedTx: "..." }` for a Solana request); ClientSession runtime-checks
171
+ * this and throws on mismatch.
172
+ */
162
173
  resolveRequest: (id: string, result: WalletRequestResult) => Promise<void>;
163
174
  /** Fail a request — sends error to backend via ClientSession */
164
175
  rejectRequest: (id: string, error?: string) => Promise<void>;
@@ -430,4 +441,4 @@ type ControlContextProviderProps = {
430
441
  };
431
442
  declare function ControlContextProvider({ children, aomiClient, sessionId, publicKey, getThreadMetadata, updateThreadMetadata, }: ControlContextProviderProps): react_jsx_runtime.JSX.Element;
432
443
 
433
- 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 };
444
+ 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 WalletRequestStatus, cn, formatAddress, getChainInfo, getNetworkName, initThreadControl, resolveAutoModel, useAomiRuntime, useControl, useCurrentThreadMessages, useCurrentThreadMetadata, useEventContext, useNotification, useNotificationHandler, useThreadContext, useUser, useWalletHandler };