@claw-link/gateway-host 0.2.11 → 0.2.13
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/package.json +1 -1
- package/scripts/install.js +27 -1
- package/src/adapters/cli.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claw-link/gateway-host",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
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": {
|
package/scripts/install.js
CHANGED
|
@@ -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
|
-
|
|
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.
|
package/src/adapters/cli.js
CHANGED
|
@@ -116,8 +116,13 @@ function makeCliAdapter(cfg) {
|
|
|
116
116
|
// edit or run shell. permArgs is handed to defaultArgs so each adapter can place
|
|
117
117
|
// it correctly (e.g. Codex must put flags BEFORE its `--` end-of-options).
|
|
118
118
|
// Operator args_template overrides take full control.
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
// Harness nodes do collaborative work (write code/files, run commands), so they get
|
|
120
|
+
// workspace-write like an admin "configure" turn — even though they're carried on the
|
|
121
|
+
// 'customer' scope. Real customer chats stay read-only.
|
|
122
|
+
const writable = !!job.harness || job.scope === 'configure' || job.scope === 'sub_configure';
|
|
123
|
+
const permArgs = (!Array.isArray(agent.args_template) && cfg.permissions)
|
|
124
|
+
? cfg.permissions(writable ? 'configure' : (job.scope || 'customer'))
|
|
125
|
+
: [];
|
|
121
126
|
const argvFor = (rid) => Array.isArray(agent.args_template)
|
|
122
127
|
? buildArgv(agent.args_template, { prompt: fullPrompt, sessionId: rid || '', systemPrompt })
|
|
123
128
|
: cfg.defaultArgs(fullPrompt, rid, cfg.promptViaStdin, permArgs);
|