@dexterai/connect 0.25.0 → 0.25.2

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.
@@ -858,6 +858,7 @@ async function syncAcceptedPasskeys(args) {
858
858
 
859
859
  export {
860
860
  ConnectError,
861
+ shouldUsePopup,
861
862
  getActiveHandle,
862
863
  setActiveHandle,
863
864
  getCredentialId,
@@ -7,7 +7,7 @@ var BUTTON_CSS = `
7
7
  @keyframes dx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
8
8
  .dx-btn{
9
9
  position:relative; display:inline-flex; align-items:center; justify-content:center; gap:10px;
10
- padding:11px 22px; border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
10
+ min-height:48px; padding:11px 22px; border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
11
11
  border-radius:var(--dx-radius,0px);
12
12
  background:linear-gradient(135deg,var(--dx-ember,#f26c18),var(--dx-ember-2,#ba3a00));
13
13
  color:var(--dx-fg,#fff4ea); font:inherit; font-weight:600; font-size:.78rem; letter-spacing:.12em;
@@ -44,7 +44,7 @@ var BUTTON_CSS = `
44
44
  .dx-btn--danger:focus-visible{ box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-danger,#b3261e) 38%,transparent); }
45
45
  .dx-btn--block{ width:100%; }
46
46
  .dx-btn--sm{
47
- padding:7px 14px; gap:7px; font-size:.66rem; letter-spacing:.1em;
47
+ min-height:40px; padding:7px 14px; gap:7px; font-size:.66rem; letter-spacing:.1em;
48
48
  box-shadow:0 8px 16px color-mix(in srgb,var(--dx-ember,#f26c18) 18%,transparent);
49
49
  }
50
50
  .dx-btn--sm:hover{ box-shadow:0 12px 22px color-mix(in srgb,var(--dx-ember,#f26c18) 26%,transparent); }
@@ -62,6 +62,11 @@ var BUTTON_CSS = `
62
62
  .dx-chip__bal{ font-weight:600; opacity:.85; }
63
63
  .dx-chip__x{ margin-left:2px; border:none; background:transparent; color:inherit; cursor:pointer; font-size:16px; line-height:1; opacity:.6; }
64
64
  .dx-chip__x:hover{ opacity:1; }
65
+ @media (prefers-reduced-motion:reduce){
66
+ .dx-btn{ transition:none; }
67
+ .dx-btn:hover,.dx-btn:active{ transform:none; }
68
+ .dx-btn__spin,.dx-btn__doing{ animation:none; }
69
+ }
65
70
  `;
66
71
  function ensureDexterButtonStyles() {
67
72
  if (typeof document === "undefined") return;
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  switchWallet,
27
27
  syncAcceptedPasskeys,
28
28
  usdToAtomic
29
- } from "./chunk-VGERNAQ3.js";
29
+ } from "./chunk-4AJ5BYFW.js";
30
30
 
31
31
  // src/agentSpend.ts
32
32
  import { PublicKey } from "@solana/web3.js";
package/dist/react.d.ts CHANGED
@@ -230,6 +230,8 @@ interface AllowanceChipsProps {
230
230
  onChange: (usd: string | null) => void;
231
231
  /** Extra className composed after the brand classes. */
232
232
  className?: string;
233
+ /** Disable every choice and the custom amount field. */
234
+ disabled?: boolean;
233
235
  }
234
236
  /** The consent-at-birth allowance chips. */
235
237
  declare function AllowanceChips(props: AllowanceChipsProps): ReactElement;
@@ -268,7 +270,8 @@ interface AppInstallButtonsProps {
268
270
  declare function cursorInstallUrl(name: string, mcpUrl: string): string;
269
271
  declare function vscodeInstallUrl(name: string, mcpUrl: string): string;
270
272
  declare function hermesInstallCommand(name: string, mcpUrl: string): string;
273
+ declare function hermesOpenUrl(name: string): string;
271
274
  declare function claudeCodeInstallCommand(name: string, mcpUrl: string): string;
272
275
  declare function AppInstallButtons(props: AppInstallButtonsProps): ReactElement;
273
276
 
274
- 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, claudeCodeInstallCommand, cursorInstallUrl, hermesInstallCommand, useDexterWallet, useIdentity, useSignInWithDexter, vscodeInstallUrl };
277
+ 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, claudeCodeInstallCommand, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterWallet, useIdentity, useSignInWithDexter, vscodeInstallUrl };
package/dist/react.js CHANGED
@@ -16,15 +16,16 @@ import {
16
16
  renamePasskey,
17
17
  resolveIdentity,
18
18
  setActiveHandle,
19
+ shouldUsePopup,
19
20
  subscribe,
20
21
  switchWallet
21
- } from "./chunk-VGERNAQ3.js";
22
+ } from "./chunk-4AJ5BYFW.js";
22
23
  import {
23
24
  DexterButton,
24
25
  DexterMark,
25
26
  cx,
26
27
  ensureDexterButtonStyles
27
- } from "./chunk-PW33ZOCP.js";
28
+ } from "./chunk-TLCQSAE5.js";
28
29
 
29
30
  // src/useSignInWithDexter.ts
30
31
  import { useCallback, useEffect, useMemo, useState } from "react";
@@ -471,16 +472,28 @@ function useIdentity({ accountToken }) {
471
472
  }
472
473
 
473
474
  // src/AllowanceChips.tsx
474
- import { useEffect as useEffect6, useState as useState4 } from "react";
475
+ import { useEffect as useEffect6, useId, useState as useState4 } from "react";
475
476
 
476
477
  // src/consentStyles.ts
477
478
  var STYLE_ID2 = "dexter-connect-consent-styles";
478
479
  var CONSENT_CSS = `
479
480
  .dx-allow{
480
- display:flex; flex-wrap:wrap; gap:8px; align-items:center;
481
+ display:flex; flex-wrap:wrap; gap:8px; align-items:center; min-width:0;
482
+ margin:0; padding:0; border:0;
483
+ }
484
+ .dx-sr-only{
485
+ position:absolute; width:1px; height:1px; padding:0; margin:-1px;
486
+ overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
487
+ }
488
+ .dx-allow__option{
489
+ display:inline-flex; min-width:0;
490
+ }
491
+ .dx-allow__radio{
492
+ position:absolute; width:1px; height:1px; margin:-1px; opacity:0;
493
+ pointer-events:none;
481
494
  }
482
495
  .dx-allow__chip{
483
- display:inline-flex; align-items:center; justify-content:center; padding:9px 15px;
496
+ display:inline-flex; min-height:44px; align-items:center; justify-content:center; padding:9px 15px;
484
497
  font:inherit; font-weight:600; font-size:.78rem; letter-spacing:.12em; text-transform:uppercase;
485
498
  font-variant-numeric:tabular-nums; cursor:pointer; background:transparent; color:inherit;
486
499
  border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 45%,transparent);
@@ -488,14 +501,17 @@ var CONSENT_CSS = `
488
501
  transition:filter .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
489
502
  }
490
503
  .dx-allow__chip:hover{ border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 70%,transparent); filter:brightness(1.05); }
491
- .dx-allow__chip:focus-visible{ outline:none; box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 34%,transparent); }
492
- .dx-allow__chip--active{
504
+ .dx-allow__radio:focus-visible + .dx-allow__chip{
505
+ outline:none; box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 34%,transparent);
506
+ }
507
+ .dx-allow__radio:checked + .dx-allow__chip{
493
508
  background:linear-gradient(135deg,var(--dx-ember,#f26c18),var(--dx-ember-2,#ba3a00));
494
509
  color:var(--dx-fg,#fff4ea); border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
495
510
  box-shadow:0 10px 22px color-mix(in srgb,var(--dx-ember,#f26c18) 22%,transparent);
496
511
  }
512
+ .dx-allow__radio:disabled + .dx-allow__chip{ cursor:default; opacity:.58; }
497
513
  .dx-allow__input{
498
- flex:1 1 130px; min-width:120px; padding:9px 13px; font:inherit; font-size:.9rem;
514
+ flex:1 1 130px; min-width:120px; min-height:44px; padding:9px 13px; font:inherit; font-size:1rem;
499
515
  font-variant-numeric:tabular-nums; color:inherit; background:transparent;
500
516
  border:1px solid color-mix(in srgb,var(--dx-ember,#f26c18) 45%,transparent);
501
517
  border-radius:var(--dx-radius,0px); -webkit-tap-highlight-color:transparent;
@@ -513,7 +529,7 @@ var CONSENT_CSS = `
513
529
  .dx-cwp__field{ display:flex; flex-direction:column; gap:8px; }
514
530
  .dx-cwp__label{ font-size:.7rem; font-weight:700; letter-spacing:.14em; text-transform:uppercase; opacity:.62; }
515
531
  .dx-cwp__name{
516
- padding:10px 13px; font:inherit; font-size:.95rem; color:inherit; background:transparent;
532
+ min-height:48px; padding:10px 13px; font:inherit; font-size:1rem; color:inherit; background:transparent;
517
533
  border:1px solid color-mix(in srgb,currentColor 22%,transparent); border-radius:var(--dx-radius,0px);
518
534
  -webkit-tap-highlight-color:transparent; transition:border-color .16s ease, box-shadow .16s ease;
519
535
  }
@@ -522,8 +538,19 @@ var CONSENT_CSS = `
522
538
  box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 26%,transparent);
523
539
  }
524
540
  .dx-cwp__name::placeholder{ color:currentColor; opacity:.42; }
541
+ .dx-cwp__hosted{ margin:0; font-size:.9rem; line-height:1.55; opacity:.82; }
525
542
  .dx-cwp__fine{ font-size:.76rem; line-height:1.5; opacity:.66; }
526
543
  .dx-cwp__err{ font-size:.78rem; line-height:1.45; color:var(--dx-danger,#e5552e); }
544
+ .dx-cwp__status{ min-height:1.25rem; margin:0; font-size:.78rem; line-height:1.45; opacity:.72; }
545
+ @media (max-width:380px){
546
+ .dx-allow__option{ flex:1 1 calc(50% - 4px); }
547
+ .dx-allow__chip{ width:100%; }
548
+ .dx-allow__input{ flex-basis:100%; }
549
+ }
550
+ @media (prefers-reduced-motion:reduce){
551
+ .dx-allow__chip,.dx-allow__input,.dx-cwp__name{ transition:none; }
552
+ .dx-allow__chip:hover{ filter:none; }
553
+ }
527
554
  `;
528
555
  function ensureConsentStyles() {
529
556
  if (typeof document === "undefined") return;
@@ -545,61 +572,64 @@ var PRESETS = [
545
572
  var PRESET_NUMS = PRESETS.map((p) => p.num);
546
573
  var isPreset = (v) => v !== null && PRESET_NUMS.includes(v);
547
574
  function AllowanceChips(props) {
548
- const { value, onChange, className } = props;
575
+ const { value, onChange, className, disabled = false } = props;
549
576
  useEffect6(ensureConsentStyles, []);
550
577
  const [customOpen, setCustomOpen] = useState4(false);
578
+ const groupName = useId();
551
579
  const customActive = customOpen || value !== null && !isPreset(value);
552
580
  const selectPreset = (num) => {
581
+ if (disabled) return;
553
582
  setCustomOpen(false);
554
583
  onChange(num);
555
584
  };
556
585
  const selectCustom = () => {
586
+ if (disabled) return;
557
587
  setCustomOpen(true);
558
588
  onChange(isPreset(value) ? null : value);
559
589
  };
560
- const onChipKeyDown = (e, select) => {
561
- if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
562
- e.preventDefault();
563
- select();
564
- }
565
- };
566
- return /* @__PURE__ */ jsxs4("div", { className: cx("dx-allow", className), role: "radiogroup", "aria-label": "Monthly agent allowance", children: [
590
+ return /* @__PURE__ */ jsxs4("fieldset", { className: cx("dx-allow", className), disabled, children: [
591
+ /* @__PURE__ */ jsx4("legend", { className: "dx-sr-only", children: "Monthly agent allowance" }),
567
592
  PRESETS.map(({ label, num }) => {
568
593
  const checked = !customActive && value === num;
569
- return /* @__PURE__ */ jsx4(
570
- "div",
571
- {
572
- role: "radio",
573
- "aria-checked": checked,
574
- tabIndex: 0,
575
- className: cx("dx-allow__chip", checked && "dx-allow__chip--active"),
576
- onClick: () => selectPreset(num),
577
- onKeyDown: (e) => onChipKeyDown(e, () => selectPreset(num)),
578
- children: label
579
- },
580
- num
581
- );
594
+ return /* @__PURE__ */ jsxs4("label", { className: "dx-allow__option", children: [
595
+ /* @__PURE__ */ jsx4(
596
+ "input",
597
+ {
598
+ className: "dx-allow__radio",
599
+ type: "radio",
600
+ name: groupName,
601
+ value: num,
602
+ checked,
603
+ onChange: () => selectPreset(num)
604
+ }
605
+ ),
606
+ /* @__PURE__ */ jsx4("span", { className: "dx-allow__chip", children: label })
607
+ ] }, num);
582
608
  }),
583
- /* @__PURE__ */ jsx4(
584
- "div",
585
- {
586
- role: "radio",
587
- "aria-checked": customActive,
588
- tabIndex: 0,
589
- className: cx("dx-allow__chip", customActive && "dx-allow__chip--active"),
590
- onClick: selectCustom,
591
- onKeyDown: (e) => onChipKeyDown(e, selectCustom),
592
- children: "Custom"
593
- }
594
- ),
609
+ /* @__PURE__ */ jsxs4("label", { className: "dx-allow__option", children: [
610
+ /* @__PURE__ */ jsx4(
611
+ "input",
612
+ {
613
+ className: "dx-allow__radio",
614
+ type: "radio",
615
+ name: groupName,
616
+ value: "custom",
617
+ checked: customActive,
618
+ onChange: selectCustom
619
+ }
620
+ ),
621
+ /* @__PURE__ */ jsx4("span", { className: "dx-allow__chip", children: "Custom" })
622
+ ] }),
595
623
  customActive && /* @__PURE__ */ jsx4(
596
624
  "input",
597
625
  {
598
626
  className: "dx-allow__input",
627
+ id: `${groupName}-custom`,
599
628
  inputMode: "decimal",
600
629
  placeholder: "$ amount",
601
630
  "aria-label": "Custom monthly allowance in USD",
602
631
  value: value ?? "",
632
+ disabled,
603
633
  autoFocus: true,
604
634
  onChange: (e) => onChange(e.target.value)
605
635
  }
@@ -608,29 +638,38 @@ function AllowanceChips(props) {
608
638
  }
609
639
 
610
640
  // src/CreateWalletPanel.tsx
611
- import { useEffect as useEffect7, useState as useState5 } from "react";
612
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
613
- var FINE_PRINT = "Agents can never spend past it, and you can revoke anytime.";
641
+ import { useEffect as useEffect7, useId as useId2, useState as useState5 } from "react";
642
+ import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
643
+ var FINE_PRINT = "This is the wallet-wide agent allowance. You can revoke it anytime. Starter credit, if available, is separate and never raises this limit.";
614
644
  function CreateWalletPanel(props) {
615
645
  const { onCreated, onError, apiBase, transport, showName = true, className } = props;
616
646
  useEffect7(ensureConsentStyles, []);
617
647
  useEffect7(ensureDexterButtonStyles, []);
648
+ const nameInputId = useId2();
618
649
  const [name, setName] = useState5("");
619
650
  const [value, setValue] = useState5(null);
620
651
  const [running, setRunning] = useState5(false);
621
652
  const [phase, setPhase] = useState5(null);
622
653
  const [error, setError] = useState5(null);
623
- const policy = authoredPolicy(value ?? "");
654
+ const [resolvedTransport, setResolvedTransport] = useState5(
655
+ transport === "inline" ? "inline" : transport === "popup" ? "popup" : "unknown"
656
+ );
657
+ useEffect7(() => {
658
+ setResolvedTransport(shouldUsePopup(transport) ? "popup" : "inline");
659
+ }, [transport]);
660
+ const hosted = resolvedTransport === "popup";
661
+ const policy = resolvedTransport === "inline" ? authoredPolicy(value ?? "") : null;
662
+ const canContinue = hosted || Boolean(policy);
624
663
  const handleCreate = async () => {
625
664
  if (running) return;
626
- if (!policy) return;
665
+ if (resolvedTransport === "unknown" || !hosted && !policy) return;
627
666
  setError(null);
628
667
  setRunning(true);
629
668
  setPhase(null);
630
669
  try {
631
670
  const result = await createWallet({
632
- name: name.trim() || "Dexter Wallet",
633
- spendPolicy: policy,
671
+ name: hosted ? void 0 : name.trim() || "Dexter Wallet",
672
+ spendPolicy: hosted ? void 0 : policy ?? void 0,
634
673
  apiBase,
635
674
  transport,
636
675
  onPhase: setPhase
@@ -646,27 +685,31 @@ function CreateWalletPanel(props) {
646
685
  }
647
686
  };
648
687
  return /* @__PURE__ */ jsxs5("div", { className: cx("dx-cwp", className), children: [
649
- showName && /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
650
- /* @__PURE__ */ jsx5("label", { className: "dx-cwp__label", htmlFor: "dx-cwp-name", children: "Name your wallet" }),
688
+ !hosted && resolvedTransport === "inline" && showName && /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
689
+ /* @__PURE__ */ jsx5("label", { className: "dx-cwp__label", htmlFor: nameInputId, children: "Name your wallet" }),
651
690
  /* @__PURE__ */ jsx5(
652
691
  "input",
653
692
  {
654
- id: "dx-cwp-name",
693
+ id: nameInputId,
655
694
  className: "dx-cwp__name",
656
695
  maxLength: 40,
657
696
  placeholder: "Dexter Wallet",
658
697
  value: name,
659
698
  disabled: running,
699
+ autoComplete: "off",
660
700
  onChange: (e) => setName(e.target.value)
661
701
  }
662
702
  )
663
703
  ] }),
664
- /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
665
- /* @__PURE__ */ jsx5("span", { className: "dx-cwp__label", children: "What agents may spend, per 30 days" }),
666
- /* @__PURE__ */ jsx5(AllowanceChips, { value, onChange: setValue })
667
- ] }),
668
- /* @__PURE__ */ jsx5("p", { className: "dx-cwp__fine", children: FINE_PRINT }),
669
- error && /* @__PURE__ */ jsx5("div", { className: "dx-cwp__err", role: "alert", children: error.message || error.code }),
704
+ hosted ? /* @__PURE__ */ jsx5("p", { className: "dx-cwp__hosted", children: "Dexter will open its secure wallet window. Choose the wallet name and agent allowance there before your passkey creates anything." }) : resolvedTransport === "inline" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
705
+ /* @__PURE__ */ jsxs5("div", { className: "dx-cwp__field", children: [
706
+ /* @__PURE__ */ jsx5("span", { className: "dx-cwp__label", children: "What agents may spend automatically, per 30 days" }),
707
+ /* @__PURE__ */ jsx5(AllowanceChips, { value, onChange: setValue, disabled: running })
708
+ ] }),
709
+ /* @__PURE__ */ jsx5("p", { className: "dx-cwp__fine", children: FINE_PRINT })
710
+ ] }) : null,
711
+ error && /* @__PURE__ */ jsx5("div", { className: "dx-cwp__err", role: "alert", "aria-live": "assertive", children: error.message || error.code }),
712
+ /* @__PURE__ */ jsx5("p", { className: "dx-cwp__status", role: "status", "aria-live": "polite", children: running ? phase ? ceremonyPhaseLabel(phase) : "Starting your passkey\u2026" : resolvedTransport === "unknown" ? "Preparing secure wallet setup\u2026" : hosted ? "Name, allowance, and passkey confirmation happen in the Dexter window." : policy ? "Allowance selected. Your passkey will create and secure the wallet." : "Choose an allowance to continue." }),
670
713
  /* @__PURE__ */ jsx5(
671
714
  DexterButton,
672
715
  {
@@ -674,16 +717,16 @@ function CreateWalletPanel(props) {
674
717
  className: "dx-cwp__cta",
675
718
  loading: running,
676
719
  loadingLabel: phase ? ceremonyPhaseLabel(phase) : "Creating\u2026",
677
- disabled: !policy,
720
+ disabled: !canContinue || resolvedTransport === "unknown",
678
721
  onClick: handleCreate,
679
- children: error ? "Retry" : "Create your Dexter Wallet"
722
+ children: error ? "Retry" : hosted ? "Continue to Dexter Wallet" : "Create your Dexter Wallet"
680
723
  }
681
724
  )
682
725
  ] });
683
726
  }
684
727
 
685
728
  // src/AppInstallButtons.tsx
686
- import { useEffect as useEffect8, useRef, useState as useState6 } from "react";
729
+ import { useEffect as useEffect8, useId as useId3, useState as useState6 } from "react";
687
730
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
688
731
  var STYLE_ID3 = "dexter-connect-appinstall-styles";
689
732
  var APPINSTALL_CSS = `
@@ -691,22 +734,70 @@ var APPINSTALL_CSS = `
691
734
  .dx-appinstall--block{ flex-direction:column; }
692
735
  .dx-appbtn{
693
736
  display:inline-flex; align-items:center; gap:10px;
694
- padding:10px 16px; border:1px solid var(--dx-appbtn-border, rgba(255,255,255,.14));
737
+ min-height:44px; padding:10px 16px; border:1px solid var(--dx-appbtn-border, rgba(255,255,255,.14));
695
738
  border-radius:var(--dx-radius,0px);
696
739
  background:var(--dx-appbtn-bg, rgba(8,8,8,.55));
697
740
  color:var(--dx-appbtn-fg, #f4ece0); font:inherit; font-weight:600; font-size:.84rem;
698
741
  cursor:pointer; text-decoration:none; -webkit-tap-highlight-color:transparent;
699
- transition:border-color .16s ease, background .16s ease, transform .16s ease;
742
+ transition:border-color .1s ease-out, background-color .1s ease-out, transform .1s ease-out;
743
+ }
744
+ .dx-appbtn:active{ transform:translateY(1px); }
745
+ .dx-appbtn:disabled{ cursor:wait; opacity:.72; transform:none; }
746
+ .dx-appbtn:focus-visible{
747
+ outline:2px solid var(--dx-ember,#f26c18); outline-offset:3px;
700
748
  }
701
- .dx-appbtn:hover{ border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent); transform:translateY(-1px); }
702
- .dx-appbtn:active{ transform:translateY(0); }
703
- .dx-appbtn:focus-visible{ outline:none; box-shadow:0 0 0 3px color-mix(in srgb,var(--dx-ember,#f26c18) 38%,transparent); }
704
749
  .dx-appbtn--block{ width:100%; justify-content:flex-start; }
705
750
  .dx-appbtn__logo{
706
751
  width:22px; height:22px; display:block; flex:none; box-sizing:border-box;
707
752
  background:#fff; padding:3px; border-radius:var(--dx-radius,0px);
708
753
  }
709
754
  .dx-appbtn__copied{ color:var(--dx-ember,#f26c18); }
755
+ .dx-appinstall__notice{
756
+ flex-basis:100%; display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px;
757
+ color:var(--dx-appbtn-fg,#f4ece0); font:inherit; font-size:.82rem; line-height:1.45;
758
+ }
759
+ .dx-appinstall__notice p{ margin:0; }
760
+ .dx-appinstall__open{
761
+ display:inline-flex; align-items:center; min-height:44px; padding:0 10px;
762
+ color:var(--dx-ember,#f26c18); font-weight:700; text-underline-offset:3px;
763
+ }
764
+ .dx-appinstall__open:focus-visible{
765
+ outline:2px solid var(--dx-ember,#f26c18); outline-offset:3px;
766
+ }
767
+ .dx-appinstall__error{
768
+ flex-basis:100%; display:grid; gap:8px; margin:0;
769
+ color:var(--dx-danger,#e5552e); font:inherit; font-size:.82rem; line-height:1.45;
770
+ }
771
+ .dx-appinstall__error label{ font-weight:700; }
772
+ .dx-appinstall__command{
773
+ width:100%; min-height:44px; box-sizing:border-box; padding:10px 12px;
774
+ border:1px solid color-mix(in srgb,var(--dx-danger,#e5552e) 55%,transparent);
775
+ border-radius:var(--dx-radius,0px); background:var(--dx-appbtn-bg,rgba(8,8,8,.55));
776
+ color:var(--dx-appbtn-fg,#f4ece0); font:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
777
+ font-size:.78rem;
778
+ }
779
+ .dx-appinstall__command:focus-visible{
780
+ outline:2px solid var(--dx-ember,#f26c18); outline-offset:3px;
781
+ }
782
+ .dx-appinstall__sr-only{
783
+ position:absolute; width:1px; height:1px; padding:0; margin:-1px;
784
+ overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
785
+ }
786
+ @media (hover:hover) and (pointer:fine){
787
+ .dx-appbtn:hover{
788
+ border-color:color-mix(in srgb,var(--dx-ember,#f26c18) 55%,transparent);
789
+ transform:translateY(-1px);
790
+ }
791
+ }
792
+ @media (max-width:560px){
793
+ .dx-appinstall{ display:grid; grid-template-columns:minmax(0,1fr); }
794
+ .dx-appbtn{ width:100%; justify-content:flex-start; }
795
+ .dx-appinstall__notice,.dx-appinstall__error{ min-width:0; }
796
+ }
797
+ @media (prefers-reduced-motion:reduce){
798
+ .dx-appbtn{ transition:none; }
799
+ .dx-appbtn:hover,.dx-appbtn:active{ transform:none; }
800
+ }
710
801
  `;
711
802
  function ensureAppInstallStyles() {
712
803
  if (typeof document === "undefined") return;
@@ -731,10 +822,13 @@ function vscodeInstallUrl(name, mcpUrl) {
731
822
  return `vscode:mcp/install?${encodeURIComponent(JSON.stringify({ name, type: "http", url: mcpUrl }))}`;
732
823
  }
733
824
  function hermesInstallCommand(name, mcpUrl) {
734
- return `hermes mcp add ${name} --url ${mcpUrl}`;
825
+ return `hermes mcp add ${name} --url ${mcpUrl} --auth oauth`;
826
+ }
827
+ function hermesOpenUrl(name) {
828
+ return `hermes://open/${encodeURIComponent(name)}`;
735
829
  }
736
830
  function claudeCodeInstallCommand(name, mcpUrl) {
737
- return `claude mcp add --transport http ${name} ${mcpUrl}`;
831
+ return `claude mcp add --scope user --transport http ${name} ${mcpUrl}`;
738
832
  }
739
833
  async function copyText(text) {
740
834
  try {
@@ -744,23 +838,9 @@ async function copyText(text) {
744
838
  return false;
745
839
  }
746
840
  }
747
- function useCopied() {
748
- const [copied, setCopied] = useState6(false);
749
- const timer = useRef(null);
750
- useEffect8(
751
- () => () => {
752
- if (timer.current) clearTimeout(timer.current);
753
- },
754
- []
755
- );
756
- return [
757
- copied,
758
- () => {
759
- setCopied(true);
760
- if (timer.current) clearTimeout(timer.current);
761
- timer.current = setTimeout(() => setCopied(false), 2600);
762
- }
763
- ];
841
+ function useCopyStatus() {
842
+ const [status, setStatus] = useState6("idle");
843
+ return [status, (next) => setStatus(next)];
764
844
  }
765
845
  function appCx(block) {
766
846
  return block ? "dx-appbtn dx-appbtn--block" : "dx-appbtn";
@@ -775,8 +855,13 @@ function AppInstallButtons(props) {
775
855
  onAction
776
856
  } = props;
777
857
  useEffect8(ensureAppInstallStyles, []);
778
- const [hermesCopied, markHermes] = useCopied();
779
- const [claudeCopied, markClaude] = useCopied();
858
+ const statusId = useId3();
859
+ const hermesCommand = hermesInstallCommand(serverName, mcpUrl);
860
+ const claudeCommand = claudeCodeInstallCommand(serverName, mcpUrl);
861
+ const [hermesStatus, markHermes] = useCopyStatus();
862
+ const [claudeStatus, markClaude] = useCopyStatus();
863
+ const hermesErrorId = `${statusId}-hermes-error`;
864
+ const claudeErrorId = `${statusId}-claude-error`;
780
865
  const buttons = {
781
866
  cursor: /* @__PURE__ */ jsxs6(
782
867
  "a",
@@ -809,16 +894,21 @@ function AppInstallButtons(props) {
809
894
  {
810
895
  type: "button",
811
896
  className: appCx(block),
897
+ disabled: hermesStatus === "copying",
898
+ "aria-busy": hermesStatus === "copying",
899
+ "aria-describedby": hermesStatus === "failed" ? hermesErrorId : void 0,
812
900
  onClick: async () => {
813
- if (await copyText(hermesInstallCommand(serverName, mcpUrl))) {
814
- markHermes();
901
+ markHermes("copying");
902
+ if (await copyText(hermesCommand)) {
903
+ markHermes("copied");
815
904
  onAction?.("hermes", "copied");
905
+ } else {
906
+ markHermes("failed");
816
907
  }
817
- window.location.href = `hermes://open/${encodeURIComponent(serverName)}`;
818
908
  },
819
909
  children: [
820
910
  /* @__PURE__ */ jsx6("img", { className: "dx-appbtn__logo", src: HERMES_MARK, alt: "", "aria-hidden": true }),
821
- hermesCopied ? /* @__PURE__ */ jsx6("span", { className: "dx-appbtn__copied", children: "Copied. Paste it in Hermes" }) : "Copy for Hermes"
911
+ hermesStatus === "copied" ? /* @__PURE__ */ jsx6("span", { className: "dx-appbtn__copied", children: "Copied. Run it in your terminal" }) : hermesStatus === "copying" ? "Copying OAuth setup\u2026" : hermesStatus === "failed" ? "Try copying for Hermes" : "Copy OAuth setup for Hermes"
822
912
  ]
823
913
  },
824
914
  "hermes"
@@ -828,21 +918,85 @@ function AppInstallButtons(props) {
828
918
  {
829
919
  type: "button",
830
920
  className: appCx(block),
921
+ disabled: claudeStatus === "copying",
922
+ "aria-busy": claudeStatus === "copying",
923
+ "aria-describedby": claudeStatus === "failed" ? claudeErrorId : void 0,
831
924
  onClick: async () => {
832
- if (await copyText(claudeCodeInstallCommand(serverName, mcpUrl))) {
833
- markClaude();
925
+ markClaude("copying");
926
+ if (await copyText(claudeCommand)) {
927
+ markClaude("copied");
834
928
  onAction?.("claude-code", "copied");
929
+ } else {
930
+ markClaude("failed");
835
931
  }
836
932
  },
837
933
  children: [
838
934
  /* @__PURE__ */ jsx6("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
839
- claudeCopied ? /* @__PURE__ */ jsx6("span", { className: "dx-appbtn__copied", children: "Copied. Run it in your terminal" }) : "Copy for Claude Code"
935
+ claudeStatus === "copied" ? /* @__PURE__ */ jsx6("span", { className: "dx-appbtn__copied", children: "Copied. Run it in your terminal" }) : claudeStatus === "copying" ? "Copying setup\u2026" : claudeStatus === "failed" ? "Try copying for Claude Code" : "Copy for Claude Code"
840
936
  ]
841
937
  },
842
938
  "claude-code"
843
939
  )
844
940
  };
845
- return /* @__PURE__ */ jsx6("div", { className: ["dx-appinstall", block ? "dx-appinstall--block" : "", className ?? ""].filter(Boolean).join(" "), children: apps.map((app) => buttons[app] ?? null) });
941
+ return /* @__PURE__ */ jsxs6(
942
+ "div",
943
+ {
944
+ className: ["dx-appinstall", block ? "dx-appinstall--block" : "", className ?? ""].filter(Boolean).join(" "),
945
+ role: "group",
946
+ "aria-label": `Add ${serverName} to an agent app`,
947
+ children: [
948
+ apps.map((app) => buttons[app] ?? null),
949
+ /* @__PURE__ */ jsx6("span", { className: "dx-appinstall__sr-only", "aria-live": "polite", "aria-atomic": "true", children: [
950
+ hermesStatus === "copied" ? "Hermes OAuth setup command copied." : "",
951
+ claudeStatus === "copied" ? "Claude Code setup command copied." : ""
952
+ ].filter(Boolean).join(" ") }),
953
+ hermesStatus === "copied" ? /* @__PURE__ */ jsxs6("div", { className: "dx-appinstall__notice", children: [
954
+ /* @__PURE__ */ jsx6("p", { children: "Run the command in your terminal. It adds the hosted MCP with OAuth." }),
955
+ /* @__PURE__ */ jsx6(
956
+ "a",
957
+ {
958
+ className: "dx-appinstall__open",
959
+ href: hermesOpenUrl(serverName),
960
+ tabIndex: 0,
961
+ onClick: () => onAction?.("hermes", "deeplink"),
962
+ children: "Open Hermes"
963
+ }
964
+ )
965
+ ] }) : null,
966
+ hermesStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: hermesErrorId, className: "dx-appinstall__error", role: "alert", children: [
967
+ /* @__PURE__ */ jsx6("label", { htmlFor: `${hermesErrorId}-command`, children: "Couldn't copy. Select this Hermes command and run it in your terminal." }),
968
+ /* @__PURE__ */ jsx6(
969
+ "input",
970
+ {
971
+ id: `${hermesErrorId}-command`,
972
+ className: "dx-appinstall__command",
973
+ readOnly: true,
974
+ value: hermesCommand,
975
+ onFocus: (event) => event.currentTarget.select()
976
+ }
977
+ )
978
+ ] }) : null,
979
+ claudeStatus === "copied" ? /* @__PURE__ */ jsx6("div", { className: "dx-appinstall__notice", children: /* @__PURE__ */ jsxs6("p", { children: [
980
+ "Run the command in your terminal. If sign-in is required, finish it from Claude Code's ",
981
+ /* @__PURE__ */ jsx6("code", { children: "/mcp" }),
982
+ " menu."
983
+ ] }) }) : null,
984
+ claudeStatus === "failed" ? /* @__PURE__ */ jsxs6("div", { id: claudeErrorId, className: "dx-appinstall__error", role: "alert", children: [
985
+ /* @__PURE__ */ jsx6("label", { htmlFor: `${claudeErrorId}-command`, children: "Couldn't copy. Select this Claude Code command and run it in your terminal." }),
986
+ /* @__PURE__ */ jsx6(
987
+ "input",
988
+ {
989
+ id: `${claudeErrorId}-command`,
990
+ className: "dx-appinstall__command",
991
+ readOnly: true,
992
+ value: claudeCommand,
993
+ onFocus: (event) => event.currentTarget.select()
994
+ }
995
+ )
996
+ ] }) : null
997
+ ]
998
+ }
999
+ );
846
1000
  }
847
1001
  export {
848
1002
  AllowanceChips,
@@ -856,6 +1010,7 @@ export {
856
1010
  claudeCodeInstallCommand,
857
1011
  cursorInstallUrl,
858
1012
  hermesInstallCommand,
1013
+ hermesOpenUrl,
859
1014
  useDexterWallet,
860
1015
  useIdentity,
861
1016
  useSignInWithDexter,
package/dist/worldid.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DexterButton,
3
3
  ensureDexterButtonStyles
4
- } from "./chunk-PW33ZOCP.js";
4
+ } from "./chunk-TLCQSAE5.js";
5
5
 
6
6
  // src/worldid.tsx
7
7
  import { useEffect, useState } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexterai/connect",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "description": "Sign in with Dexter — passkey connector. Composes @dexterai/vault.",
5
5
  "type": "module",
6
6
  "exports": {