@capxul/observability 4.2.0-rc.9 → 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.
package/dist/index.mjs CHANGED
@@ -1,41 +1,5 @@
1
- import { i as redactUrlSecrets, n as isCredentialField, r as redactSecrets, t as CAPXUL_ERROR_CODES } from "./src-CWfRYsBI.mjs";
1
+ import { a as CHAIN_UPSTREAMS, c as redactSecrets, i as CAPXUL_ERROR_CODES, l as redactUrlSecrets, n as isCapxulOperation, o as FAILURE_MODES, r as normalizeCapxulOperation, s as isCredentialField, t as CAPXUL_OPERATIONS } from "./operations-sJPrehYY.mjs";
2
2
  import { Effect, Schema, SchemaGetter } from "effect";
3
- //#region ../errors/src/chain-cause.ts
4
- /**
5
- * Why an operation failed — the one flat vocabulary. The first four are the
6
- * auth/provider diagnoses that predate this file. The rest name the chain
7
- * path. `FailureMode` is derived from this list so a runtime membership check
8
- * (the SDK's `$exception` projection, the observability schema) and the type
9
- * can never drift apart.
10
- */
11
- const FAILURE_MODES = [
12
- "auth-origin-mismatch",
13
- "stale-openfort-cache",
14
- "app-env-allowlist",
15
- "no-secure-context",
16
- "signer-not-ready",
17
- "rate-limited",
18
- "timeout",
19
- "upstream-down",
20
- "revert",
21
- "insufficient-balance",
22
- "insufficient-allowance",
23
- "rejected",
24
- "unauthorized",
25
- "forbidden",
26
- "bad-request",
27
- "method-unsupported",
28
- "unknown"
29
- ];
30
- /** Who answered. `alto` is the bundler; `gateway` is the AA gateway's own logic. */
31
- const CHAIN_UPSTREAMS = [
32
- "alchemy",
33
- "infura",
34
- "public",
35
- "alto",
36
- "gateway"
37
- ];
38
- //#endregion
39
3
  //#region ../types/src/index.ts
40
4
  const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;
41
5
  const BYTES32_RE = /^0x[0-9a-f]{64}$/i;
@@ -72,402 +36,6 @@ Object.fromEntries(SUPPORTED_CURRENCIES.map((currency) => [currency.code, curren
72
36
  const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;
73
37
  Math.floor(Number.MAX_SAFE_INTEGER / 1e3);
74
38
  //#endregion
75
- //#region src/operations.ts
76
- const CAPXUL_OPERATIONS = {
77
- account: {
78
- addressBook: {
79
- add: "account.addressBook.add",
80
- get: "account.addressBook.get",
81
- hide: "account.addressBook.hide",
82
- label: "account.addressBook.label",
83
- list: "account.addressBook.list",
84
- unhide: "account.addressBook.unhide"
85
- },
86
- balance: "account.balance",
87
- faucetMint: "account.faucetMint",
88
- getLifecycle: "account.getLifecycle",
89
- readBalance: "account.readBalance",
90
- retrySetup: "account.retrySetup",
91
- status: "account.status",
92
- profile: {
93
- depositInstructions: "account.profile.depositInstructions",
94
- get: "account.profile.get"
95
- },
96
- inbox: {
97
- approve: "account.inbox.approve",
98
- decline: "account.inbox.decline",
99
- list: "account.inbox.list"
100
- },
101
- requests: {
102
- cancel: "account.requests.cancel",
103
- get: "account.requests.get",
104
- issue: "account.requests.issue",
105
- list: "account.requests.list"
106
- }
107
- },
108
- accounts: {
109
- fund: "accounts.fund",
110
- read: "accounts.read"
111
- },
112
- activity: {
113
- annotate: "activity.annotate",
114
- emitAnnotationSaved: "activity.emitAnnotationSaved",
115
- get: "activity.get",
116
- list: "activity.list",
117
- /** The SDK's live Activity read over the indexer's SSE stream. */
118
- subscribe: "activity.subscribe",
119
- summary: "activity.summary"
120
- },
121
- addressBook: {
122
- add: "addressBook.add",
123
- emitRelationshipChanged: "addressBook.emitRelationshipChanged",
124
- get: "addressBook.get",
125
- hide: "addressBook.hide",
126
- label: "addressBook.label",
127
- list: "addressBook.list",
128
- unhide: "addressBook.unhide"
129
- },
130
- applications: { create: "applications.create" },
131
- auth: {
132
- canSendOtp: "auth.canSendOtp",
133
- getSession: "auth.getSession",
134
- signIn: "auth.signIn",
135
- signOut: "auth.signOut",
136
- sendVerificationOtp: "auth.sendVerificationOTP",
137
- verifyOtp: "auth.verifyOtp"
138
- },
139
- client: {
140
- createOrg: "createOrg",
141
- orgs: "orgs"
142
- },
143
- credentials: {
144
- bootstrapClient: "credentials.bootstrapClient",
145
- mintQuickstartKey: "credentials.mintQuickstartKey"
146
- },
147
- currentUser: { get: "currentUser.get" },
148
- devIdentity: { seedFinancialOpsOrg: "devIdentity.seedFinancialOpsOrg" },
149
- dev: { browserSeed: "dev.browserSeed" },
150
- destinations: {
151
- add: "destinations.add",
152
- list: "destinations.list",
153
- remove: "destinations.remove"
154
- },
155
- faucetSafe: { deploy: "FaucetSafe.deploy" },
156
- financialOps: {
157
- addDestination: "financialOps.addDestination",
158
- approveRequest: "financialOps.approveRequest",
159
- cancelRequest: "financialOps.cancelRequest",
160
- createPayee: "financialOps.createPayee",
161
- declineRequest: "financialOps.declineRequest",
162
- emitPaymentWriterTelemetry: "financialOps.emitPaymentWriterTelemetry",
163
- issueRequest: "financialOps.issueRequest",
164
- recoverSettlementVerification: "financialOps.recoverSettlementVerification",
165
- removeDestination: "financialOps.removeDestination",
166
- verifySettlement: "financialOps.verifySettlement"
167
- },
168
- holdings: {
169
- current: "holdings.current",
170
- primary: "holdings.primary"
171
- },
172
- identity: {
173
- accountAt: "identity.AccountAt",
174
- accountClaimed: "identity.AccountClaimed",
175
- accountClaiming: "identity.AccountClaiming",
176
- accountDerived: "identity.AccountDerived",
177
- accountFailed: "identity.AccountFailed",
178
- attachOrganization: "identity.AttachOrganization",
179
- claimAccount: "identity.ClaimAccount",
180
- completeOnboarding: "identity.completeOnboarding",
181
- completeProfile: "identity.completeProfile",
182
- create: "identity.create",
183
- createOrganization: "identity.CreateOrganization",
184
- ensureAccount: "identity.EnsureAccount",
185
- leaveOrganization: "identity.LeaveOrganization",
186
- loadByAuthUserId: "identity.loadByAuthUserId",
187
- loadCurrent: "identity.loadCurrent",
188
- orgAt: "identity.OrgAt",
189
- orgFailed: "identity.OrgFailed",
190
- orgReady: "identity.OrgReady",
191
- otpFailed: "identity.OtpFailed",
192
- otpSent: "identity.OtpSent",
193
- readSession: "identity.ReadSession",
194
- requestOtp: "identity.RequestOtp",
195
- reset: "identity.Reset",
196
- restoreSession: "identity.RestoreSession",
197
- resumeOtpEntry: "identity.ResumeOtpEntry",
198
- retryAccount: "identity.RetryAccount",
199
- retryOrganization: "identity.RetryOrganization",
200
- sessionAbsent: "identity.SessionAbsent",
201
- sessionRead: "identity.SessionRead",
202
- sessionReadFailed: "identity.SessionReadFailed",
203
- sessionRestored: "identity.SessionRestored",
204
- signedOut: "identity.SignedOut",
205
- signOut: "identity.SignOut",
206
- signOutFailed: "identity.SignOutFailed",
207
- update: "identity.update",
208
- handleAvailable: "identity.handleAvailable",
209
- verified: "identity.Verified",
210
- verifyFailed: "identity.VerifyFailed",
211
- verifyOtp: "identity.VerifyOtp"
212
- },
213
- media: {
214
- generateUploadUrl: "media.generateUploadUrl",
215
- setOrgLogo: "media.setOrgLogo",
216
- setProfileImage: "media.setProfileImage",
217
- uploadImage: "media.uploadImage"
218
- },
219
- me: {
220
- depositInstructions: "me.depositInstructions",
221
- get: "me.get"
222
- },
223
- moneyExecution: {
224
- abandonPaymentExecution: "moneyExecution.abandonPaymentExecution",
225
- prepareOrganizationPaymentExecution: "moneyExecution.prepareOrganizationPaymentExecution",
226
- preparePaymentExecution: "moneyExecution.preparePaymentExecution",
227
- preparePaymentLifecycleExecution: "moneyExecution.preparePaymentLifecycleExecution",
228
- preparePermissionExecution: "moneyExecution.preparePermissionExecution",
229
- recoverSubmissionClaims: "moneyExecution.recoverSubmissionClaims",
230
- submit: "moneyExecution.submit",
231
- submitPaymentCommandExecution: "moneyExecution.submitPaymentCommandExecution",
232
- submitPaymentExecution: "moneyExecution.submitPaymentExecution",
233
- submitPermissionExecution: "moneyExecution.submitPermissionExecution"
234
- },
235
- movement: {
236
- emitDepositSettled: "movement.emitDepositSettled",
237
- scan: "movement.scan"
238
- },
239
- inbox: {
240
- approve: "inbox.approve",
241
- decline: "inbox.decline",
242
- list: "inbox.list"
243
- },
244
- offramp: {
245
- quote: "offramp.quote",
246
- status: "offramp.status"
247
- },
248
- onboarding: {
249
- completeOrganization: "onboarding.completeOrganization",
250
- completePerson: "onboarding.completePerson"
251
- },
252
- org: {
253
- acceptInvitations: "org.acceptInvitations",
254
- account: { get: "org.account.get" },
255
- activateMember: "org.activateMember",
256
- auditLog: "org.auditLog",
257
- confirmBootstrap: "org.confirmBootstrap",
258
- createOrg: "org.createOrg",
259
- create: "org.create",
260
- detectAndAcceptPendingInvitations: "org.detectAndAcceptPendingInvitations",
261
- expireInvitations: "org.expireInvitations",
262
- getLifecycle: "org.getLifecycle",
263
- getProofReceipt: "org.getProofReceipt",
264
- invite: "org.invite",
265
- inviteMember: "org.inviteMember",
266
- list: "org.list",
267
- load: "org.load",
268
- me: "org.me",
269
- members: "org.members",
270
- orgs: "org.orgs",
271
- payment: "org.payment",
272
- permissions: {
273
- assign: "org.permissions.assign",
274
- change: "org.permissions.change",
275
- create: "org.permissions.create",
276
- get: "org.permissions.get",
277
- list: "org.permissions.list",
278
- replace: "org.permissions.replace",
279
- revoke: "org.permissions.revoke"
280
- },
281
- payments: {
282
- pay: "org.payments.pay",
283
- payBatch: "org.payments.payBatch"
284
- },
285
- payroll: {
286
- authorizeRun: "org.payroll.authorizeRun",
287
- groups: {
288
- list: "org.payroll.groups.list",
289
- remove: "org.payroll.groups.remove",
290
- save: "org.payroll.groups.save"
291
- },
292
- runs: "org.payroll.runs",
293
- terms: "org.payroll.terms"
294
- },
295
- addressBook: {
296
- add: "org.addressBook.add",
297
- get: "org.addressBook.get",
298
- hide: "org.addressBook.hide",
299
- label: "org.addressBook.label",
300
- list: "org.addressBook.list",
301
- unhide: "org.addressBook.unhide"
302
- },
303
- inbox: {
304
- approve: "org.inbox.approve",
305
- decline: "org.inbox.decline",
306
- list: "org.inbox.list"
307
- },
308
- lifecycle: { startOrResume: "org.lifecycle.startOrResume" },
309
- prepareBootstrap: "org.prepareBootstrap",
310
- prepareFounderAccount: "org.prepareFounderAccount",
311
- profile: {
312
- depositInstructions: "org.profile.depositInstructions",
313
- get: "org.profile.get"
314
- },
315
- readTreasury: "org.readTreasury",
316
- requests: {
317
- cancel: "org.requests.cancel",
318
- get: "org.requests.get",
319
- issue: "org.requests.issue",
320
- list: "org.requests.list"
321
- },
322
- recordFailure: "org.recordFailure",
323
- recordProgress: "org.recordProgress",
324
- resendInviteToken: "org.resendInviteToken",
325
- resumeBootstrapSubmission: "org.resumeBootstrapSubmission",
326
- retry: "org.retry",
327
- retrySetup: "org.retrySetup",
328
- roles: "org.roles",
329
- startOrResume: "org.startOrResume",
330
- submitBootstrap: "org.submitBootstrap",
331
- treasury: "org.treasury"
332
- },
333
- organization: { setup: "organization.setup" },
334
- organizationPayments: {
335
- pay: "organizationPayments.pay",
336
- payBatch: "organizationPayments.payBatch",
337
- prepareExecution: "organizationPayments.prepareExecution",
338
- retry: "organizationPayments.retry"
339
- },
340
- organizationSetup: { getProofReceipt: "organizationSetup.getProofReceipt" },
341
- organizations: { detectAndAcceptPendingInvitations: "orgs.detectAndAcceptPendingInvitations" },
342
- payments: {
343
- cancel: "payments.cancel",
344
- claim: "payments.claim",
345
- createCommitment: "payments.createCommitment",
346
- get: "payments.get",
347
- ledger: "payments",
348
- list: "payments.list",
349
- pay: "payments.pay",
350
- prepareExecution: "payments.prepareExecution",
351
- prepareLifecycleExecution: "payments.prepareLifecycleExecution",
352
- redirect: "payments.redirect",
353
- retry: "payments.retry",
354
- submitCommandExecution: "payments.submitCommandExecution",
355
- submitExecution: "payments.submitExecution"
356
- },
357
- paymentDocuments: {
358
- render: "paymentDocuments.render",
359
- verify: "paymentDocuments.verify"
360
- },
361
- recipient: { resolve: "recipient.resolve" },
362
- payroll: {
363
- authorizeRun: "payroll.authorizeRun",
364
- groups: {
365
- access: "payroll.groups",
366
- list: "payroll.groups.list",
367
- remove: "payroll.groups.remove",
368
- save: "payroll.groups.save"
369
- },
370
- removeGroup: "payroll.removeGroup",
371
- runs: "payroll.runs",
372
- saveGroup: "payroll.saveGroup",
373
- terms: "payroll.terms"
374
- },
375
- permission: {
376
- command: "permission.command",
377
- retryVerification: "permission.retryVerification",
378
- verify: "permission.verify",
379
- verifySubmitted: "permission.verifySubmitted"
380
- },
381
- permissions: {
382
- assign: "permissions.assign",
383
- change: "permissions.change",
384
- create: "permissions.create",
385
- get: "permissions.get",
386
- list: "permissions.list",
387
- prepareExecution: "permissions.prepareExecution",
388
- replace: "permissions.replace",
389
- revoke: "permissions.revoke",
390
- submitExecution: "permissions.submitExecution"
391
- },
392
- publishableKeys: {
393
- mint: "publishableKeys.mint",
394
- revoke: "publishableKeys.revoke",
395
- rotate: "publishableKeys.rotate"
396
- },
397
- requests: {
398
- cancel: "requests.cancel",
399
- get: "requests.get",
400
- issue: "requests.issue",
401
- list: "requests.list"
402
- },
403
- runtime: {
404
- assign: "assign",
405
- canSendOtp: "canSendOtp",
406
- cancelCommitment: "cancel_commitment",
407
- change: "change",
408
- claimCommitment: "claim_commitment",
409
- create: "create",
410
- createCapxulClient: "createCapxulClient",
411
- createCapxulClientWithOrgDeploymentSeams: "createCapxulClientWithOrgDeploymentSeams",
412
- createCommitment: "create_commitment",
413
- getConvexJwt: "getConvexJwt",
414
- getSession: "getSession",
415
- initialize: "initialize",
416
- mutation: "mutation",
417
- now: "now",
418
- port: "port",
419
- query: "query",
420
- redirectCommitment: "redirect_commitment",
421
- replace: "replace",
422
- resolve: "resolve",
423
- revoke: "revoke",
424
- send: "send",
425
- sendOtp: "sendOtp",
426
- signIn: "signIn",
427
- signOut: "signOut",
428
- sleep: "sleep",
429
- verifyOtp: "verifyOtp",
430
- wallet: "wallet"
431
- },
432
- smartAccount: {
433
- claim: "smartAccount.claim",
434
- confirmDeployment: "smartAccount.confirmDeployment",
435
- loadByAuthUserId: "smartAccount.loadByAuthUserId",
436
- loadCurrent: "smartAccount.loadCurrent",
437
- provision: "smartAccount.provision"
438
- },
439
- system: {
440
- health: "system.health",
441
- ping: "system.ping",
442
- runtimeChain: "system.runtimeChain"
443
- },
444
- testUsdc: { mint: "TestUSDC.mint" },
445
- _internal: {
446
- accounts: { fund: "_internal.accounts.fund" },
447
- close: "_internal.close",
448
- identity: {
449
- completeProfile: "_internal.identity.completeProfile",
450
- runFacade: "_internal.identity.runFacade",
451
- send: "_internal.identity.send"
452
- },
453
- organizationSetup: { getProofReceipt: "_internal.organizationSetup.getProofReceipt" }
454
- },
455
- tenancy: {
456
- revokeBackendTenancyConsent: "tenancy.revokeBackendTenancyConsent",
457
- seedBackendTenancy: "tenancy.seedBackendTenancy"
458
- }
459
- };
460
- function collectOperations(tree) {
461
- return Object.values(tree).flatMap((value) => typeof value === "string" ? [value] : collectOperations(value));
462
- }
463
- const operations = new Set(collectOperations(CAPXUL_OPERATIONS));
464
- function isCapxulOperation(value) {
465
- return typeof value === "string" && operations.has(value);
466
- }
467
- function normalizeCapxulOperation(value) {
468
- return isCapxulOperation(value) ? value : "unknown";
469
- }
470
- //#endregion
471
39
  //#region src/index.ts
472
40
  const TELEMETRY_EVENT_NAMES = [
473
41
  "auth_otp_requested",
@@ -521,6 +89,7 @@ const TELEMETRY_EVENT_NAMES = [
521
89
  "movement_scan_window",
522
90
  "movement_scan_checkpoint",
523
91
  "movement_scan_incident",
92
+ "indexer_drift_corrected",
524
93
  "activity_annotation_saved",
525
94
  "ui_activity_action_completed",
526
95
  "contact_relationship_changed",
@@ -535,7 +104,8 @@ const TELEMETRY_EVENT_NAMES = [
535
104
  "ui_receive_step_completed",
536
105
  "payroll_group_changed",
537
106
  "payroll_run_transitioned",
538
- "ui_payroll_action_completed"
107
+ "ui_payroll_action_completed",
108
+ "cli_diagnostic_completed"
539
109
  ];
540
110
  const TELEMETRY_JOURNEYS = {
541
111
  returning_user_login: {
@@ -733,6 +303,10 @@ const OptionalAccountId = Schema.optional(AccountIdSchema);
733
303
  const OptionalWeiAmount = Schema.optional(WeiAmountSchema);
734
304
  const OptionalCurrencyCode = Schema.optional(CurrencyCodeSchema);
735
305
  const OptionalBalanceBucket = Schema.optional(BalanceBucketSchema);
306
+ /** Which Safe a money record is about. Declared here so the money-domain
307
+ * props below can name it as well as the UI-step props further down. */
308
+ const AccountKindSchema = Schema.Literals(["personalSafe", "orgTreasury"]);
309
+ const OptionalAccountKind = Schema.optional(AccountKindSchema);
736
310
  const OptionalAddress = Schema.optional(AddressSchema);
737
311
  const OptionalAppId = Schema.optional(AppIdSchema);
738
312
  const OptionalBlockNumber = Schema.optional(BlockNumberSchema);
@@ -928,9 +502,22 @@ const BootstrapFailedProps = Schema.Struct({
928
502
  reason: OptionalString,
929
503
  target_host: OptionalString
930
504
  });
505
+ /**
506
+ * R08 (#1966): which Safe was read, on which chain, of which token. `currency`
507
+ * is the DISPLAY code the surface shows ("USD"); it never says which ERC-20 the
508
+ * `balanceOf` actually hit, so a reader could not tell a treasury read from a
509
+ * personal one, nor USDX from any other dollar-labelled token. The producer
510
+ * takes each of these from the authority that already decided it — the verified
511
+ * Organization row's chain, the configured token address — never from a label.
512
+ * The verified `organization_id` and its group arrive from the backend
513
+ * attribution, so they are not repeated here.
514
+ */
931
515
  const AccountBalanceReadProps = Schema.Struct({
932
516
  ...TelemetryEnvelopeProps,
933
517
  account_id: OptionalAccountId,
518
+ account_kind: OptionalAccountKind,
519
+ chain_id: OptionalChainId,
520
+ token_address: OptionalAddress,
934
521
  currency: OptionalCurrencyCode,
935
522
  balance_bucket: OptionalBalanceBucket,
936
523
  durationMs: OptionalDurationMs
@@ -1298,7 +885,27 @@ const PermissionMirrorVerificationProps = Schema.Struct({
1298
885
  "conflicting_replay",
1299
886
  "revision_mismatch"
1300
887
  ])),
1301
- command_id: OptionalString
888
+ command_id: OptionalString,
889
+ /**
890
+ * #1961 R03. The authorized stored row names the Permission it changed; the
891
+ * verified receipt names the chain facts that prove it. Every field is
892
+ * optional because a pending or provider-failed verification has neither an
893
+ * application result nor a receipt to report.
894
+ */
895
+ permission_id: OptionalString,
896
+ permission_assignment_id: OptionalString,
897
+ permission_operation: Schema.optional(Schema.Literals([
898
+ "create",
899
+ "change",
900
+ "assign",
901
+ "revoke",
902
+ "replace"
903
+ ])),
904
+ revision: Schema.optional(Schema.Number),
905
+ user_op_hash: OptionalString,
906
+ transaction_hash: OptionalString,
907
+ block_number: Schema.optional(Schema.Number),
908
+ log_index: Schema.optional(Schema.Number)
1302
909
  });
1303
910
  const MovementScanWindowProps = Schema.Struct({
1304
911
  ...TelemetryEnvelopeProps,
@@ -1324,6 +931,33 @@ const MovementScanIncidentProps = Schema.Struct({
1324
931
  incident_kind: Schema.String,
1325
932
  anchor_block_number: Schema.Number
1326
933
  });
934
+ /**
935
+ * One durable row the reconciliation job corrected against Ponder (SPEC D9).
936
+ *
937
+ * Both block fields are optional and for the same reason: a correction INTO
938
+ * drift (a Payment settled in Convex whose Ponder fact a reorg removed) has no
939
+ * current block, and a correction that confirms a later fact has one.
940
+ *
941
+ * `projection_kind` is closed. A later ticket that reconciles a deploy, a
942
+ * bootstrap or a grant outcome adds its kind here in the same change; an
943
+ * unknown kind must not decode.
944
+ */
945
+ const IndexerDriftCorrectedProps = Schema.Struct({
946
+ ...TelemetryEnvelopeProps,
947
+ projection_kind: Schema.Literals([
948
+ "member_authority",
949
+ "payment_settlement",
950
+ "permission_assignment"
951
+ ]),
952
+ previous_state: Schema.String,
953
+ current_state: Schema.String,
954
+ previous_block: Schema.optional(Schema.Number),
955
+ current_block: Schema.optional(Schema.Number),
956
+ logical_event_id: Schema.optional(Schema.String),
957
+ scope_kind: Schema.optional(Schema.Literals(["account", "organization"])),
958
+ account_id: OptionalAccountId,
959
+ reference_id: OptionalString
960
+ });
1327
961
  const AuthOtpRequestedTelemetryEventSchema = Schema.Struct({
1328
962
  name: Schema.Literal("auth_otp_requested"),
1329
963
  props: AuthOtpRequestedProps
@@ -1528,9 +1162,12 @@ const MovementScanIncidentTelemetryEventSchema = Schema.Struct({
1528
1162
  name: Schema.Literal("movement_scan_incident"),
1529
1163
  props: MovementScanIncidentProps
1530
1164
  });
1165
+ const IndexerDriftCorrectedTelemetryEventSchema = Schema.Struct({
1166
+ name: Schema.Literal("indexer_drift_corrected"),
1167
+ props: IndexerDriftCorrectedProps
1168
+ });
1531
1169
  /** The one spelling of "whose scope did this happen in" across every surface. */
1532
1170
  const ScopeKindSchema = Schema.Literals(["account", "organization"]);
1533
- const AccountKindSchema = Schema.Literals(["personalSafe", "orgTreasury"]);
1534
1171
  const OptionalReasonCode = Schema.optional(Schema.Literals(CAPXUL_ERROR_CODES));
1535
1172
  const ActivityReferenceProps = {
1536
1173
  reference_kind: Schema.Literals(["payment", "movement"]),
@@ -1595,6 +1232,21 @@ const ContactActionProps = {
1595
1232
  party_id: OptionalString,
1596
1233
  reason_code: OptionalReasonCode
1597
1234
  };
1235
+ /** One completed online CLI diagnostic. No command input or provider text. */
1236
+ const CliDiagnosticCompletedTelemetryEventSchema = Schema.Struct({
1237
+ name: Schema.Literal("cli_diagnostic_completed"),
1238
+ props: Schema.Struct({
1239
+ ...TelemetryEnvelopeProps,
1240
+ outcome: Schema.Literals([
1241
+ "succeeded",
1242
+ "refused",
1243
+ "failed",
1244
+ "cancelled"
1245
+ ]),
1246
+ invocation_id: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u)),
1247
+ cli_version: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/u))
1248
+ })
1249
+ });
1598
1250
  const UiContactActionCompletedTelemetryEventSchema = Schema.Struct({
1599
1251
  name: Schema.Literal("ui_contact_action_completed"),
1600
1252
  props: Schema.Union([
@@ -1628,6 +1280,16 @@ const ActivityAnnotationSavedTelemetryEventSchema = Schema.Struct({
1628
1280
  const UiActivityActionCompletedTelemetryEventSchema = Schema.Struct({
1629
1281
  name: Schema.Literal("ui_activity_action_completed"),
1630
1282
  props: Schema.Union([
1283
+ Schema.Struct({
1284
+ ...ActivityActionProps,
1285
+ action: Schema.Literal("read"),
1286
+ outcome: Schema.Literals(["partial_displayed", "recovered"]),
1287
+ surface: Schema.Literals([
1288
+ "transactions",
1289
+ "recent",
1290
+ "summary"
1291
+ ])
1292
+ }),
1631
1293
  Schema.Struct({
1632
1294
  ...ActivityActionProps,
1633
1295
  ...ActivityFilterProps,
@@ -1708,6 +1370,18 @@ const AccessRecoveryCompletedTelemetryEventSchema = Schema.Struct({
1708
1370
  name: Schema.Literal("access_recovery_completed"),
1709
1371
  props: AccessRecoveryCompletedProps
1710
1372
  });
1373
+ /**
1374
+ * R05 (#1963) wired three of these steps at the app's dashboard Access
1375
+ * boundary: `dashboard_granted` on the commit of the granted content,
1376
+ * `gate_error_displayed` on the mounted error surface, and `retry_selected` on
1377
+ * the actual selection. `redirect_completed` stays RESERVED and unproduced —
1378
+ * asking for a navigation is not arriving, and the destination page's own
1379
+ * normalized pageview already carries the arrival on the same journey, so a
1380
+ * second event would add no fact. `capability_refusal_displayed` and
1381
+ * `signer_refusal_displayed` belong to the screens that draw those refusals
1382
+ * (Recipients, Invoice, Payroll, Quick Pay); Access publishes the contract and
1383
+ * the `CanReason` those owners report, and produces neither itself.
1384
+ */
1711
1385
  const UiAccessStepCompletedTelemetryEventSchema = Schema.Struct({
1712
1386
  name: Schema.Literal("ui_access_step_completed"),
1713
1387
  props: Schema.Struct({
@@ -1733,6 +1407,17 @@ const UiAccessStepCompletedTelemetryEventSchema = Schema.Struct({
1733
1407
  ]))
1734
1408
  })
1735
1409
  });
1410
+ /**
1411
+ * R06 (#1964) wired three of the four progress words to the durable writer that
1412
+ * commits each one. `account_ready` comes from `org/memberLifecycle.ts`, for
1413
+ * every membership row a claimed personal Account actually advanced.
1414
+ * `permission_applied` and `membership_activated` come from
1415
+ * `permission/mirror.ts`: the first only when the mirror wrote a NEW Permission
1416
+ * state, the second only when that call flipped a `pending_grant` row to
1417
+ * `active`. A replay of an applied command writes neither, so it reports
1418
+ * neither. `revoked` stays RESERVED and unproduced — no writer revokes a
1419
+ * membership yet, and #1459 owns that ceremony.
1420
+ */
1736
1421
  const OrgInviteProgressedTelemetryEventSchema = Schema.Struct({
1737
1422
  name: Schema.Literal("org_invite_progressed"),
1738
1423
  props: Schema.Struct({
@@ -1844,6 +1529,12 @@ const PayrollRunTransitionedTelemetryEventSchema = Schema.Struct({
1844
1529
  "settled"
1845
1530
  ]),
1846
1531
  run_id: Schema.String,
1532
+ /**
1533
+ * The `paymentCommands` row at `payrollRuns.batchRef` — the durable owner of
1534
+ * this run's Payment membership. `payment_count` counts THAT command's
1535
+ * `paymentIds`, so an unrelated Payment quoting the run id changes neither.
1536
+ */
1537
+ command_id: OptionalString,
1847
1538
  payment_count: Schema.optional(Schema.Number),
1848
1539
  occurred_at: Schema.Number
1849
1540
  })
@@ -1876,6 +1567,7 @@ const TELEMETRY_EVENT_SCHEMAS = {
1876
1567
  payroll_run_transitioned: PayrollRunTransitionedTelemetryEventSchema,
1877
1568
  ui_payroll_action_completed: UiPayrollActionCompletedTelemetryEventSchema,
1878
1569
  ui_contact_action_completed: UiContactActionCompletedTelemetryEventSchema,
1570
+ cli_diagnostic_completed: CliDiagnosticCompletedTelemetryEventSchema,
1879
1571
  activity_annotation_saved: ActivityAnnotationSavedTelemetryEventSchema,
1880
1572
  ui_activity_action_completed: UiActivityActionCompletedTelemetryEventSchema,
1881
1573
  auth_otp_requested: AuthOtpRequestedTelemetryEventSchema,
@@ -1928,7 +1620,8 @@ const TELEMETRY_EVENT_SCHEMAS = {
1928
1620
  permission_mirror_verification: PermissionMirrorVerificationTelemetryEventSchema,
1929
1621
  movement_scan_window: MovementScanWindowTelemetryEventSchema,
1930
1622
  movement_scan_checkpoint: MovementScanCheckpointTelemetryEventSchema,
1931
- movement_scan_incident: MovementScanIncidentTelemetryEventSchema
1623
+ movement_scan_incident: MovementScanIncidentTelemetryEventSchema,
1624
+ indexer_drift_corrected: IndexerDriftCorrectedTelemetryEventSchema
1932
1625
  };
1933
1626
  const FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS = [];
1934
1627
  /**
@@ -1937,14 +1630,7 @@ const FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS = [];
1937
1630
  * A domain node removes its entry when it adds the producer. The telemetry
1938
1631
  * gate rejects an entry that has a producer.
1939
1632
  */
1940
- const CONTRACT_FIRST_TELEMETRY_EVENTS = [
1941
- "access_recovery_completed",
1942
- "org_invite_progressed",
1943
- "invoice_issued",
1944
- "invoice_request_transitioned",
1945
- "payroll_group_changed",
1946
- "payroll_run_transitioned"
1947
- ];
1633
+ const CONTRACT_FIRST_TELEMETRY_EVENTS = [];
1948
1634
  /**
1949
1635
  * Catalog events whose product mapper remains gated on the #1150 frontend
1950
1636
  * adoption. L1 S1 removes their retired SDK-flow producers without inventing
@@ -1998,17 +1684,17 @@ function redactTelemetryProps(name, props, options = {}) {
1998
1684
  * property before transport. Browser applications may carry emails, draft ids,
1999
1685
  * or other capabilities in the URL; those values must never leave the origin.
2000
1686
  *
2001
- * The callback mutates and returns the supplied event, matching PostHog's
2002
- * `before_send` contract while preserving the event's full structural type.
1687
+ * The callback replaces the event's data with a sanitized copy. Nested values
1688
+ * can refer to live clients or configuration; observation must never mutate them.
2003
1689
  */
2004
1690
  function sanitizePostHogBrowserEvent(event, urlPolicy = "path-only") {
2005
1691
  if (event === null) return event;
2006
1692
  const transportToken = event.properties.token;
2007
- const seen = /* @__PURE__ */ new WeakSet();
2008
- sanitizePostHogBrowserValue(event.properties, seen, urlPolicy);
1693
+ const seen = /* @__PURE__ */ new WeakMap();
1694
+ event.properties = sanitizePostHogBrowserValue(event.properties, seen, urlPolicy);
2009
1695
  if (transportToken !== void 0) event.properties.token = transportToken;
2010
- if (event.$set !== void 0) sanitizePostHogBrowserValue(event.$set, seen, urlPolicy);
2011
- if (event.$set_once !== void 0) sanitizePostHogBrowserValue(event.$set_once, seen, urlPolicy);
1696
+ if (event.$set !== void 0) event.$set = sanitizePostHogBrowserValue(event.$set, seen, urlPolicy);
1697
+ if (event.$set_once !== void 0) event.$set_once = sanitizePostHogBrowserValue(event.$set_once, seen, urlPolicy);
2012
1698
  return event;
2013
1699
  }
2014
1700
  /**
@@ -2207,22 +1893,21 @@ function createPostHogBrowserPageviewTracker(client) {
2207
1893
  };
2208
1894
  }
2209
1895
  function sanitizePostHogBrowserValue(value, seen, urlPolicy) {
2210
- if (typeof value !== "object" || value === null || seen.has(value)) return;
2211
- seen.add(value);
1896
+ if (typeof value !== "object" || value === null || value instanceof Date) return value;
1897
+ if (seen.has(value)) return seen.get(value);
2212
1898
  if (Array.isArray(value)) {
1899
+ const copy = [];
1900
+ seen.set(value, copy);
2213
1901
  for (let index = 0; index < value.length; index++) {
2214
1902
  const item = value[index];
2215
- if (typeof item === "string") value[index] = maskNetworkText(item);
2216
- else sanitizePostHogBrowserValue(item, seen, urlPolicy);
1903
+ copy[index] = typeof item === "string" ? maskNetworkText(item) : sanitizePostHogBrowserValue(item, seen, urlPolicy);
2217
1904
  }
2218
- return;
1905
+ return copy;
2219
1906
  }
2220
- const properties = value;
2221
- for (const [key, nestedValue] of Object.entries(properties)) {
2222
- if (isPostHogQueryDerivedProperty(key)) {
2223
- delete properties[key];
2224
- continue;
2225
- }
1907
+ const properties = Object.create(null);
1908
+ seen.set(value, properties);
1909
+ for (const [key, nestedValue] of Object.entries(value)) {
1910
+ if (isPostHogQueryDerivedProperty(key)) continue;
2226
1911
  if (isCredentialField(key)) {
2227
1912
  properties[key] = "[REDACTED]";
2228
1913
  continue;
@@ -2231,8 +1916,9 @@ function sanitizePostHogBrowserValue(value, seen, urlPolicy) {
2231
1916
  properties[key] = isPostHogUrlProperty(key) ? urlPolicy === "path-only" ? stripUrlQueryAndFragment(nestedValue) : redactUrlSecrets(nestedValue) : maskNetworkText(nestedValue);
2232
1917
  continue;
2233
1918
  }
2234
- sanitizePostHogBrowserValue(nestedValue, seen, urlPolicy);
1919
+ properties[key] = sanitizePostHogBrowserValue(nestedValue, seen, urlPolicy);
2235
1920
  }
1921
+ return properties;
2236
1922
  }
2237
1923
  const POSTHOG_QUERY_DERIVED_PROPERTY_NAMES = [
2238
1924
  "utm_source",
@@ -2547,4 +2233,4 @@ function rotr(value, bits) {
2547
2233
  return value >>> bits | value << 32 - bits;
2548
2234
  }
2549
2235
  //#endregion
2550
- export { AccessRecoveryCompletedTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, ActivityAnnotationSavedTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, BundlerErrorTelemetryEventSchema, CAPXUL_ENVS, CAPXUL_OPERATIONS, CONTRACT_FIRST_TELEMETRY_EVENTS, ChainAttemptSchema, ChainUpstreamFallbackTelemetryEventSchema, ChainUpstreamSchema, ContactRelationshipChangedTelemetryEventSchema, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FailureModeSchema, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, IdentityRefusedTelemetryEventSchema, InMemoryTelemetryBusAdapter, InvoiceIssuedTelemetryEventSchema, InvoiceRequestTransitionedTelemetryEventSchema, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OperationRetriedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteProgressedTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentLifecycleTransitionTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PaymentVerificationRetryTelemetryEventSchema, PayrollGroupChangedTelemetryEventSchema, PayrollRunTransitionedTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, QuickPayExternalAddressAcknowledgedTelemetryEventSchema, ReceiptPendingTelemetryEventSchema, RecordingTelemetryAdapter, ResponseHeadersSchema, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, UiAccessStepCompletedTelemetryEventSchema, UiActivityActionCompletedTelemetryEventSchema, UiContactActionCompletedTelemetryEventSchema, UiInvoiceStepCompletedTelemetryEventSchema, UiPayrollActionCompletedTelemetryEventSchema, UiReceiveStepCompletedTelemetryEventSchema, UiTreasuryStepCompletedTelemetryEventSchema, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, isCapxulOperation, maskCapturedNetworkRequest, normalizeCapxulOperation, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };
2236
+ export { AccessRecoveryCompletedTelemetryEventSchema, AccountBalanceFailedTelemetryEventSchema, AccountBalanceReadTelemetryEventSchema, ActivityAnnotationSavedTelemetryEventSchema, AuthFailedTelemetryEventSchema, AuthOtpDeliveredTelemetryEventSchema, AuthOtpExpiredTelemetryEventSchema, AuthOtpRequestedTelemetryEventSchema, AuthSignedOutTelemetryEventSchema, AuthVerifiedTelemetryEventSchema, BROWSER_GATED_TELEMETRY_EVENTS, BootstrapFailedTelemetryEventSchema, BootstrapResolvedTelemetryEventSchema, BundlerErrorTelemetryEventSchema, CAPXUL_ENVS, CAPXUL_OPERATIONS, CONTRACT_FIRST_TELEMETRY_EVENTS, ChainAttemptSchema, ChainUpstreamFallbackTelemetryEventSchema, ChainUpstreamSchema, CliDiagnosticCompletedTelemetryEventSchema, ContactRelationshipChangedTelemetryEventSchema, DepositInitiatedTelemetryEventSchema, DepositSettledTelemetryEventSchema, FINANCIAL_OPS_TARGET_TELEMETRY_PRODUCERS, FailureModeSchema, FaucetConfirmedTelemetryEventSchema, FaucetFailedTelemetryEventSchema, FaucetRequestedTelemetryEventSchema, IdentityRefusedTelemetryEventSchema, InMemoryTelemetryBusAdapter, IndexerDriftCorrectedTelemetryEventSchema, InvoiceIssuedTelemetryEventSchema, InvoiceRequestTransitionedTelemetryEventSchema, MemberActivationFailedTelemetryEventSchema, MemberActivationReadyTelemetryEventSchema, MemberActivationStartedTelemetryEventSchema, MovementScanCheckpointTelemetryEventSchema, MovementScanIncidentTelemetryEventSchema, MovementScanWindowTelemetryEventSchema, OnboardingDashboardReachedTelemetryEventSchema, OnboardingIntentSelectedTelemetryEventSchema, OnboardingOrganizationSubmittedTelemetryEventSchema, OnboardingProfileSubmittedTelemetryEventSchema, OperationRetriedTelemetryEventSchema, OrgCreateFailedTelemetryEventSchema, OrgCreateStartedTelemetryEventSchema, OrgCreatedTelemetryEventSchema, OrgInviteAcceptedTelemetryEventSchema, OrgInviteExpiredTelemetryEventSchema, OrgInviteProgressedTelemetryEventSchema, OrgInviteSentTelemetryEventSchema, OrgRolesSeededTelemetryEventSchema, OrgSafeConfirmedTelemetryEventSchema, OrgSafeCreatedTelemetryEventSchema, OrganizationCreationFailedTelemetryEventSchema, OrganizationCreationReadyTelemetryEventSchema, OrganizationCreationStartedTelemetryEventSchema, PII, PRODUCT_MAPPER_GATED_TELEMETRY_EVENTS, PaymentFailedTelemetryEventSchema, PaymentInitiatedTelemetryEventSchema, PaymentLifecycleTransitionTelemetryEventSchema, PaymentSettledTelemetryEventSchema, PaymentVerificationRetryTelemetryEventSchema, PayrollGroupChangedTelemetryEventSchema, PayrollRunTransitionedTelemetryEventSchema, PermissionMirrorVerificationTelemetryEventSchema, PostHogTelemetryAdapter, ProvisioningSafeConfirmedTelemetryEventSchema, ProvisioningSafeCreatedTelemetryEventSchema, QuickPayExternalAddressAcknowledgedTelemetryEventSchema, ReceiptPendingTelemetryEventSchema, RecordingTelemetryAdapter, ResponseHeadersSchema, SYNCABLE_CAPXUL_ENVS, TELEMETRY_EVENT_NAMES, TELEMETRY_EVENT_SCHEMAS, TELEMETRY_JOURNEYS, TELEMETRY_PRODUCERS, UiAccessStepCompletedTelemetryEventSchema, UiActivityActionCompletedTelemetryEventSchema, UiContactActionCompletedTelemetryEventSchema, UiInvoiceStepCompletedTelemetryEventSchema, UiPayrollActionCompletedTelemetryEventSchema, UiReceiveStepCompletedTelemetryEventSchema, UiTreasuryStepCompletedTelemetryEventSchema, createCapxulBeforeSend, createPostHogBrowserPageviewTracker, getTrackHandler, initializeCapxulBrowserAnalytics, initializePostHogBrowserAnalytics, isCapxulOperation, maskCapturedNetworkRequest, normalizeCapxulOperation, productAppAnalytics, redactTelemetryEvent, redactTelemetryProps, sanitizePostHogBrowserEvent, setTrackHandler, stampTelemetryEnvelope, track, utilityAppAnalytics };