@capxul/sdk 4.2.0 → 4.20.0-beta.1

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.
@@ -1,6 +1,6 @@
1
- import { $ as PublishableKey, A as AppId, D as AllowanceKey, E as Address$1, F as ChainId, G as OrgId, H as EpochMs, I as CountryCode, J as PayrollGroupId, K as PartyId, L as CurrencyCode, M as AuthUserId, N as BlockNumber, O as AllowedOrigin, P as BudgetId, Q as Profile, R as DocumentHash, St as FailureMode, V as Email, W as Money, X as PermissionAssignmentId, Y as PayrollRunId, Z as PermissionId, _ as ClockPort, a as SignerStatusStore, at as WeiAmount, c as AccountProviderSource, et as RoleKey, ft as CapxulError, g as SmartAccount$1, gt as Failure, h as Session$1, it as TxHash, j as AuthSession, k as AnonymousDistinctId, l as AccountRequirement, m as Profile$1, mt as CapxulErrorDetails, n as CapxulSigner, nt as SmartAccount, p as CapxulResult, pt as CapxulErrorCode, q as PaymentCommandId, rt as TesterKind, tt as SessionToken, v as AuthClientPort, w as Account$1, x as AuthCachePort, y as CanSendOtpStatus, z as DurationMs } from "./signer-C0hZ6Kiy.mjs";
2
- import { Context, Effect, Layer, Schema, Scope, Tracer } from "effect";
1
+ import { $ as PayrollGroupId, A as AllowanceKey, B as ChainId, C as AuthCachePort, D as Account$1, Et as FailureMode, F as AssetId, H as CurrencyCode, I as AuthSession, K as Email, L as AuthUserId, M as AnonymousDistinctId, N as AppId, Q as PaymentCommandId, R as BlockNumber, U as DocumentHash, V as CountryCode, W as DurationMs, X as OrgId, Y as Money, Z as PartyId, _ as Session$1, _t as CapxulErrorCode, at as RoleKey, b as AuthClientPort, bt as Failure, ct as TesterKind, d as AccountRequirement, et as PayrollRunId, g as Profile$1, gt as CapxulError, h as CapxulResult, i as CapxulSigner, it as PublishableKey, j as AllowedOrigin, k as Address$1, lt as TxHash, nt as PermissionId, ot as SessionToken, q as EpochMs, rt as Profile, s as SignerStatusStore, st as SmartAccount, tt as PermissionAssignmentId, u as AccountProviderSource, ut as WeiAmount, v as SmartAccount$1, vt as CapxulErrorDetails, x as CanSendOtpStatus, y as ClockPort, z as BudgetId } from "./OAuthBearerAuthClient-C-ip-z8M.mjs";
3
2
  import { Hex } from "viem";
3
+ import { Context, Effect, Layer, Schema, Scope, Tracer } from "effect";
4
4
  import { FunctionReference } from "convex/server";
5
5
  //#region src/domain/machine/shell.d.ts
6
6
  declare const INVOCATION_PARENT_SPAN: unique symbol;
@@ -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", "identity_refused", "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", "indexer_drift_corrected", "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", "cli_diagnostic_completed"];
288
288
  type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
289
289
  type TelemetryProps = Record<string, unknown>;
290
290
  type TelemetryEvent = {
@@ -611,6 +611,10 @@ type BootstrapResolution = {
611
611
  readonly siteBaseUrl: string;
612
612
  readonly openfortPublishableKey: string;
613
613
  readonly shieldPublishableKey: string;
614
+ /** Openfort third-party auth provider the signer presents; absent means better-auth. */
615
+ readonly openfortAuthProvider?: "better-auth" | "oidc";
616
+ /** Origin of the Ponder indexer the SDK reads directly; absent means no indexer reads. */
617
+ readonly indexerUrl?: string;
614
618
  readonly engineeringTelemetry?: EngineeringTelemetryBootstrapPolicyV1;
615
619
  };
616
620
  type BootstrapErrorKind = "notAuthenticated" | "network" | "provider" | "malformedBody" | "invalidInput" | "rateLimited";
@@ -904,6 +908,124 @@ interface AccountReadPort {
904
908
  fundFromFaucet(input: FundFromFaucetInput): Effect.Effect<FundFromFaucetResult, AccountReadError, never>;
905
909
  }
906
910
  //#endregion
911
+ //#region src/ports/indexer-read.d.ts
912
+ /**
913
+ * IndexerReadPort is the SDK's read seam onto the Ponder read model
914
+ * (`apps/indexer`). Ponder holds what the chain said; Convex holds what the
915
+ * user meant. Nothing here is copied into Convex, nothing waits for a
916
+ * finality tag, and no write path may read through this port.
917
+ *
918
+ * Every read is scoped to one Safe and one page. The indexer accepts only the
919
+ * exact compiled statements in `apps/indexer/src/queries.ts`, so the adapter
920
+ * that implements this port reproduces those statements byte for byte and the
921
+ * service refuses anything else with 403.
922
+ */
923
+ /** One page of rows for one Safe. `offset` defaults to 0 (the first page). */
924
+ interface IndexerReadInput {
925
+ /** The Safe the caller owns. The indexer refuses a Safe outside the session claim. */
926
+ readonly safe: Address$1;
927
+ /** 1 to 1000 inclusive — the indexer's own bound. */
928
+ readonly limit: number;
929
+ readonly offset?: number;
930
+ }
931
+ /**
932
+ * The chain evidence every indexed row carries. `id` is the logical event id
933
+ * `chainId:txHash:transactionLogOrdinal`; it survives a reorg, so it is the
934
+ * key a Convex intent row stitches against.
935
+ */
936
+ interface IndexerEventIdentity {
937
+ readonly id: string;
938
+ readonly chainId: ChainId;
939
+ readonly txHash: TxHash;
940
+ readonly transactionLogOrdinal: number;
941
+ /**
942
+ * The block-global log index of the same log, as the transaction receipt
943
+ * reports it. The ordinal above is the identity; this is the key Convex
944
+ * settles a Payment on (P12).
945
+ */
946
+ readonly logIndex: number;
947
+ readonly blockNumber: bigint;
948
+ readonly blockHash: string;
949
+ /** Block timestamp in epoch seconds. */
950
+ readonly timestamp: bigint;
951
+ }
952
+ interface IndexerTransferRow extends IndexerEventIdentity {
953
+ readonly assetId: AssetId;
954
+ readonly token: Address$1;
955
+ readonly from: Address$1;
956
+ readonly to: Address$1;
957
+ /**
958
+ * Raw token units, exact. This is an evidence boundary, so the row never
959
+ * carries Money or AssetAmount: the reader owns the asset's decimals.
960
+ */
961
+ readonly amount: bigint;
962
+ }
963
+ interface IndexerPaymentRow extends IndexerEventIdentity {
964
+ readonly contract: Address$1;
965
+ /** The protocol settlement id a Convex Payment command stitches against. */
966
+ readonly settlementId: string;
967
+ readonly sender: Address$1;
968
+ readonly recipient: Address$1;
969
+ readonly assetId: AssetId;
970
+ readonly token: Address$1;
971
+ /** Raw token units, exact. */
972
+ readonly amount: bigint;
973
+ readonly kind: number;
974
+ readonly documentHash: string;
975
+ }
976
+ /** A row of the indexer's signed-transfer `balance` view. */
977
+ interface IndexerBalanceRow {
978
+ readonly chainId: ChainId;
979
+ readonly assetId: AssetId;
980
+ readonly address: Address$1;
981
+ /** Raw token units, exact. */
982
+ readonly amount: bigint;
983
+ }
984
+ /** One chain's sync position, from the indexer's native `/status` route. */
985
+ interface IndexerChainStatus {
986
+ readonly chain: string;
987
+ readonly chainId: ChainId;
988
+ readonly blockNumber: bigint;
989
+ /** Block timestamp in epoch seconds. Its age is the freshness label. */
990
+ readonly blockTimestamp: bigint;
991
+ }
992
+ /**
993
+ * The tables this seam reads today. P04 adds the authority rows (`safe`,
994
+ * `safe_event`, `roles_module`) and P05 adds `commitment`: each is one more
995
+ * entry here plus its statement and decoder.
996
+ */
997
+ interface IndexerRowsByTable {
998
+ readonly transfer: readonly IndexerTransferRow[];
999
+ readonly payment: readonly IndexerPaymentRow[];
1000
+ readonly balance: readonly IndexerBalanceRow[];
1001
+ }
1002
+ type IndexerTable = keyof IndexerRowsByTable;
1003
+ declare const IndexerReadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
1004
+ readonly _tag: "IndexerReadError";
1005
+ } & Readonly<A>;
1006
+ declare class IndexerReadError extends IndexerReadError_base<{
1007
+ readonly operation: string;
1008
+ readonly publicCode: CapxulErrorCode;
1009
+ readonly publicError: CapxulError;
1010
+ readonly cause: unknown;
1011
+ readonly details?: CapxulErrorDetails;
1012
+ }> {}
1013
+ interface IndexerReadPort {
1014
+ /** One page of rows, newest block first. An empty page is a value, not an error. */
1015
+ read<T extends IndexerTable>(table: T, input: IndexerReadInput): Effect.Effect<IndexerRowsByTable[T], IndexerReadError>;
1016
+ /**
1017
+ * The same page over the indexer's live stream. The first snapshot is
1018
+ * `loading`; each later snapshot carries the whole page again. The indexer
1019
+ * closes the stream on token expiry or revoked authority, which arrives as
1020
+ * one `error` snapshot — the caller re-reads with a refreshed token.
1021
+ *
1022
+ * @internal-use — substrate reactive transport, like `ConvexCallPort.subscribe`.
1023
+ */
1024
+ subscribe<T extends IndexerTable>(table: T, input: IndexerReadInput, callback: (snapshot: Snapshot<IndexerRowsByTable[T]>) => void): Effect.Effect<Unsubscribe, IndexerReadError>;
1025
+ /** Sync position per chain. Unauthenticated: a stale index is not a refusal. */
1026
+ readonly status: Effect.Effect<readonly IndexerChainStatus[], IndexerReadError>;
1027
+ }
1028
+ //#endregion
907
1029
  //#region src/flows/types.d.ts
908
1030
  /** The runtime port bundle that `assembleCapxulClient` uses. */
909
1031
  interface FlowPorts {
@@ -916,6 +1038,11 @@ interface FlowPorts {
916
1038
  readonly clock: ClockPort;
917
1039
  readonly telemetry: TelemetryPort;
918
1040
  readonly convexCall: ConvexCallPort;
1041
+ /**
1042
+ * The Ponder read seam (P02). Optional: it is present only when the client
1043
+ * was given an indexer origin, and every existing flow works without it.
1044
+ */
1045
+ readonly indexerRead?: IndexerReadPort;
919
1046
  }
920
1047
  /** Legacy method input retained by the imperative auth surface. */
921
1048
  interface ExternalSigner {
@@ -1153,10 +1280,17 @@ interface ResolvedTarget {
1153
1280
  readonly canPayout: boolean;
1154
1281
  };
1155
1282
  }
1283
+ /**
1284
+ * R09 (#1967): the declared option type is the `InvocationControls` the money
1285
+ * surface already forwards to `deps.invocationControls`, named here exactly as
1286
+ * R02 named it on the address book and R13 on payroll. A caller that captured
1287
+ * one user attempt can hand the same `correlation_id`/`journey_id` to the read
1288
+ * it starts, so the read joins that attempt instead of standing alone.
1289
+ * `{ signal }` callers are unaffected.
1290
+ */
1291
+ type PaymentReadOptions = InvocationControls;
1156
1292
  interface TargetsMethods {
1157
- resolve(reference: TargetReference, options?: {
1158
- readonly signal?: AbortSignal;
1159
- }): Promise<CapxulResult<ResolvedTarget>>;
1293
+ resolve(reference: TargetReference, options?: PaymentReadOptions): Promise<CapxulResult<ResolvedTarget>>;
1160
1294
  }
1161
1295
  type Ref$1 = {
1162
1296
  readonly kind: "handle";
@@ -1203,9 +1337,8 @@ interface MeMethods {
1203
1337
  get(options?: {
1204
1338
  readonly signal?: AbortSignal;
1205
1339
  }): Promise<CapxulResult<MeProfile>>;
1206
- depositInstructions(options?: {
1207
- readonly signal?: AbortSignal;
1208
- }): Promise<CapxulResult<DepositInstructions>>;
1340
+ /** R08 (#1966): accepts a captured attempt, exactly as the treasury read does. */
1341
+ depositInstructions(options?: InvocationControls): Promise<CapxulResult<DepositInstructions>>;
1209
1342
  }
1210
1343
  interface PaymentMoney {
1211
1344
  readonly currency: string;
@@ -1440,6 +1573,8 @@ type ActivityItem = {
1440
1573
  readonly updatedAt: number;
1441
1574
  };
1442
1575
  interface ActivityPage {
1576
+ /** Usable fallback data omits indexed movements; never present it as complete. */
1577
+ readonly readWarning?: "indexer-unavailable";
1443
1578
  readonly items: readonly ActivityItem[];
1444
1579
  readonly cursor: string | null;
1445
1580
  readonly checkpoint: number;
@@ -1461,6 +1596,7 @@ interface ActivitySummaryTotal {
1461
1596
  readonly pendingIn: string;
1462
1597
  }
1463
1598
  interface ActivitySummary {
1599
+ readonly readWarning?: ActivityPage["readWarning"];
1464
1600
  readonly window: {
1465
1601
  readonly from: number | null;
1466
1602
  readonly to: number | null;
@@ -1551,20 +1687,30 @@ interface ActivityAnnotationInput {
1551
1687
  readonly accountingCategory?: string;
1552
1688
  readonly memo?: string;
1553
1689
  }
1690
+ /**
1691
+ * #1960 R02: the declared option type is the `InvocationControls` these methods
1692
+ * have always forwarded to `deps.invocationControls`, so an Activity action can
1693
+ * carry the correlation its UI observation already used. `{ signal }` callers
1694
+ * are unaffected.
1695
+ */
1554
1696
  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;
1697
+ /**
1698
+ * Tell the caller when the indexed page for this actor's Safe changed, over
1699
+ * the indexer's one live connection. The callback carries no rows: it is the
1700
+ * signal to re-read `list` or `summary`. Without an indexer this resolves a
1701
+ * no-op teardown, so a caller needs no branch.
1702
+ *
1703
+ * @internal-use — substrate reactive transport, like `ConvexCallPort.subscribe`.
1704
+ */
1705
+ subscribe(onChange: () => void, params?: {
1706
+ readonly actor?: ActorReference;
1707
+ }, options?: InvocationControls): Promise<CapxulResult<() => void>>;
1708
+ list(params?: ActivityListParams, options?: InvocationControls): Promise<CapxulResult<ActivityPage>>;
1709
+ summary(params?: ActivitySummaryParams, options?: InvocationControls): Promise<CapxulResult<ActivitySummary>>;
1710
+ get(reference: ActivityReference, options?: InvocationControls & {
1563
1711
  readonly actor?: ActorReference;
1564
1712
  }): Promise<CapxulResult<ActivityDetail | null>>;
1565
- annotate(input: ActivityAnnotationInput, options?: {
1566
- readonly signal?: AbortSignal;
1567
- }): Promise<CapxulResult<ActivityAnnotation>>;
1713
+ annotate(input: ActivityAnnotationInput, options?: InvocationControls): Promise<CapxulResult<ActivityAnnotation>>;
1568
1714
  }
1569
1715
  interface OfframpQuoteInput {
1570
1716
  readonly actor?: ActorReference;
@@ -1632,12 +1778,8 @@ interface PaymentsMethods {
1632
1778
  claim(paymentId: string, options?: {
1633
1779
  readonly signal?: AbortSignal;
1634
1780
  }): Promise<CapxulResult<Payment>>;
1635
- list(options?: {
1636
- readonly signal?: AbortSignal;
1637
- }): Promise<CapxulResult<readonly Payment[]>>;
1638
- get(paymentId: string, options?: {
1639
- readonly signal?: AbortSignal;
1640
- }): Promise<CapxulResult<Payment | null>>;
1781
+ list(options?: PaymentReadOptions): Promise<CapxulResult<readonly Payment[]>>;
1782
+ get(paymentId: string, options?: PaymentReadOptions): Promise<CapxulResult<Payment | null>>;
1641
1783
  cancel(paymentId: string, options?: {
1642
1784
  readonly signal?: AbortSignal;
1643
1785
  }): Promise<CapxulResult<Payment>>;
@@ -1718,25 +1860,19 @@ interface AddressBookLabelInput {
1718
1860
  interface AddressBookListInput {
1719
1861
  readonly includeHidden?: boolean;
1720
1862
  }
1863
+ /**
1864
+ * #1960 R02: the declared option type is the `InvocationControls` these methods
1865
+ * have always forwarded to `deps.invocationControls`. Naming it lets a caller
1866
+ * that captured one user attempt hand the same `correlation_id`/`journey_id` to
1867
+ * the operation the attempt starts. `{ signal }` callers are unaffected.
1868
+ */
1721
1869
  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>>;
1870
+ list(input?: AddressBookListInput, options?: InvocationControls): Promise<CapxulResult<readonly AddressBookEntry[]>>;
1871
+ get(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry | null>>;
1872
+ add(input: AddressBookAddInput, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1873
+ hide(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1874
+ unhide(entryId: PartyId, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1875
+ label(input: AddressBookLabelInput, options?: InvocationControls): Promise<CapxulResult<AddressBookEntry>>;
1740
1876
  }
1741
1877
  interface ActorRequest {
1742
1878
  readonly id: string;
@@ -1753,19 +1889,17 @@ interface ActorRequestIssueInput {
1753
1889
  readonly memo?: string;
1754
1890
  readonly expiresAt?: number;
1755
1891
  }
1892
+ /**
1893
+ * The issuer's own requests. The options are the address book's
1894
+ * `InvocationControls` (R07 #1965), so a caller that captured one browser
1895
+ * attempt hands it to the operation that attempt started; `{ signal }` callers
1896
+ * are unaffected.
1897
+ */
1756
1898
  interface ActorRequestsMethods {
1757
- issue(input: ActorRequestIssueInput, options?: {
1758
- readonly signal?: AbortSignal;
1759
- }): Promise<CapxulResult<ActorRequest>>;
1760
- list(options?: {
1761
- readonly signal?: AbortSignal;
1762
- }): Promise<CapxulResult<readonly ActorRequest[]>>;
1763
- get(requestId: string, options?: {
1764
- readonly signal?: AbortSignal;
1765
- }): Promise<CapxulResult<ActorRequest | null>>;
1766
- cancel(requestId: string, options?: {
1767
- readonly signal?: AbortSignal;
1768
- }): Promise<CapxulResult<ActorRequest>>;
1899
+ issue(input: ActorRequestIssueInput, options?: InvocationControls): Promise<CapxulResult<ActorRequest>>;
1900
+ list(options?: InvocationControls): Promise<CapxulResult<readonly ActorRequest[]>>;
1901
+ get(requestId: string, options?: InvocationControls): Promise<CapxulResult<ActorRequest | null>>;
1902
+ cancel(requestId: string, options?: InvocationControls): Promise<CapxulResult<ActorRequest>>;
1769
1903
  }
1770
1904
  interface InboxItem {
1771
1905
  readonly id: string;
@@ -1779,24 +1913,18 @@ interface InboxApproveInput {
1779
1913
  readonly timing?: PaymentTiming;
1780
1914
  readonly permissionId?: string;
1781
1915
  }
1916
+ /** The payer's own inbox. Its scope is the payer's, never the issuer's. */
1782
1917
  interface InboxMethods {
1783
- list(options?: {
1784
- readonly signal?: AbortSignal;
1785
- }): Promise<CapxulResult<readonly InboxItem[]>>;
1786
- approve(input: InboxApproveInput, options?: {
1787
- readonly signal?: AbortSignal;
1788
- }): Promise<CapxulResult<Payment>>;
1789
- decline(requestId: string, options?: {
1790
- readonly signal?: AbortSignal;
1791
- }): Promise<CapxulResult<InboxItem>>;
1918
+ list(options?: InvocationControls): Promise<CapxulResult<readonly InboxItem[]>>;
1919
+ approve(input: InboxApproveInput, options?: InvocationControls): Promise<CapxulResult<Payment>>;
1920
+ decline(requestId: string, options?: InvocationControls): Promise<CapxulResult<InboxItem>>;
1792
1921
  }
1793
1922
  interface ActorProfileMethods {
1794
1923
  get(options?: {
1795
1924
  readonly signal?: AbortSignal;
1796
1925
  }): Promise<CapxulResult<ActorProfile>>;
1797
- depositInstructions(options?: {
1798
- readonly signal?: AbortSignal;
1799
- }): Promise<CapxulResult<DepositInstructions>>;
1926
+ /** R08 (#1966): accepts a captured attempt, exactly as the treasury read does. */
1927
+ depositInstructions(options?: InvocationControls): Promise<CapxulResult<DepositInstructions>>;
1800
1928
  }
1801
1929
  interface ActorRelationshipMethods {
1802
1930
  readonly addressBook: AddressBookMethods;
@@ -1957,6 +2085,12 @@ type ListOrgRolesInput = {
1957
2085
  type ListOrgMembersInput = {
1958
2086
  readonly orgId: OrgId;
1959
2087
  };
2088
+ /**
2089
+ * R06 (#1964): the program attaches the caller's captured attempt to this
2090
+ * record through `copyInvocationObservation`, so the adapter forwards one
2091
+ * observation context to the backend action that owns `org_invite_sent`. The
2092
+ * carrier is a non-enumerable symbol and never becomes a wire field.
2093
+ */
1960
2094
  type InviteOrgMemberInput = {
1961
2095
  readonly orgId: OrgId;
1962
2096
  readonly input: InviteMemberInput;
@@ -2218,9 +2352,15 @@ interface AuthorizeRunInput {
2218
2352
  */
2219
2353
  readonly requestKey?: string;
2220
2354
  }
2221
- type PayrollOptions = {
2222
- readonly signal?: AbortSignal;
2223
- };
2355
+ /**
2356
+ * R13 (#1968): the declared option type is the `InvocationControls` these
2357
+ * methods have always forwarded to `deps.invocationControls` — the same naming
2358
+ * R02 gave the address book. It lets a caller that captured one browser attempt
2359
+ * hand that attempt's `correlation_id`/`journey_id` to the payroll operation it
2360
+ * starts, so `ui_payroll_action_completed` and the durable group and run events
2361
+ * share a correlation. `{ signal }` callers are unaffected.
2362
+ */
2363
+ type PayrollOptions = InvocationControls;
2224
2364
  type AuthorizeRunOptions = PayrollOptions & {
2225
2365
  /** Persist this SDK-allocated key before the first backend write. Reject to prevent execution. */
2226
2366
  readonly onRequestKey?: (key: string) => void | Promise<void>;
@@ -2370,14 +2510,15 @@ interface OrgScopedMethods extends ActorRelationshipMethods {
2370
2510
  retrySetup(options?: {
2371
2511
  readonly signal?: AbortSignal;
2372
2512
  }): Promise<CapxulResult<OrgLifecycle>>;
2373
- /** The Organization treasury Account. */
2374
- treasury(options?: {
2375
- readonly signal?: AbortSignal;
2376
- }): Promise<CapxulResult<Account$1>>;
2513
+ /**
2514
+ * The Organization treasury Account. R08 (#1966): the declared option type is
2515
+ * the `InvocationControls` this surface already forwards, so a screen that
2516
+ * captured one user attempt can hand the same `correlation_id`/`journey_id`
2517
+ * to the read it starts. `{ signal }` callers are unaffected.
2518
+ */
2519
+ treasury(options?: InvocationControls): Promise<CapxulResult<Account$1>>;
2377
2520
  readonly account: {
2378
- get(options?: {
2379
- readonly signal?: AbortSignal;
2380
- }): Promise<CapxulResult<OrganizationAccount>>;
2521
+ get(options?: InvocationControls): Promise<CapxulResult<OrganizationAccount>>;
2381
2522
  };
2382
2523
  members(options?: {
2383
2524
  readonly signal?: AbortSignal;
@@ -2385,9 +2526,14 @@ interface OrgScopedMethods extends ActorRelationshipMethods {
2385
2526
  roles(options?: {
2386
2527
  readonly signal?: AbortSignal;
2387
2528
  }): Promise<CapxulResult<readonly RoleView[]>>;
2388
- invite(input: InviteMemberInput, options?: {
2389
- readonly signal?: AbortSignal;
2390
- }): Promise<CapxulResult<MemberView>>;
2529
+ /**
2530
+ * Invite a member by email. `options` is the browser attempt the caller
2531
+ * captured before the person pressed the button (R06 #1964); it reaches the
2532
+ * backend action unchanged, so the durable `org_invite_sent` and the later
2533
+ * `org_invite_progressed` share the attempt's correlation. `{ signal }`
2534
+ * callers are unaffected.
2535
+ */
2536
+ invite(input: InviteMemberInput, options?: InvocationControls): Promise<CapxulResult<MemberView>>;
2391
2537
  /**
2392
2538
  * Leak-safe Organization payment: execute through the payments engine with
2393
2539
  * the selected receipt-verified Budget Permission
@@ -2486,11 +2632,11 @@ interface MediaMethods {
2486
2632
  }
2487
2633
  //#endregion
2488
2634
  //#region src/contract/system.d.ts
2489
- /** What `system:health` answers. */
2635
+ /** What `system:healthObserved` answers. */
2490
2636
  interface SystemHealth {
2491
2637
  /** The nonce the caller sent, as the backend saw it. */
2492
2638
  readonly nonce: string;
2493
- /** Deployment that answered, e.g. `little-sandpiper-974`. */
2639
+ /** Deployment that answered, e.g. `api` for the Railway staging host. */
2494
2640
  readonly deployment: string;
2495
2641
  /** Backend clock at execution (epoch ms). */
2496
2642
  readonly at: number;
@@ -2602,6 +2748,8 @@ interface IdentityRuntime {
2602
2748
  readonly runFacade?: <T>(verb: IdentityFacadeVerb, controls: InvocationControls | undefined, run: (controls: InvocationControls) => Promise<T>) => Promise<T>;
2603
2749
  }
2604
2750
  interface CapxulClient {
2751
+ /** Stop this client's resources. Repeated calls share the same cleanup. */
2752
+ close(): Promise<CapxulResult<void>>;
2605
2753
  readonly auth: AuthMethods;
2606
2754
  readonly smartAccount: SmartAccountMethods;
2607
2755
  readonly identity: IdentityMethods;
@@ -2676,6 +2824,13 @@ interface CapxulClient {
2676
2824
  * NOT on the public `client.accounts` surface.
2677
2825
  */
2678
2826
  readonly accounts: AccountsFaucetMethods;
2827
+ /**
2828
+ * Ponder read seam (P02). Present only when the client was built with an
2829
+ * indexer origin, so every reader treats it as optional. Ponder holds what
2830
+ * the chain said; Convex holds what the user meant. Reads here never run
2831
+ * inside a write path and never wait for a finality tag.
2832
+ */
2833
+ readonly indexer?: IndexerReadPort;
2679
2834
  /** Quarantined Reference-harness evidence; never a product Organization method. */
2680
2835
  readonly organizationSetup: OrganizationSetupProofMethods;
2681
2836
  /** Product telemetry projection for internal composition and test harnesses. */
@@ -2771,6 +2926,10 @@ interface PostHogObservabilityClient {
2771
2926
  interface PostHogObservabilityOptions {
2772
2927
  /** Consent / kill-switch seam. Defaults to enabled. */
2773
2928
  readonly enabled?: boolean | (() => boolean);
2929
+ /** Omission preserves bootstrap engineering. False/throw closes the acquired runtime's collection. */
2930
+ readonly engineeringEnabled?: boolean | (() => boolean);
2931
+ /** Opt in to code/timing/correlation-only engineering exports. Omission preserves full safe diagnostics. */
2932
+ readonly engineeringPrivacy?: "minimal";
2774
2933
  /** Host environment stamped on every SDK-owned product event. */
2775
2934
  readonly capxulEnv?: CapxulEnv;
2776
2935
  /** Host-owned correlation context shared by product and failure delivery. */
@@ -2875,4 +3034,59 @@ interface ObservationAdapter {
2875
3034
  /** Stable PostHog event used for typed failures that are expected product outcomes. */
2876
3035
  declare const CAPXUL_SDK_EXPECTED_OUTCOME_EVENT = "capxul_sdk_expected_outcome";
2877
3036
  //#endregion
2878
- export { OrganizationPaymentItemInput as $, TelemetryGroupInput as $n, DestinationKind as $t, OrgView as A, TargetReference as An, AddressBookLabelInput as At, PayrollGroup as B, OrgLifecycle as Bn, ActivityKind as Bt, DetectPendingOrgInvitationsResult as C, PaymentTiming as Cn, ActorProfileMethods as Ct, OrgMethods as D, RecipientResolution as Dn, ActorRequestsMethods as Dt, MemberView as E, PaymentsPayInput as En, ActorRequestIssueInput as Et, RoleSpendCap as F, isSettingUpLifecycle as Fn, ActivityAnnotation as Ft, PayrollOptions as G, Permission as Gn, ActivityReference as Gt, PayrollGroupMember as H, PayoutAddress as Hn, ActivityMethods as Ht, RoleView as I, CompleteProfileInput as In, ActivityAnnotationInput as It, PayrollRunStatus as J, PAYMENT_DIRECTIONS as Jn, ActivitySummaryTotal as Jt, PayrollRun as K, SubmittedPermissionExecution as Kn, ActivitySummary as Kt, AuthorizeRunInput as L, IdentityMethods as Ln, ActivityDetail as Lt, OrganizationAuditLogItem as M, fingerprintPaymentIntent as Mn, InboxApproveInput as Mt, ResendInviteTokenInput as N, AccountLifecycle as Nn, InboxItem as Nt, OrgScopedMethods as O, Ref$1 as On, AddressBookAddInput as Ot, RoleDefinition as P, AccountSetupStep as Pn, InboxMethods as Pt, OrganizationPaymentInput as Q, TelemetryEvent as Qn, DestinationAddInput as Qt, AuthorizeRunOptions as R, SmartAccountMethods as Rn, ActivityFilter as Rt, CreateOrgInput as S, PaymentStatus as Sn, ActorProfile as St, MemberStatus as T, PaymentsMethods as Tn, ActorRequest as Tt, PayrollGroupsMethods as U, ActorRef as Un, ActivityPage as Ut, PayrollGroupInput as V, OrgSetupStep as Vn, ActivityListParams as Vt, PayrollMethods as W, CurrentHoldings as Wn, ActivityRange as Wt, PayrollTermsUnit as X, PaymentStatus$1 as Xn, DepositInstructions as Xt, PayrollRuns as Y, PAYMENT_STATUSES as Yn, ActorReference as Yt, OrganizationPaymentBatchInput as Z, RequestStatus as Zn, Destination as Zt, SystemMethods as _, PaymentDocumentRef as _n, OrganizationOnboardingInput as _t, SdkFailureObservation as a, FinancialOpsMethods as an, OrgLane as ar, PermissionOptions as at, CurrentUserContext as b, PaymentDocumentsMethods as bn, ReadyAccountLifecycle as bt, PostHogObservabilityOptions as c, MovementActivityEvidence as cn, destination as cr, PermissionReadResult as ct, CreateCapxulClientInput as d, OfframpQuoteInput as dn, IdentityTransition as dr, OrgMeMethod as dt, DestinationListInput as en, TelemetryIdentifyInput as er, OrganizationPaymentsMethods as et, IdentityProfileDetails as f, OfframpStatus as fn, InvocationControls as fr, OrgMeOptions as ft, Holding as g, PaymentDocumentKind as gn, OrganizationOnboarding as gt, HoldingsMethods as h, PaymentDirection as hn, OnboardingMethods as ht, ObservationDelivery as i, DestinationsMethods as in, IdentityState as ir, PermissionMethods as it, OrganizationAccount as j, TargetsMethods as jn, AddressBookMethods as jt, OrgTemplate as k, ResolvedTarget as kn, AddressBookEntry as kt, postHogObservability as l, OfframpMethods as ln, isClaimed as lr, Budget as lt, IdentityRuntimeSendResult as m, PaymentActivityEvidence as mn, CompletedPersonProfile as mt, ObservationAdapter as n, DestinationRail as nn, Destination$1 as nr, PermissionChangeInput as nt, HostObservability as o, MeMethods as on, Readiness as or, PermissionReplaceInput as ot, IdentityRuntime as p, Payment as pn, AccountsMethods as pt, PayrollRunItemInput as q, InboxStatus as qn, ActivitySummaryParams as qt, ObservationContext as r, DestinationRemoveInput as rn, IdentityEvent as rr, PermissionCreateInput as rt, PostHogObservabilityClient as s, MeProfile as sn, StateLabel as sr, PermissionRevokeInput as st, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as t, DestinationPayload as tn, TelemetryPort as tr, PermissionAssignInput as tt, CapxulClient as u, OfframpQuote as un, isRestoring as ur, OrgMe as ut, SystemHealth as v, PaymentDocumentRender as vn, PersonOnboarding as vt, InviteMemberInput as w, PaymentType as wn, ActorRelationshipMethods as wt, CurrentUserMethods as x, PaymentMoney as xn, AccountMethods as xt, MediaMethods as y, PaymentDocumentVerification as yn, PersonOnboardingInput as yt, PayrollEngagementTerms as z, AuthMethods as zn, ActivityItem as zt };
3037
+ //#region src/ports/diagnostic.d.ts
3038
+ type DiagnosticDetail = Readonly<Record<string, unknown>>;
3039
+ interface DiagnosticPort {
3040
+ readonly trace: (scope: string, detail: DiagnosticDetail) => void;
3041
+ }
3042
+ //#endregion
3043
+ //#region src/openfort/create-openfort-browser-signer.d.ts
3044
+ interface OpenfortBrowserSignerOptions {
3045
+ readonly diagnostic?: DiagnosticPort;
3046
+ /** Testing seam below the existing one-retry recovery owner. */
3047
+ readonly signUserOpHash?: ((hash: Parameters<CapxulSigner["signUserOpHash"]>[0], delegate: CapxulSigner["signUserOpHash"]) => ReturnType<CapxulSigner["signUserOpHash"]>) | undefined;
3048
+ }
3049
+ //#endregion
3050
+ //#region src/production.d.ts
3051
+ /**
3052
+ * Consumer-facing `createCapxulClient` input (SDK DX public surface · #326).
3053
+ * The publishable key is the primary input; bootstrap host, invoke timeout,
3054
+ * runtime detection, and auth-cache selection are SDK-owned defaults.
3055
+ */
3056
+ interface CapxulClientInput {
3057
+ readonly publishableKey: string;
3058
+ /** Public Capxul bootstrap origin; defaults remain unchanged when omitted. */
3059
+ readonly bootstrapBaseUrl?: string;
3060
+ /**
3061
+ * One host-owned product/failure observability module around the host's
3062
+ * existing analytics client. Omit for zero host observation work.
3063
+ */
3064
+ readonly observability?: HostObservability;
3065
+ /**
3066
+ * Init-time account readiness target (issue #159 · AC4). Threaded into
3067
+ * `assembleCapxulClient` so `client.account.{getStatus,ensureReady}` reflect
3068
+ * the consumer's chosen requirement. Optional — defaults to `"none"` (SDK
3069
+ * publish readiness · I3) so `createCapxulClient({ publishableKey })` works
3070
+ * with no account lane.
3071
+ */
3072
+ readonly requirement?: AccountRequirement;
3073
+ /**
3074
+ * Consumer-held signer (backend-orchestrated-deploy.md). Required for
3075
+ * `requirement: "deployed"` flows: `provision` reads `getAddress()` and the
3076
+ * deploy path signs the backend's SafeOp digest via `signUserOpHash()`. The
3077
+ * backend orchestrates build + gas + paymaster + submit — the client never
3078
+ * holds an RPC URL, a gas-sponsorship policy, or a bundler.
3079
+ */
3080
+ readonly signer?: CapxulSigner;
3081
+ }
3082
+ /** Per-client signing controls; only the testing entry exposes these to consumers. */
3083
+ interface ProductionSignerControls {
3084
+ /** Final signing call. Address, readiness and session lifecycle retain their real owner. */
3085
+ readonly signUserOpHash?: (hash: Parameters<CapxulSigner["signUserOpHash"]>[0], signer: CapxulSigner & {
3086
+ readonly resetSession?: () => void;
3087
+ }) => ReturnType<CapxulSigner["signUserOpHash"]>;
3088
+ /** Embedded signing calls, including the existing recovery owner's single retry. */
3089
+ readonly signEmbeddedUserOpHash?: OpenfortBrowserSignerOptions["signUserOpHash"];
3090
+ }
3091
+ //#endregion
3092
+ export { OrganizationPaymentBatchInput as $, RequestStatus as $n, Destination as $t, OrgScopedMethods as A, Ref$1 as An, AddressBookAddInput as At, AuthorizeRunOptions as B, SmartAccountMethods as Bn, ActivityFilter as Bt, CurrentUserMethods as C, PaymentMoney as Cn, AccountMethods as Ct, MemberStatus as D, PaymentsMethods as Dn, ActorRequest as Dt, InviteMemberInput as E, PaymentType as En, ActorRelationshipMethods as Et, ResendInviteTokenInput as F, AccountLifecycle as Fn, InboxItem as Ft, PayrollGroupsMethods as G, ActorRef as Gn, ActivityPage as Gt, PayrollGroup as H, OrgLifecycle as Hn, ActivityKind as Ht, RoleDefinition as I, AccountSetupStep as In, InboxMethods as It, PayrollRun as J, SubmittedPermissionExecution as Jn, ActivitySummary as Jt, PayrollMethods as K, CurrentHoldings as Kn, ActivityRange as Kt, RoleSpendCap as L, isSettingUpLifecycle as Ln, ActivityAnnotation as Lt, OrgView as M, TargetReference as Mn, AddressBookLabelInput as Mt, OrganizationAccount as N, TargetsMethods as Nn, AddressBookMethods as Nt, MemberView as O, PaymentsPayInput as On, ActorRequestIssueInput as Ot, OrganizationAuditLogItem as P, fingerprintPaymentIntent as Pn, InboxApproveInput as Pt, PayrollTermsUnit as Q, PaymentStatus$1 as Qn, DepositInstructions as Qt, RoleView as R, CompleteProfileInput as Rn, ActivityAnnotationInput as Rt, CurrentUserContext as S, PaymentDocumentsMethods as Sn, ReadyAccountLifecycle as St, DetectPendingOrgInvitationsResult as T, PaymentTiming as Tn, ActorProfileMethods as Tt, PayrollGroupInput as U, OrgSetupStep as Un, ActivityListParams as Ut, PayrollEngagementTerms as V, AuthMethods as Vn, ActivityItem as Vt, PayrollGroupMember as W, PayoutAddress as Wn, ActivityMethods as Wt, PayrollRunStatus as X, PAYMENT_DIRECTIONS as Xn, ActivitySummaryTotal as Xt, PayrollRunItemInput as Y, InboxStatus as Yn, ActivitySummaryParams as Yt, PayrollRuns as Z, PAYMENT_STATUSES as Zn, ActorReference as Zt, HoldingsMethods as _, PaymentDirection as _n, OnboardingMethods as _t, ObservationContext as a, DestinationRemoveInput as an, IdentityEvent as ar, PermissionCreateInput as at, SystemHealth as b, PaymentDocumentRender as bn, PersonOnboarding as bt, HostObservability as c, MeMethods as cn, Readiness as cr, PermissionReplaceInput as ct, postHogObservability as d, OfframpMethods as dn, isClaimed as dr, Budget as dt, DestinationAddInput as en, TelemetryEvent as er, OrganizationPaymentInput as et, CapxulClient as f, OfframpQuote as fn, isRestoring as fr, OrgMe as ft, IdentityRuntimeSendResult as g, PaymentActivityEvidence as gn, CompletedPersonProfile as gt, IdentityRuntime as h, Payment as hn, AccountsMethods as ht, ObservationAdapter as i, DestinationRail as in, Destination$1 as ir, PermissionChangeInput as it, OrgTemplate as j, ResolvedTarget as jn, AddressBookEntry as jt, OrgMethods as k, RecipientResolution as kn, ActorRequestsMethods as kt, PostHogObservabilityClient as l, MeProfile as ln, StateLabel as lr, PermissionRevokeInput as lt, IdentityProfileDetails as m, OfframpStatus as mn, InvocationControls as mr, OrgMeOptions as mt, ProductionSignerControls as n, DestinationListInput as nn, TelemetryIdentifyInput as nr, OrganizationPaymentsMethods as nt, ObservationDelivery as o, DestinationsMethods as on, IdentityState as or, PermissionMethods as ot, CreateCapxulClientInput as p, OfframpQuoteInput as pn, IdentityTransition as pr, OrgMeMethod as pt, PayrollOptions as q, Permission as qn, ActivityReference as qt, CAPXUL_SDK_EXPECTED_OUTCOME_EVENT as r, DestinationPayload as rn, TelemetryPort as rr, PermissionAssignInput as rt, SdkFailureObservation as s, FinancialOpsMethods as sn, OrgLane as sr, PermissionOptions as st, CapxulClientInput as t, DestinationKind as tn, TelemetryGroupInput as tr, OrganizationPaymentItemInput as tt, PostHogObservabilityOptions as u, MovementActivityEvidence as un, destination as ur, PermissionReadResult as ut, Holding as v, PaymentDocumentKind as vn, OrganizationOnboarding as vt, CreateOrgInput as w, PaymentStatus as wn, ActorProfile as wt, MediaMethods as x, PaymentDocumentVerification as xn, PersonOnboardingInput as xt, SystemMethods as y, PaymentDocumentRef as yn, OrganizationOnboardingInput as yt, AuthorizeRunInput as z, IdentityMethods as zn, ActivityDetail as zt };