@adapt-toolkit/sdk 0.6.2 → 0.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.
@@ -1,5 +1,2 @@
1
1
  export * from './broker_client.js';
2
- export * from './broker_configurator.js';
3
- export * from './broker.js';
4
- export * from './pending_message_store.js';
5
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/broker/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/broker/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAA"}
@@ -1,5 +1,4 @@
1
+ // The broker *server* (Broker, BrokerConfigurator, PendingMessageStore) lives in
2
+ // @adapt-toolkit/broker; only the client side wrappers need ships here.
1
3
  export * from './broker_client.js';
2
- export * from './broker_configurator.js';
3
- export * from './broker.js';
4
- export * from './pending_message_store.js';
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/broker/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/broker/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wEAAwE;AACxE,cAAc,oBAAoB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adapt-toolkit/sdk",
3
- "version": "0.6.2",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "description": "TypeScript SDK for the ADAPT framework. One install for browser, Node, and React Native; the runtime picks a native, WASM, or platform-native backend automatically.",
@@ -102,7 +102,6 @@
102
102
  },
103
103
  "dependencies": {
104
104
  "async": "^3.2.5",
105
- "better-sqlite3": "^11.10.0",
106
105
  "express": "^4.19.0",
107
106
  "hi-base32": "^0.5.1",
108
107
  "isomorphic-ws": "^5.0.0",
@@ -110,8 +109,7 @@
110
109
  "ws": "^8.16.0"
111
110
  },
112
111
  "optionalDependencies": {
113
- "@adapt-toolkit/sdk-native": "0.6.2",
114
- "geoip-lite": "^1.4.10"
112
+ "@adapt-toolkit/sdk-native": "0.8.0"
115
113
  },
116
114
  "peerDependencies": {
117
115
  "@adapt-toolkit/sdk-react-native": "0.1.0"
@@ -130,8 +128,5 @@
130
128
  "bugs": {
131
129
  "url": "https://github.com/adapt-toolkit/adapt/issues"
132
130
  },
133
- "author": "Adapt Framework Solutions Ltd.",
134
- "devDependencies": {
135
- "@types/better-sqlite3": "^7.6.13"
136
- }
131
+ "author": "Adapt Framework Solutions Ltd."
137
132
  }
@@ -1,30 +0,0 @@
1
- import { AdaptValue } from '@adapt-toolkit/sdk/backend';
2
- import { HttpServer, AsyncQueueAdapter, NetworkComponentI } from '../common/index.js';
3
- import { Protocol } from '../../wrapper/index.js';
4
- import { BrokerConfigurator } from './broker_configurator.js';
5
- declare namespace Broker {
6
- type EventKind = 'incoming_message' | 'outgoing_message';
7
- type Event = {
8
- kind: EventKind;
9
- connection_id: number;
10
- frame: Uint8Array;
11
- type?: Protocol.MessageName;
12
- to_hex?: string;
13
- parse_payload?: () => AdaptValue;
14
- to_cid?: string;
15
- pending_row_id?: number;
16
- };
17
- }
18
- export declare class Broker extends HttpServer implements NetworkComponentI<BrokerConfigurator> {
19
- #private;
20
- queue: AsyncQueueAdapter<Broker.Event>;
21
- config: BrokerConfigurator;
22
- constructor(broker_configuration: BrokerConfigurator);
23
- connection_closed(connection_id: number): void;
24
- last_reg_nonce_for_test(): string;
25
- is_cid_registered_for_test(cid: string): boolean;
26
- start: () => void;
27
- maybe_apply_backpressure(): void;
28
- }
29
- export {};
30
- //# sourceMappingURL=broker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../../src/utilities/broker/broker.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAyC,MAAM,UAAU,CAAA;AAG5E,OAAO,EAA4C,UAAU,EAAE,iBAAiB,EAAiG,iBAAiB,EAAkD,MAAM,oBAAoB,CAAA;AAC9Q,OAAO,EAAsB,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAiQ7D,kBAAO,MAAM,CAAC;IACV,KAAY,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CAAA;IAI/D,KAAY,KAAK,GAAG;QAChB,IAAI,EAAE,SAAS,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,UAAU,CAAC;QAClB,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,UAAU,CAAC;QACjC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAA;CACJ;AACD,qBAAa,MAAO,SAAQ,UAAW,YAAW,iBAAiB,CAAC,kBAAkB,CAAC;;IACnF,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IA4BtC,MAAM,EAAE,kBAAkB,CAAA;gBAEd,oBAAoB,EAAE,kBAAkB;IAmDpD,iBAAiB,CAAC,aAAa,EAAE,MAAM;IAsBvC,uBAAuB,IAAI,MAAM;IAMjC,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IA4HhD,KAAK,aA2DJ;IAsCD,wBAAwB;CAyI3B"}
@@ -1,649 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { fileURLToPath } from 'url';
3
- import { dirname, join } from 'path';
4
- import { monitorEventLoopDelay } from 'perf_hooks';
5
- import { AdaptObjectLifetime } from '@adapt-toolkit/sdk/backend';
6
- import { ExitHandlerRegistrar } from '../../wrapper/index.js';
7
- import { AdaptProtocolWSConnection, HttpServer, AsyncQueueAdapter, AdaptNetworkError, AdaptNetworkErrorType, AdaptProtocolError, AdaptProtocolErrorType, logging } from '../common/index.js';
8
- import { AdaptObjectBuilder, Protocol } from '../../wrapper/index.js';
9
- import { encodeFrame, patchFrameType, cidHexToBytes } from '../../wrapper/protocol/broker_frame.js';
10
- import { PendingMessageStore } from './pending_message_store.js';
11
- import { createRequire } from 'module';
12
- const __broker_require = createRequire(import.meta.url);
13
- let geoip = null;
14
- try {
15
- geoip = __broker_require('geoip-lite');
16
- }
17
- catch {
18
- geoip = null;
19
- }
20
- const BROKER_VERSION = (() => {
21
- try {
22
- const pkg = join(dirname(fileURLToPath(import.meta.url)), '../../../package.json');
23
- return JSON.parse(readFileSync(pkg, 'utf8')).version ?? 'dev';
24
- }
25
- catch {
26
- return 'dev';
27
- }
28
- })();
29
- function normalize_ip(ip) {
30
- return ip.startsWith('::ffff:') ? ip.slice(7) : ip;
31
- }
32
- function extract_remote_ip(request) {
33
- try {
34
- const xff = request?.headers?.['x-forwarded-for'];
35
- if (typeof xff === 'string' && xff.length > 0)
36
- return normalize_ip(xff.split(',')[0].trim());
37
- const ra = request?.socket?.remoteAddress;
38
- return typeof ra === 'string' ? normalize_ip(ra) : undefined;
39
- }
40
- catch {
41
- return undefined;
42
- }
43
- }
44
- function is_private_ip(ip) {
45
- if (ip === '::1' || ip.startsWith('127.') || ip.startsWith('10.') || ip.startsWith('192.168.') || ip.startsWith('fc') || ip.startsWith('fd'))
46
- return true;
47
- const m = ip.match(/^172\.(\d+)\./);
48
- if (m) {
49
- const o = Number(m[1]);
50
- if (o >= 16 && o <= 31)
51
- return true;
52
- }
53
- return false;
54
- }
55
- function country_of(ip) {
56
- if (!ip)
57
- return 'unknown';
58
- if (is_private_ip(ip))
59
- return 'local';
60
- const cc = geoip?.lookup(ip)?.country;
61
- return cc && cc.length ? cc : 'unknown';
62
- }
63
- function round2(n) {
64
- return Number.isFinite(n) ? Math.round(n * 100) / 100 : 0;
65
- }
66
- function fmt_int(n) {
67
- return Math.round(n).toLocaleString('en-US');
68
- }
69
- function fmt_uptime(s) {
70
- const d = Math.floor(s / 86400), h = Math.floor((s % 86400) / 3600), m = Math.floor((s % 3600) / 60);
71
- const parts = [];
72
- if (d)
73
- parts.push(d + 'd');
74
- if (h || d)
75
- parts.push(h + 'h');
76
- parts.push(m + 'm');
77
- return parts.join(' ');
78
- }
79
- function render_info_html(info) {
80
- const t = info.traffic;
81
- const country_entries = Object.entries(info.countries);
82
- const geo_label = info.broker.geoip ? 'Countries' : 'Countries (geoip-lite not installed)';
83
- const geo_rows = country_entries.length
84
- ? country_entries.slice(0, 12).map(([cc, v]) => `<div class="tr"><span class="k">${cc}</span><span class="v">${fmt_int(v.conns_now)} now &middot; ${fmt_int(v.ips_total)} IPs</span></div>`).join('\n ')
85
- : '<div class="tr"><span class="k">no clients yet</span><span class="v"></span></div>';
86
- return `<!doctype html>
87
- <html lang="en">
88
- <head>
89
- <meta charset="utf-8">
90
- <meta name="viewport" content="width=device-width, initial-scale=1">
91
- <meta http-equiv="refresh" content="5">
92
- <title>ADAPT broker</title>
93
- <style>
94
- :root { color-scheme: dark; }
95
- * { box-sizing: border-box; }
96
- body { margin: 0; min-height: 100vh; display: grid; place-items: center;
97
- background: radial-gradient(1200px 600px at 50% -10%, #16223a, #0a0e17 60%);
98
- color: #e6edf3; font: 15px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
99
- .card { width: min(560px, 92vw); background: #0e1422; border: 1px solid #1f2a44;
100
- border-radius: 16px; padding: 28px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
101
- .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
102
- border-bottom: 1px solid #1f2a44; padding-bottom: 14px; margin-bottom: 20px; }
103
- .title { font-size: 17px; font-weight: 600; letter-spacing: .04em; }
104
- .live { color: #34d399; font-size: 12px; } .live b { font-weight: 700; }
105
- .sub { color: #7d8aa3; font-size: 12px; }
106
- .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
107
- .metric { background: #0a1020; border: 1px solid #1a2336; border-radius: 11px; padding: 13px 14px; }
108
- .label { color: #8a97b2; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
109
- .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
110
- .value small { font-size: 13px; font-weight: 400; color: #7d8aa3; }
111
- .full { grid-column: 1 / -1; }
112
- .tr { display: flex; justify-content: space-between; margin-top: 6px; }
113
- .tr .k { color: #8a97b2; } .tr .v { font-weight: 600; }
114
- .foot { margin-top: 18px; color: #56627d; font-size: 11px; text-align: right; }
115
- </style>
116
- </head>
117
- <body>
118
- <div class="card">
119
- <div class="head">
120
- <span class="title">ADAPT&nbsp;broker</span>
121
- <span class="live"><b>&#9679;</b> live &middot; up ${fmt_uptime(info.broker.uptime_s)}</span>
122
- </div>
123
- <div class="grid">
124
- <div class="metric"><div class="label">Packets connected</div>
125
- <div class="value">${fmt_int(info.packets.now)} <small>/ ${fmt_int(info.packets.total)} total</small></div></div>
126
- <div class="metric"><div class="label">Live connections</div>
127
- <div class="value">${fmt_int(info.connections.now)} <small>/ ${fmt_int(info.connections.accepted_total)} accepted</small></div></div>
128
- <div class="metric"><div class="label">Unique IPs now</div>
129
- <div class="value">${fmt_int(info.ips.now)} <small>/ ${fmt_int(info.ips.distinct_total)} total</small></div></div>
130
- <div class="metric"><div class="label">Version</div>
131
- <div class="value" style="font-size:18px">${info.broker.version}</div></div>
132
- <div class="metric full"><div class="label">Traffic &middot; last ${t.window_s}s</div>
133
- <div class="tr"><span class="k">in</span><span class="v">${round2(t.mb_in_per_min)} MB/min &middot; ${fmt_int(t.msg_in_per_min)} msg/min</span></div>
134
- <div class="tr"><span class="k">out</span><span class="v">${round2(t.mb_out_per_min)} MB/min &middot; ${fmt_int(t.msg_out_per_min)} msg/min</span></div>
135
- </div>
136
- <div class="metric full"><div class="label">Broker process</div>
137
- <div class="tr"><span class="k">cpu</span><span class="v">${round2(info.process.cpu_pct)}%</span></div>
138
- <div class="tr"><span class="k">rss</span><span class="v">${round2(info.process.rss_mb)} MB</span></div>
139
- <div class="tr"><span class="k">loop lag p99</span><span class="v">${round2(info.process.event_loop_lag_p99_ms)} ms</span></div>
140
- </div>
141
- <div class="metric full"><div class="label">${geo_label}</div>
142
- ${geo_rows}
143
- </div>
144
- </div>
145
- <div class="foot">auto-refresh 5s &middot; GET /info (Accept: application/json) for raw data</div>
146
- </div>
147
- </body>
148
- </html>`;
149
- }
150
- class AdaptPacketInfo {
151
- cid;
152
- connected_containers = new Set(); // list of ids of containers, that has identity proof document of THIS container
153
- constructor(packet_id) {
154
- this.cid = packet_id;
155
- }
156
- add_connected_container(cid) {
157
- this.connected_containers.add(cid);
158
- }
159
- ip_should_be_attached(cid) {
160
- return !this.connected_containers.has(cid);
161
- }
162
- }
163
- class Connection extends AdaptProtocolWSConnection {
164
- broker;
165
- managed_packets = new Set();
166
- connection_id;
167
- responded = false;
168
- remote_ip;
169
- country;
170
- reg_nonce = "";
171
- nonce_lt = new AdaptObjectLifetime();
172
- nonce_av;
173
- static last_connection_id = 0;
174
- constructor(broker, socket) {
175
- super(socket, false);
176
- this.broker = broker;
177
- this.connection_id = Connection.last_connection_id++;
178
- this.on('message', this.on_message_impl.bind(this));
179
- this.on('close', this.on_close_impl.bind(this));
180
- }
181
- on_message_impl(incoming) {
182
- this.responded = true;
183
- this.broker.queue.push({
184
- kind: 'incoming_message',
185
- connection_id: this.connection_id,
186
- frame: incoming.frame,
187
- type: incoming.type,
188
- to_hex: incoming.toHex,
189
- parse_payload: incoming.parsePayload,
190
- });
191
- this.broker.maybe_apply_backpressure();
192
- }
193
- on_close_impl(code, reason) {
194
- logging.info("Socket connections closed with code:", code);
195
- this.broker.connection_closed(this.connection_id);
196
- }
197
- add_packet(cid) {
198
- this.managed_packets.add(cid);
199
- }
200
- delete_packet(cid) {
201
- this.managed_packets.delete(cid);
202
- }
203
- }
204
- /**
205
- *
206
- * Manages connections with single packet. Stores information about web socket connection
207
- */
208
- class PacketConnection {
209
- connection;
210
- packet_info;
211
- constructor(connection, packet_info) {
212
- this.connection = connection;
213
- this.connection.add_packet(packet_info.cid);
214
- this.packet_info = packet_info;
215
- }
216
- get connection_id() {
217
- return this.connection.connection_id;
218
- }
219
- send_frame(frame) {
220
- this.connection.send_frame(frame);
221
- }
222
- }
223
- const IDLE_SWEEP_INTERVAL_MS = 10_000;
224
- const IDLE_TIMEOUT_MS = 35_000;
225
- const QUEUE_HIGH_WATER_MARK = 1_000;
226
- const QUEUE_LOW_WATER_MARK = 250;
227
- export class Broker extends HttpServer {
228
- queue;
229
- #connections = {};
230
- #connections_by_cid = {};
231
- #pending_messages_by_cid = {};
232
- #pending_store;
233
- #worker_functions;
234
- #global_lifetime = new AdaptObjectLifetime();
235
- #inbound_paused = false;
236
- #started_at = Date.now();
237
- #connections_accepted_total = 0;
238
- #all_ips = new Set();
239
- #ips_by_country = new Map();
240
- #all_cids = new Set();
241
- #closed_bytes_in = 0;
242
- #closed_bytes_out = 0;
243
- #closed_messages_in = 0;
244
- #closed_messages_out = 0;
245
- #traffic_samples = [];
246
- #traffic_sample_timer;
247
- #eld = monitorEventLoopDelay({ resolution: 20 });
248
- #last_cpu = process.cpuUsage();
249
- #last_cpu_at = Date.now();
250
- #cpu_pct = 0;
251
- config;
252
- constructor(broker_configuration) {
253
- super(broker_configuration.host, broker_configuration.port);
254
- this.config = broker_configuration;
255
- if (broker_configuration.db_path) {
256
- this.#pending_store = new PendingMessageStore(broker_configuration.db_path);
257
- logging.info("Persistent pending message store enabled at:", broker_configuration.db_path);
258
- }
259
- this.queue = new AsyncQueueAdapter(this.#worker.bind(this));
260
- this.#eld.enable();
261
- this.#worker_functions = new Map([
262
- [Protocol.MessageName.w2b_reg, this.#w2b_reg_v1_handler.bind(this)],
263
- [Protocol.MessageName.w2b_transaction, this.#w2b_transaction_v1_handler.bind(this)]
264
- ]);
265
- ExitHandlerRegistrar.getInstance().registerOnExitHandler(() => {
266
- if (this.#idle_sweep_timer)
267
- clearInterval(this.#idle_sweep_timer);
268
- if (this.#traffic_sample_timer)
269
- clearInterval(this.#traffic_sample_timer);
270
- this.#pending_store?.close();
271
- console.log(`Destroying ${this.#global_lifetime.size} objects from Broker lifetime`);
272
- this.#global_lifetime.Finalize();
273
- });
274
- }
275
- #add_pending_message(frame, to) {
276
- logging.debug("Adding pending message to container:", to);
277
- if (this.#pending_store) {
278
- this.#pending_store.add(to, frame);
279
- }
280
- else {
281
- if (!(to in this.#pending_messages_by_cid))
282
- this.#pending_messages_by_cid[to] = [];
283
- this.#pending_messages_by_cid[to].push(frame);
284
- }
285
- }
286
- // Build an outgoing frame from a freshly-created control message, then free the
287
- // AdaptValue. `to_hex` is null for broker-directed control messages.
288
- #build_frame(type, to_hex, payload) {
289
- try {
290
- const inner = payload.Serialize();
291
- const to = to_hex ? cidHexToBytes(to_hex) : null;
292
- return encodeFrame(type, to, inner instanceof Uint8Array ? inner : new Uint8Array(inner));
293
- }
294
- finally {
295
- payload.Destroy();
296
- }
297
- }
298
- connection_closed(connection_id) {
299
- if (connection_id in this.#connections) {
300
- const connection = this.#connections[connection_id];
301
- this.#closed_bytes_in += connection.bytes_in;
302
- this.#closed_bytes_out += connection.bytes_out;
303
- this.#closed_messages_in += connection.messages_in;
304
- this.#closed_messages_out += connection.messages_out;
305
- connection.managed_packets.forEach((cid) => {
306
- if (this.#connections_by_cid[cid]?.connection_id === connection_id)
307
- delete this.#connections_by_cid[cid];
308
- else
309
- logging.debug("Packet ", cid, " has already re-registered on another connection, keeping the new registration");
310
- });
311
- connection.nonce_lt.Finalize();
312
- delete this.#connections[connection_id];
313
- }
314
- else {
315
- logging.warning("Task 'socket_close' with connection_id ", connection_id, " that is not known to us, ignoring");
316
- }
317
- }
318
- last_reg_nonce_for_test() {
319
- const ids = Object.keys(this.#connections).map(Number);
320
- if (ids.length === 0)
321
- return '';
322
- return this.#connections[Math.max(...ids)].reg_nonce;
323
- }
324
- is_cid_registered_for_test(cid) {
325
- return cid in this.#connections_by_cid;
326
- }
327
- #idle_sweep_timer;
328
- #start_idle_sweep() {
329
- this.#idle_sweep_timer = setInterval(() => {
330
- const now = Date.now();
331
- for (const connection of Object.values(this.#connections)) {
332
- if (connection.heartbeat_received && now - connection.last_activity_ms > IDLE_TIMEOUT_MS) {
333
- logging.warning("Connection ", connection.connection_id, " timed out (no heartbeat), terminating");
334
- connection.terminate();
335
- }
336
- }
337
- }, IDLE_SWEEP_INTERVAL_MS);
338
- if (typeof this.#idle_sweep_timer?.unref === 'function')
339
- this.#idle_sweep_timer.unref();
340
- }
341
- #total_bytes_in() {
342
- let s = this.#closed_bytes_in;
343
- for (const c of Object.values(this.#connections))
344
- s += c.bytes_in;
345
- return s;
346
- }
347
- #total_bytes_out() {
348
- let s = this.#closed_bytes_out;
349
- for (const c of Object.values(this.#connections))
350
- s += c.bytes_out;
351
- return s;
352
- }
353
- #total_messages_in() {
354
- let s = this.#closed_messages_in;
355
- for (const c of Object.values(this.#connections))
356
- s += c.messages_in;
357
- return s;
358
- }
359
- #total_messages_out() {
360
- let s = this.#closed_messages_out;
361
- for (const c of Object.values(this.#connections))
362
- s += c.messages_out;
363
- return s;
364
- }
365
- #start_traffic_sampler() {
366
- const sample = () => {
367
- const now = Date.now();
368
- this.#traffic_samples.push({
369
- t: now,
370
- bi: this.#total_bytes_in(),
371
- bo: this.#total_bytes_out(),
372
- mi: this.#total_messages_in(),
373
- mo: this.#total_messages_out(),
374
- });
375
- const cutoff = now - 70_000;
376
- while (this.#traffic_samples.length > 1 && this.#traffic_samples[0].t < cutoff)
377
- this.#traffic_samples.shift();
378
- const cpu = process.cpuUsage(this.#last_cpu);
379
- const elapsed_us = (now - this.#last_cpu_at) * 1000;
380
- this.#cpu_pct = elapsed_us > 0 ? round2(((cpu.user + cpu.system) / elapsed_us) * 100) : 0;
381
- this.#last_cpu = process.cpuUsage();
382
- this.#last_cpu_at = now;
383
- };
384
- sample();
385
- this.#traffic_sample_timer = setInterval(sample, 5_000);
386
- if (typeof this.#traffic_sample_timer?.unref === 'function')
387
- this.#traffic_sample_timer.unref();
388
- }
389
- #traffic_rates() {
390
- const now = Date.now();
391
- const base = this.#traffic_samples[0];
392
- const cur = { bi: this.#total_bytes_in(), bo: this.#total_bytes_out(), mi: this.#total_messages_in(), mo: this.#total_messages_out() };
393
- if (!base || now - base.t < 1_000)
394
- return { msg_in_per_min: 0, mb_in_per_min: 0, msg_out_per_min: 0, mb_out_per_min: 0, window_s: 0 };
395
- const min = (now - base.t) / 60_000;
396
- const MB = 1024 * 1024;
397
- return {
398
- msg_in_per_min: Math.round((cur.mi - base.mi) / min),
399
- mb_in_per_min: round2((cur.bi - base.bi) / MB / min),
400
- msg_out_per_min: Math.round((cur.mo - base.mo) / min),
401
- mb_out_per_min: round2((cur.bo - base.bo) / MB / min),
402
- window_s: Math.round((now - base.t) / 1_000),
403
- };
404
- }
405
- #build_info() {
406
- const live = Object.values(this.#connections);
407
- const ips_now = new Set();
408
- const conns_by_country = new Map();
409
- for (const c of live) {
410
- if (c.remote_ip)
411
- ips_now.add(c.remote_ip);
412
- const cc = c.country ?? 'unknown';
413
- conns_by_country.set(cc, (conns_by_country.get(cc) ?? 0) + 1);
414
- }
415
- const codes = new Set([...conns_by_country.keys(), ...this.#ips_by_country.keys()]);
416
- const sorted = [...codes].sort((a, b) => (conns_by_country.get(b) ?? 0) - (conns_by_country.get(a) ?? 0) ||
417
- (this.#ips_by_country.get(b)?.size ?? 0) - (this.#ips_by_country.get(a)?.size ?? 0) ||
418
- a.localeCompare(b));
419
- const countries = {};
420
- for (const cc of sorted)
421
- countries[cc] = { conns_now: conns_by_country.get(cc) ?? 0, ips_total: this.#ips_by_country.get(cc)?.size ?? 0 };
422
- return {
423
- broker: { version: BROKER_VERSION, uptime_s: Math.floor((Date.now() - this.#started_at) / 1000), geoip: geoip !== null },
424
- packets: { now: Object.keys(this.#connections_by_cid).length, total: this.#all_cids.size },
425
- connections: { now: live.length, accepted_total: this.#connections_accepted_total },
426
- ips: { now: ips_now.size, distinct_total: this.#all_ips.size },
427
- traffic: this.#traffic_rates(),
428
- process: {
429
- cpu_pct: this.#cpu_pct,
430
- rss_mb: round2(process.memoryUsage().rss / (1024 * 1024)),
431
- event_loop_lag_p99_ms: round2(this.#eld.percentile(99) / 1e6),
432
- },
433
- countries,
434
- };
435
- }
436
- #handle_info(req, res) {
437
- const info = this.#build_info();
438
- res.format({
439
- 'application/json': () => res.json(info),
440
- 'text/html': () => res.type('html').send(render_info_html(info)),
441
- default: () => res.json(info),
442
- });
443
- }
444
- start = () => {
445
- this.app.get('/info', (req, res) => this.#handle_info(req, res));
446
- this.listen(() => {
447
- logging.info(`Server started on port ${this.server.address().port} :)`);
448
- });
449
- this.#start_idle_sweep();
450
- this.#start_traffic_sampler();
451
- this.add_event_listener('connection', (socket, request) => {
452
- logging.info("new connection");
453
- const connection = new Connection(this, socket);
454
- connection.remote_ip = extract_remote_ip(request);
455
- connection.country = country_of(connection.remote_ip);
456
- if (connection.remote_ip) {
457
- this.#all_ips.add(connection.remote_ip);
458
- let bucket = this.#ips_by_country.get(connection.country);
459
- if (!bucket) {
460
- bucket = new Set();
461
- this.#ips_by_country.set(connection.country, bucket);
462
- }
463
- bucket.add(connection.remote_ip);
464
- }
465
- this.#connections_accepted_total++;
466
- this.#connections[connection.connection_id] = connection;
467
- {
468
- const nb = new AdaptObjectBuilder();
469
- try {
470
- const nonce_bin = nb.AdaptEnvironment.GetRandomBytes(32);
471
- const nonce_hc = nb.Attach(Protocol.GetProtocolContainer().ExecuteTransaction(nb.Attach(Protocol.GetProtocolContainer().CreateDictionary()
472
- .Mutate('name', nb.AdaptValue.New('::protocol_container::primitives_wrapper::binary_to_hash_code'))
473
- .Mutate('targ', nonce_bin))));
474
- connection.reg_nonce = nonce_hc.Visualize();
475
- connection.nonce_av = nonce_hc.Detach().Attach(connection.nonce_lt);
476
- }
477
- finally {
478
- nb.Destroy();
479
- }
480
- }
481
- // message initializing connection between broker and wrapper
482
- const send_init_message_to_wrapper = (connection) => {
483
- if (connection.responded)
484
- return;
485
- if (!(connection.connection_id in this.#connections))
486
- return; // connections closed before we have obtained the registration message
487
- const frame = this.#build_frame(Protocol.MessageName.b2w_init, null, Protocol.CreateProtocolMessage(Protocol.MessageName.b2w_init, { nonce: connection.nonce_av }).Detach());
488
- this.queue.push({ kind: 'outgoing_message', connection_id: connection.connection_id, frame });
489
- setTimeout(() => send_init_message_to_wrapper(connection), 2000);
490
- };
491
- send_init_message_to_wrapper(connection);
492
- });
493
- };
494
- // =================================== worker and related methods ==============================================
495
- #worker = (task, callback) => {
496
- try {
497
- if (task.kind === 'outgoing_message') {
498
- const connection_id = task.connection_id;
499
- if (connection_id in this.#connections) {
500
- try {
501
- this.#connections[connection_id].send_frame(task.frame);
502
- if (task.pending_row_id !== undefined)
503
- this.#pending_store?.remove(task.pending_row_id);
504
- }
505
- catch (e) {
506
- logging.error("Failed to send outgoing message on connection ", connection_id, ": ", e instanceof Error ? e.message : e);
507
- this.#handle_undeliverable(task);
508
- }
509
- }
510
- else {
511
- logging.warning("Invalid connection_id ", connection_id, " in queue outgoing message task");
512
- this.#handle_undeliverable(task);
513
- }
514
- }
515
- else {
516
- this.#incoming_message_handler(task);
517
- }
518
- }
519
- catch (e) {
520
- // Here also caught exceptions from func
521
- let message = e instanceof Error ? e.message : e;
522
- logging.error(message);
523
- }
524
- finally {
525
- this.#maybe_relieve_backpressure();
526
- callback();
527
- }
528
- };
529
- maybe_apply_backpressure() {
530
- if (this.#inbound_paused || this.queue.length < QUEUE_HIGH_WATER_MARK)
531
- return;
532
- this.#inbound_paused = true;
533
- for (const id in this.#connections)
534
- this.#connections[id].pause();
535
- logging.warning("Backpressure engaged: queue depth ", this.queue.length, " >= ", QUEUE_HIGH_WATER_MARK, "; pausing inbound reads");
536
- }
537
- #maybe_relieve_backpressure() {
538
- if (!this.#inbound_paused || this.queue.length > QUEUE_LOW_WATER_MARK)
539
- return;
540
- this.#inbound_paused = false;
541
- for (const id in this.#connections)
542
- this.#connections[id].resume();
543
- logging.info("Backpressure relieved: queue depth ", this.queue.length, " <= ", QUEUE_LOW_WATER_MARK, "; resuming inbound reads");
544
- }
545
- #handle_undeliverable(task) {
546
- if (task.to_cid !== undefined) {
547
- // Already-persisted pending rows (pending_row_id set) stay in the store;
548
- // a fresh undeliverable frame is added to it.
549
- if (task.pending_row_id === undefined) {
550
- logging.debug("Returning undeliverable message for container ", task.to_cid, " to the pending store");
551
- this.#add_pending_message(task.frame, task.to_cid);
552
- }
553
- }
554
- }
555
- #incoming_message_handler(task) {
556
- const connection_id = task.connection_id;
557
- if (!(connection_id in this.#connections))
558
- throw new AdaptNetworkError(AdaptNetworkErrorType.INTERNAL_ERROR, `Invalid connection id ${connection_id}`);
559
- const func = this.#worker_functions.get(task.type);
560
- if (!func)
561
- throw new Error("Unrecognized message type: " + task.type);
562
- func(task);
563
- }
564
- /**
565
- *
566
- * 1. Validate attestation document and save it
567
- * 2. send registration ok message
568
- *
569
- */
570
- #w2b_reg_v1_handler(task) {
571
- const builder = new AdaptObjectBuilder();
572
- try {
573
- const message = builder.Attach(task.parse_payload()); // parse the inner registration message; freed with the builder
574
- const connection_id = task.connection_id;
575
- const connection = this.#connections[connection_id];
576
- if (connection == undefined)
577
- throw new AdaptNetworkError(AdaptNetworkErrorType.INTERNAL_ERROR, "Internal error: connection id is undefined");
578
- const message_body = builder.Attach(Protocol.GetBody(message));
579
- const cid = builder.Attach(Protocol.GetFrom(message)).Visualize();
580
- logging.debug("Received registration message from container with id: ", cid);
581
- this.#all_cids.add(cid);
582
- const existing = this.#connections_by_cid[cid];
583
- if (existing && existing.connection_id === connection_id)
584
- throw new AdaptProtocolError(AdaptProtocolErrorType.LOGIC_ERROR, `Duplicate registration for container ${cid}`);
585
- const proof = builder.Attach(message_body.Reduce(Protocol.FieldName.registration_proof));
586
- try {
587
- builder.Attach(Protocol.VerifyRegistrationProof(proof, connection.nonce_av, builder.AdaptValue.New(cid)));
588
- }
589
- catch (e) {
590
- logging.error(e instanceof Error ? e.message : e);
591
- throw new AdaptProtocolError(AdaptProtocolErrorType.REGISTRATION_PROOF_FAILURE, "Registration possession proof failed");
592
- }
593
- let adapt_packet_info = new AdaptPacketInfo(cid);
594
- let packet_connection = new PacketConnection(connection, adapt_packet_info);
595
- // add new packet connection
596
- this.#connections_by_cid[cid] = packet_connection;
597
- const reg_ok_frame = this.#build_frame(Protocol.MessageName.b2w_reg_ok, cid, Protocol.CreateProtocolMessage(Protocol.MessageName.b2w_reg_ok, { to: builder.AdaptValue.New(cid), message_hash: message.GetHash() }).Detach());
598
- this.queue.push({
599
- kind: 'outgoing_message',
600
- connection_id: connection_id,
601
- frame: reg_ok_frame
602
- });
603
- if (this.#pending_store) {
604
- for (const { id, value } of this.#pending_store.peek(cid)) {
605
- this.queue.push({ kind: 'outgoing_message', connection_id: connection_id, frame: value, to_cid: cid, pending_row_id: id });
606
- }
607
- }
608
- else {
609
- const pending = this.#pending_messages_by_cid[cid] ?? [];
610
- delete this.#pending_messages_by_cid[cid];
611
- for (const frame of pending) {
612
- this.queue.push({ kind: 'outgoing_message', connection_id: connection_id, frame, to_cid: cid });
613
- }
614
- }
615
- }
616
- finally {
617
- builder.Destroy();
618
- }
619
- }
620
- /**
621
- * Relay hot path — pure byte ops, no VM:
622
- * 1. Authorize the sender by connection identity (must be registered).
623
- * 2. Route on the frame's `to`; flip the type byte in place.
624
- * 3. Forward the frame verbatim (or queue it as pending if the recipient is absent).
625
- * The inner message is opaque to the broker; the recipient verifies it.
626
- */
627
- #w2b_transaction_v1_handler(task) {
628
- const sender = this.#connections[task.connection_id];
629
- if (!sender || sender.managed_packets.size === 0)
630
- throw new AdaptProtocolError(AdaptProtocolErrorType.LOGIC_ERROR, "Received transaction from unregistered connection");
631
- const to = task.to_hex;
632
- const frame = task.frame;
633
- patchFrameType(frame, Protocol.MessageName.b2w_exec_transaction);
634
- const recipient = this.#connections_by_cid[to];
635
- if (recipient) {
636
- try {
637
- recipient.send_frame(frame);
638
- }
639
- catch (e) {
640
- logging.error("Failed to send transaction message to container ", to, ": ", e instanceof Error ? e.message : e);
641
- this.#add_pending_message(frame, to);
642
- }
643
- }
644
- else {
645
- this.#add_pending_message(frame, to);
646
- }
647
- }
648
- }
649
- //# sourceMappingURL=broker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../src/utilities/broker/broker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAgC,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EAAE,yBAAyB,EAAiB,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,OAAO,EAAqE,MAAM,oBAAoB,CAAA;AAC9Q,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAEnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEtC,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAA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,CAAA;gBAC/G,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YACxC,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACxC,CAAC;IACL,CAAC;CAGJ"}
@@ -1,7 +0,0 @@
1
- import { AdaptNetworkComponentConfigurator } from '../common/index.js';
2
- export declare class BrokerConfigurator extends AdaptNetworkComponentConfigurator {
3
- protected configurator_name: string;
4
- constructor();
5
- get db_path(): string | undefined;
6
- }
7
- //# sourceMappingURL=broker_configurator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker_configurator.d.ts","sourceRoot":"","sources":["../../../src/utilities/broker/broker_configurator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,iCAAiC,EAAU,MAAM,oBAAoB,CAAA;AAEvF,qBAAa,kBAAmB,SAAQ,iCAAiC;IACrE,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAyB;;IAW5D,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS,CAEvC;CACJ"}
@@ -1,16 +0,0 @@
1
- import { Argument, AdaptNetworkComponentConfigurator } from '../common/index.js';
2
- export class BrokerConfigurator extends AdaptNetworkComponentConfigurator {
3
- configurator_name = "broker configurator";
4
- constructor() {
5
- super([
6
- new Argument('--db_path')
7
- .set_description("path to the SQLite database file for persistent pending messages")
8
- .set_supply_argument(true)
9
- .set_parameter_description('<path>'),
10
- ], { port: true, host: true, test_mode: true, logger_config: true });
11
- }
12
- get db_path() {
13
- return this.get_argument('--db_path')?.value;
14
- }
15
- }
16
- //# sourceMappingURL=broker_configurator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker_configurator.js","sourceRoot":"","sources":["../../../src/utilities/broker/broker_configurator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iCAAiC,EAAU,MAAM,oBAAoB,CAAA;AAEvF,MAAM,OAAO,kBAAmB,SAAQ,iCAAiC;IAC3D,iBAAiB,GAAW,qBAAqB,CAAC;IAE5D;QACI,KAAK,CAAC;YACF,IAAI,QAAQ,CAAS,WAAW,CAAC;iBAC5B,eAAe,CAAC,kEAAkE,CAAC;iBACnF,mBAAmB,CAAC,IAAI,CAAC;iBACzB,yBAAyB,CAAC,QAAQ,CAAC;SAC3C,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAC,CAAC,CAAC;IACvE,CAAC;IAED,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,KAA2B,CAAA;IACtE,CAAC;CACJ"}
@@ -1,13 +0,0 @@
1
- export declare class PendingMessageStore {
2
- #private;
3
- constructor(db_path: string);
4
- add(cid: string, frame: Uint8Array): void;
5
- peek(cid: string): {
6
- id: number;
7
- value: Uint8Array;
8
- }[];
9
- remove(id: number): void;
10
- has(cid: string): boolean;
11
- close(): void;
12
- }
13
- //# sourceMappingURL=pending_message_store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pending_message_store.d.ts","sourceRoot":"","sources":["../../../src/utilities/broker/pending_message_store.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAmB;;gBAMhB,OAAO,EAAE,MAAM;IAkB3B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAIzC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,EAAE;IAKtD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKzB,KAAK,IAAI,IAAI;CAGhB"}
@@ -1,40 +0,0 @@
1
- import Database from 'better-sqlite3';
2
- export class PendingMessageStore {
3
- #db;
4
- #insert;
5
- #select;
6
- #delete;
7
- constructor(db_path) {
8
- this.#db = new Database(db_path);
9
- this.#db.pragma('journal_mode = WAL');
10
- this.#db.exec(`
11
- CREATE TABLE IF NOT EXISTS pending_messages (
12
- id INTEGER PRIMARY KEY AUTOINCREMENT,
13
- cid TEXT NOT NULL,
14
- message BLOB NOT NULL
15
- )
16
- `);
17
- this.#db.exec(`CREATE INDEX IF NOT EXISTS idx_pending_cid ON pending_messages(cid)`);
18
- this.#insert = this.#db.prepare('INSERT INTO pending_messages (cid, message) VALUES (?, ?)');
19
- this.#select = this.#db.prepare('SELECT id, message FROM pending_messages WHERE cid = ? ORDER BY id');
20
- this.#delete = this.#db.prepare('DELETE FROM pending_messages WHERE id = ?');
21
- }
22
- add(cid, frame) {
23
- this.#insert.run(cid, Buffer.from(frame.buffer, frame.byteOffset, frame.byteLength));
24
- }
25
- peek(cid) {
26
- const rows = this.#select.all(cid);
27
- return rows.map(row => ({ id: row.id, value: new Uint8Array(row.message) }));
28
- }
29
- remove(id) {
30
- this.#delete.run(id);
31
- }
32
- has(cid) {
33
- const row = this.#db.prepare('SELECT 1 FROM pending_messages WHERE cid = ? LIMIT 1').get(cid);
34
- return row !== undefined;
35
- }
36
- close() {
37
- this.#db.close();
38
- }
39
- }
40
- //# sourceMappingURL=pending_message_store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pending_message_store.js","sourceRoot":"","sources":["../../../src/utilities/broker/pending_message_store.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,MAAM,OAAO,mBAAmB;IAC5B,GAAG,CAAmB;IACtB,OAAO,CAAoB;IAC3B,OAAO,CAAoB;IAC3B,OAAO,CAAoB;IAE3B,YAAY,OAAe;QACvB,IAAI,CAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAA;QAChC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAErC,IAAI,CAAC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IACpB,CAAC;CACJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=broker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker.d.ts","sourceRoot":"","sources":["../../../src/utilities/executables/broker.ts"],"names":[],"mappings":""}
@@ -1,28 +0,0 @@
1
- import { Protocol } from '../../wrapper/index.js';
2
- import { Broker, BrokerConfigurator } from '../broker/index.js';
3
- import { AdaptNetworkComponentConfigurator, logging } from '../common/index.js';
4
- import { AdaptEnvironment } from '@adapt-toolkit/sdk/backend';
5
- let broker_configuration = new BrokerConfigurator();
6
- try {
7
- broker_configuration.process_arguments(process.argv.slice(2));
8
- }
9
- catch (e) {
10
- console.error(e instanceof Error ? e.message : e);
11
- broker_configuration.display_help();
12
- process.exit(1);
13
- }
14
- logging.create_logger(broker_configuration.logger_config);
15
- // Use the async initializer so this executable works on both the native and
16
- // WASM backends — the WASM backend rejects sync Initialize() because WASM
17
- // instantiation is inherently asynchronous.
18
- AdaptEnvironment.InitializeAsync(AdaptNetworkComponentConfigurator.test_mode)
19
- .then(() => Protocol.Initialize())
20
- .then(() => {
21
- const B = new Broker(broker_configuration);
22
- B.start();
23
- })
24
- .catch((e) => {
25
- console.error("Failed to initialize adapt environment!", e);
26
- process.exit(1);
27
- });
28
- //# sourceMappingURL=broker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../src/utilities/executables/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,IAAI,oBAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAA;AACnD,IAAI,CAAC;IACD,oBAAoB,CA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