@bulolo/hermes-link 0.2.3 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +14 -5
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -262,13 +262,15 @@ async function runPairingPreflight(options) {
262
262
  };
263
263
  await mkdir2(options.paths.pairingDir, { recursive: true, mode: 448 }).catch(() => void 0);
264
264
  await writeJsonFile(pairingSessionPath(sessionId, options.paths), session);
265
+ const lanUrls = (routes?.lanIps ?? []).map((ip) => `http://${ip}:${options.config.port}`);
266
+ const publicUrls = (routes?.publicIpv4s ?? []).map((ip) => `http://${ip}:${options.config.port}`);
265
267
  const pairingUrl = buildPairingUrl({
266
268
  linkId: options.identity.link_id ?? "",
267
269
  installId: options.identity.install_id,
268
270
  connectToken: token.token,
269
271
  port: options.config.port,
270
- localApiUrl: bestUrl,
271
- preferredUrls: session.preferred_urls
272
+ lanUrls,
273
+ publicUrls
272
274
  });
273
275
  if (options.openBrowser !== false) {
274
276
  await openSystemBrowser(pairingUrl).catch(() => void 0);
@@ -280,12 +282,16 @@ function buildPairingUrl(params) {
280
282
  link_id: params.linkId,
281
283
  install_id: params.installId,
282
284
  connect_token: params.connectToken,
283
- port: String(params.port),
284
- local_url: params.localApiUrl,
285
- preferred_urls: params.preferredUrls.join(",")
285
+ port: String(params.port)
286
286
  });
287
+ if (params.lanUrls.length > 0) qs.set("lan_urls", params.lanUrls.join(","));
288
+ if (params.publicUrls.length > 0) qs.set("public_urls", params.publicUrls.join(","));
287
289
  return `hermesapp://pair?${qs.toString()}`;
288
290
  }
291
+ function buildLocalPairingPageUrl(port, connectToken) {
292
+ const qs = new URLSearchParams({ connect_token: connectToken });
293
+ return `http://127.0.0.1:${port}/pair?${qs.toString()}`;
294
+ }
289
295
 
290
296
  // src/cli/index.ts
291
297
  var args = process.argv.slice(2);
@@ -441,10 +447,13 @@ async function cmdPair(paths) {
441
447
  return;
442
448
  }
443
449
  const result = await runPairingPreflight({ identity, config, paths });
450
+ const localPageUrl = buildLocalPairingPageUrl(config.port, result.connectToken);
444
451
  process.stdout.write("\n");
445
452
  qrcode.generate(result.pairingUrl, { small: true });
446
453
  process.stdout.write(`
447
454
  Pairing URL: ${result.pairingUrl}
455
+ `);
456
+ process.stdout.write(`Pairing page: ${localPageUrl}
448
457
  `);
449
458
  process.stdout.write(`Connect token: ${result.connectToken}
450
459
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bulolo/hermes-link",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "description": "Hermes Link companion service and CLI for connecting hermes-agent through zhiji",
5
5
  "license": "MIT",
6
6
  "type": "module",