@clawpilot-app/link 0.1.0
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/README.md +48 -0
- package/package.json +43 -0
- package/scripts/check-node-version.mjs +44 -0
- package/src/cli.js +599 -0
- package/src/constants.js +1 -0
- package/src/daemon.js +1661 -0
- package/src/i18n.js +182 -0
- package/src/network.js +71 -0
- package/src/openclaw.js +297 -0
- package/src/runtime.js +423 -0
- package/src/server-api.js +135 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ClawPilot Link
|
|
2
|
+
|
|
3
|
+
`ClawPilot Link` is the local daemon and CLI that connects a local OpenClaw instance to ClawPilot Relay.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 22.14.0 or newer
|
|
8
|
+
- An OpenClaw setup that already works on the same machine
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @clawpilot-app/link
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
ClawPilot Link follows OpenClaw's runtime baseline. If your Node.js version is older than 22.14.0, the install step will stop early and ask you to upgrade first.
|
|
17
|
+
|
|
18
|
+
## Common commands
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
clawlink pair
|
|
22
|
+
clawlink connect --background
|
|
23
|
+
clawlink status
|
|
24
|
+
clawlink doctor
|
|
25
|
+
clawlink qr
|
|
26
|
+
clawlink restart
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Update
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @clawpilot-app/link@latest
|
|
33
|
+
clawlink restart
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Publish from this repo
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run release -- --version 0.1.1
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or publish in one step:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run release -- --version 0.1.1 --publish
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The npm package name is `@clawpilot-app/link`.
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clawpilot-app/link",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "ClawPilot Link daemon and CLI for connecting local OpenClaw through ClawPilot Relay",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"clawlink": "./src/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"scripts/check-node-version.mjs",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"clawpilot",
|
|
18
|
+
"openclaw",
|
|
19
|
+
"relay",
|
|
20
|
+
"link",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=22.14.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"check": "find src scripts -type f \\( -name '*.js' -o -name '*.mjs' \\) -print0 | xargs -0 -n1 node --check",
|
|
31
|
+
"preinstall": "node ./scripts/check-node-version.mjs",
|
|
32
|
+
"start": "node ./src/cli.js",
|
|
33
|
+
"daemon": "node ./src/cli.js daemon",
|
|
34
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
35
|
+
"release": "node ./scripts/release.mjs",
|
|
36
|
+
"publish:npm": "npm publish --access public"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"json5": "^2.2.3",
|
|
40
|
+
"qrcode-terminal": "^0.12.0",
|
|
41
|
+
"ws": "^8.18.3"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
|
|
3
|
+
const MINIMUM_NODE_VERSION = "22.14.0";
|
|
4
|
+
|
|
5
|
+
function parseVersion(input) {
|
|
6
|
+
const normalized = String(input ?? "")
|
|
7
|
+
.trim()
|
|
8
|
+
.replace(/^v/i, "");
|
|
9
|
+
const [major = "0", minor = "0", patch = "0"] = normalized.split(".");
|
|
10
|
+
return [
|
|
11
|
+
Number.parseInt(major, 10) || 0,
|
|
12
|
+
Number.parseInt(minor, 10) || 0,
|
|
13
|
+
Number.parseInt(patch, 10) || 0,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function compareVersions(left, right) {
|
|
18
|
+
for (let index = 0; index < 3; index += 1) {
|
|
19
|
+
if (left[index] > right[index]) {
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
if (left[index] < right[index]) {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const current = parseVersion(process.versions.node);
|
|
30
|
+
const minimum = parseVersion(MINIMUM_NODE_VERSION);
|
|
31
|
+
|
|
32
|
+
if (compareVersions(current, minimum) < 0) {
|
|
33
|
+
console.error("");
|
|
34
|
+
console.error("ClawPilot Link needs Node.js 22.14.0 or newer.");
|
|
35
|
+
console.error(`You are using Node.js ${process.versions.node}.`);
|
|
36
|
+
console.error("");
|
|
37
|
+
console.error("Why this is required:");
|
|
38
|
+
console.error("- OpenClaw itself already requires Node.js 22.14.0 or newer.");
|
|
39
|
+
console.error("- If Link allowed an older Node.js, installation might succeed but pairing or background service could fail later.");
|
|
40
|
+
console.error("");
|
|
41
|
+
console.error("Please update Node.js first, then run the install command again.");
|
|
42
|
+
console.error("");
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|