@mearl/cloud-server 2.7.1 → 2.7.3

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/dist/daemon.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { CloudServerOptions } from './index.js';
2
+ /** Whether a live WebSocket daemon exists, independent from the selected transport mode. */
3
+ export declare function isDaemonRunning(): boolean;
2
4
  /** Spawn the server as a detached background process. */
3
5
  export declare function startDaemon(passthroughArgs: string[]): Promise<void>;
4
6
  /** Stop a running background server. */
package/dist/index.js CHANGED
@@ -1,555 +1,6 @@
1
- // src/index.ts
2
- import WebSocket, { WebSocketServer } from "ws";
3
- import { createServer as createHttpServer } from "node:http";
4
- import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
5
- import { randomBytes } from "node:crypto";
6
- import { networkInterfaces } from "node:os";
7
-
8
- // src/paths.ts
9
- import { join } from "node:path";
10
- import { DAEMON_HOME } from "@mearl/daemon-core";
11
- var CONFIG_DIR = DAEMON_HOME;
12
- var CONFIG_FILE = join(CONFIG_DIR, "cloud-server.json");
13
- var LOG_FILE = join(CONFIG_DIR, "cloud-server.log");
14
-
15
- // src/index.ts
16
1
  import {
17
- isAgentHelloMessage,
18
- isConnectorHelloMessage,
19
- isHeartbeatMessage,
20
- isCloudMessage,
21
- isCloudResponse,
22
- resolveCloudConnectorSelector,
23
- MAX_BUFFER_SIZE,
24
- DEFAULT_HEARTBEAT_TIMEOUT,
25
- DEFAULT_REQUEST_TIMEOUT
26
- } from "@mearl/cloud-types";
27
- import { resolveActionTimeoutSec } from "@mearl/client/action-timeouts";
28
- var fetchInstance = null;
29
- async function getFetch() {
30
- if (fetchInstance) {
31
- return fetchInstance;
32
- }
33
- if (typeof globalThis.fetch !== "undefined") {
34
- fetchInstance = globalThis.fetch;
35
- } else {
36
- const { default: fetch } = await import("node-fetch");
37
- fetchInstance = fetch;
38
- }
39
- return fetchInstance;
40
- }
41
- var DEFAULT_PORT = 8080;
42
- var DEFAULT_PATH = "/ws";
43
- var DEFAULT_MAX_CONNECTIONS = 100;
44
- var DEFAULT_MAX_MESSAGE_SIZE = 10 * 1024 * 1024;
45
- var RESPONSE_GRACE_MS = 5e3;
46
- var LEGACY_CONNECTOR_HELLO_GRACE_MS = 1e3;
47
- var CloudServer = class {
48
- options;
49
- connectorWss = null;
50
- agentWss = null;
51
- connectorHttpServer = null;
52
- agentHttpServer = null;
53
- connections = /* @__PURE__ */ new Map();
54
- pendingRequests = /* @__PURE__ */ new Map();
55
- heartbeatTimer = null;
56
- constructor(options = {}) {
57
- const port = options.port ?? DEFAULT_PORT;
58
- this.options = {
59
- port,
60
- agentPort: options.agentPort ?? port + 1,
61
- path: options.path ?? DEFAULT_PATH,
62
- token: options.token,
63
- heartbeatTimeout: options.heartbeatTimeout ?? DEFAULT_HEARTBEAT_TIMEOUT,
64
- maxConnections: options.maxConnections ?? DEFAULT_MAX_CONNECTIONS,
65
- maxMessageSize: options.maxMessageSize ?? DEFAULT_MAX_MESSAGE_SIZE,
66
- requestTimeout: options.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT,
67
- allowRemoteAgent: options.allowRemoteAgent ?? false
68
- };
69
- }
70
- getToken() {
71
- if (!this.options.token) {
72
- this.options.token = this.generateRandomToken();
73
- }
74
- return this.options.token;
75
- }
76
- generateRandomToken() {
77
- return randomBytes(24).toString("base64url");
78
- }
79
- async start() {
80
- const token = this.getToken();
81
- await this.createListener(this.options.agentPort, "127.0.0.1", true);
82
- await this.createListener(this.options.port, "0.0.0.0", false);
83
- const localWsUrl = `ws://localhost:${this.options.agentPort}${this.options.path}?token=${token}`;
84
- let publicWsUrl;
85
- const sandboxUrl = await this.getSandboxPublicUrl(this.options.port);
86
- if (sandboxUrl) {
87
- try {
88
- const parsedUrl = new URL(sandboxUrl);
89
- parsedUrl.protocol = "wss:";
90
- parsedUrl.pathname = this.options.path;
91
- parsedUrl.search = `?token=${token}`;
92
- publicWsUrl = parsedUrl.toString();
93
- } catch {
94
- const httpsUrl = sandboxUrl.replace("https://", "wss://");
95
- publicWsUrl = `${httpsUrl}${this.options.path}?token=${token}`;
96
- }
97
- } else {
98
- const publicHost = process.env.CLOUD_SERVER_HOST || this.getPublicIP();
99
- publicWsUrl = `ws://${publicHost}:${this.options.port}${this.options.path}?token=${token}`;
100
- }
101
- if (publicWsUrl.startsWith("ws://") && !publicWsUrl.startsWith("ws://localhost")) {
102
- console.warn(
103
- "[CloudServer] Connector traffic is using unencrypted ws://. Use a TLS-terminating proxy and wss:// when the connection crosses a trusted network."
104
- );
105
- }
106
- const connectorCommand = `npx @mearl/cloud-connector "${publicWsUrl}"`;
107
- console.log(
108
- `[CloudServer] Connector listener on 0.0.0.0:${this.options.port} (network); agent listener on 127.0.0.1:${this.options.agentPort} (local only)`
109
- );
110
- console.log(`[CloudServer] Connect from local machine:`);
111
- console.log(` ${connectorCommand}`);
112
- this.startHeartbeatCheck();
113
- const info = {
114
- pid: process.pid,
115
- port: this.options.port,
116
- path: this.options.path,
117
- token,
118
- localUrl: localWsUrl,
119
- publicUrl: publicWsUrl,
120
- connectorCommand,
121
- startedAt: (/* @__PURE__ */ new Date()).toISOString()
122
- };
123
- this.writeConfigFile(info);
124
- return info;
125
- }
126
- /**
127
- * Stand up one HTTP+WebSocket listener. `fromLocal` tags every connection
128
- * accepted here so handleRequest can pin command-issuing authority to the
129
- * loopback listener.
130
- */
131
- createListener(port, host, fromLocal) {
132
- return new Promise((resolve, reject) => {
133
- const httpServer = createHttpServer((req, res) => {
134
- console.log(`[CloudServer] HTTP request: ${req.method} ${req.url}`);
135
- res.writeHead(404, { "Content-Type": "text/plain" });
136
- res.end("Not Found - This is a WebSocket server");
137
- });
138
- const wss = new WebSocketServer({
139
- server: httpServer,
140
- path: this.options.path,
141
- maxPayload: this.options.maxMessageSize
142
- });
143
- wss.on("connection", (ws, req) => {
144
- console.log(
145
- `[CloudServer] New ${fromLocal ? "agent" : "connector"} connection from ${req.socket.remoteAddress}, path: ${req.url}`
146
- );
147
- this.handleConnection(ws, req, fromLocal);
148
- });
149
- wss.on("error", (error) => {
150
- console.error("[CloudServer] WebSocket server error:", error.message);
151
- });
152
- httpServer.on("error", (error) => {
153
- console.error("[CloudServer] HTTP server error:", error.message);
154
- reject(error);
155
- });
156
- if (fromLocal) {
157
- this.agentWss = wss;
158
- this.agentHttpServer = httpServer;
159
- } else {
160
- this.connectorWss = wss;
161
- this.connectorHttpServer = httpServer;
162
- }
163
- httpServer.listen(port, host, () => {
164
- resolve();
165
- });
166
- });
167
- }
168
- stop() {
169
- return new Promise((resolve) => {
170
- if (this.heartbeatTimer) {
171
- clearInterval(this.heartbeatTimer);
172
- this.heartbeatTimer = null;
173
- }
174
- for (const [ws] of this.connections) {
175
- ws.close();
176
- }
177
- this.connections.clear();
178
- for (const pending of this.pendingRequests.values()) {
179
- clearTimeout(pending.timer);
180
- }
181
- this.pendingRequests.clear();
182
- this.agentWss?.close();
183
- this.connectorWss?.close();
184
- this.agentWss = null;
185
- this.connectorWss = null;
186
- const servers = [this.agentHttpServer, this.connectorHttpServer].filter(
187
- (s) => s !== null
188
- );
189
- this.agentHttpServer = null;
190
- this.connectorHttpServer = null;
191
- if (servers.length === 0) {
192
- resolve();
193
- return;
194
- }
195
- let remaining = servers.length;
196
- for (const s of servers) {
197
- s.close(() => {
198
- if (--remaining <= 0) resolve();
199
- });
200
- }
201
- });
202
- }
203
- handleConnection(ws, req, fromLocal) {
204
- if (this.connections.size >= this.options.maxConnections) {
205
- ws.close(1008, "Server is full");
206
- return;
207
- }
208
- if (this.options.token) {
209
- const url = new URL(req.url || "", `http://${req.headers.host}`);
210
- const token = url.searchParams.get("token");
211
- if (token !== this.options.token) {
212
- ws.close(1008, "Unauthorized");
213
- return;
214
- }
215
- }
216
- const connId = `${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
217
- const connection = {
218
- ws,
219
- id: connId,
220
- lastHeartbeat: Date.now(),
221
- connectedAt: Date.now(),
222
- role: fromLocal ? "agent" : "pending",
223
- fromLocal,
224
- messageBuffer: ""
225
- };
226
- this.connections.set(ws, connection);
227
- console.log(`[CloudServer] Client connected: ${connId} (total: ${this.connections.size})`);
228
- ws.on("message", (data) => {
229
- const conn = this.connections.get(ws);
230
- if (!conn) return;
231
- conn.messageBuffer += data.toString("utf-8");
232
- if (conn.messageBuffer.length > MAX_BUFFER_SIZE) {
233
- console.error(
234
- `[CloudServer] Message buffer exceeds limit for ${connId}, closing connection`
235
- );
236
- ws.close(1008, "Message too large");
237
- return;
238
- }
239
- let newlineIndex;
240
- while ((newlineIndex = conn.messageBuffer.indexOf("\n")) !== -1) {
241
- const line = conn.messageBuffer.slice(0, newlineIndex);
242
- conn.messageBuffer = conn.messageBuffer.slice(newlineIndex + 1);
243
- if (!line.trim()) continue;
244
- try {
245
- const message = JSON.parse(line);
246
- this.handleMessage(ws, message);
247
- } catch (error) {
248
- console.error(`[CloudServer] Failed to parse message from ${connId}:`, line, error);
249
- }
250
- }
251
- });
252
- ws.on("close", () => {
253
- this.connections.delete(ws);
254
- this.rejectPendingForWs(ws);
255
- console.log(`[CloudServer] Client disconnected: ${connId} (total: ${this.connections.size})`);
256
- });
257
- ws.on("error", (error) => {
258
- console.error(`[CloudServer] Connection error for ${connId}:`, error.message);
259
- });
260
- }
261
- handleMessage(ws, message) {
262
- const conn = this.connections.get(ws);
263
- if (!conn) return;
264
- if (isHeartbeatMessage(message)) {
265
- if (message.type === "ping") {
266
- ws.send(
267
- JSON.stringify({ type: "pong", timestamp: Date.now() }) + "\n"
268
- );
269
- conn.lastHeartbeat = Date.now();
270
- } else if (message.type === "pong") {
271
- conn.lastHeartbeat = Date.now();
272
- }
273
- return;
274
- }
275
- if (isAgentHelloMessage(message)) {
276
- this.handleAgentHello(ws);
277
- return;
278
- }
279
- if (isConnectorHelloMessage(message)) {
280
- this.handleConnectorHello(ws, message);
281
- return;
282
- }
283
- if (isCloudResponse(message)) {
284
- this.handleResponse(ws, message);
285
- return;
286
- }
287
- if (isCloudMessage(message)) {
288
- this.handleRequest(ws, message);
289
- return;
290
- }
291
- }
292
- handleAgentHello(ws) {
293
- const conn = this.connections.get(ws);
294
- if (!conn) return;
295
- if (!conn.fromLocal && !this.options.allowRemoteAgent) {
296
- ws.close(1008, "Agent must be local");
297
- return;
298
- }
299
- conn.role = "agent";
300
- delete conn.connector;
301
- }
302
- handleConnectorHello(ws, message) {
303
- const conn = this.connections.get(ws);
304
- if (!conn || conn.fromLocal) {
305
- ws.close(1008, "Connector must use the connector listener");
306
- return;
307
- }
308
- for (const [otherWs, other] of this.connections) {
309
- if (otherWs !== ws && other.role === "connector" && other.connector?.connectorId === message.connectorId) {
310
- this.connections.delete(otherWs);
311
- this.rejectPendingForWs(otherWs);
312
- otherWs.close(1e3, "Connector replaced by a newer connection");
313
- }
314
- }
315
- conn.role = "connector";
316
- conn.connector = {
317
- connectorId: message.connectorId,
318
- name: message.name,
319
- ...message.version ? { version: message.version } : {}
320
- };
321
- console.log(
322
- `[CloudServer] Connector registered: ${message.name} (${message.connectorId}, v${message.version ?? "unknown"})`
323
- );
324
- }
325
- handleRequest(ws, message) {
326
- const { id, action, data } = message;
327
- const conn = this.connections.get(ws);
328
- if (!conn) return;
329
- if (conn.role !== "agent") {
330
- console.warn(
331
- `[CloudServer] Rejected agent request from non-local connection ${conn.id} (action: ${action})`
332
- );
333
- ws.send(
334
- JSON.stringify({
335
- id,
336
- success: false,
337
- error: this.options.allowRemoteAgent && !conn.fromLocal ? "Remote agents must identify themselves with an agent_hello message before issuing commands." : "Agent requests are only accepted on the local interface (127.0.0.1). Run @mearl/client on the same machine as cloud-server, or start the server with --allow-remote-agent to override."
338
- }) + "\n"
339
- );
340
- return;
341
- }
342
- if (action === "connector_list") {
343
- const response = {
344
- id,
345
- success: true,
346
- data: this.getConnectorList()
347
- };
348
- ws.send(JSON.stringify(response) + "\n");
349
- return;
350
- }
351
- const target = this.resolveConnector(message.connector);
352
- if ("error" in target) {
353
- ws.send(JSON.stringify({ id, success: false, error: target.error }) + "\n");
354
- return;
355
- }
356
- const routeId = randomBytes(12).toString("base64url");
357
- const requestedTimeoutSec = Number(message.timeoutSec);
358
- const timeoutSec = Number.isFinite(requestedTimeoutSec) && requestedTimeoutSec > 0 ? Math.min(requestedTimeoutSec, 3600) : resolveActionTimeoutSec(action, data, this.options.requestTimeout);
359
- const timer = setTimeout(
360
- () => {
361
- this.pendingRequests.delete(routeId);
362
- if (ws.readyState === WebSocket.OPEN) {
363
- ws.send(JSON.stringify({ id, success: false, error: "Request timeout" }) + "\n");
364
- }
365
- },
366
- timeoutSec * 1e3 + RESPONSE_GRACE_MS
367
- );
368
- this.pendingRequests.set(routeId, {
369
- agentRequestId: id,
370
- agentWs: ws,
371
- connectorWs: target.ws,
372
- timer
373
- });
374
- target.ws.send(
375
- JSON.stringify({
376
- id: routeId,
377
- action,
378
- data,
379
- browser: message.browser,
380
- timeoutSec
381
- }) + "\n"
382
- );
383
- }
384
- handleResponse(ws, response) {
385
- const conn = this.connections.get(ws);
386
- if (!conn) return;
387
- if (conn.role !== "connector") return;
388
- const pending = this.pendingRequests.get(response.id);
389
- if (!pending || pending.connectorWs !== ws) return;
390
- this.pendingRequests.delete(response.id);
391
- clearTimeout(pending.timer);
392
- if (pending.agentWs.readyState === WebSocket.OPEN) {
393
- pending.agentWs.send(
394
- JSON.stringify({ ...response, id: pending.agentRequestId }) + "\n"
395
- );
396
- }
397
- }
398
- connectorInfo(ws, conn) {
399
- const pendingRequests = Array.from(this.pendingRequests.values()).filter(
400
- (pending) => pending.connectorWs === ws
401
- ).length;
402
- return {
403
- connectorId: conn.connector?.connectorId ?? conn.id,
404
- name: conn.connector?.name ?? `legacy-${conn.id.slice(-8)}`,
405
- ...conn.connector?.version ? { version: conn.connector.version } : {},
406
- connectedAt: new Date(conn.connectedAt).toISOString(),
407
- lastHeartbeatAt: new Date(conn.lastHeartbeat).toISOString(),
408
- pendingRequests,
409
- ...!conn.connector ? { legacy: true } : {}
410
- };
411
- }
412
- getConnectorConnections() {
413
- const connectors = [];
414
- for (const [ws, conn] of this.connections) {
415
- if (conn.role === "pending" && Date.now() - conn.connectedAt >= LEGACY_CONNECTOR_HELLO_GRACE_MS) {
416
- conn.role = "connector";
417
- }
418
- if (conn.role !== "connector" || ws.readyState !== WebSocket.OPEN) continue;
419
- connectors.push({ ws, conn, info: this.connectorInfo(ws, conn) });
420
- }
421
- return connectors.sort((a, b) => a.info.name.localeCompare(b.info.name));
422
- }
423
- getConnectorList() {
424
- const connectors = this.getConnectorConnections().map(({ info }) => info);
425
- return { count: connectors.length, connectors };
426
- }
427
- resolveConnector(selector) {
428
- const connectors = this.getConnectorConnections();
429
- if (connectors.length === 0) return { error: "No local connector available" };
430
- if (!selector) {
431
- if (connectors.length === 1) {
432
- return { ws: connectors[0].ws, info: connectors[0].info };
433
- }
434
- return {
435
- error: `Multiple cloud connectors are connected (${connectors.length}). Run \`mearl connector_list\` and pass --connector <id|name>.`
436
- };
437
- }
438
- const selection = resolveCloudConnectorSelector(
439
- connectors.map(({ info }) => info),
440
- selector
441
- );
442
- if (selection.status === "matched") {
443
- const matched = connectors.find(({ info }) => info === selection.connector);
444
- return { ws: matched.ws, info: matched.info };
445
- }
446
- const available = connectors.map(({ info }) => `${info.name} [${info.connectorId}]`).join(", ");
447
- if (selection.status === "ambiguous") {
448
- return {
449
- error: `Cloud connector selector "${selector}" is ambiguous. Available: ${available}`
450
- };
451
- }
452
- return {
453
- error: `No cloud connector matches "${selector}". Available: ${available}`
454
- };
455
- }
456
- rejectPendingForWs(ws) {
457
- this.pendingRequests.forEach((pending, id) => {
458
- if (pending.agentWs !== ws && pending.connectorWs !== ws) return;
459
- clearTimeout(pending.timer);
460
- this.pendingRequests.delete(id);
461
- if (pending.connectorWs === ws && pending.agentWs !== ws && pending.agentWs.readyState === WebSocket.OPEN) {
462
- pending.agentWs.send(
463
- JSON.stringify({
464
- id: pending.agentRequestId,
465
- success: false,
466
- error: "Connector connection closed"
467
- }) + "\n"
468
- );
469
- }
470
- });
471
- }
472
- startHeartbeatCheck() {
473
- if (this.heartbeatTimer) return;
474
- this.heartbeatTimer = setInterval(() => {
475
- const now = Date.now();
476
- const timeoutMs = this.options.heartbeatTimeout * 1e3;
477
- for (const [ws, conn] of this.connections) {
478
- if (now - conn.lastHeartbeat > timeoutMs) {
479
- console.log(`[CloudServer] Client ${conn.id} heartbeat timeout, closing connection`);
480
- ws.close(1e3, "Heartbeat timeout");
481
- }
482
- }
483
- }, 3e4);
484
- }
485
- getPublicIP() {
486
- const interfaces = networkInterfaces();
487
- for (const name of Object.keys(interfaces)) {
488
- const iface = interfaces[name];
489
- if (!iface) continue;
490
- for (const addr of iface) {
491
- if (addr.family === "IPv4" && !addr.internal) {
492
- return addr.address;
493
- }
494
- }
495
- }
496
- return "localhost";
497
- }
498
- async getSandboxPublicUrl(port) {
499
- if (!process.env.AONE_SANDBOX_ID) {
500
- return null;
501
- }
502
- const mappingApiUrl = "http://localhost:58596/api/port-mapping";
503
- try {
504
- const fetch = await getFetch();
505
- const response = await fetch(`${mappingApiUrl}?port=${port}`);
506
- if (!response.ok) {
507
- return null;
508
- }
509
- const data = await response.json();
510
- if (data.success && data.url) {
511
- return data.url;
512
- }
513
- } catch (error) {
514
- console.error(
515
- `[CloudServer] Failed to query sandbox port mapping:`,
516
- error instanceof Error ? error.message : String(error)
517
- );
518
- }
519
- return null;
520
- }
521
- writeConfigFile(info) {
522
- try {
523
- if (!existsSync(CONFIG_DIR)) {
524
- mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
525
- }
526
- const config = { server: info.localUrl, ...info };
527
- writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), {
528
- encoding: "utf-8",
529
- mode: 384
530
- });
531
- if (process.platform !== "win32") {
532
- chmodSync(CONFIG_DIR, 448);
533
- chmodSync(CONFIG_FILE, 384);
534
- }
535
- console.log(`[CloudServer] Config written to: ${CONFIG_FILE}`);
536
- } catch (error) {
537
- console.error("[CloudServer] Failed to write config file:", error);
538
- }
539
- }
540
- getStats() {
541
- let agents = 0;
542
- for (const conn of this.connections.values()) {
543
- if (conn.role === "agent") agents++;
544
- }
545
- return {
546
- connections: this.connections.size,
547
- agents,
548
- connectors: this.getConnectorConnections().length,
549
- pendingRequests: this.pendingRequests.size
550
- };
551
- }
552
- };
2
+ CloudServer
3
+ } from "./chunks/chunk-DCTZIDJ7.js";
553
4
  export {
554
5
  CloudServer
555
6
  };
package/dist/mode.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export type CloudServerMode = 'websocket' | 'qoder';
2
+ export declare const CLOUD_SERVER_MODE_ENV = "MEARL_CLOUD_MODE";
3
+ interface CloudServerModeStorage {
4
+ modeFile?: string;
5
+ readText?: (filePath: string) => string;
6
+ removeFile?: (filePath: string) => void;
7
+ writeText?: (filePath: string, value: string) => void;
8
+ }
9
+ export declare function resolveCloudServerMode(env?: NodeJS.ProcessEnv, storage?: CloudServerModeStorage): CloudServerMode;
10
+ export {};
package/dist/paths.d.ts CHANGED
@@ -9,5 +9,7 @@ export declare const CONFIG_DIR: string;
9
9
  * Daemon lifecycle commands additionally read `pid` / `port` / `startedAt`.
10
10
  */
11
11
  export declare const CONFIG_FILE: string;
12
+ /** Persistent transport mode selected by setup; independent from daemon liveness. */
13
+ export declare const MODE_FILE: string;
12
14
  /** Daemon stdout/stderr log file. */
13
15
  export declare const LOG_FILE: string;
@@ -0,0 +1,29 @@
1
+ export interface QoderPairingInfo {
2
+ pairingCode: string;
3
+ createdAt: number;
4
+ connectorUrl: string;
5
+ toolInput: {
6
+ action: 'pair';
7
+ payload: {
8
+ code: string;
9
+ };
10
+ };
11
+ }
12
+ export interface QoderPairingOptions {
13
+ now?: () => number;
14
+ createCode?: () => string;
15
+ }
16
+ export type CloudServerCommand = 'start' | 'stop' | 'restart' | 'status' | 'logs';
17
+ interface QoderCloudServerDependencies {
18
+ createPairing?: () => QoderPairingInfo;
19
+ isServerRunning: () => boolean;
20
+ printLogs: () => void;
21
+ printStatus: () => void;
22
+ stopServer: () => Promise<void>;
23
+ writeLine?: (message: string) => void;
24
+ }
25
+ /** Create a short-lived correlation handle without embedding Qoder credentials in the URL. */
26
+ export declare function createQoderPairingInfo(options?: QoderPairingOptions): QoderPairingInfo;
27
+ export declare function formatQoderPairingOutput(info: QoderPairingInfo): string;
28
+ export declare function runQoderCloudServerCommand(command: CloudServerCommand, dependencies: QoderCloudServerDependencies): Promise<void>;
29
+ export {};
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@mearl/cloud-server",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "Cloud WebSocket server for Mearl — bridges cloud agents to local connectors",
5
5
  "type": "module",
6
+ "engines": {
7
+ "node": ">=18"
8
+ },
6
9
  "main": "dist/index.js",
7
10
  "types": "dist/index.d.ts",
8
11
  "exports": {
@@ -15,7 +18,10 @@
15
18
  "mearl-cloud-server": "./dist/cli.js"
16
19
  },
17
20
  "files": [
18
- "dist"
21
+ "dist",
22
+ "!dist/**/*.map",
23
+ "!dist/**/__tests__/**",
24
+ "!dist/**/*.test.d.ts"
19
25
  ],
20
26
  "keywords": [
21
27
  "mearl",
@@ -27,11 +33,10 @@
27
33
  "registry": "https://registry.npmjs.org"
28
34
  },
29
35
  "dependencies": {
30
- "node-fetch": "^3.3.2",
31
36
  "ws": "^8.18.0",
32
- "@mearl/client": "2.7.1",
33
- "@mearl/cloud-types": "2.7.1",
34
- "@mearl/daemon-core": "2.7.1"
37
+ "@mearl/client": "2.7.3",
38
+ "@mearl/cloud-types": "2.7.3",
39
+ "@mearl/daemon-core": "2.7.3"
35
40
  },
36
41
  "devDependencies": {
37
42
  "@types/node": "^24.9.1",
@@ -1 +0,0 @@
1
- export {};