@mearl/cloud-connector 2.19.2 → 2.20.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.
@@ -99,6 +99,19 @@ import { resolve } from "node:path";
99
99
  import { spawnSync } from "node:child_process";
100
100
  var QODER_TOKEN_KEY = "QODER_PERSONAL_ACCESS_TOKEN";
101
101
  var QODER_KEYCHAIN_SERVICE = "com.mearl.qoder.pat";
102
+ function qoderAuthenticationHint(platform = process.platform) {
103
+ const lines = [
104
+ "Configure QODER_PERSONAL_ACCESS_TOKEN on the browser machine, then restart the connector.",
105
+ "Lookup order: process environment > MEARL_ENV_FILE > ~/.mearl/.env" + (platform === "darwin" ? ` > macOS Keychain (${QODER_KEYCHAIN_SERVICE}).` : ".")
106
+ ];
107
+ if (platform === "darwin") {
108
+ lines.push(
109
+ `Enter the PAT interactively in a local terminal: security add-generic-password -U -a "$USER" -s ${QODER_KEYCHAIN_SERVICE} -w`
110
+ );
111
+ }
112
+ lines.push("Keep the PAT out of pairing URLs, chat messages and logs.");
113
+ return lines.join("\n");
114
+ }
102
115
  function normalizeToken(value) {
103
116
  const token = value?.trim();
104
117
  if (!token || /[\r\n\0]/.test(token)) return void 0;
@@ -297,7 +310,12 @@ var QoderApiClient = class {
297
310
  });
298
311
  if (!response.ok) {
299
312
  const body = await response.text();
300
- throw new QoderApiError(qoderErrorMessage(response.status, body), response.status);
313
+ const message = qoderErrorMessage(response.status, body);
314
+ throw new QoderApiError(
315
+ response.status === 401 ? `${message}
316
+ ${qoderAuthenticationHint()}` : message,
317
+ response.status
318
+ );
301
319
  }
302
320
  return response;
303
321
  }
@@ -458,9 +476,8 @@ var QoderConnector = class {
458
476
  this.options = options;
459
477
  const token = resolveQoderPersonalAccessToken({ token: options.token });
460
478
  if (!token) {
461
- throw new Error(
462
- "Qoder authentication is required. Set QODER_PERSONAL_ACCESS_TOKEN, add it to ~/.mearl/.env, or configure the macOS Keychain item com.mearl.qoder.pat, then retry."
463
- );
479
+ throw new Error(`Qoder authentication is required.
480
+ ${qoderAuthenticationHint()}`);
464
481
  }
465
482
  this.api = new QoderApiClient(
466
483
  token,
@@ -677,7 +694,7 @@ var QoderConnector = class {
677
694
  };
678
695
 
679
696
  // src/index.ts
680
- var CLOUD_CONNECTOR_VERSION = true ? "2.19.2" : "unknown";
697
+ var CLOUD_CONNECTOR_VERSION = true ? "2.20.0" : "unknown";
681
698
  var DEFAULT_RECONNECT_INTERVAL = 5e3;
682
699
  var BACKOFF_BASE_MS = 1e3;
683
700
  var BACKOFF_MAX_MS = 3e4;
@@ -858,7 +875,8 @@ var CloudConnector = class {
858
875
  const result = await client.invoke(action, data, {
859
876
  browser,
860
877
  timeoutSec: timeoutSec ?? resolveActionTimeoutSec2(action, data, 15),
861
- controlSource: "remote"
878
+ controlSource: "remote",
879
+ ...request.controlSessionId ? { controlSessionId: request.controlSessionId } : {}
862
880
  });
863
881
  this.sendResponse({ id, success: true, data: result });
864
882
  } catch (error) {
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  CloudConnector,
4
4
  isConnectorEndpoint,
5
5
  resolveConnectorIdentity
6
- } from "./chunks/chunk-L7LRKR46.js";
6
+ } from "./chunks/chunk-SI7GZPFJ.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { Command, CommanderError, InvalidArgumentError } from "commander";
@@ -83,6 +83,11 @@ function formatConnectorStatus(record, now = Date.now()) {
83
83
  lines.push(` retry: attempt ${record.reconnectAttempt}`);
84
84
  }
85
85
  if (record.nextRetryAt) lines.push(` next retry: ${record.nextRetryAt}`);
86
+ if (!record.serverUrl.startsWith("qoder://") && (health === "reconnecting" || health === "failed" || health === "degraded")) {
87
+ lines.push(
88
+ " next step: on the Agent machine, run mearl-cloud-server status; verify the current connection URL/token and that its port is reachable from this machine."
89
+ );
90
+ }
86
91
  return lines;
87
92
  }
88
93
  function daemonFor(serverUrl, foregroundArgs = []) {
@@ -306,7 +311,7 @@ function runForeground(options) {
306
311
  }
307
312
 
308
313
  // src/cli.ts
309
- var CLOUD_CONNECTOR_VERSION = true ? "2.19.2" : "unknown";
314
+ var CLOUD_CONNECTOR_VERSION = true ? "2.20.0" : "unknown";
310
315
  var SUBCOMMANDS = ["start", "stop", "restart", "status", "list", "logs"];
311
316
  var CONNECTION_OPTION_NAMES = /* @__PURE__ */ new Set([
312
317
  "foreground",
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  parseConnectorEndpoint,
11
11
  parseQoderSse,
12
12
  requireConnectorEndpoint
13
- } from "./chunks/chunk-L7LRKR46.js";
13
+ } from "./chunks/chunk-SI7GZPFJ.js";
14
14
  export {
15
15
  CloudConnector,
16
16
  DEFAULT_QODER_API_BASE_URL,
@@ -1,3 +1,4 @@
1
+ export declare function qoderAuthenticationHint(platform?: NodeJS.Platform): string;
1
2
  interface QoderTokenResolverOptions {
2
3
  token?: string;
3
4
  env?: NodeJS.ProcessEnv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/cloud-connector",
3
- "version": "2.19.2",
3
+ "version": "2.20.0",
4
4
  "description": "Cloud connector for Mearl — bridges cloud agents to a local native-host",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,9 +36,9 @@
36
36
  "dependencies": {
37
37
  "commander": "^15.0.0",
38
38
  "ws": "^8.18.0",
39
- "@mearl/client": "2.19.2",
40
- "@mearl/cloud-types": "2.19.2",
41
- "@mearl/daemon-core": "2.19.2"
39
+ "@mearl/client": "2.20.0",
40
+ "@mearl/daemon-core": "2.20.0",
41
+ "@mearl/cloud-types": "2.20.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^24.9.1",