web-agent-bridge 2.9.0 → 3.2.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 +51 -0
- package/README.ar.md +79 -0
- package/README.md +104 -4
- package/package.json +2 -1
- package/public/.well-known/ai-plugin.json +28 -0
- package/public/agent-workspace.html +3 -1
- package/public/ai.html +5 -3
- package/public/api.html +412 -0
- package/public/browser.html +4 -2
- package/public/cookies.html +4 -2
- package/public/dashboard.html +5 -3
- package/public/demo.html +1770 -1
- package/public/docs.html +6 -4
- package/public/growth.html +463 -0
- package/public/index.html +982 -738
- package/public/llms-full.txt +52 -1
- package/public/llms.txt +39 -0
- package/public/login.html +6 -4
- package/public/premium-dashboard.html +7 -5
- package/public/premium.html +6 -4
- package/public/privacy.html +4 -2
- package/public/register.html +6 -4
- package/public/score.html +263 -0
- package/public/terms.html +4 -2
- package/sdk/index.js +7 -1
- package/sdk/package.json +12 -1
- package/server/index.js +427 -375
- package/server/middleware/rateLimits.js +3 -3
- package/server/migrations/006_growth_suite.sql +138 -0
- package/server/routes/agent-workspace.js +162 -0
- package/server/routes/demo-showcase.js +332 -0
- package/server/routes/discovery.js +18 -7
- package/server/routes/gateway.js +157 -0
- package/server/routes/growth.js +962 -0
- package/server/routes/runtime.js +204 -0
- package/server/routes/universal.js +9 -1
- package/server/routes/wab-api.js +16 -6
- package/server/runtime/container-worker.js +111 -0
- package/server/runtime/container.js +448 -0
- package/server/runtime/distributed-worker.js +362 -0
- package/server/runtime/index.js +21 -1
- package/server/runtime/queue.js +599 -0
- package/server/runtime/replay.js +431 -29
- package/server/runtime/scheduler.js +194 -55
- package/server/services/api-key-engine.js +261 -0
- package/server/services/lfd.js +22 -3
- package/server/services/modules/affiliate-intelligence.js +93 -0
- package/server/services/modules/agent-firewall.js +90 -0
- package/server/services/modules/bounty.js +89 -0
- package/server/services/modules/collective-bargaining.js +92 -0
- package/server/services/modules/dark-pattern.js +66 -0
- package/server/services/modules/gov-intelligence.js +45 -0
- package/server/services/modules/neural.js +55 -0
- package/server/services/modules/notary.js +49 -0
- package/server/services/modules/price-time-machine.js +86 -0
- package/server/services/modules/protocol.js +104 -0
- package/server/services/premium.js +1 -1
- package/server/services/price-intelligence.js +2 -1
- package/server/services/vision.js +2 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WAB Protocol Validator (08-protocol) — OPEN SOURCE
|
|
3
|
+
* Validates wab.json trust protocol files.
|
|
4
|
+
* This module is fully open to become a web standard.
|
|
5
|
+
*
|
|
6
|
+
* Powered by WAB — Web Agent Bridge
|
|
7
|
+
* https://www.webagentbridge.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const https = require('https');
|
|
13
|
+
const http = require('http');
|
|
14
|
+
|
|
15
|
+
const WAB_PROTOCOL_SCHEMA = {
|
|
16
|
+
required: ['wab_version', 'site', 'permissions'],
|
|
17
|
+
optional: ['pricing', 'returns', 'trust', 'accessibility', 'dark_patterns_policy'],
|
|
18
|
+
permissions_fields: ['ai_agents', 'price_comparison', 'automated_checkout', 'data_export'],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function validateWabJson(wabJson) {
|
|
22
|
+
const errors = [];
|
|
23
|
+
const warnings = [];
|
|
24
|
+
let score = 100;
|
|
25
|
+
|
|
26
|
+
if (!wabJson || typeof wabJson !== 'object') return { valid: false, score: 0, errors: ['Invalid JSON structure'] };
|
|
27
|
+
|
|
28
|
+
for (const field of WAB_PROTOCOL_SCHEMA.required) {
|
|
29
|
+
if (!wabJson[field]) { errors.push(`Missing required field: ${field}`); score -= 20; }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (wabJson.wab_version && !/^\d+\.\d+(\.\d+)?$/.test(wabJson.wab_version)) {
|
|
33
|
+
errors.push('Invalid wab_version format. Expected semver (e.g., "1.0.0")'); score -= 10;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (wabJson.permissions) {
|
|
37
|
+
const p = wabJson.permissions;
|
|
38
|
+
if (typeof p.ai_agents !== 'undefined' && typeof p.ai_agents !== 'boolean' && typeof p.ai_agents !== 'string') {
|
|
39
|
+
warnings.push('permissions.ai_agents should be boolean or policy string');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (const field of WAB_PROTOCOL_SCHEMA.optional) {
|
|
44
|
+
if (wabJson[field]) score = Math.min(100, score + 3);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
valid: errors.length === 0, score: Math.max(0, score), errors, warnings,
|
|
49
|
+
fields_present: Object.keys(wabJson),
|
|
50
|
+
completeness: `${Object.keys(wabJson).length} fields`,
|
|
51
|
+
protocol_version: wabJson.wab_version || 'unknown',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function fetchAndValidate(domain) {
|
|
56
|
+
const wabUrl = `https://${domain}/wab.json`;
|
|
57
|
+
return new Promise((resolve) => {
|
|
58
|
+
const protocol = wabUrl.startsWith('https') ? https : http;
|
|
59
|
+
const req = protocol.get(wabUrl, { timeout: 8000, headers: { 'User-Agent': 'WAB-Protocol-Validator/1.0' } }, (res) => {
|
|
60
|
+
if (res.statusCode !== 200) {
|
|
61
|
+
return resolve({ found: false, domain, url: wabUrl, error: `HTTP ${res.statusCode}`, recommendation: 'Add a wab.json file to your site root' });
|
|
62
|
+
}
|
|
63
|
+
let data = '';
|
|
64
|
+
res.on('data', c => data += c);
|
|
65
|
+
res.on('end', () => {
|
|
66
|
+
try {
|
|
67
|
+
const json = JSON.parse(data);
|
|
68
|
+
const result = validateWabJson(json);
|
|
69
|
+
resolve({ found: true, domain, url: wabUrl, ...result, raw: json });
|
|
70
|
+
} catch { resolve({ found: false, domain, url: wabUrl, error: 'Invalid JSON in wab.json' }); }
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
req.on('error', () => resolve({ found: false, domain, url: wabUrl, error: 'Could not reach domain' }));
|
|
74
|
+
req.on('timeout', () => { req.destroy(); resolve({ found: false, domain, url: wabUrl, error: 'Request timed out' }); });
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function createRouter(express) {
|
|
79
|
+
const router = express.Router();
|
|
80
|
+
|
|
81
|
+
router.post('/validate', (req, res) => {
|
|
82
|
+
const { wab_json } = req.body;
|
|
83
|
+
if (!wab_json) return res.status(400).json({ error: 'wab_json object is required' });
|
|
84
|
+
res.json(validateWabJson(wab_json));
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
router.get('/check/:domain', async (req, res) => {
|
|
88
|
+
const result = await fetchAndValidate(req.params.domain);
|
|
89
|
+
res.json(result);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
router.get('/schema', (req, res) => {
|
|
93
|
+
res.json({ version: '1.0', schema: WAB_PROTOCOL_SCHEMA, example: {
|
|
94
|
+
wab_version: '1.0.0', site: { name: 'Example Store', domain: 'example.com', type: 'e-commerce' },
|
|
95
|
+
permissions: { ai_agents: true, price_comparison: true, automated_checkout: false, data_export: true },
|
|
96
|
+
pricing: { transparency: 'full', currency: 'USD', includes_tax: false },
|
|
97
|
+
dark_patterns_policy: { commitment: 'none', last_audit: '2026-01-01' },
|
|
98
|
+
}});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return router;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = { createRouter, validateWabJson, fetchAndValidate };
|
|
@@ -1392,7 +1392,7 @@ function generateCdnUrl(siteId, customDomain) {
|
|
|
1392
1392
|
if (customDomain) {
|
|
1393
1393
|
return `https://${customDomain}/bridge/${siteId}/ai-agent-bridge.js`;
|
|
1394
1394
|
}
|
|
1395
|
-
return `https://
|
|
1395
|
+
return `https://webagentbridge.com/bridge/${siteId}/ai-agent-bridge.js`;
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
1398
|
// ═══════════════════════════════════════════════════════════════════════
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
const crypto = require('crypto');
|
|
16
16
|
const { db } = require('../models/db');
|
|
17
17
|
const scraper = require('./universal-scraper');
|
|
18
|
-
|
|
18
|
+
let getWabBridgeInfo;
|
|
19
|
+
try { ({ getWabBridgeInfo } = require('./fairness-engine')); } catch { getWabBridgeInfo = () => null; }
|
|
19
20
|
|
|
20
21
|
// ─── Schema ──────────────────────────────────────────────────────────
|
|
21
22
|
|
|
@@ -1070,10 +1070,10 @@ function getDomExtractionScript() {
|
|
|
1070
1070
|
'aria-labelledby','aria-checked','data-action','checked','disabled'].forEach(function(a){
|
|
1071
1071
|
if(el.hasAttribute(a))n.attributes[a]=el.getAttribute(a);
|
|
1072
1072
|
});if(el.checked)n.attributes.checked='checked';
|
|
1073
|
-
if(LAY.has(t)||INT.has(t)){n.children=[];
|
|
1073
|
+
if(LAY.has(t)||INT.has(t)){n.children=[];var ch=Array.from(el.children);for(var j=0;j<ch.length;j++){var cn=ext(ch[j],d+1);if(cn)n.children.push(cn);}}
|
|
1074
1074
|
return n;
|
|
1075
1075
|
}
|
|
1076
|
-
function sel(el){if(el.id)return'#'+CSS.escape(el.id);var p=[];var c=el;
|
|
1076
|
+
function sel(el){if(!el||!el.tagName)return'unknown';if(el.id)return'#'+CSS.escape(el.id);var p=[];var c=el;
|
|
1077
1077
|
for(var i=0;i<4&&c&&c!==document.body;i++){var s=c.tagName.toLowerCase();
|
|
1078
1078
|
if(c.id){p.unshift('#'+CSS.escape(c.id));break;}
|
|
1079
1079
|
if(c.className&&typeof c.className==='string'){var cl=c.className.trim().split(/\\s+/).slice(0,2).map(function(x){return'.'+CSS.escape(x);}).join('');if(cl)s+=cl;}
|