@dvmkit/dvm-cli 0.4.1 → 0.5.0

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 (32) hide show
  1. package/README.md +8 -0
  2. package/dist/{chunk-24VB7FR7.js → chunk-3YE43JJR.js} +4 -4
  3. package/dist/{chunk-SKKZ4OAA.js → chunk-4KINCBHL.js} +53 -56
  4. package/dist/{chunk-XN4YSEO6.js → chunk-EE2MREOM.js} +152 -93
  5. package/dist/chunk-ERJFRCJO.js +150 -0
  6. package/dist/chunk-FL2ICZW5.js +383 -0
  7. package/dist/chunk-FSYEZERJ.js +1667 -0
  8. package/dist/{chunk-V2BE4E5V.js → chunk-ID5G54HJ.js} +223 -73
  9. package/dist/{chunk-4NWEJTAW.js → chunk-MJ4X4BEW.js} +7953 -8036
  10. package/dist/{chunk-Z75N4GTG.js → chunk-QICJRKB7.js} +23557 -16012
  11. package/dist/{chunk-ECEM3ZAS.js → chunk-R55XNXAR.js} +53 -185
  12. package/dist/{chunk-R4MSO2GX.js → chunk-SHZMNEXE.js} +65 -24
  13. package/dist/chunk-TZWZTS37.js +1517 -0
  14. package/dist/{chunk-VY277ROG.js → chunk-VOO5IAK7.js} +600 -97
  15. package/dist/{chunk-2VVVWBQA.js → chunk-WTM2EICO.js} +2 -352
  16. package/dist/chunk-XHOFQ3OS.js +717 -0
  17. package/dist/{chunk-YLWATJ7F.js → chunk-Z4CZUMUT.js} +937 -1599
  18. package/dist/{client-OWIOFBKS.js → client-RYDA62DU.js} +11 -8
  19. package/dist/{dist-2G3QBGID.js → dist-GKCEIY2A.js} +7 -4
  20. package/dist/dvm.js +478 -70
  21. package/dist/{internal-OBEYRHMV.js → internal-INUTGTXQ.js} +56 -33
  22. package/dist/{payout-reporter-RG6XNGPI-KNY74HLM.js → payout-reporter-3Y2U55ZX-CMKACKA3.js} +2 -2
  23. package/dist/{pocket-refill-NXTJIVB5.js → pocket-refill-K5T4LZF6.js} +18 -14
  24. package/dist/{revenue-reporter-ASZ7SHHH-ISAMJDZQ.js → revenue-reporter-MAERPYGK-CCPZXGFA.js} +2 -2
  25. package/dist/tempo-AXTE4ZEA.js +34 -0
  26. package/dist/{tempo-lifecycle-DFIXQ54Q-LNXPKWK5.js → tempo-lifecycle-ZBBLFBMH-HWI4PLYP.js} +11 -7
  27. package/dist/{tempo-wallet-4QKSV65O-J6ZZQAD7.js → tempo-wallet-B5XXV3YH-SRQBMYFV.js} +2 -2
  28. package/dist/{x402-5H27DCBE-UEQQQ5UY.js → x402-R6HPBY5D-VMSW7Z32.js} +3 -3
  29. package/package.json +2 -2
  30. package/skills/dvm/calling.md +2 -0
  31. package/skills/dvm/credit.md +2 -0
  32. package/dist/chunk-3SWX5BQP.js +0 -66
@@ -0,0 +1,1517 @@
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-ETXDTUJO.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 = [...diagnostic_catalogue_v1_default.routeTemplates].sort(
1008
+ compareRouteTemplates
1009
+ );
1010
+ var ERROR_CODES = new Set(diagnostic_catalogue_v1_default.errorCodes);
1011
+ var DATASETS = new Set(diagnostic_catalogue_v1_default.datasets);
1012
+ var LEVELS = new Set(diagnostic_catalogue_v1_default.levels);
1013
+ var STATUSES = new Set(diagnostic_catalogue_v1_default.statuses);
1014
+ var METHODS = new Set(diagnostic_catalogue_v1_default.methods);
1015
+ var RAILS = new Set(diagnostic_catalogue_v1_default.rails);
1016
+ var STAGES = new Set(diagnostic_catalogue_v1_default.stages);
1017
+ var HANDLERS = new Set(diagnostic_catalogue_v1_default.handlers);
1018
+ var CURRENCIES = new Set(diagnostic_catalogue_v1_default.currencyTokens);
1019
+ var BOOLEAN_FIELDS = new Set(diagnostic_catalogue_v1_default.booleanFields);
1020
+ var INTEGER_FIELDS = new Set(diagnostic_catalogue_v1_default.integerFields);
1021
+ var TOKEN_FIELDS = new Set(diagnostic_catalogue_v1_default.tokenFields);
1022
+ var HASH_FIELDS = new Set(diagnostic_catalogue_v1_default.hashFields);
1023
+ var URL_FIELDS = new Set(diagnostic_catalogue_v1_default.urlFields);
1024
+ var IDENTITY_FIELDS = new Set(diagnostic_catalogue_v1_default.identityFields);
1025
+ var CAPABILITY_FIELDS = new Set(diagnostic_catalogue_v1_default.capabilityFields);
1026
+ var CLIENT_PROTOCOL_VERSIONS = new Set(
1027
+ diagnostic_catalogue_v1_default.clientProtocolVersions
1028
+ );
1029
+ var CLIENT_VERSION_FIELDS = new Set(diagnostic_catalogue_v1_default.clientVersionFields);
1030
+ var SPAN_ID_RE = /^(?!0{16}$)[0-9a-f]{16}$/;
1031
+ var TRACE_ID_RE = /^(?!0{32}$)[0-9a-f]{32}$/;
1032
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1033
+ var SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
1034
+ var MACHINE_ID_RE = /^[0-9a-f]{12,32}$/;
1035
+ var RELEASE_RE = /^(?:v?\d+\.\d+\.\d+(?:-rc\.\d+)?|[0-9a-f]{7,40}|dev|test|unknown)$/;
1036
+ var CAPABILITY_RE = /^[a-z][a-z0-9_-]{0,47}$/;
1037
+ var CLIENT_VERSION_RE = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-rc\.(?:0|[1-9]\d*))?$/;
1038
+ var HASH_RE = /^(?:[0-9a-f]{16}|[0-9a-f]{64})$/i;
1039
+ var DECIMAL_RE = /^(?:0|[1-9]\d{0,77})$/;
1040
+ var STRIPE_EVENT_RE = /^evt_[A-Za-z0-9]{1,64}$/;
1041
+ var REDACTED_SEGMENT_RE = /^:(?:uuid|hex|n|b58|token)$/;
1042
+ var SERVICE_NAMES = /* @__PURE__ */ new Set([
1043
+ "platform-api",
1044
+ "router",
1045
+ "dvmadmin",
1046
+ "admin",
1047
+ "unknown"
1048
+ ]);
1049
+ var AUTHORITY_CAPABILITIES = /* @__PURE__ */ new WeakMap();
1050
+ var VALUE_AUTHORITIES = /* @__PURE__ */ new WeakMap();
1051
+ var AUTHORITY_IDENTITIES = /* @__PURE__ */ new WeakMap();
1052
+ var VALUE_IDENTITY_AUTHORITIES = /* @__PURE__ */ new WeakMap();
1053
+ function createDiagnosticCapabilityAuthority(capabilityNames) {
1054
+ const allowed = new Set(
1055
+ capabilityNames.filter(
1056
+ (name) => typeof name === "string" && CAPABILITY_RE.test(name)
1057
+ )
1058
+ );
1059
+ const authority = Object.freeze({});
1060
+ AUTHORITY_CAPABILITIES.set(authority, allowed);
1061
+ return authority;
1062
+ }
1063
+ function bindDiagnosticCapabilityAuthority(value, authority) {
1064
+ if (authority && AUTHORITY_CAPABILITIES.has(authority)) {
1065
+ VALUE_AUTHORITIES.set(value, authority);
1066
+ }
1067
+ return value;
1068
+ }
1069
+ function extendDiagnosticIdentityAuthority(authority, key, value) {
1070
+ if (!IDENTITY_FIELDS.has(key)) return authority;
1071
+ const projected = validateIdentity(key, value);
1072
+ if (projected === void 0) return authority;
1073
+ const identities = {
1074
+ ...authority && AUTHORITY_IDENTITIES.get(authority),
1075
+ [key]: projected
1076
+ };
1077
+ const next = Object.freeze({});
1078
+ AUTHORITY_IDENTITIES.set(next, Object.freeze(identities));
1079
+ return next;
1080
+ }
1081
+ function bindDiagnosticIdentityAuthority(value, authority) {
1082
+ if (authority && AUTHORITY_IDENTITIES.has(authority)) {
1083
+ VALUE_IDENTITY_AUTHORITIES.set(value, authority);
1084
+ }
1085
+ return value;
1086
+ }
1087
+ function projectSpanRow(input) {
1088
+ try {
1089
+ if (!isObject(input)) return { ok: false, code: "invalid_span" };
1090
+ const authority = VALUE_AUTHORITIES.get(input);
1091
+ const identityAuthority = VALUE_IDENTITY_AUTHORITIES.get(input);
1092
+ const spanId = ownValue(input, "span_id");
1093
+ if (typeof spanId !== "string" || !SPAN_ID_RE.test(spanId)) {
1094
+ return { ok: false, code: "invalid_span_id" };
1095
+ }
1096
+ const traceId = ownValue(input, "trace_id");
1097
+ if (typeof traceId !== "string" || !TRACE_ID_RE.test(traceId)) {
1098
+ return { ok: false, code: "invalid_trace_id" };
1099
+ }
1100
+ const parentSpanId = ownValue(input, "parent_span_id");
1101
+ if (parentSpanId !== null && (typeof parentSpanId !== "string" || !SPAN_ID_RE.test(parentSpanId))) {
1102
+ return { ok: false, code: "invalid_parent_span_id" };
1103
+ }
1104
+ const dataset = ownValue(input, "dataset");
1105
+ if (typeof dataset !== "string" || !DATASETS.has(dataset)) {
1106
+ return { ok: false, code: "invalid_dataset" };
1107
+ }
1108
+ const level = ownValue(input, "level");
1109
+ if (typeof level !== "string" || !LEVELS.has(level)) {
1110
+ return { ok: false, code: "invalid_level" };
1111
+ }
1112
+ const status = ownValue(input, "status");
1113
+ if (typeof status !== "string" || !STATUSES.has(status)) {
1114
+ return { ok: false, code: "invalid_status" };
1115
+ }
1116
+ const startedAtMs = ownValue(input, "started_at_ms");
1117
+ const endedAtMs = ownValue(input, "ended_at_ms");
1118
+ if (!isEpochMs(startedAtMs) || !isEpochMs(endedAtMs) || endedAtMs < startedAtMs) {
1119
+ return { ok: false, code: "invalid_timestamp" };
1120
+ }
1121
+ const sampleRate = ownValue(input, "sample_rate");
1122
+ const pid = ownValue(input, "pid");
1123
+ const rawName = ownValue(input, "name");
1124
+ const row = {
1125
+ span_id: spanId,
1126
+ trace_id: traceId,
1127
+ parent_span_id: parentSpanId,
1128
+ dataset,
1129
+ name: typeof rawName === "string" && EVENTS.has(rawName) ? rawName : "diagnostic.unknown",
1130
+ level,
1131
+ status,
1132
+ started_at_ms: startedAtMs,
1133
+ ended_at_ms: endedAtMs,
1134
+ service: projectService(ownValue(input, "service")),
1135
+ service_version: projectServiceVersion(
1136
+ ownValue(input, "service_version")
1137
+ ),
1138
+ host: projectHost(ownValue(input, "host")),
1139
+ pid: Number.isInteger(pid) && pid >= 1 && pid <= 2147483647 ? pid : null,
1140
+ dimensions: projectFields(
1141
+ ownValue(input, "dimensions"),
1142
+ dataset,
1143
+ authority,
1144
+ identityAuthority
1145
+ ),
1146
+ attributes: projectFields(
1147
+ ownValue(input, "attributes"),
1148
+ dataset,
1149
+ authority,
1150
+ identityAuthority
1151
+ ),
1152
+ error_message: null,
1153
+ error_stack: null,
1154
+ sample_rate: typeof sampleRate === "number" && Number.isFinite(sampleRate) && sampleRate > 0 && sampleRate <= 1 ? sampleRate : 1
1155
+ };
1156
+ bindDiagnosticCapabilityAuthority(row, authority);
1157
+ bindDiagnosticIdentityAuthority(row, identityAuthority);
1158
+ return {
1159
+ ok: true,
1160
+ row
1161
+ };
1162
+ } catch {
1163
+ return { ok: false, code: "invalid_span" };
1164
+ }
1165
+ }
1166
+ function projectDiagnosticFields(input, dataset, authority, identityAuthority) {
1167
+ try {
1168
+ const inheritedAuthority = isObject(input) ? VALUE_AUTHORITIES.get(input) : void 0;
1169
+ const effectiveAuthority = validAuthority(authority) ?? inheritedAuthority;
1170
+ const inheritedIdentityAuthority = isObject(input) ? VALUE_IDENTITY_AUTHORITIES.get(input) : void 0;
1171
+ const effectiveIdentityAuthority = validIdentityAuthority(identityAuthority) ?? inheritedIdentityAuthority;
1172
+ const output = projectFields(
1173
+ input,
1174
+ dataset,
1175
+ effectiveAuthority,
1176
+ effectiveIdentityAuthority
1177
+ );
1178
+ bindDiagnosticCapabilityAuthority(output, effectiveAuthority);
1179
+ bindDiagnosticIdentityAuthority(output, effectiveIdentityAuthority);
1180
+ return output;
1181
+ } catch {
1182
+ return {};
1183
+ }
1184
+ }
1185
+ function projectEventName(input, fallback = "diagnostic.unknown") {
1186
+ return typeof input === "string" && EVENTS.has(input) ? input : fallback;
1187
+ }
1188
+ function projectFields(input, dataset, authority, identityAuthority) {
1189
+ if (!isObject(input)) return {};
1190
+ const output = {};
1191
+ for (const [key, value] of ownDataEntries(input, 64)) {
1192
+ if (key.length > 64) continue;
1193
+ const projected = projectField(
1194
+ key,
1195
+ value,
1196
+ dataset,
1197
+ authority,
1198
+ identityAuthority
1199
+ );
1200
+ if (projected !== void 0) output[key] = projected;
1201
+ }
1202
+ return output;
1203
+ }
1204
+ function projectField(key, value, dataset, authority, identityAuthority) {
1205
+ if (BOOLEAN_FIELDS.has(key))
1206
+ return typeof value === "boolean" ? value : void 0;
1207
+ if (INTEGER_FIELDS.has(key))
1208
+ return isNonnegativeSafeInteger(value) ? value : void 0;
1209
+ if (HASH_FIELDS.has(key))
1210
+ return typeof value === "string" && HASH_RE.test(value) ? value : void 0;
1211
+ if (URL_FIELDS.has(key)) return projectOrigin(value);
1212
+ if (IDENTITY_FIELDS.has(key)) return projectIdentity(key, identityAuthority);
1213
+ if (TOKEN_FIELDS.has(key)) return void 0;
1214
+ if (CAPABILITY_FIELDS.has(key)) return projectCapability(value, authority);
1215
+ if (CLIENT_VERSION_FIELDS.has(key)) return projectClientVersion(value);
1216
+ if (key === "client.protocol_version")
1217
+ return typeof value === "number" && CLIENT_PROTOCOL_VERSIONS.has(value) ? value : void 0;
1218
+ if (key === "route") return projectQualifiedRoute(value);
1219
+ if (key === "http.route" || key === "resource_path")
1220
+ return projectRouteTemplate(value);
1221
+ if (key === "status_code" || key === "http.status_code") {
1222
+ return Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
1223
+ }
1224
+ if (key === "method" || key === "http.method") {
1225
+ if (typeof value !== "string") return void 0;
1226
+ if (METHODS.has(value)) return value;
1227
+ return key === "method" && dataset === "tempo" && (value === "charge" || value === "session") ? value : void 0;
1228
+ }
1229
+ if (key === "rail")
1230
+ return typeof value === "string" && RAILS.has(value) ? value : void 0;
1231
+ if (key === "stage")
1232
+ return typeof value === "string" && STAGES.has(value) ? value : void 0;
1233
+ if (key === "handler")
1234
+ return typeof value === "string" && HANDLERS.has(value) ? value : void 0;
1235
+ if (key === "dataset")
1236
+ return typeof value === "string" && DATASETS.has(value) ? value : void 0;
1237
+ if (key === "error.code" || key === "error_code" || key === "code") {
1238
+ if (typeof value !== "string") return void 0;
1239
+ return ERROR_CODES.has(value) ? value : key === "error.code" || key === "error_code" ? "unknown_error" : void 0;
1240
+ }
1241
+ if (key === "currency" || key === "ask_currency" || key === "asked_topup_currency") {
1242
+ return typeof value === "string" && CURRENCIES.has(value) ? value : void 0;
1243
+ }
1244
+ if (key === "amount") {
1245
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= Number.MAX_SAFE_INTEGER ? value : void 0;
1246
+ }
1247
+ if (key === "forecast.refund_native" || key === "drain.native") {
1248
+ if (isNonnegativeSafeInteger(value)) return value;
1249
+ return typeof value === "string" && DECIMAL_RE.test(value) ? value : void 0;
1250
+ }
1251
+ if (key === "event_id")
1252
+ return typeof value === "string" && STRIPE_EVENT_RE.test(value) ? value : void 0;
1253
+ if (key === "reject_reason")
1254
+ return value === "scanner_probe" ? value : void 0;
1255
+ return void 0;
1256
+ }
1257
+ function projectService(value) {
1258
+ if (typeof value !== "string") return "unknown";
1259
+ if (SERVICE_NAMES.has(value)) return value;
1260
+ if (value.startsWith("isolate-") && SLUG_RE.test(value.slice(8)))
1261
+ return value;
1262
+ return "unknown";
1263
+ }
1264
+ function projectServiceVersion(value) {
1265
+ return typeof value === "string" && value.length <= 64 && RELEASE_RE.test(value) ? value : "unknown";
1266
+ }
1267
+ function projectHost(value) {
1268
+ if (value === "localhost") return value;
1269
+ return typeof value === "string" && MACHINE_ID_RE.test(value) ? value : null;
1270
+ }
1271
+ function validateIdentity(key, value) {
1272
+ if (typeof value !== "string") return void 0;
1273
+ if (key === "dvm_slug") return SLUG_RE.test(value) ? value : void 0;
1274
+ return value.length <= 36 && UUID_RE.test(value) ? value : void 0;
1275
+ }
1276
+ function projectIdentity(key, authority) {
1277
+ return authority && AUTHORITY_IDENTITIES.get(authority)?.[key];
1278
+ }
1279
+ function projectCapability(value, authority) {
1280
+ if (typeof value !== "string" || !CAPABILITY_RE.test(value)) return void 0;
1281
+ const allowed = authority && AUTHORITY_CAPABILITIES.get(authority);
1282
+ return allowed?.has(value) ? value : void 0;
1283
+ }
1284
+ function projectClientVersion(value) {
1285
+ return typeof value === "string" && value.length <= 64 && CLIENT_VERSION_RE.test(value) ? value : void 0;
1286
+ }
1287
+ function validAuthority(authority) {
1288
+ return authority && AUTHORITY_CAPABILITIES.has(authority) ? authority : void 0;
1289
+ }
1290
+ function validIdentityAuthority(authority) {
1291
+ return authority && AUTHORITY_IDENTITIES.has(authority) ? authority : void 0;
1292
+ }
1293
+ function projectOrigin(value) {
1294
+ if (typeof value !== "string" || value.length > 2048) return void 0;
1295
+ try {
1296
+ const parsed = new URL(value);
1297
+ const hostname = parsed.hostname.toLowerCase();
1298
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || hostname === "localhost" || isIP(hostname) !== 0 || !isDnsName(hostname)) {
1299
+ return void 0;
1300
+ }
1301
+ return `${parsed.protocol}//${hostname}`;
1302
+ } catch {
1303
+ return void 0;
1304
+ }
1305
+ }
1306
+ function projectQualifiedRoute(value) {
1307
+ if (typeof value !== "string" || value.length > 320) return void 0;
1308
+ const separator = value.indexOf(" ");
1309
+ if (separator <= 0) return void 0;
1310
+ const method = value.slice(0, separator);
1311
+ const template = projectRouteTemplate(value.slice(separator + 1));
1312
+ return METHODS.has(method) && template ? `${method} ${template}` : void 0;
1313
+ }
1314
+ function projectRouteTemplate(value) {
1315
+ if (typeof value !== "string" || value.length > 263 || !value.startsWith("/") || value.includes("?") || value.includes("#") || value.includes("@")) {
1316
+ return void 0;
1317
+ }
1318
+ return ROUTE_TEMPLATES.find((template) => routeMatches(template, value));
1319
+ }
1320
+ function routeMatches(template, value) {
1321
+ if (template === value) return true;
1322
+ const expected = template.split("/");
1323
+ const actual = value.split("/");
1324
+ if (expected.length !== actual.length) return false;
1325
+ return expected.every((segment, index) => {
1326
+ if (segment.startsWith(":")) {
1327
+ return actual[index].length > 0 && (REDACTED_SEGMENT_RE.test(actual[index]) || !actual[index].startsWith(":"));
1328
+ }
1329
+ return segment === actual[index];
1330
+ });
1331
+ }
1332
+ function compareRouteTemplates(left, right) {
1333
+ const leftParams = left.split("/").filter((segment) => segment.startsWith(":")).length;
1334
+ const rightParams = right.split("/").filter((segment) => segment.startsWith(":")).length;
1335
+ return leftParams - rightParams || right.length - left.length || left.localeCompare(right);
1336
+ }
1337
+ function isDnsName(value) {
1338
+ return value.length <= 253 && value.split(".").every((label) => SLUG_RE.test(label));
1339
+ }
1340
+ function isEpochMs(value) {
1341
+ return isNonnegativeSafeInteger(value);
1342
+ }
1343
+ function isNonnegativeSafeInteger(value) {
1344
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
1345
+ }
1346
+ function isObject(value) {
1347
+ return typeof value === "object" && value !== null || typeof value === "function";
1348
+ }
1349
+ function ownValue(input, key) {
1350
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1351
+ return descriptor && "value" in descriptor ? descriptor.value : void 0;
1352
+ }
1353
+ function ownDataEntries(input, limit) {
1354
+ const entries = [];
1355
+ for (const key of Reflect.ownKeys(input)) {
1356
+ if (typeof key !== "string") continue;
1357
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1358
+ if (!descriptor || !("value" in descriptor)) continue;
1359
+ entries.push([key, descriptor.value]);
1360
+ if (entries.length >= limit) break;
1361
+ }
1362
+ return entries;
1363
+ }
1364
+ var diagnosticConsole = {
1365
+ debug: (...values) => emit("debug", values),
1366
+ info: (...values) => emit("info", values),
1367
+ warn: (...values) => emit("warn", values),
1368
+ error: (...values) => emit("error", values),
1369
+ log: (...values) => emit("log", values)
1370
+ };
1371
+ function emitDiagnostic(level, event, fields, dataset) {
1372
+ writeDiagnostic(level, event, fields, dataset);
1373
+ }
1374
+ function writeDiagnostic(sinkLevel, event, fields, dataset, severityOverride) {
1375
+ try {
1376
+ const defaultSeverity = sinkLevel === "debug" || sinkLevel === "log" ? "info" : sinkLevel;
1377
+ const severity = severityOverride === "info" || severityOverride === "warn" || severityOverride === "error" ? severityOverride : defaultSeverity;
1378
+ const record = {
1379
+ event: projectEventName(event),
1380
+ level: severity,
1381
+ ...projectDiagnosticFields(fields, dataset)
1382
+ };
1383
+ const sink = sinkLevel === "log" ? console.log : console[sinkLevel];
1384
+ sink(JSON.stringify(record));
1385
+ } catch {
1386
+ }
1387
+ }
1388
+ function emit(level, values) {
1389
+ const parsed = values.length === 1 ? parseStructuredValue(values[0]) : void 0;
1390
+ if (parsed) {
1391
+ const event = ownValue2(parsed, "event");
1392
+ const legacyEvent = ownValue2(parsed, "level");
1393
+ const dataset = ownValue2(parsed, "dataset");
1394
+ writeDiagnostic(
1395
+ level,
1396
+ event ?? legacyEvent,
1397
+ parsed,
1398
+ typeof dataset === "string" ? dataset : void 0,
1399
+ legacyEvent
1400
+ );
1401
+ return;
1402
+ }
1403
+ emitDiagnostic(level, "diagnostic.message");
1404
+ }
1405
+ function parseStructuredValue(value) {
1406
+ if (typeof value === "object" && value !== null) return value;
1407
+ if (typeof value !== "string" || value.length > 64 * 1024 || !value.startsWith("{"))
1408
+ return void 0;
1409
+ try {
1410
+ const parsed = JSON.parse(value);
1411
+ return typeof parsed === "object" && parsed !== null ? parsed : void 0;
1412
+ } catch {
1413
+ return void 0;
1414
+ }
1415
+ }
1416
+ function ownValue2(input, key) {
1417
+ try {
1418
+ const descriptor = Object.getOwnPropertyDescriptor(input, key);
1419
+ return descriptor && "value" in descriptor ? descriptor.value : void 0;
1420
+ } catch {
1421
+ return void 0;
1422
+ }
1423
+ }
1424
+
1425
+ // node_modules/@dvmkit/sdk/dist/chunk-COYKJRMM.js
1426
+ import { AsyncLocalStorage } from "async_hooks";
1427
+ var SDK_INIT_ADVISORY_LOCK = 17320927;
1428
+ async function withSdkInitLock(db, fn) {
1429
+ const context = activeInits.getStore();
1430
+ if (context?.get(db)?.active) return fn();
1431
+ assertPoolFitsLock(db);
1432
+ let holder = holders.get(db);
1433
+ if (holder) {
1434
+ holder.refs += 1;
1435
+ } else {
1436
+ holder = { refs: 1, acquired: acquire(db), tail: Promise.resolve() };
1437
+ holders.set(db, holder);
1438
+ }
1439
+ const predecessor = holder.tail;
1440
+ let finishTurn;
1441
+ holder.tail = new Promise((resolve) => {
1442
+ finishTurn = resolve;
1443
+ });
1444
+ let guardedFailed = false;
1445
+ try {
1446
+ await holder.acquired;
1447
+ await predecessor;
1448
+ const token = { active: true };
1449
+ const nextContext = new Map(context);
1450
+ nextContext.set(db, token);
1451
+ try {
1452
+ return await activeInits.run(nextContext, fn);
1453
+ } finally {
1454
+ token.active = false;
1455
+ }
1456
+ } catch (err) {
1457
+ guardedFailed = true;
1458
+ throw err;
1459
+ } finally {
1460
+ try {
1461
+ await releaseHolder(db, holder, guardedFailed);
1462
+ } finally {
1463
+ finishTurn();
1464
+ }
1465
+ }
1466
+ }
1467
+ var holders = /* @__PURE__ */ new WeakMap();
1468
+ var activeInits = new AsyncLocalStorage();
1469
+ function assertPoolFitsLock(db) {
1470
+ const max = db.options?.max;
1471
+ if (max === void 0 || max >= 2) return;
1472
+ throw new Error(
1473
+ `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.`
1474
+ );
1475
+ }
1476
+ async function acquire(db) {
1477
+ const client = await db.connect();
1478
+ try {
1479
+ await client.query(`SELECT pg_advisory_lock(${SDK_INIT_ADVISORY_LOCK})`);
1480
+ } catch (err) {
1481
+ client.release();
1482
+ throw err;
1483
+ }
1484
+ return client;
1485
+ }
1486
+ async function releaseHolder(db, holder, guardedFailed) {
1487
+ holder.refs -= 1;
1488
+ if (holder.refs > 0) return;
1489
+ holders.delete(db);
1490
+ let client;
1491
+ try {
1492
+ client = await holder.acquired;
1493
+ } catch {
1494
+ return;
1495
+ }
1496
+ try {
1497
+ await client.query(`SELECT pg_advisory_unlock(${SDK_INIT_ADVISORY_LOCK})`);
1498
+ client.release();
1499
+ } catch (err) {
1500
+ client.release(err instanceof Error ? err : new Error(String(err)));
1501
+ if (!guardedFailed) throw err;
1502
+ }
1503
+ }
1504
+
1505
+ export {
1506
+ DIAGNOSTIC_CATALOGUE_VERSION,
1507
+ createDiagnosticCapabilityAuthority,
1508
+ bindDiagnosticCapabilityAuthority,
1509
+ extendDiagnosticIdentityAuthority,
1510
+ bindDiagnosticIdentityAuthority,
1511
+ projectSpanRow,
1512
+ projectDiagnosticFields,
1513
+ projectEventName,
1514
+ diagnosticConsole,
1515
+ emitDiagnostic,
1516
+ withSdkInitLock
1517
+ };