@dvmkit/sdk 0.3.1-rc.10 → 0.3.2-rc.10

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.
Files changed (47) hide show
  1. package/dist/{chunk-MD3H3BF7.js → chunk-2A33VHYM.js} +1 -1
  2. package/dist/{chunk-AJNFXR7J.js → chunk-3KYLYVY4.js} +4 -1
  3. package/dist/{chunk-YO56VCTQ.js → chunk-BWGRKGKG.js} +190 -75
  4. package/dist/{chunk-MMCE7XSR.js → chunk-C2AGARLM.js} +1 -13
  5. package/dist/chunk-D42FMCLJ.js +1423 -0
  6. package/dist/{chunk-QX52F6IB.js → chunk-DSVGYW3B.js} +7 -4
  7. package/dist/{chunk-CC3UY6OS.js → chunk-HNIKSOI2.js} +378 -373
  8. package/dist/{chunk-4A2RAKCW.js → chunk-IBDDIG4K.js} +7 -3
  9. package/dist/{chunk-D7YQYLLM.js → chunk-J7PW2U6P.js} +1 -1
  10. package/dist/{chunk-FDKRXOZO.js → chunk-KL4C3LQV.js} +57 -49
  11. package/dist/{chunk-VA7GT6C6.js → chunk-LHN75BTX.js} +56 -53
  12. package/dist/{chunk-C3MTFLC6.js → chunk-M4RSKQAV.js} +14 -12
  13. package/dist/{chunk-U5VNEALI.js → chunk-PPHE7XUU.js} +1 -1
  14. package/dist/{chunk-GAIPXGM3.js → chunk-SP42AI5T.js} +1 -1
  15. package/dist/{chunk-N5B66UOS.js → chunk-U2EYIPFX.js} +4 -1
  16. package/dist/{chunk-H2MEFVH6.js → chunk-UQCK5VMA.js} +7 -4
  17. package/dist/{chunk-XMDQOXHO.js → chunk-Y7JZLO5J.js} +4 -1
  18. package/dist/{chunk-HHTL3ZFT.js → chunk-YEO5GW7U.js} +16 -13
  19. package/dist/{chunk-O6D72KYA.js → chunk-YRDA7EWN.js} +1 -1
  20. package/dist/{chunk-VIVXB4CD.js → chunk-YYQG4R7T.js} +1 -1
  21. package/dist/{chunk-FPOLJRBF.js → chunk-Z3EHBW2G.js} +2 -2
  22. package/dist/{chunk-2D75MNNG.js → chunk-ZHTUITDW.js} +8 -5
  23. package/dist/{chunk-XZ7LW4S5.js → chunk-ZUTI56L7.js} +20 -16
  24. package/dist/{credit-ledger-MHA652TV.js → credit-ledger-4CCHRJE2.js} +3 -2
  25. package/dist/index.js +4 -3
  26. package/dist/internal/caller.d.ts +32 -3
  27. package/dist/internal/caller.js +22 -12
  28. package/dist/internal/index.js +1 -1
  29. package/dist/internal/server.js +16 -15
  30. package/dist/memory-credit-ledger-TERNM5T6.js +10 -0
  31. package/dist/{mpp-setup-MPP3ST5X.js → mpp-setup-OQ4OV7A5.js} +2 -1
  32. package/dist/{payout-reporter-KEMUXEUO.js → payout-reporter-TQ3YIFLZ.js} +2 -1
  33. package/dist/{postgres-consumed-credential-store-6N2V5MJN.js → postgres-consumed-credential-store-LFQNC7LD.js} +4 -1
  34. package/dist/{postgres-job-store-VE2JRUEC.js → postgres-job-store-FGOJ7UIX.js} +2 -1
  35. package/dist/{postgres-replay-store-ZF4JNZOW.js → postgres-replay-store-DFQSXPCG.js} +2 -1
  36. package/dist/{pricing-MU5GNUJZ.js → pricing-UJAPJLOM.js} +2 -1
  37. package/dist/{revenue-reporter-O75BGYFK.js → revenue-reporter-VN4WYN74.js} +2 -1
  38. package/dist/server/index.d.ts +1 -1
  39. package/dist/server/index.js +112 -112
  40. package/dist/{tempo-charge-store-SDTUNTKA.js → tempo-charge-store-EA66LSVJ.js} +2 -1
  41. package/dist/{tempo-lifecycle-G5SB4HFC.js → tempo-lifecycle-TJ62A7UX.js} +3 -3
  42. package/dist/{tempo-session-store-WF3VZXNF.js → tempo-session-store-65NA77KJ.js} +3 -2
  43. package/dist/{tempo-wallet-ZFNUDFVO.js → tempo-wallet-RCGBBAJH.js} +1 -1
  44. package/dist/testing/index.js +4 -3
  45. package/dist/{x402-CI6PSHNO.js → x402-S47Q77UE.js} +2 -2
  46. package/package.json +1 -1
  47. package/dist/memory-credit-ledger-BYBATRN3.js +0 -9
@@ -0,0 +1,1423 @@
1
+ // src/observability/projection.ts
2
+ import { isIP } from "net";
3
+
4
+ // src/observability/diagnostic-catalogue-v1.json
5
+ var diagnostic_catalogue_v1_default = {
6
+ version: 1,
7
+ events: [
8
+ "abuse_signal_record_failed",
9
+ "abuse_signal_report_failed",
10
+ "abuse_signal_volume_check",
11
+ "accepted",
12
+ "accumulator_mode_missing_config",
13
+ "accumulator_table_init_failed",
14
+ "admin.destroy",
15
+ "admin.dvm_edit_status",
16
+ "admin.dvm_transfer",
17
+ "admin.dvm_un_destroy",
18
+ "admin.org_destroy",
19
+ "admin.org_member_add",
20
+ "admin.org_member_remove",
21
+ "admin.org_member_role",
22
+ "admin.org_resume",
23
+ "admin.org_set_operator",
24
+ "admin.org_set_plan",
25
+ "admin.org_suspend",
26
+ "admin.resume",
27
+ "admin.set_operator",
28
+ "admin.set_plan",
29
+ "admin.suspend",
30
+ "admin_cashu_nonce_store_in_memory",
31
+ "admin_lock_state_unavailable",
32
+ "admin_lock_table_init_failed",
33
+ "admin_surface_missing_config",
34
+ "api_5xx_rate_check",
35
+ "api_resolved",
36
+ "audit_backlog_check",
37
+ "audit_backlog_recovery_failed",
38
+ "audit_outbox_completion_failed",
39
+ "audit_outbox_drain",
40
+ "audit_outbox_projection_failed",
41
+ "audit_outbox_retry_write_failed",
42
+ "auth_reverify_failed",
43
+ "backup_alert_report_failed",
44
+ "backup_failure_check",
45
+ "backup_failure_record_failed",
46
+ "backup_retired",
47
+ "backup_sanitized",
48
+ "body",
49
+ "btc_rate_stale_fallback",
50
+ "btc_rate_stale_refused",
51
+ "builder_identity_key_loose_mode",
52
+ "building_deploy_reaped",
53
+ "caller_data_retention.swept",
54
+ "caller_data_retention_failed",
55
+ "capability_gap_alert_error",
56
+ "cashu-mint-audit.tick",
57
+ "cashu-mint-health-cron.tick",
58
+ "cashu.get_wallet",
59
+ "cashu_audit_persist_failed",
60
+ "cashu_audit_recovery_failed",
61
+ "cashu_credential_rejected",
62
+ "cashu_mint_audit",
63
+ "cashu_mint_audit_endpoint_failed",
64
+ "cashu_mint_boot_health",
65
+ "cashu_mint_event_persist_failed",
66
+ "cashu_mint_health_check",
67
+ "cashu_mint_health_endpoint_failed",
68
+ "cashu_mint_nut_incompatible",
69
+ "cashu_mint_recovery_failed",
70
+ "cashu_mint_runtime_recovered",
71
+ "cashu_mint_runtime_sick",
72
+ "cashu_opts_env_ignored",
73
+ "cashu_refund_amount_unreported",
74
+ "ci_lane_report",
75
+ "ci_lane_report_unconfigured",
76
+ "complete",
77
+ "consumed_credential_store_in_memory",
78
+ "create",
79
+ "credit_deposit_record_failed",
80
+ "credit_drain_record_failed",
81
+ "credit_draw_fiat_at_par",
82
+ "credit_draw_reconcile_failed",
83
+ "credit_draw_reconciled",
84
+ "credit_draw_release_record_failed",
85
+ "credit_expiry_release_record_failed",
86
+ "credit_expiry_released",
87
+ "credit_expiry_sweep_failed",
88
+ "credit_funding_lot_backfill",
89
+ "credit_funding_unrecorded",
90
+ "credit_id",
91
+ "credit_job_row_recovered",
92
+ "credit_job_row_retry",
93
+ "credit_job_row_unwritten",
94
+ "credit_menu_bounds_unavailable",
95
+ "credit_menu_lightning_floor_unavailable",
96
+ "credit_menu_suppressed_non_durable",
97
+ "credit_rejected",
98
+ "credit_resolve_failed",
99
+ "credit_resolve_state_mismatch",
100
+ "credit_topup_over_ask",
101
+ "credit_topup_skipped",
102
+ "credit_topup_stale_rate",
103
+ "credit_topup_unbound",
104
+ "cron_fleet_drift_check",
105
+ "cron_fleet_drift_check_failed",
106
+ "deploy_archive_cleanup_failed",
107
+ "deploy_archive_rejected",
108
+ "deploy_failed_alert_error",
109
+ "deploy_probe_alert_error",
110
+ "deploy_reaped",
111
+ "deploy_reaper_fly_destroy_failed",
112
+ "deploy_reaper_pg_destroy_failed",
113
+ "deploy_reconciler_boot",
114
+ "deploy_reconciler_tick",
115
+ "diagnostic.message",
116
+ "diagnostic.unknown",
117
+ "domain-verify-backoff-cron.tick",
118
+ "domain_verify_backoff_check",
119
+ "domain_verify_backoff_endpoint_failed",
120
+ "draw_pool_unpriced",
121
+ "drawn_job_recovery_refused",
122
+ "dvm-stats-rollup-cron.tick",
123
+ "dvm.ask_pin_lost",
124
+ "dvm.ask_pin_stale_rate",
125
+ "dvm.auth.verify",
126
+ "dvm.credit.fund",
127
+ "dvm.fetch",
128
+ "dvm.handler",
129
+ "dvm.input.validate",
130
+ "dvm.kv.delete",
131
+ "dvm.kv.list",
132
+ "dvm.kv.read",
133
+ "dvm.kv.write",
134
+ "dvm.payment.validate",
135
+ "dvm.quote",
136
+ "dvm.request",
137
+ "dvm.topup_cap_absent",
138
+ "dvm.topup_cap_unenforceable",
139
+ "dvm.withdrawal_deleted",
140
+ "dvm.withdrawal_held",
141
+ "dvm.withdrawal_notice_failed",
142
+ "dvm.withdrawal_notice_undelivered",
143
+ "dvm.withdrawal_scale_down_failed",
144
+ "dvm.withdrawal_started",
145
+ "dvm.withdrawal_sweep_failed",
146
+ "dvm.withdrawal_swept",
147
+ "dvm_boot_phase_timings",
148
+ "dvm_failed_cleanup",
149
+ "dvm_failed_cleanup.fly_unavailable",
150
+ "dvm_failed_cleanup.kept_database",
151
+ "dvm_failed_cleanup.swept",
152
+ "dvm_failed_cleanup.teardown_pending",
153
+ "dvm_fly_health_check",
154
+ "dvm_fly_health_check_failed",
155
+ "dvm_fly_health_recovery_failed",
156
+ "dvm_stats_rollup_failed",
157
+ "dvms_listen_connect_failed",
158
+ "dvms_listen_lost",
159
+ "enforce-cron.tick",
160
+ "error",
161
+ "failed-dvm-cleanup-cron.tick",
162
+ "failed_dvm_cleanup_failed",
163
+ "fetch",
164
+ "fetch_complete",
165
+ "fetch_failed",
166
+ "fleet_drift_check",
167
+ "fleet_drift_check_failed",
168
+ "fly_app_anomaly_check",
169
+ "fly_app_anomaly_check_failed",
170
+ "fx-rate-refresh-cron.tick",
171
+ "fx_rate_attempt_failed",
172
+ "fx_rate_cold_start_failed",
173
+ "fx_rate_cold_start_synchronous_fetch",
174
+ "fx_rate_endpoint_failed",
175
+ "fx_rate_fetch_failed",
176
+ "fx_rate_fetch_ok",
177
+ "fx_rate_gap_fill",
178
+ "fx_rate_persist_failed",
179
+ "fx_rate_refresh_started",
180
+ "fx_rate_stale_warning",
181
+ "fx_rates_partial",
182
+ "fx_snapshot_endpoint_failed",
183
+ "fx_snapshot_stale",
184
+ "fx_staleness_check",
185
+ "groq_transcribe_failed",
186
+ "heartbeat_coverage_check",
187
+ "heartbeat_coverage_check_failed",
188
+ "hosting_teardown.replay_failed",
189
+ "hosting_teardown.unresolved",
190
+ "idle_suspend",
191
+ "ingest_staging_expired",
192
+ "isolate_background_invoke_failed",
193
+ "isolate_callback_ignored_terminal",
194
+ "isolate_invoke_state_ignored_cancelled",
195
+ "isolate_job_save_rejected_terminal",
196
+ "isolate_job_terminal_elsewhere",
197
+ "isolate_stale_job_reap_page_full",
198
+ "isolate_stale_job_reaped",
199
+ "isolate_stale_job_sweep_clock_skew",
200
+ "job_cost_record_failed",
201
+ "job_event_dropped",
202
+ "job_event_parse_error",
203
+ "job_heartbeat_failed",
204
+ "job_id",
205
+ "job_message_append_failed",
206
+ "job_messages_listen_connect_failed",
207
+ "job_messages_listen_lost",
208
+ "job_retention_alert_failed",
209
+ "job_retention_candidate_failed",
210
+ "job_retention_recovery_alert_failed",
211
+ "job_retention_report_failed",
212
+ "job_retention_store_unsupported",
213
+ "job_retention_sweep_failed",
214
+ "job_retention_swept",
215
+ "job_revenue_record_failed",
216
+ "job_save_rejected_terminal",
217
+ "job_status_watch_check_failed",
218
+ "job_status_watch_subscribe_failed",
219
+ "job_terminal_elsewhere",
220
+ "kind",
221
+ "kv_store_in_memory",
222
+ "lightning.get_balance",
223
+ "lightning.get_balance.result",
224
+ "lightning.get_info",
225
+ "lightning.get_info.result",
226
+ "lightning.list_transactions",
227
+ "lightning.list_transactions.result",
228
+ "lightning.lookup_invoice",
229
+ "lightning.make_invoice",
230
+ "lightning.make_invoice.result",
231
+ "lightning.pay_invoice",
232
+ "lightning.pay_invoice.reconciled",
233
+ "lightning.pay_invoice.republish",
234
+ "lightning_invoice_issue_failed",
235
+ "lightning_invoice_written_off",
236
+ "lightning_rail_health_fallback",
237
+ "lightning_rail_health_stale_observation",
238
+ "lightning_rail_health_staleness_ceiling",
239
+ "lightning_rail_health_unavailable",
240
+ "lightning_receive_permission_refused",
241
+ "lightning_receive_unreachable",
242
+ "lightning_settlement_blocked",
243
+ "lightning_settlement_check_failed",
244
+ "lock_pubkey_grace_seconds_invalid",
245
+ "log",
246
+ "melter_previous_run_read_failed",
247
+ "melter_report_unconfigured",
248
+ "melter_run_report",
249
+ "melter_run_write_failed",
250
+ "melter_runs_read_failed",
251
+ "melter_staleness_check",
252
+ "message",
253
+ "mpp_rapid_rotation_detected",
254
+ "nwc-float-health-cron.tick",
255
+ "nwc_balance_capacity_skipped",
256
+ "nwc_balance_ceiling_failed",
257
+ "nwc_balance_ceiling_unconfigured",
258
+ "nwc_balance_tiers_inverted",
259
+ "nwc_float_health_check",
260
+ "nwc_float_health_endpoint_failed",
261
+ "nwc_probe_persist_failed",
262
+ "nwc_probe_recovery_failed",
263
+ "nwc_probe_target_skipped",
264
+ "operator_alert",
265
+ "operator_alert_dedup_write_failed",
266
+ "operator_alert_email_failed",
267
+ "operator_alert_no_transport",
268
+ "operator_alert_recovery",
269
+ "operator_alert_webhook_failed",
270
+ "orphan_draw_release_failed",
271
+ "orphan_draw_released",
272
+ "orphan_draw_sweep_failed",
273
+ "orphan_draw_sweep_no_progress",
274
+ "orphan_draw_sweep_truncated",
275
+ "paid_job_death_check",
276
+ "paid_job_death_record_failed",
277
+ "paid_job_death_report_failed",
278
+ "paid_submit_replay_refused",
279
+ "parked",
280
+ "payment_mode",
281
+ "payout_amount_conflict",
282
+ "payout_batch_empty",
283
+ "payout_batch_raced",
284
+ "payout_batch_track_failed",
285
+ "payout_batch_untracked",
286
+ "payout_flush_failed",
287
+ "payout_pending_record_failed",
288
+ "payout_pending_report_failed",
289
+ "payout_pending_snapshot_failed",
290
+ "payout_record_failed",
291
+ "payout_report_failed",
292
+ "pg_notify_failed",
293
+ "phase",
294
+ "pinned",
295
+ "platform-db-health-cron.tick",
296
+ "platform.auth.verify_token",
297
+ "platform.builder.credit",
298
+ "platform.credit_expiry_release.record",
299
+ "platform.deposit.record",
300
+ "platform.drain.record",
301
+ "platform.draw_release.record",
302
+ "platform.fee.calculate",
303
+ "platform.invoice.create",
304
+ "platform.invoice.finalize",
305
+ "platform.payment.validate",
306
+ "platform.payout.record",
307
+ "platform.payout_pending.record",
308
+ "platform.revenue.record",
309
+ "platform.route.handle",
310
+ "platform_db_health_check",
311
+ "platform_db_health_check_failed",
312
+ "platform_db_health_endpoint_failed",
313
+ "platform_db_health_recovery_failed",
314
+ "platform_hosted_test_mint_allowed",
315
+ "postgres_transport_recovery",
316
+ "queued",
317
+ "receipt_issue_failed",
318
+ "receipts_disabled_store_unsupported",
319
+ "report_instant_out_of_range",
320
+ "reputation_flag",
321
+ "reputation_pruned_stale",
322
+ "request_acceptance_recovered",
323
+ "request_acceptance_recovery_refused",
324
+ "retention.swept",
325
+ "revenue-backlog-cron.tick",
326
+ "revenue_backlog_check",
327
+ "revenue_backlog_endpoint_failed",
328
+ "revenue_backlog_recovery_failed",
329
+ "revenue_deadletter_bump_failed",
330
+ "revenue_deadletter_drain",
331
+ "revenue_deadletter_enqueue_failed",
332
+ "revenue_reporter_abandoned",
333
+ "revenue_skipped_no_rail",
334
+ "revenue_skipped_no_rail_check",
335
+ "revenue_skipped_no_rail_record_failed",
336
+ "revenue_skipped_no_rail_report_failed",
337
+ "revenue_skipped_unsettled_draw",
338
+ "rollback",
339
+ "router.proxy",
340
+ "scrape_cache_touch_failed",
341
+ "scrape_cache_write_failed",
342
+ "scrape_card_segmentation_failed",
343
+ "scrape_event_write_failed",
344
+ "scrape_extract_cache_touch_failed",
345
+ "scrape_extract_cache_write_failed",
346
+ "scrape_extract_provenance_failed",
347
+ "scrape_job_cancelled",
348
+ "scrape_pagination_detection_failed",
349
+ "scrape_polish_cache_touch_failed",
350
+ "scrape_polish_cache_write_failed",
351
+ "scrape_rows_normalize_failed",
352
+ "scribe_job_cancelled",
353
+ "secp256k1_auth_replay_store_in_memory",
354
+ "sent",
355
+ "signed_request_replay_store_saturated",
356
+ "span_buffer_drop",
357
+ "span_dimension_oversized",
358
+ "span_flush_failed",
359
+ "span_ingestion_identity_resolution_failed",
360
+ "span_ingestion_insert_failed",
361
+ "span_truncated",
362
+ "spans-retention-cron.tick",
363
+ "spans_pipeline_check",
364
+ "spans_pipeline_recovery_failed",
365
+ "spans_retention_failed",
366
+ "stale_job_cancelled",
367
+ "stale_job_failed",
368
+ "stale_job_sweep_clock_skew",
369
+ "stale_job_sweep_failed",
370
+ "stripe.create_checkout_session",
371
+ "stripe.create_portal_session",
372
+ "stripe.get_or_create_customer",
373
+ "stripe.get_or_create_customer.result",
374
+ "stripe.handle_webhook",
375
+ "stripe.handle_webhook.verified",
376
+ "stripe.on_checkout_completed",
377
+ "stripe.on_checkout_completed.customer_deleted",
378
+ "stripe.on_checkout_completed.metadata_mismatch_bound",
379
+ "stripe.on_checkout_completed.metadata_mismatch_first_bind",
380
+ "stripe.on_invoice_created",
381
+ "stripe.on_invoice_paid",
382
+ "stripe.process_event",
383
+ "stripe_webhook_error_rate_check",
384
+ "stripe_webhook_gap_check",
385
+ "substrate_escalation",
386
+ "tempo.issue_challenges",
387
+ "tempo.verify_credential",
388
+ "tempo_channel_binding_malformed",
389
+ "tempo_channel_binding_missing",
390
+ "tempo_channel_binding_unavailable",
391
+ "tempo_channel_escrow_changed",
392
+ "tempo_channel_owner_conflict",
393
+ "tempo_channel_registration_failed",
394
+ "tempo_charge_replay_store_in_memory",
395
+ "tempo_close_credential_refresh_required",
396
+ "tempo_close_credential_wrong_channel",
397
+ "tempo_close_delivery_configuration_error",
398
+ "tempo_close_event",
399
+ "tempo_close_events_rearmed",
400
+ "tempo_close_finalized_before_protection",
401
+ "tempo_close_health_check",
402
+ "tempo_close_observer_tick",
403
+ "tempo_credential_rejected",
404
+ "tempo_deposit_registration_alert_failed",
405
+ "tempo_drain_refund_below_debit",
406
+ "tempo_drain_refund_forecast_below_debit",
407
+ "tempo_drain_refund_forecast_unavailable",
408
+ "tempo_drain_written_off",
409
+ "tempo_observer_health_unavailable",
410
+ "tempo_observer_scan_failed",
411
+ "tempo_refund_amount_unreported",
412
+ "tempo_routine_sweep",
413
+ "tempo_routine_sweep_failed",
414
+ "tempo_session_advertised_refresh_failed",
415
+ "tempo_session_close_challenge_failed",
416
+ "tempo_session_close_failed",
417
+ "tempo_session_close_failure_reconcile_failed",
418
+ "tempo_session_close_recovery_failed",
419
+ "tempo_session_open_refused",
420
+ "tempo_session_settled",
421
+ "tempo_session_withheld",
422
+ "tempo_settlement_balance_alert_failed",
423
+ "tempo_settlement_failure_alert_failed",
424
+ "tempo_settlement_fee_balance",
425
+ "tempo_settlement_fee_balance_failed",
426
+ "tempo_settlement_insufficient_funds",
427
+ "tempo_settlement_readiness_report_failed",
428
+ "tempo_settlement_readiness_state_failed",
429
+ "terminal_cost_handoff_retry_scheduled",
430
+ "terminal_cost_recovery_complete",
431
+ "terminal_cost_recovery_failed",
432
+ "terminal_cost_recovery_truncated",
433
+ "transcriber_fallback",
434
+ "update",
435
+ "upgrade_prompt_evaluation_failed",
436
+ "wallet_accumulator_batch_expired",
437
+ "wallet_accumulator_batch_expiring_soon",
438
+ "wallet_accumulator_batch_orphan_lock_pubkey",
439
+ "wallet_accumulator_batch_retired_lock_pubkey",
440
+ "wallet_accumulator_lock_pubkey_prune_failed",
441
+ "wallet_accumulator_monitor_start_failed",
442
+ "wallet_accumulator_reaped_expired_keyset",
443
+ "wallet_accumulator_tick_error",
444
+ "warning",
445
+ "x402.settle_with_facilitator",
446
+ "x402.settle_with_facilitator.result",
447
+ "x402.verify_payment",
448
+ "x402.verify_payment.result",
449
+ "x402.verify_with_facilitator",
450
+ "x402.verify_with_facilitator.result",
451
+ "x402_claim_ceiling_unbound",
452
+ "x402_claim_ceiling_unresolved",
453
+ "x402_credential_rejected",
454
+ "x402_facilitator_capability_degraded",
455
+ "x402_facilitator_fallback",
456
+ "x402_facilitator_staleness_ceiling",
457
+ "x402_facilitator_unavailable",
458
+ "x402_network_unsupported",
459
+ "x402_refund_amount_unreported",
460
+ "x402_repair_channel_state_stale",
461
+ "x402_repair_write_off_restore_failed",
462
+ "x402_self_relay_gas_alert_failed",
463
+ "x402_self_relay_gas_balance",
464
+ "x402_self_relay_gas_balance_failed",
465
+ "x402_self_relay_gas_balance_report_failed",
466
+ "x402_self_relay_rpc_alert_failed",
467
+ "x402_self_relay_rpc_failed",
468
+ "x402_self_relay_rpc_health_report_failed",
469
+ "x402_self_relay_submission_lock_timeout",
470
+ "x402_self_relay_unserialized",
471
+ "x402_settlement_reconciliation_chain_unreachable",
472
+ "x402_settlement_reconciliation_facilitator_unavailable",
473
+ "x402_settlement_submission_failed",
474
+ "x402_settlement_written_off"
475
+ ],
476
+ routeTemplates: [
477
+ "/",
478
+ "/_dev",
479
+ "/_internal/abuse-signal",
480
+ "/_internal/backup-alert",
481
+ "/_internal/cashu-mint-audit",
482
+ "/_internal/cashu-mint-health",
483
+ "/_internal/cast/backup",
484
+ "/_internal/cast/cleanup",
485
+ "/_internal/cast/repair-durations",
486
+ "/_internal/ci-lane-report",
487
+ "/_internal/credit-deposit",
488
+ "/_internal/credit-drain",
489
+ "/_internal/credit-draw-release",
490
+ "/_internal/credit-expiry-release",
491
+ "/_internal/domain-verify-backoff",
492
+ "/_internal/dvm-stats-rollup",
493
+ "/_internal/enforce",
494
+ "/_internal/failed-dvm-cleanup",
495
+ "/_internal/fx",
496
+ "/_internal/fx-rates/refresh",
497
+ "/_internal/job-cost",
498
+ "/_internal/job-retention",
499
+ "/_internal/job-revenue",
500
+ "/_internal/job-terminal",
501
+ "/_internal/lightning-rail-health",
502
+ "/_internal/liveness-probe",
503
+ "/_internal/melter-report",
504
+ "/_internal/nwc-float-health",
505
+ "/_internal/paid-job-death",
506
+ "/_internal/payout",
507
+ "/_internal/payout-pending",
508
+ "/_internal/platform-db-health",
509
+ "/_internal/registry",
510
+ "/_internal/registry-ranking",
511
+ "/_internal/revalidate",
512
+ "/_internal/revenue-backlog",
513
+ "/_internal/revenue-skipped-no-rail",
514
+ "/_internal/scribe/cleanup",
515
+ "/_internal/spans",
516
+ "/_internal/spans-retention",
517
+ "/_internal/tempo-close-event",
518
+ "/_internal/tempo-observer-health",
519
+ "/_internal/tempo-settlement-balance",
520
+ "/_internal/tempo-settlement-failure",
521
+ "/_internal/x402-self-relay-gas-balance",
522
+ "/_internal/x402-self-relay-rpc-health",
523
+ "/_isolate/info",
524
+ "/_isolate/invoke",
525
+ "/admin/cashu/mark-melted",
526
+ "/admin/cashu/pending-batches",
527
+ "/admin/cashu/restart-failed",
528
+ "/admin/cashu/rotate-lock-pubkey",
529
+ "/admin/credit/bitcoin-liability",
530
+ "/admin/credit/blocked-invoices",
531
+ "/admin/credit/mark-drain-sent",
532
+ "/admin/credit/park-drain",
533
+ "/admin/credit/pending-drains",
534
+ "/admin/credit/reconcile-invoice",
535
+ "/admin/credit/reconcile-tempo-drain",
536
+ "/admin/credit/reconcile-x402-exact-settlement",
537
+ "/admin/credit/reconcile-x402-settlement",
538
+ "/admin/credit/tempo-drains",
539
+ "/admin/credit/tempo-losses",
540
+ "/admin/credit/write-off-invoice",
541
+ "/admin/credit/write-off-tempo-drain",
542
+ "/admin/credit/write-off-x402-settlement",
543
+ "/admin/credit/x402-exact-settlements",
544
+ "/admin/credit/x402-settlements",
545
+ "/api-keys",
546
+ "/api-keys/:id",
547
+ "/api-keys/:id/rotate",
548
+ "/api/activity",
549
+ "/api/builders",
550
+ "/api/builders/:id",
551
+ "/api/deploys",
552
+ "/api/dvms",
553
+ "/api/dvms/:id",
554
+ "/api/dvms/:id/resume",
555
+ "/api/dvms/:id/suspend",
556
+ "/api/health",
557
+ "/api/jobs",
558
+ "/api/metrics",
559
+ "/api/revenue",
560
+ "/api/stats",
561
+ "/api/v1/billing/capabilities",
562
+ "/api/v1/billing/plans/public",
563
+ "/api/v1/cli-auth/:session",
564
+ "/api/v1/cli-auth/:session/cancel",
565
+ "/api/v1/feedback",
566
+ "/api/v1/github/installation-callback",
567
+ "/api/v1/github/webhook",
568
+ "/api/v1/handle/check/:handle",
569
+ "/api/v1/invites/:token",
570
+ "/api/v1/invites/pending",
571
+ "/api/v1/mint-health",
572
+ "/api/v1/profiles/:handle",
573
+ "/api/v1/profiles/:handle/dvms/:slug",
574
+ "/api/v1/public/explore",
575
+ "/api/v1/wallet-pairings",
576
+ "/api/v1/wallet-pairings/:session",
577
+ "/api/v1/wallet-pairings/:session/manifest",
578
+ "/api/v1/wallet-pairings/:session/submission",
579
+ "/api/v1/wallet-pairings/:session/submission/:event",
580
+ "/api/v1/webhooks/stripe",
581
+ "/auth/me",
582
+ "/billing",
583
+ "/billing/checkout",
584
+ "/billing/compute",
585
+ "/billing/egress",
586
+ "/billing/invoices",
587
+ "/billing/invoices/:id",
588
+ "/billing/lightning/checkout",
589
+ "/billing/lightning/invoice/:id",
590
+ "/billing/plan-change/:id",
591
+ "/billing/plan-change/:id/purchase",
592
+ "/billing/plan-change/:id/renew-with-credit",
593
+ "/billing/plan-change/:id/schedule",
594
+ "/billing/plan-change/quote",
595
+ "/billing/plans",
596
+ "/billing/portal",
597
+ "/billing/revenue",
598
+ "/billing/revenue/events",
599
+ "/billing/subscription/renew-current-with-credit",
600
+ "/billing/usage",
601
+ "/builders/me/base",
602
+ "/builders/me/billing-vat",
603
+ "/builders/me/tempo",
604
+ "/builders/me/terms",
605
+ "/deploy",
606
+ "/deploy/local",
607
+ "/deploys/:id",
608
+ "/deploys/:id/logs",
609
+ "/deploys/recent",
610
+ "/dvms",
611
+ "/dvms/:dvmId",
612
+ "/dvms/:dvmId/committed",
613
+ "/dvms/:dvmId/db-tunnel",
614
+ "/dvms/:dvmId/deploy-identity",
615
+ "/dvms/:dvmId/deploys",
616
+ "/dvms/:dvmId/deposits",
617
+ "/dvms/:dvmId/domains",
618
+ "/dvms/:dvmId/domains/:domain",
619
+ "/dvms/:dvmId/domains/:domain/verify",
620
+ "/dvms/:dvmId/earnings",
621
+ "/dvms/:dvmId/env",
622
+ "/dvms/:dvmId/events",
623
+ "/dvms/:dvmId/exec",
624
+ "/dvms/:dvmId/git/link",
625
+ "/dvms/:dvmId/jobs/:jobId/artifact",
626
+ "/dvms/:dvmId/jobs/:jobId/complete",
627
+ "/dvms/:dvmId/jobs/:jobId/cost",
628
+ "/dvms/:dvmId/jobs/:jobId/fail",
629
+ "/dvms/:dvmId/jobs/:jobId/message",
630
+ "/dvms/:dvmId/jobs/:jobId/payment-request",
631
+ "/dvms/:dvmId/jobs/:jobId/progress",
632
+ "/dvms/:dvmId/jobs/:jobId/prompt",
633
+ "/dvms/:dvmId/jobs/:jobId/status",
634
+ "/dvms/:dvmId/jobs/:jobId/step-result",
635
+ "/dvms/:dvmId/jobs/:jobId/text",
636
+ "/dvms/:dvmId/jobs/:jobId/working",
637
+ "/dvms/:dvmId/kv",
638
+ "/dvms/:dvmId/kv/:key",
639
+ "/dvms/:dvmId/lock-pubkey",
640
+ "/dvms/:dvmId/logs",
641
+ "/dvms/:dvmId/metrics",
642
+ "/dvms/:dvmId/pause",
643
+ "/dvms/:dvmId/redeploy",
644
+ "/dvms/:dvmId/restart",
645
+ "/dvms/:dvmId/resume",
646
+ "/dvms/:dvmId/rollback",
647
+ "/dvms/:dvmId/rotate-lock-pubkey",
648
+ "/dvms/:dvmId/scale",
649
+ "/dvms/:dvmId/secret-recovery",
650
+ "/dvms/:dvmId/secrets",
651
+ "/dvms/:dvmId/settings",
652
+ "/dvms/:dvmId/ssh",
653
+ "/dvms/:dvmId/stats",
654
+ "/dvms/:dvmId/status",
655
+ "/dvms/:dvmId/storefront",
656
+ "/dvms/:dvmId/transfer",
657
+ "/dvms/:dvmId/visibility",
658
+ "/dvms/refresh-meta",
659
+ "/events",
660
+ "/feedback",
661
+ "/feeds/:owner/:slug",
662
+ "/github/app-info",
663
+ "/github/install-intent",
664
+ "/github/installations",
665
+ "/github/installations/:id/repos",
666
+ "/handle",
667
+ "/health",
668
+ "/healthz",
669
+ "/hosting/capacity/accounts/:accountId",
670
+ "/hosting/capacity/accounts/:accountId/exemption",
671
+ "/hosting/capacity/accounts/:accountId/operations/:operationId/release",
672
+ "/hosting/capacity/accounts/:accountId/override",
673
+ "/hosting/storage/inventory",
674
+ "/invites/:token/accept",
675
+ "/me",
676
+ "/metrics/summary",
677
+ "/notifications",
678
+ "/notifications/preferences",
679
+ "/notifications/read",
680
+ "/notifications/unread-count",
681
+ "/orgs",
682
+ "/orgs/:handle",
683
+ "/orgs/:handle/avatar",
684
+ "/orgs/:handle/base",
685
+ "/orgs/:handle/billing",
686
+ "/orgs/:handle/billing-vat",
687
+ "/orgs/:handle/billing/checkout",
688
+ "/orgs/:handle/billing/compute",
689
+ "/orgs/:handle/billing/egress",
690
+ "/orgs/:handle/billing/invoices",
691
+ "/orgs/:handle/billing/portal",
692
+ "/orgs/:handle/billing/usage",
693
+ "/orgs/:handle/committed",
694
+ "/orgs/:handle/credits",
695
+ "/orgs/:handle/dvms",
696
+ "/orgs/:handle/earnings",
697
+ "/orgs/:handle/events",
698
+ "/orgs/:handle/feed",
699
+ "/orgs/:handle/invites",
700
+ "/orgs/:handle/invites/:id",
701
+ "/orgs/:handle/keys",
702
+ "/orgs/:handle/keys/:hash",
703
+ "/orgs/:handle/members",
704
+ "/orgs/:handle/members/:bh",
705
+ "/orgs/:handle/members/:bh/role",
706
+ "/orgs/:handle/members/history",
707
+ "/orgs/:handle/metrics/summary",
708
+ "/orgs/:handle/notification-preferences",
709
+ "/orgs/:handle/payout-pending",
710
+ "/orgs/:handle/payout-routing",
711
+ "/orgs/:handle/payouts",
712
+ "/orgs/:handle/payouts/csv",
713
+ "/orgs/:handle/revenue/csv",
714
+ "/orgs/:handle/revenue/events",
715
+ "/orgs/:handle/revenue/series",
716
+ "/orgs/:handle/settlements",
717
+ "/orgs/:handle/settlements/csv",
718
+ "/orgs/:handle/stats",
719
+ "/orgs/:handle/tempo",
720
+ "/orgs/:handle/transfer",
721
+ "/profile",
722
+ "/profile/avatar",
723
+ "/revenue/csv",
724
+ "/revenue/events",
725
+ "/revenue/series",
726
+ "/spans",
727
+ "/traces",
728
+ "/traces/:trace_id",
729
+ "/traces/aggregate",
730
+ "/v1/credit",
731
+ "/v1/info",
732
+ "/v1/ingest/audio",
733
+ "/v1/ingest/image",
734
+ "/v1/job",
735
+ "/v1/job/:id",
736
+ "/v1/job/:id/messages",
737
+ "/v1/quote",
738
+ "/v1/request-result/:requestId",
739
+ "/v1/request-resume/:requestId"
740
+ ],
741
+ errorCodes: [
742
+ "app_shell_detected",
743
+ "audio_source_required",
744
+ "auth_error",
745
+ "auth_required",
746
+ "bytes_cap",
747
+ "capability_required",
748
+ "captcha_unsolved",
749
+ "cloudflare_unsolved",
750
+ "content_rejected",
751
+ "cover_invalid",
752
+ "credit_fund_failed",
753
+ "css_selector_for_requested_content",
754
+ "decoder_failed",
755
+ "decoder_unavailable",
756
+ "diarise_failed",
757
+ "display",
758
+ "dns_failed",
759
+ "duration_exceeds_cap",
760
+ "empty_body",
761
+ "episode_not_found",
762
+ "extract_input_too_large",
763
+ "extract_llm_failed",
764
+ "extract_schema_invalid",
765
+ "extract_validation_failed",
766
+ "feed_full",
767
+ "feed_not_found",
768
+ "feed_path_invalid",
769
+ "fetch_blocked",
770
+ "fetch_timeout",
771
+ "forbidden",
772
+ "format_unsupported",
773
+ "function",
774
+ "fx_rate_unavailable",
775
+ "geo_blocked",
776
+ "hardened",
777
+ "head_status",
778
+ "hint",
779
+ "ingest_concurrency",
780
+ "ingest_global_concurrency",
781
+ "ingest_ip_concurrency",
782
+ "inline_too_large",
783
+ "insecure_scheme",
784
+ "internal_error",
785
+ "invalid_input",
786
+ "invalid_menu",
787
+ "invalid_payment",
788
+ "invalid_quote_data",
789
+ "invalid_url",
790
+ "job_failed",
791
+ "job_timeout",
792
+ "login_wall_detected",
793
+ "message",
794
+ "milliseconds",
795
+ "network_error",
796
+ "no_diariser",
797
+ "no_premium_substrate",
798
+ "none",
799
+ "not_found",
800
+ "object",
801
+ "output_delivery_failed",
802
+ "oversize",
803
+ "owner_short_collision",
804
+ "page_too_large",
805
+ "path_not_found",
806
+ "payment_invalid",
807
+ "payment_required",
808
+ "paywall_detected",
809
+ "polish_input_too_large",
810
+ "polish_llm_failed",
811
+ "presign_failed",
812
+ "private_address",
813
+ "probe_failed",
814
+ "provider",
815
+ "provider_allowance_exhausted",
816
+ "provider_error",
817
+ "provider_failed",
818
+ "provider_invalid_response",
819
+ "provider_network",
820
+ "provider_rate_limit",
821
+ "provider_rejected",
822
+ "provider_rejected_audio",
823
+ "provider_timeout",
824
+ "provider_unavailable",
825
+ "quota_exceeded",
826
+ "rate_limited",
827
+ "rate_limited_by_target",
828
+ "replay_detected",
829
+ "request_integrity_failed",
830
+ "retry_hardened",
831
+ "retry_with_bounded_wait",
832
+ "retry_with_content_selector",
833
+ "seconds_cap",
834
+ "selector",
835
+ "server_error",
836
+ "sha256_mismatch",
837
+ "signature_invalid",
838
+ "size_mismatch",
839
+ "source_unreachable",
840
+ "ssrf_blocked",
841
+ "string",
842
+ "substrate_unavailable",
843
+ "timeout",
844
+ "timestamp_drift",
845
+ "torn_upload",
846
+ "transcribe_failed",
847
+ "unauthorized",
848
+ "unexpected",
849
+ "unexpected_status",
850
+ "unknown_error",
851
+ "unsafe_url",
852
+ "upload_failed",
853
+ "upload_handle_expired",
854
+ "upload_handle_not_found",
855
+ "upload_handle_not_owner",
856
+ "upload_kind_mismatch",
857
+ "upstream",
858
+ "upstream_network",
859
+ "upstream_status",
860
+ "upstream_timeout",
861
+ "use_alternative_source",
862
+ "wait_for_selector",
863
+ "wait_too_long",
864
+ "wrong_content_type"
865
+ ],
866
+ datasets: [
867
+ "platform",
868
+ "cashu",
869
+ "lightning",
870
+ "stripe",
871
+ "x402",
872
+ "tempo",
873
+ "isolate",
874
+ "audit",
875
+ "cron"
876
+ ],
877
+ levels: [
878
+ "info",
879
+ "warn",
880
+ "error"
881
+ ],
882
+ statuses: [
883
+ "ok",
884
+ "error"
885
+ ],
886
+ methods: [
887
+ "GET",
888
+ "POST",
889
+ "PUT",
890
+ "PATCH",
891
+ "DELETE",
892
+ "HEAD",
893
+ "OPTIONS"
894
+ ],
895
+ rails: [
896
+ "cashu",
897
+ "lightning",
898
+ "x402",
899
+ "tempo"
900
+ ],
901
+ stages: [
902
+ "input",
903
+ "quote"
904
+ ],
905
+ handlers: [
906
+ "job",
907
+ "quote"
908
+ ],
909
+ currencyTokens: [
910
+ "BTC",
911
+ "SAT",
912
+ "SATS",
913
+ "MSAT",
914
+ "MSATS",
915
+ "USD",
916
+ "EUR",
917
+ "GBP",
918
+ "USDC",
919
+ "AlphaUSD",
920
+ "BetaUSD",
921
+ "pathUSD",
922
+ "btc",
923
+ "sat",
924
+ "sats",
925
+ "msat",
926
+ "msats",
927
+ "usd",
928
+ "eur",
929
+ "gbp",
930
+ "usdc"
931
+ ],
932
+ booleanFields: [
933
+ "client.capabilities_valid",
934
+ "client.protocol_version_valid",
935
+ "client.version_valid",
936
+ "http.probe",
937
+ "is_valid",
938
+ "rate_carried_forward",
939
+ "republished",
940
+ "storefront_probe",
941
+ "success",
942
+ "verified",
943
+ "wallet_reported_budget"
944
+ ],
945
+ integerFields: [
946
+ "ageMs",
947
+ "age_ms",
948
+ "amount_micro",
949
+ "amount_msats",
950
+ "ask_msats",
951
+ "asked_topup_micro",
952
+ "attempt",
953
+ "balance_msats",
954
+ "batch_size",
955
+ "buffer_size",
956
+ "count",
957
+ "cutoff_ms",
958
+ "durationMs",
959
+ "duration_ms",
960
+ "elapsedMs",
961
+ "elapsed_ms",
962
+ "latencyMs",
963
+ "latency_ms",
964
+ "method_count",
965
+ "proofAmount",
966
+ "required_msats",
967
+ "required_usdc_micro",
968
+ "retention_days",
969
+ "retry_count",
970
+ "rows_deleted",
971
+ "skewMs",
972
+ "skew_ms",
973
+ "timeout_ms",
974
+ "totalSats",
975
+ "transaction_count",
976
+ "value_size_bytes"
977
+ ],
978
+ tokenFields: [],
979
+ hashFields: [
980
+ "key_hash",
981
+ "prefix_hash"
982
+ ],
983
+ urlFields: [
984
+ "url",
985
+ "facilitator_url",
986
+ "mint_url"
987
+ ],
988
+ identityFields: [
989
+ "dvm_id",
990
+ "dvm_slug",
991
+ "builder_id"
992
+ ],
993
+ capabilityFields: [
994
+ "capability"
995
+ ],
996
+ clientProtocolVersions: [
997
+ 1
998
+ ],
999
+ clientVersionFields: [
1000
+ "client.version"
1001
+ ]
1002
+ };
1003
+
1004
+ // src/observability/projection.ts
1005
+ var DIAGNOSTIC_CATALOGUE_VERSION = diagnostic_catalogue_v1_default.version;
1006
+ var EVENTS = new Set(diagnostic_catalogue_v1_default.events);
1007
+ var ROUTE_TEMPLATES = new Set(diagnostic_catalogue_v1_default.routeTemplates);
1008
+ var ERROR_CODES = new Set(diagnostic_catalogue_v1_default.errorCodes);
1009
+ var DATASETS = new Set(diagnostic_catalogue_v1_default.datasets);
1010
+ var LEVELS = new Set(diagnostic_catalogue_v1_default.levels);
1011
+ var STATUSES = new Set(diagnostic_catalogue_v1_default.statuses);
1012
+ var METHODS = new Set(diagnostic_catalogue_v1_default.methods);
1013
+ var RAILS = new Set(diagnostic_catalogue_v1_default.rails);
1014
+ var STAGES = new Set(diagnostic_catalogue_v1_default.stages);
1015
+ var HANDLERS = new Set(diagnostic_catalogue_v1_default.handlers);
1016
+ var CURRENCIES = new Set(diagnostic_catalogue_v1_default.currencyTokens);
1017
+ var BOOLEAN_FIELDS = new Set(diagnostic_catalogue_v1_default.booleanFields);
1018
+ var INTEGER_FIELDS = new Set(diagnostic_catalogue_v1_default.integerFields);
1019
+ var TOKEN_FIELDS = new Set(diagnostic_catalogue_v1_default.tokenFields);
1020
+ var HASH_FIELDS = new Set(diagnostic_catalogue_v1_default.hashFields);
1021
+ var URL_FIELDS = new Set(diagnostic_catalogue_v1_default.urlFields);
1022
+ var IDENTITY_FIELDS = new Set(diagnostic_catalogue_v1_default.identityFields);
1023
+ var CAPABILITY_FIELDS = new Set(diagnostic_catalogue_v1_default.capabilityFields);
1024
+ var CLIENT_PROTOCOL_VERSIONS = new Set(
1025
+ diagnostic_catalogue_v1_default.clientProtocolVersions
1026
+ );
1027
+ var CLIENT_VERSION_FIELDS = new Set(diagnostic_catalogue_v1_default.clientVersionFields);
1028
+ var SPAN_ID_RE = /^(?!0{16}$)[0-9a-f]{16}$/;
1029
+ var TRACE_ID_RE = /^(?!0{32}$)[0-9a-f]{32}$/;
1030
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1031
+ var SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
1032
+ var MACHINE_ID_RE = /^[0-9a-f]{12,32}$/;
1033
+ var RELEASE_RE = /^(?:v?\d+\.\d+\.\d+(?:-rc\.\d+)?|[0-9a-f]{7,40}|dev|test|unknown)$/;
1034
+ var CAPABILITY_RE = /^[a-z][a-z0-9_-]{0,47}$/;
1035
+ var CLIENT_VERSION_RE = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-rc\.(?:0|[1-9]\d*))?$/;
1036
+ var HASH_RE = /^(?:[0-9a-f]{16}|[0-9a-f]{64})$/i;
1037
+ var DECIMAL_RE = /^(?:0|[1-9]\d{0,77})$/;
1038
+ var STRIPE_EVENT_RE = /^evt_[A-Za-z0-9]{1,64}$/;
1039
+ var SERVICE_NAMES = /* @__PURE__ */ new Set([
1040
+ "platform-api",
1041
+ "router",
1042
+ "dvmadmin",
1043
+ "admin",
1044
+ "unknown"
1045
+ ]);
1046
+ var AUTHORITY_CAPABILITIES = /* @__PURE__ */ new WeakMap();
1047
+ var VALUE_AUTHORITIES = /* @__PURE__ */ new WeakMap();
1048
+ var AUTHORITY_IDENTITIES = /* @__PURE__ */ new WeakMap();
1049
+ var VALUE_IDENTITY_AUTHORITIES = /* @__PURE__ */ new WeakMap();
1050
+ function createDiagnosticCapabilityAuthority(capabilityNames) {
1051
+ const allowed = new Set(
1052
+ capabilityNames.filter(
1053
+ (name) => typeof name === "string" && CAPABILITY_RE.test(name)
1054
+ )
1055
+ );
1056
+ const authority = Object.freeze({});
1057
+ AUTHORITY_CAPABILITIES.set(authority, allowed);
1058
+ return authority;
1059
+ }
1060
+ function bindDiagnosticCapabilityAuthority(value, authority) {
1061
+ if (authority && AUTHORITY_CAPABILITIES.has(authority)) {
1062
+ VALUE_AUTHORITIES.set(value, authority);
1063
+ }
1064
+ return value;
1065
+ }
1066
+ function extendDiagnosticIdentityAuthority(authority, key, value) {
1067
+ if (!IDENTITY_FIELDS.has(key)) return authority;
1068
+ const projected = validateIdentity(key, value);
1069
+ if (projected === void 0) return authority;
1070
+ const identities = {
1071
+ ...authority && AUTHORITY_IDENTITIES.get(authority),
1072
+ [key]: projected
1073
+ };
1074
+ const next = Object.freeze({});
1075
+ AUTHORITY_IDENTITIES.set(next, Object.freeze(identities));
1076
+ return next;
1077
+ }
1078
+ function bindDiagnosticIdentityAuthority(value, authority) {
1079
+ if (authority && AUTHORITY_IDENTITIES.has(authority)) {
1080
+ VALUE_IDENTITY_AUTHORITIES.set(value, authority);
1081
+ }
1082
+ return value;
1083
+ }
1084
+ function projectSpanRow(input) {
1085
+ try {
1086
+ if (!isObject(input)) return { ok: false, code: "invalid_span" };
1087
+ const authority = VALUE_AUTHORITIES.get(input);
1088
+ const identityAuthority = VALUE_IDENTITY_AUTHORITIES.get(input);
1089
+ const spanId = ownValue(input, "span_id");
1090
+ if (typeof spanId !== "string" || !SPAN_ID_RE.test(spanId)) {
1091
+ return { ok: false, code: "invalid_span_id" };
1092
+ }
1093
+ const traceId = ownValue(input, "trace_id");
1094
+ if (typeof traceId !== "string" || !TRACE_ID_RE.test(traceId)) {
1095
+ return { ok: false, code: "invalid_trace_id" };
1096
+ }
1097
+ const parentSpanId = ownValue(input, "parent_span_id");
1098
+ if (parentSpanId !== null && (typeof parentSpanId !== "string" || !SPAN_ID_RE.test(parentSpanId))) {
1099
+ return { ok: false, code: "invalid_parent_span_id" };
1100
+ }
1101
+ const dataset = ownValue(input, "dataset");
1102
+ if (typeof dataset !== "string" || !DATASETS.has(dataset)) {
1103
+ return { ok: false, code: "invalid_dataset" };
1104
+ }
1105
+ const level = ownValue(input, "level");
1106
+ if (typeof level !== "string" || !LEVELS.has(level)) {
1107
+ return { ok: false, code: "invalid_level" };
1108
+ }
1109
+ const status = ownValue(input, "status");
1110
+ if (typeof status !== "string" || !STATUSES.has(status)) {
1111
+ return { ok: false, code: "invalid_status" };
1112
+ }
1113
+ const startedAtMs = ownValue(input, "started_at_ms");
1114
+ const endedAtMs = ownValue(input, "ended_at_ms");
1115
+ if (!isEpochMs(startedAtMs) || !isEpochMs(endedAtMs) || endedAtMs < startedAtMs) {
1116
+ return { ok: false, code: "invalid_timestamp" };
1117
+ }
1118
+ const sampleRate = ownValue(input, "sample_rate");
1119
+ const pid = ownValue(input, "pid");
1120
+ const rawName = ownValue(input, "name");
1121
+ const row = {
1122
+ span_id: spanId,
1123
+ trace_id: traceId,
1124
+ parent_span_id: parentSpanId,
1125
+ dataset,
1126
+ name: typeof rawName === "string" && EVENTS.has(rawName) ? rawName : "diagnostic.unknown",
1127
+ level,
1128
+ status,
1129
+ started_at_ms: startedAtMs,
1130
+ ended_at_ms: endedAtMs,
1131
+ service: projectService(ownValue(input, "service")),
1132
+ service_version: projectServiceVersion(
1133
+ ownValue(input, "service_version")
1134
+ ),
1135
+ host: projectHost(ownValue(input, "host")),
1136
+ pid: Number.isInteger(pid) && pid >= 1 && pid <= 2147483647 ? pid : null,
1137
+ dimensions: projectFields(
1138
+ ownValue(input, "dimensions"),
1139
+ dataset,
1140
+ authority,
1141
+ identityAuthority
1142
+ ),
1143
+ attributes: projectFields(
1144
+ ownValue(input, "attributes"),
1145
+ dataset,
1146
+ authority,
1147
+ identityAuthority
1148
+ ),
1149
+ error_message: null,
1150
+ error_stack: null,
1151
+ sample_rate: typeof sampleRate === "number" && Number.isFinite(sampleRate) && sampleRate > 0 && sampleRate <= 1 ? sampleRate : 1
1152
+ };
1153
+ bindDiagnosticCapabilityAuthority(row, authority);
1154
+ bindDiagnosticIdentityAuthority(row, identityAuthority);
1155
+ return {
1156
+ ok: true,
1157
+ row
1158
+ };
1159
+ } catch {
1160
+ return { ok: false, code: "invalid_span" };
1161
+ }
1162
+ }
1163
+ function projectDiagnosticFields(input, dataset, authority, identityAuthority) {
1164
+ try {
1165
+ const inheritedAuthority = isObject(input) ? VALUE_AUTHORITIES.get(input) : void 0;
1166
+ const effectiveAuthority = validAuthority(authority) ?? inheritedAuthority;
1167
+ const inheritedIdentityAuthority = isObject(input) ? VALUE_IDENTITY_AUTHORITIES.get(input) : void 0;
1168
+ const effectiveIdentityAuthority = validIdentityAuthority(identityAuthority) ?? inheritedIdentityAuthority;
1169
+ const output = projectFields(
1170
+ input,
1171
+ dataset,
1172
+ effectiveAuthority,
1173
+ effectiveIdentityAuthority
1174
+ );
1175
+ bindDiagnosticCapabilityAuthority(output, effectiveAuthority);
1176
+ bindDiagnosticIdentityAuthority(output, effectiveIdentityAuthority);
1177
+ return output;
1178
+ } catch {
1179
+ return {};
1180
+ }
1181
+ }
1182
+ function projectEventName(input, fallback = "diagnostic.unknown") {
1183
+ return typeof input === "string" && EVENTS.has(input) ? input : fallback;
1184
+ }
1185
+ function projectFields(input, dataset, authority, identityAuthority) {
1186
+ if (!isObject(input)) return {};
1187
+ const output = {};
1188
+ for (const [key, value] of ownDataEntries(input, 64)) {
1189
+ if (key.length > 64) continue;
1190
+ const projected = projectField(
1191
+ key,
1192
+ value,
1193
+ dataset,
1194
+ authority,
1195
+ identityAuthority
1196
+ );
1197
+ if (projected !== void 0) output[key] = projected;
1198
+ }
1199
+ return output;
1200
+ }
1201
+ function projectField(key, value, dataset, authority, identityAuthority) {
1202
+ if (BOOLEAN_FIELDS.has(key))
1203
+ return typeof value === "boolean" ? value : void 0;
1204
+ if (INTEGER_FIELDS.has(key))
1205
+ return isNonnegativeSafeInteger(value) ? value : void 0;
1206
+ if (HASH_FIELDS.has(key))
1207
+ return typeof value === "string" && HASH_RE.test(value) ? value : void 0;
1208
+ if (URL_FIELDS.has(key)) return projectOrigin(value);
1209
+ if (IDENTITY_FIELDS.has(key)) return projectIdentity(key, identityAuthority);
1210
+ if (TOKEN_FIELDS.has(key)) return void 0;
1211
+ if (CAPABILITY_FIELDS.has(key)) return projectCapability(value, authority);
1212
+ if (CLIENT_VERSION_FIELDS.has(key)) return projectClientVersion(value);
1213
+ if (key === "client.protocol_version")
1214
+ return typeof value === "number" && CLIENT_PROTOCOL_VERSIONS.has(value) ? value : void 0;
1215
+ if (key === "route" || key === "http.route" || key === "resource_path")
1216
+ return projectRoute(value);
1217
+ if (key === "status_code" || key === "http.status_code") {
1218
+ return Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
1219
+ }
1220
+ if (key === "method" || key === "http.method") {
1221
+ if (typeof value !== "string") return void 0;
1222
+ if (METHODS.has(value)) return value;
1223
+ return key === "method" && dataset === "tempo" && (value === "charge" || value === "session") ? value : void 0;
1224
+ }
1225
+ if (key === "rail")
1226
+ return typeof value === "string" && RAILS.has(value) ? value : void 0;
1227
+ if (key === "stage")
1228
+ return typeof value === "string" && STAGES.has(value) ? value : void 0;
1229
+ if (key === "handler")
1230
+ return typeof value === "string" && HANDLERS.has(value) ? value : void 0;
1231
+ if (key === "dataset")
1232
+ return typeof value === "string" && DATASETS.has(value) ? value : void 0;
1233
+ if (key === "error.code" || key === "error_code" || key === "code") {
1234
+ if (typeof value !== "string") return void 0;
1235
+ return ERROR_CODES.has(value) ? value : key === "error.code" || key === "error_code" ? "unknown_error" : void 0;
1236
+ }
1237
+ if (key === "currency" || key === "ask_currency" || key === "asked_topup_currency") {
1238
+ return typeof value === "string" && CURRENCIES.has(value) ? value : void 0;
1239
+ }
1240
+ if (key === "amount") {
1241
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= Number.MAX_SAFE_INTEGER ? value : void 0;
1242
+ }
1243
+ if (key === "forecast.refund_native" || key === "drain.native") {
1244
+ if (isNonnegativeSafeInteger(value)) return value;
1245
+ return typeof value === "string" && DECIMAL_RE.test(value) ? value : void 0;
1246
+ }
1247
+ if (key === "event_id")
1248
+ return typeof value === "string" && STRIPE_EVENT_RE.test(value) ? value : void 0;
1249
+ if (key === "reject_reason")
1250
+ return value === "scanner_probe" ? value : void 0;
1251
+ return void 0;
1252
+ }
1253
+ function projectService(value) {
1254
+ if (typeof value !== "string") return "unknown";
1255
+ if (SERVICE_NAMES.has(value)) return value;
1256
+ if (value.startsWith("isolate-") && SLUG_RE.test(value.slice(8)))
1257
+ return value;
1258
+ return "unknown";
1259
+ }
1260
+ function projectServiceVersion(value) {
1261
+ return typeof value === "string" && value.length <= 64 && RELEASE_RE.test(value) ? value : "unknown";
1262
+ }
1263
+ function projectHost(value) {
1264
+ if (value === "localhost") return value;
1265
+ return typeof value === "string" && MACHINE_ID_RE.test(value) ? value : null;
1266
+ }
1267
+ function validateIdentity(key, value) {
1268
+ if (typeof value !== "string") return void 0;
1269
+ if (key === "dvm_slug") return SLUG_RE.test(value) ? value : void 0;
1270
+ return value.length <= 36 && UUID_RE.test(value) ? value : void 0;
1271
+ }
1272
+ function projectIdentity(key, authority) {
1273
+ return authority && AUTHORITY_IDENTITIES.get(authority)?.[key];
1274
+ }
1275
+ function projectCapability(value, authority) {
1276
+ if (typeof value !== "string" || !CAPABILITY_RE.test(value)) return void 0;
1277
+ const allowed = authority && AUTHORITY_CAPABILITIES.get(authority);
1278
+ return allowed?.has(value) ? value : void 0;
1279
+ }
1280
+ function projectClientVersion(value) {
1281
+ return typeof value === "string" && value.length <= 64 && CLIENT_VERSION_RE.test(value) ? value : void 0;
1282
+ }
1283
+ function validAuthority(authority) {
1284
+ return authority && AUTHORITY_CAPABILITIES.has(authority) ? authority : void 0;
1285
+ }
1286
+ function validIdentityAuthority(authority) {
1287
+ return authority && AUTHORITY_IDENTITIES.has(authority) ? authority : void 0;
1288
+ }
1289
+ function projectOrigin(value) {
1290
+ if (typeof value !== "string" || value.length > 2048) return void 0;
1291
+ try {
1292
+ const parsed = new URL(value);
1293
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || parsed.username || parsed.password)
1294
+ return void 0;
1295
+ const hostname = parsed.hostname.toLowerCase();
1296
+ if (isIP(hostname) !== 0 || !isDnsName(hostname)) return void 0;
1297
+ return `${parsed.protocol}//${hostname}`;
1298
+ } catch {
1299
+ return void 0;
1300
+ }
1301
+ }
1302
+ function projectRoute(value) {
1303
+ if (typeof value !== "string" || value.length > 512 || /[?#@]/.test(value) || !value.startsWith("/"))
1304
+ return void 0;
1305
+ const normalized = value.length > 1 ? value.replace(/\/+$/, "") : value;
1306
+ if (ROUTE_TEMPLATES.has(normalized)) return normalized;
1307
+ const candidateSegments = normalized.split("/");
1308
+ for (const template of ROUTE_TEMPLATES) {
1309
+ const templateSegments = template.split("/");
1310
+ if (candidateSegments.length !== templateSegments.length) continue;
1311
+ if (templateSegments.every(
1312
+ (part, index) => part.startsWith(":") ? validRouteSegment(candidateSegments[index]) : part === candidateSegments[index]
1313
+ )) {
1314
+ return template;
1315
+ }
1316
+ }
1317
+ return void 0;
1318
+ }
1319
+ function validRouteSegment(segment) {
1320
+ return segment.length > 0 && segment.length <= 128 && !/[/?#@]/.test(segment);
1321
+ }
1322
+ function isDnsName(value) {
1323
+ return value.length <= 253 && value.split(".").every((label) => SLUG_RE.test(label));
1324
+ }
1325
+ function isEpochMs(value) {
1326
+ return isNonnegativeSafeInteger(value);
1327
+ }
1328
+ function isNonnegativeSafeInteger(value) {
1329
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
1330
+ }
1331
+ function isObject(value) {
1332
+ return typeof value === "object" && value !== null || typeof value === "function";
1333
+ }
1334
+ function ownValue(input, key) {
1335
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1336
+ return descriptor && "value" in descriptor ? descriptor.value : void 0;
1337
+ }
1338
+ function ownDataEntries(input, limit) {
1339
+ const entries = [];
1340
+ for (const key of Reflect.ownKeys(input)) {
1341
+ if (typeof key !== "string") continue;
1342
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1343
+ if (!descriptor || !("value" in descriptor)) continue;
1344
+ entries.push([key, descriptor.value]);
1345
+ if (entries.length >= limit) break;
1346
+ }
1347
+ return entries;
1348
+ }
1349
+
1350
+ // src/observability/diagnostic-console.ts
1351
+ var diagnosticConsole = {
1352
+ debug: (...values) => emit("debug", values),
1353
+ info: (...values) => emit("info", values),
1354
+ warn: (...values) => emit("warn", values),
1355
+ error: (...values) => emit("error", values),
1356
+ log: (...values) => emit("log", values)
1357
+ };
1358
+ function emitDiagnostic(level, event, fields, dataset) {
1359
+ writeDiagnostic(level, event, fields, dataset);
1360
+ }
1361
+ function writeDiagnostic(sinkLevel, event, fields, dataset, severityOverride) {
1362
+ try {
1363
+ const defaultSeverity = sinkLevel === "debug" || sinkLevel === "log" ? "info" : sinkLevel;
1364
+ const severity = severityOverride === "info" || severityOverride === "warn" || severityOverride === "error" ? severityOverride : defaultSeverity;
1365
+ const record = {
1366
+ event: projectEventName(event),
1367
+ level: severity,
1368
+ ...projectDiagnosticFields(fields, dataset)
1369
+ };
1370
+ const sink = sinkLevel === "log" ? console.log : console[sinkLevel];
1371
+ sink(JSON.stringify(record));
1372
+ } catch {
1373
+ }
1374
+ }
1375
+ function emit(level, values) {
1376
+ const parsed = values.length === 1 ? parseStructuredValue(values[0]) : void 0;
1377
+ if (parsed) {
1378
+ const event = ownValue2(parsed, "event");
1379
+ const legacyEvent = ownValue2(parsed, "level");
1380
+ const dataset = ownValue2(parsed, "dataset");
1381
+ writeDiagnostic(
1382
+ level,
1383
+ event ?? legacyEvent,
1384
+ parsed,
1385
+ typeof dataset === "string" ? dataset : void 0,
1386
+ legacyEvent
1387
+ );
1388
+ return;
1389
+ }
1390
+ emitDiagnostic(level, "diagnostic.message");
1391
+ }
1392
+ function parseStructuredValue(value) {
1393
+ if (typeof value === "object" && value !== null) return value;
1394
+ if (typeof value !== "string" || value.length > 64 * 1024 || !value.startsWith("{"))
1395
+ return void 0;
1396
+ try {
1397
+ const parsed = JSON.parse(value);
1398
+ return typeof parsed === "object" && parsed !== null ? parsed : void 0;
1399
+ } catch {
1400
+ return void 0;
1401
+ }
1402
+ }
1403
+ function ownValue2(input, key) {
1404
+ try {
1405
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1406
+ return descriptor && "value" in descriptor ? descriptor.value : void 0;
1407
+ } catch {
1408
+ return void 0;
1409
+ }
1410
+ }
1411
+
1412
+ export {
1413
+ DIAGNOSTIC_CATALOGUE_VERSION,
1414
+ createDiagnosticCapabilityAuthority,
1415
+ bindDiagnosticCapabilityAuthority,
1416
+ extendDiagnosticIdentityAuthority,
1417
+ bindDiagnosticIdentityAuthority,
1418
+ projectSpanRow,
1419
+ projectDiagnosticFields,
1420
+ projectEventName,
1421
+ diagnosticConsole,
1422
+ emitDiagnostic
1423
+ };