web-agent-bridge 2.4.0 → 2.6.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/README.ar.md CHANGED
@@ -70,6 +70,24 @@
70
70
  - **نظام الحوسبة الطرفية (Edge Compute)** — يحول كل جهاز مستخدم إلى عقدة AI سيادية. تحليل المعدات (CPU, RAM, GPU)، تشفير AES-256-GCM بين العقد، موازنة حمل مرجحة، مراقبة صحة بنبضات القلب مع تجاوز فشل تلقائي، وتشكيل أسراب حسب القدرات
71
71
  - **محرك التنفيذ بالسرب** — إطلاق عدة وكلاء بالتوازي لحل مهمة واحدة. استراتيجيات قابلة للتكوين (متوازي، متسلسل، هجين)، دمج النتائج بأفضل درجة، تخصص بالأدوار، تجميع مرجح بالعدالة، وتقييم ثقة لكل وكيل
72
72
 
73
+ ### الإصدار 3.0 — نظام تشغيل الوكلاء (طبقة التنفيذ للويب)
74
+
75
+ الإصدار 3.0 يحوّل WAB من أداة أتمتة متقدمة إلى **نظام تشغيل حقيقي للوكلاء** — طبقة تنفيذ كاملة لوكلاء الذكاء الاصطناعي على الويب، منافس لـ MCP لكنه مصمم خصيصاً للتفاعل مع المتصفح.
76
+
77
+ - **بروتوكول WAB (WABP) v1.0.0** — بروتوكول رسمي مع سجل أوامر JSON Schema، رسائل مُنمطة، التحقق من المدخلات/المخرجات، وتعريفات أوامر مُنسّخة. ١٠ أوامر مدمجة (اكتشاف، تنفيذ، تنفيذ دلالي، تسجيل وكيل، إرسال مهمة، حالة مهمة، مقارنة تجارية، تفاوض تجاري، إرسال شبكة، استدلال AI). كل أمر يعلن عن القدرات المطلوبة ومستوى الخطر وصلاحيات الوصول
78
+ - **تفاوض القدرات** — منح قدرات ديناميكي بين الوكلاء والمواقع. موافقة تلقائية حسب مستوى الخطر (منخفض = موافقة تلقائية، عالي = يتطلب سياسة)، تحديد معدل لكل قدرة، منح قابلة للانتهاء مع تتبع الاستخدام، ودعم إبطال كامل
79
+ - **محرك تشغيل الوكلاء** — نظام تشغيل مهام بمستوى إنتاجي مع جدولة بقائمة أولويات، حل التبعيات، إعادة المحاولة بتراجع أسي، إيقاف/استئناف/إلغاء، حدود تزامن، وانتقالات حالة. ناقل أحداث غير متزامن مع وسيط، أحرف بدل مساحات الأسماء، ذاكرة إعادة (١٠ آلاف حدث)، وقائمة الرسائل الميتة
80
+ - **صندوق حماية التنفيذ** — عزل لكل مهمة مع حدود موارد (مهلة، ذاكرة قصوى، حد استدعاءات الشبكة، حد عمليات DOM)، قوائم نطاقات مسموحة، حظر محددات CSS، فحوصات قدرات وقت التنفيذ، وسجل تدقيق كامل لكل عملية
81
+ - **مدير الحالة** — حفظ حالة الوكيل بنقاط تفتيش مُسمّاة، تراجع لأي نقطة تفتيش، انتقالات حالة بالتحقق، عمليات دمج، وتنظيف بانتهاء الصلاحية
82
+ - **حزمة المراقبة** — مسجل JSON هيكلي مع مسجلات فرعية ومخارج قابلة للتوصيل، متتبع موزع بفترات أب-ابن (متوافق مع OpenTelemetry)، ومجمع مقاييس بعدادات ومقاييس ورسوم بيانية (مئينات p50/p90/p95/p99) وسلاسل زمنية للوحات التحكم
83
+ - **نموذج الأمان** — هوية الوكيل (تسجيل، مصادقة بمفتاح API مشفر، إدارة جلسات بمدة صلاحية، قوائم IP المسموحة، إبطال)، توقيع الأوامر (HMAC-SHA256 مع رمز فريد + طابع زمني، مقارنة آمنة زمنياً)، وعزل المواقع (تحكم وصول لكل موقع، وكلاء مسموحون/محظورون، حد تزامن أقصى، حظر محددات، تصنيف بيانات)
84
+ - **مستوى التحكم** — مدير الوكلاء لدورة حياة النشر (نشر، تعيين لمواقع، فحوصات صحة، إلغاء نشر) ومحرك السياسات بقواعد مُنمّطة، تقييم شروط (يساوي، يحتوي، نمط، حد أدنى، حد أقصى، ضمن)، ربط سياسات بأولوية، وتطبيق على مستوى الكيان
85
+ - **مستوى البيانات** — محلل الإجراءات الدلالية يربط صيغة `domain.action` (مثل `checkout.addItem`) بالتنفيذ الفعلي لكل موقع. المنفّذ يوجّه المهام عبر التتبع + المقاييس، يدعم أوضاع التنفيذ الدلالي/الخط الأنبوبي/المتوازي، مع ٨ إجراءات دلالية مدمجة للسلة والبحث والمصادقة والتنقل والمحتوى
86
+ - **تجريد LLM متعدد النماذج** — واجهة موحدة لـ OpenAI (محادثة + تضمينات)، Anthropic (API الرسائل)، وOllama (نماذج محلية مع اكتشاف تلقائي). مدير LLM يوفر سلسلة احتياطية تلقائية عبر جميع الموفرين، تخزين مؤقت للاستجابات (٥ دقائق)، تتبع التكاليف عبر عدد الرموز، وقائمة نماذج
87
+ - **السجل والنظام البيئي** — سجل الأوامر (كـ npm لأوامر WAB — تسجيل، اكتشاف، بحث حسب الفئة/الوسم/القدرة، تتبع الاستخدام)، سجل المواقع (دليل مواقع WAB مع التحقق، قائمة القدرات، تتبع الزيارات)، وسجل القوالب (قوالب سير عمل قابلة لإعادة الاستخدام مع عدد التنزيلات والتقييمات)
88
+ - **واجهة API الموحدة لنظام التشغيل** — جميع طبقات نظام التشغيل مكشوفة عبر نقاط REST على `/api/os/*`: اكتشاف البروتوكول، هوية/مصادقة الوكيل، CRUD المهام، التنفيذ الدلالي، النشر، السياسات، العزل، المراقبة (مقاييس/آثار/سجلات)، السجل (أوامر/مواقع/قوالب)، عمليات LLM، توقيع الأوامر، وأحداث Server-Sent Events للبث المباشر
89
+ - **عميل WABAgentOS في SDK** — فئة `WABAgentOS` جديدة في SDK مع كتابة TypeScript كاملة لجميع عمليات نظام التشغيل: تسجيل ← مصادقة ← تفاوض قدرات ← إرسال مهام ← تنفيذ دلالي ← استعلام المراقبة ← الاشتراك في الأحداث
90
+
73
91
  ---
74
92
 
75
93
  ## 🚀 البدء السريع
package/README.md CHANGED
@@ -101,6 +101,38 @@ WAB is an open-source middleware layer that bridges AI agents and websites — l
101
101
  - **Multilingual Agent** — The smart agent understands and responds in any language the user writes in — Arabic, English, French, Spanish, Turkish, and more. No restrictions on input style, dialect, or format
102
102
  - **Dynamic Pricing Shield** — Detects price manipulation by websites that change prices based on device type, geolocation, cookies, browsing history, referral source, or repeat visits. The agent probes the same page with 12 distinct identity personas (clean desktop, mobile, Mac premium, EU/MENA/SEA geo, repeat visitor, Google/social/comparison referral, privacy-focused, bot-like) and uses statistical analysis (coefficient of variation, z-score outliers) to expose hidden pricing. Includes manipulation scoring (0–100), actionable tips, historical trend detection, and a strategy builder that recommends the best identity for the lowest price. Full API at `/api/sovereign/price-shield/`
103
103
 
104
+ ### v3.0 — Agent OS (Execution Layer for the Web)
105
+
106
+ WAB v3.0 transforms the project from an advanced automation tool into a **real Agent Operating System** — a complete execution layer for AI agents on the web, comparable to MCP but purpose-built for browser interaction.
107
+
108
+ - **WAB Protocol (WABP) v1.0.0** — Formal protocol with JSON Schema command registry, typed messages, input/output validation, and versioned command definitions. 10 built-in commands (discover, execute, semantic.execute, agent.register, task.submit, task.status, commerce.compare, commerce.negotiate, mesh.send, ai.infer). Every command has declared capabilities, risk levels, and permission requirements
109
+ - **Capability Negotiation** — Dynamic capability grants between agents and sites. Risk-based auto-approval (low-risk auto-granted, high-risk requires policy), rate limiting per capability, expirable grants with usage tracking, and full revocation support
110
+ - **Agent Runtime Engine** — Production-grade task runtime with priority queue scheduler, dependency resolution, retry with exponential backoff, pause/resume/cancel, concurrency limits, and state machine transitions. EventBus with async middleware, namespace wildcards, replay buffer (10K events), and dead letter queue
111
+ - **Execution Sandbox** — Per-task isolation with resource limits (timeout, maxMemory, maxNetworkCalls, maxDomOperations), domain allowlists, blocked selector enforcement, capability checks at execution time, and full audit trail of every operation
112
+ - **State Manager** — Agent state persistence with labeled checkpoints, rollback to any checkpoint, state transitions with validation, merge operations, and TTL-based cleanup
113
+ - **Observability Stack** — Structured JSON logger with child loggers and pluggable sinks, distributed tracer with parent-child spans (OpenTelemetry-compatible), and metrics collector with counters, gauges, histograms (p50/p90/p95/p99 percentiles), and time series for dashboards
114
+ - **Security Model** — AgentIdentity (registration, hashed API key authentication, session management with TTL, IP allowlists, revocation), CommandSigner (HMAC-SHA256 signing/verification with nonce + timestamp, timing-safe comparison), and SiteIsolation (per-site access control, allowed/blocked agents, max concurrency, selector blocking, data classification)
115
+ - **Control Plane** — AgentManager for deployment lifecycle (deploy, assign to sites, health checks, undeploy) and PolicyEngine with typed rules, condition evaluation (equals, contains, pattern, min, max, in), priority-ordered policy binding, and entity-level policy enforcement
116
+ - **Data Plane** — SemanticActionResolver maps `domain.action` notation (e.g., `checkout.addItem`) to concrete implementations per site. Executor routes tasks through tracing + metrics, supports semantic/pipeline/parallel execution modes, with 8 built-in semantic actions for checkout, search, auth, navigation, and content
117
+ - **Multi-Model LLM Abstraction** — Unified interface for OpenAI (chat completions + embeddings), Anthropic (messages API), and Ollama (local models with auto-discovery). LLMManager provides automatic fallback chain through all providers, response caching (5min TTL), cost tracking via token counts, and model listing
118
+ - **Registry & Ecosystem** — CommandRegistry (like npm for WAB commands — register, discover, search by category/tag/capability, usage tracking), SiteRegistry (WAB-enabled sites directory with verification, capability listing, visit tracking), and TemplateRegistry (reusable workflow templates with download counts and ratings)
119
+ - **Unified Runtime API** — All Agent OS layers exposed via RESTful endpoints at `/api/os/*`: protocol discovery, agent identity/auth, task CRUD, semantic execution, deployments, policies, isolation, observability (metrics/traces/logs), registry (commands/sites/templates), LLM operations, command signing, and Server-Sent Events for real-time streaming
120
+ - **WABAgentOS SDK Client** — New `WABAgentOS` class in the SDK provides full TypeScript-typed API for all Agent OS operations: register → authenticate → negotiate capabilities → submit tasks → execute semantically → query observability → subscribe to events
121
+
122
+ ### v3.1 — WAP Deep Architecture (Protocol Hardening)
123
+
124
+ v3.1 hardens the Agent OS into a production-grade system that *surpasses* MCP — making WAP (Web Agent Protocol) the top-level protocol with MCP as just one adapter.
125
+
126
+ - **WAP Discovery Spec** — Formal `/.well-known/agent-tools.json` discovery document. AI agents can find all WAP capabilities, commands, permissions, runtime config, security model, and SDKs from a single standardized URL
127
+ - **Adapter Layer** — WAP sits at the top; MCP, REST/GraphQL, and Browser automation are transport adapters beneath it. MCP Adapter exposes all WAB commands as MCP tools (list_tools / call_tool). REST Adapter registers external APIs as first-class WAP endpoints with auth, mapping, and rate limiting. Browser Adapter translates semantic actions (checkout.addItem, search.query, auth.login) into concrete browser step plans with selector fallbacks and verification
128
+ - **Auth Middleware** — All `/api/os/*` mutation endpoints require authentication (Bearer token, API key, or agent header). Public read endpoints remain open for discovery. GET requests pass through for read-only access
129
+ - **Deterministic Replay Engine** — Records all task inputs, outputs, and side-effects. Supports replay with verification mode (re-execute and compare), dry-run mode (inspect recorded steps), and diff between two recordings. Enables debugging, regression testing, and workflow certification
130
+ - **Failure Analysis & Classification** — Automatic classification of failures into 9 categories (network, timeout, permission, validation, execution, rate_limit, resource, dependency, unknown). Root cause analysis, severity scoring, retryability assessment, suggested fixes, and pattern detection for recurring failures
131
+ - **Session Engine** — Browser execution sessions with cookie jar (set/get/domain-scoped), localStorage/sessionStorage emulation, navigation history, variable store, session export/import for transfer, and TTL-based expiration
132
+ - **Certification System** — Site compatibility verification with 13 weighted checks across 7 categories (integration, protocol, data, security, fairness, compliance, sovereignty). Issues certificates at 5 levels (none → basic → standard → premium → sovereign) with 90-day validity, HMAC-signed badges, and revocation
133
+ - **DB Persistence Layer** — SQLite tables for all Agent OS entities: agents, sessions, tasks, deployments, registry commands/sites/templates, audit log (immutable append-only), capability grants, and policies. Auto-migrates on boot
134
+ - **65+ API Endpoints** — Adapters (MCP tools, REST endpoints, browser mappings), replay (recordings, replay, diff, stats), sessions (CRUD, cookies, storage, export/import), failure analysis (query, patterns, summary, classify), certification (verify, certificates, revoke), plus all existing v3.0 endpoints
135
+
104
136
  > **Many more features** are available on the live website that aren't listed here — dashboards, analytics, admin tools, and more. Visit [webagentbridge.com](https://webagentbridge.com) to explore.
105
137
 
106
138
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-agent-bridge",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Open-source middleware that bridges AI agents and websites — providing a standardized command interface for intelligent automation",
5
5
  "main": "server/index.js",
6
6
  "bin": {
@@ -0,0 +1,180 @@
1
+ {
2
+ "protocol": "wap",
3
+ "version": "1.0.0",
4
+ "name": "Web Agent Bridge",
5
+ "description": "Web Execution Layer for AI Agents — Protocol + Runtime + Security + Ecosystem",
6
+ "homepage": "https://webagentbridge.com",
7
+ "spec": "https://webagentbridge.com/.well-known/agent-tools.json",
8
+
9
+ "discovery": {
10
+ "protocol_endpoint": "/api/os/protocol",
11
+ "commands_endpoint": "/api/os/registry/commands",
12
+ "sites_endpoint": "/api/os/registry/sites",
13
+ "templates_endpoint": "/api/os/registry/templates",
14
+ "health_endpoint": "/api/os/observability/health"
15
+ },
16
+
17
+ "capabilities": {
18
+ "browser": {
19
+ "read": { "risk": "low", "description": "Read page content, text, attributes" },
20
+ "click": { "risk": "medium", "description": "Click interactive elements" },
21
+ "fill": { "risk": "medium", "description": "Fill form fields" },
22
+ "navigate": { "risk": "medium", "description": "Navigate to URLs" },
23
+ "scroll": { "risk": "low", "description": "Scroll the page" },
24
+ "screenshot": { "risk": "low", "description": "Capture screenshots" },
25
+ "execute": { "risk": "high", "description": "Execute JavaScript in page" }
26
+ },
27
+ "data": {
28
+ "extract": { "risk": "low", "description": "Extract structured data" },
29
+ "compare": { "risk": "low", "description": "Compare data across sources" },
30
+ "store": { "risk": "medium", "description": "Persist data" }
31
+ },
32
+ "agent": {
33
+ "spawn": { "risk": "high", "description": "Create child agents" },
34
+ "communicate": { "risk": "medium", "description": "Inter-agent messaging" },
35
+ "delegate": { "risk": "high", "description": "Delegate tasks to other agents" }
36
+ },
37
+ "system": {
38
+ "api": { "risk": "medium", "description": "Make API calls" },
39
+ "webhook": { "risk": "medium", "description": "Send webhook notifications" },
40
+ "schedule": { "risk": "medium", "description": "Schedule future tasks" }
41
+ },
42
+ "commerce": {
43
+ "price": { "risk": "low", "description": "Read prices" },
44
+ "negotiate": { "risk": "high", "description": "Negotiate prices" },
45
+ "purchase": { "risk": "critical", "description": "Complete purchases" }
46
+ },
47
+ "ai": {
48
+ "infer": { "risk": "medium", "description": "Run LLM inference" },
49
+ "vision": { "risk": "medium", "description": "Analyze images" },
50
+ "embed": { "risk": "low", "description": "Generate embeddings" }
51
+ }
52
+ },
53
+
54
+ "permissions": {
55
+ "levels": ["none", "read", "write", "execute", "admin", "owner"],
56
+ "default": "read",
57
+ "negotiable": true
58
+ },
59
+
60
+ "security": {
61
+ "authentication": ["api_key", "bearer_token"],
62
+ "signing": "HMAC-SHA256",
63
+ "isolation": "per-site-sandbox",
64
+ "audit": true
65
+ },
66
+
67
+ "runtime": {
68
+ "scheduler": {
69
+ "maxConcurrency": 50,
70
+ "retries": 3,
71
+ "backoff": "exponential",
72
+ "maxBackoff": 30000,
73
+ "priorities": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
74
+ },
75
+ "sandbox": {
76
+ "defaultTimeout": 30000,
77
+ "maxMemory": 134217728,
78
+ "maxNetworkCalls": 100,
79
+ "maxDomOperations": 1000
80
+ },
81
+ "state": {
82
+ "checkpoints": true,
83
+ "rollback": true,
84
+ "ttl": 86400000
85
+ }
86
+ },
87
+
88
+ "adapters": {
89
+ "mcp": { "endpoint": "/api/os/adapters/mcp", "spec": "Model Context Protocol" },
90
+ "rest": { "endpoint": "/api/os/adapters/rest", "spec": "REST/OpenAPI" },
91
+ "browser": { "endpoint": "/api/os/adapters/browser", "spec": "Puppeteer/Playwright/BiDi" }
92
+ },
93
+
94
+ "commands": [
95
+ {
96
+ "name": "wab.discover",
97
+ "version": "1.0.0",
98
+ "category": "discovery",
99
+ "description": "Discover available actions on a site",
100
+ "capabilities": ["browser.read"],
101
+ "input": { "type": "object", "properties": { "siteId": { "type": "string" }, "category": { "type": "string" } } },
102
+ "output": { "type": "object", "properties": { "actions": { "type": "array" }, "meta": { "type": "object" } } }
103
+ },
104
+ {
105
+ "name": "wab.execute",
106
+ "version": "1.0.0",
107
+ "category": "execution",
108
+ "description": "Execute a registered action",
109
+ "capabilities": ["browser.execute"],
110
+ "input": { "type": "object", "properties": { "action": { "type": "string" }, "params": { "type": "object" } }, "required": ["action"] },
111
+ "sideEffects": true
112
+ },
113
+ {
114
+ "name": "wab.semantic.execute",
115
+ "version": "1.0.0",
116
+ "category": "execution",
117
+ "description": "Execute semantic action (e.g., checkout.addItem) without raw selectors",
118
+ "capabilities": ["browser.execute"],
119
+ "input": { "type": "object", "properties": { "domain": { "type": "string" }, "action": { "type": "string" }, "params": { "type": "object" } }, "required": ["domain", "action"] },
120
+ "sideEffects": true
121
+ },
122
+ {
123
+ "name": "wab.agent.register",
124
+ "version": "1.0.0",
125
+ "category": "lifecycle",
126
+ "description": "Register an agent with the runtime",
127
+ "capabilities": [],
128
+ "input": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "type": "string" }, "capabilities": { "type": "array" } }, "required": ["name", "type"] }
129
+ },
130
+ {
131
+ "name": "wab.task.submit",
132
+ "version": "1.0.0",
133
+ "category": "runtime",
134
+ "description": "Submit a task to the scheduler",
135
+ "capabilities": ["system.schedule"],
136
+ "input": { "type": "object", "properties": { "type": { "type": "string" }, "params": { "type": "object" }, "priority": { "type": "integer" } } }
137
+ },
138
+ {
139
+ "name": "wab.commerce.compare",
140
+ "version": "1.0.0",
141
+ "category": "commerce",
142
+ "description": "Compare prices across sources with fairness scoring",
143
+ "capabilities": ["commerce.price", "data.compare"]
144
+ },
145
+ {
146
+ "name": "wab.commerce.negotiate",
147
+ "version": "1.0.0",
148
+ "category": "commerce",
149
+ "description": "Open or continue a price negotiation session",
150
+ "capabilities": ["commerce.negotiate"],
151
+ "sideEffects": true
152
+ },
153
+ {
154
+ "name": "wab.ai.infer",
155
+ "version": "1.0.0",
156
+ "category": "ai",
157
+ "description": "Run LLM inference through the model abstraction layer",
158
+ "capabilities": ["ai.infer"],
159
+ "input": { "type": "object", "properties": { "prompt": { "type": "string" }, "model": { "type": "string" }, "provider": { "type": "string" } }, "required": ["prompt"] }
160
+ }
161
+ ],
162
+
163
+ "ecosystem": {
164
+ "sdks": {
165
+ "javascript": { "npm": "web-agent-bridge-sdk", "version": "2.5.0" },
166
+ "langchain": { "npm": "web-agent-bridge-langchain", "version": "2.5.0" },
167
+ "react": { "npm": "web-agent-bridge-react", "version": "2.5.0" },
168
+ "vue": { "npm": "web-agent-bridge-vue", "version": "2.5.0" },
169
+ "svelte": { "npm": "web-agent-bridge-svelte", "version": "2.5.0" }
170
+ },
171
+ "plugins": {
172
+ "wordpress": "web-agent-bridge-wordpress",
173
+ "mcp_adapter": "wab-mcp-adapter"
174
+ },
175
+ "certification": {
176
+ "endpoint": "/api/os/certification/verify",
177
+ "badge_url": "https://webagentbridge.com/badge/agent-compatible.svg"
178
+ }
179
+ }
180
+ }
package/sdk/index.d.ts CHANGED
@@ -292,3 +292,173 @@ export declare class WABUniversalAgent {
292
292
  /** Get all known competing sources. */
293
293
  sources(): Promise<any>;
294
294
  }
295
+
296
+ // ─── WABAgentOS — Agent OS Runtime Client ──────────────────────────────
297
+
298
+ export interface WABAgentOSOptions {
299
+ /** WAB server base URL (default http://localhost:3000). */
300
+ serverUrl?: string;
301
+ /** Pre-registered agent ID. */
302
+ agentId?: string;
303
+ /** Pre-registered API key. */
304
+ apiKey?: string;
305
+ /** Active session token. */
306
+ sessionToken?: string;
307
+ }
308
+
309
+ export interface AgentRegistration {
310
+ agentId: string;
311
+ apiKey: string;
312
+ message: string;
313
+ }
314
+
315
+ export interface AgentSession {
316
+ sessionToken?: string;
317
+ agentId: string;
318
+ expiresAt: number;
319
+ }
320
+
321
+ export interface ProtocolInfo {
322
+ protocol: string;
323
+ version: string;
324
+ commands: Array<{
325
+ name: string;
326
+ version: string;
327
+ category: string;
328
+ description: string;
329
+ capabilities: string[];
330
+ }>;
331
+ capabilities: string[];
332
+ permissionLevels: Record<string, number>;
333
+ }
334
+
335
+ export interface TaskSubmitResult {
336
+ taskId: string;
337
+ state: string;
338
+ }
339
+
340
+ export interface TaskInfo {
341
+ taskId: string;
342
+ type: string;
343
+ state: string;
344
+ priority: number;
345
+ result?: any;
346
+ error?: string;
347
+ createdAt: number;
348
+ startedAt?: number;
349
+ completedAt?: number;
350
+ }
351
+
352
+ export interface ExecuteResult {
353
+ success: boolean;
354
+ result?: any;
355
+ error?: string;
356
+ traceId?: string;
357
+ duration?: number;
358
+ }
359
+
360
+ export interface RegistryCommand {
361
+ id: string;
362
+ siteId: string;
363
+ name: string;
364
+ description: string;
365
+ category: string;
366
+ version: string;
367
+ tags: string[];
368
+ usageCount: number;
369
+ }
370
+
371
+ export interface RegistrySite {
372
+ domain: string;
373
+ name: string;
374
+ tier: string;
375
+ capabilities: string[];
376
+ verified: boolean;
377
+ }
378
+
379
+ export interface RegistryTemplate {
380
+ id: string;
381
+ name: string;
382
+ description: string;
383
+ category: string;
384
+ steps: any[];
385
+ downloads: number;
386
+ }
387
+
388
+ export interface HealthInfo {
389
+ runtime: any;
390
+ identity: any;
391
+ registry: any;
392
+ executor: any;
393
+ llm: any;
394
+ }
395
+
396
+ export interface LLMCompletionResult {
397
+ text: string;
398
+ provider: string;
399
+ model: string;
400
+ tokens?: { input: number; output: number; total: number };
401
+ cached?: boolean;
402
+ }
403
+
404
+ export declare class WABAgentOS {
405
+ agentId: string | null;
406
+ apiKey: string | null;
407
+ sessionToken: string | null;
408
+
409
+ constructor(options?: WABAgentOSOptions);
410
+
411
+ // Agent Identity
412
+ register(name: string, type: string, capabilities?: string[]): Promise<AgentRegistration>;
413
+ authenticate(apiKey?: string): Promise<AgentSession>;
414
+ negotiateCapabilities(capabilities: string[], siteId?: string): Promise<any>;
415
+
416
+ // Protocol
417
+ getProtocol(): Promise<ProtocolInfo>;
418
+ sendMessage(command: string, payload?: Record<string, unknown>): Promise<any>;
419
+
420
+ // Tasks
421
+ submitTask(task: Record<string, unknown>): Promise<TaskSubmitResult>;
422
+ getTask(taskId: string): Promise<TaskInfo>;
423
+ listTasks(state?: string, limit?: number): Promise<{ tasks: TaskInfo[]; total: number }>;
424
+ cancelTask(taskId: string): Promise<{ success: boolean }>;
425
+ pauseTask(taskId: string): Promise<{ success: boolean }>;
426
+ resumeTask(taskId: string): Promise<{ success: boolean }>;
427
+
428
+ // Execution
429
+ execute(command: Record<string, unknown>): Promise<ExecuteResult>;
430
+ executeSemantic(domain: string, action: string, params?: Record<string, unknown>): Promise<ExecuteResult>;
431
+ executePipeline(steps: Array<Record<string, unknown>>): Promise<ExecuteResult>;
432
+ resolveAction(domain: string, action: string, siteDomain?: string): Promise<any>;
433
+
434
+ // Registry
435
+ searchCommands(query?: Record<string, string>): Promise<{ commands: RegistryCommand[]; total: number }>;
436
+ registerCommand(siteId: string, command: Record<string, unknown>): Promise<RegistryCommand>;
437
+ searchSites(query?: Record<string, string>): Promise<{ sites: RegistrySite[]; total: number }>;
438
+ registerSite(domain: string, info: Record<string, unknown>): Promise<RegistrySite>;
439
+ searchTemplates(query?: Record<string, string>): Promise<{ templates: RegistryTemplate[]; total: number }>;
440
+ getTemplate(templateId: string): Promise<RegistryTemplate>;
441
+
442
+ // LLM
443
+ complete(prompt: string, options?: Record<string, unknown>): Promise<LLMCompletionResult>;
444
+ embed(text: string, options?: Record<string, unknown>): Promise<any>;
445
+ listModels(): Promise<{ models: any[] }>;
446
+
447
+ // Observability
448
+ getMetrics(): Promise<any>;
449
+ getTraces(query?: Record<string, string>): Promise<any>;
450
+ getTrace(traceId: string): Promise<any>;
451
+ getLogs(query?: Record<string, string>): Promise<any>;
452
+ getHealth(): Promise<HealthInfo>;
453
+
454
+ // Events (SSE)
455
+ subscribe(filter: string | null, onEvent: (data: any) => void): EventSource;
456
+
457
+ // Policies
458
+ createPolicy(policy: Record<string, unknown>): Promise<any>;
459
+ evaluatePolicy(entityId: string, action: string, context?: Record<string, unknown>): Promise<any>;
460
+
461
+ // Deploy
462
+ deploy(config?: Record<string, unknown>): Promise<any>;
463
+ listDeployments(query?: Record<string, string>): Promise<any>;
464
+ }