File size: 10,175 Bytes
91772a8
 
 
 
 
 
 
 
 
 
 
 
 
7d726a4
91772a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0e5c58
91772a8
 
 
 
 
 
 
d0e5c58
 
91772a8
d0e5c58
91772a8
d0e5c58
91772a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0e5c58
91772a8
d0e5c58
91772a8
d0e5c58
91772a8
d0e5c58
 
91772a8
d0e5c58
 
 
 
 
91772a8
d0e5c58
 
91772a8
d0e5c58
 
91772a8
d0e5c58
 
91772a8
d0e5c58
91772a8
d0e5c58
91772a8
d0e5c58
 
 
 
 
 
 
 
 
 
91772a8
d0e5c58
91772a8
d0e5c58
91772a8
d0e5c58
91772a8
d0e5c58
 
 
 
 
91772a8
d0e5c58
91772a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0e5c58
91772a8
 
ef9981b
91772a8
 
2b84db5
ef9981b
91772a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
"""
ACO Academy Benchmark Tool - HuggingFace Space
Agent Commerce Optimization Demo

No secrets or API keys in this code - all external configuration.
"""

import gradio as gr
import os
from datetime import datetime

# Configuration (set via HF Space secrets/environment)
ACO_API_BASE = os.getenv("ACO_API_BASE", "https://agenticcommerce.academy/api")
STRIPE_CHECKOUT_BASE = os.getenv("STRIPE_CHECKOUT_BASE", "https://agenticcommerce.academy/benchmark")

# Showcase examples (pre-generated reports)
SHOWCASE_EXAMPLES = {
    "amazon.com": {
        "grade": "F",
        "score": "49/100",
        "pdf": "reports/amazon_benchmark.pdf",
        "summary": "Zero ACO implementation. AI agents cannot discover Amazon's APIs."
    },
    "x.com": {
        "grade": "D", 
        "score": "65/100",
        "pdf": "reports/x_benchmark.pdf",
        "summary": "Partial ACO support. Has agent.json and MCP, but missing structured data."
    },
    "shopify.com": {
        "grade": "F",
        "score": "57/100",
        "pdf": "reports/shopify_benchmark.pdf",
        "summary": "Poor overall score despite perfect SEO. Weak ACO (40/100) and security (35/100)."
    },
    "agenticcommerce.academy": {
        "grade": "D",
        "score": "61/100",
        "pdf": "reports/agenticcommerce_benchmark.pdf",
        "summary": "We practice what we preach - and we're still improving. Perfect SEO, moderate ACO."
    }
}

def get_showcase_report(domain):
    """Return pre-generated showcase report"""
    if domain not in SHOWCASE_EXAMPLES:
        return None, "Select a domain to view the report"
    
    example = SHOWCASE_EXAMPLES[domain]
    summary = f"""
# {domain} - Grade {example['grade']} ({example['score']})

**{example['summary']}**

πŸ“₯ **Download the full 4-page PDF report below**

This is a complete ACO benchmark including:
- SEO Analysis
- ACO Implementation Check
- Security Scan
- Consent Audit
- CEH-RI Risk Assessment
- Prioritized Recommendations
"""
    return example['pdf'], summary

def scan_domain_preview(domain):
    """
    Preview scan - basic ACO check only
    
    NOTE: This is a MOCK for demo purposes.
    Real implementation calls ACO_API_BASE + /preview endpoint
    """
    if not domain or len(domain) < 4:
        return "⚠️ Please enter a valid domain (e.g., example.com)"
    
    # Clean domain
    domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0]
    
    # Mock preview result (replace with actual API call)
    # In production: response = requests.post(f"{ACO_API_BASE}/preview", json={"domain": domain})
    
    preview = f"""
## πŸ” ACO Preview Report: {domain}

### Estimated Grade: F (35/100)

**Quick Findings:**

❌ **No agent.json detected** - AI agents cannot discover your capabilities  
❌ **No MCP manifest found** - No Model Context Protocol support  
❌ **No llms.txt present** - AI crawlers have no guidance  
⚠️ **Basic SEO present** but not optimized for agents  
⚠️ **Security headers incomplete** - Missing modern protections  

---

### ⚠️ Your site is invisible to AI agents

As AI-driven commerce becomes mainstream, sites without ACO will be excluded from agent transactions.

---

### πŸ“Š What's in the Full Report?

βœ… **Complete 6-category analysis** (20+ checks across SEO, ACO, Security, Consent, CEH-RI)  
βœ… **Cognitive Event Horizon Risk Index** - Detect manipulation patterns  
βœ… **Detailed security & consent audit** - GDPR, CCPA, ACO compliance  
βœ… **Prioritized action plan** - Step-by-step fixes with impact scores  
βœ… **4-page downloadable PDF** - Professional report for your team  
βœ… **Industry benchmarks** - See how you compare  

---

### πŸ”₯ Ready to see the full picture?

**One-time analysis: $99**  
Complete ACO benchmark delivered instantly.

"""
    return preview

def get_upgrade_link(domain):
    """Generate Stripe checkout link for full report"""
    if not domain or len(domain) < 4:
        return "⚠️ Please enter a domain first"
    
    domain = domain.strip().lower().replace("https://", "").replace("http://", "").split("/")[0]
    
    # Construct checkout URL (no secrets - just URL params)
    checkout_url = f"{STRIPE_CHECKOUT_BASE}?domain={domain}&product=aco-benchmark&price=99"
    
    return f"""
## πŸš€ Upgrade to Full Report

**Domain:** {domain}  
**Price:** $99 (one-time)

**[Click here to complete checkout]({checkout_url})**

You'll receive:
- Full 4-page PDF benchmark report
- Detailed findings across all 6 categories
- Prioritized recommendations
- Access to your ACO Academy dashboard

Secure payment processed via Stripe.
"""

# Build Gradio interface
with gr.Blocks(
    theme=gr.themes.Soft(
        primary_hue="blue",
        secondary_hue="purple"
    ),
    title="ACO Academy | The SEO of the AI Era",
    css="""
    .gradio-container {max-width: 1200px !important}
    .gr-button-primary {background: linear-gradient(90deg, #3B5EE9 0%, #9333EA 100%)}
    """
) as demo:
    
    gr.Markdown("""
    # ACO Academy Benchmark Tool
    ## The SEO of the AI Era
    
    **Is Your Site Ready for AI Agents?**
    
    Get a comprehensive benchmark of your site's Agent Commerce Optimization score. Find out what AI shopping agents see when they evaluate your site.
    """)
    
    # TAB 1: Showcase Examples
    with gr.Tab("πŸ” Showcase Examples"):
        gr.Markdown("""
        ## See How Major Sites Score on ACO Readiness
        
        We've benchmarked popular platforms to show the **range** of ACO implementation.
        Download full PDF reports to see what you'll receive.
        """)
        
        showcase_dropdown = gr.Dropdown(
            choices=list(SHOWCASE_EXAMPLES.keys()),
            label="Select a site to view full report",
            value="amazon.com"
        )
        
        showcase_btn = gr.Button("πŸ“₯ View Report", variant="primary")
        
        showcase_summary = gr.Markdown()
        showcase_output = gr.File(label="Download PDF Report")
        
        showcase_btn.click(
            fn=get_showcase_report,
            inputs=[showcase_dropdown],
            outputs=[showcase_output, showcase_summary]
        )
    
    # TAB 2: Check Your Site
    with gr.Tab("πŸ†“ Check Your Site"):
        gr.Markdown("""
        ## Free Preview Scan
        
        Get a **basic ACO check** for any domain - see your estimated grade instantly.
        
        ⚠️ **Preview includes:** ACO component detection only  
        πŸ”₯ **Full report includes:** SEO, Security, Consent, CEH-RI, and 20+ recommendations
        """)
        
        with gr.Row():
            preview_input = gr.Textbox(
                label="Enter your domain",
                placeholder="example.com",
                scale=3
            )
            preview_btn = gr.Button("πŸ”Ž Scan Now (Free)", variant="secondary", scale=1)
        
        preview_output = gr.Markdown()
        
        gr.Markdown("---")
        
        upgrade_btn = gr.Button("πŸ”₯ Get Full Report ($99)", variant="primary", size="lg")
        upgrade_output = gr.Markdown()
        
        preview_btn.click(
            fn=scan_domain_preview,
            inputs=[preview_input],
            outputs=[preview_output]
        )
        
        upgrade_btn.click(
            fn=get_upgrade_link,
            inputs=[preview_input],
            outputs=[upgrade_output]
        )
    
    # TAB 3: About ACO
    with gr.Tab("πŸ“š About ACO"):
        gr.Markdown("""
        ## What's Included in Your Benchmark
        
        **A comprehensive 6-point analysis covering every aspect of agent commerce optimization**
        
        ### πŸ“Š What We Analyze
        
        ### πŸ” SEO Analysis
        SSL, robots.txt, sitemap, meta tags, and traditional search optimization factors.
        
        ### πŸ€– ACO Analysis
        Agent card, MCP manifest, llms.txt, structured data, and AI agent discoverability.
        
        ### πŸ”’ Security Scan
        Security headers, rate limiting, sybil protection, and human escalation paths.
        
        ### βœ… Consent Audit
        GDPR, CCPA, and ACO consent compliance. Informed, voluntary, and fiduciary analysis.
        
        ### 🧠 CEH-RI Analysis
        Cognitive Event Horizon Risk Index across 6 dimensions of agent decision-making.
        
        ### πŸ“‹ Pathology Report
        Perception asymmetry, epistemic ambiguity, trust exhaustion risk assessment.
        
        ---
        
        ## What You Get
        
        βœ… Overall ACO Grade (A+ to F)  
        βœ… Detailed score breakdown  
        βœ… 6-dimension CEH-RI analysis  
        βœ… Vulnerability detection  
        βœ… Compliance status (GDPR, CCPA, ACO)  
        βœ… Prioritized recommendations  
        βœ… Instant results (no waiting)  
        βœ… Downloadable PDF report  
        βœ… Compare against best practices  
        βœ… Actionable improvement steps
        
        ---
        
        ## ONE-TIME ANALYSIS: $99
        
        Complete 6-point benchmark analysis with instant results:
        
        - SEO + ACO + Security + Consent + CEH-RI + Pathology
        - Prioritized action items
        - PDF report download
        - Results saved for future reference
        - Secure payment via Stripe
        
        ---
        
        ### πŸ”— Powered by SmartLedger
        
        ACO Academy is built on the **SmartLedger ecosystem**:
        
        - **EΒ² Identity** - Verifiable credentials for agent authentication
        - **BLS Explorer** - Transparent blockchain audit trails
        - **SNTNL Network** - Decentralized trust infrastructure
        
        **[Learn more at agenticcommerce.academy β†’](https://agenticcommerce.academy)**
        """)
    
    gr.Markdown("""
    ---
    
    **ACO Academy - The SEO of the AI Era** | [Run Full Benchmark ($99)](https://agenticcommerce.academy/benchmark) | Powered by [SmartLedger Solutions](https://smartledger.solutions)
    """)

# Launch configuration for HuggingFace Docker Space
if __name__ == "__main__":
    demo.launch(
        server_name="0.0.0.0",
        server_port=7860
    )