tring-chat 0.1.3 → 0.1.5
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 +38 -0
- package/dist/tring.js +41 -5
- package/dist/web/assets/{index-CcUEKZj5.js → index-Dq7RuNXp.js} +10 -10
- package/dist/web/assets/{index-92UVk_2b.css → index-kfDHfCm1.css} +1 -1
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +12 -3
- package/dist/web/manifest.webmanifest +16 -0
- package/dist/web/sw.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,6 +100,35 @@ npm i -g ./packages/server # install this checkout as `tring`
|
|
|
100
100
|
Flags: `--port` (7331), `--host` (127.0.0.1), `--token`, `--scrollback` (5000),
|
|
101
101
|
`--idle-ms` (3000), `--shell`, `--no-open`, `--no-update-check`, `--version`.
|
|
102
102
|
|
|
103
|
+
## On a phone
|
|
104
|
+
|
|
105
|
+
Below 720px wide tring stops drawing the ring. The focus terminal fills the screen, and a
|
|
106
|
+
bar under the project tabs shows which session you are in. Tap it to get the same picker
|
|
107
|
+
`Ctrl+Space` opens on desktop, as a sheet you can thumb through; the button beside it jumps
|
|
108
|
+
to the next finished session and counts how many are waiting.
|
|
109
|
+
|
|
110
|
+
The daemon only listens on `127.0.0.1` by default. To reach it from a phone, bind it to
|
|
111
|
+
the network and require a token:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
tring --host 0.0.0.0 --token some-long-secret
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
then open `http://<your-machine>:7331/?token=some-long-secret` on the phone. A private
|
|
118
|
+
network such as Tailscale is the safer way to do this than opening the port on a LAN.
|
|
119
|
+
## Install it as an app
|
|
120
|
+
|
|
121
|
+
tring is a progressive web app. Once it is open in a browser, install it and it gets its
|
|
122
|
+
own icon and window with no address bar:
|
|
123
|
+
|
|
124
|
+
- **Android (Chrome):** the browser menu, then *Install app* or *Add to Home screen*.
|
|
125
|
+
- **iPhone and iPad (Safari):** the share button, then *Add to Home Screen*.
|
|
126
|
+
- **Desktop (Chrome, Edge):** the install icon at the right of the address bar.
|
|
127
|
+
|
|
128
|
+
If the daemon runs with `--token`, open it once with `?token=<secret>` on the URL before
|
|
129
|
+
installing. The token is remembered in the browser, so the installed app starts without
|
|
130
|
+
it. Opening a link with a new token replaces the remembered one.
|
|
131
|
+
|
|
103
132
|
## Projects
|
|
104
133
|
|
|
105
134
|
A project is a name and a root directory, and it owns its own 16 slots and its own
|
|
@@ -145,9 +174,18 @@ Browsers reserve `Ctrl+1`–`Ctrl+8` for tab switching, so `Shift+digit` is the
|
|
|
145
174
|
fallback that always works in an ordinary tab. Clicking a thumbnail also focuses it,
|
|
146
175
|
and right-clicking one opens the same dialog `r` does.
|
|
147
176
|
|
|
177
|
+
Those are picker keys. Everything else you type goes to the focused session, with one
|
|
178
|
+
exception: **`Ctrl+Enter` and `Shift+Enter` insert a newline** instead of submitting.
|
|
179
|
+
A terminal has no modifier bits for Enter — every variant is a bare `\r` on the wire —
|
|
180
|
+
so tring sends `ESC`+`CR` for those two chords, which is what Claude Code and other
|
|
181
|
+
agent CLIs read as "break the line". Native terminals need `/terminal-setup` to do the
|
|
182
|
+
same thing; here it works out of the box.
|
|
183
|
+
|
|
148
184
|
## Naming and colouring tiles
|
|
149
185
|
|
|
150
186
|
Right-click a tile — or press `r` in the picker — to give it a name and a colour.
|
|
187
|
+
The same dialog has a **Delete** button, which kills the session and frees the slot
|
|
188
|
+
back to empty; `x` in the picker does the same thing.
|
|
151
189
|
|
|
152
190
|
The colour is a ring *outside* the status border, never instead of it, so a tile you
|
|
153
191
|
have tinted still reports whether it is busy, finished or dead. Twenty-four choices:
|
package/dist/tring.js
CHANGED
|
@@ -732,7 +732,7 @@ var ProjectManager = class _ProjectManager {
|
|
|
732
732
|
|
|
733
733
|
// src/http.ts
|
|
734
734
|
import { createReadStream } from "node:fs";
|
|
735
|
-
import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
|
|
735
|
+
import { mkdir as mkdir2, readdir as readdir2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
|
|
736
736
|
import os3 from "node:os";
|
|
737
737
|
import path3 from "node:path";
|
|
738
738
|
|
|
@@ -948,7 +948,9 @@ var MIME = {
|
|
|
948
948
|
".woff2": "font/woff2",
|
|
949
949
|
".woff": "font/woff",
|
|
950
950
|
".png": "image/png",
|
|
951
|
-
".ico": "image/x-icon"
|
|
951
|
+
".ico": "image/x-icon",
|
|
952
|
+
// Browsers refuse to install a PWA whose manifest is served as anything else.
|
|
953
|
+
".webmanifest": "application/manifest+json"
|
|
952
954
|
};
|
|
953
955
|
var json = (res, code, body) => {
|
|
954
956
|
const payload = JSON.stringify(body);
|
|
@@ -963,6 +965,22 @@ var readBody = (req) => new Promise((resolve) => {
|
|
|
963
965
|
});
|
|
964
966
|
req.on("end", () => resolve(data));
|
|
965
967
|
});
|
|
968
|
+
var DROP_MAX = 25e6;
|
|
969
|
+
var readRaw = (req, cap) => new Promise((resolve, reject) => {
|
|
970
|
+
const parts = [];
|
|
971
|
+
let size = 0;
|
|
972
|
+
req.on("data", (c) => {
|
|
973
|
+
size += c.length;
|
|
974
|
+
if (size > cap) {
|
|
975
|
+
req.destroy();
|
|
976
|
+
reject(new Error("too large"));
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
parts.push(c);
|
|
980
|
+
});
|
|
981
|
+
req.on("end", () => resolve(Buffer.concat(parts)));
|
|
982
|
+
req.on("error", reject);
|
|
983
|
+
});
|
|
966
984
|
var USAGE_CACHE_MS = 3e4;
|
|
967
985
|
function createHandler(opts) {
|
|
968
986
|
const { pm, webRoot, token } = opts;
|
|
@@ -1024,6 +1042,24 @@ function createHandler(opts) {
|
|
|
1024
1042
|
return json(res, 500, { error: "cannot read Claude Code transcripts" });
|
|
1025
1043
|
}
|
|
1026
1044
|
}
|
|
1045
|
+
if (url.pathname === "/api/drop" && req.method === "POST") {
|
|
1046
|
+
const safe = (url.searchParams.get("name") ?? "").replace(/[^\w.-]+/g, "_").slice(0, 80);
|
|
1047
|
+
const dir = path3.join(os3.tmpdir(), "tring-drops");
|
|
1048
|
+
if (Number(req.headers["content-length"] ?? 0) > DROP_MAX) {
|
|
1049
|
+
json(res, 413, { error: `file is bigger than ${DROP_MAX / 1e6}MB` });
|
|
1050
|
+
req.resume();
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
try {
|
|
1054
|
+
const bytes = await readRaw(req, DROP_MAX);
|
|
1055
|
+
await mkdir2(dir, { recursive: true });
|
|
1056
|
+
const file = path3.join(dir, `${Date.now().toString(36)}-${safe || "file"}`);
|
|
1057
|
+
await writeFile2(file, bytes);
|
|
1058
|
+
return json(res, 200, { path: file });
|
|
1059
|
+
} catch {
|
|
1060
|
+
return json(res, 413, { error: `file is bigger than ${DROP_MAX / 1e6}MB` });
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1027
1063
|
if (url.pathname === "/api/sessions" && req.method === "GET") {
|
|
1028
1064
|
const sessions = pm.list().flatMap(
|
|
1029
1065
|
(p) => p.sessions.map((s) => ({ ...s, project: p.name }))
|
|
@@ -1335,7 +1371,7 @@ function describeFallback(url) {
|
|
|
1335
1371
|
|
|
1336
1372
|
// src/update-check.ts
|
|
1337
1373
|
import { createRequire as createRequire2 } from "node:module";
|
|
1338
|
-
import { mkdir as
|
|
1374
|
+
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
1339
1375
|
import path4 from "node:path";
|
|
1340
1376
|
var require3 = createRequire2(import.meta.url);
|
|
1341
1377
|
function currentVersion() {
|
|
@@ -1381,8 +1417,8 @@ async function checkForUpdate(cachePath) {
|
|
|
1381
1417
|
return null;
|
|
1382
1418
|
}
|
|
1383
1419
|
try {
|
|
1384
|
-
await
|
|
1385
|
-
await
|
|
1420
|
+
await mkdir3(path4.dirname(cachePath), { recursive: true });
|
|
1421
|
+
await writeFile3(cachePath, JSON.stringify({ checkedAt: Date.now(), latest }), "utf8");
|
|
1386
1422
|
} catch {
|
|
1387
1423
|
}
|
|
1388
1424
|
return isNewer(latest, current) ? latest : null;
|