@elizaos/capacitor-gateway 1.0.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/ElizaosCapacitorGateway.podspec +17 -0
- package/android/build.gradle +49 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/ai/eliza/plugins/gateway/GatewayPlugin.kt +614 -0
- package/dist/esm/definitions.d.ts +271 -0
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/web.d.ts +99 -0
- package/dist/esm/web.js +419 -0
- package/dist/plugin.cjs.js +435 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +438 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/GatewayPlugin/GatewayPlugin.swift +631 -0
- package/package.json +103 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const loadWeb = () => Promise.resolve().then(function () { return web; }).then((m) => new m.GatewayWeb());
|
|
6
|
+
const Gateway = core.registerPlugin("Gateway", {
|
|
7
|
+
web: loadWeb,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate a UUID v4
|
|
12
|
+
*/
|
|
13
|
+
function generateUUID() {
|
|
14
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
15
|
+
return crypto.randomUUID();
|
|
16
|
+
}
|
|
17
|
+
if (typeof crypto !== "undefined" &&
|
|
18
|
+
typeof crypto.getRandomValues === "function") {
|
|
19
|
+
const bytes = new Uint8Array(16);
|
|
20
|
+
crypto.getRandomValues(bytes);
|
|
21
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
22
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
23
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
24
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("No secure random source available for UUID generation");
|
|
27
|
+
}
|
|
28
|
+
const isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29
|
+
const getString = (value) => typeof value === "string" ? value : undefined;
|
|
30
|
+
const getNumber = (value) => typeof value === "number" ? value : undefined;
|
|
31
|
+
const getBoolean = (value) => typeof value === "boolean" ? value : undefined;
|
|
32
|
+
const toStringArray = (value) => Array.isArray(value)
|
|
33
|
+
? value.filter((item) => typeof item === "string")
|
|
34
|
+
: [];
|
|
35
|
+
const parseGatewayError = (value) => {
|
|
36
|
+
if (!value || !isJsonObject(value))
|
|
37
|
+
return undefined;
|
|
38
|
+
const code = getString(value.code);
|
|
39
|
+
const message = getString(value.message);
|
|
40
|
+
if (!code || !message)
|
|
41
|
+
return undefined;
|
|
42
|
+
return {
|
|
43
|
+
code,
|
|
44
|
+
message,
|
|
45
|
+
details: value.details,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Web implementation of the Gateway Plugin
|
|
50
|
+
*
|
|
51
|
+
* Uses browser WebSocket API for connectivity.
|
|
52
|
+
* Note: Web platform cannot perform Bonjour/mDNS discovery.
|
|
53
|
+
*/
|
|
54
|
+
class GatewayWeb extends core.WebPlugin {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
this.ws = null;
|
|
58
|
+
this.pending = new Map();
|
|
59
|
+
this.options = null;
|
|
60
|
+
this.sessionId = null;
|
|
61
|
+
this.protocol = null;
|
|
62
|
+
this.role = null;
|
|
63
|
+
this.scopes = [];
|
|
64
|
+
this.methods = [];
|
|
65
|
+
this.events = [];
|
|
66
|
+
this.lastSeq = null;
|
|
67
|
+
this.reconnectTimer = null;
|
|
68
|
+
this.backoffMs = 800;
|
|
69
|
+
this.closed = false;
|
|
70
|
+
this.connectResolve = null;
|
|
71
|
+
this.connectReject = null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Start gateway discovery (not supported on web)
|
|
75
|
+
*
|
|
76
|
+
* On web platforms, Bonjour/mDNS discovery is not available.
|
|
77
|
+
* Returns an empty list of gateways.
|
|
78
|
+
*/
|
|
79
|
+
async startDiscovery() {
|
|
80
|
+
return {
|
|
81
|
+
gateways: [],
|
|
82
|
+
status: "Discovery not supported on web platform",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Stop gateway discovery (no-op on web)
|
|
87
|
+
*/
|
|
88
|
+
async stopDiscovery() {
|
|
89
|
+
// No-op on web
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get discovered gateways (always empty on web)
|
|
93
|
+
*/
|
|
94
|
+
async getDiscoveredGateways() {
|
|
95
|
+
return {
|
|
96
|
+
gateways: [],
|
|
97
|
+
status: "Discovery not supported on web platform",
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Connect to a Gateway server
|
|
102
|
+
*/
|
|
103
|
+
async connect(options) {
|
|
104
|
+
// Close existing connection if any
|
|
105
|
+
if (this.ws) {
|
|
106
|
+
this.closed = true;
|
|
107
|
+
this.ws.close();
|
|
108
|
+
this.ws = null;
|
|
109
|
+
}
|
|
110
|
+
this.options = options;
|
|
111
|
+
this.closed = false;
|
|
112
|
+
this.backoffMs = 800;
|
|
113
|
+
return new Promise((resolve, reject) => {
|
|
114
|
+
this.connectResolve = resolve;
|
|
115
|
+
this.connectReject = reject;
|
|
116
|
+
this.establishConnection();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Establish WebSocket connection
|
|
121
|
+
*/
|
|
122
|
+
establishConnection() {
|
|
123
|
+
if (this.closed || !this.options) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.notifyStateChange("connecting");
|
|
127
|
+
this.ws = new WebSocket(this.options.url);
|
|
128
|
+
this.ws.addEventListener("open", () => {
|
|
129
|
+
this.sendConnectFrame();
|
|
130
|
+
});
|
|
131
|
+
this.ws.addEventListener("message", (event) => {
|
|
132
|
+
this.handleMessage(String(event.data));
|
|
133
|
+
});
|
|
134
|
+
this.ws.addEventListener("close", (event) => {
|
|
135
|
+
const reason = event.reason || "Connection closed";
|
|
136
|
+
this.handleClose(event.code, reason);
|
|
137
|
+
});
|
|
138
|
+
this.ws.addEventListener("error", (event) => {
|
|
139
|
+
console.warn("[Gateway] WebSocket error:", event);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Send the connect frame to authenticate
|
|
144
|
+
*/
|
|
145
|
+
sendConnectFrame() {
|
|
146
|
+
if (!this.ws || !this.options || this.ws.readyState !== WebSocket.OPEN) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const auth = {};
|
|
150
|
+
if (this.options.token) {
|
|
151
|
+
auth.token = this.options.token;
|
|
152
|
+
}
|
|
153
|
+
if (this.options.password) {
|
|
154
|
+
auth.password = this.options.password;
|
|
155
|
+
}
|
|
156
|
+
const params = {
|
|
157
|
+
minProtocol: 3,
|
|
158
|
+
maxProtocol: 3,
|
|
159
|
+
client: {
|
|
160
|
+
id: this.options.clientName || "eliza-capacitor",
|
|
161
|
+
version: this.options.clientVersion || "1.0.0",
|
|
162
|
+
platform: this.getPlatform(),
|
|
163
|
+
mode: "ui",
|
|
164
|
+
},
|
|
165
|
+
role: this.options.role || "operator",
|
|
166
|
+
scopes: this.options.scopes || ["operator.admin"],
|
|
167
|
+
caps: [],
|
|
168
|
+
auth,
|
|
169
|
+
};
|
|
170
|
+
const frame = {
|
|
171
|
+
type: "req",
|
|
172
|
+
id: generateUUID(),
|
|
173
|
+
method: "connect",
|
|
174
|
+
params,
|
|
175
|
+
};
|
|
176
|
+
this.ws.send(JSON.stringify(frame));
|
|
177
|
+
// Set up timeout for connect response
|
|
178
|
+
const timeout = setTimeout(() => {
|
|
179
|
+
if (this.connectReject) {
|
|
180
|
+
this.connectReject(new Error("Connection timeout"));
|
|
181
|
+
this.connectReject = null;
|
|
182
|
+
this.connectResolve = null;
|
|
183
|
+
}
|
|
184
|
+
}, 30000);
|
|
185
|
+
this.pending.set(frame.id, {
|
|
186
|
+
resolve: (result) => {
|
|
187
|
+
clearTimeout(timeout);
|
|
188
|
+
if (result.ok && result.payload && isJsonObject(result.payload)) {
|
|
189
|
+
this.handleHelloOk(result.payload);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
if (this.connectReject) {
|
|
193
|
+
this.connectReject(new Error(result.error?.message || "Connection failed"));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
this.connectReject = null;
|
|
197
|
+
this.connectResolve = null;
|
|
198
|
+
},
|
|
199
|
+
reject: (error) => {
|
|
200
|
+
clearTimeout(timeout);
|
|
201
|
+
if (this.connectReject) {
|
|
202
|
+
this.connectReject(error);
|
|
203
|
+
}
|
|
204
|
+
this.connectReject = null;
|
|
205
|
+
this.connectResolve = null;
|
|
206
|
+
},
|
|
207
|
+
timeout,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Handle successful hello response
|
|
212
|
+
*/
|
|
213
|
+
handleHelloOk(hello) {
|
|
214
|
+
const protocol = getNumber(hello.protocol);
|
|
215
|
+
const auth = isJsonObject(hello.auth) ? hello.auth : null;
|
|
216
|
+
const features = isJsonObject(hello.features) ? hello.features : null;
|
|
217
|
+
this.sessionId = generateUUID();
|
|
218
|
+
this.protocol = protocol ?? null;
|
|
219
|
+
this.role = getString(auth?.role) || this.options?.role || "operator";
|
|
220
|
+
this.scopes = toStringArray(auth?.scopes);
|
|
221
|
+
this.methods = toStringArray(features?.methods);
|
|
222
|
+
this.events = toStringArray(features?.events);
|
|
223
|
+
this.backoffMs = 800;
|
|
224
|
+
this.notifyStateChange("connected");
|
|
225
|
+
if (this.connectResolve) {
|
|
226
|
+
this.connectResolve({
|
|
227
|
+
connected: true,
|
|
228
|
+
sessionId: this.sessionId,
|
|
229
|
+
protocol: this.protocol ?? undefined,
|
|
230
|
+
methods: this.methods,
|
|
231
|
+
events: this.events,
|
|
232
|
+
role: this.role,
|
|
233
|
+
scopes: this.scopes,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Handle incoming WebSocket message
|
|
239
|
+
*/
|
|
240
|
+
handleMessage(raw) {
|
|
241
|
+
let parsedValue;
|
|
242
|
+
try {
|
|
243
|
+
parsedValue = JSON.parse(raw);
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (!isJsonObject(parsedValue)) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const frameType = getString(parsedValue.type);
|
|
252
|
+
if (!frameType) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// Handle response frames
|
|
256
|
+
if (frameType === "res") {
|
|
257
|
+
const id = getString(parsedValue.id);
|
|
258
|
+
if (!id)
|
|
259
|
+
return;
|
|
260
|
+
const pending = this.pending.get(id);
|
|
261
|
+
if (pending) {
|
|
262
|
+
this.pending.delete(id);
|
|
263
|
+
clearTimeout(pending.timeout);
|
|
264
|
+
pending.resolve({
|
|
265
|
+
ok: getBoolean(parsedValue.ok) ?? false,
|
|
266
|
+
payload: parsedValue.payload,
|
|
267
|
+
error: parseGatewayError(parsedValue.error),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
// Handle event frames
|
|
273
|
+
if (frameType === "event") {
|
|
274
|
+
const event = getString(parsedValue.event);
|
|
275
|
+
if (!event)
|
|
276
|
+
return;
|
|
277
|
+
const payload = parsedValue.payload;
|
|
278
|
+
const seq = getNumber(parsedValue.seq);
|
|
279
|
+
// Check for sequence gap
|
|
280
|
+
if (seq !== undefined &&
|
|
281
|
+
this.lastSeq !== null &&
|
|
282
|
+
seq > this.lastSeq + 1) {
|
|
283
|
+
console.warn(`[Gateway] Event sequence gap: expected ${this.lastSeq + 1}, got ${seq}`);
|
|
284
|
+
}
|
|
285
|
+
if (seq !== undefined) {
|
|
286
|
+
this.lastSeq = seq;
|
|
287
|
+
}
|
|
288
|
+
// Emit the event
|
|
289
|
+
this.notifyListeners("gatewayEvent", {
|
|
290
|
+
event,
|
|
291
|
+
payload,
|
|
292
|
+
seq,
|
|
293
|
+
});
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Handle WebSocket close
|
|
299
|
+
*/
|
|
300
|
+
handleClose(code, reason) {
|
|
301
|
+
this.ws = null;
|
|
302
|
+
// Reject all pending requests
|
|
303
|
+
for (const [id, pending] of this.pending) {
|
|
304
|
+
clearTimeout(pending.timeout);
|
|
305
|
+
pending.reject(new Error(`Connection closed: ${reason}`));
|
|
306
|
+
this.pending.delete(id);
|
|
307
|
+
}
|
|
308
|
+
if (this.closed) {
|
|
309
|
+
this.notifyStateChange("disconnected", reason);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
// Attempt reconnection
|
|
313
|
+
this.notifyStateChange("reconnecting", reason);
|
|
314
|
+
this.notifyListeners("error", {
|
|
315
|
+
message: `Connection lost: ${reason}`,
|
|
316
|
+
code: String(code),
|
|
317
|
+
willRetry: true,
|
|
318
|
+
});
|
|
319
|
+
this.scheduleReconnect();
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Schedule a reconnection attempt
|
|
323
|
+
*/
|
|
324
|
+
scheduleReconnect() {
|
|
325
|
+
if (this.closed || this.reconnectTimer) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.reconnectTimer = setTimeout(() => {
|
|
329
|
+
this.reconnectTimer = null;
|
|
330
|
+
this.backoffMs = Math.min(this.backoffMs * 1.7, 15000);
|
|
331
|
+
this.establishConnection();
|
|
332
|
+
}, this.backoffMs);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Notify state change listeners
|
|
336
|
+
*/
|
|
337
|
+
notifyStateChange(state, reason) {
|
|
338
|
+
this.notifyListeners("stateChange", {
|
|
339
|
+
state,
|
|
340
|
+
reason,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Get platform identifier
|
|
345
|
+
*/
|
|
346
|
+
getPlatform() {
|
|
347
|
+
if (typeof navigator !== "undefined") {
|
|
348
|
+
return navigator.platform || "web";
|
|
349
|
+
}
|
|
350
|
+
return "web";
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Disconnect from the Gateway
|
|
354
|
+
*/
|
|
355
|
+
async disconnect() {
|
|
356
|
+
this.closed = true;
|
|
357
|
+
if (this.reconnectTimer) {
|
|
358
|
+
clearTimeout(this.reconnectTimer);
|
|
359
|
+
this.reconnectTimer = null;
|
|
360
|
+
}
|
|
361
|
+
if (this.ws) {
|
|
362
|
+
this.ws.close(1000, "Client disconnect");
|
|
363
|
+
this.ws = null;
|
|
364
|
+
}
|
|
365
|
+
this.sessionId = null;
|
|
366
|
+
this.protocol = null;
|
|
367
|
+
this.notifyStateChange("disconnected", "Client disconnect");
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Check if connected
|
|
371
|
+
*/
|
|
372
|
+
async isConnected() {
|
|
373
|
+
return {
|
|
374
|
+
connected: this.ws !== null && this.ws.readyState === WebSocket.OPEN,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Send an RPC request
|
|
379
|
+
*/
|
|
380
|
+
async send(options) {
|
|
381
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
382
|
+
return {
|
|
383
|
+
ok: false,
|
|
384
|
+
error: {
|
|
385
|
+
code: "NOT_CONNECTED",
|
|
386
|
+
message: "Not connected to gateway",
|
|
387
|
+
},
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
const id = generateUUID();
|
|
391
|
+
const frame = {
|
|
392
|
+
type: "req",
|
|
393
|
+
id,
|
|
394
|
+
method: options.method,
|
|
395
|
+
params: options.params || {},
|
|
396
|
+
};
|
|
397
|
+
return new Promise((resolve, reject) => {
|
|
398
|
+
const timeout = setTimeout(() => {
|
|
399
|
+
this.pending.delete(id);
|
|
400
|
+
resolve({
|
|
401
|
+
ok: false,
|
|
402
|
+
error: {
|
|
403
|
+
code: "TIMEOUT",
|
|
404
|
+
message: "Request timed out",
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
}, 60000); // 60 second timeout
|
|
408
|
+
this.pending.set(id, {
|
|
409
|
+
resolve,
|
|
410
|
+
reject,
|
|
411
|
+
timeout,
|
|
412
|
+
});
|
|
413
|
+
this.ws?.send(JSON.stringify(frame));
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Get connection info
|
|
418
|
+
*/
|
|
419
|
+
async getConnectionInfo() {
|
|
420
|
+
return {
|
|
421
|
+
url: this.options?.url || null,
|
|
422
|
+
sessionId: this.sessionId,
|
|
423
|
+
protocol: this.protocol,
|
|
424
|
+
role: this.role,
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
430
|
+
__proto__: null,
|
|
431
|
+
GatewayWeb: GatewayWeb
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
exports.Gateway = Gateway;
|
|
435
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.GatewayWeb());\nexport const Gateway = registerPlugin(\"Gateway\", {\n web: loadWeb,\n});\n","import { WebPlugin } from \"@capacitor/core\";\n/**\n * Generate a UUID v4\n */\nfunction generateUUID() {\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n if (typeof crypto !== \"undefined\" &&\n typeof crypto.getRandomValues === \"function\") {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n }\n throw new Error(\"No secure random source available for UUID generation\");\n}\nconst isJsonObject = (value) => typeof value === \"object\" && value !== null && !Array.isArray(value);\nconst getString = (value) => typeof value === \"string\" ? value : undefined;\nconst getNumber = (value) => typeof value === \"number\" ? value : undefined;\nconst getBoolean = (value) => typeof value === \"boolean\" ? value : undefined;\nconst toStringArray = (value) => Array.isArray(value)\n ? value.filter((item) => typeof item === \"string\")\n : [];\nconst parseGatewayError = (value) => {\n if (!value || !isJsonObject(value))\n return undefined;\n const code = getString(value.code);\n const message = getString(value.message);\n if (!code || !message)\n return undefined;\n return {\n code,\n message,\n details: value.details,\n };\n};\n/**\n * Web implementation of the Gateway Plugin\n *\n * Uses browser WebSocket API for connectivity.\n * Note: Web platform cannot perform Bonjour/mDNS discovery.\n */\nexport class GatewayWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.ws = null;\n this.pending = new Map();\n this.options = null;\n this.sessionId = null;\n this.protocol = null;\n this.role = null;\n this.scopes = [];\n this.methods = [];\n this.events = [];\n this.lastSeq = null;\n this.reconnectTimer = null;\n this.backoffMs = 800;\n this.closed = false;\n this.connectResolve = null;\n this.connectReject = null;\n }\n /**\n * Start gateway discovery (not supported on web)\n *\n * On web platforms, Bonjour/mDNS discovery is not available.\n * Returns an empty list of gateways.\n */\n async startDiscovery() {\n return {\n gateways: [],\n status: \"Discovery not supported on web platform\",\n };\n }\n /**\n * Stop gateway discovery (no-op on web)\n */\n async stopDiscovery() {\n // No-op on web\n }\n /**\n * Get discovered gateways (always empty on web)\n */\n async getDiscoveredGateways() {\n return {\n gateways: [],\n status: \"Discovery not supported on web platform\",\n };\n }\n /**\n * Connect to a Gateway server\n */\n async connect(options) {\n // Close existing connection if any\n if (this.ws) {\n this.closed = true;\n this.ws.close();\n this.ws = null;\n }\n this.options = options;\n this.closed = false;\n this.backoffMs = 800;\n return new Promise((resolve, reject) => {\n this.connectResolve = resolve;\n this.connectReject = reject;\n this.establishConnection();\n });\n }\n /**\n * Establish WebSocket connection\n */\n establishConnection() {\n if (this.closed || !this.options) {\n return;\n }\n this.notifyStateChange(\"connecting\");\n this.ws = new WebSocket(this.options.url);\n this.ws.addEventListener(\"open\", () => {\n this.sendConnectFrame();\n });\n this.ws.addEventListener(\"message\", (event) => {\n this.handleMessage(String(event.data));\n });\n this.ws.addEventListener(\"close\", (event) => {\n const reason = event.reason || \"Connection closed\";\n this.handleClose(event.code, reason);\n });\n this.ws.addEventListener(\"error\", (event) => {\n console.warn(\"[Gateway] WebSocket error:\", event);\n });\n }\n /**\n * Send the connect frame to authenticate\n */\n sendConnectFrame() {\n if (!this.ws || !this.options || this.ws.readyState !== WebSocket.OPEN) {\n return;\n }\n const auth = {};\n if (this.options.token) {\n auth.token = this.options.token;\n }\n if (this.options.password) {\n auth.password = this.options.password;\n }\n const params = {\n minProtocol: 3,\n maxProtocol: 3,\n client: {\n id: this.options.clientName || \"eliza-capacitor\",\n version: this.options.clientVersion || \"1.0.0\",\n platform: this.getPlatform(),\n mode: \"ui\",\n },\n role: this.options.role || \"operator\",\n scopes: this.options.scopes || [\"operator.admin\"],\n caps: [],\n auth,\n };\n const frame = {\n type: \"req\",\n id: generateUUID(),\n method: \"connect\",\n params,\n };\n this.ws.send(JSON.stringify(frame));\n // Set up timeout for connect response\n const timeout = setTimeout(() => {\n if (this.connectReject) {\n this.connectReject(new Error(\"Connection timeout\"));\n this.connectReject = null;\n this.connectResolve = null;\n }\n }, 30000);\n this.pending.set(frame.id, {\n resolve: (result) => {\n clearTimeout(timeout);\n if (result.ok && result.payload && isJsonObject(result.payload)) {\n this.handleHelloOk(result.payload);\n }\n else {\n if (this.connectReject) {\n this.connectReject(new Error(result.error?.message || \"Connection failed\"));\n }\n }\n this.connectReject = null;\n this.connectResolve = null;\n },\n reject: (error) => {\n clearTimeout(timeout);\n if (this.connectReject) {\n this.connectReject(error);\n }\n this.connectReject = null;\n this.connectResolve = null;\n },\n timeout,\n });\n }\n /**\n * Handle successful hello response\n */\n handleHelloOk(hello) {\n const protocol = getNumber(hello.protocol);\n const auth = isJsonObject(hello.auth) ? hello.auth : null;\n const features = isJsonObject(hello.features) ? hello.features : null;\n this.sessionId = generateUUID();\n this.protocol = protocol ?? null;\n this.role = getString(auth?.role) || this.options?.role || \"operator\";\n this.scopes = toStringArray(auth?.scopes);\n this.methods = toStringArray(features?.methods);\n this.events = toStringArray(features?.events);\n this.backoffMs = 800;\n this.notifyStateChange(\"connected\");\n if (this.connectResolve) {\n this.connectResolve({\n connected: true,\n sessionId: this.sessionId,\n protocol: this.protocol ?? undefined,\n methods: this.methods,\n events: this.events,\n role: this.role,\n scopes: this.scopes,\n });\n }\n }\n /**\n * Handle incoming WebSocket message\n */\n handleMessage(raw) {\n let parsedValue;\n try {\n parsedValue = JSON.parse(raw);\n }\n catch {\n return;\n }\n if (!isJsonObject(parsedValue)) {\n return;\n }\n const frameType = getString(parsedValue.type);\n if (!frameType) {\n return;\n }\n // Handle response frames\n if (frameType === \"res\") {\n const id = getString(parsedValue.id);\n if (!id)\n return;\n const pending = this.pending.get(id);\n if (pending) {\n this.pending.delete(id);\n clearTimeout(pending.timeout);\n pending.resolve({\n ok: getBoolean(parsedValue.ok) ?? false,\n payload: parsedValue.payload,\n error: parseGatewayError(parsedValue.error),\n });\n }\n return;\n }\n // Handle event frames\n if (frameType === \"event\") {\n const event = getString(parsedValue.event);\n if (!event)\n return;\n const payload = parsedValue.payload;\n const seq = getNumber(parsedValue.seq);\n // Check for sequence gap\n if (seq !== undefined &&\n this.lastSeq !== null &&\n seq > this.lastSeq + 1) {\n console.warn(`[Gateway] Event sequence gap: expected ${this.lastSeq + 1}, got ${seq}`);\n }\n if (seq !== undefined) {\n this.lastSeq = seq;\n }\n // Emit the event\n this.notifyListeners(\"gatewayEvent\", {\n event,\n payload,\n seq,\n });\n return;\n }\n }\n /**\n * Handle WebSocket close\n */\n handleClose(code, reason) {\n this.ws = null;\n // Reject all pending requests\n for (const [id, pending] of this.pending) {\n clearTimeout(pending.timeout);\n pending.reject(new Error(`Connection closed: ${reason}`));\n this.pending.delete(id);\n }\n if (this.closed) {\n this.notifyStateChange(\"disconnected\", reason);\n return;\n }\n // Attempt reconnection\n this.notifyStateChange(\"reconnecting\", reason);\n this.notifyListeners(\"error\", {\n message: `Connection lost: ${reason}`,\n code: String(code),\n willRetry: true,\n });\n this.scheduleReconnect();\n }\n /**\n * Schedule a reconnection attempt\n */\n scheduleReconnect() {\n if (this.closed || this.reconnectTimer) {\n return;\n }\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null;\n this.backoffMs = Math.min(this.backoffMs * 1.7, 15000);\n this.establishConnection();\n }, this.backoffMs);\n }\n /**\n * Notify state change listeners\n */\n notifyStateChange(state, reason) {\n this.notifyListeners(\"stateChange\", {\n state,\n reason,\n });\n }\n /**\n * Get platform identifier\n */\n getPlatform() {\n if (typeof navigator !== \"undefined\") {\n return navigator.platform || \"web\";\n }\n return \"web\";\n }\n /**\n * Disconnect from the Gateway\n */\n async disconnect() {\n this.closed = true;\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer);\n this.reconnectTimer = null;\n }\n if (this.ws) {\n this.ws.close(1000, \"Client disconnect\");\n this.ws = null;\n }\n this.sessionId = null;\n this.protocol = null;\n this.notifyStateChange(\"disconnected\", \"Client disconnect\");\n }\n /**\n * Check if connected\n */\n async isConnected() {\n return {\n connected: this.ws !== null && this.ws.readyState === WebSocket.OPEN,\n };\n }\n /**\n * Send an RPC request\n */\n async send(options) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n return {\n ok: false,\n error: {\n code: \"NOT_CONNECTED\",\n message: \"Not connected to gateway\",\n },\n };\n }\n const id = generateUUID();\n const frame = {\n type: \"req\",\n id,\n method: options.method,\n params: options.params || {},\n };\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(id);\n resolve({\n ok: false,\n error: {\n code: \"TIMEOUT\",\n message: \"Request timed out\",\n },\n });\n }, 60000); // 60 second timeout\n this.pending.set(id, {\n resolve,\n reject,\n timeout,\n });\n this.ws?.send(JSON.stringify(frame));\n });\n }\n /**\n * Get connection info\n */\n async getConnectionInfo() {\n return {\n url: this.options?.url || null,\n sessionId: this.sessionId,\n protocol: this.protocol,\n role: this.role,\n };\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AACzD,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;AACjD,IAAI,GAAG,EAAE,OAAO;AAChB,CAAC;;ACJD;AACA;AACA;AACA,SAAS,YAAY,GAAG;AACxB,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,EAAE;AAC5D,QAAQ,OAAO,MAAM,CAAC,UAAU,EAAE;AAClC,IAAI;AACJ,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW;AACrC,QAAQ,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU,EAAE;AACtD,QAAQ,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC;AACxC,QAAQ,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC;AACrC,QAAQ,KAAK,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