pi-reply-reader 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/CHANGELOG.md +143 -0
- package/README.md +402 -39
- package/dist/src/cli.js +137 -10
- package/dist/src/listener.js +532 -0
- package/dist/src/music.js +452 -0
- package/dist/src/outputs.js +29 -4
- package/dist/src/playback.js +170 -46
- package/dist/src/player.js +265 -0
- package/dist/src/project.js +50 -0
- package/dist/src/reading-lock.js +296 -68
- package/dist/src/settings.js +32 -3
- package/dist/src/speech-text.js +581 -64
- package/examples/reply-reader-desktop-audio.service +23 -10
- package/examples/reply-reader-vps-audio.service +57 -0
- package/extensions/reply-reader.ts +920 -106
- package/package.json +3 -2
- package/src/auto-queue.ts +123 -0
- package/src/cli.ts +131 -10
- package/src/listener.ts +522 -0
- package/src/music.ts +474 -0
- package/src/outputs.ts +37 -5
- package/src/pause-key.ts +105 -0
- package/src/playback.ts +179 -48
- package/src/player.ts +255 -0
- package/src/project.ts +46 -0
- package/src/prompts.ts +142 -0
- package/src/reading-lock.ts +364 -66
- package/src/settings.ts +34 -3
- package/src/speech-text.ts +692 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 — 2026-11-20
|
|
4
|
+
|
|
5
|
+
- The SSH audio tunnel example now ends in a private Unix socket (`unix:/run/user/<uid>/reply-reader-pulse.sock`,
|
|
6
|
+
mode 0600) instead of the loopback port `127.0.0.1:4714`, which every local process and host-network container
|
|
7
|
+
could reach, with the desktop's microphone behind it. New `examples/reply-reader-vps-audio.service` for a cloud
|
|
8
|
+
VPS that cannot reach the desktop: the desktop opens a reverse tunnel. Existing `tcp:` outputs keep working.
|
|
9
|
+
- Music steps aside while the reader speaks: by default, music played by gentle-stream goes down to volume 20
|
|
10
|
+
(of gentle-stream's 0-100) and its volume comes back after. `/read-music off|pause|duck [level]` chooses (saved in `settings.json` as
|
|
11
|
+
`"music": { "mode": "duck", "level": 20 }`; no argument shows it). Pause mode plays the music again only if it
|
|
12
|
+
was playing before. Once per machine: the holder of the reading turn steps it aside when the machine starts
|
|
13
|
+
reading and restores it when nothing reads or waits, so queued readings do not flap; a pause restores it and a
|
|
14
|
+
resume steps it aside again. The prior state is kept in `$XDG_RUNTIME_DIR/pi-reply-reader/music.json`, so a
|
|
15
|
+
session start restores music a dead reader left aside; a volume you changed meanwhile stays. On a listener
|
|
16
|
+
output, `reply-reader --serve` does it on the listener. Generic `before`/`after` hooks (`sh -c`, as you) run at
|
|
17
|
+
the same moments. Every command runs in the background with a 3 s timeout and never delays speech; without
|
|
18
|
+
gentle-stream or with nothing playing, nothing happens and nothing is said. A new `/read` in the session already reading keeps the music
|
|
19
|
+
aside; a listener reading that fell back to local playback steps it aside again on resume; a broken, empty or
|
|
20
|
+
out-of-range `music.json` counts as no state and is replaced, never passed to gentle-stream.
|
|
21
|
+
|
|
22
|
+
- Auto-read shows it is on: while `/read-auto` is on, the footer says `Auto-read on · desktop` or
|
|
23
|
+
`Auto-read questions · desktop` (just `Auto-read on` before an output is chosen), also with nothing playing,
|
|
24
|
+
and `Auto-read on · Reading P12.R1 on desktop · Alt+M pauses` while the session reads. With it off the footer
|
|
25
|
+
is unchanged.
|
|
26
|
+
- Auto-read and the output are remembered: the last `/read-auto` choice (on, questions, off; the toggle
|
|
27
|
+
included) and the last output (`/read-output`, or the pick at the first reading's question) are saved in
|
|
28
|
+
`settings.json` (`autoRead`, `output`, keeping the other keys) and every new Pi session starts with them.
|
|
29
|
+
Nothing saved starts as before (off, the output asked). A saved output gone from `outputs.json` warns
|
|
30
|
+
`Saved output "desktop" is not in …/outputs.json; choose one.` and the first reading asks. A saved "on"
|
|
31
|
+
never reads the replies already in the session.
|
|
32
|
+
|
|
33
|
+
- Synthesis on the listener: an output in `outputs.json` can be `{ "ssh": "you@host", "fallback": "<PULSE_SERVER>" }`.
|
|
34
|
+
The agent host sends each reading's fragments over SSH to `reply-reader --serve` on the listener, which
|
|
35
|
+
synthesizes and plays them, so a slow agent host no longer delays readings. Pause/resume, `/read-stop`, the
|
|
36
|
+
line, announcements and the player timeout behave as for any output. When the listener does not answer,
|
|
37
|
+
lacks `reply-reader`, its voice or `paplay`, or fails mid-reading, the reading goes on from the sentence last
|
|
38
|
+
heard on the agent host through `fallback`, with one warning per session; without a fallback it fails with
|
|
39
|
+
`Playback on "<output>" failed: <reason>`. The listener waits while it reads something of its own; a
|
|
40
|
+
`/read-stop` or `/read` there drops the agent host's reading still waiting, which ends quietly. Long
|
|
41
|
+
readings (over 5000 sentences or 1 MiB) are sent in several messages and stay on the listener. Bad `ssh`
|
|
42
|
+
values (empty, a leading `-`, whitespace, control characters) and unknown keys are reported and the entry
|
|
43
|
+
skipped. Text from the listener or `ssh` is shown without control characters. `--serve` ends quietly when
|
|
44
|
+
the agent host goes away, and a reading on the listener never ends a running `--serve` as an orphan.
|
|
45
|
+
- `reply-reader --download-voice` downloads the voice (asking `[y/N]` on a terminal) and exits; a listener
|
|
46
|
+
without its voice names it in the warning.
|
|
47
|
+
|
|
48
|
+
- Readings say their project when it changes: a reading whose project (the folder name of its Git root, or of
|
|
49
|
+
its working folder outside a repository) differs from the last reading's on the machine, or the first one,
|
|
50
|
+
starts with the project's name, then its announcement if it waited ("pi-reply-reader. Respuesta P tres, R
|
|
51
|
+
dos."). Readings of the same project say none. Every Pi session and the `reply-reader` command share the
|
|
52
|
+
memory under `$XDG_RUNTIME_DIR/pi-reply-reader/`; resuming does not repeat it.
|
|
53
|
+
- `pauseKey` refuses `ctrl` with a digit and any `super` key (one warning, Alt+M is used): terminals without
|
|
54
|
+
the Kitty keyboard protocol never send them, so they silently never fired.
|
|
55
|
+
- Esc is Pi's again: the reader never takes it. Esc interrupts the agent and closes dialogs and screens
|
|
56
|
+
(pi-reply-thread's Alt+R view, `ask_user_question`) even while a reading plays or is paused. Before, a reading
|
|
57
|
+
took every Esc and paused or resumed instead, so a view could not be closed and the agent could not be
|
|
58
|
+
interrupted. Readings stop with Esc no longer: Alt+M pauses and resumes them. Set `"pauseKey"` in
|
|
59
|
+
`settings.json` (as `"alt+o"`) to use another key. A key that is not valid or that Pi, gentle-pi,
|
|
60
|
+
pi-reply-thread or the terminal already uses gets one warning, and Alt+M is used instead.
|
|
61
|
+
- Pause and resume: `/read-pause` pauses the reading playing, in this or any other Pi session on the machine
|
|
62
|
+
(`Reading paused.`), and run again resumes it (`Reading resumed.`); with nothing playing it says `Nothing is
|
|
63
|
+
being read.`. The pause key, Alt+M, does the same with the same messages (`pauseKey` in settings.json picks
|
|
64
|
+
another one). Pausing drops nothing that waits. A paused reading's player is ended (so the player timeout never fires on it) but it keeps
|
|
65
|
+
its turn on the machine: nothing waiting starts. Resuming starts again from the sentence, item or row that was
|
|
66
|
+
being heard, with the same voice and speed. The footer reads `Reading P12.R1 on local · Alt+M pauses`, and
|
|
67
|
+
while paused `Paused P12.R1 · Alt+M resumes · /read-stop ends`. `/read-stop` ends a reading, playing or paused,
|
|
68
|
+
and drops what waits, as before. A prompt's reading is ended instead of paused (`Reading stopped: a prompt is
|
|
69
|
+
not paused.`); a `reply-reader` command reading cannot be paused from Pi.
|
|
70
|
+
- See and skip the line: `/read-queue` lists the readings waiting on the machine, in order, with their session
|
|
71
|
+
(`Waiting on this machine:` / `1. P12.R2 · api (this session)`), or says `Nothing waits to be read.`;
|
|
72
|
+
`/read-next` ends the reading, playing or paused, here or in another session, and the next one waiting starts
|
|
73
|
+
with its announcement (`Skipped to the next reading.`; `Reading stopped; nothing else waits.` when nothing
|
|
74
|
+
does). Each session publishes its line under `$XDG_RUNTIME_DIR/pi-reply-reader/`, and the footer's
|
|
75
|
+
`· N waiting ·` now counts every session's; without a usable `XDG_RUNTIME_DIR` both stay per session.
|
|
76
|
+
Readings play in the listed order: a session with readings waiting refreshes its line every 250 ms, and a
|
|
77
|
+
session whose next reading has an earlier one of another session before it yields to it while that
|
|
78
|
+
session's line is under 2 s old (10 s at most per reading, counting only time the machine is free, never
|
|
79
|
+
time another reading plays), so a frozen session holds the others about 2 s. A session waiting for you (the
|
|
80
|
+
output question, the voice download confirm) says so in its line and is not waited for, and a session that
|
|
81
|
+
ends or drops its line stops beating at once, even mid-start. Two sessions with the
|
|
82
|
+
same label are listed with a tag from their session ID (`api #3f9c`).
|
|
83
|
+
- Auto-read also reads the prompts that wait for you, through the same line: an `ask_user_question` /
|
|
84
|
+
`ask_user_choice` call reads the text written before it in the same message (cleaned like a reply, on its own; not in
|
|
85
|
+
`questions` mode), then each
|
|
86
|
+
question with its option labels only ("Pregunta 1 de 2: ¿Cómo suena? Opciones: uno, Bien; dos, Mal."); text
|
|
87
|
+
before other tool calls is not read; a command confirmation reads only the program ("Confirmación de comando:
|
|
88
|
+
git." / "Command confirmation: git."), and any other dialog its title. Once answered, a prompt's reading is
|
|
89
|
+
dropped, or stopped if it plays, as a whole. The reader's own questions are not read.
|
|
90
|
+
- Auto-read reads every new reply, each once and in order, as soon as it is written, even while the agent keeps
|
|
91
|
+
working. Before, only the last reply of a run was read: a reply followed by a background-job or subagent
|
|
92
|
+
notice that started another turn was skipped.
|
|
93
|
+
- Between queued readings (auto-reads and **Read after it**): about 1.5 s of silence, then the next reading
|
|
94
|
+
says which it is, in its language (`Respuesta P12.R2.` / `Reply P12.R2.`, `Archivo notas.md.` / `File
|
|
95
|
+
notes.md.`). A reading with nothing before it starts as before. While readings wait, the footer counts them:
|
|
96
|
+
`Reading P12.R2 on local · 2 waiting · Alt+M pauses`.
|
|
97
|
+
- A player that hangs no longer piles up: when `paplay` takes no audio for 15 s (say, a Pulse server behind an
|
|
98
|
+
SSH tunnel whose far side does not answer), or does not finish within the audio's length plus 15 s, the
|
|
99
|
+
reading fails with `Playback on "<output>" failed: timed out`. `REPLY_READER_PLAYER_TIMEOUT` sets the 15 s
|
|
100
|
+
(5 to 86400 seconds; any other value warns once and uses 15). Every stop sends SIGTERM, then SIGKILL 2 s
|
|
101
|
+
later if the player is still there, also from `reply-reader` before it exits. Players left by a Pi that
|
|
102
|
+
died are ended when a Pi session or a reading starts, and with `setpriv` installed a player dies with its
|
|
103
|
+
reader even when that is killed outright. Only this package's own players, in the same PID namespace, are
|
|
104
|
+
touched.
|
|
105
|
+
- Numbers are spoken as words in the text's language (Supertonic mispronounced digits): "51" "cincuenta y
|
|
106
|
+
uno", with Spanish "un"/"una" agreement by the next word, decimals, versions and IP addresses group by group,
|
|
107
|
+
and numbers over 9 digits or starting with 0 digit by digit.
|
|
108
|
+
- More readings: Spanish hundreds agree with a feminine noun (`400 líneas` "cuatrocientas líneas", `200.000
|
|
109
|
+
líneas` "doscientas mil líneas"); times read like a clock (`21:02` "veintiuno cero dos", `07:00` "siete en
|
|
110
|
+
punto"); dates with a year read in full (`2026-10-27` and `27/10/2026` "veintisiete de octubre de dos mil
|
|
111
|
+
veintiséis", "October twenty seven, two thousand twenty six"); globs (`*.hs.lan` "cualquier hs punto lan",
|
|
112
|
+
`bin/*` "todo lo de bin", `lab-*` "lab algo"; `**negrita**` and `*x*`, only letters inside `*` or `**`, are
|
|
113
|
+
not globs and read only the letters: "negrita"); tags, HTML or not: a pair reads its name and content (`<command>ls -la</command>` "command:
|
|
114
|
+
ls -la"), a lone `<archivo>` or `<iframe>` only its name ("archivo", "iframe"), a lone `</a>` or `<br/>`
|
|
115
|
+
"la etiqueta a" ("the a tag"); `<< text >>` reads like quotes, only the text. Diagnostics no longer report
|
|
116
|
+
globs and tags.
|
|
117
|
+
- Internal: the cleanup now builds a narration plan (blocks with a role: heading, paragraph, item, row, code
|
|
118
|
+
block) and renders it in the reading's language; playback speaks the rendered fragments with each one's own
|
|
119
|
+
pause instead of splitting the text again. `speechNarration(markdown, language?)` returns the text, the
|
|
120
|
+
fragments and diagnostics: technical tokens no reading rule claimed, with their line. What is spoken and
|
|
121
|
+
played is byte-identical to 0.1.0.
|
|
122
|
+
- New readings: a bare folder (`src/` "la carpeta src") and a path ending in a dot file
|
|
123
|
+
(`ckan-docker/.prettierrc.json` "prettierrc punto json, en ckan docker"), issue and PR numbers (`#43`
|
|
124
|
+
"número 43"), key combinations (`Ctrl+Shift+P` "Control más Shift más P") and minimum versions (`v1+` "v1 o
|
|
125
|
+
superior", `1.4+` "1 punto 4 o superior"), with "number", "plus" and "or later" in English. Diagnostics no
|
|
126
|
+
longer report these tokens.
|
|
127
|
+
- Counts such as `100+` read "100 o más" ("100 or more"); a dot file with no extension inside a path reads as
|
|
128
|
+
a file: `ckan-docker/.gitignore` "gitignore, en ckan docker".
|
|
129
|
+
- `npm run build` removes `dist/` before compiling, so a packed tarball never carries stale files.
|
|
130
|
+
- Auto-read no longer interrupts: a reply due while a reading plays, in this or any other session on the
|
|
131
|
+
machine, waits and is read once nothing plays, one session's replies in order. A manual `/read` (or a read
|
|
132
|
+
request from another extension) and `/read-stop` stop the reading playing and drop every auto-read
|
|
133
|
+
waiting on the machine; `/read-auto off` and the session's end drop that session's. Sessions coordinate
|
|
134
|
+
through `$XDG_RUNTIME_DIR/pi-reply-reader/` as before (`waiting.json` and a short `reading.lock` mutex);
|
|
135
|
+
without it a reply only waits for its own session.
|
|
136
|
+
- A manual `/read` or a read request (pi-reply-thread's Alt+R `s`) while something is being read anywhere on
|
|
137
|
+
the machine asks first: `Something is being read.` with **Stop it and read now** (as before: stop, drop the
|
|
138
|
+
waiting auto-reads, read) and **Read after it** (it waits like an auto-read, after the session's waiting
|
|
139
|
+
replies; `/read-stop` and another manual reading drop it, `/read-auto off` keeps it). Dismissing the
|
|
140
|
+
question changes nothing. In Pi's TUI the question is a small overlay of its own, so it shows above the Alt+R
|
|
141
|
+
view; elsewhere it uses the host's selector. With nothing playing, or without a UI, it reads at once as
|
|
142
|
+
before. `/read-stop` and the pause key never ask.
|
|
143
|
+
- The `reply-reader` command now drops the auto-reads waiting in Pi sessions when it starts reading, as a
|
|
144
|
+
manual `/read` does; it never asks.
|
|
145
|
+
|
|
3
146
|
## 0.1.0 — 2026-11-17
|
|
4
147
|
|
|
5
148
|
First release.
|