web-agent-bridge 3.2.0 โ 3.4.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.
- package/LICENSE +84 -72
- package/README.ar.md +1304 -1152
- package/README.md +298 -1635
- package/bin/agent-runner.js +474 -474
- package/bin/cli.js +237 -138
- package/bin/wab-init.js +223 -0
- package/bin/wab.js +80 -80
- package/examples/azure-dns-wab.js +83 -0
- package/examples/bidi-agent.js +119 -119
- package/examples/cloudflare-wab-dns.js +121 -0
- package/examples/cpanel-wab-dns.js +114 -0
- package/examples/cross-site-agent.js +91 -91
- package/examples/dns-discovery-agent.js +166 -0
- package/examples/gcp-dns-wab.js +76 -0
- package/examples/governance-agent.js +169 -0
- package/examples/mcp-agent.js +94 -94
- package/examples/next-app-router/README.md +44 -44
- package/examples/plesk-wab-dns.js +103 -0
- package/examples/puppeteer-agent.js +108 -108
- package/examples/route53-wab-dns.js +144 -0
- package/examples/saas-dashboard/README.md +55 -55
- package/examples/safe-mode-agent.js +96 -0
- package/examples/shopify-hydrogen/README.md +74 -74
- package/examples/vision-agent.js +171 -171
- package/examples/wab-sign.js +74 -0
- package/examples/wab-verify.js +60 -0
- package/examples/wordpress-elementor/README.md +77 -77
- package/package.json +19 -6
- package/public/.well-known/agent-tools.json +180 -180
- package/public/.well-known/ai-assets.json +59 -59
- package/public/.well-known/security.txt +8 -0
- package/public/.well-known/wab.json +28 -0
- package/public/activate.html +368 -0
- package/public/adoption-metrics.html +188 -0
- package/public/agent-workspace.html +349 -349
- package/public/ai.html +198 -198
- package/public/api.html +413 -412
- package/public/azure-dns-integration.html +289 -0
- package/public/browser.html +486 -486
- package/public/cloudflare-integration.html +380 -0
- package/public/commander-dashboard.html +243 -243
- package/public/cookies.html +210 -210
- package/public/cpanel-integration.html +398 -0
- package/public/css/agent-workspace.css +1713 -1713
- package/public/css/premium.css +317 -317
- package/public/css/styles.css +1263 -1235
- package/public/dashboard.html +707 -706
- package/public/dns.html +436 -0
- package/public/docs.html +588 -587
- package/public/feed.xml +89 -89
- package/public/gcp-dns-integration.html +318 -0
- package/public/growth.html +465 -463
- package/public/index.html +1266 -982
- package/public/integrations.html +556 -0
- package/public/js/activate.js +145 -0
- package/public/js/agent-workspace.js +1740 -1740
- package/public/js/auth-nav.js +65 -31
- package/public/js/auth-redirect.js +12 -12
- package/public/js/cookie-consent.js +56 -56
- package/public/js/dns.js +438 -0
- package/public/js/wab-demo-page.js +721 -721
- package/public/js/ws-client.js +74 -74
- package/public/llms-full.txt +360 -360
- package/public/llms.txt +125 -125
- package/public/login.html +85 -85
- package/public/mesh-dashboard.html +328 -328
- package/public/openapi.json +669 -580
- package/public/phone-shield.html +281 -0
- package/public/plesk-integration.html +375 -0
- package/public/premium-dashboard.html +2489 -2489
- package/public/premium.html +793 -793
- package/public/privacy.html +297 -297
- package/public/provider-onboarding.html +172 -0
- package/public/provider-sandbox.html +134 -0
- package/public/providers.html +359 -0
- package/public/register.html +105 -105
- package/public/registrar-integrations.html +141 -0
- package/public/robots.txt +99 -87
- package/public/route53-integration.html +531 -0
- package/public/script/wab-consent.d.ts +36 -36
- package/public/script/wab-consent.js +104 -104
- package/public/script/wab-schema.js +131 -131
- package/public/script/wab.d.ts +108 -108
- package/public/script/wab.min.js +580 -580
- package/public/security.txt +8 -0
- package/public/shieldqr.html +231 -0
- package/public/sitemap.xml +6 -0
- package/public/terms.html +256 -256
- package/public/wab-trust.html +200 -0
- package/public/wab-vs-protocols.html +210 -0
- package/public/whitepaper.html +449 -0
- package/script/ai-agent-bridge.js +1754 -1754
- package/sdk/README.md +99 -99
- package/sdk/agent-mesh.js +449 -449
- package/sdk/auto-discovery.js +288 -0
- package/sdk/commander.js +262 -262
- package/sdk/governance.js +262 -0
- package/sdk/index.d.ts +464 -464
- package/sdk/index.js +25 -1
- package/sdk/multi-agent.js +318 -318
- package/sdk/package.json +2 -2
- package/sdk/safe-mode.js +221 -0
- package/sdk/safety-shield.js +219 -0
- package/sdk/schema-discovery.js +83 -83
- package/server/adapters/index.js +520 -520
- package/server/config/plans.js +367 -367
- package/server/config/secrets.js +102 -102
- package/server/control-plane/index.js +301 -301
- package/server/data-plane/index.js +354 -354
- package/server/index.js +670 -427
- package/server/llm/index.js +404 -404
- package/server/middleware/adminAuth.js +35 -35
- package/server/middleware/auth.js +50 -50
- package/server/middleware/featureGate.js +88 -88
- package/server/middleware/rateLimits.js +100 -100
- package/server/middleware/sensitiveAction.js +157 -0
- package/server/migrations/001_add_analytics_indexes.sql +7 -7
- package/server/migrations/002_premium_features.sql +418 -418
- package/server/migrations/003_ads_integer_cents.sql +33 -33
- package/server/migrations/004_agent_os.sql +158 -158
- package/server/migrations/005_marketplace_metering.sql +126 -126
- package/server/migrations/007_governance.sql +106 -0
- package/server/migrations/008_plans.sql +144 -0
- package/server/migrations/009_shieldqr.sql +30 -0
- package/server/migrations/010_extended_trust.sql +33 -0
- package/server/models/adapters/index.js +33 -33
- package/server/models/adapters/mysql.js +183 -183
- package/server/models/adapters/postgresql.js +172 -172
- package/server/models/adapters/sqlite.js +7 -7
- package/server/models/db.js +740 -681
- package/server/observability/failure-analysis.js +337 -337
- package/server/observability/index.js +394 -394
- package/server/protocol/capabilities.js +223 -223
- package/server/protocol/index.js +243 -243
- package/server/protocol/schema.js +584 -584
- package/server/registry/certification.js +271 -271
- package/server/registry/index.js +326 -326
- package/server/routes/admin-plans.js +76 -0
- package/server/routes/admin-premium.js +673 -671
- package/server/routes/admin-shieldqr.js +90 -0
- package/server/routes/admin-trust-monitor.js +83 -0
- package/server/routes/admin.js +549 -261
- package/server/routes/ads.js +130 -130
- package/server/routes/agent-workspace.js +540 -540
- package/server/routes/api.js +150 -150
- package/server/routes/auth.js +71 -71
- package/server/routes/billing.js +57 -45
- package/server/routes/commander.js +316 -316
- package/server/routes/demo-showcase.js +332 -332
- package/server/routes/demo-store.js +154 -0
- package/server/routes/discovery.js +2348 -417
- package/server/routes/gateway.js +173 -157
- package/server/routes/governance.js +208 -0
- package/server/routes/license.js +251 -240
- package/server/routes/mesh.js +469 -469
- package/server/routes/noscript.js +543 -543
- package/server/routes/plans.js +33 -0
- package/server/routes/premium-v2.js +686 -686
- package/server/routes/premium.js +724 -724
- package/server/routes/providers.js +650 -0
- package/server/routes/runtime.js +2148 -2147
- package/server/routes/shieldqr.js +88 -0
- package/server/routes/sovereign.js +465 -385
- package/server/routes/universal.js +200 -185
- package/server/routes/wab-api.js +850 -501
- package/server/runtime/container-worker.js +111 -111
- package/server/runtime/container.js +448 -448
- package/server/runtime/distributed-worker.js +362 -362
- package/server/runtime/event-bus.js +210 -210
- package/server/runtime/index.js +253 -253
- package/server/runtime/queue.js +599 -599
- package/server/runtime/replay.js +666 -666
- package/server/runtime/sandbox.js +266 -266
- package/server/runtime/scheduler.js +534 -534
- package/server/runtime/session-engine.js +293 -293
- package/server/runtime/state-manager.js +188 -188
- package/server/security/cross-site-redactor.js +196 -0
- package/server/security/dry-run.js +180 -0
- package/server/security/human-gate-rate-limit.js +147 -0
- package/server/security/human-gate-transports.js +178 -0
- package/server/security/human-gate.js +281 -0
- package/server/security/index.js +368 -368
- package/server/security/intent-engine.js +245 -0
- package/server/security/reward-guard.js +171 -0
- package/server/security/rollback-store.js +239 -0
- package/server/security/token-scope.js +404 -0
- package/server/security/url-policy.js +139 -0
- package/server/services/agent-chat.js +506 -506
- package/server/services/agent-learning.js +601 -575
- package/server/services/agent-memory.js +625 -625
- package/server/services/agent-mesh.js +555 -539
- package/server/services/agent-symphony.js +717 -717
- package/server/services/agent-tasks.js +1807 -1807
- package/server/services/api-key-engine.js +292 -261
- package/server/services/cluster.js +894 -894
- package/server/services/commander.js +738 -738
- package/server/services/edge-compute.js +440 -440
- package/server/services/email.js +233 -204
- package/server/services/governance.js +466 -0
- package/server/services/hosted-runtime.js +205 -205
- package/server/services/lfd.js +635 -635
- package/server/services/local-ai.js +389 -389
- package/server/services/marketplace.js +270 -270
- package/server/services/metering.js +182 -182
- package/server/services/modules/affiliate-intelligence.js +93 -93
- package/server/services/modules/agent-firewall.js +90 -90
- package/server/services/modules/bounty.js +89 -89
- package/server/services/modules/collective-bargaining.js +92 -92
- package/server/services/modules/dark-pattern.js +66 -66
- package/server/services/modules/gov-intelligence.js +45 -45
- package/server/services/modules/neural.js +55 -55
- package/server/services/modules/notary.js +49 -49
- package/server/services/modules/price-time-machine.js +86 -86
- package/server/services/modules/protocol.js +104 -104
- package/server/services/negotiation.js +439 -439
- package/server/services/plans.js +214 -0
- package/server/services/plugins.js +771 -771
- package/server/services/premium.js +1 -1
- package/server/services/price-intelligence.js +566 -566
- package/server/services/price-shield.js +1137 -1137
- package/server/services/provider-clients.js +740 -0
- package/server/services/reputation.js +465 -465
- package/server/services/search-engine.js +357 -357
- package/server/services/security.js +513 -513
- package/server/services/self-healing.js +843 -843
- package/server/services/shieldqr.js +322 -0
- package/server/services/sovereign-shield.js +542 -0
- package/server/services/ssl-inspector.js +42 -0
- package/server/services/ssl-monitor.js +167 -0
- package/server/services/stripe.js +205 -192
- package/server/services/swarm.js +788 -788
- package/server/services/universal-scraper.js +662 -661
- package/server/services/verification.js +481 -481
- package/server/services/vision.js +1163 -1163
- package/server/services/wab-crypto.js +178 -0
- package/server/utils/cache.js +125 -125
- package/server/utils/migrate.js +81 -81
- package/server/utils/safe-fetch.js +228 -0
- package/server/utils/secureFields.js +50 -50
- package/server/ws.js +161 -161
- package/templates/artisan-marketplace.yaml +104 -104
- package/templates/book-price-scout.yaml +98 -98
- package/templates/electronics-price-tracker.yaml +108 -108
- package/templates/flight-deal-hunter.yaml +113 -113
- package/templates/freelancer-direct.yaml +116 -116
- package/templates/grocery-price-compare.yaml +93 -93
- package/templates/hotel-direct-booking.yaml +113 -113
- package/templates/local-services.yaml +98 -98
- package/templates/olive-oil-tunisia.yaml +88 -88
- package/templates/organic-farm-fresh.yaml +101 -101
- package/templates/restaurant-direct.yaml +97 -97
- package/public/score.html +0 -263
- package/server/migrations/006_growth_suite.sql +0 -138
- package/server/routes/growth.js +0 -962
- package/server/services/fairness-engine.js +0 -409
- package/server/services/fairness.js +0 -420
package/README.md
CHANGED
|
@@ -1,1635 +1,298 @@
|
|
|
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
|
-
โ โ โโโ negotiation.js # Real-time negotiation engine
|
|
300
|
-
โ โ โโโ verification.js # Anti-hallucination shield
|
|
301
|
-
โ โ โโโ reputation.js # Decentralized reputation system
|
|
302
|
-
โ โ โโโ agent-mesh.js # Inter-agent protocol (mesh)
|
|
303
|
-
โ โ โโโ agent-learning.js # Local reinforcement learning (UCB1)
|
|
304
|
-
โ โ โโโ agent-symphony.js # Symphony orchestrator (4 roles, 6 phases)
|
|
305
|
-
โ โ โโโ agent-memory.js # Persistent agent memory with associations
|
|
306
|
-
โ โ โโโ commander.js # Mission orchestration & task DAGs
|
|
307
|
-
โ โ โโโ edge-compute.js # Edge computing / sovereign AI nodes
|
|
308
|
-
โ โ โโโ swarm.js # Swarm execution engine
|
|
309
|
-
โ โ โโโ fairness.js # Fairness & neutrality engine
|
|
310
|
-
โ โ โโโ vision.js # Vision analysis (multi-provider)
|
|
311
|
-
โ โ โโโ self-healing.js # Self-healing selector corrections
|
|
312
|
-
โ โ โโโ local-ai.js # Local AI model runtime
|
|
313
|
-
โ โ โโโ plugins.js # Plugin architecture (hooks, registry)
|
|
314
|
-
โ โ โโโ premium.js # Premium traffic intelligence & bot detection
|
|
315
|
-
โ โ โโโ email.js # SMTP email service
|
|
316
|
-
โ โ โโโ stripe.js # Stripe payment integration
|
|
317
|
-
โ โ โโโ api-key-engine.js # v3.2: API key auth, rate limiting, plans
|
|
318
|
-
โ โ โโโ modules/ # v3.2: API Gateway modules
|
|
319
|
-
โ โ โโโ protocol.js # WAB Protocol validator (open)
|
|
320
|
-
โ โ โโโ agent-firewall.js # Agent Firewall (partial)
|
|
321
|
-
โ โ โโโ price-time-machine.js # Price Time Machine (partial)
|
|
322
|
-
โ โ โโโ bounty.js # Bounty Network (partial)
|
|
323
|
-
โ โ โโโ collective-bargaining.js # Collective Bargaining (partial)
|
|
324
|
-
โ โ โโโ affiliate-intelligence.js # Affiliate Intelligence (partial)
|
|
325
|
-
โ โ โโโ neural.js # Neural Engine (closed)
|
|
326
|
-
โ โ โโโ dark-pattern.js # Dark Pattern Detector (closed)
|
|
327
|
-
โ โ โโโ gov-intelligence.js # Gov Intelligence (closed)
|
|
328
|
-
โ โ โโโ notary.js # Cryptographic Notary (closed)
|
|
329
|
-
โ โโโ middleware/
|
|
330
|
-
โ โ โโโ auth.js # JWT authentication middleware
|
|
331
|
-
โ โ โโโ adminAuth.js # Admin authentication
|
|
332
|
-
โ โ โโโ rateLimits.js # Multi-layer rate limiting
|
|
333
|
-
โ โโโ models/
|
|
334
|
-
โ โ โโโ db.js # Database operations
|
|
335
|
-
โ โ โโโ adapters/ # SQLite, PostgreSQL, MySQL adapters
|
|
336
|
-
โ โโโ migrations/ # Numbered SQL migrations
|
|
337
|
-
โ โโโ utils/
|
|
338
|
-
โ โโโ cache.js # In-memory TTL cache + analytics queue
|
|
339
|
-
โ โโโ migrate.js # Migration runner
|
|
340
|
-
โ โโโ secureFields.js # Field-level encryption utilities
|
|
341
|
-
โโโ public/ # Frontend
|
|
342
|
-
โ โโโ index.html # Landing page
|
|
343
|
-
โ โโโ dashboard.html # Management dashboard
|
|
344
|
-
โ โโโ premium-dashboard.html # Premium analytics dashboard
|
|
345
|
-
โ โโโ docs.html # Documentation
|
|
346
|
-
โ โโโ login.html / register.html # Auth pages
|
|
347
|
-
โ โโโ admin/ # Admin panel
|
|
348
|
-
โ โโโ pwa/ # Progressive Web App (mobile browser)
|
|
349
|
-
โ โ โโโ manifest.json # PWA manifest
|
|
350
|
-
โ โ โโโ sw.js # Service worker (offline-first)
|
|
351
|
-
โ โ โโโ index.html # Mobile browser UI
|
|
352
|
-
โ โ โโโ app.js # Ad blocker, scam shield, fairness
|
|
353
|
-
โ โ โโโ app.css # Mobile-optimized dark theme
|
|
354
|
-
โ โ โโโ icons/ # PWA icons (192x192, 512x512)
|
|
355
|
-
โ โโโ script/
|
|
356
|
-
โ โ โโโ wab.min.js # Minified WAB client library
|
|
357
|
-
โ โ โโโ wab-consent.js # GDPR/CCPA consent banner
|
|
358
|
-
โ โ โโโ wab-schema.js # Schema.org discovery
|
|
359
|
-
โ โ โโโ wab.d.ts # TypeScript definitions
|
|
360
|
-
โ โ โโโ wab-consent.d.ts # Consent TypeScript definitions
|
|
361
|
-
โ โโโ js/ # Dashboard frontend JS
|
|
362
|
-
โ โโโ css/ # Stylesheets
|
|
363
|
-
โโโ script/
|
|
364
|
-
โ โโโ ai-agent-bridge.js # The bridge script (embed in websites)
|
|
365
|
-
โโโ examples/ # Agent examples
|
|
366
|
-
โ โโโ puppeteer-agent.js # Puppeteer + window.AICommands
|
|
367
|
-
โ โโโ bidi-agent.js # WebDriver BiDi protocol
|
|
368
|
-
โ โโโ vision-agent.js # Vision/NLP intent resolution
|
|
369
|
-
โ โโโ mcp-agent.js # MCP adapter usage for Claude/GPT
|
|
370
|
-
โ โโโ cross-site-agent.js # Multi-domain orchestration
|
|
371
|
-
โ โโโ next-app-router/ # Next.js App Router integration
|
|
372
|
-
โ โโโ shopify-hydrogen/ # Shopify Hydrogen storefront
|
|
373
|
-
โ โโโ wordpress-elementor/ # WordPress + Elementor setup
|
|
374
|
-
โ โโโ saas-dashboard/ # SaaS dashboard actions
|
|
375
|
-
โโโ packages/ # Framework wrappers
|
|
376
|
-
โ โโโ react/ # @web-agent-bridge/react
|
|
377
|
-
โ โโโ vue/ # @web-agent-bridge/vue
|
|
378
|
-
โ โโโ svelte/ # @web-agent-bridge/svelte
|
|
379
|
-
โ โโโ langchain/ # @web-agent-bridge/langchain
|
|
380
|
-
โโโ sdk/ # Agent SDK
|
|
381
|
-
โ โโโ index.js # WABAgent for Puppeteer/Playwright
|
|
382
|
-
โ โโโ schema-discovery.js # Server-side schema.org extraction
|
|
383
|
-
โโโ wab-mcp-adapter/ # MCP adapter for Claude/GPT/Gemini
|
|
384
|
-
โ โโโ index.js # MCP tool definitions
|
|
385
|
-
โ โโโ package.json
|
|
386
|
-
โโโ wab-browser/ # Electron desktop browser
|
|
387
|
-
โ โโโ main.js # Electron main process
|
|
388
|
-
โ โโโ preload.js # Bridge preload
|
|
389
|
-
โ โโโ package.json
|
|
390
|
-
โโโ web-agent-bridge-wordpress/ # WordPress plugin
|
|
391
|
-
โ โโโ web-agent-bridge.php # Plugin entry point
|
|
392
|
-
โ โโโ includes/ # PHP classes (API, Actions, Dashboard)
|
|
393
|
-
โ โโโ assets/ # Plugin CSS/JS
|
|
394
|
-
โโโ bin/
|
|
395
|
-
โ โโโ cli.js # CLI entry point (wab-agent)
|
|
396
|
-
โ โโโ wab.js # Agent runner
|
|
397
|
-
โโโ templates/ # 11 Community Agent Hub YAML templates
|
|
398
|
-
โโโ docs/
|
|
399
|
-
โ โโโ SPEC.md # WAB Protocol Specification
|
|
400
|
-
โ โโโ DEPLOY.md # Deployment guide
|
|
401
|
-
โโโ demo-store/ # Demo store for testing
|
|
402
|
-
โโโ deploy/ # Nginx configs
|
|
403
|
-
โโโ tests/ # Jest + Supertest test suite
|
|
404
|
-
โโโ .env # Environment variables
|
|
405
|
-
โโโ package.json
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
---
|
|
409
|
-
|
|
410
|
-
## API Endpoints
|
|
411
|
-
|
|
412
|
-
### Authentication
|
|
413
|
-
| Endpoint | Method | Description |
|
|
414
|
-
|---|---|---|
|
|
415
|
-
| `/api/auth/register` | POST | Create account |
|
|
416
|
-
| `/api/auth/login` | POST | Sign in, receive JWT |
|
|
417
|
-
| `/api/auth/me` | GET | Get current user |
|
|
418
|
-
|
|
419
|
-
### Sites
|
|
420
|
-
| Endpoint | Method | Description |
|
|
421
|
-
|---|---|---|
|
|
422
|
-
| `/api/sites` | GET | List your sites |
|
|
423
|
-
| `/api/sites` | POST | Add a new site |
|
|
424
|
-
| `/api/sites/:id` | GET | Get site details |
|
|
425
|
-
| `/api/sites/:id/config` | PUT | Update configuration |
|
|
426
|
-
| `/api/sites/:id/tier` | PUT | Change subscription tier |
|
|
427
|
-
| `/api/sites/:id` | DELETE | Delete a site |
|
|
428
|
-
| `/api/sites/:id/snippet` | GET | Get install code snippet |
|
|
429
|
-
| `/api/sites/:id/analytics` | GET | Get analytics data |
|
|
430
|
-
|
|
431
|
-
### License (Public)
|
|
432
|
-
| Endpoint | Method | Description |
|
|
433
|
-
|---|---|---|
|
|
434
|
-
| `/api/license/verify` | POST | Verify license key for domain (cached) |
|
|
435
|
-
| `/api/license/token` | POST | Exchange `siteId` (Origin must match domain) or `licenseKey` for session token |
|
|
436
|
-
| `/api/license/session` | POST | Validate session token (domain-locked) |
|
|
437
|
-
| `/api/license/track` | POST | Record analytics (`sessionToken` + Origin) |
|
|
438
|
-
|
|
439
|
-
### Sovereign (v2.0)
|
|
440
|
-
| Endpoint | Method | Description |
|
|
441
|
-
|---|---|---|
|
|
442
|
-
| `/api/sovereign/reputation/agents` | POST | Register a new agent |
|
|
443
|
-
| `/api/sovereign/reputation/attestations` | POST | Submit a trust attestation |
|
|
444
|
-
| `/api/sovereign/reputation/sites/:siteId` | GET | Get site reputation |
|
|
445
|
-
| `/api/sovereign/reputation/leaderboard` | GET | Get reputation leaderboard |
|
|
446
|
-
| `/api/sovereign/negotiation/rules` | POST | Create negotiation rule |
|
|
447
|
-
| `/api/sovereign/negotiation/rules/:siteId` | GET | Get rules for a site |
|
|
448
|
-
| `/api/sovereign/negotiation/sessions` | POST | Open negotiation session |
|
|
449
|
-
| `/api/sovereign/negotiation/sessions/:id/propose` | POST | Submit counter-offer |
|
|
450
|
-
| `/api/sovereign/negotiation/sessions/:id/confirm` | POST | Confirm a deal |
|
|
451
|
-
| `/api/sovereign/verify/price` | POST | Verify price (DOM vs vision) |
|
|
452
|
-
| `/api/sovereign/verify/text` | POST | Verify text accuracy |
|
|
453
|
-
| `/api/sovereign/verify/page` | POST | Full page verification |
|
|
454
|
-
| `/api/sovereign/dashboard/sovereign` | GET | Dashboard aggregate data |
|
|
455
|
-
|
|
456
|
-
### Agent Mesh (v2.3)
|
|
457
|
-
| Endpoint | Method | Description |
|
|
458
|
-
|---|---|---|
|
|
459
|
-
| `/api/mesh/agents` | POST | Register agent in mesh |
|
|
460
|
-
| `/api/mesh/agents` | GET | List mesh agents |
|
|
461
|
-
| `/api/mesh/channels` | GET | List communication channels |
|
|
462
|
-
| `/api/mesh/messages` | POST | Publish message to channel |
|
|
463
|
-
| `/api/mesh/messages/:channel` | GET | Get messages from channel |
|
|
464
|
-
| `/api/mesh/knowledge` | POST | Share knowledge to mesh |
|
|
465
|
-
| `/api/mesh/knowledge` | GET | Query knowledge base |
|
|
466
|
-
| `/api/mesh/votes` | POST | Start a vote |
|
|
467
|
-
| `/api/mesh/votes/:id/cast` | POST | Cast a vote |
|
|
468
|
-
| `/api/mesh/votes/:id/tally` | GET | Get vote results |
|
|
469
|
-
|
|
470
|
-
### Commander (v2.4)
|
|
471
|
-
| Endpoint | Method | Description |
|
|
472
|
-
|---|---|---|
|
|
473
|
-
| `/api/commander/missions` | POST | Create a new mission |
|
|
474
|
-
| `/api/commander/missions/:id/launch` | POST | Launch mission execution |
|
|
475
|
-
| `/api/commander/missions/:id` | GET | Get mission status |
|
|
476
|
-
| `/api/commander/missions` | GET | List all missions |
|
|
477
|
-
| `/api/commander/agents` | POST | Register an agent |
|
|
478
|
-
| `/api/commander/agents` | GET | List registered agents |
|
|
479
|
-
| `/api/commander/edge/nodes` | POST | Register edge node |
|
|
480
|
-
| `/api/commander/edge/nodes` | GET | List edge nodes |
|
|
481
|
-
| `/api/commander/ai/models` | GET | Discover local AI models |
|
|
482
|
-
| `/api/commander/ai/infer` | POST | Run local AI inference |
|
|
483
|
-
| `/api/commander/stats` | GET | Unified platform statistics |
|
|
484
|
-
|
|
485
|
-
### Premium v2
|
|
486
|
-
| Endpoint | Method | Description |
|
|
487
|
-
|---|---|---|
|
|
488
|
-
| `/api/premium/v2/memory` | POST | Store agent memory |
|
|
489
|
-
| `/api/premium/v2/memory/:agentId` | GET | Recall agent memories |
|
|
490
|
-
| `/api/premium/v2/memory/associate` | POST | Create memory association |
|
|
491
|
-
| `/api/premium/v2/memory/:id` | DELETE | Forget a memory |
|
|
492
|
-
| `/api/premium/v2/memory/consolidate` | POST | Consolidate old memories |
|
|
493
|
-
| `/api/premium/v2/vision/analyze` | POST | Analyze screenshot |
|
|
494
|
-
| `/api/premium/v2/vision/elements` | POST | Extract interactive elements |
|
|
495
|
-
| `/api/premium/v2/healing/corrections` | POST | Register selector correction |
|
|
496
|
-
| `/api/premium/v2/healing/resolve` | POST | Resolve broken selector |
|
|
497
|
-
| `/api/premium/v2/swarm/execute` | POST | Launch swarm task |
|
|
498
|
-
| `/api/premium/v2/swarm/:id` | GET | Get swarm results |
|
|
499
|
-
| `/api/premium/v2/plugins` | GET | List available plugins |
|
|
500
|
-
| `/api/premium/v2/plugins/:id/install` | POST | Install plugin for site |
|
|
501
|
-
| `/api/premium/v2/plugins/:id/hooks` | POST | Execute plugin hook |
|
|
502
|
-
|
|
503
|
-
### Discovery & Fairness
|
|
504
|
-
| Endpoint | Method | Description |
|
|
505
|
-
|---|---|---|
|
|
506
|
-
| `/api/discovery` | GET | WAB discovery document |
|
|
507
|
-
| `/api/discovery/search` | GET | Fairness-weighted site search |
|
|
508
|
-
| `/api/discovery/register` | POST | Register site in WAB directory |
|
|
509
|
-
|
|
510
|
-
### WAB Protocol (HTTP Transport)
|
|
511
|
-
| Endpoint | Method | Description |
|
|
512
|
-
|---|---|---|
|
|
513
|
-
| `/api/wab/session` | POST | Exchange session token |
|
|
514
|
-
| `/api/wab/actions` | GET | Get available actions |
|
|
515
|
-
| `/api/wab/execute` | POST | Execute action via HTTP |
|
|
516
|
-
|
|
517
|
-
### NoScript Fallback
|
|
518
|
-
| Endpoint | Method | Description |
|
|
519
|
-
|---|---|---|
|
|
520
|
-
| `/noscript/pixel.gif` | GET | 1ร1 tracking pixel for non-JS environments |
|
|
521
|
-
|
|
522
|
-
---
|
|
523
|
-
|
|
524
|
-
## Bridge Script API
|
|
525
|
-
|
|
526
|
-
Once loaded, `window.AICommands` exposes:
|
|
527
|
-
|
|
528
|
-
| Method | Description |
|
|
529
|
-
|---|---|
|
|
530
|
-
| `getActions(category?)` | List available actions |
|
|
531
|
-
| `getAction(name)` | Get a specific action |
|
|
532
|
-
| `execute(name, params?)` | Execute an action |
|
|
533
|
-
| `readContent(selector)` | Read element content |
|
|
534
|
-
| `getPageInfo()` | Get page and bridge metadata |
|
|
535
|
-
| `waitForElement(selector, timeout?)` | Wait for DOM element |
|
|
536
|
-
| `waitForNavigation(timeout?)` | Wait for URL change |
|
|
537
|
-
| `registerAction(def)` | Register a custom action |
|
|
538
|
-
| `authenticate(key, meta?)` | Authenticate an agent |
|
|
539
|
-
| `refresh()` | Re-scan the page |
|
|
540
|
-
| `onReady(callback)` | Callback when bridge is ready |
|
|
541
|
-
| `events.on(event, cb)` | Subscribe to events |
|
|
542
|
-
|
|
543
|
-
---
|
|
544
|
-
|
|
545
|
-
## Configuration
|
|
546
|
-
|
|
547
|
-
```javascript
|
|
548
|
-
window.AIBridgeConfig = {
|
|
549
|
-
// Recommended โ copy siteId from dashboard snippet (no license key in HTML)
|
|
550
|
-
siteId: "uuid-from-dashboard",
|
|
551
|
-
configEndpoint: "/api/license/token",
|
|
552
|
-
|
|
553
|
-
// Legacy: token exchange via license key (avoid embedding in public pages)
|
|
554
|
-
// licenseKey: "WAB-...",
|
|
555
|
-
|
|
556
|
-
agentPermissions: {
|
|
557
|
-
readContent: true, // Read page text
|
|
558
|
-
click: true, // Click elements
|
|
559
|
-
fillForms: false, // Fill/submit forms
|
|
560
|
-
scroll: true, // Scroll page
|
|
561
|
-
navigate: false, // Navigate pages
|
|
562
|
-
apiAccess: false, // Internal API calls (Pro+)
|
|
563
|
-
automatedLogin: false, // Auto login (Starter+)
|
|
564
|
-
extractData: false // Data extraction (Pro+)
|
|
565
|
-
},
|
|
566
|
-
restrictions: {
|
|
567
|
-
allowedSelectors: [],
|
|
568
|
-
blockedSelectors: [".private", "[data-private]"],
|
|
569
|
-
requireLoginForActions: ["apiAccess"],
|
|
570
|
-
rateLimit: { maxCallsPerMinute: 60 }
|
|
571
|
-
},
|
|
572
|
-
logging: { enabled: false, level: "basic" }
|
|
573
|
-
};
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
---
|
|
577
|
-
|
|
578
|
-
## Subscription Tiers
|
|
579
|
-
|
|
580
|
-
| Feature | Free | Starter | Pro | Enterprise |
|
|
581
|
-
|---|:---:|:---:|:---:|:---:|
|
|
582
|
-
| Auto-discovery | โ | โ | โ | โ |
|
|
583
|
-
| Click/Scroll | โ | โ | โ | โ |
|
|
584
|
-
| Form filling | โ | โ | โ | โ |
|
|
585
|
-
| Basic logging | โ | โ | โ | โ |
|
|
586
|
-
| Automated login | โ | โ | โ | โ |
|
|
587
|
-
| Analytics dashboard | โ | โ | โ | โ |
|
|
588
|
-
| API access | โ | โ | โ | โ |
|
|
589
|
-
| Data extraction | โ | โ | โ | โ |
|
|
590
|
-
| Custom rate limits | โ | โ | โ | โ |
|
|
591
|
-
| Webhooks | โ | โ | โ | โ |
|
|
592
|
-
|
|
593
|
-
---
|
|
594
|
-
|
|
595
|
-
## Tech Stack
|
|
596
|
-
|
|
597
|
-
- **Backend**: Node.js + Express + WebSocket (ws)
|
|
598
|
-
- **Database**: SQLite (via better-sqlite3) with migration runner
|
|
599
|
-
- **Auth**: JWT + bcrypt + session tokens (domain-locked)
|
|
600
|
-
- **Caching**: In-memory TTL cache + batched analytics queue
|
|
601
|
-
- **Payments**: Stripe integration with billing portal
|
|
602
|
-
- **Frontend**: Vanilla HTML/CSS/JS (no framework dependencies)
|
|
603
|
-
- **Framework Wrappers**: React, Vue 3, Svelte (optional)
|
|
604
|
-
- **LLM Integration**: LangChain adapter, MCP adapter
|
|
605
|
-
- **Security**: Helmet, CORS, CSP, multi-layer rate limiting
|
|
606
|
-
- **Containers**: Docker + Docker Compose
|
|
607
|
-
- **CI/CD**: GitHub Actions (test + auto-publish to npm)
|
|
608
|
-
- **Testing**: Jest + Supertest
|
|
609
|
-
|
|
610
|
-
---
|
|
611
|
-
|
|
612
|
-
## WebDriver BiDi Compatibility
|
|
613
|
-
|
|
614
|
-
WAB exposes a `window.__wab_bidi` interface for agents using standardized WebDriver BiDi protocol:
|
|
615
|
-
|
|
616
|
-
```javascript
|
|
617
|
-
// Get BiDi context
|
|
618
|
-
const context = window.__wab_bidi.getContext();
|
|
619
|
-
|
|
620
|
-
// Send BiDi command
|
|
621
|
-
const result = await window.__wab_bidi.send({
|
|
622
|
-
id: 1,
|
|
623
|
-
method: 'wab.executeAction',
|
|
624
|
-
params: { name: 'signup', data: {} }
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
// Supported methods:
|
|
628
|
-
// wab.getContext, wab.getActions, wab.executeAction, wab.readContent, wab.getPageInfo
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
---
|
|
632
|
-
|
|
633
|
-
## Real-Time Analytics (WebSocket)
|
|
634
|
-
|
|
635
|
-
Connect to `ws://localhost:3000/ws/analytics` for live analytics. Use the built-in `WABWebSocket` client for automatic reconnection with exponential backoff:
|
|
636
|
-
|
|
637
|
-
```javascript
|
|
638
|
-
// Recommended: use the auto-reconnecting client
|
|
639
|
-
import { WABWebSocket } from './js/ws-client.js';
|
|
640
|
-
|
|
641
|
-
const ws = new WABWebSocket('jwt-token', 'site-id');
|
|
642
|
-
ws.on('analytic', (data) => console.log(data));
|
|
643
|
-
ws.on('reconnecting', ({ attempt, delay }) => console.log(`Reconnecting #${attempt}...`));
|
|
644
|
-
ws.connect();
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
```javascript
|
|
648
|
-
// Or connect manually
|
|
649
|
-
const ws = new WebSocket('ws://localhost:3000/ws/analytics');
|
|
650
|
-
ws.onopen = () => ws.send(JSON.stringify({ type: 'auth', token: 'jwt-token', siteId: 'site-id' }));
|
|
651
|
-
ws.onmessage = (e) => console.log(JSON.parse(e.data));
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
### WebSocket Message Protocol
|
|
655
|
-
|
|
656
|
-
**Client โ Server Messages:**
|
|
657
|
-
|
|
658
|
-
| Message | Fields | Description |
|
|
659
|
-
|---|---|---|
|
|
660
|
-
| `auth` | `type`, `token`, `siteId` | Authenticate and subscribe to a site's events |
|
|
661
|
-
|
|
662
|
-
```json
|
|
663
|
-
{ "type": "auth", "token": "eyJhbGciOi...", "siteId": "uuid-of-site" }
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
**Server โ Client Messages:**
|
|
667
|
-
|
|
668
|
-
| Message Type | Fields | Description |
|
|
669
|
-
|---|---|---|
|
|
670
|
-
| `auth:success` | `type`, `siteId` | Authentication succeeded |
|
|
671
|
-
| `analytic` | `type`, `timestamp`, `actionName`, `agentId`, `success` | Real-time analytics event |
|
|
672
|
-
| `error` | `type`, `message` | Error (invalid auth, malformed message) |
|
|
673
|
-
|
|
674
|
-
```json
|
|
675
|
-
// Success response
|
|
676
|
-
{ "type": "auth:success", "siteId": "uuid-of-site" }
|
|
677
|
-
|
|
678
|
-
// Analytics event
|
|
679
|
-
{
|
|
680
|
-
"type": "analytic",
|
|
681
|
-
"timestamp": "2024-01-15T10:30:00.000Z",
|
|
682
|
-
"actionName": "click-signup",
|
|
683
|
-
"agentId": "agent-123",
|
|
684
|
-
"triggerType": "click",
|
|
685
|
-
"success": true
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// Error
|
|
689
|
-
{ "type": "error", "message": "Invalid message or auth failed" }
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
**Connection Lifecycle:**
|
|
693
|
-
1. Connect to `ws://host:port/ws/analytics`
|
|
694
|
-
2. Send `auth` message with valid JWT and site ID
|
|
695
|
-
3. Receive `auth:success` confirmation
|
|
696
|
-
4. Receive `analytic` events as they occur
|
|
697
|
-
5. Server sends heartbeat pings every 30 seconds โ dead connections are cleaned up automatically
|
|
698
|
-
|
|
699
|
-
---
|
|
700
|
-
|
|
701
|
-
## CDN & Versioning
|
|
702
|
-
|
|
703
|
-
Scripts are served at versioned URLs for cache-safe deployments:
|
|
704
|
-
|
|
705
|
-
| URL | Description |
|
|
706
|
-
|---|---|
|
|
707
|
-
| `/script/ai-agent-bridge.js` | Default path |
|
|
708
|
-
| `/v1/ai-agent-bridge.js` | Version-pinned (recommended) |
|
|
709
|
-
| `/latest/ai-agent-bridge.js` | Always latest (use with caution) |
|
|
710
|
-
|
|
711
|
-
---
|
|
712
|
-
|
|
713
|
-
## Docker
|
|
714
|
-
|
|
715
|
-
```bash
|
|
716
|
-
# Quick start
|
|
717
|
-
docker compose up -d
|
|
718
|
-
|
|
719
|
-
# Or build manually
|
|
720
|
-
docker build -t web-agent-bridge .
|
|
721
|
-
docker run -p 3000:3000 -e JWT_SECRET=your-secret -e JWT_SECRET_ADMIN=your-admin-secret web-agent-bridge
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
---
|
|
725
|
-
|
|
726
|
-
## Testing
|
|
727
|
-
|
|
728
|
-
```bash
|
|
729
|
-
npm test
|
|
730
|
-
```
|
|
731
|
-
|
|
732
|
-
Tests cover: authentication, site CRUD, config management, license verification, analytics tracking, and static pages.
|
|
733
|
-
|
|
734
|
-
---
|
|
735
|
-
|
|
736
|
-
## Agent SDK
|
|
737
|
-
|
|
738
|
-
WAB includes a built-in SDK for building AI agents. See [`sdk/README.md`](sdk/README.md) for full documentation.
|
|
739
|
-
|
|
740
|
-
```javascript
|
|
741
|
-
const puppeteer = require('puppeteer');
|
|
742
|
-
const { WABAgent } = require('web-agent-bridge/sdk');
|
|
743
|
-
|
|
744
|
-
const browser = await puppeteer.launch();
|
|
745
|
-
const page = await browser.newPage();
|
|
746
|
-
const agent = new WABAgent(page);
|
|
747
|
-
|
|
748
|
-
await agent.navigateAndWait('https://example.com');
|
|
749
|
-
const actions = await agent.getActions();
|
|
750
|
-
await agent.execute('signup', { email: 'user@test.com' });
|
|
751
|
-
await browser.close();
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
### SDK Extras
|
|
755
|
-
|
|
756
|
-
The SDK now includes additional helpers for advanced agent workflows:
|
|
757
|
-
|
|
758
|
-
```javascript
|
|
759
|
-
// Wait for GDPR consent before proceeding
|
|
760
|
-
await agent.waitForConsent();
|
|
761
|
-
|
|
762
|
-
// Discover all actions + page meta
|
|
763
|
-
const disc = await agent.discover();
|
|
764
|
-
console.log(disc.actions, disc.meta);
|
|
765
|
-
|
|
766
|
-
// Run a sequence of actions (stops on first failure by default)
|
|
767
|
-
const results = await agent.runPipeline([
|
|
768
|
-
{ name: 'login', params: { email: 'a@b.com', pass: 'secret' } },
|
|
769
|
-
{ name: 'addToCart', params: { sku: 'ABC123' } },
|
|
770
|
-
{ name: 'checkout' }
|
|
771
|
-
]);
|
|
772
|
-
|
|
773
|
-
// Run actions in parallel
|
|
774
|
-
const parallel = await agent.executeParallel([
|
|
775
|
-
{ name: 'getCartCount' },
|
|
776
|
-
{ name: 'getWishlistCount' }
|
|
777
|
-
]);
|
|
778
|
-
|
|
779
|
-
// Capture screenshot (base64) for vision agents
|
|
780
|
-
const b64 = await agent.screenshot({ fullPage: true });
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
---
|
|
784
|
-
|
|
785
|
-
## Framework Packages
|
|
786
|
-
|
|
787
|
-
### Vue 3
|
|
788
|
-
|
|
789
|
-
```bash
|
|
790
|
-
npm install @web-agent-bridge/vue
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
```javascript
|
|
794
|
-
import { useWAB, useWABAction } from '@web-agent-bridge/vue';
|
|
795
|
-
|
|
796
|
-
// In setup()
|
|
797
|
-
const { ready, execute } = useWAB({ siteUrl: 'https://example.com' });
|
|
798
|
-
const cart = useWABAction('addToCart');
|
|
799
|
-
|
|
800
|
-
// In template handler
|
|
801
|
-
await cart.run({ sku: 'ABC123' });
|
|
802
|
-
console.log(cart.result.value);
|
|
803
|
-
```
|
|
804
|
-
|
|
805
|
-
### Svelte
|
|
806
|
-
|
|
807
|
-
```bash
|
|
808
|
-
npm install @web-agent-bridge/svelte
|
|
809
|
-
```
|
|
810
|
-
|
|
811
|
-
```svelte
|
|
812
|
-
<script>
|
|
813
|
-
import { createWAB, createWABAction } from '@web-agent-bridge/svelte';
|
|
814
|
-
|
|
815
|
-
const wab = createWAB();
|
|
816
|
-
const cart = createWABAction('addToCart');
|
|
817
|
-
|
|
818
|
-
async function add() {
|
|
819
|
-
await cart.run({ sku: 'ABC123' });
|
|
820
|
-
}
|
|
821
|
-
</script>
|
|
822
|
-
|
|
823
|
-
{#if $cart.loading}Adding...{/if}
|
|
824
|
-
{#if $cart.result}Added!{/if}
|
|
825
|
-
<button on:click={add}>Add to Cart</button>
|
|
826
|
-
```
|
|
827
|
-
|
|
828
|
-
### LangChain / LangGraph
|
|
829
|
-
|
|
830
|
-
```bash
|
|
831
|
-
npm install @web-agent-bridge/langchain
|
|
832
|
-
```
|
|
833
|
-
|
|
834
|
-
```javascript
|
|
835
|
-
const { WABToolkit } = require('@web-agent-bridge/langchain');
|
|
836
|
-
const { ChatOpenAI } = require('@langchain/openai');
|
|
837
|
-
const { AgentExecutor, createOpenAIToolsAgent } = require('langchain/agents');
|
|
838
|
-
|
|
839
|
-
// HTTP mode โ discover + execute via the WAB server
|
|
840
|
-
const toolkit = new WABToolkit({ siteUrl: 'https://shop.example.com' });
|
|
841
|
-
const tools = await toolkit.getTools();
|
|
842
|
-
|
|
843
|
-
// Browser mode โ use with Puppeteer/Playwright
|
|
844
|
-
const { WABAgent } = require('web-agent-bridge/sdk');
|
|
845
|
-
const toolkit2 = new WABToolkit({ agent: new WABAgent(page) });
|
|
846
|
-
const tools2 = await toolkit2.getTools();
|
|
847
|
-
|
|
848
|
-
// Pass tools to any LangChain agent
|
|
849
|
-
const llm = new ChatOpenAI({ model: 'gpt-4o' });
|
|
850
|
-
const agent = await createOpenAIToolsAgent({ llm, tools, prompt });
|
|
851
|
-
const executor = new AgentExecutor({ agent, tools });
|
|
852
|
-
await executor.invoke({ input: 'Add the first product to my cart' });
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
---
|
|
856
|
-
|
|
857
|
-
## GDPR / CCPA Consent
|
|
858
|
-
|
|
859
|
-
Load the consent script after `wab.min.js` to gate agent actions behind user consent:
|
|
860
|
-
|
|
861
|
-
```html
|
|
862
|
-
<script src="/script/wab.min.js"></script>
|
|
863
|
-
<script src="/script/wab-consent.js"></script>
|
|
864
|
-
<script>
|
|
865
|
-
WABConsent.showBanner({
|
|
866
|
-
policyUrl: '/privacy',
|
|
867
|
-
message: 'Allow AI agents to interact with this page?',
|
|
868
|
-
onAccept: () => WAB.init({ siteUrl: location.origin }),
|
|
869
|
-
onDecline: () => console.log('Agent access declined')
|
|
870
|
-
});
|
|
871
|
-
</script>
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
SDK agents can check consent programmatically:
|
|
875
|
-
|
|
876
|
-
```javascript
|
|
877
|
-
const agent = new WABAgent(page);
|
|
878
|
-
const ok = await agent.hasConsent(); // true | false
|
|
879
|
-
await agent.waitForConsent(); // blocks until Allow is clicked
|
|
880
|
-
```
|
|
881
|
-
|
|
882
|
-
---
|
|
883
|
-
|
|
884
|
-
## Agent Examples
|
|
885
|
-
|
|
886
|
-
Ready-to-run agent examples in the [`examples/`](examples/) directory:
|
|
887
|
-
|
|
888
|
-
| File | Description |
|
|
889
|
-
|---|---|
|
|
890
|
-
| `puppeteer-agent.js` | Basic agent using Puppeteer + `window.AICommands` |
|
|
891
|
-
| `bidi-agent.js` | Agent using WebDriver BiDi protocol via `window.__wab_bidi` |
|
|
892
|
-
| `vision-agent.js` | Vision/NLP agent โ resolves natural language intents to actions using a local keyword-based resolver (no external API) |
|
|
893
|
-
| `mcp-agent.js` | MCP adapter usage for Claude and GPT with tool discovery and execution |
|
|
894
|
-
| `cross-site-agent.js` | Multi-domain orchestration โ compare prices across stores, aggregate data, find best deals |
|
|
895
|
-
|
|
896
|
-
## Framework + CMS Examples
|
|
897
|
-
|
|
898
|
-
Additional integration examples are available in:
|
|
899
|
-
|
|
900
|
-
| Path | Description |
|
|
901
|
-
|---|---|
|
|
902
|
-
| `examples/next-app-router/` | Next.js App Router integration with `@web-agent-bridge/react` |
|
|
903
|
-
| `examples/shopify-hydrogen/` | Hydrogen storefront integration with practical cart actions |
|
|
904
|
-
| `examples/wordpress-elementor/` | WordPress + Elementor setup with schema-assisted actions |
|
|
905
|
-
| `examples/saas-dashboard/` | Notion-style SaaS dashboard actions for KPI read + workflow triggers |
|
|
906
|
-
|
|
907
|
-
```bash
|
|
908
|
-
node examples/puppeteer-agent.js http://localhost:3000
|
|
909
|
-
node examples/bidi-agent.js http://localhost:3000
|
|
910
|
-
node examples/vision-agent.js http://localhost:3000
|
|
911
|
-
```
|
|
912
|
-
|
|
913
|
-
---
|
|
914
|
-
|
|
915
|
-
## Multi-Database Support
|
|
916
|
-
|
|
917
|
-
WAB defaults to SQLite but supports PostgreSQL and MySQL via database adapters.
|
|
918
|
-
|
|
919
|
-
```bash
|
|
920
|
-
# SQLite (default โ no setup needed)
|
|
921
|
-
npm start
|
|
922
|
-
|
|
923
|
-
# PostgreSQL
|
|
924
|
-
npm install pg
|
|
925
|
-
DB_ADAPTER=postgresql DATABASE_URL=postgres://user:pass@localhost:5432/wab npm start
|
|
926
|
-
|
|
927
|
-
# MySQL
|
|
928
|
-
npm install mysql2
|
|
929
|
-
DB_ADAPTER=mysql DATABASE_URL=mysql://user:pass@localhost:3306/wab npm start
|
|
930
|
-
```
|
|
931
|
-
|
|
932
|
-
### When to Choose Which Database
|
|
933
|
-
|
|
934
|
-
| Scenario | Recommended DB | Why |
|
|
935
|
-
|---|---|---|
|
|
936
|
-
| Local dev / prototyping | SQLite | Zero setup, single file, instant |
|
|
937
|
-
| Small production (< 100 sites) | SQLite | Fast, no external dependencies |
|
|
938
|
-
| Medium production (100-10K sites) | PostgreSQL | Better concurrency, JSONB support |
|
|
939
|
-
| Large / enterprise production | PostgreSQL | Replication, backups, scalability |
|
|
940
|
-
| Existing MySQL infrastructure | MySQL | Integrate with what you already use |
|
|
941
|
-
|
|
942
|
-
See [`server/models/adapters/`](server/models/adapters/) for adapter implementations.
|
|
943
|
-
|
|
944
|
-
---
|
|
945
|
-
|
|
946
|
-
## Security Architecture
|
|
947
|
-
|
|
948
|
-
WAB implements defense-in-depth to protect the bridge from misuse:
|
|
949
|
-
|
|
950
|
-
### Secure License Exchange
|
|
951
|
-
|
|
952
|
-
1. **Dashboard snippet (recommended):** `siteId` + `configEndpoint`. The browser sends `POST /api/license/token` with `{ siteId }`; the server checks **Origin** against the siteโs registered domain and issues a session token.
|
|
953
|
-
2. **Legacy:** `licenseKey` + `configEndpoint` (or deprecated `_licenseKey`) still works for token exchange but should not be embedded in public HTML.
|
|
954
|
-
3. **Session** is domain-locked (1h TTL); **analytics** use `sessionToken` on `POST /api/license/track` (not the license key).
|
|
955
|
-
4. **WebSocket** `/ws/analytics`: user JWT must **own** the `siteId`; admin JWT may observe any site.
|
|
956
|
-
|
|
957
|
-
```
|
|
958
|
-
Client Server
|
|
959
|
-
โโโ POST /api/license/token โโโโ { siteId } + Origin header
|
|
960
|
-
โ โ domain match โ sessionToken
|
|
961
|
-
โโโโ { sessionToken, tier } โโโ
|
|
962
|
-
โโโ POST /api/license/track โโโ { sessionToken, actionName } + Origin
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
**Production:** set `JWT_SECRET`, `JWT_SECRET_ADMIN`, `STRIPE_WEBHOOK_SECRET`, `ALLOWED_ORIGINS`, and create the first admin via `BOOTSTRAP_ADMIN_*` or `node scripts/create-admin.js`.
|
|
966
|
-
|
|
967
|
-
### Security Sandbox
|
|
968
|
-
|
|
969
|
-
Every bridge instance runs inside a `SecuritySandbox` that provides:
|
|
970
|
-
|
|
971
|
-
- **Session tokens** โ Unique cryptographic token per session prevents replay attacks
|
|
972
|
-
- **Origin validation** โ Only whitelisted origins can interact with the bridge
|
|
973
|
-
- **Command validation** โ All commands are validated for format, length, and blocklist
|
|
974
|
-
- **Audit logging** โ Every action is logged with timestamp, agent fingerprint, and status
|
|
975
|
-
- **Escalation protection** โ Attempts to access higher-tier features trigger automatic lockdown after 5 violations
|
|
976
|
-
- **Auto-lockdown** โ Bridge becomes read-only when security violations are detected
|
|
977
|
-
|
|
978
|
-
```javascript
|
|
979
|
-
// Get security status
|
|
980
|
-
const info = bridge.getPageInfo();
|
|
981
|
-
console.log(info.security);
|
|
982
|
-
// { sandboxActive: true, locked: false, sessionToken: "a3f2..." }
|
|
983
|
-
|
|
984
|
-
// View audit log
|
|
985
|
-
const audit = bridge.security.getAuditLog(20);
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
### Selector Restrictions
|
|
989
|
-
|
|
990
|
-
Block sensitive page sections from agent access:
|
|
991
|
-
|
|
992
|
-
```javascript
|
|
993
|
-
window.AIBridgeConfig = {
|
|
994
|
-
restrictions: {
|
|
995
|
-
blockedSelectors: [".private", "[data-private]", "#payment-form"],
|
|
996
|
-
allowedSelectors: [".public-content"]
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
```
|
|
1000
|
-
|
|
1001
|
-
---
|
|
1002
|
-
|
|
1003
|
-
## Self-Healing Selectors
|
|
1004
|
-
|
|
1005
|
-
Modern SPAs frequently change their DOM structure. WAB's self-healing system ensures selectors keep working even when the page changes:
|
|
1006
|
-
|
|
1007
|
-
### How It Works
|
|
1008
|
-
|
|
1009
|
-
1. **Fingerprinting** โ When actions are discovered, WAB stores a rich fingerprint of each element (tag, id, classes, text, ARIA attributes, position)
|
|
1010
|
-
2. **7-Strategy Resolution** โ When a selector breaks, WAB tries these strategies in order:
|
|
1011
|
-
- `data-wab-id` attribute (most stable โ add to your HTML)
|
|
1012
|
-
- `data-testid` attribute
|
|
1013
|
-
- Element ID
|
|
1014
|
-
- `aria-label` (semantic, usually survives redesigns)
|
|
1015
|
-
- `name` attribute
|
|
1016
|
-
- Fuzzy text matching (bigram similarity > 70%)
|
|
1017
|
-
- Role + position heuristic
|
|
1018
|
-
3. **SPA Observer** โ A `MutationObserver` watches for DOM changes and automatically re-discovers actions with a 500ms debounce
|
|
1019
|
-
|
|
1020
|
-
```javascript
|
|
1021
|
-
// Check healing stats
|
|
1022
|
-
const info = bridge.getPageInfo();
|
|
1023
|
-
console.log(info.selfHealing);
|
|
1024
|
-
// { tracked: 12, healed: 3, failed: 0 }
|
|
1025
|
-
|
|
1026
|
-
// Listen for healing events
|
|
1027
|
-
bridge.events.on('selector:healed', (data) => {
|
|
1028
|
-
console.log(`Healed: ${data.action} via ${data.strategy}`);
|
|
1029
|
-
});
|
|
1030
|
-
```
|
|
1031
|
-
|
|
1032
|
-
### Best Practices for Site Owners
|
|
1033
|
-
|
|
1034
|
-
Add `data-wab-id` attributes to critical elements for maximum stability:
|
|
1035
|
-
|
|
1036
|
-
```html
|
|
1037
|
-
<button data-wab-id="signup-btn">Sign Up</button>
|
|
1038
|
-
<form data-wab-id="login-form">...</form>
|
|
1039
|
-
```
|
|
1040
|
-
|
|
1041
|
-
---
|
|
1042
|
-
|
|
1043
|
-
## Stealth Mode
|
|
1044
|
-
|
|
1045
|
-
For sites with anti-bot protection, WAB can simulate human-like interaction patterns. **Stealth mode requires explicit consent** to ensure ethical use.
|
|
1046
|
-
|
|
1047
|
-
```javascript
|
|
1048
|
-
window.AIBridgeConfig = {
|
|
1049
|
-
stealth: {
|
|
1050
|
-
enabled: true,
|
|
1051
|
-
consent: true // Required โ confirms site owner authorizes human-like patterns
|
|
1052
|
-
}
|
|
1053
|
-
};
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
> **โ ๏ธ Ethical Use Policy:** Stealth mode is designed for accessibility and testing on your own websites. Using it to bypass security controls on sites you do not own may violate terms of service and applicable laws.
|
|
1057
|
-
|
|
1058
|
-
When enabled, all interactions use:
|
|
1059
|
-
|
|
1060
|
-
| Feature | Description |
|
|
1061
|
-
|---|---|
|
|
1062
|
-
| **Mouse event chain** | `mouseover โ mouseenter โ mousemove โ mousedown โ mouseup โ click` with natural coordinates |
|
|
1063
|
-
| **Typing simulation** | Character-by-character input with 30-120ms delays per keystroke |
|
|
1064
|
-
| **Scroll easing** | Multi-step scrolling with variable speed |
|
|
1065
|
-
| **Random delays** | 50-400ms natural pauses between actions |
|
|
1066
|
-
|
|
1067
|
-
```javascript
|
|
1068
|
-
// Enable/disable at runtime (consent required)
|
|
1069
|
-
bridge.stealth.enable(true); // true = consent granted
|
|
1070
|
-
bridge.stealth.disable();
|
|
1071
|
-
```
|
|
1072
|
-
|
|
1073
|
-
---
|
|
1074
|
-
|
|
1075
|
-
## CLI
|
|
1076
|
-
|
|
1077
|
-
Install globally or use via npx:
|
|
1078
|
-
|
|
1079
|
-
```bash
|
|
1080
|
-
# Run the server
|
|
1081
|
-
npx web-agent-bridge start
|
|
1082
|
-
npx web-agent-bridge start --port 8080
|
|
1083
|
-
|
|
1084
|
-
# Initialize a new project
|
|
1085
|
-
npx web-agent-bridge init
|
|
1086
|
-
```
|
|
1087
|
-
|
|
1088
|
-
---
|
|
1089
|
-
|
|
1090
|
-
## Environment Variables
|
|
1091
|
-
|
|
1092
|
-
See `.env.example`. Important:
|
|
1093
|
-
|
|
1094
|
-
```
|
|
1095
|
-
PORT=3000
|
|
1096
|
-
NODE_ENV=development
|
|
1097
|
-
JWT_SECRET=long-random-user-signing-secret
|
|
1098
|
-
JWT_SECRET_ADMIN=long-random-admin-signing-secret # required in production
|
|
1099
|
-
ALLOWED_ORIGINS=http://localhost:3000,https://your-app.com
|
|
1100
|
-
STRIPE_WEBHOOK_SECRET=whsec_... # Stripe webhook verify
|
|
1101
|
-
CREDENTIALS_ENCRYPTION_KEY=... # optional SMTP password encryption
|
|
1102
|
-
DB_ADAPTER=sqlite
|
|
1103
|
-
DATABASE_URL=
|
|
1104
|
-
```
|
|
1105
|
-
|
|
1106
|
-
First admin: set `BOOTSTRAP_ADMIN_EMAIL` / `BOOTSTRAP_ADMIN_PASSWORD` when the `admins` table is empty, or run `node scripts/create-admin.js <email> <password>`.
|
|
1107
|
-
|
|
1108
|
-
---
|
|
1109
|
-
|
|
1110
|
-
## Real-time Negotiation Engine
|
|
1111
|
-
|
|
1112
|
-
Site owners define negotiation rules. AI agents negotiate prices in multi-round sessions:
|
|
1113
|
-
|
|
1114
|
-
```javascript
|
|
1115
|
-
// Agent opens a negotiation session
|
|
1116
|
-
const session = await fetch('/api/sovereign/negotiation/sessions', {
|
|
1117
|
-
method: 'POST',
|
|
1118
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1119
|
-
body: JSON.stringify({
|
|
1120
|
-
siteId: 'site-uuid',
|
|
1121
|
-
agentId: 'agent-id',
|
|
1122
|
-
originalPrice: 49.99,
|
|
1123
|
-
itemId: 'product-123',
|
|
1124
|
-
itemName: 'Olive Oil 1L'
|
|
1125
|
-
})
|
|
1126
|
-
}).then(r => r.json());
|
|
1127
|
-
|
|
1128
|
-
// Agent makes a counter-offer
|
|
1129
|
-
const counter = await fetch(`/api/sovereign/negotiation/sessions/${session.sessionId}/propose`, {
|
|
1130
|
-
method: 'POST',
|
|
1131
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1132
|
-
body: JSON.stringify({
|
|
1133
|
-
agentId: 'agent-id',
|
|
1134
|
-
proposedPrice: 39.99
|
|
1135
|
-
})
|
|
1136
|
-
}).then(r => r.json());
|
|
1137
|
-
// โ { status: 'accepted', finalPrice: 42.49, message: 'Deal! ...' }
|
|
1138
|
-
```
|
|
1139
|
-
|
|
1140
|
-
### Condition Types
|
|
1141
|
-
| Condition | Description |
|
|
1142
|
-
|---|---|
|
|
1143
|
-
| `bulk_quantity` | Discounts based on order quantity |
|
|
1144
|
-
| `loyalty` | Rewards for repeat customers |
|
|
1145
|
-
| `time_based` | Happy hour / flash sale windows |
|
|
1146
|
-
| `first_purchase` | Welcome discount for new buyers |
|
|
1147
|
-
| `cart_value` | Minimum cart value threshold |
|
|
1148
|
-
| `seasonal` | Date-range seasonal promotions |
|
|
1149
|
-
| `membership` | Member-only pricing |
|
|
1150
|
-
| `referral` | Referral-based discounts |
|
|
1151
|
-
|
|
1152
|
-
---
|
|
1153
|
-
|
|
1154
|
-
## Anti-Hallucination Shield
|
|
1155
|
-
|
|
1156
|
-
Cross-verification engine that catches AI hallucinations before they reach users:
|
|
1157
|
-
|
|
1158
|
-
```javascript
|
|
1159
|
-
// Verify a price
|
|
1160
|
-
const result = await fetch('/api/sovereign/verify/price', {
|
|
1161
|
-
method: 'POST',
|
|
1162
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1163
|
-
body: JSON.stringify({
|
|
1164
|
-
siteId: 'site-uuid',
|
|
1165
|
-
domValue: 29.99,
|
|
1166
|
-
visionValue: 29.99,
|
|
1167
|
-
category: 'electronics',
|
|
1168
|
-
itemName: 'USB Cable'
|
|
1169
|
-
})
|
|
1170
|
-
}).then(r => r.json());
|
|
1171
|
-
// โ { verified: true, confidence: 0.98, severity: 'none', layers: { dom_vision: { match: true }, ... } }
|
|
1172
|
-
|
|
1173
|
-
// Verify text content
|
|
1174
|
-
const textResult = await fetch('/api/sovereign/verify/text', {
|
|
1175
|
-
method: 'POST',
|
|
1176
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1177
|
-
body: JSON.stringify({
|
|
1178
|
-
siteId: 'site-uuid',
|
|
1179
|
-
source: 'dom',
|
|
1180
|
-
value: 'Free shipping on orders over $50',
|
|
1181
|
-
expected: 'Free shipping on orders over $50'
|
|
1182
|
-
})
|
|
1183
|
-
}).then(r => r.json());
|
|
1184
|
-
// โ { verified: true, similarity: 1.0 }
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
### Verification Layers
|
|
1188
|
-
1. **DOM vs Vision** โ Compares DOM-extracted price with screenshot OCR value
|
|
1189
|
-
2. **Market Benchmark** โ Validates against historical price benchmarks for the category
|
|
1190
|
-
3. **Temporal Consistency** โ Checks if price changed suspiciously since last verification
|
|
1191
|
-
4. **Composite Score** โ Weighted combination of all layers with severity classification
|
|
1192
|
-
|
|
1193
|
-
---
|
|
1194
|
-
|
|
1195
|
-
## Community Agent Hub
|
|
1196
|
-
|
|
1197
|
-
Pre-built YAML agent templates for common use cases. Run any template from the CLI:
|
|
1198
|
-
|
|
1199
|
-
```bash
|
|
1200
|
-
# List available templates
|
|
1201
|
-
npx wab-agent templates
|
|
1202
|
-
|
|
1203
|
-
# Run a template
|
|
1204
|
-
npx wab-agent run olive-oil-tunisia --budget 50 --region tunis
|
|
1205
|
-
|
|
1206
|
-
# Run with custom server
|
|
1207
|
-
npx wab-agent run hotel-direct-booking --server https://yourserver.com --checkin 2025-01-15
|
|
1208
|
-
```
|
|
1209
|
-
|
|
1210
|
-
### Available Templates
|
|
1211
|
-
| Template | Description |
|
|
1212
|
-
|---|---|
|
|
1213
|
-
| `olive-oil-tunisia` | Find olive oil from small Tunisian farms |
|
|
1214
|
-
| `hotel-direct-booking` | Book hotels directly, bypass aggregators |
|
|
1215
|
-
| `artisan-marketplace` | Handmade products from independent artisans |
|
|
1216
|
-
| `grocery-price-compare` | Compare grocery prices across local stores |
|
|
1217
|
-
| `freelancer-direct` | Find freelancers without platform fees |
|
|
1218
|
-
| `restaurant-direct` | Order from restaurants without delivery apps |
|
|
1219
|
-
| `book-price-scout` | Find books from indie bookstores |
|
|
1220
|
-
| `flight-deal-hunter` | Find flights direct from airlines |
|
|
1221
|
-
| `electronics-price-tracker` | Track electronics prices with history |
|
|
1222
|
-
| `local-services` | Find local service providers |
|
|
1223
|
-
| `organic-farm-fresh` | Organic produce direct from farms |
|
|
1224
|
-
|
|
1225
|
-
### Create Your Own Template
|
|
1226
|
-
|
|
1227
|
-
```yaml
|
|
1228
|
-
name: my-custom-agent
|
|
1229
|
-
description: My custom agent template
|
|
1230
|
-
goal: Find the best deals on custom products
|
|
1231
|
-
version: "1.0"
|
|
1232
|
-
target_sites:
|
|
1233
|
-
- https://example.com
|
|
1234
|
-
parameters:
|
|
1235
|
-
budget:
|
|
1236
|
-
type: number
|
|
1237
|
-
default: 100
|
|
1238
|
-
description: Maximum budget
|
|
1239
|
-
actions:
|
|
1240
|
-
- name: discover
|
|
1241
|
-
wab_action: discover
|
|
1242
|
-
- name: search
|
|
1243
|
-
wab_action: execute
|
|
1244
|
-
action_name: search
|
|
1245
|
-
params:
|
|
1246
|
-
query: "{{keyword}}"
|
|
1247
|
-
- name: negotiate
|
|
1248
|
-
wab_action: negotiate
|
|
1249
|
-
params:
|
|
1250
|
-
item_id: "{{item_id}}"
|
|
1251
|
-
max_price: "{{budget}}"
|
|
1252
|
-
negotiation:
|
|
1253
|
-
enabled: true
|
|
1254
|
-
max_rounds: 3
|
|
1255
|
-
accept_threshold: 0.85
|
|
1256
|
-
fairness_rules:
|
|
1257
|
-
- Prefer independent sellers over large platforms
|
|
1258
|
-
- Verify all prices before purchase
|
|
1259
|
-
```
|
|
1260
|
-
|
|
1261
|
-
---
|
|
1262
|
-
|
|
1263
|
-
## Commander Agent System
|
|
1264
|
-
|
|
1265
|
-
The Commander is a local-first mission orchestration engine that decomposes high-level goals into task DAGs and distributes work across specialized agents:
|
|
1266
|
-
|
|
1267
|
-
```javascript
|
|
1268
|
-
// Create a mission
|
|
1269
|
-
const mission = await fetch('/api/commander/missions', {
|
|
1270
|
-
method: 'POST',
|
|
1271
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1272
|
-
body: JSON.stringify({
|
|
1273
|
-
goal: 'Find the cheapest olive oil across 5 stores',
|
|
1274
|
-
strategy: 'parallel',
|
|
1275
|
-
agents: ['researcher-1', 'analyst-1', 'negotiator-1']
|
|
1276
|
-
})
|
|
1277
|
-
}).then(r => r.json());
|
|
1278
|
-
|
|
1279
|
-
// Launch mission
|
|
1280
|
-
await fetch(`/api/commander/missions/${mission.id}/launch`, { method: 'POST', headers: { 'Authorization': 'Bearer ' + token } });
|
|
1281
|
-
|
|
1282
|
-
// Check status
|
|
1283
|
-
const status = await fetch(`/api/commander/missions/${mission.id}`, { headers: { 'Authorization': 'Bearer ' + token } }).then(r => r.json());
|
|
1284
|
-
// โ { status: 'completed', tasks: [...], result: { bestPrice: 12.99, store: 'farm-direct' } }
|
|
1285
|
-
```
|
|
1286
|
-
|
|
1287
|
-
### Commander Capabilities
|
|
1288
|
-
| Feature | Description |
|
|
1289
|
-
|---|---|
|
|
1290
|
-
| **Mission Decomposition** | Breaks high-level goals into task DAGs with dependency tracking |
|
|
1291
|
-
| **Agent Registry** | Tracks agent capabilities, availability, and performance history |
|
|
1292
|
-
| **Parallel Execution** | Runs independent tasks concurrently across multiple agents |
|
|
1293
|
-
| **Learning Integration** | Records outcomes for reinforcement learning feedback |
|
|
1294
|
-
| **Edge Coordination** | Distributes compute-heavy tasks to edge nodes |
|
|
1295
|
-
|
|
1296
|
-
---
|
|
1297
|
-
|
|
1298
|
-
## Edge Compute System
|
|
1299
|
-
|
|
1300
|
-
Transform every user device into a sovereign AI node โ no central cloud required:
|
|
1301
|
-
|
|
1302
|
-
```javascript
|
|
1303
|
-
// Register a device as an edge node
|
|
1304
|
-
const node = await fetch('/api/commander/edge/nodes', {
|
|
1305
|
-
method: 'POST',
|
|
1306
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1307
|
-
body: JSON.stringify({
|
|
1308
|
-
name: 'my-laptop',
|
|
1309
|
-
capabilities: { cpu: 8, ram: 16384, gpu: true },
|
|
1310
|
-
supportedTasks: ['text-inference', 'vision-analysis', 'price-comparison']
|
|
1311
|
-
})
|
|
1312
|
-
}).then(r => r.json());
|
|
1313
|
-
|
|
1314
|
-
// List available edge nodes
|
|
1315
|
-
const nodes = await fetch('/api/commander/edge/nodes', { headers: { 'Authorization': 'Bearer ' + token } }).then(r => r.json());
|
|
1316
|
-
```
|
|
1317
|
-
|
|
1318
|
-
| Feature | Description |
|
|
1319
|
-
|---|---|
|
|
1320
|
-
| **Hardware Profiling** | Detects CPU, RAM, GPU capabilities per node |
|
|
1321
|
-
| **AES-256-GCM Encryption** | All inter-node data is encrypted end-to-end |
|
|
1322
|
-
| **Weighted Load Balancing** | Routes tasks based on hardware + availability scores |
|
|
1323
|
-
| **Heartbeat Health Monitoring** | Auto-failover when nodes become unresponsive |
|
|
1324
|
-
| **Swarm Formation** | Capability-based clustering of nodes for distributed tasks |
|
|
1325
|
-
|
|
1326
|
-
---
|
|
1327
|
-
|
|
1328
|
-
## Swarm Execution Engine
|
|
1329
|
-
|
|
1330
|
-
Launch multiple agents in parallel to solve a single task, then intelligently merge their outputs:
|
|
1331
|
-
|
|
1332
|
-
```javascript
|
|
1333
|
-
// Launch a swarm task
|
|
1334
|
-
const swarm = await fetch('/api/premium/v2/swarm/execute', {
|
|
1335
|
-
method: 'POST',
|
|
1336
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1337
|
-
body: JSON.stringify({
|
|
1338
|
-
task: 'Find best laptop deals under $1000',
|
|
1339
|
-
strategy: 'parallel', // parallel | sequential | hybrid
|
|
1340
|
-
agentCount: 4,
|
|
1341
|
-
roles: ['researcher', 'analyst', 'price-checker', 'reviewer'],
|
|
1342
|
-
mergeStrategy: 'best-score' // best-score | fairness-weighted | consensus
|
|
1343
|
-
})
|
|
1344
|
-
}).then(r => r.json());
|
|
1345
|
-
// โ { swarmId: '...', agents: 4, status: 'running' }
|
|
1346
|
-
|
|
1347
|
-
// Get merged results
|
|
1348
|
-
const results = await fetch(`/api/premium/v2/swarm/${swarm.swarmId}`, {
|
|
1349
|
-
headers: { 'Authorization': 'Bearer ' + token }
|
|
1350
|
-
}).then(r => r.json());
|
|
1351
|
-
// โ { status: 'completed', merged: { bestDeal: {...}, confidence: 0.94 } }
|
|
1352
|
-
```
|
|
1353
|
-
|
|
1354
|
-
---
|
|
1355
|
-
|
|
1356
|
-
## Fairness Engine
|
|
1357
|
-
|
|
1358
|
-
A neutrality layer ensuring AI agents give equal opportunity to small and large sites, preventing monopolistic concentration of agent traffic:
|
|
1359
|
-
|
|
1360
|
-
```javascript
|
|
1361
|
-
// Fairness-weighted search (instead of pure relevance)
|
|
1362
|
-
const results = await fetch('/api/discovery/search?q=olive+oil&fairness=true', {
|
|
1363
|
-
headers: { 'Authorization': 'Bearer ' + token }
|
|
1364
|
-
}).then(r => r.json());
|
|
1365
|
-
// Small farms ranked alongside Amazon โ weighted by neutrality score, not just SEO
|
|
1366
|
-
|
|
1367
|
-
// Register site in WAB directory
|
|
1368
|
-
await fetch('/api/discovery/register', {
|
|
1369
|
-
method: 'POST',
|
|
1370
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1371
|
-
body: JSON.stringify({
|
|
1372
|
-
domain: 'small-farm.example.com',
|
|
1373
|
-
category: 'food',
|
|
1374
|
-
commissionRate: 0, // Direct โ no middleman
|
|
1375
|
-
independentSeller: true
|
|
1376
|
-
})
|
|
1377
|
-
}).then(r => r.json());
|
|
1378
|
-
```
|
|
1379
|
-
|
|
1380
|
-
### How Neutrality Scoring Works
|
|
1381
|
-
| Factor | Weight | Description |
|
|
1382
|
-
|---|---|---|
|
|
1383
|
-
| **Configuration completeness** | 25% | How well the site has configured WAB |
|
|
1384
|
-
| **Trust score** | 25% | Reputation attestations from the agent network |
|
|
1385
|
-
| **Transparency** | 25% | Commission disclosure, pricing clarity |
|
|
1386
|
-
| **Responsiveness** | 25% | API response time, uptime, action success rate |
|
|
1387
|
-
|
|
1388
|
-
Small independent sites with good WAB configuration can outrank large platforms on fairness-weighted searches.
|
|
1389
|
-
|
|
1390
|
-
---
|
|
1391
|
-
|
|
1392
|
-
## Agent Memory System
|
|
1393
|
-
|
|
1394
|
-
Persistent behavioral memory allowing agents to remember user preferences, learn patterns, and build associations:
|
|
1395
|
-
|
|
1396
|
-
```javascript
|
|
1397
|
-
// Store a memory
|
|
1398
|
-
await fetch('/api/premium/v2/memory', {
|
|
1399
|
-
method: 'POST',
|
|
1400
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1401
|
-
body: JSON.stringify({
|
|
1402
|
-
agentId: 'agent-1',
|
|
1403
|
-
type: 'preference', // preference | interaction | correction | pattern
|
|
1404
|
-
category: 'purchase', // navigation | purchase | search | form | custom
|
|
1405
|
-
key: 'preferred-brand',
|
|
1406
|
-
value: 'organic-only',
|
|
1407
|
-
importance: 0.9
|
|
1408
|
-
})
|
|
1409
|
-
}).then(r => r.json());
|
|
1410
|
-
|
|
1411
|
-
// Recall memories
|
|
1412
|
-
const memories = await fetch('/api/premium/v2/memory/agent-1?category=purchase&limit=10', {
|
|
1413
|
-
headers: { 'Authorization': 'Bearer ' + token }
|
|
1414
|
-
}).then(r => r.json());
|
|
1415
|
-
|
|
1416
|
-
// Create associations
|
|
1417
|
-
await fetch('/api/premium/v2/memory/associate', {
|
|
1418
|
-
method: 'POST',
|
|
1419
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1420
|
-
body: JSON.stringify({
|
|
1421
|
-
sourceId: 'memory-1',
|
|
1422
|
-
targetId: 'memory-2',
|
|
1423
|
-
relationship: 'leads_to' // leads_to | similar_to | replaces | depends_on
|
|
1424
|
-
})
|
|
1425
|
-
}).then(r => r.json());
|
|
1426
|
-
```
|
|
1427
|
-
|
|
1428
|
-
---
|
|
1429
|
-
|
|
1430
|
-
## Vision Analysis Service
|
|
1431
|
-
|
|
1432
|
-
Multi-provider screenshot analysis for interactive element detection and data extraction:
|
|
1433
|
-
|
|
1434
|
-
```javascript
|
|
1435
|
-
// Analyze a screenshot
|
|
1436
|
-
const analysis = await fetch('/api/premium/v2/vision/analyze', {
|
|
1437
|
-
method: 'POST',
|
|
1438
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1439
|
-
body: JSON.stringify({
|
|
1440
|
-
screenshot: 'base64-encoded-image...',
|
|
1441
|
-
provider: 'auto', // auto | local | openai | anthropic | ollama
|
|
1442
|
-
extractElements: true
|
|
1443
|
-
})
|
|
1444
|
-
}).then(r => r.json());
|
|
1445
|
-
// โ { elements: [{ type: 'button', text: 'Add to Cart', selector: '#add-btn', confidence: 0.95, bbox: [120, 340, 200, 40] }] }
|
|
1446
|
-
|
|
1447
|
-
// Extract interactive elements only
|
|
1448
|
-
const elements = await fetch('/api/premium/v2/vision/elements', {
|
|
1449
|
-
method: 'POST',
|
|
1450
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1451
|
-
body: JSON.stringify({ screenshot: 'base64...', types: ['button', 'input', 'link'] })
|
|
1452
|
-
}).then(r => r.json());
|
|
1453
|
-
```
|
|
1454
|
-
|
|
1455
|
-
### Supported Vision Providers
|
|
1456
|
-
| Provider | Local? | Description |
|
|
1457
|
-
|---|---|---|
|
|
1458
|
-
| **Moondream** | โ
| Lightweight local vision model |
|
|
1459
|
-
| **Ollama** | โ
| Local models via Ollama (llava, bakllava) |
|
|
1460
|
-
| **OpenAI** | โ | GPT-4 Vision |
|
|
1461
|
-
| **Anthropic** | โ | Claude Vision |
|
|
1462
|
-
|
|
1463
|
-
---
|
|
1464
|
-
|
|
1465
|
-
## Plugin Architecture
|
|
1466
|
-
|
|
1467
|
-
Dynamic plugin system allowing third-party extensions:
|
|
1468
|
-
|
|
1469
|
-
```javascript
|
|
1470
|
-
// List available plugins
|
|
1471
|
-
const plugins = await fetch('/api/premium/v2/plugins', {
|
|
1472
|
-
headers: { 'Authorization': 'Bearer ' + token }
|
|
1473
|
-
}).then(r => r.json());
|
|
1474
|
-
|
|
1475
|
-
// Install a plugin for your site
|
|
1476
|
-
await fetch('/api/premium/v2/plugins/price-alert/install', {
|
|
1477
|
-
method: 'POST',
|
|
1478
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1479
|
-
body: JSON.stringify({ siteId: 'site-uuid', config: { threshold: 10 } })
|
|
1480
|
-
}).then(r => r.json());
|
|
1481
|
-
|
|
1482
|
-
// Execute a plugin hook
|
|
1483
|
-
await fetch('/api/premium/v2/plugins/price-alert/hooks', {
|
|
1484
|
-
method: 'POST',
|
|
1485
|
-
headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' },
|
|
1486
|
-
body: JSON.stringify({ hook: 'onPriceChange', data: { oldPrice: 49.99, newPrice: 39.99 } })
|
|
1487
|
-
}).then(r => r.json());
|
|
1488
|
-
```
|
|
1489
|
-
|
|
1490
|
-
---
|
|
1491
|
-
|
|
1492
|
-
## Premium Traffic Intelligence
|
|
1493
|
-
|
|
1494
|
-
Advanced bot detection and traffic profiling for premium sites:
|
|
1495
|
-
|
|
1496
|
-
| Capability | Description |
|
|
1497
|
-
|---|---|
|
|
1498
|
-
| **30+ Bot Types** | Detects Google, Bing, ChatGPT, Claude, Perplexity, and more |
|
|
1499
|
-
| **Behavioral Profiling** | Classifies agent behavior by signature, platform, and type |
|
|
1500
|
-
| **Anomaly Detection** | Spike detection and pattern analysis for unusual traffic |
|
|
1501
|
-
| **Security Exploit Detection** | Flags SQL injection, XSS patterns, and rate anomalies |
|
|
1502
|
-
| **Webhook Alerting** | Triggers webhooks on suspicious activity |
|
|
1503
|
-
| **Compliance Audit Logging** | Full audit trail for regulatory compliance |
|
|
1504
|
-
|
|
1505
|
-
---
|
|
1506
|
-
|
|
1507
|
-
## WAB-MCP Adapter
|
|
1508
|
-
|
|
1509
|
-
Expose WAB site capabilities as [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) tools for Claude, GPT, Gemini, and other MCP-compatible AI agents:
|
|
1510
|
-
|
|
1511
|
-
```javascript
|
|
1512
|
-
const { WABMCPAdapter } = require('wab-mcp-adapter');
|
|
1513
|
-
|
|
1514
|
-
// Create adapter for a WAB-enabled site
|
|
1515
|
-
const adapter = new WABMCPAdapter({
|
|
1516
|
-
siteUrl: 'https://shop.example.com',
|
|
1517
|
-
transport: 'http' // http | websocket | direct
|
|
1518
|
-
});
|
|
1519
|
-
|
|
1520
|
-
// Get MCP tool definitions
|
|
1521
|
-
const tools = await adapter.getTools();
|
|
1522
|
-
// โ [{ name: 'discover', description: '...', inputSchema: {...} }, ...]
|
|
1523
|
-
|
|
1524
|
-
// Execute via MCP
|
|
1525
|
-
const result = await adapter.executeTool('execute_action', {
|
|
1526
|
-
name: 'addToCart',
|
|
1527
|
-
params: { sku: 'ABC123' }
|
|
1528
|
-
});
|
|
1529
|
-
```
|
|
1530
|
-
|
|
1531
|
-
### Built-in MCP Tools
|
|
1532
|
-
| Tool | Description |
|
|
1533
|
-
|---|---|
|
|
1534
|
-
| `discover` | Auto-discover available actions on a WAB site |
|
|
1535
|
-
| `get_actions` | Get list of all actions with parameters |
|
|
1536
|
-
| `execute_action` | Execute a specific action |
|
|
1537
|
-
| `read_content` | Read content from the page |
|
|
1538
|
-
| `get_page_info` | Get page metadata |
|
|
1539
|
-
| `fairness_search` | Search the WAB directory with fairness weighting |
|
|
1540
|
-
| `authenticate` | Authenticate an agent with the site |
|
|
1541
|
-
|
|
1542
|
-
---
|
|
1543
|
-
|
|
1544
|
-
## WAB Browser (Desktop)
|
|
1545
|
-
|
|
1546
|
-
Standalone Electron desktop browser with built-in privacy and fairness features:
|
|
1547
|
-
|
|
1548
|
-
- **Ad Blocker** โ 80+ blocked ad domains + URL pattern matching + cosmetic CSS rules
|
|
1549
|
-
- **Scam Shield** โ Detects suspicious TLDs and brand-name spoofing in URLs
|
|
1550
|
-
- **Fairness Ranking** โ Prioritizes independent sites, flags big-tech concentration
|
|
1551
|
-
- **Agent Chat** โ Built-in AI assistant panel for browsing help
|
|
1552
|
-
- **Notifications** โ Page analysis with safety and fairness alerts
|
|
1553
|
-
- **Ghost Mode** โ Privacy-first browsing with no tracking
|
|
1554
|
-
- **Smart Search** โ WAB Search integration for independent search
|
|
1555
|
-
- **Desktop/Mobile Toggle** โ Switch user-agent for responsive testing
|
|
1556
|
-
|
|
1557
|
-
```bash
|
|
1558
|
-
# Run the WAB Browser
|
|
1559
|
-
cd wab-browser
|
|
1560
|
-
npm install
|
|
1561
|
-
npx electron .
|
|
1562
|
-
|
|
1563
|
-
# Build installer (Windows NSIS)
|
|
1564
|
-
npm run build:win
|
|
1565
|
-
```
|
|
1566
|
-
|
|
1567
|
-
---
|
|
1568
|
-
|
|
1569
|
-
## PWA Browser (Mobile)
|
|
1570
|
-
|
|
1571
|
-
Progressive Web App browser for Android and iOS โ installable from any mobile browser:
|
|
1572
|
-
|
|
1573
|
-
- **Ad Blocker** โ 80+ ad domain blacklist + URL pattern matching
|
|
1574
|
-
- **Scam Detection** โ Suspicious TLD alerts and brand-name spoofing checks
|
|
1575
|
-
- **Fairness Mode** โ Filters big-tech sites to promote independent alternatives
|
|
1576
|
-
- **Offline-First** โ Service worker caches shell assets for offline launch
|
|
1577
|
-
- **WAB Search** โ Independent search engine with multi-source aggregation, autocomplete, and trending
|
|
1578
|
-
- **AI Agent Chat** โ Real AI agent (OpenAI / local Ollama / smart fallback) with conversation memory, web search, and security analysis
|
|
1579
|
-
|
|
1580
|
-
Install at: `https://yourserver.com/pwa/`
|
|
1581
|
-
|
|
1582
|
-
---
|
|
1583
|
-
|
|
1584
|
-
## WordPress Plugin
|
|
1585
|
-
|
|
1586
|
-
Native WordPress plugin for adding WAB support to any WordPress site:
|
|
1587
|
-
|
|
1588
|
-
```bash
|
|
1589
|
-
# Install
|
|
1590
|
-
cp -r web-agent-bridge-wordpress/ /wp-content/plugins/web-agent-bridge/
|
|
1591
|
-
```
|
|
1592
|
-
|
|
1593
|
-
| Feature | Description |
|
|
1594
|
-
|---|---|
|
|
1595
|
-
| **Settings Page** | Configure API base URL, site ID, permissions |
|
|
1596
|
-
| **Per-Page Actions** | Meta box for adding custom WAB actions per page/post |
|
|
1597
|
-
| **Discovery Document** | Auto-generates WAB discovery endpoint |
|
|
1598
|
-
| **Dashboard Widget** | Shows WAB status and agent interaction stats |
|
|
1599
|
-
| **Shortcode** | `[wab_bridge]` shortcode for embedding WAB on specific pages |
|
|
1600
|
-
| **Hooks API** | `wab_before_action` / `wab_after_action` for custom logic |
|
|
1601
|
-
|
|
1602
|
-
See [`web-agent-bridge-wordpress/README.md`](web-agent-bridge-wordpress/README.md) for full documentation.
|
|
1603
|
-
|
|
1604
|
-
---
|
|
1605
|
-
|
|
1606
|
-
## WAB Protocol Specification
|
|
1607
|
-
|
|
1608
|
-
The full normative specification is available at [`docs/SPEC.md`](docs/SPEC.md):
|
|
1609
|
-
|
|
1610
|
-
| Layer | Description |
|
|
1611
|
-
|---|---|
|
|
1612
|
-
| **Protocol Layer** | Discovery document format, command protocol, fairness protocol |
|
|
1613
|
-
| **Runtime Layer** | `window.AICommands` interface, auto-discovery engine, security sandbox |
|
|
1614
|
-
| **Transport Layer** | JavaScript global, WebSocket, HTTP, WebDriver BiDi, MCP |
|
|
1615
|
-
|
|
1616
|
-
### 5-Phase Lifecycle
|
|
1617
|
-
1. **Discover** โ Agent finds WAB discovery document (`.well-known/wab.json` or script tag)
|
|
1618
|
-
2. **Authenticate** โ Agent exchanges `siteId` for session token
|
|
1619
|
-
3. **Plan** โ Agent reads available actions and page metadata
|
|
1620
|
-
4. **Execute** โ Agent runs actions through the bridge
|
|
1621
|
-
5. **Confirm** โ Results are verified via Anti-Hallucination Shield
|
|
1622
|
-
|
|
1623
|
-
---
|
|
1624
|
-
|
|
1625
|
-
## License
|
|
1626
|
-
|
|
1627
|
-
WAB uses an **Open Core** dual-license model:
|
|
1628
|
-
|
|
1629
|
-
| Layer | License | Components |
|
|
1630
|
-
|-------|---------|------------|
|
|
1631
|
-
| **Open Source** | MIT | SDK, Widget, MCP Server, Trust Protocol Spec, Browser Extension, Protocol module, Public module APIs |
|
|
1632
|
-
| **Proprietary** | Closed | Detection Engine, Threat DB, WAB Score Model, Fairness Algorithm, Neural Engine, Dark Pattern Engine, Gov Engine, Notary Engine, Firewall Engine, Price Engine, Bargaining Engine, Bounty Verification, Affiliate DB |
|
|
1633
|
-
| **Commercial** | Paid API | API Gateway modules (Free/Pro/Business/Enterprise tiers), Data Marketplace, AI Safety Layer, Enterprise SDK |
|
|
1634
|
-
|
|
1635
|
-
See [LICENSE](LICENSE) for full details.
|
|
1
|
+
<!-- coderlegion: https://coderlegion.com/user/WAB -->
|
|
2
|
+
<div align="center">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/abokenan444/web-agent-bridge/main/public/images/wab-logo-large.png" alt="Web Agent Bridge Logo" width="200" />
|
|
4
|
+
<h1>Web Agent Bridge (WAB)</h1>
|
|
5
|
+
<p><b>The Open AI โ Web Protocol & Agent Platform</b></p>
|
|
6
|
+
<p><i>robots.txt told bots what NOT to do. WAB tells AI agents what they CAN do.</i></p>
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/web-agent-bridge)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://webagentbridge.com/activate)
|
|
11
|
+
[](https://discord.gg/NnbpJYEF)
|
|
12
|
+
[](https://coderlegion.com/user/WAB)
|
|
13
|
+
|
|
14
|
+
[](#-shieldqr--extended-trust-layer)
|
|
15
|
+
[](#-shieldqr--extended-trust-layer)
|
|
16
|
+
[](#-zero-config-adoption-layer)
|
|
17
|
+
[](#-governance-layer--enterprise-security--compliance)
|
|
18
|
+
[](tests)
|
|
19
|
+
|
|
20
|
+
<br />
|
|
21
|
+
<a href="https://webagentbridge.com"><strong>Website</strong></a> ยท
|
|
22
|
+
<a href="https://webagentbridge.com/docs"><strong>Documentation</strong></a> ยท
|
|
23
|
+
<a href="https://webagentbridge.com/whitepaper"><strong>Whitepaper</strong></a> ยท
|
|
24
|
+
<a href="https://webagentbridge.com/activate"><strong>DNS Discovery</strong></a> ยท
|
|
25
|
+
<a href="https://coderlegion.com/user/WAB"><strong>CoderLegion</strong></a> ยท
|
|
26
|
+
<a href="README.ar.md"><strong>ุงูุนุฑุจูุฉ</strong></a>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<br />
|
|
30
|
+
|
|
31
|
+
## Why WAB?
|
|
32
|
+
|
|
33
|
+
Currently, AI agents interact with the web by parsing the DOM, guessing selectors, or relying on fragile visual models. This is slow, error-prone, and breaks whenever a site's layout changes.
|
|
34
|
+
|
|
35
|
+
**WAB solves this by providing a standardized API for the web.** It creates a secure bridge between AI agents and websites, allowing agents to discover capabilities, execute commands, and interact with sites accurately โ no DOM parsing, no scraping, no guesswork.
|
|
36
|
+
|
|
37
|
+
### For Website Owners ๐ข
|
|
38
|
+
Control exactly how AI interacts with your site. Expose specific capabilities, set rate limits, and monitor agent activity.
|
|
39
|
+
|
|
40
|
+
### For AI Developers ๐ค
|
|
41
|
+
Build reliable agents that work instantly on any WAB-enabled site. Stop writing custom scrapers and start using the `window.AICommands` standardized interface.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## โก Quick Start
|
|
46
|
+
|
|
47
|
+
### 0. Zero-Config Initializer (30 seconds)
|
|
48
|
+
The fastest path. Auto-detects your stack (Next.js, Nuxt, SvelteKit, Astro, Laravel, WordPress, staticโฆ) and scaffolds `/.well-known/wab.json` plus the DNS instructions for your provider:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx wab-init
|
|
52
|
+
# or non-interactive:
|
|
53
|
+
npx wab-init --site=https://yourdomain.com --name="Your Site" --yes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 1. DNS Discovery (No Code)
|
|
57
|
+
Make your website instantly discoverable by AI agents by adding a single DNS TXT record. No code changes required.
|
|
58
|
+
|
|
59
|
+
```dns
|
|
60
|
+
_wab.yourdomain.com TXT "v=wab1; endpoint=https://yourdomain.com/.well-known/wab.json"
|
|
61
|
+
```
|
|
62
|
+
๐ [**Watch the 40-second setup video & full guide**](https://webagentbridge.com/activate)
|
|
63
|
+
|
|
64
|
+
### 2. The Developer Way: Install via npm
|
|
65
|
+
```bash
|
|
66
|
+
npm install web-agent-bridge
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
import { initWAB } from 'web-agent-bridge';
|
|
71
|
+
|
|
72
|
+
initWAB({
|
|
73
|
+
siteId: 'your-site-id',
|
|
74
|
+
capabilities: ['browse', 'api', 'commerce'],
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. The Edge Way: One-Click Edge Adoption
|
|
79
|
+
No origin changes needed. Drop in a Cloudflare Worker, Vercel Middleware, or Netlify Edge Function and `/.well-known/wab.json` is served from the edge:
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// Vercel โ middleware.ts
|
|
83
|
+
import { handleRequest } from '@wab/edge';
|
|
84
|
+
export const config = { matcher: ['/.well-known/wab.json'] };
|
|
85
|
+
export default (req) => handleRequest(req, {
|
|
86
|
+
siteName: 'Acme', siteUrl: 'https://acme.com'
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or for Next.js, wrap your config:
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
// next.config.js
|
|
94
|
+
const { withWAB } = require('@wab/next');
|
|
95
|
+
module.exports = withWAB({}, {
|
|
96
|
+
siteName: 'Acme', siteUrl: 'https://acme.com',
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 4. The Agent Builder Way: Governance-First Agents
|
|
101
|
+
|
|
102
|
+
If you're building an AI agent that touches Stripe, Gmail, ClickUp, or any sensitive API, wrap every action in the **Governance Layer**. Permissions, human-in-the-loop approvals, tamper-evident audit, kill-switch and spend caps โ server-enforced and one call away:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
const { WABGovernance } = require('web-agent-bridge/sdk');
|
|
106
|
+
|
|
107
|
+
// 1) one-time: register the agent identity
|
|
108
|
+
const { agent_id, agent_token } = await WABGovernance.register({
|
|
109
|
+
apiBase: 'https://webagentbridge.com',
|
|
110
|
+
displayName: 'My Stripe Agent',
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const gov = new WABGovernance({
|
|
114
|
+
apiBase: 'https://webagentbridge.com',
|
|
115
|
+
agentId: agent_id,
|
|
116
|
+
agentToken: agent_token,
|
|
117
|
+
onApprovalRequired: async (req) => {
|
|
118
|
+
// post to Slack/Email; return 'approved' or 'rejected'
|
|
119
|
+
return await askHuman(req);
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// 2) define boundaries
|
|
124
|
+
await gov.definePolicy({
|
|
125
|
+
resource: 'stripe', action: 'write', scope: 'refunds',
|
|
126
|
+
max_amount: 50, daily_cap: 200, currency: 'USD',
|
|
127
|
+
});
|
|
128
|
+
await gov.definePolicy({
|
|
129
|
+
resource: 'stripe', action: 'write', scope: 'refunds-large',
|
|
130
|
+
max_amount: 5000, requires_approval: true,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// 3) wrap every action
|
|
134
|
+
await gov.guard(
|
|
135
|
+
{ resource: 'stripe', action: 'write', scope: 'refunds', amount: 49.99 },
|
|
136
|
+
async () => stripe.refunds.create({ charge: 'ch_x' }),
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
๐ **Run the full 9-step demo:** [`node examples/governance-agent.js`](examples/governance-agent.js) โ walks register โ policies โ deny โ allow โ approval gate โ audit โ kill switch.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## โจ Core Features
|
|
145
|
+
|
|
146
|
+
### ๐ DNS Discovery Protocol
|
|
147
|
+
The fastest way to make your site AI-ready. AI agents can find your capabilities document via DNS over HTTPS (DoH) without any initial HTTP request.
|
|
148
|
+
|
|
149
|
+
### ๐ก๏ธ Sovereign Shield & Firewall
|
|
150
|
+
Protect your site from malicious bots while allowing verified AI agents. Includes IP rate-limiting, Intent Engine, and Human-Gate rollback.
|
|
151
|
+
|
|
152
|
+
### ๐ป Agent OS & Workspace
|
|
153
|
+
A premium 4-panel workspace for non-technical users featuring an embedded browser, smart agent chat, real-time negotiation monitor, and results panel.
|
|
154
|
+
|
|
155
|
+
### ๐ Universal Agent Mode
|
|
156
|
+
Works on any website, even those without the WAB script installed, using our advanced fallback heuristics.
|
|
157
|
+
|
|
158
|
+
### ๐ฃ๏ธ Multilingual Support
|
|
159
|
+
Full Arabic and English interface with auto-detection. The smart agent understands and responds in any language the user writes in.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## ๏ฟฝ ShieldQR & Extended Trust Layer
|
|
164
|
+
|
|
165
|
+
WAB ships an **end-to-end trust pipeline** that lets agents (and humans) verify a site is exactly who it claims to be โ at the protocol level, not just the TLS level.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
169
|
+
โ /.well-known/wab.json โ signed Ed25519 payload โ
|
|
170
|
+
โ โฒ โ
|
|
171
|
+
โ _wab.<host> DNS TXT โ pk + ssl_thumbprint + endpoint โ
|
|
172
|
+
โ โฒ โ
|
|
173
|
+
โ TLS certificate โ fingerprint pinned in DNS โ
|
|
174
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Capability | What it does |
|
|
178
|
+
|---|---|
|
|
179
|
+
| **๐ชช Ed25519-signed `wab.json`** | Every capability document is signed; the public key is published in DNS (`pk=ed25519:โฆ`). Agents detect tampering or impersonation. |
|
|
180
|
+
| **๐ SSL fingerprint pinning** | `ssl_thumbprint` (SHA-256) and `ssl_expires` are embedded in both `wab.json` and the DNS TXT record. Mismatch = automatic distrust. |
|
|
181
|
+
| **๐ฉบ SSL Health Monitor** | A 24h cron sweep tracks every site's certificate; sends an email alert **7 days** before expiry so renewal never surprises you. |
|
|
182
|
+
| **๐ Certificate Transparency log** | A local CT log (`cert_history`) records every fingerprint observed per host โ silent re-issuance is detectable. |
|
|
183
|
+
| **๐ Fallback Trust mode** | If TLS is degraded but the Ed25519 signature still verifies, ShieldQR returns `partial trust` instead of failing closed. Never blocks a legitimate site over a single moving part. |
|
|
184
|
+
| **๐ฑ ShieldQR Public Scanner** | `/shieldqr` lets users scan any QR code and instantly see if the destination is a verified WAB-trusted site (`green` / `yellow` / `red`). |
|
|
185
|
+
| **๐ Admin Trust Monitor** | `/admin/trust-monitor` โ dashboard for monitored hosts, SSL status pills, CT log entries, and one-click re-verification. |
|
|
186
|
+
|
|
187
|
+
**Sign your domain in one command:**
|
|
188
|
+
```bash
|
|
189
|
+
node scripts/sign-wab-domain.js
|
|
190
|
+
# โ writes signed /.well-known/wab.json + prints the DNS TXT record to publish
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Verify any site: <https://www.webagentbridge.com/check?host=YOUR_HOST>
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## ๐ Zero-Config Adoption Layer
|
|
198
|
+
|
|
199
|
+
Drop-in adoption for every popular stack โ **no origin changes, no PHP, no `.htaccess` edits**.
|
|
200
|
+
|
|
201
|
+
| Package | Use it for | Install |
|
|
202
|
+
|---|---|---|
|
|
203
|
+
| **`wab-init` CLI** | Auto-detect project (Next/Nuxt/SvelteKit/Astro/Laravel/WordPress/static) and scaffold `wab.json` + DNS instructions. | `npx wab-init` |
|
|
204
|
+
| **`@wab/next`** | Next.js plugin: `withWAB(nextConfig, { siteName, siteUrl })` adds rewrites + headers for `/.well-known/wab.json`. App Router + Pages Router supported. | `npm i @wab/next` |
|
|
205
|
+
| **`@wab/edge`** | Vercel Middleware & Netlify Edge Function โ serve `wab.json` from the edge, configured by env vars. | `npm i @wab/edge` |
|
|
206
|
+
| **`@wab/cloudflare-worker`** | Standalone Cloudflare Worker that injects `/.well-known/wab.json` from KV or env vars. Optional reverse-proxy origin. | `wrangler deploy` |
|
|
207
|
+
| **SDK Auto-Discovery** | When a site has no `wab.json`, the SDK falls back through JSON-LD / Schema.org / OpenGraph / `sitemap.xml` / `robots.txt` and returns a **normalized capabilities envelope** so your agent still works. | `require('web-agent-bridge-sdk').discover(url)` |
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
const { discover } = require('web-agent-bridge-sdk');
|
|
211
|
+
|
|
212
|
+
const env = await discover('https://example.com');
|
|
213
|
+
// env.source โ 'wab.json' | 'auto-discovery'
|
|
214
|
+
// env.site โ { name, description, url }
|
|
215
|
+
// env.actions โ [{ name, description, source }, โฆ]
|
|
216
|
+
// env.products โ [ schema.org/Product nodes โฆ ]
|
|
217
|
+
// env.sitemap โ [ url, โฆ ]
|
|
218
|
+
// env.trust.signed โ boolean
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
The result: any agent can do something useful on **any** website on day one, even before the site formally adopts WAB.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ๏ฟฝ๐ก๏ธ Governance Layer โ Enterprise Security & Compliance
|
|
226
|
+
|
|
227
|
+
The **WAB Governance Layer** sits *above* the protocol and turns any agent into a compliance-ready, auditable, kill-switch-controlled identity. It's the missing piece for agents that touch real money, mailboxes, or production systems.
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
231
|
+
โ Layer 3: Governance (permissions ยท audit) โ โ /api/governance
|
|
232
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
233
|
+
โ Layer 2: WAB Protocol (AICommands ยท trust) โ โ /api/discovery
|
|
234
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
235
|
+
โ Layer 1: Dynamic Shield (price ยท OCR) โ โ /api/shield
|
|
236
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
| Capability | What it gives you |
|
|
240
|
+
|------------|-------------------|
|
|
241
|
+
| **๐ Permission Boundaries** | Per-agent `resource ร action ร scope` policies with `effect=allow\|deny`. Most-specific match wins. |
|
|
242
|
+
| **๐ Human-in-the-Loop Approvals** | Mark any policy `requires_approval: true` โ sensitive actions are routed through async human gates with TTL. |
|
|
243
|
+
| **๐งพ Tamper-Evident Audit** | Every event hash-chained with HMAC: `hash_n = HMAC(secret, prev_hash โ row)`. `verifyAuditChain()` detects any tampering. |
|
|
244
|
+
| **๐ Kill Switch** | One call disables an agent globally and auto-cancels all pending approvals (no resurrection). |
|
|
245
|
+
| **๐ฐ Spend & Rate Limits** | Per-call `max_amount`, rolling 24h `daily_cap`, per-minute `per_call_rate`. |
|
|
246
|
+
| **๐ต๏ธ Param Redaction** | `password`, `api_key`, `token`, `cookie`, `cvv`, `ssn` are automatically redacted before audit storage. |
|
|
247
|
+
|
|
248
|
+
**Verified end-to-end** โ [293/293 tests passing](tests) including 26 governance, 10 ShieldQR, 36 server, plus the full integration suite.
|
|
249
|
+
|
|
250
|
+
Full demo: [`examples/governance-agent.js`](examples/governance-agent.js) ยท API surface: `/api/governance/*` ยท SDK: `WABGovernance` class.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## ๐๏ธ Architecture & Open Core Model
|
|
255
|
+
|
|
256
|
+
WAB uses an **Open Core** dual-license model to ensure the protocol remains free while supporting sustainable development.
|
|
257
|
+
|
|
258
|
+
| Component | License | Description |
|
|
259
|
+
|-----------|---------|-------------|
|
|
260
|
+
| **Core SDK & Protocol** | MIT | Discovery protocol, JS SDK, signing scripts, `wab-init` CLI. |
|
|
261
|
+
| **ShieldQR Verifier** | MIT | Open Ed25519 verifier โ anyone can validate signatures and SSL pins. |
|
|
262
|
+
| **Adoption Packages** | MIT | `@wab/next`, `@wab/edge`, `@wab/cloudflare-worker`. |
|
|
263
|
+
| **WordPress Plugin** | GPL-2.0 | Full integration for WordPress sites. |
|
|
264
|
+
| **Engines (Firewall, Price, OCR)** | Proprietary (Free) | Advanced detection, scoring, and protection engines. |
|
|
265
|
+
| **ShieldQR Threat Intel** | Commercial | Curated impersonation-host blocklist + reputation feeds. |
|
|
266
|
+
| **API Gateway & Pro Modules** | Commercial | Enterprise features, data marketplace, SLA. |
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## ๐ค Contributing
|
|
271
|
+
|
|
272
|
+
We welcome contributions from the community! Whether it's fixing a bug, improving documentation, or proposing a new feature.
|
|
273
|
+
|
|
274
|
+
1. Fork the repository
|
|
275
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
276
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
277
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
278
|
+
5. Open a Pull Request
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## ๐ License
|
|
283
|
+
|
|
284
|
+
This project is licensed under the terms described in the [LICENSE](LICENSE) file. The core protocol and SDKs are MIT licensed.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## ๐ Community & Links
|
|
289
|
+
|
|
290
|
+
- **Website**: <https://webagentbridge.com>
|
|
291
|
+
- **Discord**: <https://discord.gg/NnbpJYEF>
|
|
292
|
+
- **CoderLegion**: <https://coderlegion.com/user/WAB>
|
|
293
|
+
- **Issues & PRs**: <https://github.com/abokenan444/web-agent-bridge/issues>
|
|
294
|
+
- **npm**: <https://www.npmjs.com/package/web-agent-bridge>
|
|
295
|
+
|
|
296
|
+
<div align="center">
|
|
297
|
+
<i>ยฉ 2026 Web Agent Bridge. Built for the AI-first web.</i>
|
|
298
|
+
</div>
|