dsh-tg-bridge 1.25.3 → 1.26.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 -3
- package/bridge.mjs +1 -1
- package/callbacks.mjs +39 -21
- package/commands-registry.mjs +1 -1
- package/control/cmd-agents.mjs +1 -1
- package/control/cmd-bridge.mjs +1 -1
- package/control/cmd-plugin.mjs +1 -1
- package/control/cmd-session.mjs +1 -1
- package/control/cmd-skills.mjs +1 -1
- package/control/cmd-task.mjs +1 -1
- package/control/cmd-views.mjs +20 -3
- package/control/tasks.mjs +9 -24
- package/control.mjs +2 -2
- package/help-explain.mjs +1 -1
- package/i18n/en/core.mjs +15 -4
- package/i18n/en/ctrl.mjs +2 -1
- package/i18n/ru/core.mjs +15 -4
- package/i18n/ru/ctrl.mjs +2 -1
- package/i18n/zh/core.mjs +15 -4
- package/i18n/zh/ctrl.mjs +2 -1
- package/menu-card.mjs +1 -1
- package/package.json +1 -1
- package/progress.mjs +15 -0
- package/settings-card.mjs +63 -6
package/README.md
CHANGED
|
@@ -271,7 +271,7 @@ Updates: /update · /update confirm · /update on|off|check|auto · /subscr
|
|
|
271
271
|
Diagnostics: /doctor · /logs [errors|N|text] · /report
|
|
272
272
|
Service: /app · /restart · /help
|
|
273
273
|
Settings: /settings — the same switches as buttons, grouped in four tabs
|
|
274
|
-
Display: /lang · /reasoning off|card|chat · /thoughts
|
|
274
|
+
Display: /lang · /reasoning off|card|chat · /pin on|off · /thoughts
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
### Settings as a card
|
|
@@ -281,8 +281,18 @@ four tabs: what the bot says, who answers and how hard it works, new releases,
|
|
|
281
281
|
and the health checks. Each row shows what the setting is now and what a tap
|
|
282
282
|
would change it to. A tap runs the command a person would have typed
|
|
283
283
|
(`/reasoning chat`, `/update on`), so the card cannot disagree with the command:
|
|
284
|
-
it is a view of them.
|
|
285
|
-
|
|
284
|
+
it is a view of them.
|
|
285
|
+
|
|
286
|
+
The card stays after a tap. It is edited in place — same message, same buttons,
|
|
287
|
+
the value in force marked with `●` and one `✓ row: value` line saying what just
|
|
288
|
+
changed — so a second setting is one more tap instead of a second `/settings`.
|
|
289
|
+
`✓ Done` removes the card when you are finished with it; nothing else deletes it.
|
|
290
|
+
|
|
291
|
+
`📌 Pin the progress card` (`/pin on`) keeps the running card pinned, so the
|
|
292
|
+
clock, the speed and the step list are one tap away instead of a scroll. Telegram
|
|
293
|
+
gives a chat one pinned message, so each turn's card replaces the last one. Off by
|
|
294
|
+
default: a bot that pins without being asked takes that slot in someone else's
|
|
295
|
+
chat, and a group needs the right to pin at all.
|
|
286
296
|
|
|
287
297
|
Nothing on the card is only available on the card. `/settings` is for people who
|
|
288
298
|
would rather press a labelled button than remember which of `/effort`,
|
package/bridge.mjs
CHANGED
|
@@ -41,7 +41,7 @@ import { startJobLoops } from './job-loops.mjs';
|
|
|
41
41
|
import { ensureProfile } from './profiles.mjs';
|
|
42
42
|
import { firstLiveModel, describeVerdicts, probeHint, probeModel } from './model-probe.mjs';
|
|
43
43
|
import { explainFailure } from './failures.mjs';
|
|
44
|
-
import { handleControl, CONTROL_COMMANDS, modelOf, modelsOf
|
|
44
|
+
import { handleControl, CONTROL_COMMANDS, modelOf, modelsOf } from './control.mjs';
|
|
45
45
|
import { bridgeVersion, installRelease, npmLatestAsync } from './control.mjs';
|
|
46
46
|
import { dueForCheck, updateState } from './update-policy.mjs';
|
|
47
47
|
import { drainGoalJobs, goalOf, progressOf, renderPromptBlock, toggleTask } from './goals.mjs';
|
package/callbacks.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// task card. One place, because a press may mean a control command, a card
|
|
3
3
|
// update or an approval, and only one handler may claim it.
|
|
4
4
|
import { AgentsetStore } from './agentsets.mjs';
|
|
5
|
-
import { CONTROL_COMMANDS, handleControl
|
|
5
|
+
import { CONTROL_COMMANDS, handleControl } from './control.mjs';
|
|
6
6
|
import { isFallbackPress, pressTarget } from './fallback-card.mjs';
|
|
7
7
|
import { progressOf, toggleTask } from './goals.mjs';
|
|
8
8
|
import { handleMessage } from './handle-message.mjs';
|
|
@@ -326,22 +326,31 @@ export async function handleCallback(query) {
|
|
|
326
326
|
export async function handleCardPress(query, ctx) {
|
|
327
327
|
const { chatId, messageId, threadId, key, lang } = ctx;
|
|
328
328
|
const data = String(query.data || '');
|
|
329
|
-
const
|
|
329
|
+
const tt = (k, vars) => t(lang, k, vars);
|
|
330
330
|
const updateMode = state.update?.mode || 'check';
|
|
331
|
-
const
|
|
331
|
+
const current = settingsCurrent({ config, state, key });
|
|
332
|
+
const wanted = commandFor({ t: tt, current, updateMode }, data);
|
|
332
333
|
|
|
333
334
|
if (!wanted) {
|
|
334
335
|
await tg('answerCallbackQuery', { callback_query_id: query.id, text: t(lang, 'settings.card.stale') }).catch(() => {});
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
338
|
|
|
338
|
-
if (wanted.
|
|
339
|
+
if (wanted.done) {
|
|
340
|
+
await tg('deleteMessage', { chat_id: chatId, message_id: messageId }).catch((error) => log(`settings card delete failed: ${error.message}`));
|
|
341
|
+
await tg('answerCallbackQuery', { callback_query_id: query.id }).catch(() => {});
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** Redraw the card in place: the same message, the new values, the buttons kept. */
|
|
346
|
+
const redraw = async (page, note = '') => {
|
|
339
347
|
const card = renderSettingsCard({
|
|
340
|
-
page
|
|
341
|
-
t:
|
|
342
|
-
current,
|
|
348
|
+
page,
|
|
349
|
+
t: tt,
|
|
350
|
+
current: settingsCurrent({ config, state, key }),
|
|
343
351
|
updateMode,
|
|
344
352
|
bound: boundSetOf(key),
|
|
353
|
+
note,
|
|
345
354
|
});
|
|
346
355
|
await tg('editMessageText', {
|
|
347
356
|
chat_id: chatId,
|
|
@@ -351,6 +360,10 @@ export async function handleCardPress(query, ctx) {
|
|
|
351
360
|
...(threadId > 0 ? { message_thread_id: threadId } : {}),
|
|
352
361
|
}).catch((error) => log(`settings card redraw failed: ${error.message}`));
|
|
353
362
|
await tg('answerCallbackQuery', { callback_query_id: query.id }).catch(() => {});
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
if (wanted.page) {
|
|
366
|
+
await redraw(wanted.page);
|
|
354
367
|
return;
|
|
355
368
|
}
|
|
356
369
|
|
|
@@ -358,6 +371,10 @@ export async function handleCardPress(query, ctx) {
|
|
|
358
371
|
// in the chat: the one line below is the chat's share of this press. Only a
|
|
359
372
|
// command that failed says more than that.
|
|
360
373
|
const replies = [];
|
|
374
|
+
// A press that fails has to say so: the card is redrawn either way, and a
|
|
375
|
+
// redraw alone looks exactly like success. The old path hid failures behind a
|
|
376
|
+
// line the person read as a confirmation.
|
|
377
|
+
let failed = '';
|
|
361
378
|
const [head, ...rest] = wanted.command.split(/\s+/);
|
|
362
379
|
const handled = await handleControl({
|
|
363
380
|
command: head,
|
|
@@ -390,29 +407,30 @@ export async function handleCardPress(query, ctx) {
|
|
|
390
407
|
prices: () => Promise.resolve(''),
|
|
391
408
|
}).catch((error) => {
|
|
392
409
|
log(`settings press ${data} failed: ${error.message}`);
|
|
410
|
+
failed = error.message;
|
|
393
411
|
replies.push(error.message);
|
|
394
412
|
return true;
|
|
395
413
|
});
|
|
396
414
|
|
|
397
415
|
const changed = Boolean(wanted.value);
|
|
398
|
-
const answerText = changed
|
|
399
|
-
? t(lang, 'settings.card.changed', { label: wanted.label, value: wanted.value })
|
|
400
|
-
: t(lang, 'settings.card.door', { command: wanted.command });
|
|
401
416
|
|
|
402
|
-
// The card
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
417
|
+
// The card stays where it is, redrawn with the new value. A press that turned
|
|
418
|
+
// it into one line took the menu away from the person who wanted the next tap,
|
|
419
|
+
// and the line said less than the card did; keeping it costs no message,
|
|
420
|
+
// because this is an edit of the one already in the chat. The way out is the
|
|
421
|
+
// card's own button, so removing it is a decision, not a side effect.
|
|
422
|
+
await redraw(
|
|
423
|
+
wanted.page,
|
|
424
|
+
failed ? `⚠️ ${failed}` : changed ? t(lang, 'settings.card.changed', { label: wanted.label, value: wanted.value }) : '',
|
|
425
|
+
);
|
|
410
426
|
|
|
411
427
|
// A door that opened to nothing (an unknown set id, a command that is not
|
|
412
|
-
// allowed here) still has something to say; it goes under the
|
|
428
|
+
// allowed here) still has something to say; it goes under the card, once. A
|
|
429
|
+
// switch says nothing here: the card above it already named the new value, and
|
|
430
|
+
// a failure is on the card too, so it is not repeated below it.
|
|
413
431
|
if (!handled) log(`settings press ${data}: no handler answered`);
|
|
414
|
-
const notLine = replies.filter(Boolean).filter((r) => r !==
|
|
415
|
-
if (notLine.length > 0 && !changed) {
|
|
432
|
+
const notLine = replies.filter(Boolean).filter((r) => r !== wanted.command);
|
|
433
|
+
if (notLine.length > 0 && !changed && !failed) {
|
|
416
434
|
await send(chatId, notLine[0], threadId).catch(() => {});
|
|
417
435
|
}
|
|
418
436
|
}
|
package/commands-registry.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export const CONTROL_COMMANDS = [
|
|
|
10
10
|
'status', 'models', 'model', 'effort', 'profile', 'agents', 'preset', 'permissions', 'plan',
|
|
11
11
|
'jobs', 'remind', 'sessions', 'resume', 'plugins', 'plugin',
|
|
12
12
|
'skills', 'soul', 'restart', 'app', 'stop', 'new', 'seed', 'send', 'cd',
|
|
13
|
-
'prices', 'help', 'doctor', 'logs', 'report', 'lang', 'reasoning', 'goal', 'task', 'tasks',
|
|
13
|
+
'prices', 'help', 'doctor', 'logs', 'report', 'lang', 'reasoning', 'pin', 'goal', 'task', 'tasks',
|
|
14
14
|
'thoughts', 'version', 'update', 'crew', 'agentset', 'subscribe', 'settings',
|
|
15
15
|
'rewind', 'fork', 'branches', 'menu', 'fallback',
|
|
16
16
|
];
|
package/control/cmd-agents.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
31
31
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
32
32
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
33
33
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
34
|
-
import { taskKeyboard, goalView, taskView,
|
|
34
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
35
35
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
36
36
|
|
|
37
37
|
export async function handleAgentCommands(ctx) {
|
package/control/cmd-bridge.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
31
31
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
32
32
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
33
33
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
34
|
-
import { taskKeyboard, goalView, taskView,
|
|
34
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
35
35
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
36
36
|
import { buildReport, tailOf, writeReport } from '../report.mjs';
|
|
37
37
|
import { effectivePreset } from '../permission-rows.mjs';
|
package/control/cmd-plugin.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
30
30
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
31
31
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
32
32
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
33
|
-
import { taskKeyboard, goalView, taskView,
|
|
33
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
34
34
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
35
35
|
|
|
36
36
|
export async function handlePluginCommands(ctx) {
|
package/control/cmd-session.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
30
30
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
31
31
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
32
32
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
33
|
-
import { taskKeyboard, goalView, taskView,
|
|
33
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
34
34
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
35
35
|
import { resolveCd } from './cd-path.mjs';
|
|
36
36
|
import { permissionEnabled } from '../permission-rows.mjs';
|
package/control/cmd-skills.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
30
30
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
31
31
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
32
32
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
33
|
-
import { taskKeyboard, goalView, taskView,
|
|
33
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
34
34
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
35
35
|
|
|
36
36
|
export async function handleSkillCommands(ctx) {
|
package/control/cmd-task.mjs
CHANGED
|
@@ -30,7 +30,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
30
30
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
31
31
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
32
32
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
33
|
-
import { taskKeyboard, goalView, taskView,
|
|
33
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
34
34
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
35
35
|
import { CAP_CHOICES, CAP_MAX, CAP_MIN, setParallel } from '../jobs-cap.mjs';
|
|
36
36
|
|
package/control/cmd-views.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { parseAgentPresets, parseModelSelection, parsePermissionPresets, parseRe
|
|
|
14
14
|
import { setRowConfig, unsetRowConfig } from '../profile-edit.mjs';
|
|
15
15
|
import { parseReminder, stampAt, upcoming } from '../reminders.mjs';
|
|
16
16
|
import { AgentsetStore, emptySet, slugId } from '../agentsets.mjs';
|
|
17
|
-
import { SETTINGS_PAGES, renderSettingsCard, settingsCurrent } from '../settings-card.mjs';
|
|
17
|
+
import { SETTINGS_PAGES, cardPin, renderSettingsCard, settingsCurrent } from '../settings-card.mjs';
|
|
18
18
|
import { applyFork, planFork, planRewind } from '../rewind.mjs';
|
|
19
19
|
import { cutSession, isRewindPress } from '../rewind-buttons.mjs';
|
|
20
20
|
import { renderRewindCard, renderRewindUsage } from '../rewind-card.mjs';
|
|
@@ -30,7 +30,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
30
30
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './sessions.mjs';
|
|
31
31
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './agents.mjs';
|
|
32
32
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './agentsets.mjs';
|
|
33
|
-
import { taskKeyboard, goalView, taskView,
|
|
33
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './tasks.mjs';
|
|
34
34
|
import { reasoningMode } from '../notes.mjs';
|
|
35
35
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './release.mjs';
|
|
36
36
|
import { presetOf } from '../profile-view.mjs';
|
|
@@ -240,7 +240,7 @@ export async function handleViewCommands(ctx) {
|
|
|
240
240
|
permission = null;
|
|
241
241
|
}
|
|
242
242
|
const current = {
|
|
243
|
-
...settingsCurrent({ config, state, key
|
|
243
|
+
...settingsCurrent({ config, state, key }),
|
|
244
244
|
permissions: permission ? { profile: permission.profile, preset: permission.preset?.id || '' } : null,
|
|
245
245
|
};
|
|
246
246
|
const bound = agentsetOf(state, key);
|
|
@@ -288,6 +288,23 @@ export async function handleViewCommands(ctx) {
|
|
|
288
288
|
say(t(lang, next === 'off' ? 'msg.reasoningOff' : next === 'chat' ? 'msg.reasoningChat' : 'msg.reasoningOn'));
|
|
289
289
|
return true;
|
|
290
290
|
}
|
|
291
|
+
case '/pin': {
|
|
292
|
+
// The progress card is pinned while its turn runs, so getting back to the
|
|
293
|
+
// numbers is one tap instead of a scroll. Off by default: pinning someone's
|
|
294
|
+
// chat uninvited is not a favour, and a group needs the right to pin.
|
|
295
|
+
const wanted = String(arg || '').trim().toLowerCase();
|
|
296
|
+
const mode = cardPin(state, config, key);
|
|
297
|
+
const next = { on: 'on', off: 'off' }[wanted];
|
|
298
|
+
if (!next) {
|
|
299
|
+
say(t(lang, 'msg.pinState', { state: t(lang, `msg.pinMode.${mode}`) }));
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
state.pin = state.pin || {};
|
|
303
|
+
state.pin[key] = next;
|
|
304
|
+
ctx.saveState();
|
|
305
|
+
say(t(lang, next === 'on' ? 'msg.pinOn' : 'msg.pinOff'));
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
291
308
|
case '/thoughts': {
|
|
292
309
|
// The model's reasoning, read from the session log. Text by default (short,
|
|
293
310
|
// ephemeral, deletes itself); `file` and `all` write a Markdown log and send
|
package/control/tasks.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
// The goal card, the task list and the reasoning switch: the three small views `/goal` and `/tasks` draw.
|
|
2
|
-
//
|
|
3
|
-
// Split out of `control.mjs` by the 500-line plan: the command handlers that
|
|
4
|
-
// follow call these, and none of them needs the dispatcher to do it.
|
|
5
|
-
import { t } from '../i18n.mjs';
|
|
6
|
-
import { progressOf } from '../goals.mjs';
|
|
7
|
-
import { COMMAND_ALIASES, CONTROL_COMMANDS, DOCUMENTED_COMMANDS } from '../commands-registry.mjs';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { read } from './models.mjs';
|
|
1
|
+
// The goal card, the task list and the reasoning switch: the three small views `/goal` and `/tasks` draw.
|
|
2
|
+
//
|
|
3
|
+
// Split out of `control.mjs` by the 500-line plan: the command handlers that
|
|
4
|
+
// follow call these, and none of them needs the dispatcher to do it.
|
|
5
|
+
import { t } from '../i18n.mjs';
|
|
6
|
+
import { progressOf } from '../goals.mjs';
|
|
7
|
+
import { COMMAND_ALIASES, CONTROL_COMMANDS, DOCUMENTED_COMMANDS } from '../commands-registry.mjs';
|
|
8
|
+
|
|
9
|
+
import { read } from './models.mjs';
|
|
11
10
|
/**
|
|
12
11
|
* The task list as a keyboard: one button per task, labelled with its number and
|
|
13
12
|
* state. A tap marks the task done and a second tap undoes it, so managing the
|
|
@@ -60,20 +59,6 @@ export function taskView(goal, lang) {
|
|
|
60
59
|
|
|
61
60
|
export { CONTROL_COMMANDS, COMMAND_ALIASES, DOCUMENTED_COMMANDS };
|
|
62
61
|
|
|
63
|
-
/**
|
|
64
|
-
* Working notes ("💭" lines) are on unless the topic or the config says
|
|
65
|
-
* otherwise. Per-topic wins over the install default, so one topic can keep the
|
|
66
|
-
* trail while another stays terse.
|
|
67
|
-
*
|
|
68
|
-
* Three ends, one job: `off`, `card` (the last two lines inside the progress
|
|
69
|
-
* message) and `chat` (every line as its own message). `reasoningOf` stays the
|
|
70
|
-
* boolean question the prompt asks — "does this turn write notes at all" — and
|
|
71
|
-
* `reasoningMode` answers the one the panel asks.
|
|
72
|
-
*/
|
|
73
|
-
export function reasoningOf(state, config, key) {
|
|
74
|
-
return reasoningMode(state, config, key) !== 'off';
|
|
75
|
-
}
|
|
76
|
-
|
|
77
62
|
/**
|
|
78
63
|
* The chat view of `bridge.log`. Delivery chatter ("sent chat=…") answers
|
|
79
64
|
* nothing when the question is "what did the agent do", so the default view
|
package/control.mjs
CHANGED
|
@@ -41,7 +41,7 @@ import { listPids, waitForExit, waitForStart, pluginsOf, bundleRowIds, addBundle
|
|
|
41
41
|
import { cwdSlug, bareId, stamp, recentSessions, sessionTitle } from './control/sessions.mjs';
|
|
42
42
|
import { agentsOf, fleetOf, patchRows, skillsOf, AGENTS, PERSONA_HEADING, soulOf, setSoul } from './control/agents.mjs';
|
|
43
43
|
import { fmt, AGENTSETS, agentset, agentsetOf, profileRowOf, bindAgentset, agentsetCard, agentsetKeyboard } from './control/agentsets.mjs';
|
|
44
|
-
import { taskKeyboard, goalView, taskView,
|
|
44
|
+
import { taskKeyboard, goalView, taskView, filterLogLines } from './control/tasks.mjs';
|
|
45
45
|
import { updatePolicy, bridgeRoot, copyRelease, installRelease, bridgeVersion, newestModuleMtime, npmLatest, npmLatestAsync } from './control/release.mjs';
|
|
46
46
|
|
|
47
47
|
export async function handleControl(ctx) {
|
|
@@ -118,6 +118,6 @@ export async function handleControl(ctx) {
|
|
|
118
118
|
// keeps its promises: same names, same module, different file.
|
|
119
119
|
export { COMMAND_ALIASES, CONTROL_COMMANDS, DOCUMENTED_COMMANDS, MENU_COMMANDS } from './commands-registry.mjs';
|
|
120
120
|
export { copyRelease } from './control/release.mjs';
|
|
121
|
-
export { filterLogLines
|
|
121
|
+
export { filterLogLines } from './control/tasks.mjs';
|
|
122
122
|
export { DSH_HOME } from './paths.mjs';
|
|
123
123
|
export { modelOf, modelsOf, pluginsOf, recentSessions, skillsOf, soulOf, bridgeVersion, npmLatest, npmLatestAsync, installRelease };
|
package/help-explain.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const SECTION = {
|
|
|
16
16
|
effort: 'Tuning', permissions: 'Tuning', preset: 'Tuning', crew: 'Tuning', plan: 'Tuning', jobs: 'Tuning', remind: 'Tuning',
|
|
17
17
|
skills: 'Extensions', plugins: 'Extensions', soul: 'Extensions',
|
|
18
18
|
update: 'Versions', subscribe: 'Versions',
|
|
19
|
-
settings: 'Other', lang: 'Other', reasoning: 'Other', doctor: 'Other', logs: 'Other', report: 'Other',
|
|
19
|
+
settings: 'Other', lang: 'Other', reasoning: 'Other', pin: 'Other', doctor: 'Other', logs: 'Other', report: 'Other',
|
|
20
20
|
app: 'Other', restart: 'Other', help: 'Other', menu: 'Panels',
|
|
21
21
|
};
|
|
22
22
|
|
package/i18n/en/core.mjs
CHANGED
|
@@ -14,13 +14,15 @@ export default {
|
|
|
14
14
|
'settings.state.on': 'on',
|
|
15
15
|
'settings.state.off': 'off',
|
|
16
16
|
'settings.state.auto': 'auto',
|
|
17
|
-
'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e\nGoals: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (tap to tick)\nSessions: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cname\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nTuning: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nExtensions: /skills · /plugins [add|remove] · /soul\nVersions: /update [confirm|on|off|auto] · /subscribe on|off\nOther: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nPanels: /menu — the same commands as buttons, page by page. /menu on puts four keys under the message field.",
|
|
17
|
+
'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e\nGoals: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (tap to tick)\nSessions: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cname\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nTuning: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nExtensions: /skills · /plugins [add|remove] · /soul\nVersions: /update [confirm|on|off|auto] · /subscribe on|off\nOther: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nPanels: /menu — the same commands as buttons, page by page. /menu on puts four keys under the message field.",
|
|
18
18
|
'settings.reply.title': 'What the bot says',
|
|
19
19
|
'settings.agent.title': 'Who answers, and how hard it works',
|
|
20
20
|
'settings.updates.title': 'New releases (this install, not this topic)',
|
|
21
21
|
'settings.health.title': 'If something is off',
|
|
22
22
|
'settings.reasoning.label': 'Working notes',
|
|
23
23
|
'settings.reasoning.hint': 'The 💭 lines: in the progress card, also as messages in the chat, or off.',
|
|
24
|
+
'settings.pin.label': '📌 Pin the progress card',
|
|
25
|
+
'settings.pin.hint': 'Holds the card at the top of the chat while the turn runs, so the numbers are one tap away.',
|
|
24
26
|
'settings.reasoning.chat': 'chat',
|
|
25
27
|
'settings.reasoning.card': 'card',
|
|
26
28
|
'settings.lang.label': 'Reply language',
|
|
@@ -40,6 +42,11 @@ export default {
|
|
|
40
42
|
'settings.set.hint': 'Model, effort, permissions and preset as one named switch.',
|
|
41
43
|
'settings.agents.label': '🕸 Agents',
|
|
42
44
|
'settings.agents.hint': 'Who can be spawned, on which model, with which tools.',
|
|
45
|
+
'settings.cd.label': '📁 Project',
|
|
46
|
+
'settings.cd.hint': 'Which folder this topic works in.',
|
|
47
|
+
'settings.fallback.label': '🔁 Fallback chain',
|
|
48
|
+
'settings.fallback.hint': 'Who answers when a provider refuses, and in what order.',
|
|
49
|
+
'settings.done': '✓ Done',
|
|
43
50
|
'settings.u-late.label': 'New version notices',
|
|
44
51
|
'settings.u-auto.label': 'Auto-install',
|
|
45
52
|
'settings.u-auto.hint': 'With auto on, a release is downloaded by itself; /restart loads it.',
|
|
@@ -62,10 +69,9 @@ export default {
|
|
|
62
69
|
'settings.tab.updates': 'Updates',
|
|
63
70
|
'settings.tab.health': 'Health',
|
|
64
71
|
'settings.u-late.hint': 'One message per new release; turning it off installs nothing and moves nothing.',
|
|
65
|
-
'settings.card.foot': 'A tap changes the setting and
|
|
72
|
+
'settings.card.foot': 'A tap changes the setting and the card stays, redrawn with the new value. "Done" removes it from the chat.',
|
|
66
73
|
'settings.reply.setBound': 'This topic uses set {name}: model, effort, permissions and preset come from it.',
|
|
67
|
-
'settings.card.changed': '
|
|
68
|
-
'settings.card.door': '⌨️ {command} — send it below or press it again',
|
|
74
|
+
'settings.card.changed': '✓ {label}: {value}',
|
|
69
75
|
'settings.card.stale': 'That button is from an older version of the card. Open /settings again.',
|
|
70
76
|
'btn.stop': 'Stop',
|
|
71
77
|
'btn.logs': 'Logs',
|
|
@@ -121,6 +127,11 @@ export default {
|
|
|
121
127
|
'profile.badName': 'Name it with lowercase letters, digits and dashes: /profile new my-space from web',
|
|
122
128
|
'profile.set': 'Topic profile → {name} ({route}). Applies from the next turn.',
|
|
123
129
|
'msg.reasoningState': 'Working notes: {state}. Switch with /reasoning off, /reasoning card or /reasoning chat.',
|
|
130
|
+
'msg.pinOn': 'The progress card is pinned while its turn runs, so one tap brings back the clock, the speed and the steps. The next turn replaces it.',
|
|
131
|
+
'msg.pinOff': 'The progress card stays unpinned.',
|
|
132
|
+
'msg.pinState': 'Progress card pinned: {state}. Switch with /pin on or /pin off.',
|
|
133
|
+
'msg.pinMode.on': 'on',
|
|
134
|
+
'msg.pinMode.off': 'off',
|
|
124
135
|
'prompt.reasoning': 'Working notes: in every turn, 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. Keep the line plain — no markup, no secrets, no paths to credentials — because in chat mode it is also posted as a message of its own. Only a turn that is a single tool call may skip it. When a decision changes what the person should expect — a release shipped, a cause found, a blocker, a turn running long — 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.',
|
|
125
136
|
'prompt.reasoningChat': 'This topic is in chat mode: every 💭 line is also posted to the chat as its own message, so a person reading only the chat sees the steps as they happen. Write each line to stand alone — what changed and why it matters — and never put a secret, a token or a private path in it.',
|
|
126
137
|
'cmd.help.title': 'Commands',
|
package/i18n/en/ctrl.mjs
CHANGED
|
@@ -28,12 +28,13 @@ export default {
|
|
|
28
28
|
'ctrl.help.about.settings': "Every switch on one card with pages: /settings, /settings agent, /settings updates.",
|
|
29
29
|
'ctrl.help.about.lang': "The language of the bot in this topic: /lang en|ru|zh.",
|
|
30
30
|
'ctrl.help.about.reasoning': "Working notes: off, in the progress card, or as messages in the chat — /reasoning off|card|chat.",
|
|
31
|
+
'ctrl.help.about.pin': "Holds the progress card pinned while its turn runs, so the clock and the steps are one tap away — /pin on|off.",
|
|
31
32
|
'ctrl.help.about.doctor': "Checks the install: bridge, network, disk, plugins, session. Run it first when something breaks.",
|
|
32
33
|
'ctrl.help.about.logs': "The bridge log: /logs, /logs 100, /logs errors, /logs file.",
|
|
33
34
|
'ctrl.help.about.app': "The DSH desktop app, not the bridge: /app restart confirm.",
|
|
34
35
|
'ctrl.help.about.restart': "Restarts the bridge: /restart confirm. The DSH app is /app.",
|
|
35
36
|
'ctrl.help.about.help': "This list. /help <command> explains one command.",
|
|
36
|
-
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command
|
|
37
|
+
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command, the card stays, and the answer arrives under it.",
|
|
37
38
|
'ctrl.help.versus': "The line for /{name} in /help:",
|
|
38
39
|
'ctrl.help.unknown': "No command /{name}. The full list: /help",
|
|
39
40
|
'ctrl.menu.title': "What this bot can do",
|
package/i18n/ru/core.mjs
CHANGED
|
@@ -14,13 +14,15 @@ export default {
|
|
|
14
14
|
'settings.state.on': 'вкл',
|
|
15
15
|
'settings.state.off': 'выкл',
|
|
16
16
|
'settings.state.auto': 'авто',
|
|
17
|
-
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
17
|
+
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
18
18
|
'settings.reply.title': 'Что бот говорит',
|
|
19
19
|
'settings.agent.title': 'Кто отвечает и как старается',
|
|
20
20
|
'settings.updates.title': 'Новые версии (эта установка, не тема)',
|
|
21
21
|
'settings.health.title': 'Если что-то не так',
|
|
22
22
|
'settings.reasoning.label': 'Заметки по ходу',
|
|
23
23
|
'settings.reasoning.hint': 'Строки 💭: в карточке прогресса, ещё и сообщениями в чат, или выкл.',
|
|
24
|
+
'settings.pin.label': '📌 Закреплять карточку',
|
|
25
|
+
'settings.pin.hint': 'Держит карточку наверху чата, пока идёт ход: цифры в одно касание.',
|
|
24
26
|
'settings.reasoning.chat': 'в чат',
|
|
25
27
|
'settings.reasoning.card': 'в карточке',
|
|
26
28
|
'settings.lang.label': 'Язык ответов',
|
|
@@ -40,6 +42,11 @@ export default {
|
|
|
40
42
|
'settings.set.hint': 'Модель, усилие, права и пресет одним переключателем.',
|
|
41
43
|
'settings.agents.label': '🕸 Агенты',
|
|
42
44
|
'settings.agents.hint': 'Кого можно порождать, на какой модели, с какими инструментами.',
|
|
45
|
+
'settings.cd.label': '📁 Проект',
|
|
46
|
+
'settings.cd.hint': 'В какой папке работает эта тема.',
|
|
47
|
+
'settings.fallback.label': '🔁 Цепочка подмены',
|
|
48
|
+
'settings.fallback.hint': 'Кто отвечает, когда провайдер отказал, и в каком порядке.',
|
|
49
|
+
'settings.done': '✓ Готово',
|
|
43
50
|
'settings.u-late.label': 'Уведомления о версиях',
|
|
44
51
|
'settings.u-auto.label': 'Автоустановка',
|
|
45
52
|
'settings.u-auto.hint': 'С авто версия скачивается сама; включает её /restart.',
|
|
@@ -62,10 +69,9 @@ export default {
|
|
|
62
69
|
'settings.tab.updates': 'Версии',
|
|
63
70
|
'settings.tab.health': 'Здоровье',
|
|
64
71
|
'settings.u-late.hint': 'Одно сообщение на новую версию; выключение ничего не ставит и ничего не сдвигает.',
|
|
65
|
-
'settings.card.foot': 'Нажатие меняет настройку,
|
|
72
|
+
'settings.card.foot': 'Нажатие меняет настройку, а карточка остаётся и перерисовывается с новым значением. «Готово» убирает её из чата.',
|
|
66
73
|
'settings.reply.setBound': 'Тема использует набор {name}: модель, усилие, права и пресет берутся из него.',
|
|
67
|
-
'settings.card.changed': '
|
|
68
|
-
'settings.card.door': '⌨️ {command} — отправь ниже или нажми ещё раз',
|
|
74
|
+
'settings.card.changed': '✓ {label}: {value}',
|
|
69
75
|
'settings.card.stale': 'Эта кнопка из старой версии карточки. Открой /settings заново.',
|
|
70
76
|
'btn.stop': 'Стоп',
|
|
71
77
|
'btn.logs': 'Логи',
|
|
@@ -121,6 +127,11 @@ export default {
|
|
|
121
127
|
'profile.badName': 'Имя — строчные буквы, цифры и дефис: /profile new my-space from web',
|
|
122
128
|
'profile.set': 'Профиль темы → {name} ({route}). Действует со следующего хода.',
|
|
123
129
|
'msg.reasoningState': 'Заметки по ходу: {state}. Переключить: /reasoning off, /reasoning card или /reasoning chat.',
|
|
130
|
+
'msg.pinOn': 'Карточка прогресса закреплена на время хода: одно касание возвращает часы, скорость и шаги. Следующий ход заменит её.',
|
|
131
|
+
'msg.pinOff': 'Карточка прогресса больше не закрепляется.',
|
|
132
|
+
'msg.pinState': 'Карточка прогресса закреплена: {state}. Переключить: /pin on или /pin off.',
|
|
133
|
+
'msg.pinMode.on': 'да',
|
|
134
|
+
'msg.pinMode.off': 'нет',
|
|
124
135
|
'prompt.reasoning': 'Заметки по ходу: в каждом ходе, на каждом значимом шаге — задача ясна, причина найдена, сейчас изменю рискованное, результат проверен — дописывай одну строку до 90 символов через `node {say} --thought "..."`. Она видна как 💭 в сообщении прогресса: пиши решение, а не пересказ. Строка — простым текстом, без разметки, секретов и путей к ключам: в режиме чата она уходит отдельным сообщением. Пропускать можно только если весь ход — один вызов инструмента. Когда решение меняет то, что человек должен знать сразу — выпущена версия, найдена причина, упёрся в блокер, ход идёт долго — отправь это в чат одной строкой без разметки: `node {say} --note "..."`. В чат — только то, что важно сейчас, не каждый шаг.',
|
|
125
136
|
'prompt.reasoningChat': 'Эта тема в режиме чата: каждая строка 💭 дополнительно уходит в чат отдельным сообщением, поэтому человек, читающий только чат, видит шаги по мере работы. Пиши строку так, чтобы она читалась сама по себе — что изменилось и почему это важно — и никогда не вставляй в неё секрет, токен или приватный путь.',
|
|
126
137
|
'cmd.help.title': 'Команды',
|
package/i18n/ru/ctrl.mjs
CHANGED
|
@@ -28,12 +28,13 @@ export default {
|
|
|
28
28
|
'ctrl.help.about.settings': "Все переключатели одной карточкой по страницам: /settings, /settings agent, /settings updates.",
|
|
29
29
|
'ctrl.help.about.lang': "Язык бота в теме: /lang en|ru|zh.",
|
|
30
30
|
'ctrl.help.about.reasoning': "Заметки о ходе работы: выкл, в карточке прогресса или отдельными сообщениями в чат — /reasoning off|card|chat.",
|
|
31
|
+
'ctrl.help.about.pin': "Держит карточку прогресса закреплённой на время хода, чтобы часы и шаги были в одно касание — /pin on|off.",
|
|
32
|
+
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, карточка остаётся, а ответ приходит под ней.",
|
|
31
33
|
'ctrl.help.about.doctor': "Проверяет установку: мост, сеть, диск, плагины, сессию. С него начинают, когда что-то сломалось.",
|
|
32
34
|
'ctrl.help.about.logs': "Лог моста: /logs, /logs 100, /logs errors, /logs file.",
|
|
33
35
|
'ctrl.help.about.app': "Приложение DSH, не мост: /app restart confirm.",
|
|
34
36
|
'ctrl.help.about.restart': "Перезапускает мост: /restart confirm. Приложение — /app.",
|
|
35
37
|
'ctrl.help.about.help': "Этот список. /help <команда> объясняет одну команду.",
|
|
36
|
-
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, а карточка становится ответом.",
|
|
37
38
|
'ctrl.help.versus': "Строка про /{name} в /help:",
|
|
38
39
|
'ctrl.help.unknown': "Нет команды /{name}. Весь список: /help",
|
|
39
40
|
'ctrl.menu.title': "Что умеет бот",
|
package/i18n/zh/core.mjs
CHANGED
|
@@ -14,13 +14,15 @@ export default {
|
|
|
14
14
|
'settings.state.on': '开',
|
|
15
15
|
'settings.state.off': '关',
|
|
16
16
|
'settings.state.auto': '自动',
|
|
17
|
-
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
17
|
+
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
18
18
|
'settings.reply.title': '机器人怎么说',
|
|
19
19
|
'settings.agent.title': '谁来回答、投入多少',
|
|
20
20
|
'settings.updates.title': '新版本(针对本次安装,而非话题)',
|
|
21
21
|
'settings.health.title': '如果哪里不对',
|
|
22
22
|
'settings.reasoning.label': '过程记录',
|
|
23
23
|
'settings.reasoning.hint': '💭 行:放在进度卡片里、同时发到聊天,或关闭。',
|
|
24
|
+
'settings.pin.label': '📌 置顶进度卡片',
|
|
25
|
+
'settings.pin.hint': '运行期间把卡片固定在聊天顶部,数字一按就到。',
|
|
24
26
|
'settings.reasoning.chat': '发到聊天',
|
|
25
27
|
'settings.reasoning.card': '放在卡片里',
|
|
26
28
|
'settings.lang.label': '回复语言',
|
|
@@ -40,6 +42,11 @@ export default {
|
|
|
40
42
|
'settings.set.hint': '把模型、力度、权限、预设合成一个开关。',
|
|
41
43
|
'settings.agents.label': '🕸 代理',
|
|
42
44
|
'settings.agents.hint': '可以派生子代理、用什么模型、带哪些工具。',
|
|
45
|
+
'settings.cd.label': '📁 项目',
|
|
46
|
+
'settings.cd.hint': '本话题在哪个目录里工作。',
|
|
47
|
+
'settings.fallback.label': '🔁 备用链路',
|
|
48
|
+
'settings.fallback.hint': '供应商拒绝时由谁接手,按什么顺序。',
|
|
49
|
+
'settings.done': '✓ 完成',
|
|
43
50
|
'settings.u-late.label': '新版本提示',
|
|
44
51
|
'settings.u-auto.label': '自动安装',
|
|
45
52
|
'settings.u-auto.hint': '开启后自动下载新版本;/restart 使其生效。',
|
|
@@ -62,10 +69,9 @@ export default {
|
|
|
62
69
|
'settings.tab.updates': '版本',
|
|
63
70
|
'settings.tab.health': '健康',
|
|
64
71
|
'settings.u-late.hint': '每个新版本只发一条;关闭它不安装、不移动任何东西。',
|
|
65
|
-
'settings.card.foot': '
|
|
72
|
+
'settings.card.foot': '点一下即改变设置,卡片会留着并按新值重画。“完成”把卡片从聊天里删掉。',
|
|
66
73
|
'settings.reply.setBound': '本话题使用组合 {name}:模型、力度、权限、预设都来自它。',
|
|
67
|
-
'settings.card.changed': '
|
|
68
|
-
'settings.card.door': '⌨️ {command} — 在下面发送或再点一次',
|
|
74
|
+
'settings.card.changed': '✓ {label}:{value}',
|
|
69
75
|
'settings.card.stale': '这个按钮来自旧版卡片。请重新打开 /settings。',
|
|
70
76
|
'btn.stop': '停止',
|
|
71
77
|
'btn.logs': '日志',
|
|
@@ -121,6 +127,11 @@ export default {
|
|
|
121
127
|
'profile.badName': '名称只能用小写字母、数字和连字符:/profile new my-space from web',
|
|
122
128
|
'profile.set': '话题配置档 → {name}({route})。下一轮生效。',
|
|
123
129
|
'msg.reasoningState': '工作记录:{state}。切换:/reasoning off、/reasoning card 或 /reasoning chat。',
|
|
130
|
+
'msg.pinOn': '进度卡片在本次运行期间置顶:一按就回到时间、速度和步骤。下一次运行会替换它。',
|
|
131
|
+
'msg.pinOff': '进度卡片不再置顶。',
|
|
132
|
+
'msg.pinState': '进度卡片置顶:{state}。切换:/pin on 或 /pin off。',
|
|
133
|
+
'msg.pinMode.on': '开',
|
|
134
|
+
'msg.pinMode.off': '关',
|
|
124
135
|
'prompt.reasoning': '工作记录:每一轮在每个有意义的节点——任务已清楚、原因已找到、即将改动有风险的地方、结果已验证——用 `node {say} --thought "..."` 追加一行,不超过 90 个字符。它会以 💭 出现在进度消息里:写结论,不要复述。这一行要用纯文本,不带标记、不含密钥和凭据路径:在聊天模式下它会单独成一条消息。只有整轮只是一次工具调用时才可以跳过。当某个决定改变对方需要预期的事——版本已发布、找到原因、遇到阻塞、这一轮跑得很久——用一行纯文本发到聊天:`node {say} --note "..."`。聊天里只发此刻重要的内容,不是每一步。',
|
|
125
136
|
'prompt.reasoningChat': '这个会话处于聊天模式:每条 💭 还会单独作为一条消息发到聊天,只看聊天的人也能边跑边看到步骤。每一行都要能独立读懂——改了什么、为什么重要——绝不写入密钥、令牌或私有路径。',
|
|
126
137
|
'cmd.help.title': '命令',
|
package/i18n/zh/ctrl.mjs
CHANGED
|
@@ -28,12 +28,13 @@ export default {
|
|
|
28
28
|
'ctrl.help.about.settings': "所有开关在一张卡片上,分页显示:/settings、/settings agent、/settings updates。",
|
|
29
29
|
'ctrl.help.about.lang': "本话题中机器人的语言:/lang en|ru|zh。",
|
|
30
30
|
'ctrl.help.about.reasoning': "工作记录:关闭、放在进度卡片里,或作为消息发到聊天——/reasoning off|card|chat。",
|
|
31
|
+
'ctrl.help.about.pin': "让进度卡片在本次运行期间保持置顶,时间和步骤一按就到——/pin on|off。",
|
|
31
32
|
'ctrl.help.about.doctor': "检查安装:桥接、网络、磁盘、插件、会话。出问题先跑它。",
|
|
32
33
|
'ctrl.help.about.logs': "桥接日志:/logs、/logs 100、/logs errors、/logs file。",
|
|
33
34
|
'ctrl.help.about.app': "DSH 桌面应用,不是桥接:/app restart confirm。",
|
|
34
35
|
'ctrl.help.about.restart': "重启桥接:/restart confirm。桌面应用用 /app。",
|
|
35
36
|
'ctrl.help.about.help': "这个列表。/help <命令> 解释单个命令。",
|
|
36
|
-
'ctrl.help.about.menu': "
|
|
37
|
+
'ctrl.help.about.menu': "面板:每项工作一个按钮。点击执行命令,卡片留着,回答出现在它下面。",
|
|
37
38
|
'ctrl.help.versus': "/help 中关于 /{name} 的这一行:",
|
|
38
39
|
'ctrl.help.unknown': "没有命令 /{name}。完整列表:/help",
|
|
39
40
|
'ctrl.menu.title': "这个机器人能做什么",
|
package/menu-card.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const SECTIONS = {
|
|
|
18
18
|
work: ['cd', 'seed', 'send'],
|
|
19
19
|
session: ['sessions', 'rewind', 'profile', 'agents'],
|
|
20
20
|
goals: ['goal', 'task', 'tasks', 'plan', 'jobs', 'remind'],
|
|
21
|
-
talk: ['effort', 'reasoning', 'thoughts', 'prices', 'lang', 'fallback'],
|
|
21
|
+
talk: ['effort', 'reasoning', 'pin', 'thoughts', 'prices', 'lang', 'fallback'],
|
|
22
22
|
ext: ['plugins', 'skills', 'soul', 'preset', 'permissions', 'crew'],
|
|
23
23
|
house: ['settings', 'update', 'subscribe', 'doctor', 'logs', 'report', 'restart', 'app', 'help'],
|
|
24
24
|
};
|
package/package.json
CHANGED
package/progress.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import { topicName } from './topics.mjs';
|
|
|
15
15
|
import { t } from './i18n.mjs';
|
|
16
16
|
import { addStep, progressPanel, stepLine } from './panel.mjs';
|
|
17
17
|
import { reasoningMode, thoughtRows } from './notes.mjs';
|
|
18
|
+
import { cardPin } from './settings-card.mjs';
|
|
18
19
|
import { continueKeyboard, errorKeyboard } from './keyboards.mjs';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -188,6 +189,20 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
188
189
|
log(`progress message failed: ${error.message}`);
|
|
189
190
|
}
|
|
190
191
|
|
|
192
|
+
// Pinned on request. Telegram keeps one pinned message per chat and topic, so
|
|
193
|
+
// pinning this card is also what replaces the previous turn's — the slot always
|
|
194
|
+
// holds the turn that is running now, or the numbers of the one that just
|
|
195
|
+
// finished. A pin that lands with a notification reads as an interruption, so
|
|
196
|
+
// it goes silently; a chat where the bot may not pin is not an error either —
|
|
197
|
+
// the card works the same unpinned, and the reason belongs in the log.
|
|
198
|
+
if (messageId && cardPin(state, config, panelKey) === 'on') {
|
|
199
|
+
tg('pinChatMessage', {
|
|
200
|
+
chat_id: chatId,
|
|
201
|
+
message_id: messageId,
|
|
202
|
+
disable_notification: true,
|
|
203
|
+
}).catch((error) => log(`pin failed: ${String(error.message).slice(0, 120)}`));
|
|
204
|
+
}
|
|
205
|
+
|
|
191
206
|
let lastView = '';
|
|
192
207
|
const edit = async (text, keyboard = undefined, view = null) => {
|
|
193
208
|
if (!messageId) return;
|
package/settings-card.mjs
CHANGED
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
* draws — one line per setting, a tap to flip it — and it is deletable, so the
|
|
9
9
|
* history is not a wall of menus.
|
|
10
10
|
*
|
|
11
|
+
* The card stays after a press. An earlier version turned it into one line naming
|
|
12
|
+
* the change, which answered "what did I just do" and took away "what can I do
|
|
13
|
+
* next": the menu vanished the moment it was used, and the way out had to be the
|
|
14
|
+
* person deleting a message by hand. So a press now edits the card in place — same
|
|
15
|
+
* message, same buttons, the new value marked — and the one line saying what
|
|
16
|
+
* changed sits above the rows. Removing it is a button of its own (`✓ Done`),
|
|
17
|
+
* which is the difference between a thing that stays and a thing that traps.
|
|
18
|
+
*
|
|
11
19
|
* Design rule, and the reason this file has no settings logic of its own: a
|
|
12
20
|
* button runs the command a person would have typed. `m:reasoning:on` becomes
|
|
13
21
|
* `/reasoning on` and goes through `handleControl`, so the card cannot validate,
|
|
@@ -38,6 +46,15 @@ const PAGES = {
|
|
|
38
46
|
labels: { card: 'settings.reasoning.card', chat: 'settings.reasoning.chat', off: 'settings.state.off' },
|
|
39
47
|
},
|
|
40
48
|
{ id: 'lang', field: 'lang', values: ['en', 'ru', 'zh'], on: 'auto', command: '/lang {v}', labels: {} },
|
|
49
|
+
// The card that shows the numbers can hold the one pinned slot the chat has,
|
|
50
|
+
// so getting back to it is a tap rather than a scroll back through a turn.
|
|
51
|
+
{
|
|
52
|
+
id: 'pin',
|
|
53
|
+
field: 'pin',
|
|
54
|
+
values: ['on', 'off'],
|
|
55
|
+
command: '/pin {v}',
|
|
56
|
+
labels: { on: 'settings.state.on', off: 'settings.state.off' },
|
|
57
|
+
},
|
|
41
58
|
{ id: 'thoughts', command: '/thoughts' },
|
|
42
59
|
],
|
|
43
60
|
// Who answers and how hard it works. These open the command that owns the
|
|
@@ -50,6 +67,11 @@ const PAGES = {
|
|
|
50
67
|
{ id: 'preset', command: '/preset' },
|
|
51
68
|
{ id: 'set', command: '/agentset' },
|
|
52
69
|
{ id: 'agents', command: '/agents' },
|
|
70
|
+
// The two doors a person reaches for from the chat more often than the rest:
|
|
71
|
+
// which project this topic works in, and what answers when the provider
|
|
72
|
+
// refuses. Both already have a card of their own; the row is just the way in.
|
|
73
|
+
{ id: 'cd', command: '/cd' },
|
|
74
|
+
{ id: 'fallback', command: '/fallback' },
|
|
53
75
|
],
|
|
54
76
|
// New releases: install-wide, so the row is about the install, not the topic.
|
|
55
77
|
updates: [
|
|
@@ -101,6 +123,7 @@ export function settingsButtons({ t, current = {}, updateMode = 'check' }) {
|
|
|
101
123
|
let active = false;
|
|
102
124
|
if (row.field === 'reasoning') active = current.reasoning === value;
|
|
103
125
|
else if (row.field === 'lang') active = current.lang === value;
|
|
126
|
+
else if (row.field === 'pin') active = current.pin === value;
|
|
104
127
|
else if (row.id === 'u-late') active = value === 'on' ? updateMode !== 'off' : updateMode === 'off';
|
|
105
128
|
else if (row.id === 'u-auto') active = updateMode === value;
|
|
106
129
|
buttons.push({
|
|
@@ -128,14 +151,35 @@ export function settingsCurrent({ config = {}, state = {}, key = '' }) {
|
|
|
128
151
|
return {
|
|
129
152
|
reasoning: reasoningMode(state, config, key),
|
|
130
153
|
lang: state.lang?.[key] || 'auto',
|
|
154
|
+
pin: cardPin(state, config, key),
|
|
131
155
|
};
|
|
132
156
|
}
|
|
133
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Is the progress card pinned while its turn runs?
|
|
160
|
+
*
|
|
161
|
+
* Per-topic wins over the install default, and the default is off: pinning
|
|
162
|
+
* somebody's chat uninvited takes the one slot Telegram gives a conversation, and
|
|
163
|
+
* a group needs the right to pin at all. `true`/`false` read as on/off, the way
|
|
164
|
+
* the notes switch migrated.
|
|
165
|
+
*/
|
|
166
|
+
export function cardPin(state, config, key = '') {
|
|
167
|
+
const raw = state?.pin?.[key];
|
|
168
|
+
if (raw === 'on' || raw === 'off') return raw;
|
|
169
|
+
if (raw === true) return 'on';
|
|
170
|
+
if (raw === false) return 'off';
|
|
171
|
+
if (config?.pin === 'on' || config?.pin === true) return 'on';
|
|
172
|
+
return 'off';
|
|
173
|
+
}
|
|
174
|
+
|
|
134
175
|
/** The line above the buttons: what a tap on this row changes it to. */
|
|
135
176
|
function rowLine(button, group, t) {
|
|
136
177
|
if (!button.value) return t('settings.row.action', { label: button.label, hint: button.hint });
|
|
137
178
|
const active = group.find((b) => b.active);
|
|
138
|
-
|
|
179
|
+
// The filled dot is layout, not language, so it is added here: the same mark
|
|
180
|
+
// sits on the button and on the value the card names in words. A person who
|
|
181
|
+
// scans only the text still sees which end is in force.
|
|
182
|
+
const now = active ? `● ${wordFor(active.row, active.value, t)}` : t('settings.notSet');
|
|
139
183
|
const next = group.filter((b) => !b.active && b.value).map((b) => wordFor(b.row, b.value, t)).join(' / ');
|
|
140
184
|
return t('settings.row.toggle', { label: button.label, now, next, hint: button.hint });
|
|
141
185
|
}
|
|
@@ -146,9 +190,12 @@ function rowLine(button, group, t) {
|
|
|
146
190
|
* explanation the commands never had to give, because the person typed them
|
|
147
191
|
* knowing what they do.
|
|
148
192
|
*/
|
|
149
|
-
export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode = 'check', bound = null }) {
|
|
193
|
+
export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode = 'check', bound = null, note = '' }) {
|
|
150
194
|
const buttons = settingsButtons({ t, current, updateMode }).filter((b) => b.page === page);
|
|
151
195
|
const lines = [t(`settings.${page}.title`), ''];
|
|
196
|
+
// What the last tap did, in one line above the rows: the card stays, so the
|
|
197
|
+
// change needs somewhere to be said, and the top is where the eye lands.
|
|
198
|
+
if (note) lines.push(note, '');
|
|
152
199
|
|
|
153
200
|
// One line per row, in the order the rows declare.
|
|
154
201
|
const byId = new Map();
|
|
@@ -168,15 +215,18 @@ export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode
|
|
|
168
215
|
lines.push('', t('settings.card.foot'));
|
|
169
216
|
|
|
170
217
|
// Doors get their own full-width row so they read as actions; switches sit
|
|
171
|
-
// together; tabs last, because they switch the page, not the
|
|
218
|
+
// together; the way out, then tabs last, because they switch the page, not the
|
|
219
|
+
// setting. Only the value in force carries the dot — a card where every option
|
|
220
|
+
// is marked says nothing about which one is on.
|
|
172
221
|
const keyboard = [];
|
|
173
222
|
for (const group of byId.values()) {
|
|
174
223
|
if (!group[0].value) {
|
|
175
224
|
keyboard.push(group.map((b) => ({ text: b.label, data: b.data })));
|
|
176
225
|
continue;
|
|
177
226
|
}
|
|
178
|
-
keyboard.push(group.map((b) => ({ text:
|
|
227
|
+
keyboard.push(group.map((b) => ({ text: b.active ? `● ${wordFor(b.row, b.value, t)}` : wordFor(b.row, b.value, t), data: b.data })));
|
|
179
228
|
}
|
|
229
|
+
keyboard.push([{ text: t('settings.done'), data: `${SET_PREFIX}done` }]);
|
|
180
230
|
keyboard.push(SETTINGS_PAGES.map((p) => ({
|
|
181
231
|
text: p === page ? `— ${t(`settings.tab.${p}`)} —` : t(`settings.tab.${p}`),
|
|
182
232
|
data: `${SET_PREFIX}${p}`,
|
|
@@ -187,8 +237,9 @@ export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode
|
|
|
187
237
|
|
|
188
238
|
/**
|
|
189
239
|
* Turn a button payload into what it stands for: `{ page }` for a tab,
|
|
190
|
-
* `{
|
|
191
|
-
*
|
|
240
|
+
* `{ done: true }` for the way out, `{ command, label, page }` for a setting
|
|
241
|
+
* (what to run, what to call it in the line above the rows, and which page to
|
|
242
|
+
* redraw once it has run).
|
|
192
243
|
*
|
|
193
244
|
* Unknown rows and unknown values answer `null`: a button from a message written
|
|
194
245
|
* before this release is the normal case, not an error, and the caller says so in
|
|
@@ -198,6 +249,9 @@ export function commandFor({ t, current = {}, updateMode = 'check' }, data) {
|
|
|
198
249
|
const text = String(data || '');
|
|
199
250
|
if (!text.startsWith(SET_PREFIX)) return null;
|
|
200
251
|
const [, row, value = ''] = text.split(':');
|
|
252
|
+
// The way out is not a setting: it removes the card, which is the one action
|
|
253
|
+
// the buttons could not do while a press turned the card into a line.
|
|
254
|
+
if (row === 'done' && !value) return { done: true };
|
|
201
255
|
if (SETTINGS_PAGES.includes(row) && !value) return { page: row };
|
|
202
256
|
const button = settingsButtons({ t, current, updateMode }).find((b) => b.id === row && (b.value || '') === value);
|
|
203
257
|
if (!button || !button.command) return null;
|
|
@@ -205,5 +259,8 @@ export function commandFor({ t, current = {}, updateMode = 'check' }, data) {
|
|
|
205
259
|
command: button.command,
|
|
206
260
|
label: button.label,
|
|
207
261
|
value: button.value ? wordFor(button.row, button.value, t) : '',
|
|
262
|
+
// The card is redrawn after the press, and a redraw needs to know which page
|
|
263
|
+
// it is looking at: the payload does not carry it, the row does.
|
|
264
|
+
page: button.page,
|
|
208
265
|
};
|
|
209
266
|
}
|