@hermespilot/link 0.2.8 → 0.2.9

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.
@@ -3724,7 +3724,7 @@ import os2 from "os";
3724
3724
  import path5 from "path";
3725
3725
 
3726
3726
  // src/constants.ts
3727
- var LINK_VERSION = "0.2.8";
3727
+ var LINK_VERSION = "0.2.9";
3728
3728
  var LINK_COMMAND = "hermeslink";
3729
3729
  var LINK_DEFAULT_PORT = 52379;
3730
3730
  var LINK_RUNTIME_DIR_NAME = ".hermeslink";
package/dist/cli/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  startDaemonProcess,
31
31
  startLinkService,
32
32
  stopDaemonProcess
33
- } from "../chunk-W4U6XJ4W.js";
33
+ } from "../chunk-VLTX75SY.js";
34
34
 
35
35
  // src/cli/index.ts
36
36
  import { Command } from "commander";
@@ -277,6 +277,7 @@ var messages = {
277
277
  "pair.code": "Pairing code: {value}",
278
278
  "pair.localApi": "Local API: http://127.0.0.1:{port}",
279
279
  "pair.scan": "Open this pairing page in the HermesPilot App or scan the QR code below:",
280
+ "pair.openBrowserFailed": "Could not open the system browser automatically. You can still scan the QR code below or open this URL manually: {url}",
280
281
  "pair.expires": "Pairing expires in 10 minutes. Press Ctrl+C to cancel waiting.",
281
282
  "pair.claimed": "Pairing succeeded. Starting Hermes Link in the background...",
282
283
  "pair.claimedRunning": "Pairing succeeded. Hermes Link is already running in the background.",
@@ -363,6 +364,7 @@ var messages = {
363
364
  "pair.code": "\u914D\u5BF9\u7801\uFF1A{value}",
364
365
  "pair.localApi": "\u672C\u5730 API\uFF1Ahttp://127.0.0.1:{port}",
365
366
  "pair.scan": "\u8BF7\u5728 HermesPilot App \u4E2D\u6253\u5F00\u8FD9\u4E2A\u914D\u5BF9\u9875\uFF0C\u6216\u626B\u63CF\u4E0B\u9762\u7684\u4E8C\u7EF4\u7801\uFF1A",
367
+ "pair.openBrowserFailed": "\u65E0\u6CD5\u81EA\u52A8\u6253\u5F00\u7CFB\u7EDF\u6D4F\u89C8\u5668\u3002\u4F60\u4ECD\u7136\u53EF\u4EE5\u626B\u63CF\u4E0B\u9762\u7684\u4E8C\u7EF4\u7801\uFF0C\u6216\u624B\u52A8\u6253\u5F00\u8FD9\u4E2A\u94FE\u63A5\uFF1A{url}",
366
368
  "pair.expires": "\u914D\u5BF9\u4F1A\u8BDD 10 \u5206\u949F\u540E\u8FC7\u671F\u3002\u6309 Ctrl+C \u9000\u51FA\u7B49\u5F85\u3002",
367
369
  "pair.claimed": "\u914D\u5BF9\u5DF2\u6210\u529F\u3002\u6B63\u5728\u628A Hermes Link \u5207\u6362\u5230\u540E\u53F0\u8FD0\u884C...",
368
370
  "pair.claimedRunning": "\u914D\u5BF9\u5DF2\u6210\u529F\u3002Hermes Link \u5DF2\u5728\u540E\u53F0\u6301\u7EED\u8FD0\u884C\u3002",
@@ -609,16 +611,29 @@ async function openSystemBrowser(url) {
609
611
  return await spawnDetached("xdg-open", [url]);
610
612
  }
611
613
  async function spawnDetached(command, args) {
612
- try {
613
- const child = spawn(command, args, {
614
- detached: true,
615
- stdio: "ignore"
616
- });
617
- child.unref();
618
- return true;
619
- } catch {
620
- return false;
621
- }
614
+ return await new Promise((resolve) => {
615
+ let settled = false;
616
+ const settle = (ok) => {
617
+ if (settled) {
618
+ return;
619
+ }
620
+ settled = true;
621
+ resolve(ok);
622
+ };
623
+ try {
624
+ const child = spawn(command, args, {
625
+ detached: true,
626
+ stdio: "ignore"
627
+ });
628
+ child.once("error", () => settle(false));
629
+ child.once("spawn", () => {
630
+ child.unref();
631
+ settle(true);
632
+ });
633
+ } catch {
634
+ settle(false);
635
+ }
636
+ });
622
637
  }
623
638
 
624
639
  // src/cli/index.ts
@@ -777,7 +792,10 @@ program.command("pair").description(helpText("pair.description")).action(async (
777
792
  }
778
793
  console.log(t("pair.scan"));
779
794
  console.log(`Pairing page: ${pairingPageUrl}`);
780
- void openSystemBrowser(pairingPageUrl);
795
+ const browserOpened = await openSystemBrowser(pairingPageUrl);
796
+ if (!browserOpened) {
797
+ console.log(t("pair.openBrowserFailed", { url: pairingPageUrl }));
798
+ }
781
799
  qrcode.generate(qrValue, { small: true });
782
800
  console.log(t("pair.expires"));
783
801
  const result = await waitForPairingOrShutdown(prepared.sessionId, paths);
package/dist/http/app.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApp
3
- } from "../chunk-W4U6XJ4W.js";
3
+ } from "../chunk-VLTX75SY.js";
4
4
  export {
5
5
  createApp
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hermespilot/link",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "private": false,
5
5
  "description": "Hermes Link companion service and CLI for connecting hermes-agent through HermesPilot",
6
6
  "license": "MIT",