tring-chat 0.1.17 → 0.1.18
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 +47 -1
- package/dist/tring-hook.js +65 -0
- package/dist/tring.js +670 -36
- package/dist/web/assets/index-DJrdNuH4.js +77 -0
- package/dist/web/assets/{index-0xbypOYs.css → index-Da6ZZKaU.css} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +4 -3
- package/dist/web/assets/index-Ci79Y46u.js +0 -69
package/README.md
CHANGED
|
@@ -261,6 +261,7 @@ streams thumbnails, which is what keeps several projects cheap.
|
|
|
261
261
|
| `Space` | back to the previous session |
|
|
262
262
|
| `c` / `r` / `x` | new session / rename and colour / kill |
|
|
263
263
|
| `m` | mark seen |
|
|
264
|
+
| `o` | orchestrator: every agent's questions in the centre |
|
|
264
265
|
| `Esc` | close the picker |
|
|
265
266
|
|
|
266
267
|
Browsers reserve `Ctrl+1`–`Ctrl+8` for tab switching, so `Shift+digit` is the
|
|
@@ -468,9 +469,54 @@ works in Chrome on Android and Safari on iOS, but not in Firefox, where the butt
|
|
|
468
469
|
is not shown. Unlike paste, it has no fallback on plain http: browsers only give
|
|
469
470
|
the microphone to an https page (or localhost).
|
|
470
471
|
|
|
472
|
+
## Orchestrator
|
|
473
|
+
|
|
474
|
+
With many agents running, finding the one that is waiting means hunting through the
|
|
475
|
+
ring. The **Orchestrator** tab (or `Ctrl+Space`, then `o`) turns the centre into an
|
|
476
|
+
inbox of everything the agents are waiting on, from every session in every project:
|
|
477
|
+
|
|
478
|
+
- **permission prompts** — the command, the file and the edit, or the tool input, with
|
|
479
|
+
Allow, Deny (with an optional reason the agent sees) and *Answer in terminal*
|
|
480
|
+
- **questions** Claude asks with its AskUserQuestion tool — pick an option, or type
|
|
481
|
+
your own answer
|
|
482
|
+
- **finished turns** — the agent's last message and a box to reply in
|
|
483
|
+
|
|
484
|
+
Answer and the card goes; the next one moves up. The ring keeps running around it, and
|
|
485
|
+
*Open* takes you to that session's terminal. On a card, `a` allows, `d` denies, `t`
|
|
486
|
+
hands it back to the terminal, `o` opens it, `1`–`9` picks an option, and `↑`/`↓` move
|
|
487
|
+
between cards.
|
|
488
|
+
|
|
489
|
+
The prompt also stays live in the session's own terminal, and whichever you answer first
|
|
490
|
+
wins — answer it there and the card clears itself.
|
|
491
|
+
|
|
492
|
+
It reads what the agents ask through Claude Code hooks, never by scraping the screen:
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
tring hooks install # or the Install button the inbox shows when they are missing
|
|
496
|
+
tring hooks status
|
|
497
|
+
tring hooks uninstall
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
This adds a `tring-hook` entry per event to `~/.claude/settings.json` (keeping a backup
|
|
501
|
+
beside it, and leaving your own hooks alone). Outside a tring session `tring-hook` exits
|
|
502
|
+
at once and does nothing, so the same settings are safe for every `claude` you run.
|
|
503
|
+
Restart running `claude` sessions to pick the hooks up.
|
|
504
|
+
|
|
505
|
+
**AI approves routine prompts** (a switch in the inbox, off by default) has a small
|
|
506
|
+
Claude model (`claude -p --model haiku`, on your own Claude login) approve the prompts
|
|
507
|
+
that are plainly routine — tests, builds, edits inside the session's directory — so
|
|
508
|
+
only the rest reach you. It can only approve or leave a card for you; it never denies,
|
|
509
|
+
never answers a question and never replies for you. Some things always come to you
|
|
510
|
+
without the model being asked: `rm -r`/`-f`, `sudo`, `git push`/`reset --hard`,
|
|
511
|
+
publishing, deploys, `kubectl`/`terraform`, anything mentioning production, secrets and
|
|
512
|
+
`.env` files, paths outside the session's directory, MCP tools and plan approvals.
|
|
513
|
+
Every decision it makes is listed in the inbox with its reason.
|
|
514
|
+
|
|
471
515
|
## Claude Code
|
|
472
516
|
|
|
473
|
-
|
|
517
|
+
`tring hooks install` (see [Orchestrator](#orchestrator)) includes a Stop hook, so
|
|
518
|
+
a tile turns green the instant Claude ends its turn. To do only that by hand, add a
|
|
519
|
+
`Stop` hook to `~/.claude/settings.json` so a tile turns green the
|
|
474
520
|
instant Claude ends its turn instead of after the idle timeout:
|
|
475
521
|
|
|
476
522
|
```json
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/hook-cli.ts
|
|
4
|
+
import { request as httpRequest } from "node:http";
|
|
5
|
+
import { request as httpsRequest } from "node:https";
|
|
6
|
+
var LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "[::1]"]);
|
|
7
|
+
function readStdin() {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
if (process.stdin.isTTY) return resolve("");
|
|
10
|
+
const chunks = [];
|
|
11
|
+
process.stdin.on("data", (c) => chunks.push(c));
|
|
12
|
+
process.stdin.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
|
|
13
|
+
process.stdin.on("error", () => resolve(""));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function post(url, token, body) {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
const https = url.protocol === "https:";
|
|
19
|
+
const req = (https ? httpsRequest : httpRequest)(url, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: {
|
|
22
|
+
"content-type": "application/json",
|
|
23
|
+
"content-length": Buffer.byteLength(body),
|
|
24
|
+
...token ? { authorization: `Bearer ${token}` } : {}
|
|
25
|
+
},
|
|
26
|
+
// A daemon on this machine with a self-signed --tls-cert is still the
|
|
27
|
+
// daemon that spawned us; anywhere else the certificate must check out.
|
|
28
|
+
...https && LOOPBACK.has(url.hostname) ? { rejectUnauthorized: false } : {}
|
|
29
|
+
}, (res) => {
|
|
30
|
+
const chunks = [];
|
|
31
|
+
res.on("data", (c) => chunks.push(c));
|
|
32
|
+
res.on("end", () => resolve(res.statusCode === 200 ? Buffer.concat(chunks).toString("utf8") : null));
|
|
33
|
+
res.on("error", () => resolve(null));
|
|
34
|
+
});
|
|
35
|
+
req.on("error", () => resolve(null));
|
|
36
|
+
req.end(body);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function main() {
|
|
40
|
+
const event = process.argv[2];
|
|
41
|
+
const id = process.env["TRING_SESSION_ID"];
|
|
42
|
+
const base = process.env["TRING_URL"];
|
|
43
|
+
if (!event || !id || !base) return;
|
|
44
|
+
const raw = await readStdin();
|
|
45
|
+
let payload = {};
|
|
46
|
+
try {
|
|
47
|
+
payload = raw.trim() ? JSON.parse(raw) : {};
|
|
48
|
+
} catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let url;
|
|
52
|
+
try {
|
|
53
|
+
url = new URL(`/api/sessions/${encodeURIComponent(id)}/hook`, base);
|
|
54
|
+
} catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const reply = await post(url, process.env["TRING_TOKEN"], JSON.stringify({ event, payload }));
|
|
58
|
+
if (!reply) return;
|
|
59
|
+
try {
|
|
60
|
+
const { output } = JSON.parse(reply);
|
|
61
|
+
if (output && typeof output === "object") process.stdout.write(JSON.stringify(output) + "\n");
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
main().then(() => process.exit(0), () => process.exit(0));
|