forked from NSPG13/agent-bounties
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-site.py
More file actions
1503 lines (1457 loc) · 64.5 KB
/
Copy pathcheck-site.py
File metadata and controls
1503 lines (1457 loc) · 64.5 KB
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
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
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
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
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
751
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
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
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
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from __future__ import annotations
import hashlib
import json
import re
import subprocess
import sys
import xml.etree.ElementTree as ET
from html.parser import HTMLParser
from pathlib import Path
from urllib.parse import urldefrag, urlparse
import yaml
REQUIRED_FILES = [
"index.html",
"earn.html",
"metrics.html",
"metrics.css",
"metrics.js",
"generated/github-participation.json",
"competition.html",
"competition.css",
"competition.js",
"post.html",
"funding.html",
"onramp.html",
"onramp.css",
"wallet-adapters.css",
"wallet-config.js",
"wallet-adapter-registry.js",
"coinbase-embedded-wallet.bundle.js",
"coinbase-embedded-wallet.bundle.css",
"x402-browser.js",
"moonpay-onramp.js",
"moonpay-link.js",
"objective.html",
"objective.css",
"objective.js",
"x402.html",
"how-to-earn-money-with-my-ai-agent.html",
"earn-money-using-ai.html",
"post-a-bounty-with-chatgpt-claude-gemini.html",
"blog.css",
"x402-test-vectors.json",
"prepare-agent.html",
"agent-budget.html",
"agent-budget.js",
"operator.html",
"recovery.html",
"terms.html",
"privacy.html",
"refunds.html",
"styles.css",
"favicon.svg",
"robots.txt",
"sitemap.xml",
"home.js",
"analytics-config.js",
"analytics.js",
"route-alias.js",
"bounty-entry.js",
"ai-bounty-handoff.js",
"ai-bounty-handoff.css",
"autonomous.js",
"legal-consent.js",
"protocol.json",
"llms.txt",
".well-known/agent-bounties.json",
".well-known/x402.json",
"agent/index.html",
"agent/index.md",
"agent.css",
".nojekyll",
]
CORE_PAGES = [
"index.html",
"earn.html",
"post.html",
"funding.html",
"refunds.html",
"operator.html",
]
PUBLIC_INDEXABLE_PAGES = {
"index.html": "https://agentbounties.app/",
"earn.html": "https://agentbounties.app/earn.html",
"metrics.html": "https://agentbounties.app/metrics.html",
"competition.html": "https://agentbounties.app/competition.html",
"post.html": "https://agentbounties.app/post.html",
"funding.html": "https://agentbounties.app/funding.html",
"objective.html": "https://agentbounties.app/objective.html",
"prepare-agent.html": "https://agentbounties.app/prepare-agent.html",
"agent-budget.html": "https://agentbounties.app/agent-budget.html",
"x402.html": "https://agentbounties.app/x402.html",
"how-to-earn-money-with-my-ai-agent.html": "https://agentbounties.app/how-to-earn-money-with-my-ai-agent.html",
"earn-money-using-ai.html": "https://agentbounties.app/earn-money-using-ai.html",
"post-a-bounty-with-chatgpt-claude-gemini.html": "https://agentbounties.app/post-a-bounty-with-chatgpt-claude-gemini.html",
"terms.html": "https://agentbounties.app/terms.html",
"privacy.html": "https://agentbounties.app/privacy.html",
"refunds.html": "https://agentbounties.app/refunds.html",
}
INTERNAL_NOINDEX_PAGES = {
"cancel.html",
"chatgpt-post-widget.html",
"operator.html",
"onramp.html",
"recovery.html",
"success.html",
}
ROUTE_ALIASES = {
"tasks/index.html": "/earn.html",
"post-a-task/index.html": "/post.html",
"agents/index.html": "/#leaderboard",
"developers/index.html": "https://api.agentbounties.app/docs",
"docs/index.html": "https://github.com/NSPG13/agent-bounties/blob/main/docs/agent-quickstart.md",
"community/index.html": "https://github.com/NSPG13/agent-bounties",
"global/index.html": "/",
"en/index.html": "/",
"es/index.html": "/",
}
ADDRESS = re.compile(r"^0x[0-9a-fA-F]{40}$")
class LinkParser(HTMLParser):
def __init__(self) -> None:
super().__init__()
self.links: list[str] = []
self.ids: set[str] = set()
def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
values = dict(attrs)
if values.get("id"):
self.ids.add(values["id"] or "")
for attr in ("href", "src"):
if values.get(attr):
self.links.append(values[attr] or "")
def fail(message: str) -> None:
raise SystemExit(message)
def require_phrases(label: str, text: str, phrases: list[str]) -> None:
for phrase in phrases:
if phrase not in text:
fail(f"{label} missing required phrase: {phrase}")
def check_internal_link(site_dir: Path, source: Path, link: str, ids: set[str]) -> None:
target, fragment = urldefrag(link)
parsed = urlparse(target)
if parsed.scheme in {"http", "https", "mailto"}:
return
if target.startswith("#"):
if fragment and fragment not in ids:
fail(f"{source}: missing local anchor {fragment}")
return
if target.startswith("/"):
fail(f"{source}: root-relative link is not portable on GitHub Pages: {link}")
target_path = (source.parent / (parsed.path or source.name)).resolve()
try:
target_path.relative_to(site_dir.resolve())
except ValueError:
fail(f"{source}: link escapes site directory: {link}")
if not target_path.exists():
fail(f"{source}: missing linked file {link}")
def check_protocol(protocol: dict, deployment: dict) -> None:
if protocol.get("protocol_version") != "agent-bounties/autonomous-v1":
fail("protocol.json must identify autonomous-v1")
if protocol.get("network") != "base-mainnet" or protocol.get("chain_id") != 8453:
fail("protocol.json must target Base mainnet chain 8453")
if protocol.get("native_usdc", "").lower() != "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913":
fail("protocol.json must use Base native USDC")
if protocol.get("status") not in {"pending_external_review_and_deployment", "active"}:
fail("protocol.json has an unsupported status")
if protocol.get("status") == "active":
if not ADDRESS.match(protocol.get("factory") or ""):
fail("active protocol.json requires a factory address")
if not ADDRESS.match(protocol.get("implementation") or ""):
fail("active protocol.json requires an implementation address")
else:
if protocol.get("factory") is not None or protocol.get("implementation") is not None:
fail("pending protocol.json must not advertise undeployed addresses")
if deployment.get("protocol_version") != protocol.get("protocol_version"):
fail("site and deployment manifests disagree on protocol version")
if deployment.get("status") != protocol.get("status"):
fail("site and deployment manifests disagree on deployment status")
if deployment.get("factory", {}).get("contract") != protocol.get("factory"):
fail("site and deployment manifests disagree on factory address")
if deployment.get("policy", {}).get("operator_settlement_signer") is not False:
fail("autonomous deployment must not configure a settlement operator")
def main() -> int:
repo_root = Path(__file__).resolve().parents[1]
site_dir = repo_root / "site"
for relative in REQUIRED_FILES:
if not (site_dir / relative).exists():
fail(f"missing site file: {relative}")
for relative, destination in ROUTE_ALIASES.items():
alias = site_dir / relative
if not alias.exists():
fail(f"missing route alias: {relative}")
text = alias.read_text(encoding="utf-8")
require_phrases(
relative,
text,
[
f'data-destination="{destination}"',
'<meta name="robots" content="noindex">',
'<script src="../route-alias.js"></script>',
],
)
agent_page_path = site_dir / "agent" / "index.html"
agent_page = agent_page_path.read_text(encoding="utf-8")
agent_parser = LinkParser()
agent_parser.feed(agent_page)
require_phrases(
"agent/index.html",
agent_page,
[
'<link rel="canonical" href="https://agentbounties.app/agent/">',
'type="text/markdown"',
"AGENT MODE · NO COMPUTER USE REQUIRED",
"https://mcp.agentbounties.app/mcp",
"https://api.agentbounties.app/api-docs/openapi.json",
"https://agentbounties.app/schemas/discovery-manifest.v2.json",
"Only <code>BountySettled</code> proves bounty payment",
],
)
if re.search(r'<meta\s+name="robots"[^>]*noindex', agent_page, re.IGNORECASE):
fail("agent/index.html must remain indexable")
for link in agent_parser.links:
check_internal_link(site_dir, agent_page_path, link, agent_parser.ids)
agent_markdown = (site_dir / "agent" / "index.md").read_text(encoding="utf-8")
require_phrases(
"agent/index.md",
agent_markdown,
[
"No computer use is required",
"https://agentbounties.app/llms.txt",
"https://mcp.agentbounties.app/mcp",
"https://api.agentbounties.app/api-docs/openapi.json",
"Only a confirmed canonical `BountySettled` event proves bounty payment",
],
)
for html_file in sorted(site_dir.glob("*.html")):
parser = LinkParser()
text = html_file.read_text(encoding="utf-8")
parser.feed(text)
if "<title>" not in text or '<meta name="description"' not in text:
fail(f"{html_file}: missing title or description meta")
if '<link rel="icon" href="favicon.svg" type="image/svg+xml">' not in text:
fail(f"{html_file}: missing project favicon")
expected_canonical = PUBLIC_INDEXABLE_PAGES.get(html_file.name)
if expected_canonical:
if f'<link rel="canonical" href="{expected_canonical}">' not in text:
fail(f"{html_file}: missing canonical URL {expected_canonical}")
if re.search(r'<meta\s+name="robots"[^>]*noindex', text, re.IGNORECASE):
fail(f"{html_file}: public page must remain indexable")
if text.count('<script src="analytics.js"></script>') != 1:
fail(f"{html_file}: public page must load the first-party analytics collector exactly once")
if text.count('<script src="analytics-config.js"></script>') != 1:
fail(f"{html_file}: public page must load the analytics configuration exactly once")
if text.index('src="analytics-config.js"') > text.index('src="analytics.js"'):
fail(f"{html_file}: analytics configuration must load before the collector")
elif html_file.name in INTERNAL_NOINDEX_PAGES:
if not re.search(r'<meta\s+name="robots"[^>]*noindex', text, re.IGNORECASE):
fail(f"{html_file}: internal page must be noindex")
if '<script src="analytics.js"></script>' in text:
fail(f"{html_file}: internal page must not load the public analytics collector")
if '<script src="analytics-config.js"></script>' in text:
fail(f"{html_file}: internal page must not load the public analytics configuration")
for link in parser.links:
check_internal_link(site_dir, html_file, link, parser.ids)
sitemap_root = ET.parse(site_dir / "sitemap.xml").getroot()
sitemap_namespace = {"sm": "http://www.sitemaps.org/schemas/sitemap/0.9"}
sitemap_urls = {
element.text.strip()
for element in sitemap_root.findall("sm:url/sm:loc", sitemap_namespace)
if element.text
}
expected_sitemap_urls = set(PUBLIC_INDEXABLE_PAGES.values()) | {
"https://agentbounties.app/agent/"
}
if sitemap_urls != expected_sitemap_urls:
missing = sorted(expected_sitemap_urls - sitemap_urls)
extra = sorted(sitemap_urls - expected_sitemap_urls)
fail(f"sitemap coverage mismatch: missing={missing} extra={extra}")
robots = (site_dir / "robots.txt").read_text(encoding="utf-8")
if "Sitemap: https://agentbounties.app/sitemap.xml" not in robots:
fail("robots.txt must advertise the canonical sitemap")
if (site_dir / "main.js").exists():
fail("retired browser settlement bundle site/main.js must not exist")
pages = {name: (site_dir / name).read_text(encoding="utf-8") for name in CORE_PAGES}
metrics_page = (site_dir / "metrics.html").read_text(encoding="utf-8")
metrics_css = (site_dir / "metrics.css").read_text(encoding="utf-8")
metrics_javascript = (site_dir / "metrics.js").read_text(encoding="utf-8")
require_phrases(
"public metrics dashboard",
metrics_page,
[
"External active identities",
"Marketplace payout volume",
"Mature claim-to-settlement",
"API, CLI, and MCP usage",
"Observed external requests",
"MCP request share",
"Counts are external requests, not unique people, agents, clients, or sessions",
"Verify every payout",
"Event sum",
"Role counts are not additive",
"Browser/device IDs",
"Thousands of repository actions",
"Unique cloners",
"Unique visitors",
"Unique repository users measured by GitHub",
"Monetization not active",
"Only a confirmed canonical <code>BountySettled</code> event proves solver payment",
'data-period="lifetime" aria-pressed="true"',
'data-period="7d" aria-pressed="false"',
],
)
require_phrases(
"public metrics dashboard behavior",
metrics_javascript,
[
'const PLATFORM_DELAY_MS = 5 * 60 * 1000',
'const GITHUB_DELAY_MS = 2 * 60 * 60 * 1000',
'win.setInterval(() =>',
'doc.hidden',
'visibilitychange',
'"unavailable"',
'"delayed"',
'weeklyGrowth',
'interfaceUsageSummary',
'data-interface-status',
'canonicalPayoutRows',
'payoutAuditSummary',
'BASESCAN_TX_URL',
'raw.textContent = "Raw events"',
],
)
require_phrases(
"public metrics accessibility",
metrics_css,
[
"@media (prefers-reduced-motion: reduce)",
".metrics-page [data-reveal]",
".period-control button[aria-pressed=\"true\"]",
".audit-table-shell:focus-visible",
".interface-track i",
],
)
github_participation = json.loads(
(site_dir / "generated" / "github-participation.json").read_text(encoding="utf-8")
)
if github_participation.get("schema_version") != "agent-bounties/github-participation-v1":
fail("GitHub participation placeholder has the wrong schema version")
if github_participation.get("coverage", {}).get("raw_identifiers_included") is not False:
fail("GitHub participation artifact must declare aggregate-only coverage")
serialized_github_participation = json.dumps(github_participation).lower()
for forbidden in ("html_url", "profile_url", "comment_text", "wallet_address"):
if forbidden in serialized_github_participation:
fail(f"GitHub participation artifact exposes forbidden field: {forbidden}")
structured_data_match = re.search(
r'<script\s+type="application/ld\+json">\s*(\{.*?\})\s*</script>',
pages["index.html"],
re.DOTALL,
)
if not structured_data_match:
fail("index.html must expose JSON-LD website identity")
structured_data = json.loads(structured_data_match.group(1))
if structured_data.get("@type") != "WebSite":
fail("index.html JSON-LD must identify a WebSite")
if structured_data.get("name") != "Agent Bounties":
fail("index.html JSON-LD must use the canonical product name")
if structured_data.get("url") != "https://agentbounties.app/":
fail("index.html JSON-LD must use the canonical website URL")
require_phrases(
"index.html blog discovery",
pages["index.html"],
[
'href="https://medium.com/search?q=agent%20bounties"',
'aria-label="Find Agent Bounties on Medium"',
'href="how-to-earn-money-with-my-ai-agent.html">Blog</a>',
'href="earn-money-using-ai.html"',
],
)
guide_page = (site_dir / "how-to-earn-money-with-my-ai-agent.html").read_text(encoding="utf-8")
require_phrases(
"AI agent earning guide",
guide_page,
[
"How to Earn Money With Your AI Agent: 7 Practical Models",
"How can I earn money with my AI agent?",
"Publisher disclosure",
"Revenue is not profit",
'id="agent-bounties"',
'href="earn.html">Browse live agent bounties</a>',
"Can I use ChatGPT, Claude, or Gemini to complete paid bounties?",
"https://mcp.agentbounties.app/mcp",
"Gemini Spark",
"BountySettled",
"https://docs.stripe.com/billing/subscriptions/usage-based",
"https://www.ftc.gov/business-guidance/blog/2026/06/back-those-earnings-claims-other-lessons-ftcs-labor-task-force-work",
],
)
guide_structured_data_match = re.search(
r'<script\s+type="application/ld\+json">\s*(\{.*?\})\s*</script>',
guide_page,
re.DOTALL,
)
if not guide_structured_data_match:
fail("AI agent earning guide must expose JSON-LD")
guide_structured_data = json.loads(guide_structured_data_match.group(1))
guide_graph = guide_structured_data.get("@graph", [])
guide_types = {item.get("@type") for item in guide_graph}
if guide_types != {"Article", "FAQPage"}:
fail("AI agent earning guide JSON-LD must expose Article and FAQPage")
provider_earning_page = (site_dir / "earn-money-using-ai.html").read_text(encoding="utf-8")
require_phrases(
"provider-safe AI earning guide",
provider_earning_page,
[
"Earn money using AI through funded, verifiable work",
"ChatGPT, Claude, or Gemini",
"https://agentbounties.app/agent/",
"https://mcp.agentbounties.app/mcp",
"Base mainnet only",
"Only a confirmed canonical <code>BountySettled</code> event proves payment",
"Agent Bounties does not promise income",
"not Solana",
"<code>@agent-bounty/sdk</code> does not exist",
],
)
posting_with_ai_page = (site_dir / "post-a-bounty-with-chatgpt-claude-gemini.html").read_text(encoding="utf-8")
require_phrases(
"provider-safe AI posting guide",
posting_with_ai_page,
[
"Post a bounty with ChatGPT, Claude, or Gemini",
"No provider API key is required",
"prepare_bounty_post",
"review_required_not_published",
"Copy prompt & open",
"Nothing is posted, funded, or signed",
"Base mainnet",
"not Phantom or Solana",
"https://agentbounties.app/agent/",
],
)
recovery_page = (site_dir / "recovery.html").read_text(encoding="utf-8")
javascript = (site_dir / "autonomous.js").read_text(encoding="utf-8")
analytics_javascript = (site_dir / "analytics.js").read_text(encoding="utf-8")
analytics_config = (site_dir / "analytics-config.js").read_text(encoding="utf-8")
home_javascript = (site_dir / "home.js").read_text(encoding="utf-8")
simple_home_javascript = (site_dir / "simple-home.js").read_text(encoding="utf-8")
bounty_entry_javascript = (site_dir / "bounty-entry.js").read_text(encoding="utf-8")
ai_handoff_javascript = (site_dir / "ai-bounty-handoff.js").read_text(encoding="utf-8")
llms = (site_dir / "llms.txt").read_text(encoding="utf-8")
posting_guide = (repo_root / "docs" / "posting-a-usable-bounty.md").read_text(encoding="utf-8")
bounty_template = (repo_root / ".github" / "ISSUE_TEMPLATE" / "paid-bounty.yml").read_text(encoding="utf-8")
parsed_bounty_template = yaml.safe_load(bounty_template)
if not isinstance(parsed_bounty_template, dict) or parsed_bounty_template.get("name") != "Bounty draft":
fail("paid bounty issue template must be valid YAML with the expected form name")
objective_page = (site_dir / "objective.html").read_text(encoding="utf-8")
objective_javascript = (site_dir / "objective.js").read_text(encoding="utf-8")
discovery = json.loads((site_dir / ".well-known/agent-bounties.json").read_text(encoding="utf-8"))
x402_discovery = json.loads((site_dir / ".well-known/x402.json").read_text(encoding="utf-8"))
x402_vectors = json.loads((site_dir / "x402-test-vectors.json").read_text(encoding="utf-8"))
protocol = json.loads((site_dir / "protocol.json").read_text(encoding="utf-8"))
deployment = json.loads((repo_root / "deployments" / "base-mainnet.json").read_text(encoding="utf-8"))
legacy_bounded_deployment = json.loads(
(repo_root / "deployments" / "bounded-agent-wallet-base-mainnet.json").read_text(encoding="utf-8")
)
bounded_deployment = json.loads(
(repo_root / "deployments" / "bounded-agent-wallet-v2-base-mainnet.json").read_text(encoding="utf-8")
)
standing_meta_deployment = json.loads(
(repo_root / "deployments" / "standing-meta-v2-base-mainnet.json").read_text(encoding="utf-8")
)
bounded_page = (site_dir / "agent-budget.html").read_text(encoding="utf-8")
bounded_javascript = (site_dir / "agent-budget.js").read_text(encoding="utf-8")
legal_javascript = (site_dir / "legal-consent.js").read_text(encoding="utf-8")
privacy_page = (site_dir / "privacy.html").read_text(encoding="utf-8")
pages_workflow = (repo_root / ".github" / "workflows" / "pages.yml").read_text(encoding="utf-8")
check_protocol(protocol, deployment)
require_phrases(
"index.html agent and bounty entry",
pages["index.html"],
[
"data-primary-bounty-cta>Post a bounty</a>",
'class="mode-switch"',
'href="agent/"',
'action="objective.html"',
'name="autostart" value="1"',
'src="bounty-entry.js?v=1"',
'type="text/markdown" title="Agent mode (Markdown)"',
],
)
for retired in ("data-connect-wallet", "data-wallet-provider", 'class="network-chip"'):
if retired in pages["index.html"]:
fail(f"homepage still exposes retired wallet-first navigation: {retired}")
require_phrases(
"bounty-entry.js",
bounty_entry_javascript,
[
"agent-bounties:homepage-bounty-intent",
"window.sessionStorage.setItem",
"window.sessionStorage.removeItem",
"objective.html?source=home&autostart=1",
],
)
for name, page in pages.items():
require_phrases(name, page, ["Post your own bounty", "autonomous.js"])
if "main.js" in page:
fail(f"{name} still loads the retired browser settlement bundle")
for name in ["earn.html", "post.html", "funding.html"]:
require_phrases(name, pages[name], ["data-protocol-action", "disabled"])
wallet_action_pages = {
"post.html": (pages["post.html"], "post_bounty"),
"funding.html": (pages["funding.html"], "fund_bounty"),
"earn.html claim": (pages["earn.html"], "claim_bounty"),
"earn.html submit": (pages["earn.html"], "submit_result"),
"refunds.html cancel": (pages["refunds.html"], "cancel_bounty"),
"refunds.html refund": (pages["refunds.html"], "recover_funds"),
"recovery.html": (recovery_page, "recover_funds"),
"agent-budget.html": (bounded_page, "activate_agent_budget"),
}
for name, (page, action) in wallet_action_pages.items():
require_phrases(name, page, ["legal-consent.js", "data-legal-consent", action, "terms.html", "privacy.html"])
require_phrases(
"analytics.js",
analytics_javascript,
[
"https://api.agentbounties.app/v1/analytics/events",
"navigator.globalPrivacyControl",
"navigator.doNotTrack",
"credentials: \"omit\"",
"referrerPolicy: \"no-referrer\"",
"page_path: window.location.pathname",
"funded_bounty_click",
"canonical_post_confirmed",
"claim_confirmed",
"competition_entry_started",
"competition_entry_confirmed",
"competition_reveal_started",
"competition_reveal_confirmed",
"data-analytics-event",
"agentBountiesAnalytics",
"data-google-analytics-consent",
"allow_google_signals: false",
"allow_ad_personalization_signals: false",
"https://www.googletagmanager.com/gtag/js",
"bountyboard.global",
],
)
for forbidden in ["document.cookie", "location.search.slice", "wallet_address", "user_agent", "ip_address"]:
if forbidden in analytics_javascript:
fail(f"analytics.js must not collect or store {forbidden}")
require_phrases(
"privacy.html analytics disclosure",
privacy_page,
[
"First-party site analytics",
"Global Privacy Control",
"Do Not Track",
"selected public opportunity identifier or bounty contract",
"does not store an IP address, user agent, full referrer URL, URL query string, wallet address",
"data-analytics-opt-out",
"Optional Google Analytics",
"loads only after you select <strong>Allow</strong>",
"Advertising signals and ad personalization are disabled",
],
)
if not re.search(r'googleMeasurementId:\s*"(?:|G-[A-Z0-9]+)"', analytics_config):
fail("analytics-config.js must contain an empty or valid GA4 measurement ID")
require_phrases(
"Pages GA4 configuration",
pages_workflow,
["GA_MEASUREMENT_ID", "Configure optional Google Analytics", "^G-[A-Z0-9]+$"],
)
require_phrases(
"legal-consent.js",
legal_javascript,
[
"/v1/legal/policy",
"/v1/legal/acceptances",
"web_clickwrap",
"recovery phrase or private key",
"requireAcceptance",
],
)
require_phrases(
"autonomous.js legal gate",
javascript,
[
"acceptLegalAction",
"x-agent-bounties-legal-acceptance",
"post_bounty",
"fund_bounty",
"claim_bounty",
"submit_result",
"cancel_bounty",
],
)
require_phrases(
"autonomous.js",
javascript,
[
"requireActiveProtocol",
"No transaction was requested",
"[data-protocol-action]",
"eth_requestAccounts",
],
)
require_phrases(
"autonomous.js persisted social draft handoff",
javascript,
[
'params.has("socialDraft")',
"/v1/social/mention-drafts/${draftId}",
'draft.state !== "review_required_not_published"',
"No bounty id or contract exists yet; this social reply did not publish or fund anything.",
"await prefillPost()",
],
)
require_phrases(
"recovery.html",
recovery_page,
[
'id="legacy-recovery-form"',
"Cancel and recover 3 USDC",
"0x786be3f994365fcd417a1b502a83300ea87d9b34",
"0x481dfc6f45d43b89dfcc1a84fd6d9b5f73a6a0b9",
"0x3195aebfc39a069bf1a4420951d0babc99b2b612",
"Only the exact creator wallet and six pinned zero-value calls are accepted.",
"autonomous.js",
],
)
require_phrases(
"autonomous.js legacy recovery",
javascript,
[
'creator: "0x884834e884d6e93462655a2820140ad03e6747bc"',
'factory: "0x082c52131aaf0c56e76b075f895eab6fcab6d2f9"',
'implementation: "0x2fa36d2b2327642db3a6cc8cdd91544ad7484eb9"',
'usdc: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"',
'cancel: "0xea8a1af0"',
'withdrawRefund: "0x110f8874"',
"value.code !== expectedCloneRuntime()",
"value.solver !== \"0x0000000000000000000000000000000000000000\" || value.bond !== 0n",
"value.funded === 0n",
"value.contribution === 0n",
"value.balance === 0n",
'value: "0x0"',
],
)
if "import wallet" in recovery_page.lower() or "private key" in recovery_page.lower():
fail("legacy recovery must use connect-wallet onboarding only")
public_wallet_surface = (
pages["earn.html"]
+ pages["post.html"]
+ pages["funding.html"]
+ pages["refunds.html"]
)
if "Connect wallet" not in public_wallet_surface:
fail("public transaction pages must expose a connect-wallet flow")
if "import wallet" in public_wallet_surface.lower():
fail("public transaction pages must never expose wallet-import onboarding")
if 'name="apiBaseUrl"' in public_wallet_surface:
fail("public transaction pages must use the deployed API from protocol.json")
require_phrases(
"refunds.html creator cancellation",
pages["refunds.html"],
[
'id="creator-cancel-form"',
"Delete unclaimed bounty",
"A claimed bounty cannot be deleted",
"BountyCancelled",
"Withdraw my refund",
"RefundWithdrawn",
"immutable audit history",
"creator cannot withdraw another funder's money",
"BoundedAgentWalletV2",
],
)
require_phrases(
"autonomous.js creator cancellation",
javascript,
[
"/v1/base/autonomous-bounties/cancel-plan",
"/v1/base/autonomous-bounties/refund-withdrawal-plan",
"/v1/base/autonomous-bounties/bounded-wallet-cancel-refund-plan",
'function: "cancel()"',
'data: "0xea8a1af0"',
'function: "withdrawRefund()"',
'data: "0x110f8874"',
"Only unclaimed Open or Claimable bounties can be cancelled",
"Connect the creator wallet or the owner of its BoundedAgentWalletV2",
"BountyCancelled is confirmed",
"RefundWithdrawn is confirmed",
"cancelAndWithdrawUnclaimedBounty(address)",
"withdrawCancelledBountyRefund(address)",
],
)
require_phrases(
"home.js",
home_javascript,
[
"network-canvas",
"requestAnimationFrame",
"home-live-inventory",
"/v1/opportunities",
"/v1/opportunities/stream",
"new EventSource",
"stream.onopen",
"stream.onerror",
"Live stream connected",
"Live stream reconnecting",
"Ready to earn",
"Open opportunities",
"Seeking funding",
"In progress",
"Recently paid",
"MARKET_REFRESH_MS = 15_000",
"LEADERBOARD_REFRESH_MS = 60_000",
"refreshMarket",
"window.setInterval",
'document.addEventListener("visibilitychange"',
"claim-funnel?window_hours=${MARKET_WINDOW_HOURS}",
"limit=300",
"/v1/metrics/platform?period=lifetime",
"metrics.html#payout-audit",
"no stale bounty is shown",
"Last verified standings remain visible",
"payment_state",
"payment_committed",
"verification_ready",
"Meta-bounty:",
'timeZone: "UTC"',
"end.getTime() - 1",
],
)
bounty_board_javascript = (site_dir / "bounty-board.js").read_text(encoding="utf-8")
require_phrases(
"bounty-board.js claim telemetry",
bounty_board_javascript,
[
"view=ready_to_earn",
"source_type=canonical_base",
"/v1/opportunities/stream",
"new EventSource",
"stream.onopen",
"stream.onerror",
"Live stream connected",
"Live stream reconnecting",
"cache: \"no-store\"",
"no stale bounty is shown",
"window.setInterval",
'claim.dataset.analyticsEvent = "funded_bounty_click"',
"claim.dataset.analyticsOpportunityId = item.opportunity_id",
"claim.dataset.analyticsBountyContract = item.source_id",
"source=bounty-board#claim-workflow",
],
)
if "refreshes every 15 seconds" in bounty_board_javascript:
fail("the SSE inventory must not be described as a periodic refresh")
require_phrases(
"usable bounty publication contracts",
posting_guide + bounty_template,
[
"Positive solver net value",
"known-good and known-bad rehearsal",
"permissionless timeout",
"cancellation",
"contributor refund",
"one active canonical contract",
"remove this bounty from earning inventory immediately",
],
)
require_phrases(
"index.html adoption metrics",
pages["index.html"],
[
"Live marketplace metrics",
"automatically refreshed",
"data-adoption-ready",
"data-adoption-available",
"data-adoption-settled",
"data-adoption-paid",
"data-market-proof",
"Only <code>BountySettled</code> counts as payment.",
],
)
for stale_metric in ["data-adoption-solvers", "data-adoption-posters"]:
if stale_metric in pages["index.html"]:
fail(f"index.html must not present wallet counts as agent activity: {stale_metric}")
terms_page = (site_dir / "terms.html").read_text(encoding="utf-8")
privacy_page = (site_dir / "privacy.html").read_text(encoding="utf-8")
require_phrases(
"terms.html",
terms_page,
[
"Terms version 2026-07-18",
"How you agree",
"Eligibility and authority",
"Blockchain and wallet risk",
"Public content and intellectual property",
"Limits on liability",
"mandatory consumer protections",
],
)
require_phrases(
"privacy.html",
privacy_page,
[
"Legal acceptance receipts",
"session-only receipt",
"does not record a private key",
"wallet count is not presented as a count of unique people",
],
)
require_phrases(
"index.html",
pages["index.html"],
[
"The Global Marketplace for Digital Work",
"What can be done here?",
"explicit acceptance criteria",
"Benchmark suites",
"Code review agents",
"Multimodal RAG",
"MCP integrations",
"Agent memory",
"Cost optimization",
"3 USDC daily. 26 USDC weekly.",
"BountySettled",
"Share proof",
"star the repository",
"Each creator counts once",
"Rank is not payment",
"Work moving through the market",
"Open opportunity",
"does not imply payment",
'type="application/rss+xml"',
'type="application/atom+xml"',
'type="application/feed+json"',
"Subscribe via RSS",
"Subscribe via Atom",
"Agent Bounties | The Global Marketplace for Digital Work",
'src="home.js?v=767"',
'src="simple-home.js?v=766"',
'property="og:title"',
'name="twitter:card"',
'type="application/ld+json"',
],
)
require_phrases(
"simple-home.js digital work positioning",
simple_home_javascript,
[
"The Global Marketplace for Digital Work",
"For Digital Work.",
"Post bounded digital work.",
"What digital work needs to get done?",
"digital-work-v1",
],
)
for stale_phrase in ("Problems Worth Solving", "For Problems", "What problem do you need"):
if stale_phrase in simple_home_javascript:
fail(f"simple-home.js still contains stale homepage positioning: {stale_phrase}")
require_phrases(
"post.html",
pages["post.html"],
[
"Sign and post bounty",
"Post with 0 USDC now and open it to funding later",
"Fund on creation",
"One automatic verifier",
"Optional independent review for higher-risk work",
"Benchmark JSON (exact payout condition)",
"Evidence record schema",
"does not evaluate my task or acceptance criteria",
"How did you find Agent Bounties?",
"Draft measurable terms",
"cloud draft is advisory",
],
)
require_phrases(
"earn.html unfunded discovery",
pages["earn.html"],
[
"Unfunded bounties",
"not claimable and promise no payment",
"list_unfunded_bounties",
"submit_unfunded_bounty_solution",
],
)
require_phrases(
"funding.html",
pages["funding.html"],
[
"Pooled funding",
"Sign and fund bounty",
"FundingAdded",
"Stop only after that event",
"transaction hash is not funding",
],
)
require_phrases(
"earn.html",
pages["earn.html"],
[
"Make money with your AI",
"Claimable bounties",
"Submit evidence",
"Artifact reference",
"Evidence package JSON",
"Only a confirmed BountySettled event",
"star the repository",
],
)
require_phrases(
"operator.html",
pages["operator.html"],
[
"No settlement operator",
"Escrow #1 refunded",
"retired contract holds zero USDC",
],
)
require_phrases(
"autonomous.js",
javascript,
[
"eth_signTypedData_v4",
"wallet_sendCalls",
"create_bounty",
"eip3009_authorization",
"/v1/base/autonomous-bounties/terms",
"/v1/base/autonomous-bounties/creation-plan",
"/v1/base/autonomous-bounties/contribution-plan",
"/v1/base/autonomous-bounties/claims",
"/v1/cloud-agent/readiness",
"/v1/cloud-agent/bounty-drafts",
"request_bond_sponsorship",
"wallet_signature",
"canonical_event_id",
"/v1/base/autonomous-bounties/submission-plan",
"contract_terms",
"canonical_bounty_created",
"bounty_became_claimable",
"SHA-256",
"A transaction hash alone is not funding evidence",
'params.get("amount")',
],
)
active_surface = "\n".join(pages.values()) + "\n" + javascript + "\n" + llms
for retired in [
"createEscrow",
"EscrowReleased",
"/v1/base/release-plan",
"release(uint256,address[],uint256[],bytes32)",
"0x150C6dFbCe7803cc7f634f59b0624e87349CEAce",
]:
if retired in active_surface:
fail(f"active site still advertises retired escrow behavior: {retired}")
if "/v1/base/autonomous-bounties/authorized-claim-plan" in javascript:
fail("browser earning flow must use the hosted one-signature claim path")
if "sk_live" in active_surface or "private_key" in active_surface.lower():
fail("active site must not contain secret-looking payment material")