dsh-tg-bridge 1.13.1 → 1.13.2

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/QUICKSTART.md ADDED
@@ -0,0 +1,137 @@
1
+ # Quickstart: from zero to a bot that answers
2
+
3
+ Written for someone who has never made a Telegram bot and does not know what a
4
+ profile is. Twelve minutes, most of it waiting for the bot to say hello.
5
+
6
+ If an AI agent is helping you, skip to [For agents](#for-agents): it can do
7
+ steps 2–5 for you and only needs your answers to three questions.
8
+
9
+ ---
10
+
11
+ ## 0. What you need before you start
12
+
13
+ - **Node.js 20 or newer.** Check with `node --version`. If the number is lower or
14
+ the command is missing, install Node from [nodejs.org](https://nodejs.org) first
15
+ — nothing below works without it.
16
+ - **A computer that stays on.** The bot runs on your machine, not in a cloud.
17
+ Laptop is fine; it answers only while awake.
18
+ - **DeepSeek Harness**, the app this bridge connects to Telegram.
19
+ - **Ten minutes and your phone.**
20
+
21
+ ## 1. Make a bot in Telegram
22
+
23
+ 1. Open Telegram and search for **@BotFather** (the one with the blue checkmark).
24
+ 2. Press **Start**, then send `/newbot`.
25
+ 3. It asks for a **name** — anything people will see: `My work bot`.
26
+ 4. It asks for a **username**, which must end in `bot`:
27
+ `my_work_2026_bot`. If it says the name is taken, add a word.
28
+ 5. BotFather answers with a line like
29
+ `Use this token to access the HTTP API: 123456789:AAH...` — that is your
30
+ **token**. Treat it like a password: anyone with it controls your bot.
31
+
32
+ Optional but recommended in the same chat:
33
+
34
+ - `/setprivacy` → **Disable** — only needed for groups; without it the bot sees
35
+ commands there but not ordinary text.
36
+ - `/setjoingroups` → **Enable** — if you want to use it in a group at all.
37
+
38
+ ## 2. Tell the bridge about the token
39
+
40
+ ```bash
41
+ npx dsh-tg@latest init --token <the token> --user <your id>
42
+ ```
43
+
44
+ - **`<the token>`** — the line from step 1, in quotes if your shell needs it.
45
+ - **`<your id>`** — the number Telegram gives you. Don't know it? Send `/start`
46
+ to **@userinfobot** and copy the `Id:` line. The bridge answers only this
47
+ account; anyone else is ignored.
48
+
49
+ `init` writes the token to `~/.dsh/.credentials.yaml` (never to the project
50
+ folder) and your id to `~/.dsh/tg-bridge/config.json`. Add `--cwd D:\work` if your
51
+ projects live somewhere other than `~/Projects`, and `--dry-run` to see what it
52
+ would write without writing.
53
+
54
+ ## 3. Start the bridge
55
+
56
+ ```bash
57
+ npx dsh-tg@latest setup
58
+ ```
59
+
60
+ This registers the bridge so it starts with your session and runs it once. Watch
61
+ for `bridge started` at the end. A failure here is almost always one of the three
62
+ things in [If it does not work](#if-it-does-not-work).
63
+
64
+ ## 4. Say hello
65
+
66
+ 1. In Telegram, open your bot (BotFather gives you a `t.me/...` link) and press
67
+ **Start**.
68
+ 2. Send `hi`.
69
+
70
+ You should see two messages: a short "got it" and then the answer. If you see a
71
+ progress line with a spinner instead, it is working — the answer follows.
72
+
73
+ ## 5. Make it yours
74
+
75
+ Everything below is typed in the chat, not in a terminal.
76
+
77
+ | What you want | Type |
78
+ |---|---|
79
+ | Work on a project folder | `/cd /path/to/project` |
80
+ | A separate space per project | turn on **Topics** in the group, one topic per project, `/cd` in each |
81
+ | Cheaper or stronger model | `/model` then pick, or `/model <id>` |
82
+ | More freedom for commands | `/permissions` |
83
+ | See what it is doing | it posts a live progress message; `/thoughts` toggles the 💭 notes |
84
+ | A plan you can tick off | `/goal <what done looks like>`, then `/task <step>`, then `/tasks` to tap items |
85
+ | Stop a long answer | `/stop` |
86
+ | Restart after an update | `/restart confirm` |
87
+ | Everything it can do | `/help` |
88
+
89
+ `/lang` pins the reply language; without it the bridge answers in the language you
90
+ write in (Russian, Chinese, otherwise English).
91
+
92
+ ---
93
+
94
+ ## If it does not work
95
+
96
+ | What you see | What it means |
97
+ |---|---|
98
+ | Nothing at all after `hi` | The id in `config.json` is not yours, or the bridge is not running: `npx dsh-tg@latest setup` again and read its output. |
99
+ | `401 Unauthorized` | The token is wrong or was revoked by BotFather. Run `init` again with a fresh token. |
100
+ | Works in private chat, silent in a group | Privacy mode is on: `/setprivacy` → Disable, then remove and re-add the bot to the group. |
101
+ | `Error [ERR_MODULE_NOT_FOUND]` on start | The package is older than 1.13.1, which shipped without a file it needs. `npm i -g dsh-tg-bridge@latest`. |
102
+ | Bot answers in the wrong language | `/lang ru` / `/lang en` / `/lang zh`, or just write in the language you want. |
103
+ | Two answers to one message | Another copy of the bridge is running: `/status` shows the pid, kill the duplicate. |
104
+
105
+ Still stuck: `/doctor` in the chat, or `npx dsh-tg@latest check` in a
106
+ terminal — both print what is missing and how to fix it.
107
+
108
+ ---
109
+
110
+ ## For agents
111
+
112
+ An agent helping a person needs three answers, then can do the rest:
113
+
114
+ 1. **What is the bot for** — a project folder, a chat with themselves, or a team
115
+ group? This decides `--cwd` and whether `--user` must be added to a group.
116
+ 2. **Do they have a bot token already** — from [@BotFather](https://t.me/BotFather)?
117
+ If not, walk them through step 1 of this file; it cannot be automated.
118
+ 3. **Which OS** — Windows, macOS or Linux; it changes where the background start
119
+ lives, not what the bridge does.
120
+
121
+ Then:
122
+
123
+ ```bash
124
+ npx dsh-tg@latest check # what is missing right now
125
+ npx dsh-tg@latest init --token <token> --user <id> [--cwd <path>] [--dry-run]
126
+ npx dsh-tg@latest setup # register autostart and start
127
+ npx dsh-tg@latest menu # push the command menu to Telegram
128
+ ```
129
+
130
+ Verify with a real message, not with logs: ask the person to send `hi` and wait
131
+ for the answer before declaring success. `check` reporting success only means the
132
+ files are in place.
133
+
134
+ Never echo the token into a transcript, a commit, or a file inside a repository:
135
+ `init` puts it in `~/.dsh/.credentials.yaml` and nothing else should hold it.
136
+ If you keep notes, keep them outside the repo — `scan-secrets.mjs` refuses tokens,
137
+ personal ids and home paths on every commit.
package/README.md CHANGED
@@ -7,6 +7,9 @@ Each forum topic is a separate project with its own session and its own working
7
7
  directory. Replies arrive with progress, a "Stop" button and copyable code
8
8
  blocks.
9
9
 
10
+ Never made a bot? [QUICKSTART.md](QUICKSTART.md) takes you from "no account" to
11
+ a bot that answers, one step at a time.
12
+
10
13
  ## Features
11
14
 
12
15
  - **Text**: a regular task goes to the agent, the answer comes back in the same topic.
@@ -147,6 +150,9 @@ the command menu.
147
150
 
148
151
  ## Troubleshooting
149
152
 
153
+ Starting from nothing, or helping someone who is: [QUICKSTART.md](QUICKSTART.md)
154
+ has the same answers with the terminal output they will actually see.
155
+
150
156
  Error replies end with a code, which tells you what to fix:
151
157
 
152
158
  | Code | Meaning |
package/cli.mjs CHANGED
@@ -22,11 +22,10 @@ const DSH_HOME = process.env.DSH_HOME || join(homedir(), '.dsh');
22
22
  // setup.mjs, the watchdog and /doctor all work on this one directory, so the
23
23
  // config must be written here and a checkout elsewhere must be mirrored here.
24
24
  const RUNTIME = join(DSH_HOME, 'tg-bridge');
25
- const RUNTIME_FILES = [
26
- 'bridge.mjs', 'control.mjs', 'i18n.mjs', 'bot-menu.mjs', 'prices.mjs',
27
- 'transcribe.py', 'setup.mjs', 'bridge-kick.mjs', 'bridge-restart-idle.mjs',
28
- 'restart-after-send.mjs', 'config.example.json', 'profiles.mjs',
29
- ];
25
+ // Whatever the package ships. This was a hand-kept list until it silently fell
26
+ // behind the code: a file it did not name was not copied, and the bridge then
27
+ // started from a directory that could not import what it needed.
28
+ const RUNTIME_FILES = (pkg.files || []).filter((entry) => !entry.endsWith('/'));
30
29
 
31
30
  /**
32
31
  * Mirror this checkout into the runtime directory.
@@ -37,6 +36,7 @@ const RUNTIME_FILES = [
37
36
  */
38
37
  function syncRuntime() {
39
38
  if (resolve(DIR) === resolve(RUNTIME)) return;
39
+ mkdirSync(RUNTIME, { recursive: true });
40
40
  for (const file of RUNTIME_FILES) {
41
41
  if (existsSync(join(DIR, file))) copyFileSync(join(DIR, file), join(RUNTIME, file));
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
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",
@@ -67,6 +67,7 @@
67
67
  "transcribe.py",
68
68
  "cli.mjs",
69
69
  "README.md",
70
+ "QUICKSTART.md",
70
71
  "LICENSE",
71
72
  "config.example.json",
72
73
  "queue-notice.mjs",
@@ -88,6 +89,7 @@
88
89
  "install.ps1",
89
90
  "install.sh",
90
91
  "INJECTION-AND-REPLIES.md",
91
- "SECURITY.md"
92
+ "SECURITY.md",
93
+ "skills/"
92
94
  ]
93
95
  }
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: dsh-tg-bridge-onboarding
3
+ description: Walk a complete beginner from nothing to a working DeepSeek Harness Telegram bot with dsh-tg-bridge — no Telegram account, no bot, no token. Use when someone says "set up the Telegram bot", "install dsh-tg-bridge", "how do I get a bot token", "плохо, подключи телеграм", "не понимаю, как подключить бота", or when a fresh install has to be verified end to end.
4
+ whenToUse: Before the bridge exists on their machine, or when a bridge is installed but nobody has confirmed it answers.
5
+ ---
6
+
7
+ # Onboarding someone onto dsh-tg-bridge
8
+
9
+ The person may have never used Telegram, never made a bot, and never opened a
10
+ terminal. Your job is one confirmed answer in their chat, not a completed
11
+ checklist. Every step below ends in something you can see.
12
+
13
+ Repo: https://github.com/aleksvega/dsh-tg-bridge — the long-form guide is
14
+ `QUICKSTART.md` there. Read it if anything below is ambiguous; it is written for
15
+ the person, not for you.
16
+
17
+ ## 0. Ask three questions, then stop asking
18
+
19
+ 1. **Telegram account** — do they have one? If not: install the app
20
+ (telegram.org or the app store), register with a phone number, wait for the
21
+ SMS code. Nothing else can start before this.
22
+ 2. **What the bot is for** — their own work, one project folder, or a team group.
23
+ This decides `--cwd` and whether their id must be added to a group.
24
+ 3. **Which machine stays on** — the bot answers only while that computer is
25
+ awake. A laptop that sleeps is the usual reason "it stopped working".
26
+
27
+ ## 1. Bot token (they must do this; it cannot be automated)
28
+
29
+ 1. In Telegram search **@BotFather**, press **Start**, send `/newbot`.
30
+ 2. Name: anything. Username: must end in `bot`.
31
+ 3. BotFather replies with `123456789:AAH...` — that is the token.
32
+
33
+ If they cannot find BotFather, send them `https://t.me/BotFather`. If Telegram
34
+ says the username is taken, add a word.
35
+
36
+ **Never paste the token into a file in a repository, a commit, or a chat message
37
+ you will quote back.** The next step writes it where it belongs.
38
+
39
+ ## 2. Their numeric id
40
+
41
+ Send `/start` to **@userinfobot** (`https://t.me/userinfobot`), copy the `Id:`
42
+ number. It is not the phone number and not the `@username`.
43
+
44
+ ## 3. Check the machine first
45
+
46
+ ```bash
47
+ node --version # must be 20 or newer
48
+ npx dsh-tg@latest check
49
+ ```
50
+
51
+ `check` lists what is missing. Missing Node: install from nodejs.org, restart the
52
+ terminal. Empty output with a non-zero exit usually means `npx` is not on PATH.
53
+
54
+ ## 4. Install with one command
55
+
56
+ ```bash
57
+ npx dsh-tg@latest init --token <token> --user <id> [--cwd <project dir>] [--dry-run]
58
+ npx dsh-tg@latest setup
59
+ npx dsh-tg@latest menu
60
+ ```
61
+
62
+ - `init` writes the token to `~/.dsh/.credentials.yaml` and their id to
63
+ `~/.dsh/tg-bridge/config.json`. It never overwrites an existing `config.json`.
64
+ - `setup` copies the bridge to `~/.dsh/tg-bridge`, registers the background
65
+ start, and starts it once.
66
+ - `menu` pushes the command list to Telegram.
67
+
68
+ The package name is `dsh-tg-bridge`; the CLI it installs is `dsh-tg`. Version
69
+ 1.13.0 shipped without `format.mjs` and could not start — if you see
70
+ `ERR_MODULE_NOT_FOUND`, run `npm i -g dsh-tg-bridge@latest`.
71
+
72
+ ## 5. Verify in the chat, not in the logs
73
+
74
+ Ask them to send `hi` to the bot. You are done when they report an answer, not
75
+ when `check` prints success. If nothing arrives, in this order:
76
+
77
+ | Symptom | Cause |
78
+ |---|---|
79
+ | Silence, no error | id in `config.json` is not theirs, or the bridge is not running |
80
+ | `401 Unauthorized` | token wrong or revoked — redo step 1 |
81
+ | Silent in a group only | BotFather `/setprivacy` → Disable, then re-add the bot |
82
+ | `TG_CONFLICT` | two bridges polling the same bot — `/doctor`, kill the duplicate |
83
+ | `MISSING_CREDENTIAL` | they have not signed into a provider in the DSH app yet |
84
+ | `NO_DSH_CLI` | DeepSeek Harness is not installed on that machine |
85
+
86
+ In the chat, `/doctor` prints the same diagnosis they can read themselves.
87
+
88
+ ## 6. Five things to teach, then stop
89
+
90
+ Type, don't explain:
91
+
92
+ - `/cd /path/to/project` — all turns then run there.
93
+ - `/model` — pick a model; `/permissions` — how much it may do.
94
+ - `/goal <what done looks like>` and `/task <step>`, then `/tasks` — a plan they
95
+ can tap off as it moves.
96
+ - `/stop` — kills a long answer; `/restart confirm` — reloads code after an update.
97
+ - `/help` — every command.
98
+
99
+ `/lang ru|en|zh` pins the reply language; without it it matches the language they
100
+ write in.
101
+
102
+ ## Failure modes worth knowing
103
+
104
+ - **Do not restart the bridge for them.** It polls Telegram; two pollers make it
105
+ go silent. `/restart confirm` is typed by the person.
106
+ - **Do not run `init` twice with a different id** and expect the old config to
107
+ change: an existing `config.json` is left alone on purpose. Delete it first if
108
+ it is wrong.
109
+ - **Do not put the token in a `config.json` you copy around** — `init` puts it in
110
+ the credentials store; a token in a repo is what `scan-secrets.mjs` refuses on
111
+ push.
112
+ - **Voice needs `--voice` plus python and faster-whisper**; without it, a voice
113
+ message gets a text answer saying it was not transcribed.