@claw-link/gateway-host 0.2.11 → 0.2.12

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/package.json +1 -1
  2. package/scripts/install.js +27 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claw-link/gateway-host",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "ClawLink Host Gateway — a secure, outbound-only worker that bridges a local agent CLI (OpenClaw, Hermes, Claude, Codex, Cursor) to your ClawLink agents. No inbound ports; authenticated per-agent by a Host Token.",
5
5
  "homepage": "https://claw-link.co",
6
6
  "bin": {
@@ -22,6 +22,29 @@ function ask(rl, q, def) {
22
22
  }
23
23
  function execSafe(cmd) { try { return execSync(cmd, { stdio: ['ignore', 'pipe', 'ignore'] }).toString(); } catch { return null; } }
24
24
 
25
+ // `npx` runs the package from a cache and NEVER puts the `clhost` bin on PATH — only a
26
+ // global install does. So during setup we make `clhost` available (best-effort, non-fatal):
27
+ // probe PATH, and if it's missing, do a quiet global install of the same version.
28
+ function clhostOnPath() {
29
+ const probe = process.platform === 'win32' ? 'where clhost' : 'command -v clhost';
30
+ return execSafe(probe) != null;
31
+ }
32
+ function ensureGlobalCli() {
33
+ if (clhostOnPath()) return true;
34
+ try { execSync(`npm install -g @claw-link/gateway-host@${VERSION}`, { stdio: 'ignore', timeout: 120000 }); }
35
+ catch { /* no permission / offline — reportCli() prints the manual fallback */ }
36
+ return clhostOnPath();
37
+ }
38
+ function reportCli() {
39
+ if (ensureGlobalCli()) {
40
+ console.log(' ✓ The `clhost` command is ready — try: clhost status');
41
+ } else {
42
+ console.log(' ℹ To get the short `clhost` command, install it once (you may need sudo):');
43
+ console.log(' npm i -g @claw-link/gateway-host');
44
+ console.log(' Until then, run commands as: npx @claw-link/gateway-host <command>');
45
+ }
46
+ }
47
+
25
48
  // The bridge URL is baked in (config.DEFAULT_BRIDGE_URL / CLAWLINK_BRIDGE_URL env)
26
49
  // — operators never type it. We just ensure it's populated.
27
50
  function ensureBridgeUrl(cfg) {
@@ -110,6 +133,7 @@ async function run() {
110
133
  console.log(installed
111
134
  ? ' ✓ Service refreshed to the latest version.'
112
135
  : ' ⚠ Could not refresh the service automatically — run: clhost restart');
136
+ reportCli();
113
137
  console.log('\n Commands: clhost status · clhost agents · clhost add-agent · clhost transport-test\n');
114
138
  return;
115
139
  }
@@ -133,6 +157,7 @@ async function run() {
133
157
  console.log(installed
134
158
  ? ' ✓ Installed + started the background service.'
135
159
  : ' ⚠ Could not install a background service automatically.\n Run it yourself with: clhost run');
160
+ reportCli();
136
161
  console.log('\n Check status in ClawLink → Agents → Host Gateway (connection badge).\n');
137
162
  }
138
163
 
@@ -143,7 +168,8 @@ async function installOnly() {
143
168
  config.save(cfg);
144
169
  const installed = installService();
145
170
  console.log(installed ? ' ✓ Service installed.' : ' ⚠ Could not install the service automatically.');
146
- console.log(' Next: npx @claw-link/gateway-host add-agent\n');
171
+ reportCli();
172
+ console.log(' Next: clhost add-agent (or npx @claw-link/gateway-host add-agent)\n');
147
173
  }
148
174
 
149
175
  // `add-agent` — add one agent by token, then restart the service to pick it up.