kiteline 0.1.0 → 0.2.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 +5 -5
- package/dist/{banner-DJdyE8-G.mjs → banner-CXnDgf5p.mjs} +73 -4
- package/dist/cli.mjs +10 -6
- package/dist/{package-D46-e3oS.mjs → package-CbMOnF6R.mjs} +1 -1
- package/dist/{service-1H4ozSPX.mjs → service-BCgNAv2Z.mjs} +3 -2
- package/dist/{show-pairing-jhFEXWi7.mjs → show-pairing-CTd0UfS1.mjs} +1 -1
- package/dist/show-pairing-Zurbk9wK.mjs +1 -0
- package/dist/{src-BnClcgTs.mjs → src-DSH8d4ZM.mjs} +520 -7
- package/dist/web/assets/{IconBase.es-CfbvcPwJ.js → IconBase.es-h0cGkmPy.js} +1 -1
- package/dist/web/assets/MagnifyingGlass.es-CpSmmHxy.js +1 -0
- package/dist/web/assets/{composer-B6OuQTWV.js → composer-WnPpY669.js} +1 -1
- package/dist/web/assets/{copy-button-DrJvfi1A.js → copy-button-DBETbWKF.js} +1 -1
- package/dist/web/assets/index-CTAi3HIp.js +11 -0
- package/dist/web/assets/lazy/{core-DbyPnbRm.js → core-CuC-kkU7.js} +1 -1
- package/dist/web/assets/{new-x01_nUpy.js → new-D_XEbYrm.js} +1 -1
- package/dist/web/assets/prefs-D6OSXuFe.js +1 -0
- package/dist/web/assets/routes-Csbxwlji.js +1 -0
- package/dist/web/assets/{s._sessionId-BtgSN22Q.js → s._sessionId-BlR4dPFc.js} +8 -8
- package/dist/web/assets/settings-DRpTnWMo.js +1 -0
- package/dist/web/assets/{status-BFb0ZUqi.js → status-C7fEa4v1.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/show-pairing-u0LfkF9W.mjs +0 -1
- package/dist/web/assets/MagnifyingGlass.es-DLNPT1gT.js +0 -1
- package/dist/web/assets/index-Da9GDrpu.js +0 -11
- package/dist/web/assets/prefs-CliZrwNF.js +0 -1
- package/dist/web/assets/routes-NIOlnkZY.js +0 -1
- package/dist/web/assets/settings-B7yar__r.js +0 -1
package/README.md
CHANGED
|
@@ -27,28 +27,28 @@ It's self-hosted: your phone talks straight to your computer, and Claude Code ke
|
|
|
27
27
|
You need Node.js 22.18 or newer, and Claude Code signed in on the computer.
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npx kiteline
|
|
30
|
+
npx kiteline --relay
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Scan the QR code it prints with your phone's camera, and you're in.
|
|
33
|
+
Scan the QR code it prints with your phone's camera, and you're in, on any network. `--relay` connects through Kiteline's relay, sealed end to end: it passes your sessions on without being able to read them. Leave it out to keep Kiteline to your own Wi-Fi, or [use Tailscale](https://kiteline.seefun.dev/docs/#tailscale).
|
|
34
34
|
|
|
35
35
|
To keep it running in the background, starting with your computer (Linux):
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
npm install -g kiteline
|
|
39
|
-
kiteline service install
|
|
39
|
+
kiteline service install --relay
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Everything else is in the **[docs](https://kiteline.seefun.dev/docs/)**:
|
|
43
43
|
|
|
44
|
-
- [Reach it from anywhere](https://kiteline.seefun.dev/docs/#anywhere),
|
|
44
|
+
- [Reach it from anywhere](https://kiteline.seefun.dev/docs/#anywhere), and [what the relay sees](https://kiteline.seefun.dev/docs/#relay-privacy)
|
|
45
45
|
- [Keep it running](https://kiteline.seefun.dev/docs/#always-on) all the time, even with the lid closed
|
|
46
46
|
- [Approvals](https://kiteline.seefun.dev/docs/#approve) and [permission modes](https://kiteline.seefun.dev/docs/#modes)
|
|
47
47
|
- [Configuration](https://kiteline.seefun.dev/docs/#config), [security](https://kiteline.seefun.dev/docs/#security) and [troubleshooting](https://kiteline.seefun.dev/docs/#troubleshooting)
|
|
48
48
|
|
|
49
49
|
## Good to know
|
|
50
50
|
|
|
51
|
-
- **Treat the pairing link like a password.** Anyone who opens it can drive Claude Code on your computer. Don't open Kiteline's port to the internet; use Tailscale to reach it from elsewhere.
|
|
51
|
+
- **Treat the pairing link like a password.** Anyone who opens it can drive Claude Code on your computer. Don't open Kiteline's port to the internet; use `--relay` or Tailscale to reach it from elsewhere.
|
|
52
52
|
- **It uses Claude Code's own login,** your Claude plan or API key. Check that the way you use it fits your plan's terms.
|
|
53
53
|
- **Tested on Linux so far.** Reports from real phones, macOS and Windows are very welcome.
|
|
54
54
|
|
|
@@ -906,6 +906,51 @@ function renderSVG(data, options = {}) {
|
|
|
906
906
|
svg += "</svg>";
|
|
907
907
|
return svg;
|
|
908
908
|
}
|
|
909
|
+
// ../../packages/api/src/tunnel/relay-protocol.ts
|
|
910
|
+
/** The relay Kiteline uses unless told otherwise. */
|
|
911
|
+
const DEFAULT_RELAY = "https://relay.kiteline.seefun.dev";
|
|
912
|
+
const RelayPath = {
|
|
913
|
+
/** A computer's standing connection, over which the relay asks it to open channels. */
|
|
914
|
+
host: "/v1/host",
|
|
915
|
+
/** A phone asking for a computer: /v1/client/<hostId>. */
|
|
916
|
+
client: "/v1/client/",
|
|
917
|
+
/** A computer answering a phone: /v1/data/<channel>. */
|
|
918
|
+
data: "/v1/data/"
|
|
919
|
+
};
|
|
920
|
+
/** Close codes, so each side can say plainly what happened. */
|
|
921
|
+
const RelayClose = {
|
|
922
|
+
Replaced: 4e3,
|
|
923
|
+
BadRequest: 4400,
|
|
924
|
+
NotPaired: 4401,
|
|
925
|
+
HostOffline: 4404,
|
|
926
|
+
TooMany: 4429,
|
|
927
|
+
ShuttingDown: 4503,
|
|
928
|
+
HostSilent: 4504
|
|
929
|
+
};
|
|
930
|
+
function toBase64Url(bytes) {
|
|
931
|
+
let binary = "";
|
|
932
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
933
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
934
|
+
}
|
|
935
|
+
function fromBase64Url(text) {
|
|
936
|
+
const binary = atob(text.replace(/-/g, "+").replace(/_/g, "/"));
|
|
937
|
+
const out = new Uint8Array(binary.length);
|
|
938
|
+
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
|
939
|
+
return out;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* A computer's address at the relay, worked out from its relay secret: whoever can show the secret
|
|
943
|
+
* owns the address, and the relay needs to remember nothing.
|
|
944
|
+
*/
|
|
945
|
+
async function hostIdFor(secret) {
|
|
946
|
+
return toBase64Url(new Uint8Array(await crypto.subtle.digest("SHA-256", secret))).slice(0, 22);
|
|
947
|
+
}
|
|
948
|
+
/** The relay's WebSocket address for a path, from its https address. */
|
|
949
|
+
function relaySocketUrl(relay, path) {
|
|
950
|
+
const url = new URL(path, relay);
|
|
951
|
+
url.protocol = url.protocol === "http:" ? "ws:" : "wss:";
|
|
952
|
+
return url.toString();
|
|
953
|
+
}
|
|
909
954
|
// src/config.ts
|
|
910
955
|
var SettingsError = class extends Error {};
|
|
911
956
|
/** `apps/server/.env` when running from a clone; a published package has none. */
|
|
@@ -951,6 +996,23 @@ function address(name, what) {
|
|
|
951
996
|
} catch {}
|
|
952
997
|
throw new SettingsError(`${what} (${name}) should be a web address such as https://my-computer.my-tailnet.ts.net, not "${raw}".`);
|
|
953
998
|
}
|
|
999
|
+
/** on and off, or a relay of your own: KITELINE_RELAY=https://relay.example.com */
|
|
1000
|
+
function relay() {
|
|
1001
|
+
const raw = text("KITELINE_RELAY");
|
|
1002
|
+
if (raw === void 0 || [
|
|
1003
|
+
"off",
|
|
1004
|
+
"false",
|
|
1005
|
+
"0",
|
|
1006
|
+
"no"
|
|
1007
|
+
].includes(raw.toLowerCase())) return null;
|
|
1008
|
+
if ([
|
|
1009
|
+
"on",
|
|
1010
|
+
"true",
|
|
1011
|
+
"1",
|
|
1012
|
+
"yes"
|
|
1013
|
+
].includes(raw.toLowerCase())) return DEFAULT_RELAY;
|
|
1014
|
+
return address("KITELINE_RELAY", "The relay");
|
|
1015
|
+
}
|
|
954
1016
|
function readSettings() {
|
|
955
1017
|
loadOwnEnvFile();
|
|
956
1018
|
return {
|
|
@@ -962,7 +1024,8 @@ function readSettings() {
|
|
|
962
1024
|
claudePath: text("CLAUDE_PATH"),
|
|
963
1025
|
allowBypass: yesNo("KITELINE_ALLOW_BYPASS", "Allowing Bypass mode", true),
|
|
964
1026
|
maxSessions: whole("KITELINE_MAX_SESSIONS", "The session limit", 6, 1, 100),
|
|
965
|
-
idleMinutes: whole("KITELINE_IDLE_MINUTES", "The idle time", 20, 1, 10080)
|
|
1027
|
+
idleMinutes: whole("KITELINE_IDLE_MINUTES", "The idle time", 20, 1, 10080),
|
|
1028
|
+
relay: relay() ?? null
|
|
966
1029
|
};
|
|
967
1030
|
}
|
|
968
1031
|
/** How the person started Kiteline, so the hints it prints name a command they can run. */
|
|
@@ -993,12 +1056,14 @@ function reachableHosts() {
|
|
|
993
1056
|
function buildPairing(port, token, options) {
|
|
994
1057
|
const publicUrl = options.publicUrl?.replace(/\/+$/, "");
|
|
995
1058
|
const lan = options.loopbackOnly ? [] : reachableHosts().map((host) => `http://${host}:${port}`);
|
|
1059
|
+
const relay = options.relay?.url.replace(/\/+$/, "");
|
|
996
1060
|
const urls = [
|
|
1061
|
+
...relay ? [relay] : [],
|
|
997
1062
|
...publicUrl ? [publicUrl] : [],
|
|
998
1063
|
...lan,
|
|
999
1064
|
`http://localhost:${port}`
|
|
1000
1065
|
];
|
|
1001
|
-
const url = `${urls[0]}/#pair=${token}`;
|
|
1066
|
+
const url = relay ? `${relay}/#host=${options.relay?.hostId}&pair=${token}` : `${urls[0]}/#pair=${token}`;
|
|
1002
1067
|
return {
|
|
1003
1068
|
url,
|
|
1004
1069
|
urls,
|
|
@@ -1015,7 +1080,11 @@ function printBanner(pairing, options) {
|
|
|
1015
1080
|
"",
|
|
1016
1081
|
` ${accent("◆")} ${bold("Kiteline")} ${dim(`v${options.version}`)}${options.dev ? dim(" (dev, web on :4546)") : ""}`,
|
|
1017
1082
|
"",
|
|
1018
|
-
...pairing.urls.map((url, i) =>
|
|
1083
|
+
...pairing.urls.map((url, i) => {
|
|
1084
|
+
const label = i === pairing.urls.length - 1 ? "Local " : url === options.relay ? "Anywhere" : "Network ";
|
|
1085
|
+
return ` ${dim(label)} ${url}`;
|
|
1086
|
+
}),
|
|
1087
|
+
...options.relay ? ["", ` ${dim("Through the relay, sealed end to end: it passes your sessions on unread.")}`] : [],
|
|
1019
1088
|
"",
|
|
1020
1089
|
` ${bold("Pair your phone:")} scan this code, or open the link on it.`,
|
|
1021
1090
|
"",
|
|
@@ -1064,4 +1133,4 @@ function printSettingsError(message) {
|
|
|
1064
1133
|
""
|
|
1065
1134
|
].join("\n"));
|
|
1066
1135
|
}
|
|
1067
|
-
export { printAlreadyRunning as a, savePairing as c, loadOwnEnvFile as d, readSettings as f, dim as i, SettingsError as l,
|
|
1136
|
+
export { hostIdFor as _, printAlreadyRunning as a, renderSVG as b, savePairing as c, loadOwnEnvFile as d, readSettings as f, fromBase64Url as g, RelayPath as h, dim as i, SettingsError as l, RelayClose as m, bold as n, printBanner as o, startedFromCli as p, buildPairing as r, printSettingsError as s, accent as t, command as u, relaySocketUrl as v, toBase64Url as y };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
3
|
-
import { i as dim, n as bold, p as startedFromCli, t as accent } from "./banner-
|
|
2
|
+
import { t as version } from "./package-CbMOnF6R.mjs";
|
|
3
|
+
import { i as dim, n as bold, p as startedFromCli, t as accent } from "./banner-CXnDgf5p.mjs";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
// src/cli.ts
|
|
6
6
|
const HELP = `
|
|
@@ -20,12 +20,14 @@ const HELP = `
|
|
|
20
20
|
127.0.0.1 keeps it to this computer, for Tailscale Serve
|
|
21
21
|
--public-url <url> The address your phone uses, like your Tailscale one;
|
|
22
22
|
the pairing code points there
|
|
23
|
+
--relay Reach this computer from anywhere, through Kiteline's relay.
|
|
24
|
+
Sealed end to end: the relay passes your sessions on unread
|
|
23
25
|
--new-token Make a new pairing code, so every device pairs again
|
|
24
26
|
--force With service install: replace a service set up by hand
|
|
25
27
|
-v, --version Show the version
|
|
26
28
|
-h, --help Show this
|
|
27
29
|
|
|
28
|
-
The options also work as environment variables (PORT, HOST, KITELINE_PUBLIC_URL), and a few
|
|
30
|
+
The options also work as environment variables (PORT, HOST, KITELINE_PUBLIC_URL, KITELINE_RELAY), and a few
|
|
29
31
|
more settings do too: ${accent("https://kiteline.seefun.dev/docs/#config")}
|
|
30
32
|
`;
|
|
31
33
|
function fail(message) {
|
|
@@ -46,6 +48,7 @@ function parse() {
|
|
|
46
48
|
host: { type: "string" },
|
|
47
49
|
"public-url": { type: "string" },
|
|
48
50
|
"new-token": { type: "boolean" },
|
|
51
|
+
relay: { type: "boolean" },
|
|
49
52
|
force: { type: "boolean" },
|
|
50
53
|
help: {
|
|
51
54
|
type: "boolean",
|
|
@@ -83,6 +86,7 @@ if (values.help || positionals[0] === "help") {
|
|
|
83
86
|
if (values.port !== void 0) process.env.PORT = values.port;
|
|
84
87
|
if (values.host !== void 0) process.env.HOST = values.host;
|
|
85
88
|
if (values["public-url"] !== void 0) process.env.KITELINE_PUBLIC_URL = values["public-url"];
|
|
89
|
+
if (values.relay) process.env.KITELINE_RELAY ||= "on";
|
|
86
90
|
startedFromCli();
|
|
87
91
|
const [command, action, ...rest] = positionals;
|
|
88
92
|
if (rest.length) fail(`"${rest.join(" ")}" isn't something Kiteline takes. Run ${bold("kiteline --help")}.`);
|
|
@@ -90,15 +94,15 @@ switch (command) {
|
|
|
90
94
|
case void 0:
|
|
91
95
|
case "start":
|
|
92
96
|
if (action) fail(`"${action}" isn't something Kiteline takes. Run ${bold("kiteline --help")}.`);
|
|
93
|
-
await import("./src-
|
|
97
|
+
await import("./src-DSH8d4ZM.mjs");
|
|
94
98
|
break;
|
|
95
99
|
case "pair": {
|
|
96
|
-
const { showPairing } = await import("./show-pairing-
|
|
100
|
+
const { showPairing } = await import("./show-pairing-Zurbk9wK.mjs");
|
|
97
101
|
await showPairing();
|
|
98
102
|
break;
|
|
99
103
|
}
|
|
100
104
|
case "service": {
|
|
101
|
-
const { service } = await import("./service-
|
|
105
|
+
const { service } = await import("./service-BCgNAv2Z.mjs");
|
|
102
106
|
await service(action, { force: values.force === true });
|
|
103
107
|
break;
|
|
104
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as kitelineHome } from "./auth-YhkfTv6K.mjs";
|
|
2
|
-
import { f as readSettings, i as dim, l as SettingsError, n as bold, t as accent } from "./banner-
|
|
3
|
-
import { t as showPairing } from "./show-pairing-
|
|
2
|
+
import { f as readSettings, i as dim, l as SettingsError, n as bold, t as accent } from "./banner-CXnDgf5p.mjs";
|
|
3
|
+
import { t as showPairing } from "./show-pairing-CTd0UfS1.mjs";
|
|
4
4
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir, userInfo } from "node:os";
|
|
6
6
|
import { delimiter, dirname, join } from "node:path";
|
|
@@ -17,6 +17,7 @@ const KEPT = [
|
|
|
17
17
|
"PORT",
|
|
18
18
|
"HOST",
|
|
19
19
|
"KITELINE_PUBLIC_URL",
|
|
20
|
+
"KITELINE_RELAY",
|
|
20
21
|
"KITELINE_HOME",
|
|
21
22
|
"CLAUDE_PATH",
|
|
22
23
|
"KITELINE_ALLOW_BYPASS",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as renderSVG, d as loadOwnEnvFile, o as printBanner, u as command } from "./banner-CXnDgf5p.mjs";
|
|
2
2
|
import { i as kitelineHome } from "./auth-YhkfTv6K.mjs";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as showPairing } from "./show-pairing-CTd0UfS1.mjs";
|