web-agent-bridge 2.6.0 → 2.8.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/package.json +79 -79
- package/sdk/package.json +22 -14
- package/server/config/plans.js +367 -0
- package/server/middleware/featureGate.js +88 -0
- package/server/migrations/005_marketplace_metering.sql +126 -0
- package/server/routes/runtime.js +616 -3
- package/server/services/hosted-runtime.js +205 -0
- package/server/services/lfd.js +616 -0
- package/server/services/marketplace.js +270 -0
- package/server/services/metering.js +182 -0
- package/server/services/vision.js +292 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
-- Migration 005: Marketplace & Usage Metering tables
|
|
2
|
+
|
|
3
|
+
-- Marketplace listings
|
|
4
|
+
CREATE TABLE IF NOT EXISTS marketplace_listings (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
name TEXT NOT NULL,
|
|
7
|
+
description TEXT DEFAULT '',
|
|
8
|
+
type TEXT NOT NULL,
|
|
9
|
+
category TEXT DEFAULT 'automation',
|
|
10
|
+
seller_id TEXT NOT NULL,
|
|
11
|
+
seller_name TEXT DEFAULT 'Anonymous',
|
|
12
|
+
price REAL DEFAULT 0,
|
|
13
|
+
currency TEXT DEFAULT 'usd',
|
|
14
|
+
version TEXT DEFAULT '1.0.0',
|
|
15
|
+
tags TEXT DEFAULT '[]',
|
|
16
|
+
icon TEXT,
|
|
17
|
+
readme TEXT DEFAULT '',
|
|
18
|
+
install_command TEXT,
|
|
19
|
+
config_schema TEXT DEFAULT '{}',
|
|
20
|
+
entry_point TEXT,
|
|
21
|
+
installs INTEGER DEFAULT 0,
|
|
22
|
+
revenue REAL DEFAULT 0,
|
|
23
|
+
rating REAL DEFAULT 0,
|
|
24
|
+
review_count INTEGER DEFAULT 0,
|
|
25
|
+
status TEXT DEFAULT 'pending_review',
|
|
26
|
+
rejection_reason TEXT,
|
|
27
|
+
published_at INTEGER,
|
|
28
|
+
created_at INTEGER NOT NULL,
|
|
29
|
+
updated_at INTEGER NOT NULL
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE INDEX IF NOT EXISTS idx_mkt_listings_status ON marketplace_listings(status);
|
|
33
|
+
CREATE INDEX IF NOT EXISTS idx_mkt_listings_category ON marketplace_listings(category);
|
|
34
|
+
CREATE INDEX IF NOT EXISTS idx_mkt_listings_seller ON marketplace_listings(seller_id);
|
|
35
|
+
|
|
36
|
+
-- Marketplace purchases
|
|
37
|
+
CREATE TABLE IF NOT EXISTS marketplace_purchases (
|
|
38
|
+
id TEXT PRIMARY KEY,
|
|
39
|
+
listing_id TEXT NOT NULL,
|
|
40
|
+
listing_name TEXT,
|
|
41
|
+
buyer_id TEXT NOT NULL,
|
|
42
|
+
seller_id TEXT NOT NULL,
|
|
43
|
+
price REAL DEFAULT 0,
|
|
44
|
+
commission REAL DEFAULT 0,
|
|
45
|
+
seller_earning REAL DEFAULT 0,
|
|
46
|
+
currency TEXT DEFAULT 'usd',
|
|
47
|
+
status TEXT DEFAULT 'pending_payment',
|
|
48
|
+
created_at INTEGER NOT NULL,
|
|
49
|
+
completed_at INTEGER,
|
|
50
|
+
FOREIGN KEY (listing_id) REFERENCES marketplace_listings(id)
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
CREATE INDEX IF NOT EXISTS idx_mkt_purchases_buyer ON marketplace_purchases(buyer_id);
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_mkt_purchases_seller ON marketplace_purchases(seller_id);
|
|
55
|
+
|
|
56
|
+
-- Marketplace reviews
|
|
57
|
+
CREATE TABLE IF NOT EXISTS marketplace_reviews (
|
|
58
|
+
id TEXT PRIMARY KEY,
|
|
59
|
+
listing_id TEXT NOT NULL,
|
|
60
|
+
user_id TEXT NOT NULL,
|
|
61
|
+
rating INTEGER NOT NULL,
|
|
62
|
+
comment TEXT DEFAULT '',
|
|
63
|
+
created_at INTEGER NOT NULL,
|
|
64
|
+
FOREIGN KEY (listing_id) REFERENCES marketplace_listings(id)
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
-- Seller earnings
|
|
68
|
+
CREATE TABLE IF NOT EXISTS marketplace_earnings (
|
|
69
|
+
seller_id TEXT PRIMARY KEY,
|
|
70
|
+
total REAL DEFAULT 0,
|
|
71
|
+
pending REAL DEFAULT 0,
|
|
72
|
+
paid REAL DEFAULT 0,
|
|
73
|
+
last_payout INTEGER
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
-- Usage metering daily records
|
|
77
|
+
CREATE TABLE IF NOT EXISTS usage_metering (
|
|
78
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
79
|
+
entity_id TEXT NOT NULL,
|
|
80
|
+
metric TEXT NOT NULL,
|
|
81
|
+
date TEXT NOT NULL,
|
|
82
|
+
count INTEGER DEFAULT 0,
|
|
83
|
+
overage INTEGER DEFAULT 0,
|
|
84
|
+
overage_cost REAL DEFAULT 0,
|
|
85
|
+
UNIQUE(entity_id, metric, date)
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
CREATE INDEX IF NOT EXISTS idx_usage_entity ON usage_metering(entity_id);
|
|
89
|
+
CREATE INDEX IF NOT EXISTS idx_usage_date ON usage_metering(date);
|
|
90
|
+
|
|
91
|
+
-- Hosted runtime instances
|
|
92
|
+
CREATE TABLE IF NOT EXISTS hosted_instances (
|
|
93
|
+
id TEXT PRIMARY KEY,
|
|
94
|
+
agent_id TEXT NOT NULL,
|
|
95
|
+
tier TEXT DEFAULT 'starter',
|
|
96
|
+
region TEXT DEFAULT 'auto',
|
|
97
|
+
cpu TEXT DEFAULT '0.5',
|
|
98
|
+
memory TEXT DEFAULT '512',
|
|
99
|
+
status TEXT DEFAULT 'starting',
|
|
100
|
+
execution_count INTEGER DEFAULT 0,
|
|
101
|
+
compute_minutes REAL DEFAULT 0,
|
|
102
|
+
errors INTEGER DEFAULT 0,
|
|
103
|
+
started_at INTEGER NOT NULL,
|
|
104
|
+
stopped_at INTEGER,
|
|
105
|
+
last_activity INTEGER
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
CREATE INDEX IF NOT EXISTS idx_hosted_agent ON hosted_instances(agent_id);
|
|
109
|
+
CREATE INDEX IF NOT EXISTS idx_hosted_status ON hosted_instances(status);
|
|
110
|
+
|
|
111
|
+
-- Hosted executions
|
|
112
|
+
CREATE TABLE IF NOT EXISTS hosted_executions (
|
|
113
|
+
id TEXT PRIMARY KEY,
|
|
114
|
+
instance_id TEXT NOT NULL,
|
|
115
|
+
agent_id TEXT NOT NULL,
|
|
116
|
+
task_type TEXT,
|
|
117
|
+
task_action TEXT,
|
|
118
|
+
status TEXT DEFAULT 'running',
|
|
119
|
+
started_at INTEGER NOT NULL,
|
|
120
|
+
completed_at INTEGER,
|
|
121
|
+
compute_ms INTEGER DEFAULT 0,
|
|
122
|
+
error TEXT,
|
|
123
|
+
FOREIGN KEY (instance_id) REFERENCES hosted_instances(id)
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
CREATE INDEX IF NOT EXISTS idx_hexe_instance ON hosted_executions(instance_id);
|