dsh-tg-bridge 1.16.0 → 1.18.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/bridge.mjs +56 -6
- package/i18n.mjs +134 -131
- package/menu-card.mjs +12 -0
- package/model-probe.mjs +126 -0
- package/package.json +2 -1
- package/rewind.mjs +18 -0
package/bridge.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { createAlbumBuffer } from './albums.mjs';
|
|
|
30
30
|
import { turnArgs } from './cli-args.mjs';
|
|
31
31
|
import { chunk, markdownParts, toPlainText, toTelegramHtml } from './format.mjs';
|
|
32
32
|
import { ensureProfile } from './profiles.mjs';
|
|
33
|
+
import { firstLiveModel, describeVerdicts, probeHint, probeModel } from './model-probe.mjs';
|
|
33
34
|
import { handleControl, CONTROL_COMMANDS, modelOf, modelsOf, reasoningOf } from './control.mjs';
|
|
34
35
|
import { bridgeVersion, installRelease, npmLatestAsync } from './control.mjs';
|
|
35
36
|
import { dueForCheck, updateState } from './update-policy.mjs';
|
|
@@ -47,7 +48,7 @@ import { commandFor, renderSettingsCard, settingsCurrent } from './settings-card
|
|
|
47
48
|
import { answerRewindPress, cutSession, isRewindPress } from './rewind-buttons.mjs';
|
|
48
49
|
import { applyRewind, newestBackup, restoreBackup } from './rewind.mjs';
|
|
49
50
|
import { sessionFile } from './thoughts.mjs';
|
|
50
|
-
import { MENU_PREFIX, commandForName, isMenuPress, renderPanel } from './menu-card.mjs';
|
|
51
|
+
import { MENU_PREFIX, commandForName, isMenuPress, renderPanel, runsUnasked } from './menu-card.mjs';
|
|
51
52
|
|
|
52
53
|
const HOME = homedir();
|
|
53
54
|
const DSH_HOME = process.env.DSH_HOME || join(HOME, '.dsh');
|
|
@@ -1756,10 +1757,24 @@ ${t(lang, 'help.body')}`,
|
|
|
1756
1757
|
// chain as well, otherwise the bridge sits on AUTH 403 and gives up.
|
|
1757
1758
|
const FALLBACK_TRIGGERS = /RATE_LIMIT|503|all providers|нет активности|EMPTY_RESPONSE|TIMEOUT|overloaded|AUTH|403|insufficient_user_quota|quota|UNKNOWN_MODEL|MISSING_CREDENTIAL/i;
|
|
1758
1759
|
const QUOTA_LIKE = /insufficient_user_quota|AUTH\b|\b403\b|\b401\b|quota|balance|баланс|payment|billing/i;
|
|
1760
|
+
// "get_channel_failed / all providers are busy" is the provider's own channel
|
|
1761
|
+
// pool, not the model: when it is down, it is down for every model in the
|
|
1762
|
+
// chain. One probe then answers in seconds what four full turns spent 741
|
|
1763
|
+
// seconds discovering.
|
|
1764
|
+
const CHANNEL_DOWN = /get_channel_failed|all providers|no providers|503/i;
|
|
1759
1765
|
const tried = [];
|
|
1760
1766
|
for (const entry of chain) {
|
|
1761
1767
|
if (!result.error || !FALLBACK_TRIGGERS.test(result.error)) break;
|
|
1762
1768
|
if (!entry.patch || !existsSync(entry.patch)) continue;
|
|
1769
|
+
// The provider's channel pool is down: every model in the chain will answer
|
|
1770
|
+
// the same 503. Ask once, quickly, and say so instead of burning a turn per
|
|
1771
|
+
// model. A probe that DOES answer proves the pool is back — then the chain
|
|
1772
|
+
// goes on, and the fallback at hand is tried as usual.
|
|
1773
|
+
if (tried.length >= 1 && CHANNEL_DOWN.test(result.error)) {
|
|
1774
|
+
const verdict = await probeModel(config.primaryModel || 'deepseek-v4.1-flash-1017');
|
|
1775
|
+
log(`channel down after ${tried.length} model(s): probe says ${verdict.kind}; not trying ${entry.model}`);
|
|
1776
|
+
if (!verdict.ok) break;
|
|
1777
|
+
}
|
|
1763
1778
|
const quotaLike = QUOTA_LIKE.test(result.error);
|
|
1764
1779
|
// Quota failures never deserve a retry of the same model: the balance is
|
|
1765
1780
|
// gone, so waiting is pure loss. Anything else gets one retry at most.
|
|
@@ -1785,13 +1800,41 @@ ${t(lang, 'help.body')}`,
|
|
|
1785
1800
|
});
|
|
1786
1801
|
if (!result.error) break;
|
|
1787
1802
|
}
|
|
1788
|
-
// Every model refused
|
|
1789
|
-
|
|
1790
|
-
|
|
1803
|
+
// Every model refused. Before saying "all models are unavailable", ask each
|
|
1804
|
+
// channel directly with a 1-token request: a 503 storm usually clears within
|
|
1805
|
+
// seconds, and the verdict tells the person whether the balance is gone or the
|
|
1806
|
+
// provider is merely busy — the old message always claimed quota.
|
|
1807
|
+
let probeKind = '';
|
|
1808
|
+
if (result.error && FALLBACK_TRIGGERS.test(result.error)) {
|
|
1809
|
+
const models = [config.primaryModel || 'deepseek-v4.1-flash-1017', ...chain.map((entry) => entry.model)];
|
|
1810
|
+
const { live, verdicts } = await firstLiveModel(models);
|
|
1811
|
+
if (live) {
|
|
1812
|
+
log(`probe: ${live.model} answers after ${verdicts.length} check(s), retrying the turn there`);
|
|
1813
|
+
const entry = chain.find((item) => item.model === live.model);
|
|
1814
|
+
result = await runTurnLive(text, sessionAtStart, key, {
|
|
1815
|
+
onEvent,
|
|
1816
|
+
onAbort: () => killTurn(key),
|
|
1817
|
+
onHeartbeat: () => progress.heartbeat(),
|
|
1818
|
+
profile: entry ? ensureProfile(entry.patch) : turnProfile,
|
|
1819
|
+
cwd,
|
|
1820
|
+
lang,
|
|
1821
|
+
});
|
|
1822
|
+
} else {
|
|
1823
|
+
// Nothing answers: the verdict is the only useful part of the failure.
|
|
1824
|
+
probeKind = describeVerdicts(verdicts);
|
|
1825
|
+
log(`probe: no channel answers (${verdicts.map((v) => `${v.model}:${v.kind}`).join(', ')})`);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
// Every model refused — or the provider's own channel pool was down and the
|
|
1829
|
+
// chain stopped early, which is the same answer to the person: one message
|
|
1830
|
+
// naming the causes, not a cascade of errors.
|
|
1831
|
+
if (result.error && tried.length > 0 && (probeKind || tried.length >= (Array.isArray(config.fallbackModels) ? config.fallbackModels.length : 0))) {
|
|
1832
|
+
log(`all fallbacks exhausted for ${where}: ${tried.length} probe=${probeKind || 'n/a'}`);
|
|
1833
|
+
const verdictLine = probeKind ? `\n${probeHint(probeKind, lang)}` : '';
|
|
1791
1834
|
result = {
|
|
1792
1835
|
sessionId: result.sessionId,
|
|
1793
1836
|
text: '',
|
|
1794
|
-
error: t(lang, 'bridge.fallback.allDown', { list: tried.map((line) => `• ${line}`).join('\n') }),
|
|
1837
|
+
error: t(lang, 'bridge.fallback.allDown', { list: tried.map((line) => `• ${line}`).join('\n') }) + verdictLine,
|
|
1795
1838
|
};
|
|
1796
1839
|
}
|
|
1797
1840
|
// A session opened in the desktop UI holds its write handle, so the CLI
|
|
@@ -1844,6 +1887,9 @@ ${t(lang, 'help.body')}`,
|
|
|
1844
1887
|
await send(chatId, result.text || t(lang, 'bridge.progress.emptyReply'), threadId);
|
|
1845
1888
|
}
|
|
1846
1889
|
|
|
1890
|
+
// `probeHint` lives in model-probe.mjs: this file used it at the call site and
|
|
1891
|
+
// defined it below, and the hint never reached the person.
|
|
1892
|
+
|
|
1847
1893
|
/**
|
|
1848
1894
|
* Turn a raw CLI/provider error into `CODE` plus one actionable line.
|
|
1849
1895
|
*
|
|
@@ -2323,7 +2369,11 @@ async function handleCallback(query) {
|
|
|
2323
2369
|
}
|
|
2324
2370
|
}
|
|
2325
2371
|
await clearKeyboard();
|
|
2326
|
-
|
|
2372
|
+
// `/new` and `/stop` change something when typed alone, and a stray tap on
|
|
2373
|
+
// them is a command nobody asked for — so they open their explanation.
|
|
2374
|
+
const typed = runsUnasked(name) && CONTROL_COMMANDS.includes(name)
|
|
2375
|
+
? commandForName(name, { t: (k, v) => t(lang, k, v) })
|
|
2376
|
+
: `/help ${name}`;
|
|
2327
2377
|
await answer(typed || t(lang, 'bridge.cb.unknown'));
|
|
2328
2378
|
if (!typed) return;
|
|
2329
2379
|
log(`menu press /${name} for ${key}`);
|
package/i18n.mjs
CHANGED
|
@@ -29,49 +29,49 @@ const DICT = {
|
|
|
29
29
|
'settings.state.off': 'off',
|
|
30
30
|
'settings.state.auto': 'auto',
|
|
31
31
|
'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 · /task · /tasks\nSessions: /status · /sessions [n] · /resume \u003cid\u003e · /rewind [n] · /new · /profile \u003cname\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /models · /prices · /thoughts\nTuning: /effort · /permissions · /preset · /agentset [use|show|off|new] · /plan · /jobs · /remind\nExtensions: /skills · /plugins · /plugin add|remove · /soul\nVersions: /version · /update [confirm|on|off|auto] · /subscribe on|offOther: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help\nPanels: /menu — everything below as buttons, gone after one press",
|
|
32
|
-
'ctrl.help.about.status': "Where this topic stands: session, model, effort, running turns. Read-only.",
|
|
33
|
-
'ctrl.help.about.new': "Starts a fresh session in this topic. The old one stays on disk and can be resumed with /resume.",
|
|
34
|
-
'ctrl.help.about.cd': "Binds the topic to a project folder: /cd my-app. Every turn in the topic then runs there.",
|
|
35
|
-
'ctrl.help.about.stop': "Stops the turn that is running in this topic right now (the button under the progress message does the same).",
|
|
36
|
-
'ctrl.help.about.send': "Sends a file from the project into the chat: /send report.pdf.",
|
|
37
|
-
'ctrl.help.about.seed': "Puts the first text into an empty topic and pins it, for topics created before the bot joined.",
|
|
38
|
-
'ctrl.help.about.goal': "The goal of this topic in one line: /goal <text>, /goal done. Tasks live under it.",
|
|
39
|
-
'ctrl.help.about.task': "Adds one task to the list: /task <text>. Draws nothing — the list is /tasks.",
|
|
40
|
-
'ctrl.help.about.tasks': "Shows the task list as buttons; a press closes the task. This is the list, /task is the adding.",
|
|
41
|
-
'ctrl.help.about.sessions': "The sessions of this topic, newest first. Plain text continues the latest one.",
|
|
42
|
-
'ctrl.help.about.resume': "Continues an older session: /resume <id>. The id comes from /sessions.",
|
|
43
|
-
'ctrl.help.about.rewind': "Goes back n turns and lets you rephrase: /rewind 2. Shows a card of what will go and cuts only on the button. /rewind undo puts it back.",
|
|
44
|
-
'ctrl.help.about.profile': "The profile this topic runs on, and how to change it: /profile <name>, /profile new.",
|
|
45
|
-
'ctrl.help.about.agents': "Agents and subagents: who is configured, on which model, and who was actually spawned.",
|
|
46
|
-
'ctrl.help.about.model': "Shows the current model, or switches it: /model, /model <id>. The list of ids is /models.",
|
|
47
|
-
'ctrl.help.about.models': "Every model of the active profile with prices. This is the catalogue, /model is the switch.",
|
|
48
|
-
'ctrl.help.about.prices': "Prices of the models in use, and what the current model costs for the tokens this topic has spent.",
|
|
49
|
-
'ctrl.help.about.thoughts': "The reasoning behind the last turn: text, file or off.",
|
|
50
|
-
'ctrl.help.about.effort': "How hard the model thinks before answering: /effort high.",
|
|
51
|
-
'ctrl.help.about.permissions': "The sandbox and approval preset of the profile.",
|
|
52
|
-
'ctrl.help.about.preset': "The agent preset (persona and tools) of the profile: /preset <id>.",
|
|
53
|
-
'ctrl.help.about.agentset': "A named bundle of model, permissions and preset for this topic, in one switch.",
|
|
54
|
-
'ctrl.help.about.plan': "What plan mode is and how to ask for a plan without any edits.",
|
|
55
|
-
'ctrl.help.about.jobs': "What the bridge is doing right now: active turns and the queue behind them.",
|
|
56
|
-
'ctrl.help.about.remind': "One reminder: /remind +15m text or /remind 09:30 text.",
|
|
57
|
-
'ctrl.help.about.skills': "Installed skills, or the text of one.",
|
|
58
|
-
'ctrl.help.about.plugins': "The plugin list and the changes: /plugins, /plugins add|remove|disable|enable. /plugin is the old spelling of the same command — prefer this one.",
|
|
59
|
-
'ctrl.help.about.plugin': "The old spelling of /plugins, kept so older instructions keep working. It does the same thing; new text always says /plugins and should not mention this one.",
|
|
60
|
-
'ctrl.help.about.soul': "The persona file of the profile: show or set.",
|
|
61
|
-
'ctrl.help.about.version': "The bridge version you run and the latest one on npm.",
|
|
62
|
-
'ctrl.help.about.update': "Updates and their mode: /update, /update on|off|confirm|auto.",
|
|
63
|
-
'ctrl.help.about.subscribe': "Whether this install is announced as a user of the plugin, /subscribe on|off.",
|
|
64
|
-
'ctrl.help.about.settings': "Every switch on one card with pages: /settings, /settings agent, /settings updates.",
|
|
65
|
-
'ctrl.help.about.lang': "The language of the bot in this topic: /lang en|ru|zh.",
|
|
66
|
-
'ctrl.help.about.reasoning': "Working notes in the chat: /reasoning on|off.",
|
|
67
|
-
'ctrl.help.about.doctor': "Checks the install: bridge, network, disk, plugins, session. Run it first when something breaks.",
|
|
68
|
-
'ctrl.help.about.logs': "The bridge log: /logs, /logs 100, /logs errors, /logs file.",
|
|
69
|
-
'ctrl.help.about.app': "The DSH desktop app, not the bridge: /app restart confirm.",
|
|
70
|
-
'ctrl.help.about.restart': "Restarts the bridge: /restart confirm. The DSH app is /app.",
|
|
71
|
-
'ctrl.help.about.help': "This list. /help <command> explains one command.",
|
|
72
|
-
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command and the card becomes the answer.",
|
|
73
|
-
'ctrl.help.versus': "The line for /{name} in /help:",
|
|
74
|
-
'ctrl.help.unknown': "No command /{name}. The full list: /help",
|
|
32
|
+
'ctrl.help.about.status': "Where this topic stands: session, model, effort, running turns. Read-only.",
|
|
33
|
+
'ctrl.help.about.new': "Starts a fresh session in this topic. The old one stays on disk and can be resumed with /resume.",
|
|
34
|
+
'ctrl.help.about.cd': "Binds the topic to a project folder: /cd my-app. Every turn in the topic then runs there.",
|
|
35
|
+
'ctrl.help.about.stop': "Stops the turn that is running in this topic right now (the button under the progress message does the same).",
|
|
36
|
+
'ctrl.help.about.send': "Sends a file from the project into the chat: /send report.pdf.",
|
|
37
|
+
'ctrl.help.about.seed': "Puts the first text into an empty topic and pins it, for topics created before the bot joined.",
|
|
38
|
+
'ctrl.help.about.goal': "The goal of this topic in one line: /goal <text>, /goal done. Tasks live under it.",
|
|
39
|
+
'ctrl.help.about.task': "Adds one task to the list: /task <text>. Draws nothing — the list is /tasks.",
|
|
40
|
+
'ctrl.help.about.tasks': "Shows the task list as buttons; a press closes the task. This is the list, /task is the adding.",
|
|
41
|
+
'ctrl.help.about.sessions': "The sessions of this topic, newest first. Plain text continues the latest one.",
|
|
42
|
+
'ctrl.help.about.resume': "Continues an older session: /resume <id>. The id comes from /sessions.",
|
|
43
|
+
'ctrl.help.about.rewind': "Goes back n turns and lets you rephrase: /rewind 2. Shows a card of what will go and cuts only on the button. /rewind undo puts it back.",
|
|
44
|
+
'ctrl.help.about.profile': "The profile this topic runs on, and how to change it: /profile <name>, /profile new.",
|
|
45
|
+
'ctrl.help.about.agents': "Agents and subagents: who is configured, on which model, and who was actually spawned.",
|
|
46
|
+
'ctrl.help.about.model': "Shows the current model, or switches it: /model, /model <id>. The list of ids is /models.",
|
|
47
|
+
'ctrl.help.about.models': "Every model of the active profile with prices. This is the catalogue, /model is the switch.",
|
|
48
|
+
'ctrl.help.about.prices': "Prices of the models in use, and what the current model costs for the tokens this topic has spent.",
|
|
49
|
+
'ctrl.help.about.thoughts': "The reasoning behind the last turn: text, file or off.",
|
|
50
|
+
'ctrl.help.about.effort': "How hard the model thinks before answering: /effort high.",
|
|
51
|
+
'ctrl.help.about.permissions': "The sandbox and approval preset of the profile.",
|
|
52
|
+
'ctrl.help.about.preset': "The agent preset (persona and tools) of the profile: /preset <id>.",
|
|
53
|
+
'ctrl.help.about.agentset': "A named bundle of model, permissions and preset for this topic, in one switch.",
|
|
54
|
+
'ctrl.help.about.plan': "What plan mode is and how to ask for a plan without any edits.",
|
|
55
|
+
'ctrl.help.about.jobs': "What the bridge is doing right now: active turns and the queue behind them.",
|
|
56
|
+
'ctrl.help.about.remind': "One reminder: /remind +15m text or /remind 09:30 text.",
|
|
57
|
+
'ctrl.help.about.skills': "Installed skills, or the text of one.",
|
|
58
|
+
'ctrl.help.about.plugins': "The plugin list and the changes: /plugins, /plugins add|remove|disable|enable. /plugin is the old spelling of the same command — prefer this one.",
|
|
59
|
+
'ctrl.help.about.plugin': "The old spelling of /plugins, kept so older instructions keep working. It does the same thing; new text always says /plugins and should not mention this one.",
|
|
60
|
+
'ctrl.help.about.soul': "The persona file of the profile: show or set.",
|
|
61
|
+
'ctrl.help.about.version': "The bridge version you run and the latest one on npm.",
|
|
62
|
+
'ctrl.help.about.update': "Updates and their mode: /update, /update on|off|confirm|auto.",
|
|
63
|
+
'ctrl.help.about.subscribe': "Whether this install is announced as a user of the plugin, /subscribe on|off.",
|
|
64
|
+
'ctrl.help.about.settings': "Every switch on one card with pages: /settings, /settings agent, /settings updates.",
|
|
65
|
+
'ctrl.help.about.lang': "The language of the bot in this topic: /lang en|ru|zh.",
|
|
66
|
+
'ctrl.help.about.reasoning': "Working notes in the chat: /reasoning on|off.",
|
|
67
|
+
'ctrl.help.about.doctor': "Checks the install: bridge, network, disk, plugins, session. Run it first when something breaks.",
|
|
68
|
+
'ctrl.help.about.logs': "The bridge log: /logs, /logs 100, /logs errors, /logs file.",
|
|
69
|
+
'ctrl.help.about.app': "The DSH desktop app, not the bridge: /app restart confirm.",
|
|
70
|
+
'ctrl.help.about.restart': "Restarts the bridge: /restart confirm. The DSH app is /app.",
|
|
71
|
+
'ctrl.help.about.help': "This list. /help <command> explains one command.",
|
|
72
|
+
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command and the card becomes the answer.",
|
|
73
|
+
'ctrl.help.versus': "The line for /{name} in /help:",
|
|
74
|
+
'ctrl.help.unknown': "No command /{name}. The full list: /help",
|
|
75
75
|
'ctrl.menu.title': "What this bot can do",
|
|
76
76
|
'ctrl.menu.lead': "Press a button — it runs the command, and this card becomes the answer.",
|
|
77
77
|
'ctrl.menu.foot': "The card does not stay: one press and it is gone. Call it again with /menu.",
|
|
@@ -120,6 +120,7 @@ const DICT = {
|
|
|
120
120
|
'ctrl.rewind.stale': "This button is from an older session — nothing was removed. Run /rewind again.",
|
|
121
121
|
'ctrl.rewind.refused.missing': "The session file is not on disk any more, so there is nothing to cut.",
|
|
122
122
|
'ctrl.rewind.refused.unreadable': "The session file cannot be read right now.",
|
|
123
|
+
'ctrl.rewind.refused.recently-written': "This session was written to in the last half minute — the app may have it open, and a session someone else is writing must not be cut. If a turn is running, /stop it; otherwise wait half a minute and run /rewind again.",
|
|
123
124
|
'ctrl.rewind.refused.tail-incomplete': "The session is being written right now (its last record is incomplete). Wait for the turn to finish and try again.",
|
|
124
125
|
'ctrl.rewind.refused.no-turns': "This session has no turns yet.",
|
|
125
126
|
'ctrl.rewind.refused.bad-steps': "Say how many turns back: /rewind 1, /rewind 2, …",
|
|
@@ -627,49 +628,49 @@ const DICT = {
|
|
|
627
628
|
'settings.state.off': 'выкл',
|
|
628
629
|
'settings.state.auto': 'авто',
|
|
629
630
|
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /task · /tasks\nСессии: /status · /sessions [n] · /resume \u003cid\u003e · /rewind [n] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /models · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /agentset [use|show|off|new] · /plan · /jobs · /remind\nРасширения: /skills · /plugins · /plugin add|remove · /soul\nВерсии: /version · /update [confirm|on|off|auto] · /subscribe on|offПрочее: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help\nПанели: /menu — всё ниже кнопками, исчезает после нажатия",
|
|
630
|
-
'ctrl.help.about.status': "Где тема сейчас: сессия, модель, усилие, идущие ходы. Ничего не меняет.",
|
|
631
|
-
'ctrl.help.about.new': "Начинает новую сессию в теме. Старая остаётся на диске, в неё можно вернуться: /resume.",
|
|
632
|
-
'ctrl.help.about.cd': "Привязывает тему к папке проекта: /cd my-app. Ходы темы идут уже там.",
|
|
633
|
-
'ctrl.help.about.stop': "Останавливает ход, который идёт в теме прямо сейчас (кнопка под сообщением о ходе делает то же).",
|
|
634
|
-
'ctrl.help.about.send': "Присылает файл из проекта в чат: /send report.pdf.",
|
|
635
|
-
'ctrl.help.about.seed': "Кладёт первый текст в пустую тему и закрепляет — для тем, созданных до бота.",
|
|
636
|
-
'ctrl.help.about.goal': "Цель темы одной строкой: /goal <текст>, /goal done. Задачи живут под ней.",
|
|
637
|
-
'ctrl.help.about.task': "Добавляет одну задачу в список: /task <текст>. Ничего не рисует — список это /tasks.",
|
|
638
|
-
'ctrl.help.about.tasks': "Показывает список задач кнопками; нажатие закрывает задачу. Это список, добавляет /task.",
|
|
639
|
-
'ctrl.help.about.sessions': "Сессии темы, новые сверху. Обычный текст продолжает последнюю.",
|
|
640
|
-
'ctrl.help.about.resume': "Продолжает старую сессию: /resume <id>. Идентификатор берётся из /sessions.",
|
|
641
|
-
'ctrl.help.about.rewind': "Откатывает на n ходов и даёт сформулировать иначе: /rewind 2. Показывает карточку того, что уйдёт, и режет только по кнопке. /rewind undo возвращает.",
|
|
642
|
-
'ctrl.help.about.profile': "Профиль, на котором идёт тема, и как его сменить: /profile <имя>, /profile new.",
|
|
643
|
-
'ctrl.help.about.agents': "Агенты и субагенты: кто настроен, на какой модели, кого реально запускали.",
|
|
644
|
-
'ctrl.help.about.model': "Показывает текущую модель или меняет её: /model, /model <id>. Список — /models.",
|
|
645
|
-
'ctrl.help.about.models': "Все модели активного профиля с ценами. Это каталог, переключает /model.",
|
|
646
|
-
'ctrl.help.about.prices': "Цены моделей в работе и во что обходится текущая модель на токенах этой темы.",
|
|
647
|
-
'ctrl.help.about.thoughts': "Рассуждения последнего хода: текстом, файлом или выкл.",
|
|
648
|
-
'ctrl.help.about.effort': "Насколько глубоко модель думает перед ответом: /effort high.",
|
|
649
|
-
'ctrl.help.about.permissions': "Песочница и пресет подтверждений профиля.",
|
|
650
|
-
'ctrl.help.about.preset': "Пресет агента (персона и инструменты) профиля: /preset <id>.",
|
|
651
|
-
'ctrl.help.about.agentset': "Именованный набор «модель + права + пресет» для темы, одним переключателем.",
|
|
652
|
-
'ctrl.help.about.plan': "Что такое режим плана и как попросить план без правок.",
|
|
653
|
-
'ctrl.help.about.jobs': "Что мост делает сейчас: активные ходы и очередь за ними.",
|
|
654
|
-
'ctrl.help.about.remind': "Одно напоминание: /remind +15m текст или /remind 09:30 текст.",
|
|
655
|
-
'ctrl.help.about.skills': "Установленные скиллы или текст одного.",
|
|
656
|
-
'ctrl.help.about.plugins': "Список плагинов и изменения: /plugins, /plugins add|remove|disable|enable. /plugin — старое написание той же команды, лучше эта.",
|
|
657
|
-
'ctrl.help.about.plugin': "Старое написание /plugins, оставлено, чтобы старые инструкции работали. Делает то же; в новых текстах всегда /plugins, а это имя не упоминается.",
|
|
658
|
-
'ctrl.help.about.soul': "Файл персоны профиля: показать или задать.",
|
|
659
|
-
'ctrl.help.about.version': "Версия моста, которая работает, и последняя на npm.",
|
|
660
|
-
'ctrl.help.about.update': "Обновления и их режим: /update, /update on|off|confirm|auto.",
|
|
661
|
-
'ctrl.help.about.subscribe': "Сообщается ли о нас как о пользователе плагина: /subscribe on|off.",
|
|
662
|
-
'ctrl.help.about.settings': "Все переключатели одной карточкой по страницам: /settings, /settings agent, /settings updates.",
|
|
663
|
-
'ctrl.help.about.lang': "Язык бота в теме: /lang en|ru|zh.",
|
|
664
|
-
'ctrl.help.about.reasoning': "Заметки о ходе работы в чате: /reasoning on|off.",
|
|
665
|
-
'ctrl.help.about.doctor': "Проверяет установку: мост, сеть, диск, плагины, сессию. С него начинают, когда что-то сломалось.",
|
|
666
|
-
'ctrl.help.about.logs': "Лог моста: /logs, /logs 100, /logs errors, /logs file.",
|
|
667
|
-
'ctrl.help.about.app': "Приложение DSH, не мост: /app restart confirm.",
|
|
668
|
-
'ctrl.help.about.restart': "Перезапускает мост: /restart confirm. Приложение — /app.",
|
|
669
|
-
'ctrl.help.about.help': "Этот список. /help <команда> объясняет одну команду.",
|
|
670
|
-
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, а карточка становится ответом.",
|
|
671
|
-
'ctrl.help.versus': "Строка про /{name} в /help:",
|
|
672
|
-
'ctrl.help.unknown': "Нет команды /{name}. Весь список: /help",
|
|
631
|
+
'ctrl.help.about.status': "Где тема сейчас: сессия, модель, усилие, идущие ходы. Ничего не меняет.",
|
|
632
|
+
'ctrl.help.about.new': "Начинает новую сессию в теме. Старая остаётся на диске, в неё можно вернуться: /resume.",
|
|
633
|
+
'ctrl.help.about.cd': "Привязывает тему к папке проекта: /cd my-app. Ходы темы идут уже там.",
|
|
634
|
+
'ctrl.help.about.stop': "Останавливает ход, который идёт в теме прямо сейчас (кнопка под сообщением о ходе делает то же).",
|
|
635
|
+
'ctrl.help.about.send': "Присылает файл из проекта в чат: /send report.pdf.",
|
|
636
|
+
'ctrl.help.about.seed': "Кладёт первый текст в пустую тему и закрепляет — для тем, созданных до бота.",
|
|
637
|
+
'ctrl.help.about.goal': "Цель темы одной строкой: /goal <текст>, /goal done. Задачи живут под ней.",
|
|
638
|
+
'ctrl.help.about.task': "Добавляет одну задачу в список: /task <текст>. Ничего не рисует — список это /tasks.",
|
|
639
|
+
'ctrl.help.about.tasks': "Показывает список задач кнопками; нажатие закрывает задачу. Это список, добавляет /task.",
|
|
640
|
+
'ctrl.help.about.sessions': "Сессии темы, новые сверху. Обычный текст продолжает последнюю.",
|
|
641
|
+
'ctrl.help.about.resume': "Продолжает старую сессию: /resume <id>. Идентификатор берётся из /sessions.",
|
|
642
|
+
'ctrl.help.about.rewind': "Откатывает на n ходов и даёт сформулировать иначе: /rewind 2. Показывает карточку того, что уйдёт, и режет только по кнопке. /rewind undo возвращает.",
|
|
643
|
+
'ctrl.help.about.profile': "Профиль, на котором идёт тема, и как его сменить: /profile <имя>, /profile new.",
|
|
644
|
+
'ctrl.help.about.agents': "Агенты и субагенты: кто настроен, на какой модели, кого реально запускали.",
|
|
645
|
+
'ctrl.help.about.model': "Показывает текущую модель или меняет её: /model, /model <id>. Список — /models.",
|
|
646
|
+
'ctrl.help.about.models': "Все модели активного профиля с ценами. Это каталог, переключает /model.",
|
|
647
|
+
'ctrl.help.about.prices': "Цены моделей в работе и во что обходится текущая модель на токенах этой темы.",
|
|
648
|
+
'ctrl.help.about.thoughts': "Рассуждения последнего хода: текстом, файлом или выкл.",
|
|
649
|
+
'ctrl.help.about.effort': "Насколько глубоко модель думает перед ответом: /effort high.",
|
|
650
|
+
'ctrl.help.about.permissions': "Песочница и пресет подтверждений профиля.",
|
|
651
|
+
'ctrl.help.about.preset': "Пресет агента (персона и инструменты) профиля: /preset <id>.",
|
|
652
|
+
'ctrl.help.about.agentset': "Именованный набор «модель + права + пресет» для темы, одним переключателем.",
|
|
653
|
+
'ctrl.help.about.plan': "Что такое режим плана и как попросить план без правок.",
|
|
654
|
+
'ctrl.help.about.jobs': "Что мост делает сейчас: активные ходы и очередь за ними.",
|
|
655
|
+
'ctrl.help.about.remind': "Одно напоминание: /remind +15m текст или /remind 09:30 текст.",
|
|
656
|
+
'ctrl.help.about.skills': "Установленные скиллы или текст одного.",
|
|
657
|
+
'ctrl.help.about.plugins': "Список плагинов и изменения: /plugins, /plugins add|remove|disable|enable. /plugin — старое написание той же команды, лучше эта.",
|
|
658
|
+
'ctrl.help.about.plugin': "Старое написание /plugins, оставлено, чтобы старые инструкции работали. Делает то же; в новых текстах всегда /plugins, а это имя не упоминается.",
|
|
659
|
+
'ctrl.help.about.soul': "Файл персоны профиля: показать или задать.",
|
|
660
|
+
'ctrl.help.about.version': "Версия моста, которая работает, и последняя на npm.",
|
|
661
|
+
'ctrl.help.about.update': "Обновления и их режим: /update, /update on|off|confirm|auto.",
|
|
662
|
+
'ctrl.help.about.subscribe': "Сообщается ли о нас как о пользователе плагина: /subscribe on|off.",
|
|
663
|
+
'ctrl.help.about.settings': "Все переключатели одной карточкой по страницам: /settings, /settings agent, /settings updates.",
|
|
664
|
+
'ctrl.help.about.lang': "Язык бота в теме: /lang en|ru|zh.",
|
|
665
|
+
'ctrl.help.about.reasoning': "Заметки о ходе работы в чате: /reasoning on|off.",
|
|
666
|
+
'ctrl.help.about.doctor': "Проверяет установку: мост, сеть, диск, плагины, сессию. С него начинают, когда что-то сломалось.",
|
|
667
|
+
'ctrl.help.about.logs': "Лог моста: /logs, /logs 100, /logs errors, /logs file.",
|
|
668
|
+
'ctrl.help.about.app': "Приложение DSH, не мост: /app restart confirm.",
|
|
669
|
+
'ctrl.help.about.restart': "Перезапускает мост: /restart confirm. Приложение — /app.",
|
|
670
|
+
'ctrl.help.about.help': "Этот список. /help <команда> объясняет одну команду.",
|
|
671
|
+
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, а карточка становится ответом.",
|
|
672
|
+
'ctrl.help.versus': "Строка про /{name} в /help:",
|
|
673
|
+
'ctrl.help.unknown': "Нет команды /{name}. Весь список: /help",
|
|
673
674
|
'ctrl.menu.title': "Что умеет бот",
|
|
674
675
|
'ctrl.menu.lead': "Нажми — выполнится команда, а эта карточка станет ответом.",
|
|
675
676
|
'ctrl.menu.foot': "Карточка не остаётся: одно нажатие — и её нет. Вызвать снова: /menu.",
|
|
@@ -718,6 +719,7 @@ const DICT = {
|
|
|
718
719
|
'ctrl.rewind.stale': "Эта кнопка от другой сессии — ничего не удалено. Повтори /rewind.",
|
|
719
720
|
'ctrl.rewind.refused.missing': "Файла сессии уже нет на диске — резать нечего.",
|
|
720
721
|
'ctrl.rewind.refused.unreadable': "Файл сессии сейчас не читается.",
|
|
722
|
+
'ctrl.rewind.refused.recently-written': "В эту сессию писали последние полминуты — возможно, она открыта в приложении, а сессию, которую кто-то пишет, резать нельзя. Если идёт ход — /stop; иначе подожди полминуты и повтори /rewind.",
|
|
721
723
|
'ctrl.rewind.refused.tail-incomplete': "Сессия пишется прямо сейчас (последняя запись недописана). Дождись конца хода и повтори.",
|
|
722
724
|
'ctrl.rewind.refused.no-turns': "В этой сессии ещё нет ходов.",
|
|
723
725
|
'ctrl.rewind.refused.bad-steps': "Назови, на сколько ходов назад: /rewind 1, /rewind 2, …",
|
|
@@ -1225,49 +1227,49 @@ const DICT = {
|
|
|
1225
1227
|
'settings.state.off': '关',
|
|
1226
1228
|
'settings.state.auto': '自动',
|
|
1227
1229
|
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /task · /tasks\n会话: /status · /sessions [n] · /resume \u003cid\u003e · /rewind [n] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /models · /prices · /thoughts\n调优: /effort · /permissions · /preset · /agentset [use|show|off|new] · /plan · /jobs · /remind\n扩展: /skills · /plugins · /plugin add|remove · /soul\n版本: /version · /update [confirm|on|off|auto] · /subscribe on|off其他: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help\n面板: /menu — 下列全部做成按钮,按一下就消失",
|
|
1228
|
-
'ctrl.help.about.status': "本话题的状态:会话、模型、力度、进行中的轮次。不改变任何东西。",
|
|
1229
|
-
'ctrl.help.about.new': "在本话题开始新会话。旧的留在磁盘上,可用 /resume 回来。",
|
|
1230
|
-
'ctrl.help.about.cd': "把话题绑定到项目文件夹:/cd my-app。之后本话题的轮次都在那里执行。",
|
|
1231
|
-
'ctrl.help.about.stop': "停止本话题正在进行的轮次(进度消息下的按钮效果相同)。",
|
|
1232
|
-
'ctrl.help.about.send': "把项目中的文件发到聊天:/send report.pdf。",
|
|
1233
|
-
'ctrl.help.about.seed': "为空话题写入首段文本并置顶,适用于机器人加入前创建的话题。",
|
|
1234
|
-
'ctrl.help.about.goal': "用一行说明本话题的目标:/goal <文本>、/goal done。任务在其下。",
|
|
1235
|
-
'ctrl.help.about.task': "向清单添加一条任务:/task <文本>。不绘制任何内容——清单是 /tasks。",
|
|
1236
|
-
'ctrl.help.about.tasks': "用按钮显示任务清单,点击即完成。这是清单,/task 才是添加。",
|
|
1237
|
-
'ctrl.help.about.sessions': "本话题的会话,最新的在前。直接发文字会延续最近的会话。",
|
|
1238
|
-
'ctrl.help.about.resume': "继续较早的会话:/resume <id>。编号来自 /sessions。",
|
|
1239
|
-
'ctrl.help.about.rewind': "回退 n 轮并换种说法:/rewind 2。先显示将移除内容的卡片,只有按按钮才裁切。/rewind undo 可恢复。",
|
|
1240
|
-
'ctrl.help.about.profile': "本话题使用的配置档,以及如何更换:/profile <名称>、/profile new。",
|
|
1241
|
-
'ctrl.help.about.agents': "智能体与子智能体:配置了谁、用什么模型、实际启动了谁。",
|
|
1242
|
-
'ctrl.help.about.model': "显示当前模型或切换:/model、/model <id>。编号列表是 /models。",
|
|
1243
|
-
'ctrl.help.about.models': "当前配置档的全部模型与价格。这是目录,切换用 /model。",
|
|
1244
|
-
'ctrl.help.about.prices': "在用模型的价格,以及当前模型花掉本话题令牌的费用。",
|
|
1245
|
-
'ctrl.help.about.thoughts': "上一轮的推理:文本、文件或关闭。",
|
|
1246
|
-
'ctrl.help.about.effort': "模型回答前的思考深度:/effort high。",
|
|
1247
|
-
'ctrl.help.about.permissions': "配置档的沙箱与确认预设。",
|
|
1248
|
-
'ctrl.help.about.preset': "配置档的智能体预设(人格与工具):/preset <id>。",
|
|
1249
|
-
'ctrl.help.about.agentset': "本话题的命名组合:模型、权限、预设,一个开关。",
|
|
1250
|
-
'ctrl.help.about.plan': "计划模式是什么,以及如何只要计划、不做修改。",
|
|
1251
|
-
'ctrl.help.about.jobs': "桥接器当前在做什么:进行中的轮次与排队的。",
|
|
1252
|
-
'ctrl.help.about.remind': "一条提醒:/remind +15m 文本 或 /remind 09:30 文本。",
|
|
1253
|
-
'ctrl.help.about.skills': "已安装的技能,或某个技能的内容。",
|
|
1254
|
-
'ctrl.help.about.plugins': "插件列表与修改:/plugins、/plugins add|remove|disable|enable。/plugin 是同一命令的旧写法,建议用这个。",
|
|
1255
|
-
'ctrl.help.about.plugin': "/plugins 的旧写法,为兼容旧说明而保留。作用相同;新文本一律写 /plugins,不提及此名。",
|
|
1256
|
-
'ctrl.help.about.soul': "配置档的人格文件:查看或设置。",
|
|
1257
|
-
'ctrl.help.about.version': "正在运行的桥接版本,以及 npm 上的最新版本。",
|
|
1258
|
-
'ctrl.help.about.update': "更新及其模式:/update、/update on|off|confirm|auto。",
|
|
1259
|
-
'ctrl.help.about.subscribe': "是否公开本安装为该插件的使用者:/subscribe on|off。",
|
|
1260
|
-
'ctrl.help.about.settings': "所有开关在一张卡片上,分页显示:/settings、/settings agent、/settings updates。",
|
|
1261
|
-
'ctrl.help.about.lang': "本话题中机器人的语言:/lang en|ru|zh。",
|
|
1262
|
-
'ctrl.help.about.reasoning': "聊天中的工作备注:/reasoning on|off。",
|
|
1263
|
-
'ctrl.help.about.doctor': "检查安装:桥接、网络、磁盘、插件、会话。出问题先跑它。",
|
|
1264
|
-
'ctrl.help.about.logs': "桥接日志:/logs、/logs 100、/logs errors、/logs file。",
|
|
1265
|
-
'ctrl.help.about.app': "DSH 桌面应用,不是桥接:/app restart confirm。",
|
|
1266
|
-
'ctrl.help.about.restart': "重启桥接:/restart confirm。桌面应用用 /app。",
|
|
1267
|
-
'ctrl.help.about.help': "这个列表。/help <命令> 解释单个命令。",
|
|
1268
|
-
'ctrl.help.about.menu': "面板:每项工作一个按钮。点击执行命令,卡片随即变成回答。",
|
|
1269
|
-
'ctrl.help.versus': "/help 中关于 /{name} 的这一行:",
|
|
1270
|
-
'ctrl.help.unknown': "没有命令 /{name}。完整列表:/help",
|
|
1230
|
+
'ctrl.help.about.status': "本话题的状态:会话、模型、力度、进行中的轮次。不改变任何东西。",
|
|
1231
|
+
'ctrl.help.about.new': "在本话题开始新会话。旧的留在磁盘上,可用 /resume 回来。",
|
|
1232
|
+
'ctrl.help.about.cd': "把话题绑定到项目文件夹:/cd my-app。之后本话题的轮次都在那里执行。",
|
|
1233
|
+
'ctrl.help.about.stop': "停止本话题正在进行的轮次(进度消息下的按钮效果相同)。",
|
|
1234
|
+
'ctrl.help.about.send': "把项目中的文件发到聊天:/send report.pdf。",
|
|
1235
|
+
'ctrl.help.about.seed': "为空话题写入首段文本并置顶,适用于机器人加入前创建的话题。",
|
|
1236
|
+
'ctrl.help.about.goal': "用一行说明本话题的目标:/goal <文本>、/goal done。任务在其下。",
|
|
1237
|
+
'ctrl.help.about.task': "向清单添加一条任务:/task <文本>。不绘制任何内容——清单是 /tasks。",
|
|
1238
|
+
'ctrl.help.about.tasks': "用按钮显示任务清单,点击即完成。这是清单,/task 才是添加。",
|
|
1239
|
+
'ctrl.help.about.sessions': "本话题的会话,最新的在前。直接发文字会延续最近的会话。",
|
|
1240
|
+
'ctrl.help.about.resume': "继续较早的会话:/resume <id>。编号来自 /sessions。",
|
|
1241
|
+
'ctrl.help.about.rewind': "回退 n 轮并换种说法:/rewind 2。先显示将移除内容的卡片,只有按按钮才裁切。/rewind undo 可恢复。",
|
|
1242
|
+
'ctrl.help.about.profile': "本话题使用的配置档,以及如何更换:/profile <名称>、/profile new。",
|
|
1243
|
+
'ctrl.help.about.agents': "智能体与子智能体:配置了谁、用什么模型、实际启动了谁。",
|
|
1244
|
+
'ctrl.help.about.model': "显示当前模型或切换:/model、/model <id>。编号列表是 /models。",
|
|
1245
|
+
'ctrl.help.about.models': "当前配置档的全部模型与价格。这是目录,切换用 /model。",
|
|
1246
|
+
'ctrl.help.about.prices': "在用模型的价格,以及当前模型花掉本话题令牌的费用。",
|
|
1247
|
+
'ctrl.help.about.thoughts': "上一轮的推理:文本、文件或关闭。",
|
|
1248
|
+
'ctrl.help.about.effort': "模型回答前的思考深度:/effort high。",
|
|
1249
|
+
'ctrl.help.about.permissions': "配置档的沙箱与确认预设。",
|
|
1250
|
+
'ctrl.help.about.preset': "配置档的智能体预设(人格与工具):/preset <id>。",
|
|
1251
|
+
'ctrl.help.about.agentset': "本话题的命名组合:模型、权限、预设,一个开关。",
|
|
1252
|
+
'ctrl.help.about.plan': "计划模式是什么,以及如何只要计划、不做修改。",
|
|
1253
|
+
'ctrl.help.about.jobs': "桥接器当前在做什么:进行中的轮次与排队的。",
|
|
1254
|
+
'ctrl.help.about.remind': "一条提醒:/remind +15m 文本 或 /remind 09:30 文本。",
|
|
1255
|
+
'ctrl.help.about.skills': "已安装的技能,或某个技能的内容。",
|
|
1256
|
+
'ctrl.help.about.plugins': "插件列表与修改:/plugins、/plugins add|remove|disable|enable。/plugin 是同一命令的旧写法,建议用这个。",
|
|
1257
|
+
'ctrl.help.about.plugin': "/plugins 的旧写法,为兼容旧说明而保留。作用相同;新文本一律写 /plugins,不提及此名。",
|
|
1258
|
+
'ctrl.help.about.soul': "配置档的人格文件:查看或设置。",
|
|
1259
|
+
'ctrl.help.about.version': "正在运行的桥接版本,以及 npm 上的最新版本。",
|
|
1260
|
+
'ctrl.help.about.update': "更新及其模式:/update、/update on|off|confirm|auto。",
|
|
1261
|
+
'ctrl.help.about.subscribe': "是否公开本安装为该插件的使用者:/subscribe on|off。",
|
|
1262
|
+
'ctrl.help.about.settings': "所有开关在一张卡片上,分页显示:/settings、/settings agent、/settings updates。",
|
|
1263
|
+
'ctrl.help.about.lang': "本话题中机器人的语言:/lang en|ru|zh。",
|
|
1264
|
+
'ctrl.help.about.reasoning': "聊天中的工作备注:/reasoning on|off。",
|
|
1265
|
+
'ctrl.help.about.doctor': "检查安装:桥接、网络、磁盘、插件、会话。出问题先跑它。",
|
|
1266
|
+
'ctrl.help.about.logs': "桥接日志:/logs、/logs 100、/logs errors、/logs file。",
|
|
1267
|
+
'ctrl.help.about.app': "DSH 桌面应用,不是桥接:/app restart confirm。",
|
|
1268
|
+
'ctrl.help.about.restart': "重启桥接:/restart confirm。桌面应用用 /app。",
|
|
1269
|
+
'ctrl.help.about.help': "这个列表。/help <命令> 解释单个命令。",
|
|
1270
|
+
'ctrl.help.about.menu': "面板:每项工作一个按钮。点击执行命令,卡片随即变成回答。",
|
|
1271
|
+
'ctrl.help.versus': "/help 中关于 /{name} 的这一行:",
|
|
1272
|
+
'ctrl.help.unknown': "没有命令 /{name}。完整列表:/help",
|
|
1271
1273
|
'ctrl.menu.title': "这个机器人能做什么",
|
|
1272
1274
|
'ctrl.menu.lead': "按一下就会执行命令,这张卡片随即变成回答。",
|
|
1273
1275
|
'ctrl.menu.foot': "卡片不会留下:按一下就消失。再调出用 /menu。",
|
|
@@ -1315,9 +1317,10 @@ const DICT = {
|
|
|
1315
1317
|
'ctrl.rewind.failed': "没有删除任何内容:{error}",
|
|
1316
1318
|
'ctrl.rewind.stale': "这个按钮来自另一个会话——没有删除任何内容。请重新执行 /rewind。",
|
|
1317
1319
|
'ctrl.rewind.refused.missing': "会话文件已不在磁盘上,没有可裁剪的内容。",
|
|
1318
|
-
'ctrl.rewind.refused.unreadable': "
|
|
1320
|
+
'ctrl.rewind.refused.unreadable': "会话文件当前无法读取,不知道里面有什么,所以先不动它。",
|
|
1321
|
+
'ctrl.rewind.refused.recently-written': "最近半分钟内这个会话被写入过——它可能正被应用打开,而正在被写入的会话不能裁切。如果有轮次在进行,请 /stop;否则等半分钟再执行 /rewind。",
|
|
1319
1322
|
'ctrl.rewind.refused.tail-incomplete': "会话正在写入(最后一条记录未完成)。等这一轮结束再试。",
|
|
1320
|
-
'ctrl.rewind.refused.no-turns': "
|
|
1323
|
+
'ctrl.rewind.refused.no-turns': "这个会话还没有任何轮次,删掉就没有可继续的内容了。",
|
|
1321
1324
|
'ctrl.rewind.refused.bad-steps': "请说明回退几轮:/rewind 1、/rewind 2……",
|
|
1322
1325
|
'ctrl.rewind.refused.too-many-steps': "本会话共有 {total} 轮;回退 {dropped} 轮将没有可继续的内容。需要全新的会话请用 /new。",
|
|
1323
1326
|
'ctrl.rewind.refused.would-leave-open-turn': "会话边界不在轮次结束处;没有删除任何内容。",
|
package/menu-card.mjs
CHANGED
|
@@ -69,4 +69,16 @@ export function commandForName(name, { t }) {
|
|
|
69
69
|
const bare = ['cd', 'resume', 'seed', 'send', 'effort', 'logs', 'rewind'];
|
|
70
70
|
if (bare.includes(name)) return `/help ${name}`;
|
|
71
71
|
return `/${name}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Whether `/menu` done alone would change something. Almost every command only
|
|
76
|
+
* reports what is already true; `new` and `stop` do not, and a stray tap on them
|
|
77
|
+
* would be a command nobody asked for. Those open their explanation instead.
|
|
78
|
+
*/
|
|
79
|
+
const CHANGES_ALONE = ['new', 'stop'];
|
|
80
|
+
|
|
81
|
+
/** Whether a press labelled `name`, tapped on its own, is safe to run. */
|
|
82
|
+
export function runsUnasked(name) {
|
|
83
|
+
return !CHANGES_ALONE.includes(name);
|
|
72
84
|
}
|
package/model-probe.mjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Live model probe.
|
|
2
|
+
//
|
|
3
|
+
// A turn that ends with "all models are unavailable" is useless on its own: the
|
|
4
|
+
// person cannot tell an exhausted balance from a provider that is merely busy,
|
|
5
|
+
// and the bridge used to burn 12 minutes before saying it. One tiny request per
|
|
6
|
+
// channel answers that question in seconds, and a channel that answers can be
|
|
7
|
+
// used for one more attempt instead of giving up.
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
const DSH_HOME = process.env.DSH_HOME || join(homedir(), '.dsh');
|
|
13
|
+
const CRED = join(DSH_HOME, '.credentials.yaml');
|
|
14
|
+
const BASE = process.env.UNOROUTER_BASE_URL || 'https://api.unorouter.com/v1';
|
|
15
|
+
|
|
16
|
+
function secret(name) {
|
|
17
|
+
const fromEnv = (process.env[name] || '').trim();
|
|
18
|
+
if (fromEnv) return fromEnv;
|
|
19
|
+
try {
|
|
20
|
+
const yaml = readFileSync(CRED, 'utf8');
|
|
21
|
+
const m = yaml.match(new RegExp(`^\\s*${name}:\\s*["']?([^"'\\s]+)`, 'm'));
|
|
22
|
+
return m ? m[1] : '';
|
|
23
|
+
} catch {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Classify a provider answer into something the chat can act on. */
|
|
29
|
+
function classify(status, body) {
|
|
30
|
+
const text = String(body || '');
|
|
31
|
+
if (status === 200) return 'ok';
|
|
32
|
+
if (/insufficient_user_quota|balance|billing|payment/i.test(text)) return 'balance';
|
|
33
|
+
if (/get_channel_failed|all providers|rate limit|busy/i.test(text)) return 'busy';
|
|
34
|
+
if (status === 401 || status === 403) return 'auth';
|
|
35
|
+
if (status === 404) return 'missing';
|
|
36
|
+
return 'other';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* One 1-token completion. `ok` means the channel really answers for this
|
|
41
|
+
* account right now — not just that the name exists.
|
|
42
|
+
*/
|
|
43
|
+
async function probeModel(model, { timeoutMs = 15000 } = {}) {
|
|
44
|
+
const key = secret('UNOROUTER_API_KEY');
|
|
45
|
+
if (!key) return { model, ok: false, kind: 'auth', detail: 'UNOROUTER_API_KEY is missing' };
|
|
46
|
+
const controller = new AbortController();
|
|
47
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
48
|
+
try {
|
|
49
|
+
const response = await fetch(`${BASE}/chat/completions`, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
headers: { Authorization: `Bearer ${key}`, 'Content-Type': 'application/json' },
|
|
52
|
+
body: JSON.stringify({ model, messages: [{ role: 'user', content: 'ping' }], max_tokens: 1, stream: false }),
|
|
53
|
+
signal: controller.signal,
|
|
54
|
+
});
|
|
55
|
+
const body = await response.text();
|
|
56
|
+
const kind = classify(response.status, body);
|
|
57
|
+
return {
|
|
58
|
+
model,
|
|
59
|
+
ok: kind === 'ok',
|
|
60
|
+
kind,
|
|
61
|
+
status: response.status,
|
|
62
|
+
detail: kind === 'ok' ? '' : body.slice(0, 200),
|
|
63
|
+
};
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return { model, ok: false, kind: 'network', detail: String(error?.message ?? error) };
|
|
66
|
+
} finally {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** First channel that answers, or null. Probes run in order, so the cheapest wins. */
|
|
72
|
+
async function firstLiveModel(models) {
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
const verdicts = [];
|
|
75
|
+
for (const model of models) {
|
|
76
|
+
if (!model || seen.has(model)) continue;
|
|
77
|
+
seen.add(model);
|
|
78
|
+
const verdict = await probeModel(model);
|
|
79
|
+
verdicts.push(verdict);
|
|
80
|
+
if (verdict.ok) return { live: verdict, verdicts };
|
|
81
|
+
}
|
|
82
|
+
return { live: null, verdicts };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Short human line for the failure message: what is actually wrong. */
|
|
86
|
+
function describeVerdicts(verdicts) {
|
|
87
|
+
const kinds = new Set(verdicts.map((v) => v.kind));
|
|
88
|
+
if (kinds.has('balance')) return 'balance';
|
|
89
|
+
if (kinds.has('busy')) return 'busy';
|
|
90
|
+
if (kinds.has('auth')) return 'auth';
|
|
91
|
+
if (kinds.has('network')) return 'network';
|
|
92
|
+
return 'unknown';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* What to tell the person once the probe has a verdict. The old version glued
|
|
97
|
+
* the verdict onto a raw provider string, and the message opened with the tail
|
|
98
|
+
* of an English error ("...balance" + "in"). The verdict is the message.
|
|
99
|
+
*/
|
|
100
|
+
function probeHint(kind, lang = 'ru') {
|
|
101
|
+
const text = {
|
|
102
|
+
balance: {
|
|
103
|
+
ru: 'Баланс провайдера пуст: проба вернула 403 «недостаточно средств». Пополни счёт или переключись на free-модель через /model.',
|
|
104
|
+
en: 'The provider balance is empty: the probe got a 403 "insufficient funds". Top up, or switch to a free model with /model.',
|
|
105
|
+
zh: '提供商余额为空:探测返回 403「余额不足」。请充值,或用 /model 切换到免费模型。',
|
|
106
|
+
},
|
|
107
|
+
busy: {
|
|
108
|
+
ru: 'Провайдер перегружен: все каналы отдают 503. Это не баланс — повтори через пару минут.',
|
|
109
|
+
en: 'The provider is overloaded: every channel answers 503. Not a balance problem — try again in a few minutes.',
|
|
110
|
+
zh: '提供商过载:所有通道都返回 503。不是余额问题——过几分钟再试。',
|
|
111
|
+
},
|
|
112
|
+
auth: {
|
|
113
|
+
ru: 'Ключ не принят: провайдер вернул 401/403. Проверь ~/.dsh/.credentials.yaml.',
|
|
114
|
+
en: 'The key was rejected: the provider answered 401/403. Check ~/.dsh/.credentials.yaml.',
|
|
115
|
+
zh: '密钥未被接受:提供商返回 401/403。请检查 ~/.dsh/.credentials.yaml。',
|
|
116
|
+
},
|
|
117
|
+
network: {
|
|
118
|
+
ru: 'Сеть не отвечает: проба не достучалась до провайдера. Проверь VPN и IPv4.',
|
|
119
|
+
en: 'The network does not answer: the probe could not reach the provider. Check VPN and IPv4.',
|
|
120
|
+
zh: '网络无响应:探测无法连接提供商。请检查 VPN 和 IPv4。',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return text[kind]?.[lang] ?? text[kind]?.ru ?? '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { probeModel, firstLiveModel, describeVerdicts, probeHint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tg-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Telegram bridge for DeepSeek Harness: text, voice, photos and project-per-topic sessions without opening the desktop app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "plugin-bridge.mjs",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"steer-queue.mjs",
|
|
79
79
|
"plugin/",
|
|
80
80
|
"profiles.mjs",
|
|
81
|
+
"model-probe.mjs",
|
|
81
82
|
"aset-profile.mjs",
|
|
82
83
|
"aset-schema.mjs",
|
|
83
84
|
"aset-job.mjs",
|
package/rewind.mjs
CHANGED
|
@@ -99,6 +99,15 @@ export function recentTurns(file, { limit = 8 } = {}) {
|
|
|
99
99
|
return turns.slice(-limit).reverse();
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/** Every reason a cut can be refused. Each one has words in every language. */
|
|
103
|
+
const REFUSAL_REASONS = [
|
|
104
|
+
'missing', 'unreadable', 'recently-written', 'tail-incomplete', 'no-turns', 'bad-steps', 'too-many-steps', 'would-leave-open-turn',
|
|
105
|
+
];
|
|
106
|
+
export { REFUSAL_REASONS };
|
|
107
|
+
|
|
108
|
+
/** How fresh a write must be for the file to count as in use. */
|
|
109
|
+
const RECENT_WRITE_MS = 30_000;
|
|
110
|
+
|
|
102
111
|
/**
|
|
103
112
|
* Where to cut so that the last `steps` turns are gone and everything before
|
|
104
113
|
* them is untouched.
|
|
@@ -118,6 +127,15 @@ export function planRewind(file, steps = 1) {
|
|
|
118
127
|
return { ...plan, reason: 'unreadable' };
|
|
119
128
|
}
|
|
120
129
|
plan.size = size;
|
|
130
|
+
// A file written in the last half minute may be held open by another process
|
|
131
|
+
// (the desktop app keeps a write handle for a session it has open) even when
|
|
132
|
+
// no bridge turn runs. DSH then refuses with "stored log shrank below a
|
|
133
|
+
// previously observed prefix". Waiting is the honest answer.
|
|
134
|
+
try {
|
|
135
|
+
if (Date.now() - statSync(file).mtimeMs < RECENT_WRITE_MS) return { ...plan, reason: 'recently-written' };
|
|
136
|
+
} catch {
|
|
137
|
+
return { ...plan, reason: 'unreadable' };
|
|
138
|
+
}
|
|
121
139
|
const offsets = frameOffsets(buf);
|
|
122
140
|
// A frame that does not decode is a frame being written right now, or a
|
|
123
141
|
// damaged tail. Either way this file is not cut today.
|