dsh-tg-bridge 1.10.1 → 1.11.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/README.md +13 -0
- package/bridge.mjs +7 -2
- package/i18n.mjs +6 -3
- package/package.json +1 -1
- package/panel.mjs +8 -1
- package/say.mjs +10 -4
package/README.md
CHANGED
|
@@ -288,6 +288,19 @@ message shows the last two as `💭` lines. The command needs no ids: it falls b
|
|
|
288
288
|
newest turn's thought file, because tool shells do not inherit the bridge environment.
|
|
289
289
|
`--thought` never sends a Telegram message on its own.
|
|
290
290
|
|
|
291
|
+
A decision the person must know before the turn ends — a release shipped, a cause found,
|
|
292
|
+
a blocker — goes to the chat as one plain line instead:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
node ~/.dsh/tg-bridge/say.mjs --note "1.10.1 is on npm; restart to load it"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
`--note` sends a real message and takes the same no-ids fallback as `--thought`. The split
|
|
299
|
+
is deliberate: `--thought` is the working trail inside the progress message, `--note` is the
|
|
300
|
+
short line that changes what the reader expects to happen next. The progress message itself
|
|
301
|
+
opens with the request echoed back (`⏳ Принял: «…» · 3 с`), so the first thing the person
|
|
302
|
+
sees after sending names their task rather than a generic spinner.
|
|
303
|
+
|
|
291
304
|
`/reasoning` is the switch for the 💭 mechanism. It is on by default: every turn carries a
|
|
292
305
|
short instruction to leave one line at each decision point (task clear, cause found, risky
|
|
293
306
|
change, result checked). `/reasoning off` drops the instruction and the `💭` lines for that
|
package/bridge.mjs
CHANGED
|
@@ -817,7 +817,7 @@ function killTurn(key) {
|
|
|
817
817
|
* thinks for ten minutes still leaves one line in the chat — and the whole trail
|
|
818
818
|
* one tap away.
|
|
819
819
|
*/
|
|
820
|
-
async function startProgress(chatId, threadId, lang = 'ru') {
|
|
820
|
+
async function startProgress(chatId, threadId, lang = 'ru', task = '') {
|
|
821
821
|
const started = Date.now();
|
|
822
822
|
const panelKey = sessionKey(chatId, threadId);
|
|
823
823
|
const steps = [];
|
|
@@ -875,6 +875,7 @@ async function startProgress(chatId, threadId, lang = 'ru') {
|
|
|
875
875
|
// `/thoughts off` keeps the block out of the chat and leaves the counter;
|
|
876
876
|
// the log itself is a file the command sends on demand.
|
|
877
877
|
reasoning: state.thinkBlock?.[panelKey] === 'counter' ? 'counter' : 'block',
|
|
878
|
+
task,
|
|
878
879
|
cache,
|
|
879
880
|
});
|
|
880
881
|
};
|
|
@@ -1376,6 +1377,10 @@ ${t(lang, 'help.body')}`,
|
|
|
1376
1377
|
const sessionAtStart = state.sessions[key];
|
|
1377
1378
|
// Project directory bound to this topic (set with /cd); config.cwd otherwise.
|
|
1378
1379
|
const cwd = (state.cwd && state.cwd[key]) || config.cwd;
|
|
1380
|
+
// What the person actually wrote, before any injected block: the progress
|
|
1381
|
+
// message echoes it back so the first thing they see names their task, not a
|
|
1382
|
+
// generic spinner.
|
|
1383
|
+
const request = text;
|
|
1379
1384
|
|
|
1380
1385
|
// Desktop-style goal: the topic's goal and task list travel with every turn,
|
|
1381
1386
|
// so a fresh session after /new still knows what the project is aiming at.
|
|
@@ -1391,7 +1396,7 @@ ${t(lang, 'help.body')}`,
|
|
|
1391
1396
|
|
|
1392
1397
|
// Live progress: one status message per turn, rewritten as the agent works.
|
|
1393
1398
|
// Without it a long turn and a hung turn looked exactly alike in the chat.
|
|
1394
|
-
const progress = await startProgress(chatId, threadId, lang);
|
|
1399
|
+
const progress = await startProgress(chatId, threadId, lang, request);
|
|
1395
1400
|
// Turn telemetry for the log: what the agent did, how much it cost, on which
|
|
1396
1401
|
// model. Without it /logs shows only "in" and "sent" — useless when asking
|
|
1397
1402
|
// "why did this take 9 minutes".
|
package/i18n.mjs
CHANGED
|
@@ -15,6 +15,7 @@ export const LANGS = ['en', 'ru', 'zh'];
|
|
|
15
15
|
const DICT = {
|
|
16
16
|
en: {
|
|
17
17
|
'status.working': 'Working',
|
|
18
|
+
'status.accepted': 'On it',
|
|
18
19
|
'status.done': 'Done',
|
|
19
20
|
'status.failed': 'Turn failed',
|
|
20
21
|
'status.queued': 'queued',
|
|
@@ -70,7 +71,7 @@ const DICT = {
|
|
|
70
71
|
'profile.badName': 'Name it with lowercase letters, digits and dashes: /profile new my-space from web',
|
|
71
72
|
'profile.set': 'Topic profile → {name} ({route}). Applies from the next turn.',
|
|
72
73
|
'msg.reasoningState': 'Working notes: {state}. Switch with /reasoning on or /reasoning off.',
|
|
73
|
-
'prompt.reasoning': 'Working notes: at each meaningful step — the task is clear, the cause is found, something risky is about to change, the result is checked — append one line of at most 90 characters with `node {say} --thought "..."`. It shows up as 💭 in the progress message: write the decision, not a retelling. Skip it for one-step work.',
|
|
74
|
+
'prompt.reasoning': 'Working notes: at each meaningful step — the task is clear, the cause is found, something risky is about to change, the result is checked — append one line of at most 90 characters with `node {say} --thought "..."`. It shows up as 💭 in the progress message: write the decision, not a retelling. Skip it for one-step work. When a decision changes what the person should expect — a release shipped, a cause found, a blocker — send it to the chat as one plain line: `node {say} --note "..."`. The chat line is for what they must know now, not for every step.',
|
|
74
75
|
'cmd.help.title': 'Commands',
|
|
75
76
|
'cmd.help.hint': 'Send any text to start a task. In a forum topic: /cd <project> binds the topic to that project.',
|
|
76
77
|
'cmd.cd.bound': 'Topic bound to project:\n{path}\n\nAll turns run from this directory.',
|
|
@@ -389,6 +390,7 @@ const DICT = {
|
|
|
389
390
|
},
|
|
390
391
|
ru: {
|
|
391
392
|
'status.working': 'Работаю',
|
|
393
|
+
'status.accepted': 'Принял',
|
|
392
394
|
'status.done': 'Готово',
|
|
393
395
|
'status.failed': 'Ход не удался',
|
|
394
396
|
'status.queued': 'в очереди',
|
|
@@ -444,7 +446,7 @@ const DICT = {
|
|
|
444
446
|
'profile.badName': 'Имя — строчные буквы, цифры и дефис: /profile new my-space from web',
|
|
445
447
|
'profile.set': 'Профиль темы → {name} ({route}). Действует со следующего хода.',
|
|
446
448
|
'msg.reasoningState': 'Заметки по ходу: {state}. Переключить: /reasoning on или /reasoning off.',
|
|
447
|
-
'prompt.reasoning': 'Заметки по ходу: на каждом значимом шаге — задача ясна, причина найдена, сейчас изменю рискованное, результат проверен — дописывай одну строку до 90 символов через `node {say} --thought "..."`. Она видна как 💭 в сообщении прогресса: пиши решение, а не пересказ. Для работы в один шаг не зови.',
|
|
449
|
+
'prompt.reasoning': 'Заметки по ходу: на каждом значимом шаге — задача ясна, причина найдена, сейчас изменю рискованное, результат проверен — дописывай одну строку до 90 символов через `node {say} --thought "..."`. Она видна как 💭 в сообщении прогресса: пиши решение, а не пересказ. Для работы в один шаг не зови. Когда решение меняет то, что человек должен знать сразу — выпущена версия, найдена причина, упёрся в блокер — отправь это в чат одной строкой без разметки: `node {say} --note "..."`. В чат — только то, что важно сейчас, не каждый шаг.',
|
|
448
450
|
'cmd.help.title': 'Команды',
|
|
449
451
|
'cmd.help.hint': 'Любой текст — задача агенту. В теме форума: /cd <проект> привяжет тему к проекту.',
|
|
450
452
|
'cmd.cd.bound': 'Тема привязана к проекту:\n{path}\n\nДальше все команды идут отсюда.',
|
|
@@ -763,6 +765,7 @@ const DICT = {
|
|
|
763
765
|
},
|
|
764
766
|
zh: {
|
|
765
767
|
'status.working': '处理中',
|
|
768
|
+
'status.accepted': '收到',
|
|
766
769
|
'status.done': '完成',
|
|
767
770
|
'status.failed': '运行失败',
|
|
768
771
|
'status.queued': '排队中',
|
|
@@ -818,7 +821,7 @@ const DICT = {
|
|
|
818
821
|
'profile.badName': '名称只能用小写字母、数字和连字符:/profile new my-space from web',
|
|
819
822
|
'profile.set': '话题配置档 → {name}({route})。下一轮生效。',
|
|
820
823
|
'msg.reasoningState': '工作记录:{state}。切换:/reasoning on 或 /reasoning off。',
|
|
821
|
-
'prompt.reasoning': '工作记录:在每个有意义的节点——任务已清楚、原因已找到、即将改动有风险的地方、结果已验证——用 `node {say} --thought "..."` 追加一行,不超过 90 个字符。它会以 💭
|
|
824
|
+
'prompt.reasoning': '工作记录:在每个有意义的节点——任务已清楚、原因已找到、即将改动有风险的地方、结果已验证——用 `node {say} --thought "..."` 追加一行,不超过 90 个字符。它会以 💭 出现在进度消息里:写结论,不要复述。一步就能完成的工作不必调用。当某个决定改变对方需要预期的事——版本已发布、找到原因、遇到阻塞——用一行纯文本发到聊天:`node {say} --note "..."`。聊天里只发此刻重要的内容,不是每一步。',
|
|
822
825
|
'cmd.help.title': '命令',
|
|
823
826
|
'cmd.help.hint': '发送任意文本即可开始任务。在论坛话题中:/cd <项目> 将该话题绑定到项目目录。',
|
|
824
827
|
'cmd.cd.bound': '话题已绑定到项目:\n{path}\n\n之后所有操作都在此目录执行。',
|
package/package.json
CHANGED
package/panel.mjs
CHANGED
|
@@ -90,10 +90,17 @@ export function progressPanel({
|
|
|
90
90
|
// `counter` keeps the reasoning out of the chat: a number in the panel, the
|
|
91
91
|
// log itself in the file that `/thoughts file` sends.
|
|
92
92
|
reasoning = 'block',
|
|
93
|
+
// The person's own request, echoed back in the head. The panel is the first
|
|
94
|
+
// thing sent after a message arrives, so this is what makes that first
|
|
95
|
+
// message say "принял: …" instead of a generic spinner.
|
|
96
|
+
task = '',
|
|
93
97
|
} = {}) {
|
|
98
|
+
const snippet = String(task).replace(/\s+/g, ' ').trim().slice(0, 48);
|
|
94
99
|
const head = final
|
|
95
100
|
? `✅ ${t(lang, 'status.done')} · ${seconds} ${secondsUnit(lang)}`
|
|
96
|
-
:
|
|
101
|
+
: snippet
|
|
102
|
+
? `⏳ ${t(lang, 'status.accepted')}: «${snippet}${String(task).trim().length > 48 ? '…' : ''}» · ${seconds} ${secondsUnit(lang)}`
|
|
103
|
+
: `⏳ ${t(lang, 'status.working')}… ${seconds} ${secondsUnit(lang)}`;
|
|
97
104
|
const mind = thoughts.map((line) => `💭 ${line}`);
|
|
98
105
|
const base = [head, ...mind, cache].filter(Boolean).join('\n').length;
|
|
99
106
|
|
package/say.mjs
CHANGED
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
//
|
|
8
8
|
// node say.mjs --steer <job-id> "text"
|
|
9
9
|
// node say.mjs --chat <chat-id> [--thread <id>] "text"
|
|
10
|
-
// node say.mjs --thought "short note" (no ids needed)
|
|
10
|
+
// node say.mjs --thought "short note" (no ids needed)
|
|
11
|
+
// node say.mjs --note "short sentence" (a real chat message, no ids needed)
|
|
11
12
|
//
|
|
13
|
+
// `--thought` is a note inside the progress message. `--note` is a real chat
|
|
14
|
+
// message: use it for what the person must know now (a release shipped, a cause
|
|
15
|
+
// found, a blocker), not for every step.
|
|
16
|
+
//
|
|
12
17
|
// `--thought` does not send a message: it appends to the turn's thought file,
|
|
13
18
|
// and the live progress message shows the last two notes as 💭 lines.
|
|
14
19
|
//
|
|
@@ -44,7 +49,7 @@ function jobOf(id) {
|
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
function usage() {
|
|
47
|
-
console.error('usage: node say.mjs --steer <id> "text" | --chat <id> [--thread <id>] "text" | --thought "text"');
|
|
52
|
+
console.error('usage: node say.mjs --steer <id> "text" | --chat <id> [--thread <id>] "text" | --thought "text" | --note "text"');
|
|
48
53
|
process.exit(2);
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -56,7 +61,8 @@ function parse(argv) {
|
|
|
56
61
|
if (arg === '--steer') out.steer = argv[++i] || '';
|
|
57
62
|
else if (arg === '--chat') out.chatId = Number(argv[++i] || 0);
|
|
58
63
|
else if (arg === '--thread') out.threadId = Number(argv[++i] || 0);
|
|
59
|
-
else if (arg === '--thought') out.thought = true;
|
|
64
|
+
else if (arg === '--thought') out.thought = true;
|
|
65
|
+
else if (arg === '--note') out.note = true;
|
|
60
66
|
else rest.push(arg);
|
|
61
67
|
}
|
|
62
68
|
out.text = rest.join(' ').trim();
|
|
@@ -87,7 +93,7 @@ async function main() {
|
|
|
87
93
|
let jobPath = '';
|
|
88
94
|
// Tool shells do not inherit the bridge's env, so fall back to the thought
|
|
89
95
|
// file the bridge touched at the start of the newest turn.
|
|
90
|
-
if (!chatId && args.thought) {
|
|
96
|
+
if (!chatId && (args.thought || args.note)) {
|
|
91
97
|
const active = activeThoughtFile();
|
|
92
98
|
if (active) {
|
|
93
99
|
chatId = active.chatId;
|