@dvmkit/dvm-cli 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1502 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __dvmCreateRequire } from "node:module";
3
+ const require = __dvmCreateRequire(import.meta.url);
4
+
5
+ // node_modules/@dvmkit/sdk/dist/chunk-D42FMCLJ.js
6
+ import { isIP } from "net";
7
+ var diagnostic_catalogue_v1_default = {
8
+ version: 1,
9
+ events: [
10
+ "abuse_signal_record_failed",
11
+ "abuse_signal_report_failed",
12
+ "abuse_signal_volume_check",
13
+ "accepted",
14
+ "accumulator_mode_missing_config",
15
+ "accumulator_table_init_failed",
16
+ "admin.destroy",
17
+ "admin.dvm_edit_status",
18
+ "admin.dvm_transfer",
19
+ "admin.dvm_un_destroy",
20
+ "admin.org_destroy",
21
+ "admin.org_member_add",
22
+ "admin.org_member_remove",
23
+ "admin.org_member_role",
24
+ "admin.org_resume",
25
+ "admin.org_set_operator",
26
+ "admin.org_set_plan",
27
+ "admin.org_suspend",
28
+ "admin.resume",
29
+ "admin.set_operator",
30
+ "admin.set_plan",
31
+ "admin.suspend",
32
+ "admin_cashu_nonce_store_in_memory",
33
+ "admin_lock_state_unavailable",
34
+ "admin_lock_table_init_failed",
35
+ "admin_surface_missing_config",
36
+ "api_5xx_rate_check",
37
+ "api_resolved",
38
+ "audit_backlog_check",
39
+ "audit_backlog_recovery_failed",
40
+ "audit_outbox_completion_failed",
41
+ "audit_outbox_drain",
42
+ "audit_outbox_projection_failed",
43
+ "audit_outbox_retry_write_failed",
44
+ "auth_reverify_failed",
45
+ "backup_alert_report_failed",
46
+ "backup_failure_check",
47
+ "backup_failure_record_failed",
48
+ "backup_retired",
49
+ "backup_sanitized",
50
+ "body",
51
+ "btc_rate_stale_fallback",
52
+ "btc_rate_stale_refused",
53
+ "builder_identity_key_loose_mode",
54
+ "building_deploy_reaped",
55
+ "caller_data_retention.swept",
56
+ "caller_data_retention_failed",
57
+ "capability_gap_alert_error",
58
+ "cashu-mint-audit.tick",
59
+ "cashu-mint-health-cron.tick",
60
+ "cashu.get_wallet",
61
+ "cashu_audit_persist_failed",
62
+ "cashu_audit_recovery_failed",
63
+ "cashu_credential_rejected",
64
+ "cashu_mint_audit",
65
+ "cashu_mint_audit_endpoint_failed",
66
+ "cashu_mint_boot_health",
67
+ "cashu_mint_event_persist_failed",
68
+ "cashu_mint_health_check",
69
+ "cashu_mint_health_endpoint_failed",
70
+ "cashu_mint_nut_incompatible",
71
+ "cashu_mint_recovery_failed",
72
+ "cashu_mint_runtime_recovered",
73
+ "cashu_mint_runtime_sick",
74
+ "cashu_opts_env_ignored",
75
+ "cashu_refund_amount_unreported",
76
+ "ci_lane_report",
77
+ "ci_lane_report_unconfigured",
78
+ "complete",
79
+ "consumed_credential_store_in_memory",
80
+ "create",
81
+ "credit_deposit_record_failed",
82
+ "credit_drain_record_failed",
83
+ "credit_draw_fiat_at_par",
84
+ "credit_draw_reconcile_failed",
85
+ "credit_draw_reconciled",
86
+ "credit_draw_release_record_failed",
87
+ "credit_expiry_release_record_failed",
88
+ "credit_expiry_released",
89
+ "credit_expiry_sweep_failed",
90
+ "credit_funding_lot_backfill",
91
+ "credit_funding_unrecorded",
92
+ "credit_id",
93
+ "credit_job_row_recovered",
94
+ "credit_job_row_retry",
95
+ "credit_job_row_unwritten",
96
+ "credit_menu_bounds_unavailable",
97
+ "credit_menu_lightning_floor_unavailable",
98
+ "credit_menu_suppressed_non_durable",
99
+ "credit_rejected",
100
+ "credit_resolve_failed",
101
+ "credit_resolve_state_mismatch",
102
+ "credit_topup_over_ask",
103
+ "credit_topup_skipped",
104
+ "credit_topup_stale_rate",
105
+ "credit_topup_unbound",
106
+ "cron_fleet_drift_check",
107
+ "cron_fleet_drift_check_failed",
108
+ "deploy_archive_cleanup_failed",
109
+ "deploy_archive_rejected",
110
+ "deploy_failed_alert_error",
111
+ "deploy_probe_alert_error",
112
+ "deploy_reaped",
113
+ "deploy_reaper_fly_destroy_failed",
114
+ "deploy_reaper_pg_destroy_failed",
115
+ "deploy_reconciler_boot",
116
+ "deploy_reconciler_tick",
117
+ "diagnostic.message",
118
+ "diagnostic.unknown",
119
+ "domain-verify-backoff-cron.tick",
120
+ "domain_verify_backoff_check",
121
+ "domain_verify_backoff_endpoint_failed",
122
+ "draw_pool_unpriced",
123
+ "drawn_job_recovery_refused",
124
+ "dvm-stats-rollup-cron.tick",
125
+ "dvm.ask_pin_lost",
126
+ "dvm.ask_pin_stale_rate",
127
+ "dvm.auth.verify",
128
+ "dvm.credit.fund",
129
+ "dvm.fetch",
130
+ "dvm.handler",
131
+ "dvm.input.validate",
132
+ "dvm.kv.delete",
133
+ "dvm.kv.list",
134
+ "dvm.kv.read",
135
+ "dvm.kv.write",
136
+ "dvm.payment.validate",
137
+ "dvm.quote",
138
+ "dvm.request",
139
+ "dvm.topup_cap_absent",
140
+ "dvm.topup_cap_unenforceable",
141
+ "dvm.withdrawal_deleted",
142
+ "dvm.withdrawal_held",
143
+ "dvm.withdrawal_notice_failed",
144
+ "dvm.withdrawal_notice_undelivered",
145
+ "dvm.withdrawal_scale_down_failed",
146
+ "dvm.withdrawal_started",
147
+ "dvm.withdrawal_sweep_failed",
148
+ "dvm.withdrawal_swept",
149
+ "dvm_boot_phase_timings",
150
+ "dvm_failed_cleanup",
151
+ "dvm_failed_cleanup.fly_unavailable",
152
+ "dvm_failed_cleanup.kept_database",
153
+ "dvm_failed_cleanup.swept",
154
+ "dvm_failed_cleanup.teardown_pending",
155
+ "dvm_fly_health_check",
156
+ "dvm_fly_health_check_failed",
157
+ "dvm_fly_health_recovery_failed",
158
+ "dvm_stats_rollup_failed",
159
+ "dvms_listen_connect_failed",
160
+ "dvms_listen_lost",
161
+ "enforce-cron.tick",
162
+ "error",
163
+ "failed-dvm-cleanup-cron.tick",
164
+ "failed_dvm_cleanup_failed",
165
+ "fetch",
166
+ "fetch_complete",
167
+ "fetch_failed",
168
+ "fleet_drift_check",
169
+ "fleet_drift_check_failed",
170
+ "fly_app_anomaly_check",
171
+ "fly_app_anomaly_check_failed",
172
+ "fx-rate-refresh-cron.tick",
173
+ "fx_rate_attempt_failed",
174
+ "fx_rate_cold_start_failed",
175
+ "fx_rate_cold_start_synchronous_fetch",
176
+ "fx_rate_endpoint_failed",
177
+ "fx_rate_fetch_failed",
178
+ "fx_rate_fetch_ok",
179
+ "fx_rate_gap_fill",
180
+ "fx_rate_persist_failed",
181
+ "fx_rate_refresh_started",
182
+ "fx_rate_stale_warning",
183
+ "fx_rates_partial",
184
+ "fx_snapshot_endpoint_failed",
185
+ "fx_snapshot_stale",
186
+ "fx_staleness_check",
187
+ "groq_transcribe_failed",
188
+ "heartbeat_coverage_check",
189
+ "heartbeat_coverage_check_failed",
190
+ "hosting_teardown.replay_failed",
191
+ "hosting_teardown.unresolved",
192
+ "idle_suspend",
193
+ "ingest_staging_expired",
194
+ "isolate_background_invoke_failed",
195
+ "isolate_callback_ignored_terminal",
196
+ "isolate_invoke_state_ignored_cancelled",
197
+ "isolate_job_save_rejected_terminal",
198
+ "isolate_job_terminal_elsewhere",
199
+ "isolate_stale_job_reap_page_full",
200
+ "isolate_stale_job_reaped",
201
+ "isolate_stale_job_sweep_clock_skew",
202
+ "job_cost_record_failed",
203
+ "job_event_dropped",
204
+ "job_event_parse_error",
205
+ "job_heartbeat_failed",
206
+ "job_id",
207
+ "job_message_append_failed",
208
+ "job_messages_listen_connect_failed",
209
+ "job_messages_listen_lost",
210
+ "job_retention_alert_failed",
211
+ "job_retention_candidate_failed",
212
+ "job_retention_recovery_alert_failed",
213
+ "job_retention_report_failed",
214
+ "job_retention_store_unsupported",
215
+ "job_retention_sweep_failed",
216
+ "job_retention_swept",
217
+ "job_revenue_record_failed",
218
+ "job_save_rejected_terminal",
219
+ "job_status_watch_check_failed",
220
+ "job_status_watch_subscribe_failed",
221
+ "job_terminal_elsewhere",
222
+ "kind",
223
+ "kv_store_in_memory",
224
+ "lightning.get_balance",
225
+ "lightning.get_balance.result",
226
+ "lightning.get_info",
227
+ "lightning.get_info.result",
228
+ "lightning.list_transactions",
229
+ "lightning.list_transactions.result",
230
+ "lightning.lookup_invoice",
231
+ "lightning.make_invoice",
232
+ "lightning.make_invoice.result",
233
+ "lightning.pay_invoice",
234
+ "lightning.pay_invoice.reconciled",
235
+ "lightning.pay_invoice.republish",
236
+ "lightning_invoice_issue_failed",
237
+ "lightning_invoice_written_off",
238
+ "lightning_rail_health_fallback",
239
+ "lightning_rail_health_stale_observation",
240
+ "lightning_rail_health_staleness_ceiling",
241
+ "lightning_rail_health_unavailable",
242
+ "lightning_receive_permission_refused",
243
+ "lightning_receive_unreachable",
244
+ "lightning_settlement_blocked",
245
+ "lightning_settlement_check_failed",
246
+ "lock_pubkey_grace_seconds_invalid",
247
+ "log",
248
+ "melter_previous_run_read_failed",
249
+ "melter_report_unconfigured",
250
+ "melter_run_report",
251
+ "melter_run_write_failed",
252
+ "melter_runs_read_failed",
253
+ "melter_staleness_check",
254
+ "message",
255
+ "mpp_rapid_rotation_detected",
256
+ "nwc-float-health-cron.tick",
257
+ "nwc_balance_capacity_skipped",
258
+ "nwc_balance_ceiling_failed",
259
+ "nwc_balance_ceiling_unconfigured",
260
+ "nwc_balance_tiers_inverted",
261
+ "nwc_float_health_check",
262
+ "nwc_float_health_endpoint_failed",
263
+ "nwc_probe_persist_failed",
264
+ "nwc_probe_recovery_failed",
265
+ "nwc_probe_target_skipped",
266
+ "operator_alert",
267
+ "operator_alert_dedup_write_failed",
268
+ "operator_alert_email_failed",
269
+ "operator_alert_no_transport",
270
+ "operator_alert_recovery",
271
+ "operator_alert_webhook_failed",
272
+ "orphan_draw_release_failed",
273
+ "orphan_draw_released",
274
+ "orphan_draw_sweep_failed",
275
+ "orphan_draw_sweep_no_progress",
276
+ "orphan_draw_sweep_truncated",
277
+ "paid_job_death_check",
278
+ "paid_job_death_record_failed",
279
+ "paid_job_death_report_failed",
280
+ "paid_submit_replay_refused",
281
+ "parked",
282
+ "payment_mode",
283
+ "payout_amount_conflict",
284
+ "payout_batch_empty",
285
+ "payout_batch_raced",
286
+ "payout_batch_track_failed",
287
+ "payout_batch_untracked",
288
+ "payout_flush_failed",
289
+ "payout_pending_record_failed",
290
+ "payout_pending_report_failed",
291
+ "payout_pending_snapshot_failed",
292
+ "payout_record_failed",
293
+ "payout_report_failed",
294
+ "pg_notify_failed",
295
+ "phase",
296
+ "pinned",
297
+ "platform-db-health-cron.tick",
298
+ "platform.auth.verify_token",
299
+ "platform.builder.credit",
300
+ "platform.credit_expiry_release.record",
301
+ "platform.deposit.record",
302
+ "platform.drain.record",
303
+ "platform.draw_release.record",
304
+ "platform.fee.calculate",
305
+ "platform.invoice.create",
306
+ "platform.invoice.finalize",
307
+ "platform.payment.validate",
308
+ "platform.payout.record",
309
+ "platform.payout_pending.record",
310
+ "platform.revenue.record",
311
+ "platform.route.handle",
312
+ "platform_db_health_check",
313
+ "platform_db_health_check_failed",
314
+ "platform_db_health_endpoint_failed",
315
+ "platform_db_health_recovery_failed",
316
+ "platform_hosted_test_mint_allowed",
317
+ "postgres_transport_recovery",
318
+ "queued",
319
+ "receipt_issue_failed",
320
+ "receipts_disabled_store_unsupported",
321
+ "report_instant_out_of_range",
322
+ "reputation_flag",
323
+ "reputation_pruned_stale",
324
+ "request_acceptance_recovered",
325
+ "request_acceptance_recovery_refused",
326
+ "retention.swept",
327
+ "revenue-backlog-cron.tick",
328
+ "revenue_backlog_check",
329
+ "revenue_backlog_endpoint_failed",
330
+ "revenue_backlog_recovery_failed",
331
+ "revenue_deadletter_bump_failed",
332
+ "revenue_deadletter_drain",
333
+ "revenue_deadletter_enqueue_failed",
334
+ "revenue_reporter_abandoned",
335
+ "revenue_skipped_no_rail",
336
+ "revenue_skipped_no_rail_check",
337
+ "revenue_skipped_no_rail_record_failed",
338
+ "revenue_skipped_no_rail_report_failed",
339
+ "revenue_skipped_unsettled_draw",
340
+ "rollback",
341
+ "router.proxy",
342
+ "scrape_cache_touch_failed",
343
+ "scrape_cache_write_failed",
344
+ "scrape_card_segmentation_failed",
345
+ "scrape_event_write_failed",
346
+ "scrape_extract_cache_touch_failed",
347
+ "scrape_extract_cache_write_failed",
348
+ "scrape_extract_provenance_failed",
349
+ "scrape_job_cancelled",
350
+ "scrape_pagination_detection_failed",
351
+ "scrape_polish_cache_touch_failed",
352
+ "scrape_polish_cache_write_failed",
353
+ "scrape_rows_normalize_failed",
354
+ "scribe_job_cancelled",
355
+ "secp256k1_auth_replay_store_in_memory",
356
+ "sent",
357
+ "signed_request_replay_store_saturated",
358
+ "span_buffer_drop",
359
+ "span_dimension_oversized",
360
+ "span_flush_failed",
361
+ "span_ingestion_identity_resolution_failed",
362
+ "span_ingestion_insert_failed",
363
+ "span_truncated",
364
+ "spans-retention-cron.tick",
365
+ "spans_pipeline_check",
366
+ "spans_pipeline_recovery_failed",
367
+ "spans_retention_failed",
368
+ "stale_job_cancelled",
369
+ "stale_job_failed",
370
+ "stale_job_sweep_clock_skew",
371
+ "stale_job_sweep_failed",
372
+ "stripe.create_checkout_session",
373
+ "stripe.create_portal_session",
374
+ "stripe.get_or_create_customer",
375
+ "stripe.get_or_create_customer.result",
376
+ "stripe.handle_webhook",
377
+ "stripe.handle_webhook.verified",
378
+ "stripe.on_checkout_completed",
379
+ "stripe.on_checkout_completed.customer_deleted",
380
+ "stripe.on_checkout_completed.metadata_mismatch_bound",
381
+ "stripe.on_checkout_completed.metadata_mismatch_first_bind",
382
+ "stripe.on_invoice_created",
383
+ "stripe.on_invoice_paid",
384
+ "stripe.process_event",
385
+ "stripe_webhook_error_rate_check",
386
+ "stripe_webhook_gap_check",
387
+ "substrate_escalation",
388
+ "tempo.issue_challenges",
389
+ "tempo.verify_credential",
390
+ "tempo_channel_binding_malformed",
391
+ "tempo_channel_binding_missing",
392
+ "tempo_channel_binding_unavailable",
393
+ "tempo_channel_escrow_changed",
394
+ "tempo_channel_owner_conflict",
395
+ "tempo_channel_registration_failed",
396
+ "tempo_charge_replay_store_in_memory",
397
+ "tempo_close_credential_refresh_required",
398
+ "tempo_close_credential_wrong_channel",
399
+ "tempo_close_delivery_configuration_error",
400
+ "tempo_close_event",
401
+ "tempo_close_events_rearmed",
402
+ "tempo_close_finalized_before_protection",
403
+ "tempo_close_health_check",
404
+ "tempo_close_observer_tick",
405
+ "tempo_credential_rejected",
406
+ "tempo_deposit_registration_alert_failed",
407
+ "tempo_drain_refund_below_debit",
408
+ "tempo_drain_refund_forecast_below_debit",
409
+ "tempo_drain_refund_forecast_unavailable",
410
+ "tempo_drain_written_off",
411
+ "tempo_observer_health_unavailable",
412
+ "tempo_observer_scan_failed",
413
+ "tempo_refund_amount_unreported",
414
+ "tempo_routine_sweep",
415
+ "tempo_routine_sweep_failed",
416
+ "tempo_session_advertised_refresh_failed",
417
+ "tempo_session_close_challenge_failed",
418
+ "tempo_session_close_failed",
419
+ "tempo_session_close_failure_reconcile_failed",
420
+ "tempo_session_close_recovery_failed",
421
+ "tempo_session_open_refused",
422
+ "tempo_session_settled",
423
+ "tempo_session_withheld",
424
+ "tempo_settlement_balance_alert_failed",
425
+ "tempo_settlement_failure_alert_failed",
426
+ "tempo_settlement_fee_balance",
427
+ "tempo_settlement_fee_balance_failed",
428
+ "tempo_settlement_insufficient_funds",
429
+ "tempo_settlement_readiness_report_failed",
430
+ "tempo_settlement_readiness_state_failed",
431
+ "terminal_cost_handoff_retry_scheduled",
432
+ "terminal_cost_recovery_complete",
433
+ "terminal_cost_recovery_failed",
434
+ "terminal_cost_recovery_truncated",
435
+ "transcriber_fallback",
436
+ "update",
437
+ "upgrade_prompt_evaluation_failed",
438
+ "wallet_accumulator_batch_expired",
439
+ "wallet_accumulator_batch_expiring_soon",
440
+ "wallet_accumulator_batch_orphan_lock_pubkey",
441
+ "wallet_accumulator_batch_retired_lock_pubkey",
442
+ "wallet_accumulator_lock_pubkey_prune_failed",
443
+ "wallet_accumulator_monitor_start_failed",
444
+ "wallet_accumulator_reaped_expired_keyset",
445
+ "wallet_accumulator_tick_error",
446
+ "warning",
447
+ "x402.settle_with_facilitator",
448
+ "x402.settle_with_facilitator.result",
449
+ "x402.verify_payment",
450
+ "x402.verify_payment.result",
451
+ "x402.verify_with_facilitator",
452
+ "x402.verify_with_facilitator.result",
453
+ "x402_claim_ceiling_unbound",
454
+ "x402_claim_ceiling_unresolved",
455
+ "x402_credential_rejected",
456
+ "x402_facilitator_capability_degraded",
457
+ "x402_facilitator_fallback",
458
+ "x402_facilitator_staleness_ceiling",
459
+ "x402_facilitator_unavailable",
460
+ "x402_network_unsupported",
461
+ "x402_refund_amount_unreported",
462
+ "x402_repair_channel_state_stale",
463
+ "x402_repair_write_off_restore_failed",
464
+ "x402_self_relay_gas_alert_failed",
465
+ "x402_self_relay_gas_balance",
466
+ "x402_self_relay_gas_balance_failed",
467
+ "x402_self_relay_gas_balance_report_failed",
468
+ "x402_self_relay_rpc_alert_failed",
469
+ "x402_self_relay_rpc_failed",
470
+ "x402_self_relay_rpc_health_report_failed",
471
+ "x402_self_relay_submission_lock_timeout",
472
+ "x402_self_relay_unserialized",
473
+ "x402_settlement_reconciliation_chain_unreachable",
474
+ "x402_settlement_reconciliation_facilitator_unavailable",
475
+ "x402_settlement_submission_failed",
476
+ "x402_settlement_written_off"
477
+ ],
478
+ routeTemplates: [
479
+ "/",
480
+ "/_dev",
481
+ "/_internal/abuse-signal",
482
+ "/_internal/backup-alert",
483
+ "/_internal/cashu-mint-audit",
484
+ "/_internal/cashu-mint-health",
485
+ "/_internal/cast/backup",
486
+ "/_internal/cast/cleanup",
487
+ "/_internal/cast/repair-durations",
488
+ "/_internal/ci-lane-report",
489
+ "/_internal/credit-deposit",
490
+ "/_internal/credit-drain",
491
+ "/_internal/credit-draw-release",
492
+ "/_internal/credit-expiry-release",
493
+ "/_internal/domain-verify-backoff",
494
+ "/_internal/dvm-stats-rollup",
495
+ "/_internal/enforce",
496
+ "/_internal/failed-dvm-cleanup",
497
+ "/_internal/fx",
498
+ "/_internal/fx-rates/refresh",
499
+ "/_internal/job-cost",
500
+ "/_internal/job-retention",
501
+ "/_internal/job-revenue",
502
+ "/_internal/job-terminal",
503
+ "/_internal/lightning-rail-health",
504
+ "/_internal/liveness-probe",
505
+ "/_internal/melter-report",
506
+ "/_internal/nwc-float-health",
507
+ "/_internal/paid-job-death",
508
+ "/_internal/payout",
509
+ "/_internal/payout-pending",
510
+ "/_internal/platform-db-health",
511
+ "/_internal/registry",
512
+ "/_internal/registry-ranking",
513
+ "/_internal/revalidate",
514
+ "/_internal/revenue-backlog",
515
+ "/_internal/revenue-skipped-no-rail",
516
+ "/_internal/scribe/cleanup",
517
+ "/_internal/spans",
518
+ "/_internal/spans-retention",
519
+ "/_internal/tempo-close-event",
520
+ "/_internal/tempo-observer-health",
521
+ "/_internal/tempo-settlement-balance",
522
+ "/_internal/tempo-settlement-failure",
523
+ "/_internal/x402-self-relay-gas-balance",
524
+ "/_internal/x402-self-relay-rpc-health",
525
+ "/_isolate/info",
526
+ "/_isolate/invoke",
527
+ "/admin/cashu/mark-melted",
528
+ "/admin/cashu/pending-batches",
529
+ "/admin/cashu/restart-failed",
530
+ "/admin/cashu/rotate-lock-pubkey",
531
+ "/admin/credit/bitcoin-liability",
532
+ "/admin/credit/blocked-invoices",
533
+ "/admin/credit/mark-drain-sent",
534
+ "/admin/credit/park-drain",
535
+ "/admin/credit/pending-drains",
536
+ "/admin/credit/reconcile-invoice",
537
+ "/admin/credit/reconcile-tempo-drain",
538
+ "/admin/credit/reconcile-x402-exact-settlement",
539
+ "/admin/credit/reconcile-x402-settlement",
540
+ "/admin/credit/tempo-drains",
541
+ "/admin/credit/tempo-losses",
542
+ "/admin/credit/write-off-invoice",
543
+ "/admin/credit/write-off-tempo-drain",
544
+ "/admin/credit/write-off-x402-settlement",
545
+ "/admin/credit/x402-exact-settlements",
546
+ "/admin/credit/x402-settlements",
547
+ "/api-keys",
548
+ "/api-keys/:id",
549
+ "/api-keys/:id/rotate",
550
+ "/api/activity",
551
+ "/api/builders",
552
+ "/api/builders/:id",
553
+ "/api/deploys",
554
+ "/api/dvms",
555
+ "/api/dvms/:id",
556
+ "/api/dvms/:id/resume",
557
+ "/api/dvms/:id/suspend",
558
+ "/api/health",
559
+ "/api/jobs",
560
+ "/api/metrics",
561
+ "/api/revenue",
562
+ "/api/stats",
563
+ "/api/v1/billing/capabilities",
564
+ "/api/v1/billing/plans/public",
565
+ "/api/v1/cli-auth/:session",
566
+ "/api/v1/cli-auth/:session/cancel",
567
+ "/api/v1/feedback",
568
+ "/api/v1/github/installation-callback",
569
+ "/api/v1/github/webhook",
570
+ "/api/v1/handle/check/:handle",
571
+ "/api/v1/invites/:token",
572
+ "/api/v1/invites/pending",
573
+ "/api/v1/mint-health",
574
+ "/api/v1/profiles/:handle",
575
+ "/api/v1/profiles/:handle/dvms/:slug",
576
+ "/api/v1/public/explore",
577
+ "/api/v1/wallet-pairings",
578
+ "/api/v1/wallet-pairings/:session",
579
+ "/api/v1/wallet-pairings/:session/manifest",
580
+ "/api/v1/wallet-pairings/:session/submission",
581
+ "/api/v1/wallet-pairings/:session/submission/:event",
582
+ "/api/v1/webhooks/stripe",
583
+ "/auth/me",
584
+ "/billing",
585
+ "/billing/checkout",
586
+ "/billing/compute",
587
+ "/billing/egress",
588
+ "/billing/invoices",
589
+ "/billing/invoices/:id",
590
+ "/billing/lightning/checkout",
591
+ "/billing/lightning/invoice/:id",
592
+ "/billing/plan-change/:id",
593
+ "/billing/plan-change/:id/purchase",
594
+ "/billing/plan-change/:id/renew-with-credit",
595
+ "/billing/plan-change/:id/schedule",
596
+ "/billing/plan-change/quote",
597
+ "/billing/plans",
598
+ "/billing/portal",
599
+ "/billing/revenue",
600
+ "/billing/revenue/events",
601
+ "/billing/subscription/renew-current-with-credit",
602
+ "/billing/usage",
603
+ "/builders/me/base",
604
+ "/builders/me/billing-vat",
605
+ "/builders/me/tempo",
606
+ "/builders/me/terms",
607
+ "/deploy",
608
+ "/deploy/local",
609
+ "/deploys/:id",
610
+ "/deploys/:id/logs",
611
+ "/deploys/recent",
612
+ "/dvms",
613
+ "/dvms/:dvmId",
614
+ "/dvms/:dvmId/committed",
615
+ "/dvms/:dvmId/db-tunnel",
616
+ "/dvms/:dvmId/deploy-identity",
617
+ "/dvms/:dvmId/deploys",
618
+ "/dvms/:dvmId/deposits",
619
+ "/dvms/:dvmId/domains",
620
+ "/dvms/:dvmId/domains/:domain",
621
+ "/dvms/:dvmId/domains/:domain/verify",
622
+ "/dvms/:dvmId/earnings",
623
+ "/dvms/:dvmId/env",
624
+ "/dvms/:dvmId/events",
625
+ "/dvms/:dvmId/exec",
626
+ "/dvms/:dvmId/git/link",
627
+ "/dvms/:dvmId/jobs/:jobId/artifact",
628
+ "/dvms/:dvmId/jobs/:jobId/complete",
629
+ "/dvms/:dvmId/jobs/:jobId/cost",
630
+ "/dvms/:dvmId/jobs/:jobId/fail",
631
+ "/dvms/:dvmId/jobs/:jobId/message",
632
+ "/dvms/:dvmId/jobs/:jobId/payment-request",
633
+ "/dvms/:dvmId/jobs/:jobId/progress",
634
+ "/dvms/:dvmId/jobs/:jobId/prompt",
635
+ "/dvms/:dvmId/jobs/:jobId/status",
636
+ "/dvms/:dvmId/jobs/:jobId/step-result",
637
+ "/dvms/:dvmId/jobs/:jobId/text",
638
+ "/dvms/:dvmId/jobs/:jobId/working",
639
+ "/dvms/:dvmId/kv",
640
+ "/dvms/:dvmId/kv/:key",
641
+ "/dvms/:dvmId/lock-pubkey",
642
+ "/dvms/:dvmId/logs",
643
+ "/dvms/:dvmId/metrics",
644
+ "/dvms/:dvmId/pause",
645
+ "/dvms/:dvmId/redeploy",
646
+ "/dvms/:dvmId/restart",
647
+ "/dvms/:dvmId/resume",
648
+ "/dvms/:dvmId/rollback",
649
+ "/dvms/:dvmId/rotate-lock-pubkey",
650
+ "/dvms/:dvmId/scale",
651
+ "/dvms/:dvmId/secret-recovery",
652
+ "/dvms/:dvmId/secrets",
653
+ "/dvms/:dvmId/settings",
654
+ "/dvms/:dvmId/ssh",
655
+ "/dvms/:dvmId/stats",
656
+ "/dvms/:dvmId/status",
657
+ "/dvms/:dvmId/storefront",
658
+ "/dvms/:dvmId/transfer",
659
+ "/dvms/:dvmId/visibility",
660
+ "/dvms/refresh-meta",
661
+ "/events",
662
+ "/feedback",
663
+ "/feeds/:owner/:slug",
664
+ "/github/app-info",
665
+ "/github/install-intent",
666
+ "/github/installations",
667
+ "/github/installations/:id/repos",
668
+ "/handle",
669
+ "/health",
670
+ "/healthz",
671
+ "/hosting/capacity/accounts/:accountId",
672
+ "/hosting/capacity/accounts/:accountId/exemption",
673
+ "/hosting/capacity/accounts/:accountId/operations/:operationId/release",
674
+ "/hosting/capacity/accounts/:accountId/override",
675
+ "/hosting/storage/inventory",
676
+ "/invites/:token/accept",
677
+ "/me",
678
+ "/metrics/summary",
679
+ "/notifications",
680
+ "/notifications/preferences",
681
+ "/notifications/read",
682
+ "/notifications/unread-count",
683
+ "/orgs",
684
+ "/orgs/:handle",
685
+ "/orgs/:handle/avatar",
686
+ "/orgs/:handle/base",
687
+ "/orgs/:handle/billing",
688
+ "/orgs/:handle/billing-vat",
689
+ "/orgs/:handle/billing/checkout",
690
+ "/orgs/:handle/billing/compute",
691
+ "/orgs/:handle/billing/egress",
692
+ "/orgs/:handle/billing/invoices",
693
+ "/orgs/:handle/billing/portal",
694
+ "/orgs/:handle/billing/usage",
695
+ "/orgs/:handle/committed",
696
+ "/orgs/:handle/credits",
697
+ "/orgs/:handle/dvms",
698
+ "/orgs/:handle/earnings",
699
+ "/orgs/:handle/events",
700
+ "/orgs/:handle/feed",
701
+ "/orgs/:handle/invites",
702
+ "/orgs/:handle/invites/:id",
703
+ "/orgs/:handle/keys",
704
+ "/orgs/:handle/keys/:hash",
705
+ "/orgs/:handle/members",
706
+ "/orgs/:handle/members/:bh",
707
+ "/orgs/:handle/members/:bh/role",
708
+ "/orgs/:handle/members/history",
709
+ "/orgs/:handle/metrics/summary",
710
+ "/orgs/:handle/notification-preferences",
711
+ "/orgs/:handle/payout-pending",
712
+ "/orgs/:handle/payout-routing",
713
+ "/orgs/:handle/payouts",
714
+ "/orgs/:handle/payouts/csv",
715
+ "/orgs/:handle/revenue/csv",
716
+ "/orgs/:handle/revenue/events",
717
+ "/orgs/:handle/revenue/series",
718
+ "/orgs/:handle/settlements",
719
+ "/orgs/:handle/settlements/csv",
720
+ "/orgs/:handle/stats",
721
+ "/orgs/:handle/tempo",
722
+ "/orgs/:handle/transfer",
723
+ "/profile",
724
+ "/profile/avatar",
725
+ "/revenue/csv",
726
+ "/revenue/events",
727
+ "/revenue/series",
728
+ "/spans",
729
+ "/traces",
730
+ "/traces/:trace_id",
731
+ "/traces/aggregate",
732
+ "/v1/credit",
733
+ "/v1/info",
734
+ "/v1/ingest/audio",
735
+ "/v1/ingest/image",
736
+ "/v1/job",
737
+ "/v1/job/:id",
738
+ "/v1/job/:id/messages",
739
+ "/v1/quote",
740
+ "/v1/request-result/:requestId",
741
+ "/v1/request-resume/:requestId"
742
+ ],
743
+ errorCodes: [
744
+ "app_shell_detected",
745
+ "audio_source_required",
746
+ "auth_error",
747
+ "auth_required",
748
+ "bytes_cap",
749
+ "capability_required",
750
+ "captcha_unsolved",
751
+ "cloudflare_unsolved",
752
+ "content_rejected",
753
+ "cover_invalid",
754
+ "credit_fund_failed",
755
+ "css_selector_for_requested_content",
756
+ "decoder_failed",
757
+ "decoder_unavailable",
758
+ "diarise_failed",
759
+ "display",
760
+ "dns_failed",
761
+ "duration_exceeds_cap",
762
+ "empty_body",
763
+ "episode_not_found",
764
+ "extract_input_too_large",
765
+ "extract_llm_failed",
766
+ "extract_schema_invalid",
767
+ "extract_validation_failed",
768
+ "feed_full",
769
+ "feed_not_found",
770
+ "feed_path_invalid",
771
+ "fetch_blocked",
772
+ "fetch_timeout",
773
+ "forbidden",
774
+ "format_unsupported",
775
+ "function",
776
+ "fx_rate_unavailable",
777
+ "geo_blocked",
778
+ "hardened",
779
+ "head_status",
780
+ "hint",
781
+ "ingest_concurrency",
782
+ "ingest_global_concurrency",
783
+ "ingest_ip_concurrency",
784
+ "inline_too_large",
785
+ "insecure_scheme",
786
+ "internal_error",
787
+ "invalid_input",
788
+ "invalid_menu",
789
+ "invalid_payment",
790
+ "invalid_quote_data",
791
+ "invalid_url",
792
+ "job_failed",
793
+ "job_timeout",
794
+ "login_wall_detected",
795
+ "message",
796
+ "milliseconds",
797
+ "network_error",
798
+ "no_diariser",
799
+ "no_premium_substrate",
800
+ "none",
801
+ "not_found",
802
+ "object",
803
+ "output_delivery_failed",
804
+ "oversize",
805
+ "owner_short_collision",
806
+ "page_too_large",
807
+ "path_not_found",
808
+ "payment_invalid",
809
+ "payment_required",
810
+ "paywall_detected",
811
+ "polish_input_too_large",
812
+ "polish_llm_failed",
813
+ "presign_failed",
814
+ "private_address",
815
+ "probe_failed",
816
+ "provider",
817
+ "provider_allowance_exhausted",
818
+ "provider_error",
819
+ "provider_failed",
820
+ "provider_invalid_response",
821
+ "provider_network",
822
+ "provider_rate_limit",
823
+ "provider_rejected",
824
+ "provider_rejected_audio",
825
+ "provider_timeout",
826
+ "provider_unavailable",
827
+ "quota_exceeded",
828
+ "rate_limited",
829
+ "rate_limited_by_target",
830
+ "replay_detected",
831
+ "request_integrity_failed",
832
+ "retry_hardened",
833
+ "retry_with_bounded_wait",
834
+ "retry_with_content_selector",
835
+ "seconds_cap",
836
+ "selector",
837
+ "server_error",
838
+ "sha256_mismatch",
839
+ "signature_invalid",
840
+ "size_mismatch",
841
+ "source_unreachable",
842
+ "ssrf_blocked",
843
+ "string",
844
+ "substrate_unavailable",
845
+ "timeout",
846
+ "timestamp_drift",
847
+ "torn_upload",
848
+ "transcribe_failed",
849
+ "unauthorized",
850
+ "unexpected",
851
+ "unexpected_status",
852
+ "unknown_error",
853
+ "unsafe_url",
854
+ "upload_failed",
855
+ "upload_handle_expired",
856
+ "upload_handle_not_found",
857
+ "upload_handle_not_owner",
858
+ "upload_kind_mismatch",
859
+ "upstream",
860
+ "upstream_network",
861
+ "upstream_status",
862
+ "upstream_timeout",
863
+ "use_alternative_source",
864
+ "wait_for_selector",
865
+ "wait_too_long",
866
+ "wrong_content_type"
867
+ ],
868
+ datasets: [
869
+ "platform",
870
+ "cashu",
871
+ "lightning",
872
+ "stripe",
873
+ "x402",
874
+ "tempo",
875
+ "isolate",
876
+ "audit",
877
+ "cron"
878
+ ],
879
+ levels: [
880
+ "info",
881
+ "warn",
882
+ "error"
883
+ ],
884
+ statuses: [
885
+ "ok",
886
+ "error"
887
+ ],
888
+ methods: [
889
+ "GET",
890
+ "POST",
891
+ "PUT",
892
+ "PATCH",
893
+ "DELETE",
894
+ "HEAD",
895
+ "OPTIONS"
896
+ ],
897
+ rails: [
898
+ "cashu",
899
+ "lightning",
900
+ "x402",
901
+ "tempo"
902
+ ],
903
+ stages: [
904
+ "input",
905
+ "quote"
906
+ ],
907
+ handlers: [
908
+ "job",
909
+ "quote"
910
+ ],
911
+ currencyTokens: [
912
+ "BTC",
913
+ "SAT",
914
+ "SATS",
915
+ "MSAT",
916
+ "MSATS",
917
+ "USD",
918
+ "EUR",
919
+ "GBP",
920
+ "USDC",
921
+ "AlphaUSD",
922
+ "BetaUSD",
923
+ "pathUSD",
924
+ "btc",
925
+ "sat",
926
+ "sats",
927
+ "msat",
928
+ "msats",
929
+ "usd",
930
+ "eur",
931
+ "gbp",
932
+ "usdc"
933
+ ],
934
+ booleanFields: [
935
+ "client.capabilities_valid",
936
+ "client.protocol_version_valid",
937
+ "client.version_valid",
938
+ "http.probe",
939
+ "is_valid",
940
+ "rate_carried_forward",
941
+ "republished",
942
+ "storefront_probe",
943
+ "success",
944
+ "verified",
945
+ "wallet_reported_budget"
946
+ ],
947
+ integerFields: [
948
+ "ageMs",
949
+ "age_ms",
950
+ "amount_micro",
951
+ "amount_msats",
952
+ "ask_msats",
953
+ "asked_topup_micro",
954
+ "attempt",
955
+ "balance_msats",
956
+ "batch_size",
957
+ "buffer_size",
958
+ "count",
959
+ "cutoff_ms",
960
+ "durationMs",
961
+ "duration_ms",
962
+ "elapsedMs",
963
+ "elapsed_ms",
964
+ "latencyMs",
965
+ "latency_ms",
966
+ "method_count",
967
+ "proofAmount",
968
+ "required_msats",
969
+ "required_usdc_micro",
970
+ "retention_days",
971
+ "retry_count",
972
+ "rows_deleted",
973
+ "skewMs",
974
+ "skew_ms",
975
+ "timeout_ms",
976
+ "totalSats",
977
+ "transaction_count",
978
+ "value_size_bytes"
979
+ ],
980
+ tokenFields: [],
981
+ hashFields: [
982
+ "key_hash",
983
+ "prefix_hash"
984
+ ],
985
+ urlFields: [
986
+ "url",
987
+ "facilitator_url",
988
+ "mint_url"
989
+ ],
990
+ identityFields: [
991
+ "dvm_id",
992
+ "dvm_slug",
993
+ "builder_id"
994
+ ],
995
+ capabilityFields: [
996
+ "capability"
997
+ ],
998
+ clientProtocolVersions: [
999
+ 1
1000
+ ],
1001
+ clientVersionFields: [
1002
+ "client.version"
1003
+ ]
1004
+ };
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
+ var diagnosticConsole = {
1350
+ debug: (...values) => emit("debug", values),
1351
+ info: (...values) => emit("info", values),
1352
+ warn: (...values) => emit("warn", values),
1353
+ error: (...values) => emit("error", values),
1354
+ log: (...values) => emit("log", values)
1355
+ };
1356
+ function emitDiagnostic(level, event, fields, dataset) {
1357
+ writeDiagnostic(level, event, fields, dataset);
1358
+ }
1359
+ function writeDiagnostic(sinkLevel, event, fields, dataset, severityOverride) {
1360
+ try {
1361
+ const defaultSeverity = sinkLevel === "debug" || sinkLevel === "log" ? "info" : sinkLevel;
1362
+ const severity = severityOverride === "info" || severityOverride === "warn" || severityOverride === "error" ? severityOverride : defaultSeverity;
1363
+ const record = {
1364
+ event: projectEventName(event),
1365
+ level: severity,
1366
+ ...projectDiagnosticFields(fields, dataset)
1367
+ };
1368
+ const sink = sinkLevel === "log" ? console.log : console[sinkLevel];
1369
+ sink(JSON.stringify(record));
1370
+ } catch {
1371
+ }
1372
+ }
1373
+ function emit(level, values) {
1374
+ const parsed = values.length === 1 ? parseStructuredValue(values[0]) : void 0;
1375
+ if (parsed) {
1376
+ const event = ownValue2(parsed, "event");
1377
+ const legacyEvent = ownValue2(parsed, "level");
1378
+ const dataset = ownValue2(parsed, "dataset");
1379
+ writeDiagnostic(
1380
+ level,
1381
+ event ?? legacyEvent,
1382
+ parsed,
1383
+ typeof dataset === "string" ? dataset : void 0,
1384
+ legacyEvent
1385
+ );
1386
+ return;
1387
+ }
1388
+ emitDiagnostic(level, "diagnostic.message");
1389
+ }
1390
+ function parseStructuredValue(value) {
1391
+ if (typeof value === "object" && value !== null) return value;
1392
+ if (typeof value !== "string" || value.length > 64 * 1024 || !value.startsWith("{"))
1393
+ return void 0;
1394
+ try {
1395
+ const parsed = JSON.parse(value);
1396
+ return typeof parsed === "object" && parsed !== null ? parsed : void 0;
1397
+ } catch {
1398
+ return void 0;
1399
+ }
1400
+ }
1401
+ function ownValue2(input, key) {
1402
+ try {
1403
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1404
+ return descriptor && "value" in descriptor ? descriptor.value : void 0;
1405
+ } catch {
1406
+ return void 0;
1407
+ }
1408
+ }
1409
+
1410
+ // node_modules/@dvmkit/sdk/dist/chunk-COYKJRMM.js
1411
+ import { AsyncLocalStorage } from "async_hooks";
1412
+ var SDK_INIT_ADVISORY_LOCK = 17320927;
1413
+ async function withSdkInitLock(db, fn) {
1414
+ const context = activeInits.getStore();
1415
+ if (context?.get(db)?.active) return fn();
1416
+ assertPoolFitsLock(db);
1417
+ let holder = holders.get(db);
1418
+ if (holder) {
1419
+ holder.refs += 1;
1420
+ } else {
1421
+ holder = { refs: 1, acquired: acquire(db), tail: Promise.resolve() };
1422
+ holders.set(db, holder);
1423
+ }
1424
+ const predecessor = holder.tail;
1425
+ let finishTurn;
1426
+ holder.tail = new Promise((resolve) => {
1427
+ finishTurn = resolve;
1428
+ });
1429
+ let guardedFailed = false;
1430
+ try {
1431
+ await holder.acquired;
1432
+ await predecessor;
1433
+ const token = { active: true };
1434
+ const nextContext = new Map(context);
1435
+ nextContext.set(db, token);
1436
+ try {
1437
+ return await activeInits.run(nextContext, fn);
1438
+ } finally {
1439
+ token.active = false;
1440
+ }
1441
+ } catch (err) {
1442
+ guardedFailed = true;
1443
+ throw err;
1444
+ } finally {
1445
+ try {
1446
+ await releaseHolder(db, holder, guardedFailed);
1447
+ } finally {
1448
+ finishTurn();
1449
+ }
1450
+ }
1451
+ }
1452
+ var holders = /* @__PURE__ */ new WeakMap();
1453
+ var activeInits = new AsyncLocalStorage();
1454
+ function assertPoolFitsLock(db) {
1455
+ const max = db.options?.max;
1456
+ if (max === void 0 || max >= 2) return;
1457
+ throw new Error(
1458
+ `withSdkInitLock: the SDK boot lock needs a pool that allows at least 2 connections (got max=${max}). The lock is held on one pinned client while the guarded DDL runs on another, so boot would hang forever.`
1459
+ );
1460
+ }
1461
+ async function acquire(db) {
1462
+ const client = await db.connect();
1463
+ try {
1464
+ await client.query(`SELECT pg_advisory_lock(${SDK_INIT_ADVISORY_LOCK})`);
1465
+ } catch (err) {
1466
+ client.release();
1467
+ throw err;
1468
+ }
1469
+ return client;
1470
+ }
1471
+ async function releaseHolder(db, holder, guardedFailed) {
1472
+ holder.refs -= 1;
1473
+ if (holder.refs > 0) return;
1474
+ holders.delete(db);
1475
+ let client;
1476
+ try {
1477
+ client = await holder.acquired;
1478
+ } catch {
1479
+ return;
1480
+ }
1481
+ try {
1482
+ await client.query(`SELECT pg_advisory_unlock(${SDK_INIT_ADVISORY_LOCK})`);
1483
+ client.release();
1484
+ } catch (err) {
1485
+ client.release(err instanceof Error ? err : new Error(String(err)));
1486
+ if (!guardedFailed) throw err;
1487
+ }
1488
+ }
1489
+
1490
+ export {
1491
+ DIAGNOSTIC_CATALOGUE_VERSION,
1492
+ createDiagnosticCapabilityAuthority,
1493
+ bindDiagnosticCapabilityAuthority,
1494
+ extendDiagnosticIdentityAuthority,
1495
+ bindDiagnosticIdentityAuthority,
1496
+ projectSpanRow,
1497
+ projectDiagnosticFields,
1498
+ projectEventName,
1499
+ diagnosticConsole,
1500
+ emitDiagnostic,
1501
+ withSdkInitLock
1502
+ };