@dexterai/connect 0.26.4 → 0.29.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/dist/react.d.ts CHANGED
@@ -1,118 +1,8 @@
1
- import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
2
- import { b as CeremonyPhase, o as SignInResult, a as RecoverOutcome, e as ContinueResult, k as PasskeyLoginTokens, C as ConnectVault, d as ConnectError, q as StoredWallet, l as PasskeySignalSupport, n as ResolvedIdentity, g as CreateWalletResult } from './signals-dIHYwlPh.js';
3
- export { m as RecoverVault } from './signals-dIHYwlPh.js';
4
- import { ReactElement, ButtonHTMLAttributes, ReactNode } from 'react';
1
+ import { c as WalletAccountRelationSnapshot, s as DexterControlModel, m as ConnectError, M as SignInResult, q as DexterConnectionIntent, h as AccountSessionInstaller, g as AccountSessionClearer, B as BindingFetch, a4 as PasskeyLoginConfig, o as CreateWalletResult, i as AgentDelegationMode } from './connectionContract-QGRidIHM.js';
2
+ export { C as ConnectVault, p as DexterConnectionCapability, r as DexterConnectionPermissions, t as DexterControlPrimaryAction, u as DexterControlStage, a as RecoverOutcome, y as RecoverVault, W as WalletIdentityProof } from './connectionContract-QGRidIHM.js';
3
+ import { ButtonHTMLAttributes, ReactNode, ReactElement } from 'react';
5
4
 
6
- type ConnectStatus = 'idle' | 'pending' | 'done' | 'error';
7
- interface UseSignInWithDexterConfig {
8
- /** Compatibility-only: omitted or exactly https://api.dexter.cash. */
9
- apiBase?: string;
10
- /** RPC for the connected-chip balance read. Default: Dexter's Helius proxy. */
11
- rpcUrl?: string;
12
- /** Ceremony transport (both verbs). 'auto' (default) = inline on dexter.cash,
13
- * popup anywhere else. Exposed so tests/staging can force a leg —
14
- * CreateWalletPanel already had this knob; the sign-in surface was the odd
15
- * one out. */
16
- transport?: 'auto' | 'popup' | 'inline';
17
- /** Hosted ceremony page for the popup transport. Default dexter.cash/connect. */
18
- connectHost?: string;
19
- /** Chrome-149+ immediate UI mode for the wallet-only verb: instant fast-fail
20
- * when this device holds no passkey. Ignored by signIn(). */
21
- preferImmediate?: boolean;
22
- }
23
- interface UseSignInWithDexter {
24
- status: ConnectStatus;
25
- /** Live ceremony phase while status==='pending' (challenge → passkey →
26
- * verifying); null otherwise. Drives the button's "connecting steps". */
27
- phase: CeremonyPhase | null;
28
- isVaultConnected: boolean;
29
- /** Run the ceremony. Resolves with the result; throws ConnectError on failure
30
- * (error is also captured in `error` + `status==='error'` for declarative UI). */
31
- signIn: () => Promise<SignInResult>;
32
- /** Wallet-only sign-in (P0c): re-points this browser at an existing wallet,
33
- * mints NO session. Returns a discriminated outcome — cancel is a normal
34
- * result, never a throw. Identity surfaces (useIdentity/useDexterWallet)
35
- * light up via the wallet store; `session`/`vault` here stay null. Fire on
36
- * tap only — never on mount (iOS gesture rule). */
37
- recover: () => Promise<RecoverOutcome>;
38
- /** One-button register-or-sign-in (keychain-first; see continueWithDexter).
39
- * Terminal kinds update session/vault state; needs_create / needs_choice /
40
- * cancelled return with status back at idle for the caller to route. */
41
- continueWith: () => Promise<ContinueResult>;
42
- /** Last recover outcome; null until recover() settles. */
43
- recovered: RecoverOutcome | null;
44
- disconnect: () => void;
45
- session: PasskeyLoginTokens | null;
46
- vault: ConnectVault | null;
47
- /** Dexter Wallet address (swigAddress, base58). */
48
- vaultAddress: string | null;
49
- vaultPda: string | null;
50
- credentialId: string | null;
51
- /** Guest passkey signer for authorizing spends / opening x402 tabs. null until
52
- * a vault is connected. Drive it via `passkeySigner.signOperation(op)`. */
53
- passkeySigner: PasskeySignerWithPublicKey | null;
54
- /** USD available. number once read; null = unknown → chip shows wallet only. */
55
- usdcBalance: number | null;
56
- refreshBalance: () => Promise<void>;
57
- error: ConnectError | null;
58
- }
59
- /**
60
- * "Sign in with Dexter" — React surface over the login ceremony.
61
- *
62
- * Returns the Supabase session (always) plus the vault identity + USD balance
63
- * (vault-review's login payload is live). dexter.cash login needs only
64
- * `session`; the vault fields + balance drive the connected chip. The
65
- * passkeySigner (for opening x402 tabs — dexter-agents) lands next, on the
66
- * anon ServerPolicy bridge over the now-live publicKey/credentialId.
67
- */
68
- declare function useSignInWithDexter(config?: UseSignInWithDexterConfig): UseSignInWithDexter;
69
-
70
- interface SignInWithDexterProps extends UseSignInWithDexterConfig {
71
- /** 'signin' (default) = full sign-in minting the account session.
72
- * 'recover' = wallet-only: re-points this browser at an existing wallet and
73
- * mints NOTHING else (the wallet IS the sign-in). After a successful
74
- * recover the element renders null — identity display belongs to
75
- * DexterWalletChip/useIdentity, which light up via the wallet store.
76
- * 'continue' = the one-button register-or-sign-in (keychain-first): the
77
- * hosted popup decides sign-in vs create; every settled outcome fires
78
- * onContinue. */
79
- mode?: 'signin' | 'recover' | 'continue';
80
- /** Fired with the result the moment sign-in completes. */
81
- onSuccess?: (result: SignInResult) => void;
82
- /** Recover mode: fired with EVERY settled outcome (ok, no_credential,
83
- * cancelled, error) — the single channel; onError is not used in this mode.
84
- * Branch on `reason`: no_credential → offer create; cancelled → stay silent. */
85
- onRecovered?: (outcome: RecoverOutcome) => void;
86
- /** Continue mode: fired with EVERY settled ContinueResult (signin, create,
87
- * needs_create, needs_choice, cancelled) — the single channel for routing.
88
- * Real ceremony failures still go to onError. */
89
- onContinue?: (result: ContinueResult) => void;
90
- /** Fired with the typed error if the ceremony fails. */
91
- onError?: (error: ConnectError) => void;
92
- /** Button label when signed out. Default "Sign in with Dexter". */
93
- label?: string;
94
- /** 'primary' = filled ember (default), 'secondary' = outline. */
95
- variant?: 'primary' | 'secondary';
96
- /** Full-width button. */
97
- block?: boolean;
98
- /** 'md' (default) or 'sm' — the mini header variant of the button. */
99
- size?: 'md' | 'sm';
100
- /** Extra className composed after the brand classes. Prefer overriding the
101
- * `--dx-*` CSS variables for theming. */
102
- className?: string;
103
- /** Render the built-in connected chip (wallet + balance). Default true. */
104
- showConnectedChip?: boolean;
105
- }
106
- /**
107
- * Turnkey "Sign in with Dexter" element. Signed out → the branded DexterButton
108
- * (hover / focus / active / loading states, themeable via --dx-* CSS vars);
109
- * signed in → a compact chip with the Dexter Wallet address + USD available.
110
- * Wraps useSignInWithDexter; for the wallet CREATE flow use <DexterButton>
111
- * wired to your create action. Brand voice: no emojis, "unlock" banned.
112
- */
113
- declare function SignInWithDexter(props: SignInWithDexterProps): ReactElement | null;
114
-
115
- /** The Dexter passkey mark — the brand glyph carried on the branded button. */
5
+ /** The Dexter passkey mark carried on the branded button. */
116
6
  declare function DexterMark(): ReactElement;
117
7
  interface DexterButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'disabled' | 'className' | 'type'> {
118
8
  /** Button content (e.g. "Sign in with Dexter", "Create your Dexter Wallet"). */
@@ -128,7 +18,7 @@ interface DexterButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>
128
18
  block?: boolean;
129
19
  /** 'md' (default) = the standard CTA. 'sm' = the mini header/chip-row
130
20
  * variant: tighter padding, smaller type and mark. Same states, same
131
- * theming — never hand-shrink the md button with a className. */
21
+ * theming. Never hand-shrink the md button with a className. */
132
22
  size?: 'md' | 'sm';
133
23
  /** Render the Dexter mark before the children. Default true. */
134
24
  withMark?: boolean;
@@ -141,85 +31,68 @@ interface DexterButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>
141
31
  /** The branded Dexter button. Wire it to any action via `onClick`. */
142
32
  declare function DexterButton(props: DexterButtonProps): ReactElement;
143
33
 
144
- interface UseDexterWallet {
145
- /** Active wallet handle, or null if this browser has no active wallet. */
146
- activeHandle: string | null;
147
- /** The active wallet's roster entry (handle + label + credentialId), or
148
- * null. `activeWallet.label` is the wallet's human name — identity is
149
- * first-class, so display surfaces read it here instead of re-fetching. */
150
- activeWallet: StoredWallet | null;
151
- /** Known wallets on this browser, most-recently-used first. */
152
- wallets: StoredWallet[];
153
- /** What the WebAuthn Signal API supports in THIS browser (rename / prune). */
154
- support: PasskeySignalSupport;
155
- /**
156
- * Eject the active wallet — "switch / start fresh". Clears the local binding
157
- * and, where supported, prunes the old passkey from the OS manager so it
158
- * disappears from the user's list. `{ forget: true }` also drops it from the
159
- * roster.
160
- */
161
- eject: (opts?: {
162
- forget?: boolean;
163
- }) => void;
164
- /** Switch the active wallet to a known handle. No-op if unknown. */
165
- switchTo: (handle: string) => boolean;
166
- /** Record/activate a handle (after enroll or recover). Prefer over writing
167
- * localStorage by hand so the roster + subscribers stay correct. */
168
- setActive: (handle: string, label?: string, credentialId?: string) => void;
169
- /**
170
- * Rename the ACTIVE passkey in the OS keychain (post-creation). Returns true
171
- * if the browser supported it and the signal fired; false otherwise (the
172
- * keychain entry is then just left as-is).
173
- */
174
- rename: (name: string, displayName?: string) => Promise<boolean>;
175
- }
176
- declare function useDexterWallet(): UseDexterWallet;
34
+ type DexterAccountSession = {
35
+ readonly status: 'loading';
36
+ } | {
37
+ readonly status: 'signed_out';
38
+ } | {
39
+ readonly status: 'authenticated';
40
+ readonly accessToken: string;
41
+ };
177
42
 
178
- interface DexterWalletChipProps {
179
- /** Connected (a wallet/account is present) → avatar + label; else signed-out label only. */
180
- connected: boolean;
181
- /** What to show: account name, wallet label, or the signed-out prompt (e.g. "Log in"). */
182
- label: string;
183
- /** Avatar image (e.g. a linked X avatar); falls back to the initial. */
184
- avatarUrl?: string | null;
185
- /** Single-character avatar fallback (defaults to the first letter of `label`). */
186
- avatarInitial?: string;
187
- onClick?: () => void;
188
- /** Extra className composed after the brand classes. */
189
- className?: string;
190
- /** Reflected to aria-expanded (when the chip toggles a menu). */
191
- ariaExpanded?: boolean;
43
+ type DexterConnectionOperation = 'idle' | 'connecting' | 'disconnecting' | 'removing';
44
+ declare const REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION: "remove-dexter-from-device";
45
+ type RemoveDexterFromDeviceConfirmation = typeof REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION;
46
+ interface RemoveDexterFromDeviceResult {
47
+ readonly removedFromRoster: boolean;
48
+ readonly passkeyPruned: boolean;
192
49
  }
193
- /** The branded wallet/account chip. Wire it to open your menu via `onClick`. */
194
- declare function DexterWalletChip(props: DexterWalletChipProps): ReactElement;
195
-
196
- interface DexterWalletMenuProps {
197
- /** The wallet's display name (nickname, else "Dexter Wallet"). */
198
- walletLabel: string;
199
- /** Avatar initial (defaults to the first letter of walletLabel). */
200
- avatarInitial?: string;
201
- /** "Manage wallet" → the consumer's wallet page. Row hidden if omitted. */
202
- onManageWallet?: () => void;
203
- /** Eject row → the consumer ejects/resets (guard + perform on its side). Row hidden if omitted. */
204
- onStartFresh?: () => void;
205
- /** Label for the eject/reset row. Default "Eject wallet". */
206
- startFreshLabel?: string;
207
- /** Sign-in/save UI revealed when "Save your wallet" is tapped (e.g. <SignInWithDexter/>). Row hidden if omitted. */
208
- saveSlot?: ReactNode;
209
- /** Short hint shown above the save UI. */
210
- saveHint?: string;
211
- /** Extra className composed after the brand classes. */
212
- className?: string;
50
+ interface DexterIdentityView {
51
+ readonly kind: WalletAccountRelationSnapshot['relation'];
52
+ readonly userHandle: string | null;
53
+ readonly walletLabel: string | null;
54
+ readonly hasPasskeyVault: boolean;
55
+ readonly hasAccount: boolean;
56
+ readonly hasWallet: boolean;
57
+ readonly hasAccountAccess: boolean;
58
+ readonly quarantined: boolean;
213
59
  }
214
- /** The branded wallet dropdown. */
215
- declare function DexterWalletMenu(props: DexterWalletMenuProps): ReactElement;
216
-
217
- interface UseIdentityConfig {
218
- /** The account session token (e.g. a Supabase access_token), or null when the
219
- * user has no account session. The SDK is auth-agnostic — pass your own. */
220
- accountToken: string | null;
60
+ interface DexterWalletView {
61
+ readonly userHandle: string;
62
+ readonly label: string | null;
63
+ readonly vaultPda: string | null;
64
+ readonly swigAddress: string | null;
65
+ readonly walletAddress: string | null;
66
+ readonly receiveAddress: string | null;
67
+ readonly network: string | null;
68
+ }
69
+ interface UseDexterConnectionConfig {
70
+ readonly intent: DexterConnectionIntent;
71
+ readonly accountSession: DexterAccountSession;
72
+ readonly installAccountSession: AccountSessionInstaller;
73
+ readonly clearAccountSession: AccountSessionClearer;
74
+ readonly apiBase?: string;
75
+ readonly fetch?: BindingFetch;
76
+ readonly passkey?: Omit<PasskeyLoginConfig, 'apiBase' | 'walletStore'>;
77
+ }
78
+ interface UseDexterConnection {
79
+ readonly model: DexterControlModel;
80
+ readonly identity: DexterIdentityView;
81
+ readonly relation: WalletAccountRelationSnapshot;
82
+ readonly operation: DexterConnectionOperation;
83
+ readonly activeWallet: DexterWalletView | null;
84
+ readonly error: ConnectError | null;
85
+ connect(): Promise<SignInResult>;
86
+ useAnotherDexterWallet(): Promise<SignInResult>;
87
+ disconnectDexter(): Promise<boolean>;
88
+ removeFromThisDevice(confirmation: RemoveDexterFromDeviceConfirmation): Promise<RemoveDexterFromDeviceResult>;
89
+ retry(): Promise<void>;
221
90
  }
222
- declare function useIdentity({ accountToken }: UseIdentityConfig): ResolvedIdentity;
91
+ /**
92
+ * Canonical React control for one active Dexter identity and Wallet.
93
+ * Consumers supply their account-session adapter and render from `model`.
94
+ */
95
+ declare function useDexterConnection(config: UseDexterConnectionConfig): UseDexterConnection;
223
96
 
224
97
  interface AllowanceChipsProps {
225
98
  /** The authored USD amount as a raw string, or null when nothing is chosen.
@@ -247,6 +120,11 @@ interface CreateWalletPanelProps {
247
120
  transport?: 'auto' | 'popup' | 'inline';
248
121
  /** Render the optional "Name your wallet" field. Default true. */
249
122
  showName?: boolean;
123
+ /**
124
+ * `deferred` is the default and omits the agent-allowance UI.
125
+ * `configure-now` is the explicit compatibility flow for an allowance.
126
+ */
127
+ agentDelegation?: AgentDelegationMode;
250
128
  /** Extra className composed after the brand classes. */
251
129
  className?: string;
252
130
  }
@@ -278,4 +156,4 @@ declare function hermesOpenUrl(name: string): string;
278
156
  declare function claudeCodeInstallCommand(name: string, mcpUrl: string): string;
279
157
  declare function AppInstallButtons(props: AppInstallButtonsProps): ReactElement;
280
158
 
281
- export { AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, type ConnectStatus, CreateWalletPanel, type CreateWalletPanelProps, DexterButton, type DexterButtonProps, DexterMark, DexterWalletChip, type DexterWalletChipProps, DexterWalletMenu, type DexterWalletMenuProps, type InstallApp, RecoverOutcome, SignInWithDexter, type SignInWithDexterProps, type UseDexterWallet, type UseIdentityConfig, type UseSignInWithDexter, type UseSignInWithDexterConfig, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterWallet, useIdentity, useSignInWithDexter, vscodeInstallUrl };
159
+ export { AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, CreateWalletPanel, type CreateWalletPanelProps, CreateWalletResult, type DexterAccountSession, DexterButton, type DexterButtonProps, DexterConnectionIntent, type DexterConnectionOperation, DexterControlModel, type DexterIdentityView, DexterMark, type DexterWalletView, type InstallApp, REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION, type RemoveDexterFromDeviceConfirmation, type RemoveDexterFromDeviceResult, SignInResult, type UseDexterConnection, type UseDexterConnectionConfig, WalletAccountRelationSnapshot, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterConnection, vscodeInstallUrl };