dsh-tg-bridge 1.27.0 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/cli-args.mjs +8 -3
- package/control/cmd-bridge.mjs +19 -10
- package/control/cmd-views.mjs +444 -441
- package/control/plugins.mjs +149 -152
- package/dsh-launch.mjs +68 -0
- package/i18n/en/core.mjs +253 -253
- package/i18n/en/ctrl.mjs +3 -1
- package/i18n/ru/core.mjs +253 -253
- package/i18n/ru/ctrl.mjs +3 -1
- package/i18n/zh/core.mjs +253 -253
- package/i18n/zh/ctrl.mjs +3 -1
- package/machine.mjs +3 -2
- package/package.json +2 -1
- package/paths.mjs +78 -46
- package/turn.mjs +253 -252
package/README.md
CHANGED
|
@@ -91,6 +91,27 @@ npx dsh-tg-bridge@latest setup
|
|
|
91
91
|
`init` writes the token, your id and the working directory; `setup` registers
|
|
92
92
|
autostart and starts the bridge.
|
|
93
93
|
|
|
94
|
+
### What it needs from DSH
|
|
95
|
+
|
|
96
|
+
The bridge is a client of the DSH CLI, and the surface it uses is small enough to
|
|
97
|
+
write down: `--profile`, `--json`, `--session-id`, `--expose-internals <cli.js>`
|
|
98
|
+
when the app binary runs the CLI, and the `{"type": ...}` JSON events on stdout.
|
|
99
|
+
Profiles are read as files (`cordis.patch.yml`, `package.json`) under
|
|
100
|
+
`~/.dsh/profiles`. `package.json` spells the supported range out in
|
|
101
|
+
`engines.dsh`, and it is capped below `0.3.0` on purpose: a minor bump may rename
|
|
102
|
+
an event, and a bridge that guesses is a bridge that answers with silence.
|
|
103
|
+
|
|
104
|
+
Two escape hatches, for a moved app or a DSH that ships differently:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
DSH_BIN=/usr/local/bin/dsh # the CLI itself, no entrypoint argument
|
|
108
|
+
DSH_CLI_JS=/opt/dsh/lib/cli.js # just the CLI entrypoint, run by DSH_BIN
|
|
109
|
+
DSH_APP_DIR=/opt/DeepSeek-Harness # where the desktop app is installed
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`/doctor` prints the command a turn would actually run, so a machine where these
|
|
113
|
+
matter says so instead of failing with an empty answer.
|
|
114
|
+
|
|
94
115
|
**As a DSH plugin** (the package carries a `dsh.bundle`; the catalog entry is
|
|
95
116
|
pending review):
|
|
96
117
|
|
package/cli-args.mjs
CHANGED
|
@@ -6,11 +6,16 @@
|
|
|
6
6
|
// `--json ... --patch x.yml` the app received `--patch`, answered
|
|
7
7
|
// `{"type":"error","message":"unknown option '--patch'"}` and exited 1 — every
|
|
8
8
|
// photo turn and every fallback-model attempt died in about five seconds.
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// `lead` is what goes before `--profile`, and it is not always
|
|
10
|
+
// `--expose-internals <cli.js>`: the Electron app needs that, a plain `dsh` on
|
|
11
|
+
// PATH needs nothing (see `dsh-launch.mjs`). Keeping `cli` as a fallback means
|
|
12
|
+
// the old call still reads the way it did.
|
|
13
|
+
export function turnArgs({ lead = null, cli, profile, extraArgs = [], sessionId = '', task }) {
|
|
14
|
+
const prefix = lead || (cli ? ['--expose-internals', cli] : null);
|
|
15
|
+
if (!prefix) throw new Error('turnArgs: lead or cli is required');
|
|
11
16
|
if (!profile) throw new Error('turnArgs: profile is required');
|
|
12
17
|
if (typeof task !== 'string' || !task) throw new Error('turnArgs: task is required');
|
|
13
|
-
const args = [
|
|
18
|
+
const args = [...prefix, '--profile', profile, ...extraArgs, '--json'];
|
|
14
19
|
if (sessionId) args.push('--session-id', sessionId);
|
|
15
20
|
args.push(task);
|
|
16
21
|
return args;
|
package/control/cmd-bridge.mjs
CHANGED
|
@@ -20,6 +20,8 @@ import { cutSession, isRewindPress } from '../rewind-buttons.mjs';
|
|
|
20
20
|
import { renderRewindCard, renderRewindUsage } from '../rewind-card.mjs';
|
|
21
21
|
import { MENU_GROUPS, commandForName, renderPanel, replyKeyboard } from '../menu-card.mjs';
|
|
22
22
|
import { chainSummary } from '../fallback-card.mjs';
|
|
23
|
+
import { driveOf, sampleDisk } from '../machine.mjs';
|
|
24
|
+
import { describeLaunch, dshLaunch } from '../dsh-launch.mjs';
|
|
23
25
|
import { explainCommand } from '../help-explain.mjs';
|
|
24
26
|
import { profileValues, resolveSettings } from '../settings.mjs';
|
|
25
27
|
import { UPDATE_DEFAULTS, describeUpdate, modeChange, updateState } from '../update-policy.mjs';
|
|
@@ -226,16 +228,23 @@ export async function handleBridgeCommands(ctx) {
|
|
|
226
228
|
add(t(lang, 'ctrl.doctor.logLines'), String(lines.length - start));
|
|
227
229
|
} catch {}
|
|
228
230
|
|
|
229
|
-
// Disk space: the silent killer of model downloads and OCR.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
// Disk space: the silent killer of model downloads and OCR. This used to
|
|
232
|
+
// shell out to `powershell (Get-PSDrive C)`, so on macOS and Linux the row
|
|
233
|
+
// simply vanished — a diagnostic that is silent on the platform you are
|
|
234
|
+
// debugging is worse than none.
|
|
235
|
+
const disk = sampleDisk(driveOf(config.cwd || ''));
|
|
236
|
+
if (disk.freeGb !== null) {
|
|
237
|
+
// `C:\` is a path; the row wants the name of a disk, so the separator
|
|
238
|
+
// and its colon both go: "Disk C", "Disk /".
|
|
239
|
+
const label = disk.drive.replace(/[\\/:]+$/, '') || disk.drive;
|
|
240
|
+
add(t(lang, 'ctrl.doctor.disk', { drive: label }), t(lang, 'ctrl.doctor.diskFree', { gb: disk.freeGb.toFixed(1) }));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Which binary a turn would actually start. On a machine where the app is
|
|
244
|
+
// missing but `dsh` is on PATH (or the other way round) this is the row
|
|
245
|
+
// that explains why every turn fails, so it is worth one line always.
|
|
246
|
+
const launch = dshLaunch({ exists: existsSync });
|
|
247
|
+
add(t(lang, 'ctrl.doctor.turnCmd'), `${describeLaunch(launch)}${launch.kind === 'cli' ? t(lang, 'ctrl.doctor.turnCmdPath') : ''}`);
|
|
239
248
|
|
|
240
249
|
// Project directory bound to this topic and whether it exists. The bridge
|
|
241
250
|
// default is a fact, not an accident: say when it is being used.
|