@claw-link/gateway-host 0.1.1 → 0.1.3
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/bin/cli.js +2 -2
- package/package.json +2 -1
- package/scripts/install.js +7 -10
- package/src/config.js +8 -2
package/bin/cli.js
CHANGED
|
@@ -42,7 +42,7 @@ async function main() {
|
|
|
42
42
|
console.log([
|
|
43
43
|
'ClawLink Host Gateway',
|
|
44
44
|
'',
|
|
45
|
-
'Usage:
|
|
45
|
+
'Usage: gateway-host <command>',
|
|
46
46
|
' install Install the background service (one-time)',
|
|
47
47
|
' add-agent Add an agent by pasting its Host Token (pulls runtime from ClawLink)',
|
|
48
48
|
' setup install + add-agent in one flow (default)',
|
|
@@ -54,7 +54,7 @@ async function main() {
|
|
|
54
54
|
return;
|
|
55
55
|
|
|
56
56
|
default:
|
|
57
|
-
console.error(`Unknown command '${cmd}'. Try:
|
|
57
|
+
console.error(`Unknown command '${cmd}'. Try: gateway-host help`);
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
60
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claw-link/gateway-host",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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": {
|
|
7
|
+
"gateway-host": "bin/cli.js",
|
|
7
8
|
"claw-host": "bin/cli.js"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
package/scripts/install.js
CHANGED
|
@@ -13,7 +13,6 @@ const { detectRuntimes } = require('../src/detect');
|
|
|
13
13
|
const { Bridge } = require('../src/bridge');
|
|
14
14
|
|
|
15
15
|
const VERSION = (() => { try { return require('../package.json').version; } catch { return '0.0.0'; } })();
|
|
16
|
-
const PROJECT_REF_DEFAULT = 'rgzinqbdnesinmbshgtc';
|
|
17
16
|
const RUNTIMES = ['openclaw', 'hermes', 'claude', 'codex', 'cursor'];
|
|
18
17
|
const SERVICE_LABEL = 'co.clawlink.host';
|
|
19
18
|
|
|
@@ -22,10 +21,10 @@ function ask(rl, q, def) {
|
|
|
22
21
|
}
|
|
23
22
|
function execSafe(cmd) { try { return execSync(cmd, { stdio: ['ignore', 'pipe', 'ignore'] }).toString(); } catch { return null; } }
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
cfg.bridge_url =
|
|
24
|
+
// The bridge URL is baked in (config.DEFAULT_BRIDGE_URL / CLAWLINK_BRIDGE_URL env)
|
|
25
|
+
// — operators never type it. We just ensure it's populated.
|
|
26
|
+
function ensureBridgeUrl(cfg) {
|
|
27
|
+
if (!cfg.bridge_url) cfg.bridge_url = config.DEFAULT_BRIDGE_URL;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// Add one agent with ONLY its Host Token. The token resolves the agent + runtime
|
|
@@ -80,7 +79,7 @@ async function run() {
|
|
|
80
79
|
console.log('\n ClawLink Host Gateway — setup\n ─────────────────────────────\n');
|
|
81
80
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
82
81
|
const cfg = config.load() || config.defaultConfig();
|
|
83
|
-
|
|
82
|
+
ensureBridgeUrl(cfg);
|
|
84
83
|
config.save(cfg);
|
|
85
84
|
|
|
86
85
|
let added = 0, more = true;
|
|
@@ -104,11 +103,9 @@ async function run() {
|
|
|
104
103
|
|
|
105
104
|
// `install` — install the service only (configure agents later with `add-agent`).
|
|
106
105
|
async function installOnly() {
|
|
107
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
108
106
|
const cfg = config.load() || config.defaultConfig();
|
|
109
|
-
|
|
107
|
+
ensureBridgeUrl(cfg);
|
|
110
108
|
config.save(cfg);
|
|
111
|
-
rl.close();
|
|
112
109
|
const installed = installService();
|
|
113
110
|
console.log(installed ? ' ✓ Service installed.' : ' ⚠ Could not install the service automatically.');
|
|
114
111
|
console.log(' Next: npx @claw-link/gateway-host add-agent\n');
|
|
@@ -118,7 +115,7 @@ async function installOnly() {
|
|
|
118
115
|
async function addAgentCmd() {
|
|
119
116
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
120
117
|
const cfg = config.load() || config.defaultConfig();
|
|
121
|
-
|
|
118
|
+
ensureBridgeUrl(cfg);
|
|
122
119
|
const agent = await addAgentInteractive(cfg, rl);
|
|
123
120
|
rl.close();
|
|
124
121
|
if (agent) { saveAgent(cfg, agent); console.log(`\n ✓ Added agent ${agent.agent_id}. Restart the service or it will pick it up shortly.\n`); }
|
package/src/config.js
CHANGED
|
@@ -11,6 +11,12 @@ const path = require('path');
|
|
|
11
11
|
const HOME_DIR = path.join(os.homedir(), '.clawlink-host');
|
|
12
12
|
const CONFIG_PATH = path.join(HOME_DIR, 'config.json');
|
|
13
13
|
|
|
14
|
+
// The ClawLink host-bridge endpoint is a fixed public URL — baked in so operators
|
|
15
|
+
// only ever paste a Host Token. Override only for a self-hosted ClawLink (env var).
|
|
16
|
+
const DEFAULT_BRIDGE_URL =
|
|
17
|
+
process.env.CLAWLINK_BRIDGE_URL ||
|
|
18
|
+
'https://rgzinqbdnesinmbshgtc.supabase.co/functions/v1/host-bridge';
|
|
19
|
+
|
|
14
20
|
// Runtimes whose CLI runs inside a project WORKSPACE directory (coding agents).
|
|
15
21
|
// OpenClaw (HTTP) and Hermes (~/.hermes context) don't need one.
|
|
16
22
|
const WORKSPACE_RUNTIMES = ['claude', 'codex', 'cursor'];
|
|
@@ -29,7 +35,7 @@ function ensureHomeDir() {
|
|
|
29
35
|
|
|
30
36
|
function defaultConfig() {
|
|
31
37
|
return {
|
|
32
|
-
bridge_url:
|
|
38
|
+
bridge_url: DEFAULT_BRIDGE_URL,
|
|
33
39
|
instance_id: require('crypto').randomUUID(),
|
|
34
40
|
poll_interval_ms: 1500,
|
|
35
41
|
heartbeat_ms: 10000,
|
|
@@ -81,4 +87,4 @@ function redacted(cfg) {
|
|
|
81
87
|
return clone;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
module.exports = { HOME_DIR, CONFIG_PATH, WORKSPACE_RUNTIMES, expandHome, ensureHomeDir, defaultConfig, load, save, normalizeAgent, redacted };
|
|
90
|
+
module.exports = { HOME_DIR, CONFIG_PATH, DEFAULT_BRIDGE_URL, WORKSPACE_RUNTIMES, expandHome, ensureHomeDir, defaultConfig, load, save, normalizeAgent, redacted };
|