tring-chat 0.1.4 → 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
CHANGED
|
@@ -174,9 +174,18 @@ Browsers reserve `Ctrl+1`–`Ctrl+8` for tab switching, so `Shift+digit` is the
|
|
|
174
174
|
fallback that always works in an ordinary tab. Clicking a thumbnail also focuses it,
|
|
175
175
|
and right-clicking one opens the same dialog `r` does.
|
|
176
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
|
+
|
|
177
184
|
## Naming and colouring tiles
|
|
178
185
|
|
|
179
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.
|
|
180
189
|
|
|
181
190
|
The colour is a ring *outside* the status border, never instead of it, so a tile you
|
|
182
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
|
|
|
@@ -965,6 +965,22 @@ var readBody = (req) => new Promise((resolve) => {
|
|
|
965
965
|
});
|
|
966
966
|
req.on("end", () => resolve(data));
|
|
967
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
|
+
});
|
|
968
984
|
var USAGE_CACHE_MS = 3e4;
|
|
969
985
|
function createHandler(opts) {
|
|
970
986
|
const { pm, webRoot, token } = opts;
|
|
@@ -1026,6 +1042,24 @@ function createHandler(opts) {
|
|
|
1026
1042
|
return json(res, 500, { error: "cannot read Claude Code transcripts" });
|
|
1027
1043
|
}
|
|
1028
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
|
+
}
|
|
1029
1063
|
if (url.pathname === "/api/sessions" && req.method === "GET") {
|
|
1030
1064
|
const sessions = pm.list().flatMap(
|
|
1031
1065
|
(p) => p.sessions.map((s) => ({ ...s, project: p.name }))
|
|
@@ -1337,7 +1371,7 @@ function describeFallback(url) {
|
|
|
1337
1371
|
|
|
1338
1372
|
// src/update-check.ts
|
|
1339
1373
|
import { createRequire as createRequire2 } from "node:module";
|
|
1340
|
-
import { mkdir as
|
|
1374
|
+
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
1341
1375
|
import path4 from "node:path";
|
|
1342
1376
|
var require3 = createRequire2(import.meta.url);
|
|
1343
1377
|
function currentVersion() {
|
|
@@ -1383,8 +1417,8 @@ async function checkForUpdate(cachePath) {
|
|
|
1383
1417
|
return null;
|
|
1384
1418
|
}
|
|
1385
1419
|
try {
|
|
1386
|
-
await
|
|
1387
|
-
await
|
|
1420
|
+
await mkdir3(path4.dirname(cachePath), { recursive: true });
|
|
1421
|
+
await writeFile3(cachePath, JSON.stringify({ checkedAt: Date.now(), latest }), "utf8");
|
|
1388
1422
|
} catch {
|
|
1389
1423
|
}
|
|
1390
1424
|
return isNewer(latest, current) ? latest : null;
|