@capxul/sdk 4.2.0-rc.3 → 4.2.0-rc.5

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.
@@ -1947,6 +1947,12 @@ const USDX_BASE_SEPOLIA_TOKEN = {
1947
1947
  USDX_BASE_SEPOLIA_TOKEN.chainId;
1948
1948
  USDX_BASE_SEPOLIA_TOKEN.chainId;
1949
1949
  10n ** BigInt(6);
1950
+ /**
1951
+ * The bootstrap manage role. It administers people and roles, cannot spend,
1952
+ * and is not a signer of the Organization Safe; "Owner" implied the latter,
1953
+ * so the label is Admin (ruled 2026-09-06).
1954
+ */
1955
+ const ADMIN_ROLE_LABEL = "Admin";
1950
1956
  function normalizeOrgRoleLabel(label) {
1951
1957
  const normalized = label.trim().replace(/\s+/g, " ");
1952
1958
  if (normalized.length === 0) throw Errors.invalidInput("role.label", "must be a non-empty role label");
@@ -2363,4 +2369,4 @@ function readExchange(body) {
2363
2369
  };
2364
2370
  }
2365
2371
  //#endregion
2366
- export { toTesterKind as $, toAccountId as A, toEmail as B, BYTES32_RE as C, ZERO_BYTES32 as D, WEI_RE as E, toBudgetId as F, toKycTier as G, toEpochSeconds as H, toChainId as I, toPayrollGroupId as J, toOrgId as K, toCountryCode as L, toAllowedOrigin as M, toAppId as N, assetIdFor as O, toAuthUserId as P, toSessionToken as Q, toCurrencyCode as R, ASSET_ID_RE as S, SUPPORTED_CURRENCY_CODES as T, toHandle as U, toEpochMs as V, toJwtToken as W, toPublishableKey as X, toPayrollRunId as Y, toRoleKey as Z, BASE_SEPOLIA_CHAIN_ID as _, revertSummaryText as _t, parseAuthSession as a, EXPECTED_OPERATION_OUTCOMES as at, ACCOUNT_ID_RE as b, redactSecrets as bt, AuthCachePortTag as c, CHAIN_UPSTREAMS as ct, authClientPortFromPromiseAdapter as d, chainCauseProperties as dt, validateHandle as et, AuthClientError as f, chainEvidenceLabel as ft, normalizeBindingEmail as g, isFailureMode as gt, CAPXUL_PAYMENTS_V2_ADDRESS as h, isChainUpstream as ht, BrowserAuthCacheAdapter as i, CapxulError as it, toAddress as j, currencySymbolFor as k, SystemClockLayer as l, FAILURE_MODES as lt, orgRoleKeyForLabel as m, failureFingerprint as mt, readClockNow as n, decodeConvexError as nt, parseCachedJwt as o, Errors as ot, AuthClientPortTag as p, decodeChainCause as pt, toPartyId as q, InMemoryAuthCacheAdapter as r, CAPXUL_ERROR_CODES as rt, AuthCacheError as s, isCapxulError as st, oauthBearerAuthClient as t, HANDLE_RE as tt, ClockPortTag as u, boundedResponseHeaders as ut, deriveCapxulSafeAddress as v, containsSensitiveMaterial as vt, EVM_ADDRESS_RE as w, APP_ID_RE as x, redactUrlSecrets as xt, configuredMoneyAssetById as y, isCredentialField as yt, toDurationMs as z };
2372
+ export { toSessionToken as $, currencySymbolFor as A, toDurationMs as B, ASSET_ID_RE as C, WEI_RE as D, SUPPORTED_CURRENCY_CODES as E, toAuthUserId as F, toJwtToken as G, toEpochMs as H, toBudgetId as I, toPartyId as J, toKycTier as K, toChainId as L, toAddress as M, toAllowedOrigin as N, ZERO_BYTES32 as O, toAppId as P, toRoleKey as Q, toCountryCode as R, APP_ID_RE as S, redactUrlSecrets as St, EVM_ADDRESS_RE as T, toEpochSeconds as U, toEmail as V, toHandle as W, toPayrollRunId as X, toPayrollGroupId as Y, toPublishableKey as Z, normalizeBindingEmail as _, isFailureMode as _t, parseAuthSession as a, CapxulError as at, configuredMoneyAssetById as b, isCredentialField as bt, AuthCachePortTag as c, isCapxulError as ct, authClientPortFromPromiseAdapter as d, boundedResponseHeaders as dt, toTesterKind as et, AuthClientError as f, chainCauseProperties as ft, CAPXUL_PAYMENTS_V2_ADDRESS as g, isChainUpstream as gt, orgRoleKeyForLabel as h, failureFingerprint as ht, BrowserAuthCacheAdapter as i, CAPXUL_ERROR_CODES as it, toAccountId as j, assetIdFor as k, SystemClockLayer as l, CHAIN_UPSTREAMS as lt, ADMIN_ROLE_LABEL as m, decodeChainCause as mt, readClockNow as n, HANDLE_RE as nt, parseCachedJwt as o, EXPECTED_OPERATION_OUTCOMES as ot, AuthClientPortTag as p, chainEvidenceLabel as pt, toOrgId as q, InMemoryAuthCacheAdapter as r, decodeConvexError as rt, AuthCacheError as s, Errors as st, oauthBearerAuthClient as t, validateHandle as tt, ClockPortTag as u, FAILURE_MODES as ut, BASE_SEPOLIA_CHAIN_ID as v, revertSummaryText as vt, BYTES32_RE as w, ACCOUNT_ID_RE as x, redactSecrets as xt, deriveCapxulSafeAddress as y, containsSensitiveMaterial as yt, toCurrencyCode as z };
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "source": {
3
- "commit": "4547e113caca6cf936b489dda3c22c68ea2f30d8",
4
- "tree": "6ccaeaf77b6d8fef28eacd312d0b884a383c502f",
3
+ "commit": "72be9c2d5c9b2dcdd27fa5c5acb22163ddec5c44",
4
+ "tree": "1529290d3427ecf12fece6ff70fbea35b077b6a9",
5
5
  "branch": "codex/programme-rc",
6
6
  "repository": "https://github.com/Xelmar-tech/infrastructure",
7
7
  "lockfileSha256": "5870f53b72706d103220c1bcf733cb4fb71196aea32a9cfbdc277d73cc959264"
8
8
  },
9
9
  "name": "@capxul/sdk",
10
- "version": "4.2.0-rc.3"
10
+ "version": "4.2.0-rc.5"
11
11
  }
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as PayrollGroupId, B as ChainId, Ct as ChainCause, D as Account, Dt as RevertSummary, E as CAPXUL_PAYMENTS_V2_ADDRESS, Et as FailureMode, F as AssetId, G as EVM_ADDRESS_RE, H as CurrencyCode, I as AuthSession, J as Handle, L as AuthUserId, O as AccountId, P as AssetAmount, St as CHAIN_UPSTREAMS, Tt as FAILURE_MODES, V as CountryCode, X as OrgId, Y as Money, Z as PartyId, _ as Session, _t as CapxulErrorCode, a as Eip1193RequestProvider, at as RoleKey, c as injectedWalletSigner, ct as TesterKind, d as AccountRequirement, dt as toAddress, et as PayrollRunId, f as Eip1193Provider, ft as toCountryCode, g as Profile, gt as CapxulError, h as CapxulResult, ht as CAPXUL_ERROR_CODES, i as CapxulSigner, k as Address, l as AccountProvider, m as localPrivateKeyAccountProvider, mt as toPartyId, o as SignerStatus, p as eip1193AccountProvider, pt as toHandle, r as CapxulDigestSigner, s as SignerStatusStore, u as AccountProviderSource, v as SmartAccount, vt as CapxulErrorDetails, wt as ChainUpstream, xt as isCapxulError, yt as Errors, z as BudgetId } from "./OAuthBearerAuthClient-C-ip-z8M.mjs";
2
- import { $ as OrganizationPaymentBatchInput, $n as RequestStatus, $t as Destination, A as OrgScopedMethods, An as Ref, At as AddressBookAddInput, B as AuthorizeRunOptions, Bn as SmartAccountMethods, Bt as ActivityFilter, C as CurrentUserMethods, Cn as PaymentMoney, Ct as AccountMethods, D as MemberStatus, Dn as PaymentsMethods, Dt as ActorRequest, E as InviteMemberInput, En as PaymentType, Et as ActorRelationshipMethods, F as ResendInviteTokenInput, Fn as AccountLifecycle, Ft as InboxItem, G as PayrollGroupsMethods, Gn as ActorRef, Gt as ActivityPage, H as PayrollGroup, Hn as OrgLifecycle, Ht as ActivityKind, I as RoleDefinition, In as AccountSetupStep, It as InboxMethods, J as PayrollRun, Jn as SubmittedPermissionExecution, Jt as ActivitySummary, K as PayrollMethods, Kn as CurrentHoldings, Kt as ActivityRange, L as RoleSpendCap, Ln as isSettingUpLifecycle, Lt as ActivityAnnotation, M as OrgView, Mn as TargetReference, Mt as AddressBookLabelInput, N as OrganizationAccount, Nn as TargetsMethods, Nt as AddressBookMethods, O as MemberView, On as PaymentsPayInput, Ot as ActorRequestIssueInput, P as OrganizationAuditLogItem, Pn as fingerprintPaymentIntent, Pt as InboxApproveInput, Q as PayrollTermsUnit, Qn as PaymentStatus$1, Qt as DepositInstructions, R as RoleView, Rn as CompleteProfileInput, Rt as ActivityAnnotationInput, S as CurrentUserContext, Sn as PaymentDocumentsMethods, St as ReadyAccountLifecycle, T as DetectPendingOrgInvitationsResult, Tn as PaymentTiming, Tt as ActorProfileMethods, U as PayrollGroupInput, Un as OrgSetupStep, Ut as ActivityListParams, V as PayrollEngagementTerms, Vn as AuthMethods, Vt as ActivityItem, W as PayrollGroupMember, Wn as PayoutAddress, Wt as ActivityMethods, X as PayrollRunStatus, Xn as PAYMENT_DIRECTIONS, Xt as ActivitySummaryTotal, Y as PayrollRunItemInput, Yn as InboxStatus, Yt as ActivitySummaryParams, Z as PayrollRuns, Zn as PAYMENT_STATUSES, Zt as ActorReference, _ as HoldingsMethods, _n as PaymentDirection, _t as OnboardingMethods, a as ObservationContext, an as DestinationRemoveInput, ar as IdentityEvent, at as PermissionCreateInput, b as SystemHealth, bn as PaymentDocumentRender, bt as PersonOnboarding, c as HostObservability, cn as MeMethods, cr as Readiness, ct as PermissionReplaceInput, d as postHogObservability, dn as OfframpMethods, dr as isClaimed, dt as Budget, en as DestinationAddInput, et as OrganizationPaymentInput, f as CapxulClient, fn as OfframpQuote, fr as isRestoring, ft as OrgMe, g as IdentityRuntimeSendResult, gn as PaymentActivityEvidence, gt as CompletedPersonProfile, h as IdentityRuntime, hn as Payment, ht as AccountsMethods, i as ObservationAdapter, in as DestinationRail, ir as Destination$1, it as PermissionChangeInput, j as OrgTemplate, jn as ResolvedTarget, jt as AddressBookEntry, k as OrgMethods, kn as RecipientResolution, kt as ActorRequestsMethods, l as PostHogObservabilityClient, ln as MeProfile, lr as StateLabel, lt as PermissionRevokeInput, m as IdentityProfileDetails, mn as OfframpStatus, mr as InvocationControls, mt as OrgMeOptions, nn as DestinationListInput, nt as OrganizationPaymentsMethods, o as ObservationDelivery, on as DestinationsMethods, or as IdentityState, ot as PermissionMethods, p as CreateCapxulClientInput, pn as OfframpQuoteInput, pr as IdentityTransition, pt as OrgMeMethod, q as PayrollOptions, qn as Permission, qt as ActivityReference, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as DestinationPayload, rr as TelemetryPort, rt as PermissionAssignInput, s as SdkFailureObservation, sn as FinancialOpsMethods, sr as OrgLane, st as PermissionOptions, t as CapxulClientInput, tn as DestinationKind, tt as OrganizationPaymentItemInput, u as PostHogObservabilityOptions, un as MovementActivityEvidence, ur as destination, ut as PermissionReadResult, v as Holding, vn as PaymentDocumentKind, vt as OrganizationOnboarding, w as CreateOrgInput, wn as PaymentStatus, wt as ActorProfile, x as MediaMethods, xn as PaymentDocumentVerification, xt as PersonOnboardingInput, y as SystemMethods, yn as PaymentDocumentRef, yt as OrganizationOnboardingInput, z as AuthorizeRunInput, zn as IdentityMethods, zt as ActivityDetail } from "./production-CBKHzqYP.mjs";
2
+ import { $ as OrganizationPaymentBatchInput, $n as RequestStatus, $t as Destination, A as OrgScopedMethods, An as Ref, At as AddressBookAddInput, B as AuthorizeRunOptions, Bn as SmartAccountMethods, Bt as ActivityFilter, C as CurrentUserMethods, Cn as PaymentMoney, Ct as AccountMethods, D as MemberStatus, Dn as PaymentsMethods, Dt as ActorRequest, E as InviteMemberInput, En as PaymentType, Et as ActorRelationshipMethods, F as ResendInviteTokenInput, Fn as AccountLifecycle, Ft as InboxItem, G as PayrollGroupsMethods, Gn as ActorRef, Gt as ActivityPage, H as PayrollGroup, Hn as OrgLifecycle, Ht as ActivityKind, I as RoleDefinition, In as AccountSetupStep, It as InboxMethods, J as PayrollRun, Jn as SubmittedPermissionExecution, Jt as ActivitySummary, K as PayrollMethods, Kn as CurrentHoldings, Kt as ActivityRange, L as RoleSpendCap, Ln as isSettingUpLifecycle, Lt as ActivityAnnotation, M as OrgView, Mn as TargetReference, Mt as AddressBookLabelInput, N as OrganizationAccount, Nn as TargetsMethods, Nt as AddressBookMethods, O as MemberView, On as PaymentsPayInput, Ot as ActorRequestIssueInput, P as OrganizationAuditLogItem, Pn as fingerprintPaymentIntent, Pt as InboxApproveInput, Q as PayrollTermsUnit, Qn as PaymentStatus$1, Qt as DepositInstructions, R as RoleView, Rn as CompleteProfileInput, Rt as ActivityAnnotationInput, S as CurrentUserContext, Sn as PaymentDocumentsMethods, St as ReadyAccountLifecycle, T as DetectPendingOrgInvitationsResult, Tn as PaymentTiming, Tt as ActorProfileMethods, U as PayrollGroupInput, Un as OrgSetupStep, Ut as ActivityListParams, V as PayrollEngagementTerms, Vn as AuthMethods, Vt as ActivityItem, W as PayrollGroupMember, Wn as PayoutAddress, Wt as ActivityMethods, X as PayrollRunStatus, Xn as PAYMENT_DIRECTIONS, Xt as ActivitySummaryTotal, Y as PayrollRunItemInput, Yn as InboxStatus, Yt as ActivitySummaryParams, Z as PayrollRuns, Zn as PAYMENT_STATUSES, Zt as ActorReference, _ as HoldingsMethods, _n as PaymentDirection, _t as OnboardingMethods, a as ObservationContext, an as DestinationRemoveInput, ar as IdentityEvent, at as PermissionCreateInput, b as SystemHealth, bn as PaymentDocumentRender, bt as PersonOnboarding, c as HostObservability, cn as MeMethods, cr as Readiness, ct as PermissionReplaceInput, d as postHogObservability, dn as OfframpMethods, dr as isClaimed, dt as Budget, en as DestinationAddInput, et as OrganizationPaymentInput, f as CapxulClient, fn as OfframpQuote, fr as isRestoring, ft as OrgMe, g as IdentityRuntimeSendResult, gn as PaymentActivityEvidence, gt as CompletedPersonProfile, h as IdentityRuntime, hn as Payment, ht as AccountsMethods, i as ObservationAdapter, in as DestinationRail, ir as Destination$1, it as PermissionChangeInput, j as OrgTemplate, jn as ResolvedTarget, jt as AddressBookEntry, k as OrgMethods, kn as RecipientResolution, kt as ActorRequestsMethods, l as PostHogObservabilityClient, ln as MeProfile, lr as StateLabel, lt as PermissionRevokeInput, m as IdentityProfileDetails, mn as OfframpStatus, mr as InvocationControls, mt as OrgMeOptions, nn as DestinationListInput, nt as OrganizationPaymentsMethods, o as ObservationDelivery, on as DestinationsMethods, or as IdentityState, ot as PermissionMethods, p as CreateCapxulClientInput, pn as OfframpQuoteInput, pr as IdentityTransition, pt as OrgMeMethod, q as PayrollOptions, qn as Permission, qt as ActivityReference, r as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, rn as DestinationPayload, rr as TelemetryPort, rt as PermissionAssignInput, s as SdkFailureObservation, sn as FinancialOpsMethods, sr as OrgLane, st as PermissionOptions, t as CapxulClientInput, tn as DestinationKind, tt as OrganizationPaymentItemInput, u as PostHogObservabilityOptions, un as MovementActivityEvidence, ur as destination, ut as PermissionReadResult, v as Holding, vn as PaymentDocumentKind, vt as OrganizationOnboarding, w as CreateOrgInput, wn as PaymentStatus, wt as ActorProfile, x as MediaMethods, xn as PaymentDocumentVerification, xt as PersonOnboardingInput, y as SystemMethods, yn as PaymentDocumentRef, yt as OrganizationOnboardingInput, z as AuthorizeRunInput, zn as IdentityMethods, zt as ActivityDetail } from "./production-Dkp_cJ5N.mjs";
3
3
  import { Hex } from "viem";
4
4
  import { Effect, Layer } from "effect";
5
5
  //#region ../errors/src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as signerFailure, B as isRestoring, C as normalizeExceptionErrorKind, E as safeExceptionLabel, F as CAPXUL_OPERATIONS, I as isCapxulOperation, L as normalizeCapxulOperation, M as PAYMENT_DIRECTIONS, N as PAYMENT_STATUSES, O as isSettingUpLifecycle, R as destination, S as SDK_VERSION, T as projectSdkException, _ as fingerprintPaymentIntent, b as failureDetail, d as embeddedSigner, f as openfortEmbeddedSigner, g as devPrivateKeySigner, h as deriveDevPrivateKey, j as resolveFailureMode, k as injectedWalletSigner, m as openfortEmbeddedWalletPort, p as openfortEmbeddedSignerFromWallet, r as postHogObservability, t as createCapxulClient$1, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as isClaimed } from "./production-2bwmvmWd.mjs";
2
- import { L as toCountryCode, O as assetIdFor, R as toCurrencyCode, U as toHandle, ct as CHAIN_UPSTREAMS, h as CAPXUL_PAYMENTS_V2_ADDRESS, it as CapxulError, j as toAddress, k as currencySymbolFor, lt as FAILURE_MODES, ot as Errors, q as toPartyId, rt as CAPXUL_ERROR_CODES, st as isCapxulError, tt as HANDLE_RE, w as EVM_ADDRESS_RE, y as configuredMoneyAssetById } from "./OAuthBearerAuthClient-BrbXrndM.mjs";
1
+ import { A as signerFailure, B as isRestoring, C as normalizeExceptionErrorKind, E as safeExceptionLabel, F as CAPXUL_OPERATIONS, I as isCapxulOperation, L as normalizeCapxulOperation, M as PAYMENT_DIRECTIONS, N as PAYMENT_STATUSES, O as isSettingUpLifecycle, R as destination, S as SDK_VERSION, T as projectSdkException, _ as fingerprintPaymentIntent, b as failureDetail, d as embeddedSigner, f as openfortEmbeddedSigner, g as devPrivateKeySigner, h as deriveDevPrivateKey, j as resolveFailureMode, k as injectedWalletSigner, m as openfortEmbeddedWalletPort, p as openfortEmbeddedSignerFromWallet, r as postHogObservability, t as createCapxulClient$1, w as normalizeExceptionOperation, x as EXCEPTION_MESSAGE, y as CAPXUL_SDK_EXPECTED_OUTCOME_EVENT, z as isClaimed } from "./production-gUH_helr.mjs";
2
+ import { A as currencySymbolFor, J as toPartyId, M as toAddress, R as toCountryCode, T as EVM_ADDRESS_RE, W as toHandle, at as CapxulError, b as configuredMoneyAssetById, ct as isCapxulError, g as CAPXUL_PAYMENTS_V2_ADDRESS, it as CAPXUL_ERROR_CODES, k as assetIdFor, lt as CHAIN_UPSTREAMS, nt as HANDLE_RE, st as Errors, ut as FAILURE_MODES, z as toCurrencyCode } from "./OAuthBearerAuthClient-hPwtSpEf.mjs";
3
3
  import { formatUnits } from "viem";
4
4
  import { Effect } from "effect";
5
5
  import { privateKeyToAccount } from "viem/accounts";
@@ -1,4 +1,4 @@
1
- import { a as parseAuthSession, c as AuthCachePortTag, i as BrowserAuthCacheAdapter, j as toAddress, o as parseCachedJwt, r as InMemoryAuthCacheAdapter, s as AuthCacheError, t as oauthBearerAuthClient } from "../OAuthBearerAuthClient-BrbXrndM.mjs";
1
+ import { M as toAddress, a as parseAuthSession, c as AuthCachePortTag, i as BrowserAuthCacheAdapter, o as parseCachedJwt, r as InMemoryAuthCacheAdapter, s as AuthCacheError, t as oauthBearerAuthClient } from "../OAuthBearerAuthClient-hPwtSpEf.mjs";
2
2
  import { Effect, FileSystem, Layer, Path } from "effect";
3
3
  import { privateKeyToAccount } from "viem/accounts";
4
4
  import * as os from "node:os";
@@ -284,7 +284,7 @@ interface TelemetryPort {
284
284
  }
285
285
  //#endregion
286
286
  //#region ../observability/src/index.d.ts
287
- declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "chain_upstream_fallback", "bundler_error", "receipt_pending", "operation_retried", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "payment_verification_retry", "payment_lifecycle_transition", "quick_pay_external_address_acknowledged", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident", "activity_annotation_saved", "ui_activity_action_completed", "contact_relationship_changed", "ui_contact_action_completed"];
287
+ declare const TELEMETRY_EVENT_NAMES: readonly ["auth_otp_requested", "auth_otp_delivered", "auth_otp_expired", "auth_verified", "auth_failed", "auth_signed_out", "onboarding_intent_selected", "onboarding_profile_submitted", "onboarding_organization_submitted", "onboarding_dashboard_reached", "provisioning_safe_created", "provisioning_safe_confirmed", "bootstrap_resolved", "bootstrap_failed", "member_activation_started", "member_activation_ready", "member_activation_failed", "organization_creation_started", "organization_creation_ready", "organization_creation_failed", "chain_upstream_fallback", "bundler_error", "receipt_pending", "operation_retried", "account_balance_read", "account_balance_failed", "faucet_requested", "faucet_confirmed", "faucet_failed", "org_create_started", "org_safe_created", "org_safe_confirmed", "org_roles_seeded", "org_created", "org_create_failed", "org_invite_sent", "org_invite_accepted", "org_invite_expired", "payment_initiated", "payment_settled", "payment_failed", "payment_verification_retry", "payment_lifecycle_transition", "quick_pay_external_address_acknowledged", "deposit_initiated", "deposit_settled", "permission_mirror_verification", "movement_scan_window", "movement_scan_checkpoint", "movement_scan_incident", "activity_annotation_saved", "ui_activity_action_completed", "contact_relationship_changed", "ui_contact_action_completed", "access_recovery_completed", "ui_access_step_completed", "org_invite_progressed", "invoice_issued", "invoice_request_transitioned", "ui_invoice_step_completed", "ui_treasury_step_completed", "ui_receive_step_completed", "payroll_group_changed", "payroll_run_transitioned", "ui_payroll_action_completed"];
288
288
  type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
289
289
  type TelemetryProps = Record<string, unknown>;
290
290
  type TelemetryEvent = {
@@ -1551,20 +1551,19 @@ interface ActivityAnnotationInput {
1551
1551
  readonly accountingCategory?: string;
1552
1552
  readonly memo?: string;
1553
1553
  }
1554
+ /**
1555
+ * #1960 R02: the declared option type is the `InvocationControls` these methods
1556
+ * have always forwarded to `deps.invocationControls`, so an Activity action can
1557
+ * carry the correlation its UI observation already used. `{ signal }` callers
1558
+ * are unaffected.
1559
+ */
1554
1560
  interface ActivityMethods {
1555
- list(params?: ActivityListParams, options?: {
1556
- readonly signal?: AbortSignal;
1557
- }): Promise<CapxulResult<ActivityPage>>;
1558
- summary(params?: ActivitySummaryParams, options?: {
1559
- readonly signal?: AbortSignal;
1560
- }): Promise<CapxulResult<ActivitySummary>>;
1561
- get(reference: ActivityReference, options?: {
1562
- readonly signal?: AbortSignal;
1561
+ list(params?: ActivityListParams, options?: InvocationControls): Promise<CapxulResult<ActivityPage>>;
1562
+ summary(params?: ActivitySummaryParams, options?: InvocationControls): Promise<CapxulResult<ActivitySummary>>;
1563
+ get(reference: ActivityReference, options?: InvocationControls & {
1563
1564
  readonly actor?: ActorReference;
1564
1565
  }): Promise<CapxulResult<ActivityDetail | null>>;
1565
- annotate(input: ActivityAnnotationInput, options?: {
1566
- readonly signal?: AbortSignal;
1567
- }): Promise<CapxulResult<ActivityAnnotation>>;
1566
+ annotate(input: ActivityAnnotationInput, options?: InvocationControls): Promise<CapxulResult<ActivityAnnotation>>;
1568
1567
  }
1569
1568
  interface OfframpQuoteInput {
1570
1569
  readonly actor?: ActorReference;
@@ -1718,25 +1717,19 @@ interface AddressBookLabelInput {
1718
1717
  interface AddressBookListInput {
1719
1718
  readonly includeHidden?: boolean;
1720
1719
  }
1720
+ /**
1721
+ * #1960 R02: the declared option type is the `InvocationControls` these methods
1722
+ * have always forwarded to `deps.invocationControls`. Naming it lets a caller
1723
+ * that captured one user attempt hand the same `correlation_id`/`journey_id` to
1724
+ * the operation the attempt starts. `{ signal }` callers are unaffected.
1725
+ */
1721
1726
  interface AddressBookMethods {
1722
- list(input?: AddressBookListInput, options?: {
1723
- readonly signal?: AbortSignal;
1724
- }): Promise<CapxulResult<readonly AddressBookEntry[]>>;
1725
- get(entryId: PartyId, options?: {
1726
- readonly signal?: AbortSignal;
1727
- }): Promise<CapxulResult<AddressBookEntry | null>>;
1728
- add(input: AddressBookAddInput, options?: {
1729
- readonly signal?: AbortSignal;
1730
- }): Promise<CapxulResult<AddressBookEntry>>;
1731
- hide(entryId: PartyId, options?: {
1732
- readonly signal?: AbortSignal;
1733
- }): Promise<CapxulResult<AddressBookEntry>>;
1734
- unhide(entryId: PartyId, options?: {
1735
- readonly signal?: AbortSignal;
1736
- }): Promise<CapxulResult<AddressBookEntry>>;
1737
- label(input: AddressBookLabelInput, options?: {
1738
- readonly signal?: AbortSignal;
1739
- }): Promise<CapxulResult<AddressBookEntry>>;
1727
+ list(input?: AddressBookListInput, options?: InvocationControls): Promise<CapxulResult<readonly AddressBookEntry[]>>;
1728
+ get(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry | null>>;
1729
+ add(input: AddressBookAddInput, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1730
+ hide(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1731
+ unhide(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1732
+ label(input: AddressBookLabelInput, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1740
1733
  }
1741
1734
  interface ActorRequest {
1742
1735
  readonly id: string;
@@ -1966,6 +1959,7 @@ type ResendOrgInviteTokenInput = {
1966
1959
  readonly email: string;
1967
1960
  };
1968
1961
  type DetectPendingOrgInvitationsInput = Record<never, never>;
1962
+ type PendingOrgSetupInput = Record<never, never>;
1969
1963
  type DetectPendingOrgInvitationsResult$1 = {
1970
1964
  readonly matched: readonly OrgId[];
1971
1965
  };
@@ -1987,6 +1981,15 @@ interface OrgPort {
1987
1981
  listRoles(input: ListOrgRolesInput): Effect.Effect<readonly RoleView[], OrgError, never>;
1988
1982
  listMembers(input: ListOrgMembersInput): Effect.Effect<readonly MemberView[], OrgError, never>;
1989
1983
  pendingMembers?(input: ListOrgMembersInput): Effect.Effect<readonly MemberView[], OrgError, never>;
1984
+ /**
1985
+ * The caller's own Organization whose setup has not finished, or `null`.
1986
+ * Optional: only the Convex read adapter answers it. The client's attach
1987
+ * subscriber starts nothing without it, exactly as a signerless client
1988
+ * starts no readiness cycle.
1989
+ */
1990
+ pendingSetup?(input: PendingOrgSetupInput): Effect.Effect<{
1991
+ readonly orgId: OrgId;
1992
+ } | null, OrgError, never>;
1990
1993
  inviteMember(input: InviteOrgMemberInput): Effect.Effect<MemberView, OrgError, never>;
1991
1994
  resendInviteToken?(input: ResendOrgInviteTokenInput): Effect.Effect<MemberView, OrgError, never>;
1992
1995
  detectAndAcceptPendingInvitations(input: DetectPendingOrgInvitationsInput): Effect.Effect<DetectPendingOrgInvitationsResult$1, OrgError, never>;
@@ -1,4 +1,4 @@
1
- import { $ as toTesterKind, A as toAccountId, B as toEmail, C as BYTES32_RE, D as ZERO_BYTES32, E as WEI_RE, F as toBudgetId, G as toKycTier, H as toEpochSeconds, I as toChainId, J as toPayrollGroupId, K as toOrgId, L as toCountryCode, M as toAllowedOrigin, P as toAuthUserId, Q as toSessionToken, R as toCurrencyCode, S as ASSET_ID_RE, T as SUPPORTED_CURRENCY_CODES, U as toHandle, V as toEpochMs, W as toJwtToken, X as toPublishableKey, Y as toPayrollRunId, Z as toRoleKey, _ as BASE_SEPOLIA_CHAIN_ID, _t as revertSummaryText, at as EXPECTED_OPERATION_OUTCOMES, b as ACCOUNT_ID_RE, bt as redactSecrets, c as AuthCachePortTag, ct as CHAIN_UPSTREAMS, d as authClientPortFromPromiseAdapter, dt as chainCauseProperties, et as validateHandle, f as AuthClientError, ft as chainEvidenceLabel, g as normalizeBindingEmail, gt as isFailureMode, ht as isChainUpstream, i as BrowserAuthCacheAdapter, it as CapxulError, j as toAddress, l as SystemClockLayer, lt as FAILURE_MODES$1, m as orgRoleKeyForLabel, mt as failureFingerprint, nt as decodeConvexError, ot as Errors, p as AuthClientPortTag, pt as decodeChainCause, q as toPartyId, r as InMemoryAuthCacheAdapter, rt as CAPXUL_ERROR_CODES, st as isCapxulError, u as ClockPortTag, ut as boundedResponseHeaders, v as deriveCapxulSafeAddress, vt as containsSensitiveMaterial, w as EVM_ADDRESS_RE$1, x as APP_ID_RE, xt as redactUrlSecrets, yt as isCredentialField, z as toDurationMs } from "./OAuthBearerAuthClient-BrbXrndM.mjs";
1
+ import { $ as toSessionToken, B as toDurationMs, C as ASSET_ID_RE, D as WEI_RE, E as SUPPORTED_CURRENCY_CODES, F as toAuthUserId, G as toJwtToken, H as toEpochMs, I as toBudgetId, J as toPartyId, K as toKycTier, L as toChainId, M as toAddress, N as toAllowedOrigin, O as ZERO_BYTES32, Q as toRoleKey, R as toCountryCode, S as APP_ID_RE, St as redactUrlSecrets, T as EVM_ADDRESS_RE$1, U as toEpochSeconds, V as toEmail, W as toHandle, X as toPayrollRunId, Y as toPayrollGroupId, Z as toPublishableKey, _ as normalizeBindingEmail, _t as isFailureMode, at as CapxulError, bt as isCredentialField, c as AuthCachePortTag, ct as isCapxulError, d as authClientPortFromPromiseAdapter, dt as boundedResponseHeaders, et as toTesterKind, f as AuthClientError, ft as chainCauseProperties, gt as isChainUpstream, h as orgRoleKeyForLabel, ht as failureFingerprint, i as BrowserAuthCacheAdapter, it as CAPXUL_ERROR_CODES, j as toAccountId, l as SystemClockLayer, lt as CHAIN_UPSTREAMS, m as ADMIN_ROLE_LABEL, mt as decodeChainCause, ot as EXPECTED_OPERATION_OUTCOMES, p as AuthClientPortTag, pt as chainEvidenceLabel, q as toOrgId, r as InMemoryAuthCacheAdapter, rt as decodeConvexError, st as Errors, tt as validateHandle, u as ClockPortTag, ut as FAILURE_MODES$1, v as BASE_SEPOLIA_CHAIN_ID, vt as revertSummaryText, w as BYTES32_RE, x as ACCOUNT_ID_RE, xt as redactSecrets, y as deriveCapxulSafeAddress, yt as containsSensitiveMaterial, z as toCurrencyCode } from "./OAuthBearerAuthClient-hPwtSpEf.mjs";
2
2
  import { formatUnits, keccak256, parseUnits, recoverAddress, stringToHex, toBytes } from "viem";
3
3
  import { Cause, Clock, Context, Data, Deferred, Duration, Effect, Exit, Fiber, FiberSet, Layer, Option, Queue, Ref, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaParser, Scope, Stream, Tracer } from "effect";
4
4
  import { getFunctionName, makeFunctionReference } from "convex/server";
@@ -1333,10 +1333,24 @@ const DepositSettledProps = Schema.Struct({
1333
1333
  });
1334
1334
  const PermissionMirrorVerificationProps = Schema.Struct({
1335
1335
  ...TelemetryEnvelopeProps,
1336
+ /** The RECEIPT verification outcome. What the mirror then did is separate. */
1336
1337
  outcome: Schema.String,
1337
1338
  reason: Schema.String,
1338
1339
  chain_id: Schema.Number,
1339
- retry_count: Schema.Number
1340
+ retry_count: Schema.Number,
1341
+ /**
1342
+ * #1960 R02, consumed by R03. A verified receipt is not an applied Permission:
1343
+ * these two optional fields let the producer say what the applying mutation
1344
+ * actually returned, and which command it was, without either fact rewriting
1345
+ * the receipt outcome above. Absent when application has not happened yet.
1346
+ */
1347
+ application_result: Schema.optional(Schema.Literals([
1348
+ "applied",
1349
+ "replayed",
1350
+ "conflicting_replay",
1351
+ "revision_mismatch"
1352
+ ])),
1353
+ command_id: OptionalString
1340
1354
  });
1341
1355
  const MovementScanWindowProps = Schema.Struct({
1342
1356
  ...TelemetryEnvelopeProps,
@@ -1562,6 +1576,10 @@ Schema.Struct({
1562
1576
  name: Schema.Literal("movement_scan_incident"),
1563
1577
  props: MovementScanIncidentProps
1564
1578
  });
1579
+ /** The one spelling of "whose scope did this happen in" across every surface. */
1580
+ const ScopeKindSchema = Schema.Literals(["account", "organization"]);
1581
+ const AccountKindSchema = Schema.Literals(["personalSafe", "orgTreasury"]);
1582
+ const OptionalReasonCode = Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES));
1565
1583
  const ActivityReferenceProps = {
1566
1584
  reference_kind: Schema.Literals(["payment", "movement"]),
1567
1585
  reference_id: Schema.String
@@ -1592,8 +1610,8 @@ const ActivityFilterProps = {
1592
1610
  };
1593
1611
  const ActivityActionProps = {
1594
1612
  ...TelemetryEnvelopeProps,
1595
- scope_kind: Schema.Literals(["account", "organization"]),
1596
- reason_code: Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES))
1613
+ scope_kind: ScopeKindSchema,
1614
+ reason_code: OptionalReasonCode
1597
1615
  };
1598
1616
  Schema.Struct({
1599
1617
  name: Schema.Literal("contact_relationship_changed"),
@@ -1605,7 +1623,7 @@ Schema.Struct({
1605
1623
  "hidden",
1606
1624
  "restored"
1607
1625
  ]),
1608
- scope_kind: Schema.Literals(["account", "organization"]),
1626
+ scope_kind: ScopeKindSchema,
1609
1627
  scope_id: Schema.String,
1610
1628
  owner_party_id: Schema.String,
1611
1629
  party_id: Schema.String,
@@ -1621,9 +1639,9 @@ Schema.Struct({
1621
1639
  });
1622
1640
  const ContactActionProps = {
1623
1641
  ...TelemetryEnvelopeProps,
1624
- scope_kind: Schema.Literals(["account", "organization"]),
1642
+ scope_kind: ScopeKindSchema,
1625
1643
  party_id: OptionalString,
1626
- reason_code: Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES))
1644
+ reason_code: OptionalReasonCode
1627
1645
  };
1628
1646
  Schema.Struct({
1629
1647
  name: Schema.Literal("ui_contact_action_completed"),
@@ -1650,7 +1668,7 @@ Schema.Struct({
1650
1668
  props: Schema.Struct({
1651
1669
  ...TelemetryEnvelopeProps,
1652
1670
  ...ActivityReferenceProps,
1653
- scope_kind: Schema.Literals(["account", "organization"]),
1671
+ scope_kind: ScopeKindSchema,
1654
1672
  scope_id: Schema.String,
1655
1673
  occurred_at: Schema.Number
1656
1674
  })
@@ -1705,6 +1723,193 @@ Schema.Struct({
1705
1723
  })
1706
1724
  ])
1707
1725
  });
1726
+ /**
1727
+ * Reliability closeout (#1960 R02) — the shape every explicit UI observation
1728
+ * below shares. `scope_kind` says whose surface the person was looking at,
1729
+ * `organization_id` is the verified Organization the producer resolved (absent
1730
+ * on a personal action), and `reason_code` is a catalog error code, never copy.
1731
+ */
1732
+ const UiStepProps = {
1733
+ ...TelemetryEnvelopeProps,
1734
+ scope_kind: ScopeKindSchema,
1735
+ organization_id: OptionalOrgId,
1736
+ reason_code: OptionalReasonCode
1737
+ };
1738
+ const AccessRecoveryCompletedProps = Schema.Union([Schema.Struct({
1739
+ ...TelemetryEnvelopeProps,
1740
+ recovery: Schema.Literal("session_restoration"),
1741
+ outcome: Schema.Literals([
1742
+ "restored",
1743
+ "absent",
1744
+ "failed"
1745
+ ]),
1746
+ reason_code: OptionalReasonCode,
1747
+ organization_id: OptionalOrgId
1748
+ }), Schema.Struct({
1749
+ ...TelemetryEnvelopeProps,
1750
+ recovery: Schema.Literal("signer_readiness"),
1751
+ outcome: Schema.Literals(["ready", "unavailable"]),
1752
+ reason_code: OptionalReasonCode,
1753
+ organization_id: OptionalOrgId
1754
+ })]);
1755
+ Schema.Struct({
1756
+ name: Schema.Literal("access_recovery_completed"),
1757
+ props: AccessRecoveryCompletedProps
1758
+ });
1759
+ Schema.Struct({
1760
+ name: Schema.Literal("ui_access_step_completed"),
1761
+ props: Schema.Struct({
1762
+ ...UiStepProps,
1763
+ step: Schema.Literals([
1764
+ "dashboard_granted",
1765
+ "redirect_completed",
1766
+ "gate_error_displayed",
1767
+ "retry_selected",
1768
+ "capability_refusal_displayed",
1769
+ "signer_refusal_displayed"
1770
+ ]),
1771
+ capability: Schema.optional(Schema.Literals(["spend", "managePeople"])),
1772
+ probe: Schema.optional(Schema.Literals([
1773
+ "session",
1774
+ "membership",
1775
+ "lifecycle"
1776
+ ])),
1777
+ reason: Schema.optional(Schema.Literals([
1778
+ "loading",
1779
+ "no-permission",
1780
+ "org-unavailable"
1781
+ ]))
1782
+ })
1783
+ });
1784
+ Schema.Struct({
1785
+ name: Schema.Literal("org_invite_progressed"),
1786
+ props: Schema.Struct({
1787
+ ...TelemetryEnvelopeProps,
1788
+ organization_id: OrgIdTelemetrySchema,
1789
+ progress: Schema.Literals([
1790
+ "account_ready",
1791
+ "permission_applied",
1792
+ "membership_activated",
1793
+ "revoked"
1794
+ ]),
1795
+ /** The invited Party. The initiating actor stays on the envelope's identity. */
1796
+ member_party_id: Schema.String,
1797
+ occurred_at: Schema.Number
1798
+ })
1799
+ });
1800
+ Schema.Struct({
1801
+ name: Schema.Literal("invoice_issued"),
1802
+ props: Schema.Struct({
1803
+ ...TelemetryEnvelopeProps,
1804
+ request_id: Schema.String,
1805
+ issuer_scope_kind: ScopeKindSchema,
1806
+ issuer_scope_id: Schema.String,
1807
+ payer_party_id: OptionalString,
1808
+ occurred_at: Schema.Number
1809
+ })
1810
+ });
1811
+ Schema.Struct({
1812
+ name: Schema.Literal("invoice_request_transitioned"),
1813
+ props: Schema.Struct({
1814
+ ...TelemetryEnvelopeProps,
1815
+ request_id: Schema.String,
1816
+ transition: Schema.Literals([
1817
+ "approval_prepared",
1818
+ "declined",
1819
+ "cancelled"
1820
+ ]),
1821
+ actor_scope_kind: ScopeKindSchema,
1822
+ actor_scope_id: Schema.String,
1823
+ occurred_at: Schema.Number
1824
+ })
1825
+ });
1826
+ Schema.Struct({
1827
+ name: Schema.Literal("ui_invoice_step_completed"),
1828
+ props: Schema.Struct({
1829
+ ...UiStepProps,
1830
+ step: Schema.Literals([
1831
+ "opened",
1832
+ "previewed",
1833
+ "dismissed",
1834
+ "submitted",
1835
+ "result_displayed",
1836
+ "refusal_displayed",
1837
+ "retry_selected"
1838
+ ]),
1839
+ request_id: OptionalString
1840
+ })
1841
+ });
1842
+ Schema.Struct({
1843
+ name: Schema.Literal("ui_treasury_step_completed"),
1844
+ props: Schema.Struct({
1845
+ ...UiStepProps,
1846
+ step: Schema.Literals([
1847
+ "balance_displayed",
1848
+ "read_refusal_displayed",
1849
+ "retry_selected",
1850
+ "recovery_completed"
1851
+ ]),
1852
+ account_kind: Schema.optional(AccountKindSchema)
1853
+ })
1854
+ });
1855
+ Schema.Struct({
1856
+ name: Schema.Literal("ui_receive_step_completed"),
1857
+ props: Schema.Struct({
1858
+ ...UiStepProps,
1859
+ step: Schema.Literals([
1860
+ "instructions_displayed",
1861
+ "address_copied",
1862
+ "copy_failed",
1863
+ "refusal_displayed",
1864
+ "retry_selected"
1865
+ ]),
1866
+ account_kind: Schema.optional(AccountKindSchema)
1867
+ })
1868
+ });
1869
+ Schema.Struct({
1870
+ name: Schema.Literal("payroll_group_changed"),
1871
+ props: Schema.Struct({
1872
+ ...TelemetryEnvelopeProps,
1873
+ organization_id: OrgIdTelemetrySchema,
1874
+ change: Schema.Literals([
1875
+ "created",
1876
+ "updated",
1877
+ "deleted"
1878
+ ]),
1879
+ group_id: Schema.String,
1880
+ member_count: Schema.Number,
1881
+ occurred_at: Schema.Number
1882
+ })
1883
+ });
1884
+ Schema.Struct({
1885
+ name: Schema.Literal("payroll_run_transitioned"),
1886
+ props: Schema.Struct({
1887
+ ...TelemetryEnvelopeProps,
1888
+ organization_id: OrgIdTelemetrySchema,
1889
+ transition: Schema.Literals([
1890
+ "prepared",
1891
+ "authorized",
1892
+ "settled"
1893
+ ]),
1894
+ run_id: Schema.String,
1895
+ payment_count: Schema.optional(Schema.Number),
1896
+ occurred_at: Schema.Number
1897
+ })
1898
+ });
1899
+ Schema.Struct({
1900
+ name: Schema.Literal("ui_payroll_action_completed"),
1901
+ props: Schema.Struct({
1902
+ ...UiStepProps,
1903
+ action: Schema.Literals([
1904
+ "opened",
1905
+ "refusal_displayed",
1906
+ "recovery_completed",
1907
+ "cancelled",
1908
+ "submitted_displayed"
1909
+ ]),
1910
+ run_id: OptionalString
1911
+ })
1912
+ });
1708
1913
  function redactTelemetryEvent(event, options = {}) {
1709
1914
  const props = redactTelemetryProps(event.name, event.props, options);
1710
1915
  return props === void 0 ? { name: event.name } : {
@@ -2129,7 +2334,8 @@ const CAPXUL_FUNCTIONS = {
2129
2334
  listMine: "org/queries:listMine",
2130
2335
  listRolesByOrgId: "org/queries:listRolesByOrgId",
2131
2336
  loadByOrgId: "org/queries:loadByOrgId",
2132
- me: "org/queries:me"
2337
+ me: "org/queries:me",
2338
+ pendingSetup: "org/queries:pendingSetup"
2133
2339
  },
2134
2340
  "smartAccount/actions": {
2135
2341
  claim: "smartAccount/actions:claim",
@@ -5451,7 +5657,7 @@ const moneyExecutionContract = {
5451
5657
  };
5452
5658
  //#endregion
5453
5659
  //#region package.json
5454
- var version = "4.2.0-rc.3";
5660
+ var version = "4.2.0-rc.5";
5455
5661
  //#endregion
5456
5662
  //#region src/telemetry/exception-projection.ts
5457
5663
  /** Fixed fallback for failures that have no safe message. */
@@ -5721,6 +5927,34 @@ function ignoreDeliveryFailure(delivery) {
5721
5927
  } catch {}
5722
5928
  }
5723
5929
  /**
5930
+ * Fold a caller-captured attempt identity into the host's resolved context.
5931
+ *
5932
+ * The host's `resolveContext` runs at the moment an SDK method is entered, so a
5933
+ * host that mints a correlation per resolve gives every operation of one user
5934
+ * attempt a different identity — and a user or Organization switch between the
5935
+ * click and the reply relabels an action that already started. When the caller
5936
+ * captured `correlation_id`/`journey_id` BEFORE the action started, that is the
5937
+ * attempt, and it replaces what the resolver returned for this one call. The
5938
+ * result is what the SDK span/Log, the failure envelope and the backend carrier
5939
+ * all read, so the three agree by construction rather than by convention.
5940
+ *
5941
+ * A caller that captured nothing gets the resolver's context unchanged, so
5942
+ * automatic reads keep their own invocation context.
5943
+ */
5944
+ function withCapturedAttemptContext(context, controls) {
5945
+ const correlationId = controls?.correlation_id;
5946
+ const journeyId = controls?.journey_id;
5947
+ if (correlationId === void 0 && journeyId === void 0) return context;
5948
+ const captured = sanitizeObservationContext({
5949
+ ...correlationId === void 0 ? {} : { correlationId },
5950
+ ...journeyId === void 0 ? {} : { journeyId }
5951
+ });
5952
+ return captured === void 0 ? context : {
5953
+ ...context,
5954
+ ...captured
5955
+ };
5956
+ }
5957
+ /**
5724
5958
  * Map an ALREADY-sanitized observation context to the snake_case PostHog
5725
5959
  * property keys. Shared by the failure boundary here and the host
5726
5960
  * success-telemetry seam (`telemetry/from-posthog.ts`) so both attach identical
@@ -7852,7 +8086,8 @@ var BetterAuthBrowserAdapter = class {
7852
8086
  try {
7853
8087
  const res = await this.fetchImpl(this.url("/api/auth/get-session"), withSignal$1({
7854
8088
  method: "GET",
7855
- credentials: "include"
8089
+ credentials: "include",
8090
+ cache: "no-store"
7856
8091
  }, options?.signal));
7857
8092
  if (options?.signal?.aborted) return {
7858
8093
  ok: false,
@@ -7924,7 +8159,8 @@ var BetterAuthBrowserAdapter = class {
7924
8159
  try {
7925
8160
  const res = await this.fetchImpl(this.url("/api/auth/convex/token"), withSignal$1({
7926
8161
  method: "GET",
7927
- credentials: "include"
8162
+ credentials: "include",
8163
+ cache: "no-store"
7928
8164
  }, options?.signal));
7929
8165
  if (options?.signal?.aborted) return {
7930
8166
  ok: false,
@@ -9420,6 +9656,7 @@ function orgIdBody(orgId) {
9420
9656
  //#region src/adapters/org/ConvexOrganizationAdapter.ts
9421
9657
  const DEFAULT_FUNCTIONS$1 = {
9422
9658
  listAll: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listAll),
9659
+ pendingSetup: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].pendingSetup),
9423
9660
  listRoles: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listRolesByOrgId),
9424
9661
  listMembers: makeFunctionReference(CAPXUL_FUNCTIONS["org/queries"].listMembersByOrgId),
9425
9662
  readTreasury: makeFunctionReference(CAPXUL_FUNCTIONS["org/actions"].readTreasury),
@@ -9455,6 +9692,9 @@ var ConvexOrganizationAdapter = class {
9455
9692
  return brandOrgView(wire, treasury, viewerRole);
9456
9693
  })))), Effect.catchDefect((cause) => Effect.fail(toOrgError("listOrgs", cause))));
9457
9694
  }
9695
+ pendingSetup(input) {
9696
+ return this.#convex.query(this.#fns.pendingSetup, copyInvocationObservation(input, {})).pipe(Effect.mapError((error) => orgErrorFromCapxul("pendingSetup", error.publicError, error)), Effect.map((wire) => wire === null ? null : { orgId: toOrgId(wire.orgId) }), Effect.catchDefect((cause) => Effect.fail(toOrgError("pendingSetup", cause))));
9697
+ }
9458
9698
  readTreasury(input) {
9459
9699
  return this.#readTreasuryWire(input).pipe(Effect.catchDefect((cause) => Effect.fail(toOrgError("readTreasury", cause))));
9460
9700
  }
@@ -9872,6 +10112,32 @@ var ConsoleDiagnosticAdapter = class {
9872
10112
  }
9873
10113
  };
9874
10114
  //#endregion
10115
+ //#region src/adapters/diagnostic/EffectLogDiagnosticAdapter.ts
10116
+ /**
10117
+ * Diagnostic breadcrumbs as SDK log records. The signer's readiness cycle
10118
+ * traces (`openfort.*`) used to reach only the browser console; through this
10119
+ * adapter they run in the client's own Effect context, so the engineering
10120
+ * telemetry layer ships them to PostHog Logs beside `identity.transition`.
10121
+ * Logging never throws back into the cycle that emitted it.
10122
+ */
10123
+ var EffectLogDiagnosticAdapter = class {
10124
+ #runPromise;
10125
+ #console;
10126
+ constructor(context, consoleFallback) {
10127
+ this.#runPromise = Effect.runPromiseWith(context);
10128
+ this.#console = consoleFallback;
10129
+ }
10130
+ trace(scope, detail) {
10131
+ this.#console?.trace(scope, detail);
10132
+ try {
10133
+ this.#runPromise(Effect.logInfo(scope).pipe(Effect.annotateLogs({
10134
+ ...detail,
10135
+ diagnostic_scope: scope
10136
+ }), Effect.catchCause(() => Effect.void))).catch(() => void 0);
10137
+ } catch {}
10138
+ }
10139
+ };
10140
+ //#endregion
9875
10141
  //#region src/openfort/create-openfort-browser-signer.ts
9876
10142
  function httpStatusOf(link) {
9877
10143
  const carrier = link;
@@ -10009,9 +10275,28 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10009
10275
  function encryptionSessionUrl() {
10010
10276
  return `${authBaseUrl}/encryption-session`;
10011
10277
  }
10278
+ let cycleStartedAt = null;
10279
+ let stepStartedAt = 0;
10280
+ let tokenCalls = 0;
10281
+ const sinceCycleStart = () => cycleStartedAt === null ? void 0 : Date.now() - cycleStartedAt;
10282
+ const step = (name, extra = {}) => {
10283
+ const now = Date.now();
10284
+ diagnostic?.trace("openfort.step", {
10285
+ step: name,
10286
+ duration_ms: now - stepStartedAt,
10287
+ elapsed_ms: sinceCycleStart(),
10288
+ ...extra
10289
+ });
10290
+ stepStartedAt = now;
10291
+ };
10012
10292
  async function fetchBetterAuthAccessToken() {
10293
+ tokenCalls += 1;
10294
+ const tokenStartedAt = Date.now();
10013
10295
  try {
10014
- const response = await fetch(betterAuthSessionUrl(), { credentials: "include" });
10296
+ const response = await fetch(betterAuthSessionUrl(), {
10297
+ credentials: "include",
10298
+ cache: "no-store"
10299
+ });
10015
10300
  if (!response.ok) {
10016
10301
  diagnostic?.trace("openfort.token", {
10017
10302
  ok: false,
@@ -10032,7 +10317,10 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10032
10317
  }
10033
10318
  diagnostic?.trace("openfort.token", {
10034
10319
  ok: true,
10035
- tokenPresent: true
10320
+ tokenPresent: true,
10321
+ call: tokenCalls,
10322
+ duration_ms: Date.now() - tokenStartedAt,
10323
+ elapsed_ms: sinceCycleStart()
10036
10324
  });
10037
10325
  return token;
10038
10326
  } catch (cause) {
@@ -10088,10 +10376,16 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10088
10376
  let walletReadyPromise = null;
10089
10377
  function startWalletReady() {
10090
10378
  return (async () => {
10379
+ const startedAt = Date.now();
10380
+ cycleStartedAt = startedAt;
10381
+ stepStartedAt = startedAt;
10382
+ tokenCalls = 0;
10091
10383
  if (isInsecureBrowserContext()) failNoSecureContext();
10092
10384
  await openfort.waitForInitialization();
10385
+ step("initialize");
10093
10386
  const accessToken = await fetchBetterAuthAccessToken();
10094
10387
  if (accessToken === null) throw openfortProviderError("token", /* @__PURE__ */ new Error("Better Auth access token unavailable for Openfort"));
10388
+ step("token");
10095
10389
  let encryptionResponse;
10096
10390
  try {
10097
10391
  encryptionResponse = await fetch(encryptionSessionUrl(), {
@@ -10134,10 +10428,12 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10134
10428
  ok: true,
10135
10429
  httpStatus: encryptionResponse.status
10136
10430
  });
10431
+ step("encryptionSession", { httpStatus: encryptionResponse.status });
10137
10432
  let embeddedState;
10138
10433
  try {
10139
10434
  embeddedState = await openfort.embeddedWallet.getEmbeddedState();
10140
10435
  diagnostic?.trace("openfort.embeddedState", { state: embeddedState });
10436
+ step("embeddedState", { state: embeddedState });
10141
10437
  } catch (cause) {
10142
10438
  diagnostic?.trace("openfort.embeddedState", {
10143
10439
  ok: false,
@@ -10151,6 +10447,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10151
10447
  try {
10152
10448
  await configureEmbeddedWallet(encryptionBody.sessionId);
10153
10449
  diagnostic?.trace("openfort.configure", { ok: true });
10450
+ step("configure");
10154
10451
  } catch (cause) {
10155
10452
  const error = openfortProviderError("configure", cause);
10156
10453
  diagnostic?.trace("openfort.configure", {
@@ -10163,6 +10460,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10163
10460
  try {
10164
10461
  await openfort.embeddedWallet.get();
10165
10462
  diagnostic?.trace("openfort.get", { ok: true });
10463
+ step("get");
10166
10464
  } catch (cause) {
10167
10465
  if (!isStaleUserSignal(cause)) {
10168
10466
  diagnostic?.trace("openfort.get", {
@@ -10176,7 +10474,13 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10176
10474
  failure_mode: "stale-openfort-cache"
10177
10475
  });
10178
10476
  await healStaleOpenfortCache(encryptionBody.sessionId);
10477
+ step("healStaleCache");
10179
10478
  }
10479
+ step("walletReady", {
10480
+ ok: true,
10481
+ total_ms: Date.now() - startedAt,
10482
+ token_calls: tokenCalls
10483
+ });
10180
10484
  })();
10181
10485
  }
10182
10486
  async function ensureOpenfortWalletReady() {
@@ -10259,9 +10563,13 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
10259
10563
  statusStore,
10260
10564
  ensureWalletReady: ensureOpenfortWalletReady,
10261
10565
  getAddress: async () => {
10566
+ const addressStartedAt = Date.now();
10262
10567
  try {
10263
10568
  const address = await signer.getAddress();
10264
- diagnostic?.trace("openfort.address", { ok: true });
10569
+ diagnostic?.trace("openfort.address", {
10570
+ ok: true,
10571
+ duration_ms: Date.now() - addressStartedAt
10572
+ });
10265
10573
  return address;
10266
10574
  } catch (cause) {
10267
10575
  diagnostic?.trace("openfort.address", {
@@ -12424,7 +12732,7 @@ function hermeticOrgView(input) {
12424
12732
  name: input.name,
12425
12733
  handle: input.handle,
12426
12734
  safeAddress: toAddress(placeholder),
12427
- role: "Owner",
12735
+ role: ADMIN_ROLE_LABEL,
12428
12736
  treasury: zeroTreasury(orgId),
12429
12737
  bio: null,
12430
12738
  size: null,
@@ -13112,6 +13420,43 @@ function startSignerReadinessOnClaim(actor, signer) {
13112
13420
  browserSigner.ensureWalletReady?.().catch(() => {});
13113
13421
  });
13114
13422
  }
13423
+ /**
13424
+ * Attach a pending Organization when the identity becomes claimed.
13425
+ *
13426
+ * A reload during Organization setup used to leave the app re-submitting the
13427
+ * stored draft, and that second submission raced the controller's resume on
13428
+ * `ReadSession` — the loser was refused with `SUPERSEDED`. The backend already
13429
+ * knows the truth: `pendingSetup()` reports the owner's Organization whose
13430
+ * setup has not finished. The SDK asks once per authenticated user and sends
13431
+ * `AttachOrganization`, which the identity flow runs as `orgLane(…, attach)`.
13432
+ * The app then re-submits nothing.
13433
+ *
13434
+ * The read is fire-and-forget, as the signer readiness cycle is: a failure is
13435
+ * swallowed and the ask is released, so the next state change retries. The ask
13436
+ * is held to ONE per authUserId, so the claimed transitions that follow (the
13437
+ * org lane's own) start no second read, and a new session asks again.
13438
+ */
13439
+ function attachPendingOrganizationOnClaim(actor, organizationPort) {
13440
+ const pendingSetup = organizationPort?.pendingSetup?.bind(organizationPort);
13441
+ if (pendingSetup === void 0) return () => {};
13442
+ let askedFor = null;
13443
+ return actor.subscribe((state) => {
13444
+ if (state.phase !== "authenticated" || state.account.at !== "claimed") return;
13445
+ if (state.account.org !== null) return;
13446
+ const authUserId = state.session.authUserId;
13447
+ if (askedFor === authUserId) return;
13448
+ askedFor = authUserId;
13449
+ Effect.runPromise(pendingSetup({})).then((pending) => {
13450
+ if (pending === null) return;
13451
+ return Effect.runPromise(actor.ask({
13452
+ _tag: "AttachOrganization",
13453
+ orgId: String(pending.orgId)
13454
+ }));
13455
+ }).catch(() => {
13456
+ askedFor = null;
13457
+ });
13458
+ });
13459
+ }
13115
13460
  function assembleCapxulClient(input) {
13116
13461
  const observation = input;
13117
13462
  const authCache = input.authCache ?? detectAuthCacheAdapter();
@@ -13141,18 +13486,20 @@ function assembleCapxulClient(input) {
13141
13486
  }, failureObservation, normalizeCapxulOperation(`identity.${record.event}`), "machine");
13142
13487
  });
13143
13488
  const unsubscribeSignerReadiness = startSignerReadinessOnClaim(actor, input.signer);
13489
+ const selectedOrgPort = input.orgPort ?? input.orgDeploymentPort;
13490
+ const unsubscribePendingOrganization = attachPendingOrganizationOnClaim(actor, selectedOrgPort);
13144
13491
  let stopPromise = null;
13145
13492
  const stopActor = () => {
13146
13493
  if (stopPromise === null) {
13147
13494
  unsubscribeProductTelemetry();
13148
13495
  unsubscribeFailureObservation();
13149
13496
  unsubscribeSignerReadiness();
13497
+ unsubscribePendingOrganization();
13150
13498
  stopPromise = effectRunner.runPromise(Scope.close(scope, Exit.void));
13151
13499
  }
13152
13500
  return stopPromise;
13153
13501
  };
13154
13502
  if (input.signal !== void 0) input.signal.addEventListener("abort", () => void stopActor(), { once: true });
13155
- const selectedOrgPort = input.orgPort ?? input.orgDeploymentPort;
13156
13503
  let detectPendingOrgInvitations;
13157
13504
  let kickProvisioning;
13158
13505
  const financialOps = makeFinancialOpsMethods({
@@ -13192,10 +13539,13 @@ function assembleCapxulClient(input) {
13192
13539
  ...input.invokeTimeoutMs === void 0 ? {} : { invokeTimeoutMs: input.invokeTimeoutMs },
13193
13540
  afterVerifyOtp: async () => {
13194
13541
  const browserSigner = input.signer;
13195
- if (browserSigner !== void 0 && "resetSession" in browserSigner && typeof browserSigner.resetSession === "function") try {
13196
- browserSigner.resetSession();
13197
- } catch (cause) {
13198
- throw signerFailure(browserSigner.source, "resetSession", cause);
13542
+ if (browserSigner !== void 0 && "resetSession" in browserSigner && typeof browserSigner.resetSession === "function") {
13543
+ try {
13544
+ browserSigner.resetSession();
13545
+ } catch (cause) {
13546
+ throw signerFailure(browserSigner.source, "resetSession", cause);
13547
+ }
13548
+ if (browserSigner.statusStore?.status() === "unknown" && typeof browserSigner.ensureWalletReady === "function") browserSigner.ensureWalletReady().catch(() => {});
13199
13549
  }
13200
13550
  await detectPendingOrgInvitations?.();
13201
13551
  kickProvisioning?.();
@@ -13414,8 +13764,10 @@ function withHostObservationControls(snapshot, input, actorId) {
13414
13764
  const previous = readInvocationObservation(input);
13415
13765
  if (previous !== void 0) return attachInvocationObservation({ ...input }, previous);
13416
13766
  const captured = snapshot?.() ?? { active: true };
13767
+ const context = captured.active ? withCapturedAttemptContext(captured.context, input) : captured.context;
13417
13768
  return attachInvocationObservation({ ...input }, {
13418
13769
  ...captured,
13770
+ ...context === void 0 ? {} : { context },
13419
13771
  ...actorId === void 0 ? {} : { actorId }
13420
13772
  });
13421
13773
  }
@@ -13931,7 +14283,7 @@ async function createCapxulClientWithSignerControls(input, controls) {
13931
14283
  ...adapters.value.bootstrap,
13932
14284
  authBaseUrl: resolvedAuthBaseUrl
13933
14285
  }, {
13934
- diagnostic: new ConsoleDiagnosticAdapter(),
14286
+ diagnostic: new EffectLogDiagnosticAdapter(adapters.value.context, new ConsoleDiagnosticAdapter()),
13935
14287
  signUserOpHash: controls.signEmbeddedUserOpHash
13936
14288
  });
13937
14289
  signer = withSignerControl(signer, controls.signUserOpHash);
@@ -1,5 +1,5 @@
1
1
  import { h as CapxulResult } from "../OAuthBearerAuthClient-C-ip-z8M.mjs";
2
- import { er as TelemetryEvent, f as CapxulClient, i as ObservationAdapter, n as ProductionSignerControls, nr as TelemetryIdentifyInput, pr as IdentityTransition, t as CapxulClientInput, tr as TelemetryGroupInput } from "../production-CBKHzqYP.mjs";
2
+ import { er as TelemetryEvent, f as CapxulClient, i as ObservationAdapter, n as ProductionSignerControls, nr as TelemetryIdentifyInput, pr as IdentityTransition, t as CapxulClientInput, tr as TelemetryGroupInput } from "../production-Dkp_cJ5N.mjs";
3
3
  import { Effect, Layer } from "effect";
4
4
  //#region src/testing/production-client.d.ts
5
5
  /** Create the one production client with per-client controls at its signing boundaries. */
@@ -1,5 +1,5 @@
1
- import { D as fromWei, P as redactTelemetryEvent, a as smartAccountErrorFromCapxul, c as identityErrorFromCapxul, i as assembleCapxulClient, l as convexCallErrorFromCapxul, n as createCapxulClientWithSignerControls, o as accountReadErrorFromCapxul, s as wireChainId, u as bootstrapErrorFromCapxul, v as toWei } from "../production-2bwmvmWd.mjs";
2
- import { A as toAccountId, B as toEmail, G as toKycTier, H as toEpochSeconds, I as toChainId, L as toCountryCode, M as toAllowedOrigin, N as toAppId, P as toAuthUserId, Q as toSessionToken, U as toHandle, V as toEpochMs, W as toJwtToken, X as toPublishableKey, d as authClientPortFromPromiseAdapter, et as validateHandle, it as CapxulError, j as toAddress, n as readClockNow, ot as Errors, r as InMemoryAuthCacheAdapter, v as deriveCapxulSafeAddress, z as toDurationMs } from "../OAuthBearerAuthClient-BrbXrndM.mjs";
1
+ import { D as fromWei, P as redactTelemetryEvent, a as smartAccountErrorFromCapxul, c as identityErrorFromCapxul, i as assembleCapxulClient, l as convexCallErrorFromCapxul, n as createCapxulClientWithSignerControls, o as accountReadErrorFromCapxul, s as wireChainId, u as bootstrapErrorFromCapxul, v as toWei } from "../production-gUH_helr.mjs";
2
+ import { $ as toSessionToken, B as toDurationMs, F as toAuthUserId, G as toJwtToken, H as toEpochMs, K as toKycTier, L as toChainId, M as toAddress, N as toAllowedOrigin, P as toAppId, R as toCountryCode, U as toEpochSeconds, V as toEmail, W as toHandle, Z as toPublishableKey, at as CapxulError, d as authClientPortFromPromiseAdapter, j as toAccountId, n as readClockNow, r as InMemoryAuthCacheAdapter, st as Errors, tt as validateHandle, y as deriveCapxulSafeAddress } from "../OAuthBearerAuthClient-hPwtSpEf.mjs";
3
3
  import { keccak256 } from "viem";
4
4
  import { Effect, Result, Semaphore } from "effect";
5
5
  import { getFunctionName } from "convex/server";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk",
3
- "version": "4.2.0-rc.3",
3
+ "version": "4.2.0-rc.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -49,10 +49,10 @@
49
49
  "vitest": "4.1.11",
50
50
  "@capxul/config": "0.3.0",
51
51
  "@capxul/errors": "0.3.0",
52
- "@capxul/observability": "4.2.0-rc.3",
53
52
  "@capxul/types": "0.3.0",
53
+ "@capxul/wire": "0.7.0",
54
54
  "@capxul/typescript-config": "0.0.0",
55
- "@capxul/wire": "0.7.0"
55
+ "@capxul/observability": "4.2.0-rc.5"
56
56
  },
57
57
  "_permissionlessPinReason": "permissionless.toSafeSmartAccount is pinned to 0.3.4 for live Safe deployment E2E. Counterfactual address fixtures captured 2026-05-17 in packages/backend/convex/_shared/__tests__/counterfactual.test.ts and packages/config/tests/safe.test.ts must be re-verified before upgrading.",
58
58
  "scripts": {