tring-chat 0.1.7 → 0.1.9

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
@@ -50,6 +50,21 @@ sudo dnf install -y gcc-c++ make python3 # Fedora/RHEL
50
50
  Without those, `npm i -g tring-chat` fails while building node-pty. It takes a few seconds
51
51
  once they are present.
52
52
 
53
+ **macOS needs no compiler, but node-pty's prebuilds carry one defect.** It
54
+ publishes `prebuilds/darwin-*/spawn-helper` without the execute bit
55
+ ([node-pty#850](https://github.com/microsoft/node-pty/issues/850)), and every
56
+ PTY on macOS is forked through that binary — so an untreated install answers
57
+ the first tile with `posix_spawnp failed` and starts no shell. tring puts the
58
+ bit back, at install time and again before the first spawn, so this should
59
+ never be visible. If you installed with `--ignore-scripts` into a prefix you
60
+ do not own, the one-liner is:
61
+
62
+ ```
63
+ sudo chmod +x "$(npm root -g)/tring-chat/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper"
64
+ ```
65
+
66
+ All of this goes away when node-pty publishes a stable release carrying the fix.
67
+
53
68
  `tring` starts the daemon and opens a chromeless browser window — no address bar, no
54
69
  tab strip, its own taskbar entry. In that window the browser stops reserving
55
70
  `Ctrl+1`–`Ctrl+8` for tab switching, so slots 11–16 get their natural keys.
@@ -392,6 +407,25 @@ Two things are deliberate:
392
407
  Auto-executing whatever was there last time is how four dev servers end up fighting
393
408
  over a port.
394
409
 
410
+ ## Dropping images on a terminal
411
+
412
+ Drag a screenshot onto the centre terminal and its path is typed into the prompt,
413
+ the way dropping a file on any other terminal types one. Claude Code reads the
414
+ path from there.
415
+
416
+ It cannot work the way a native terminal's does. A browser hands a dropped file
417
+ over as bytes and withholds its location by design, and that location would be
418
+ the wrong machine's anyway whenever you have the deck open on a phone or a laptop
419
+ across the room. So the bytes go to the daemon, which writes them down on the
420
+ machine the shell is actually running on and answers with the path it chose.
421
+
422
+ - PNG, JPEG, GIF and WebP, up to 10MB. The type is read from the file's first
423
+ bytes, not from what the browser called it.
424
+ - The daemon names every file itself, under `~/.config/tring/uploads`. Nothing
425
+ a client sends reaches a filesystem path.
426
+ - The last 20 are kept. The directory is emptied when the daemon stops.
427
+ - The upload goes through the same token as the rest of the API.
428
+
395
429
  ## Claude Code
396
430
 
397
431
  Optional. Add a `Stop` hook to `~/.claude/settings.json` so a tile turns green the
@@ -0,0 +1,55 @@
1
+ // src/spawn-helper.ts
2
+ import {
3
+ closeSync,
4
+ constants,
5
+ fchmodSync,
6
+ fstatSync,
7
+ openSync,
8
+ readdirSync
9
+ } from "node:fs";
10
+ import { createRequire } from "node:module";
11
+ import path from "node:path";
12
+ var EXEC = 73;
13
+ function nodePtyRoot() {
14
+ try {
15
+ return path.dirname(createRequire(import.meta.url).resolve("node-pty/package.json"));
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+ function spawnHelperPaths(root) {
21
+ const found = [path.join(root, "build", "Release", "spawn-helper")];
22
+ let prebuilds;
23
+ try {
24
+ prebuilds = readdirSync(path.join(root, "prebuilds"), { withFileTypes: true });
25
+ } catch {
26
+ return found;
27
+ }
28
+ for (const entry of prebuilds) {
29
+ if (entry.isDirectory()) found.push(path.join(root, "prebuilds", entry.name, "spawn-helper"));
30
+ }
31
+ return found;
32
+ }
33
+ function fixSpawnHelper(root = nodePtyRoot()) {
34
+ if (process.platform === "win32" || root === null) return [];
35
+ const fixed = [];
36
+ for (const file of spawnHelperPaths(root)) {
37
+ let fd = null;
38
+ try {
39
+ fd = openSync(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
40
+ const info = fstatSync(fd);
41
+ if (!info.isFile()) continue;
42
+ const mode = info.mode & 511;
43
+ if (mode & EXEC) continue;
44
+ fchmodSync(fd, mode | EXEC);
45
+ fixed.push(file);
46
+ } catch {
47
+ } finally {
48
+ if (fd !== null) closeSync(fd);
49
+ }
50
+ }
51
+ return fixed;
52
+ }
53
+
54
+ // <stdin>
55
+ for (const file of fixSpawnHelper()) console.log(`tring: made ${file} executable`);