dsh-tg-bridge 1.33.3 → 1.34.1
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 +11 -8
- package/control/cmd-bridge.mjs +23 -15
- package/control/cmd-model.mjs +1 -0
- package/control/cmd-skills.mjs +12 -2
- package/control/model-card.mjs +7 -1
- package/docs/CHANGELOG.md +1909 -0
- package/docs/COST.md +118 -0
- package/docs/HERMES-PARITY.md +68 -0
- package/docs/MARKETPLACE.md +92 -0
- package/docs/RELEASE-CRITERIA.md +27 -0
- package/docs/ROADMAP.md +50 -0
- package/docs/TELEGRAM-SETUP.md +99 -0
- package/docs/UX-ANALYSIS.md +62 -0
- package/docs/VOICE.md +107 -0
- package/fallback.mjs +13 -2
- package/handle-message.mjs +6 -6
- package/i18n/en/core.mjs +5 -2
- package/i18n/en/ctrl.mjs +2 -0
- package/i18n/ru/core.mjs +5 -2
- package/i18n/ru/ctrl.mjs +2 -0
- package/i18n/zh/core.mjs +5 -2
- package/i18n/zh/ctrl.mjs +2 -0
- package/media.mjs +161 -22
- package/package.json +3 -5
- package/settings-card.mjs +13 -0
- package/thoughts.mjs +6 -1
- package/turn-events.mjs +20 -0
package/README.md
CHANGED
|
@@ -30,9 +30,10 @@ that answers, one step at a time.
|
|
|
30
30
|
[model,model]` writes the provider without an AI turn, and the key itself is
|
|
31
31
|
never typed — only the name of the variable that holds it. The new models appear
|
|
32
32
|
on `/model` as routes.
|
|
33
|
-
- **Input: text, voice, photos.**
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
- **Input: text, voice, photos.** Any speech engine plugs in — a local script, any
|
|
34
|
+
command-line tool, or an OpenAI-compatible API (see [`docs/VOICE.md`](docs/VOICE.md))
|
|
35
|
+
— and the transcript is shown before the answer. A photo is read by the turn's own
|
|
36
|
+
model through `read_image`, text and UI included; no second model is needed.
|
|
36
37
|
- **Goal and checklist per topic.** `/goal`, `/tasks`; both survive restarts and
|
|
37
38
|
are prepended to every turn.
|
|
38
39
|
- **Two scopes for every setting.** `/reasoning <mode> all` moves the default,
|
|
@@ -423,16 +424,18 @@ What each kind of attachment becomes inside a running turn:
|
|
|
423
424
|
|
|
424
425
|
| Sent | Inside the turn | Needs |
|
|
425
426
|
|---|---|---|
|
|
426
|
-
| voice note, audio file, audio sent as a document | transcript, echoed as `🎤 …` before the steer | `
|
|
427
|
+
| voice note, audio file, audio sent as a document | transcript, echoed as `🎤 …` before the steer | any engine you point `voice` at: `script`, `command` or an OpenAI-compatible `openai` endpoint; **off by default** |
|
|
427
428
|
| small text file (`.md`, `.json`, `.csv`, `.py`, `.log`, … up to 60 KB) | the content itself between `<file>` markers — no tool call needed | nothing |
|
|
428
429
|
| PDF, archive, binary, anything bigger | its local path under `~/.dsh/tg-bridge/inbox/` | nothing; the agent opens it with its own tools |
|
|
429
430
|
| video, video note, animation | its path; the agent can pull frames or sound out with ffmpeg | ffmpeg, only if frames or audio are needed |
|
|
430
431
|
| photo | its path plus one honest line; the turn reads it with `read_image`, and says so in one line if it cannot | a model that accepts images |
|
|
431
432
|
|
|
432
|
-
Voice is the one row with a hidden prerequisite
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
`
|
|
433
|
+
Voice is the one row with a hidden prerequisite: something has to turn audio into
|
|
434
|
+
text. Faster-whisper is what `init --voice` writes, but it is not the only answer —
|
|
435
|
+
`voice.provider` also takes `command` (whisper.cpp, Vosk, a wrapper of your own) or
|
|
436
|
+
`openai` (OpenAI, Groq, a local server; anything that speaks
|
|
437
|
+
`/audio/transcriptions`). With no backend configured, a voice note is not swallowed:
|
|
438
|
+
the bridge says what is missing and points at [`docs/VOICE.md`](docs/VOICE.md).
|
|
436
439
|
|
|
437
440
|
A caption does not turn the attachment into a text-only message: it is folded into the same
|
|
438
441
|
hand-over, so "why did this fail" plus a `.log` file arrives as one steer.
|
package/control/cmd-bridge.mjs
CHANGED
|
@@ -149,22 +149,30 @@ export async function handleBridgeCommands(ctx) {
|
|
|
149
149
|
return true;
|
|
150
150
|
}
|
|
151
151
|
say(t(lang, 'ctrl.app.restarting', { pids: before.join(', '), exe: EXE }));
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
spawn(EXE, [], { detached: true, stdio: 'ignore', windowsHide: false }).unref();
|
|
163
|
-
const up = await waitForStart(15000);
|
|
164
|
-
say(up.length
|
|
165
|
-
? t(lang, 'ctrl.app.restarted', { pids: up.join(', ') })
|
|
166
|
-
: t(lang, 'ctrl.app.notUp'));
|
|
152
|
+
// Kill the processes that were just named, one by one. An image-name kill
|
|
153
|
+
// takes down every program with that name — a second DSH opened for another
|
|
154
|
+
// profile, or an instance started after this list was read — and the message
|
|
155
|
+
// above promised the pids it lists, not every window on the machine.
|
|
156
|
+
const kill = (pid) => new Promise((resolve) => {
|
|
157
|
+
spawn('taskkill', ['/PID', String(pid), '/T', '/F'], { windowsHide: true, detached: true })
|
|
158
|
+
.on('close', resolve)
|
|
159
|
+
.on('error', resolve);
|
|
167
160
|
});
|
|
161
|
+
await Promise.all(before.map(kill));
|
|
162
|
+
const gone = await waitForExit(before, 12000);
|
|
163
|
+
if (!gone) {
|
|
164
|
+
say(t(lang, 'ctrl.app.stuck'));
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
if (!existsSync(EXE)) {
|
|
168
|
+
say(t(lang, 'ctrl.app.noExe', { exe: EXE }));
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
spawn(EXE, [], { detached: true, stdio: 'ignore', windowsHide: false }).unref();
|
|
172
|
+
const up = await waitForStart(15000);
|
|
173
|
+
say(up.length
|
|
174
|
+
? t(lang, 'ctrl.app.restarted', { pids: up.join(', ') })
|
|
175
|
+
: t(lang, 'ctrl.app.notUp'));
|
|
168
176
|
return true;
|
|
169
177
|
}
|
|
170
178
|
case '/stop': {
|
package/control/cmd-model.mjs
CHANGED
|
@@ -30,6 +30,7 @@ export async function handleModelCommand(ctx) {
|
|
|
30
30
|
current: routes.length ? { provider: topic.provider, model: topic.model } : null,
|
|
31
31
|
topic: topic.source === 'topic',
|
|
32
32
|
fallback: topic.source === 'topic' ? modelOf(activeProfile) : null,
|
|
33
|
+
answered: state.answered?.[key] || null,
|
|
33
34
|
t: (k, v) => t(lang, k, v),
|
|
34
35
|
});
|
|
35
36
|
say(card.text, { keyboard: card.keyboard });
|
package/control/cmd-skills.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { execFileSync, spawn, spawnSync } from 'node:child_process';
|
|
6
6
|
import { cpSync, existsSync, copyFileSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { homedir, tmpdir } from 'node:os';
|
|
8
|
-
import { join,
|
|
8
|
+
import { basename, isAbsolute, join, relative } from 'node:path';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
10
|
import { t, LANGS, normalizeLang } from '../i18n.mjs';
|
|
11
11
|
import { addTask, clearGoal, doneTask, editTask, finishGoal, goalOf, progressOf, reopenGoal, removeTask, setGoal } from '../goals.mjs';
|
|
@@ -46,7 +46,17 @@ export async function handleSkillCommands(ctx) {
|
|
|
46
46
|
const rows = skillsOf();
|
|
47
47
|
const want = (arg || '').trim();
|
|
48
48
|
if (want) {
|
|
49
|
-
|
|
49
|
+
// A skill is one directory under `skills/`, and the name here is whatever
|
|
50
|
+
// was typed: `join` walks out of the root for `../..`, so the resolved
|
|
51
|
+
// path is checked to still be inside before anything is read. The old
|
|
52
|
+
// code could be pointed at any `SKILL.md` on the disk.
|
|
53
|
+
const root = join(DSH_HOME, 'skills');
|
|
54
|
+
const dir = join(root, want);
|
|
55
|
+
const inside = relative(root, dir);
|
|
56
|
+
if (!inside || inside.startsWith('..') || isAbsolute(inside)) {
|
|
57
|
+
say(t(lang, 'ctrl.skills.none', { name: want }));
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
50
60
|
const body = read(join(dir, 'SKILL.md'));
|
|
51
61
|
say(body
|
|
52
62
|
? t(lang, 'ctrl.skills.body', { name: want, body: body.slice(0, 3000) })
|
package/control/model-card.mjs
CHANGED
|
@@ -68,7 +68,7 @@ export function modelPress(data) {
|
|
|
68
68
|
* provider prefix each is a wall, and a group heading stays readable when the
|
|
69
69
|
* models have long names.
|
|
70
70
|
*/
|
|
71
|
-
export function modelCard({ profile, routes, current = null, topic = false, fallback = null, t, limit = 60 }) {
|
|
71
|
+
export function modelCard({ profile, routes, current = null, topic = false, fallback = null, answered = null, t, limit = 60 }) {
|
|
72
72
|
const now = current || (routes.find((route) => route.current) || null);
|
|
73
73
|
const isNow = (route) => Boolean(now && route.provider === now.provider && route.model === now.model);
|
|
74
74
|
const known = routes.filter((route) => routeData(route.provider, route.model));
|
|
@@ -117,6 +117,12 @@ export function modelCard({ profile, routes, current = null, topic = false, fall
|
|
|
117
117
|
lines.push(t('ctrl.model.pickNowDefault', { route: `${fallback.provider}/${fallback.model}` }));
|
|
118
118
|
}
|
|
119
119
|
} else lines.push(t('ctrl.model.pickUnknown', { profile }));
|
|
120
|
+
// The route above is the one this topic is set to. After a fallback the turn
|
|
121
|
+
// ran somewhere else, and a card that only names the setting reads as "this is
|
|
122
|
+
// who answers" when it is not.
|
|
123
|
+
if (answered?.model) {
|
|
124
|
+
lines.push(t(answered.switched ? 'ctrl.model.answeredSwitched' : 'ctrl.model.answered', { model: answered.model }));
|
|
125
|
+
}
|
|
120
126
|
lines.push('');
|
|
121
127
|
// Three different silences, and they are not the same fact: a profile with no
|
|
122
128
|
// models at all, a profile whose every route is too long to be a button, and
|