@redcenterstudio/agent-tollbooth-edge 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +372 -372
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2005 -2005
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Zero-dependency dual-rail HTTP 402 middleware for Cloudflare Workers, Fetch APIs, Next.js, and Hono.
|
|
4
4
|
*
|
|
5
5
|
* Rail A: Open x402 V2 standard (`PAYMENT-REQUIRED`, `PAYMENT-SIGNATURE`, `PAYMENT-RESPONSE`)
|
|
6
|
-
* Rail B: Red Center
|
|
6
|
+
* Rail B: prepaid Red Center agent wallet receipts (`rcs_receipt_...`, Web Crypto + NonceStore), Red Center Studio routes only
|
|
7
7
|
*/
|
|
8
8
|
export const DEFAULT_FACILITATOR_URL = 'https://tollbooth.redcenterstudio.com';
|
|
9
9
|
export const DEFAULT_PAYMENT_URL = 'https://tollbooth.redcenterstudio.com';
|
|
@@ -441,7 +441,7 @@ function resolveErrorGuidance(errorReason, requiredMicros, expectedAudience) {
|
|
|
441
441
|
case 'insufficient_payment_amount':
|
|
442
442
|
return {
|
|
443
443
|
code: 'INSUFFICIENT_FUNDS',
|
|
444
|
-
fix_hint: `Payment amount is below the required ${priceStr}.
|
|
444
|
+
fix_hint: `Payment amount is below the required ${priceStr}. Authorize at least ${requiredMicros} atomic units.`,
|
|
445
445
|
};
|
|
446
446
|
case 'RECEIPT_EXPIRED':
|
|
447
447
|
case 'receipt_expired':
|
|
@@ -507,376 +507,376 @@ export function renderDefault402HtmlPage(challenge, request) {
|
|
|
507
507
|
const payTo = accept?.payTo ?? DEFAULT_PAY_TO;
|
|
508
508
|
const network = accept?.network ?? DEFAULT_NETWORK;
|
|
509
509
|
const scheme = accept?.scheme ?? 'exact';
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
<
|
|
517
|
-
|
|
518
|
-
<meta
|
|
519
|
-
<meta name="
|
|
520
|
-
<
|
|
521
|
-
<
|
|
522
|
-
<link rel="preconnect" href="https://fonts.
|
|
523
|
-
<link rel="
|
|
524
|
-
<
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
--ironstone
|
|
528
|
-
--
|
|
529
|
-
--ochre
|
|
530
|
-
--
|
|
531
|
-
--
|
|
532
|
-
--
|
|
533
|
-
--
|
|
534
|
-
--
|
|
535
|
-
--
|
|
536
|
-
--
|
|
537
|
-
--
|
|
538
|
-
--
|
|
539
|
-
--on-dark
|
|
540
|
-
--
|
|
541
|
-
--
|
|
542
|
-
--
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
.head-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
border
|
|
616
|
-
border-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
.
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
border
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
.badge-
|
|
635
|
-
.
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
.
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
border
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
font-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
border
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
.term-dots
|
|
751
|
-
.term-dots i:
|
|
752
|
-
.
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
border
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
.
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
.btn-
|
|
804
|
-
.btn-
|
|
805
|
-
.btn-
|
|
806
|
-
.btn-
|
|
807
|
-
.
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
.
|
|
817
|
-
.
|
|
818
|
-
.
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
<
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
<
|
|
874
|
-
<a class="btn btn-ghost" href="https://redcenterstudio.com/services/ai-tollbooth-setup/" rel="noopener noreferrer">See AI Tollbooth Setup</a>
|
|
875
|
-
</div>
|
|
876
|
-
<p class="meta-foot">Powered by Agent Tollbooth 402 · <a href="https://redcenterstudio.com/" rel="noopener noreferrer">Red Center Studio</a></p>
|
|
877
|
-
</article>
|
|
878
|
-
</main>
|
|
879
|
-
</body>
|
|
510
|
+
const hasFiat = challenge.acceptedRails.includes('rcs-fiat-wallet');
|
|
511
|
+
const railsText = hasFiat ? 'x402 V2 (USDC) + prepaid agent wallet' : 'x402 V2 (USDC)';
|
|
512
|
+
const fiatCurl = `curl -H "PAYMENT-SIGNATURE: <base64_x402_v2>" "${request.url}"\ncurl -H "Authorization: Bearer rcs_receipt_..." "${request.url}"\n# payTo: ${payTo}`;
|
|
513
|
+
const x402Curl = `curl -H "PAYMENT-SIGNATURE: <base64_x402_v2>" "${request.url}"\n# payTo: ${payTo}`;
|
|
514
|
+
const safeCurl = hasFiat ? fiatCurl : x402Curl;
|
|
515
|
+
return `<!DOCTYPE html>
|
|
516
|
+
<html lang="en">
|
|
517
|
+
<head>
|
|
518
|
+
<meta charset="utf-8" />
|
|
519
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
520
|
+
<meta name="theme-color" content="#24181a" />
|
|
521
|
+
<title>402 Payment Required: Agent Tollbooth 402 | Red Center Studio</title>
|
|
522
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
523
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
524
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Archivo:wght@700;800&family=IBM+Plex+Mono:wght@500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap" />
|
|
525
|
+
<style>
|
|
526
|
+
:root {
|
|
527
|
+
--ironstone: #24181a;
|
|
528
|
+
--ironstone-2: #32211f;
|
|
529
|
+
--ochre: #d9622b;
|
|
530
|
+
--ochre-deep: #a63d14;
|
|
531
|
+
--oxide: #7a2e1d;
|
|
532
|
+
--spinifex: #e3a23c;
|
|
533
|
+
--gum: #4f7f63;
|
|
534
|
+
--sand: #f5efe6;
|
|
535
|
+
--card: #fffcf8;
|
|
536
|
+
--line: #e3d7c8;
|
|
537
|
+
--ink: #2a1a16;
|
|
538
|
+
--muted: #6b5a52;
|
|
539
|
+
--on-dark: #f3e9de;
|
|
540
|
+
--on-dark-muted: #cbb9ab;
|
|
541
|
+
--display: "Archivo", "Helvetica Neue", Arial, sans-serif;
|
|
542
|
+
--body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
|
|
543
|
+
--mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
|
|
544
|
+
}
|
|
545
|
+
* { box-sizing: border-box; }
|
|
546
|
+
html { -webkit-text-size-adjust: 100%; }
|
|
547
|
+
body {
|
|
548
|
+
margin: 0;
|
|
549
|
+
min-height: 100vh;
|
|
550
|
+
display: flex;
|
|
551
|
+
flex-direction: column;
|
|
552
|
+
background: var(--sand);
|
|
553
|
+
color: var(--ink);
|
|
554
|
+
font: 400 16px/1.6 var(--body);
|
|
555
|
+
}
|
|
556
|
+
a { color: var(--ochre-deep); }
|
|
557
|
+
.site-head { background: var(--ironstone); color: var(--on-dark); }
|
|
558
|
+
.head-wrap {
|
|
559
|
+
max-width: 760px;
|
|
560
|
+
margin: 0 auto;
|
|
561
|
+
padding: 14px 20px;
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
justify-content: space-between;
|
|
565
|
+
gap: 14px;
|
|
566
|
+
flex-wrap: wrap;
|
|
567
|
+
}
|
|
568
|
+
.brand {
|
|
569
|
+
display: inline-flex;
|
|
570
|
+
align-items: center;
|
|
571
|
+
gap: 10px;
|
|
572
|
+
font: 500 12px/1 var(--mono);
|
|
573
|
+
letter-spacing: 0.16em;
|
|
574
|
+
text-transform: uppercase;
|
|
575
|
+
color: var(--on-dark);
|
|
576
|
+
text-decoration: none;
|
|
577
|
+
}
|
|
578
|
+
.brand::before {
|
|
579
|
+
content: "";
|
|
580
|
+
width: 22px;
|
|
581
|
+
height: 22px;
|
|
582
|
+
flex: none;
|
|
583
|
+
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3CclipPath id='s'%3E%3Ccircle cx='11' cy='11' r='11'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23s)'%3E%3Crect width='22' height='12.5' fill='%23d9622b'/%3E%3Crect y='14.5' width='22' height='2.5' fill='%23d9622b'/%3E%3Crect y='19' width='22' height='2.5' fill='%23a63d14'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
|
|
584
|
+
}
|
|
585
|
+
.head-link {
|
|
586
|
+
font: 600 14px/1 var(--body);
|
|
587
|
+
color: var(--spinifex);
|
|
588
|
+
text-decoration: none;
|
|
589
|
+
}
|
|
590
|
+
.head-link:hover { text-decoration: underline; }
|
|
591
|
+
.strata {
|
|
592
|
+
display: block;
|
|
593
|
+
height: 8px;
|
|
594
|
+
background: linear-gradient(to bottom, var(--oxide) 0 25%, var(--ochre-deep) 25% 50%, var(--ochre) 50% 75%, var(--spinifex) 75% 100%);
|
|
595
|
+
}
|
|
596
|
+
.stage {
|
|
597
|
+
flex: 1;
|
|
598
|
+
display: flex;
|
|
599
|
+
align-items: center;
|
|
600
|
+
justify-content: center;
|
|
601
|
+
padding: 18px 20px 24px;
|
|
602
|
+
}
|
|
603
|
+
@keyframes cardRise {
|
|
604
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
605
|
+
to { opacity: 1; transform: translateY(0); }
|
|
606
|
+
}
|
|
607
|
+
@keyframes softPulse {
|
|
608
|
+
0%, 100% { box-shadow: 0 0 0 0 rgba(79, 127, 99, 0.35); }
|
|
609
|
+
50% { box-shadow: 0 0 0 5px rgba(79, 127, 99, 0); }
|
|
610
|
+
}
|
|
611
|
+
.card {
|
|
612
|
+
width: 100%;
|
|
613
|
+
max-width: 650px;
|
|
614
|
+
background: var(--card);
|
|
615
|
+
border: 1px solid var(--line);
|
|
616
|
+
border-top: 3px solid var(--ochre);
|
|
617
|
+
border-radius: 2px;
|
|
618
|
+
padding: 20px 24px;
|
|
619
|
+
box-shadow: 0 14px 36px rgba(36, 24, 26, 0.11);
|
|
620
|
+
animation: cardRise 0.35s ease-out both;
|
|
621
|
+
}
|
|
622
|
+
.badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
|
|
623
|
+
.badge {
|
|
624
|
+
display: inline-flex;
|
|
625
|
+
align-items: center;
|
|
626
|
+
gap: 6px;
|
|
627
|
+
padding: 4px 9px;
|
|
628
|
+
border: 1px solid;
|
|
629
|
+
border-radius: 2px;
|
|
630
|
+
font: 500 11.5px/1.2 var(--mono);
|
|
631
|
+
letter-spacing: 0.1em;
|
|
632
|
+
text-transform: uppercase;
|
|
633
|
+
}
|
|
634
|
+
.badge-ochre { background: #fbeee4; color: var(--ochre-deep); border-color: var(--ochre-deep); }
|
|
635
|
+
.badge-gum { background: #eaf2ec; color: #2f5a41; border-color: var(--gum); }
|
|
636
|
+
.dot {
|
|
637
|
+
width: 6px;
|
|
638
|
+
height: 6px;
|
|
639
|
+
border-radius: 50%;
|
|
640
|
+
background: var(--gum);
|
|
641
|
+
display: inline-block;
|
|
642
|
+
animation: softPulse 2.2s ease-in-out infinite;
|
|
643
|
+
}
|
|
644
|
+
h1 {
|
|
645
|
+
margin: 0 0 4px;
|
|
646
|
+
font: 800 clamp(24px, 3.8vw, 31px)/1.08 var(--display);
|
|
647
|
+
letter-spacing: -0.02em;
|
|
648
|
+
color: var(--ink);
|
|
649
|
+
}
|
|
650
|
+
.desc { margin: 0 0 12px; color: var(--muted); font-size: 15px; line-height: 1.45; }
|
|
651
|
+
.facts {
|
|
652
|
+
display: grid;
|
|
653
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
654
|
+
gap: 8px 18px;
|
|
655
|
+
margin-bottom: 11px;
|
|
656
|
+
padding: 11px 14px;
|
|
657
|
+
background: var(--sand);
|
|
658
|
+
border: 1px solid var(--line);
|
|
659
|
+
border-radius: 2px;
|
|
660
|
+
}
|
|
661
|
+
.fact-wide { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
|
|
662
|
+
.label {
|
|
663
|
+
font: 500 11.5px/1.4 var(--mono);
|
|
664
|
+
letter-spacing: 0.14em;
|
|
665
|
+
text-transform: uppercase;
|
|
666
|
+
color: var(--ochre-deep);
|
|
667
|
+
}
|
|
668
|
+
.val {
|
|
669
|
+
font-size: 14.5px;
|
|
670
|
+
font-weight: 600;
|
|
671
|
+
color: var(--ink);
|
|
672
|
+
overflow-wrap: anywhere;
|
|
673
|
+
margin-top: 2px;
|
|
674
|
+
font-variant-numeric: tabular-nums;
|
|
675
|
+
}
|
|
676
|
+
.price {
|
|
677
|
+
font: 800 24px/1.1 var(--display);
|
|
678
|
+
letter-spacing: -0.02em;
|
|
679
|
+
color: var(--ink);
|
|
680
|
+
font-variant-numeric: tabular-nums;
|
|
681
|
+
}
|
|
682
|
+
.hint {
|
|
683
|
+
background: #fbeee4;
|
|
684
|
+
border-left: 3px solid var(--ochre);
|
|
685
|
+
padding: 9px 13px;
|
|
686
|
+
border-radius: 2px;
|
|
687
|
+
font-size: 13.5px;
|
|
688
|
+
line-height: 1.45;
|
|
689
|
+
color: var(--ink);
|
|
690
|
+
margin-bottom: 11px;
|
|
691
|
+
overflow-wrap: anywhere;
|
|
692
|
+
}
|
|
693
|
+
.rails {
|
|
694
|
+
display: grid;
|
|
695
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
696
|
+
gap: 10px;
|
|
697
|
+
margin-bottom: 11px;
|
|
698
|
+
}
|
|
699
|
+
.rails.one { grid-template-columns: 1fr; }
|
|
700
|
+
.rail-box {
|
|
701
|
+
padding: 11px 13px;
|
|
702
|
+
background: #fff;
|
|
703
|
+
border: 1px solid var(--line);
|
|
704
|
+
border-left: 3px solid var(--spinifex);
|
|
705
|
+
border-radius: 2px;
|
|
706
|
+
transition: transform 0.15s ease, border-color 0.15s ease;
|
|
707
|
+
}
|
|
708
|
+
.rail-box:hover {
|
|
709
|
+
transform: translateY(-1px);
|
|
710
|
+
border-color: #d6c4b0;
|
|
711
|
+
border-left-color: var(--ochre);
|
|
712
|
+
}
|
|
713
|
+
.rail-box h2 {
|
|
714
|
+
margin: 0 0 3px;
|
|
715
|
+
font: 700 14.5px/1.25 var(--body);
|
|
716
|
+
color: var(--ink);
|
|
717
|
+
}
|
|
718
|
+
.rail-box p {
|
|
719
|
+
margin: 0;
|
|
720
|
+
font-size: 13px;
|
|
721
|
+
line-height: 1.4;
|
|
722
|
+
color: var(--muted);
|
|
723
|
+
overflow-wrap: anywhere;
|
|
724
|
+
}
|
|
725
|
+
.code-shell {
|
|
726
|
+
border: 1px solid #3c2a27;
|
|
727
|
+
border-radius: 2px;
|
|
728
|
+
overflow: hidden;
|
|
729
|
+
margin-bottom: 13px;
|
|
730
|
+
background: var(--ironstone);
|
|
731
|
+
}
|
|
732
|
+
.code-bar {
|
|
733
|
+
display: flex;
|
|
734
|
+
align-items: center;
|
|
735
|
+
justify-content: space-between;
|
|
736
|
+
gap: 10px;
|
|
737
|
+
padding: 7px 12px;
|
|
738
|
+
background: #1a1112;
|
|
739
|
+
border-bottom: 1px solid rgba(243, 233, 222, 0.12);
|
|
740
|
+
}
|
|
741
|
+
.code-title {
|
|
742
|
+
display: inline-flex;
|
|
743
|
+
align-items: center;
|
|
744
|
+
gap: 8px;
|
|
745
|
+
font: 500 11px/1 var(--mono);
|
|
746
|
+
letter-spacing: 0.12em;
|
|
747
|
+
text-transform: uppercase;
|
|
748
|
+
color: var(--on-dark-muted);
|
|
749
|
+
}
|
|
750
|
+
.term-dots { display: inline-flex; gap: 5px; }
|
|
751
|
+
.term-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(243, 233, 222, 0.3); display: inline-block; }
|
|
752
|
+
.term-dots i:first-child { background: var(--ochre); }
|
|
753
|
+
.term-dots i:nth-child(2) { background: var(--spinifex); }
|
|
754
|
+
.code {
|
|
755
|
+
background: var(--ironstone);
|
|
756
|
+
color: var(--on-dark);
|
|
757
|
+
padding: 11px 13px;
|
|
758
|
+
font: 500 12px/1.45 var(--mono);
|
|
759
|
+
white-space: pre-wrap;
|
|
760
|
+
overflow-wrap: anywhere;
|
|
761
|
+
margin: 0;
|
|
762
|
+
}
|
|
763
|
+
.copy-btn {
|
|
764
|
+
min-height: 26px;
|
|
765
|
+
padding: 3px 11px;
|
|
766
|
+
background: var(--card);
|
|
767
|
+
color: var(--ink);
|
|
768
|
+
border: 1px solid var(--line);
|
|
769
|
+
border-radius: 2px;
|
|
770
|
+
font: 600 12px/1 var(--body);
|
|
771
|
+
cursor: pointer;
|
|
772
|
+
}
|
|
773
|
+
.copy-btn:hover { background: var(--spinifex); border-color: var(--spinifex); }
|
|
774
|
+
.sim-banner {
|
|
775
|
+
display: none;
|
|
776
|
+
margin-bottom: 12px;
|
|
777
|
+
padding: 10px 13px;
|
|
778
|
+
background: #eaf2ec;
|
|
779
|
+
border: 1px solid #b8d3c1;
|
|
780
|
+
border-left: 3px solid var(--gum);
|
|
781
|
+
border-radius: 2px;
|
|
782
|
+
font: 500 12.5px/1.45 var(--mono);
|
|
783
|
+
color: #214530;
|
|
784
|
+
overflow-wrap: anywhere;
|
|
785
|
+
animation: cardRise 0.25s ease-out both;
|
|
786
|
+
}
|
|
787
|
+
.sim-banner.show { display: block; }
|
|
788
|
+
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
|
|
789
|
+
.btn {
|
|
790
|
+
display: inline-flex;
|
|
791
|
+
align-items: center;
|
|
792
|
+
justify-content: center;
|
|
793
|
+
text-align: center;
|
|
794
|
+
min-height: 44px;
|
|
795
|
+
padding: 9px 18px;
|
|
796
|
+
border: 1px solid transparent;
|
|
797
|
+
border-radius: 2px;
|
|
798
|
+
font: 600 14.5px/1.2 var(--body);
|
|
799
|
+
text-decoration: none;
|
|
800
|
+
cursor: pointer;
|
|
801
|
+
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
|
802
|
+
}
|
|
803
|
+
.btn-primary { background: var(--ochre); color: #1e1412; }
|
|
804
|
+
.btn-primary:hover { background: var(--spinifex); }
|
|
805
|
+
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
|
|
806
|
+
.btn-ghost:hover { background: var(--ink); color: var(--sand); }
|
|
807
|
+
.btn-sand { background: var(--sand); color: var(--ink); border-color: #b9a898; }
|
|
808
|
+
.btn-sand:hover { border-color: var(--ochre-deep); background: #fbeee4; }
|
|
809
|
+
.meta-foot {
|
|
810
|
+
margin-top: 11px;
|
|
811
|
+
font: 400 12.5px/1.4 var(--body);
|
|
812
|
+
color: var(--muted);
|
|
813
|
+
}
|
|
814
|
+
@media (prefers-reduced-motion: reduce) { .card, .dot, .sim-banner { animation: none; } }
|
|
815
|
+
@media (max-width: 640px) {
|
|
816
|
+
.stage { padding: 18px 14px 32px; align-items: flex-start; }
|
|
817
|
+
.card { padding: 18px 16px; }
|
|
818
|
+
.facts, .rails { grid-template-columns: 1fr; gap: 10px; }
|
|
819
|
+
.actions { flex-direction: column; align-items: stretch; }
|
|
820
|
+
.btn { width: 100%; min-height: 48px; }
|
|
821
|
+
}
|
|
822
|
+
</style>
|
|
823
|
+
</head>
|
|
824
|
+
<body>
|
|
825
|
+
<header class="site-head">
|
|
826
|
+
<div class="head-wrap">
|
|
827
|
+
<a class="brand" href="https://redcenterstudio.com/" rel="noopener noreferrer">Red Center Studio</a>
|
|
828
|
+
<a class="head-link" href="${escapeHtml(challenge.paymentUrl)}" rel="noopener noreferrer">Agent Tollbooth 402</a>
|
|
829
|
+
</div>
|
|
830
|
+
<span class="strata" aria-hidden="true"></span>
|
|
831
|
+
</header>
|
|
832
|
+
<main class="stage">
|
|
833
|
+
<article class="card">
|
|
834
|
+
<div class="badges">
|
|
835
|
+
<span class="badge badge-ochre">HTTP 402 · ${escapeHtml(challenge.code)}</span>
|
|
836
|
+
<span class="badge badge-gum"><span class="dot"></span>${escapeHtml(railsText)}</span>
|
|
837
|
+
</div>
|
|
838
|
+
<h1>402 Payment Required</h1>
|
|
839
|
+
<p class="desc">${escapeHtml(challenge.resource.description)}</p>
|
|
840
|
+
<div class="facts">
|
|
841
|
+
<div>
|
|
842
|
+
<div class="label">Endpoint</div>
|
|
843
|
+
<div class="val">${escapeHtml(request.method.toUpperCase())} ${escapeHtml(url.pathname)}</div>
|
|
844
|
+
</div>
|
|
845
|
+
<div>
|
|
846
|
+
<div class="label">Price (${escapeHtml(scheme)})</div>
|
|
847
|
+
<div class="val price">$${escapeHtml(challenge.priceUsd)} USD</div>
|
|
848
|
+
</div>
|
|
849
|
+
<div class="fact-wide">
|
|
850
|
+
<div class="label">x402 Settlement Destination</div>
|
|
851
|
+
<div class="val">${escapeHtml(network)} · ${escapeHtml(amountAtomic)} USDC · payTo <code>${escapeHtml(payTo)}</code></div>
|
|
852
|
+
</div>
|
|
853
|
+
</div>
|
|
854
|
+
<div class="rails${hasFiat ? '' : ' one'}">${hasFiat ? `
|
|
855
|
+
<div class="rail-box">
|
|
856
|
+
<h2>Pay with a prepaid agent wallet</h2>
|
|
857
|
+
<p>Pass a prepaid <code>rcs_receipt_...</code> bearer token issued by Red Center Studio for this route.</p>
|
|
858
|
+
</div>` : ''}
|
|
859
|
+
<div class="rail-box">
|
|
860
|
+
<h2>Pay with Crypto (x402 V2)</h2>
|
|
861
|
+
<p>Sign a Base USDC payment payload on <code>${escapeHtml(network)}</code> to <code>${escapeHtml(payTo)}</code> and retry with <code>PAYMENT-SIGNATURE</code>.</p>
|
|
862
|
+
</div>
|
|
863
|
+
</div>
|
|
864
|
+
<div class="hint"><strong>Next step:</strong> ${escapeHtml(challenge.fix_hint)}</div>
|
|
865
|
+
<div class="code-shell">
|
|
866
|
+
<div class="code-bar">
|
|
867
|
+
<span class="code-title"><span class="term-dots"><i></i><i></i><i></i></span>HTTP 402 Retry Snippet · x402 V2${hasFiat ? ' & Bearer Receipt' : ''}</span>
|
|
868
|
+
<button class="copy-btn" type="button" onclick="var b=this;navigator.clipboard&&navigator.clipboard.writeText(document.getElementById('curl-cmd').textContent).then(function(){b.textContent='Copied';b.style.borderColor='#4f7f63';b.style.color='#2f5a41';setTimeout(function(){b.textContent='Copy';b.style.borderColor='';b.style.color='';},1500);})">Copy</button>
|
|
869
|
+
</div>
|
|
870
|
+
<pre class="code" id="curl-cmd">${escapeHtml(safeCurl)}</pre>
|
|
871
|
+
</div>
|
|
872
|
+
<div class="actions">
|
|
873
|
+
<a class="btn btn-primary" href="${escapeHtml(challenge.paymentUrl)}" rel="noopener noreferrer">How AI agents pay</a>
|
|
874
|
+
<a class="btn btn-ghost" href="https://redcenterstudio.com/services/ai-tollbooth-setup/" rel="noopener noreferrer">See AI Tollbooth Setup</a>
|
|
875
|
+
</div>
|
|
876
|
+
<p class="meta-foot">Powered by Agent Tollbooth 402 · <a href="https://redcenterstudio.com/" rel="noopener noreferrer">Red Center Studio</a></p>
|
|
877
|
+
</article>
|
|
878
|
+
</main>
|
|
879
|
+
</body>
|
|
880
880
|
</html>`;
|
|
881
881
|
}
|
|
882
882
|
function matchPathPattern(pattern, pathname) {
|