@shliamb/dsh-telegram-bot 0.2.6 β 0.2.7
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 +41 -11
- package/README.ru.md +40 -11
- package/lib/index.js +75 -46
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Package: [`@shliamb/dsh-telegram-bot`](https://www.npmjs.com/package/@shliamb/ds
|
|
|
6
6
|
|
|
7
7
|
Telegram bridge for **DeepSeek Harness**. The plugin runs inside the Harness Host as an external bundle: you talk to the agent from a private Telegram chat, choose a workspace and session, follow long turns with a live progress message, and manage the Host remotely.
|
|
8
8
|
|
|
9
|
-
> **Status:**
|
|
9
|
+
> **Status:** 0.2.7, early beta. The bundle targets DeepSeek Harness `0.2.2-alpha.3` and the `web` profile.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -16,10 +16,26 @@ Telegram bridge for **DeepSeek Harness**. The plugin runs inside the Harness Hos
|
|
|
16
16
|
- One editable progress message per turn (`π thinking`, `π§ tool`, `βοΈ writing`, `β
done`) instead of a stream of bash output.
|
|
17
17
|
- Parallel turns: switch to another workspace while an older turn keeps updating. Its final answer still arrives in the same chat.
|
|
18
18
|
- Tool approvals and agent questions as inline buttons; typed text answers as custom, including multi-select.
|
|
19
|
+
- Questions and approvals follow the active Telegram session: the bot claims them for that session; every other session stays in Web and gets a text notice after 15 seconds.
|
|
19
20
|
- Main menu with account balance, workspace, session, context usage and colored buttons.
|
|
21
|
+
- Context percentage matches the Web meter, including right after compaction, and refreshes every time you open `/start` or `/menu`.
|
|
22
|
+
- Draft sessions are hidden and reused, so pressing **New session** twice does not create duplicates; the current session is marked `β
`.
|
|
20
23
|
- Sound on/off per chat, history compaction via `/compact`, and a confirmed stop.
|
|
21
24
|
- Admin screen with log download and remote Harness restart.
|
|
22
|
-
- Russian or English UI, chosen from the Telegram
|
|
25
|
+
- Russian or English UI automatically, chosen from the Telegram interface language (`ru*` β Russian, any other β English). Menus, buttons, progress, questions, approvals and command descriptions follow it; the Web settings page follows the Web UI locale.
|
|
26
|
+
|
|
27
|
+
## Screenshots
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
The main menu in Russian: balance, active workspace and session, context usage, and action buttons.
|
|
32
|
+
|
|
33
|
+
## What's new
|
|
34
|
+
|
|
35
|
+
- **0.2.7 β fresh context and calm compaction.** The menu reads the projection view (`projectedTokens`), so the percentage is correct immediately after compaction and on every `/start`; pressing **Compact** replaces the confirmation with a waiting message and removes the buttons.
|
|
36
|
+
- **0.2.6 β routing.** Questions and approvals belong to the Session currently open in Telegram. Other Sessions stay in Web, and after 15 seconds the bot sends a text notice with the workspace and Session name.
|
|
37
|
+
- **0.2.5 β context and sessions.** The context percentage now matches Web after compaction (`projectedTokens`), empty draft Sessions are reused and hidden, and the current Session is marked `β
`.
|
|
38
|
+
- **Languages.** The whole bot follows Telegram's interface language: `ru*` β Russian, any other β English. The binding locale is refreshed on every update, so a language change applies to progress, answers, questions and approvals immediately.
|
|
23
39
|
|
|
24
40
|
## Requirements
|
|
25
41
|
|
|
@@ -29,6 +45,13 @@ Telegram bridge for **DeepSeek Harness**. The plugin runs inside the Harness Hos
|
|
|
29
45
|
- Your numeric Telegram user ID, for example from [@userinfobot](https://t.me/userinfobot).
|
|
30
46
|
- A running Host. One bot token can be polled by only one Host process at a time (otherwise Telegram returns `409 Conflict`).
|
|
31
47
|
|
|
48
|
+
## Stack
|
|
49
|
+
|
|
50
|
+
- DeepSeek Harness `web` profile, installed as an external Cordis bundle (`cordis.patch.yml`).
|
|
51
|
+
- TypeScript on Node.js `>= 24.9`; grammY for long polling.
|
|
52
|
+
- React settings page registered through DSH client slots.
|
|
53
|
+
- No runtime imports of `@deepseek-ai/dsh-*`: Host services are described by local types.
|
|
54
|
+
|
|
32
55
|
## Installation
|
|
33
56
|
|
|
34
57
|
The package is published on npm as **`@shliamb/dsh-telegram-bot`**. The short name `dsh-telegram-bot` is already used by another project, so use the scoped name.
|
|
@@ -59,13 +82,13 @@ Adding a new bundle requires a Host restart. Chat sessions and bindings survive
|
|
|
59
82
|
The repository also contains a ready-to-install archive:
|
|
60
83
|
|
|
61
84
|
```text
|
|
62
|
-
dist/shliamb-dsh-telegram-bot-0.2.
|
|
85
|
+
dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
63
86
|
```
|
|
64
87
|
|
|
65
88
|
If the `dsh` CLI is on your `PATH`, run this from the repository root:
|
|
66
89
|
|
|
67
90
|
```bash
|
|
68
|
-
dsh plugin --profile web add ./dist/shliamb-dsh-telegram-bot-0.2.
|
|
91
|
+
dsh plugin --profile web add ./dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
69
92
|
dsh web
|
|
70
93
|
```
|
|
71
94
|
|
|
@@ -73,7 +96,7 @@ If you run Harness from a source checkout, use `pnpm dsh` from that checkout and
|
|
|
73
96
|
|
|
74
97
|
```bash
|
|
75
98
|
cd /path/to/deepseek-harness
|
|
76
|
-
pnpm dsh plugin --profile web add /path/to/HarnessBot/dist/shliamb-dsh-telegram-bot-0.2.
|
|
99
|
+
pnpm dsh plugin --profile web add /path/to/HarnessBot/dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
77
100
|
pnpm dsh web
|
|
78
101
|
```
|
|
79
102
|
|
|
@@ -160,7 +183,7 @@ On a fresh Host start the bot sends the admin a single **βHarness is onlineβ
|
|
|
160
183
|
|
|
161
184
|
### Commands
|
|
162
185
|
|
|
163
|
-
Only `/start` is shown in Telegram's command menu.
|
|
186
|
+
Only `/start` is shown in Telegram's command menu. `/admin` is additionally scoped to the admin chat; the other commands are hidden but still work when typed manually.
|
|
164
187
|
|
|
165
188
|
| Command | Description |
|
|
166
189
|
| --- | --- |
|
|
@@ -174,6 +197,10 @@ Only `/start` is shown in Telegram's command menu. The other commands are hidden
|
|
|
174
197
|
|
|
175
198
|
Final answers are sent as separate rich messages. Long text is split into parts that fit Telegram's message limit. If rich formatting fails, the plugin retries with rich HTML and then with plain text, so the answer is not lost.
|
|
176
199
|
|
|
200
|
+
### Languages
|
|
201
|
+
|
|
202
|
+
The bot follows Telegram's interface language: a `ru*` code selects Russian, any other code selects English. The binding locale is refreshed on every update, so progress, final answers, questions and approvals switch immediately after you change Telegram's language. Command descriptions use the same rule. The Web settings page follows the Web UI locale. Agent-produced text is left as the agent wrote it.
|
|
203
|
+
|
|
177
204
|
### Workspaces and sessions
|
|
178
205
|
|
|
179
206
|
After you choose a workspace:
|
|
@@ -202,7 +229,7 @@ Turn tracking lives in Host memory. If the Host is restarted in the middle of a
|
|
|
202
229
|
|
|
203
230
|
### Approvals and questions
|
|
204
231
|
|
|
205
|
-
When the agent requests a tool approval, the bot sends an inline **Allow** / **Deny** keyboard. When the agent asks a question with predefined options, the answers are inline buttons as well.
|
|
232
|
+
When the agent requests a tool approval, the bot sends an inline **Allow** / **Deny** keyboard. When the agent asks a question with predefined options, the answers are inline buttons as well. In Telegram the card is closed after 10 minutes; an unanswered question is returned as skipped.
|
|
206
233
|
|
|
207
234
|
Approvals and questions are answered for the bound session. The bot asks one question at a time. For a single-select question, tapping an option answers immediately; for a multi-select question, toggle the options and tap **Done**. Typing text while a question is open sends it as the custom answer (for multi-select it supplements the selected options), and **Skip** leaves the question unanswered. While a question or approval is open, ordinary text is not queued as a new prompt.
|
|
208
235
|
|
|
@@ -210,7 +237,7 @@ Where the prompt appears is decided by the Telegram binding. If the request belo
|
|
|
210
237
|
|
|
211
238
|
### Compaction, sound and stop
|
|
212
239
|
|
|
213
|
-
- **Compact** shows the current context percentage and asks for confirmation. The plugin calls the preset-scoped `/compact` command through the `commands` service and reports the localized result and the new percentage. If the agent is busy, compaction is refused.
|
|
240
|
+
- **Compact** shows the current context percentage and asks for confirmation. Pressing **Compact** replaces the card with a waiting message and removes the buttons, so repeated taps do nothing. The plugin calls the preset-scoped `/compact` command through the `commands` service and reports the localized result and the new percentage. If the agent is busy, compaction is refused.
|
|
214
241
|
- **Sound** is stored per chat. When it is off, answers, progress edits and the startup greeting use `disable_notification`.
|
|
215
242
|
- **Stop** asks for confirmation, then cancels the current turn with `agent.cancel({ kind: 'user' })`.
|
|
216
243
|
|
|
@@ -285,6 +312,7 @@ pnpm pack --pack-destination dist
|
|
|
285
312
|
src/index.ts Host plugin: config, bot runtime, menus, commands
|
|
286
313
|
src/client/index.tsx Web settings page (token + admin ID)
|
|
287
314
|
src/client/locales.ts Russian and English UI strings
|
|
315
|
+
images/ README screenshots
|
|
288
316
|
src/state/index.ts Chat bindings in the storageDomain
|
|
289
317
|
src/logging/index.ts JSONL file log with rotation
|
|
290
318
|
src/*/SPEC.md Module contracts and data formats
|
|
@@ -301,13 +329,15 @@ dist/ Prebuilt install archive
|
|
|
301
329
|
- Web settings expose only the token and the admin ID; `lowBalanceUsd`, `rich` and `apiRoot` are configured through `cordis.patch.yml`.
|
|
302
330
|
- No voice or file handling: Telegram transcribes voice messages itself.
|
|
303
331
|
- No proxy configuration.
|
|
304
|
-
-
|
|
332
|
+
- Questions and approvals for the active Telegram session appear only in Telegram; other sessions stay in Web with a delayed text notice. Telegram supports single-select, multi-select, custom text and skip.
|
|
305
333
|
- Progress tracking is in memory, so a Host restart in the middle of a turn can leave a stale progress message.
|
|
306
334
|
|
|
307
335
|
## Roadmap
|
|
308
336
|
|
|
309
|
-
-
|
|
310
|
-
-
|
|
337
|
+
- Done in 0.2.5: context meter from `projectedTokens`, draft-session reuse, `β
` current session, English command fallback, locale sync.
|
|
338
|
+
- Done in 0.2.6: active-session routing for questions and approvals, 15-second Web-waiting text notice, diagnostics.
|
|
339
|
+
- Done in 0.2.7: context from the projection snapshot, forced refresh on menu open, compact waiting state, removed the redundant question-keyboard clear call.
|
|
340
|
+
- Next: `/history`; reply routing; completion notifications for other sessions; plugin catalog listing.
|
|
311
341
|
|
|
312
342
|
## License
|
|
313
343
|
|
package/README.ru.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Telegram-ΠΌΠΎΡΡ Π΄Π»Ρ **DeepSeek Harness**. ΠΠ»Π°Π³ΠΈΠ½ ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°Π΅ΡΡΡ Π² ΠΏΡΠΎΡΠΈΠ»Ρ `web` ΠΊΠ°ΠΊ Π²Π½Π΅ΡΠ½ΠΈΠΉ Π±Π°Π½Π΄Π» ΠΈ ΡΠ°Π±ΠΎΡΠ°Π΅Ρ Π²Π½ΡΡΡΠΈ Host-ΠΏΡΠΎΡΠ΅ΡΡΠ°: Π²Ρ ΠΎΠ±ΡΠ°Π΅ΡΠ΅ΡΡ Ρ Π°Π³Π΅Π½ΡΠΎΠΌ ΠΈΠ· ΠΏΡΠΈΠ²Π°ΡΠ½ΠΎΠ³ΠΎ ΡΠ°ΡΠ° Telegram, Π²ΡΠ±ΠΈΡΠ°Π΅ΡΠ΅ ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎ ΠΈ ΡΠ΅ΡΡΠΈΡ, ΡΠ»Π΅Π΄ΠΈΡΠ΅ Π·Π° Π΄Π»ΠΈΠ½Π½ΡΠΌΠΈ Ρ
ΠΎΠ΄Π°ΠΌΠΈ ΡΠ΅ΡΠ΅Π· ΠΎΠ΄Π½ΠΎ progress-ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ ΠΈ ΡΠΏΡΠ°Π²Π»ΡΠ΅ΡΠ΅ Host ΡΠ΄Π°Π»ΡΠ½Π½ΠΎ.
|
|
8
8
|
|
|
9
|
-
> **Π‘ΡΠ°ΡΡΡ:**
|
|
9
|
+
> **Π‘ΡΠ°ΡΡΡ:** 0.2.7, ΡΠ°Π½Π½ΡΡ Π±Π΅ΡΠ°. ΠΠ°Π½Π΄Π» ΡΠ°ΡΡΡΠΈΡΠ°Π½ Π½Π° DeepSeek Harness `0.2.2-alpha.3` ΠΈ ΠΏΡΠΎΡΠΈΠ»Ρ `web`.
|
|
10
10
|
|
|
11
11
|
## ΠΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ
|
|
12
12
|
|
|
@@ -16,10 +16,26 @@ Telegram-ΠΌΠΎΡΡ Π΄Π»Ρ **DeepSeek Harness**. ΠΠ»Π°Π³ΠΈΠ½ ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²
|
|
|
16
16
|
- ΠΠ΄Π½ΠΎ ΡΠ΅Π΄Π°ΠΊΡΠΈΡΡΠ΅ΠΌΠΎΠ΅ progress-ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ Π½Π° Ρ
ΠΎΠ΄ (`π Π΄ΡΠΌΠ°Π΅Ρ`, `π§ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½Ρ`, `βοΈ ΠΏΠΈΡΠ΅Ρ`, `β
Π³ΠΎΡΠΎΠ²ΠΎ`) Π²ΠΌΠ΅ΡΡΠΎ ΠΏΠΎΡΠΎΠΊΠ° bash-Π²ΡΠ²ΠΎΠ΄Π°.
|
|
17
17
|
- ΠΠ°ΡΠ°Π»Π»Π΅Π»ΡΠ½ΡΠ΅ Ρ
ΠΎΠ΄Ρ: ΠΌΠΎΠΆΠ½ΠΎ ΠΏΠ΅ΡΠ΅ΠΊΠ»ΡΡΠΈΡΡΡΡ Π² Π΄ΡΡΠ³ΠΎΠ΅ ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎ, Π° ΡΡΠ°ΡΠΎΠ΅ progress-ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠΈΡ ΠΎΠ±Π½ΠΎΠ²Π»ΡΡΡΡΡ. Π€ΠΈΠ½Π°Π»ΡΠ½ΡΠΉ ΠΎΡΠ²Π΅Ρ Π²ΡΡ ΡΠ°Π²Π½ΠΎ ΠΏΡΠΈΠ΄ΡΡ Π² ΡΠΎΡ ΠΆΠ΅ ΡΠ°Ρ.
|
|
18
18
|
- ΠΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½ΡΠΎΠ² ΠΈ Π²ΠΎΠΏΡΠΎΡΡ Π°Π³Π΅Π½ΡΠ° ΠΊΠ½ΠΎΠΏΠΊΠ°ΠΌΠΈ; ΡΠ΅ΠΊΡΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅ΡΡΡ ΠΊΠ°ΠΊ Β«ΡΠ²ΠΎΠΉ ΠΎΡΠ²Π΅ΡΒ», Π²ΠΊΠ»ΡΡΠ°Ρ ΠΌΡΠ»ΡΡΠΈΠ²ΡΠ±ΠΎΡ.
|
|
19
|
+
- ΠΠΎΠΏΡΠΎΡΡ ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΈΠ΄ΡΡ Π² ΡΡ ΡΠ΅ΡΡΠΈΡ, ΠΊΠΎΡΠΎΡΠ°Ρ ΠΎΡΠΊΡΡΡΠ° Π² Telegram; ΠΎΡΡΠ°Π»ΡΠ½ΡΠ΅ ΡΠ΅ΡΡΠΈΠΈ ΠΎΡΡΠ°ΡΡΡΡ Π² Web ΠΈ ΡΠ΅ΡΠ΅Π· 15 ΡΠ΅ΠΊΡΠ½Π΄ ΠΏΠΎΠ»ΡΡΠ°ΡΡ ΡΠ΅ΠΊΡΡΠΎΠ²ΠΎΠ΅ ΡΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΠ΅.
|
|
19
20
|
- ΠΠ»Π°Π²Π½ΠΎΠ΅ ΠΌΠ΅Π½Ρ Ρ Π±Π°Π»Π°Π½ΡΠΎΠΌ, ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎΠΌ, ΡΠ΅ΡΡΠΈΠ΅ΠΉ, ΠΏΡΠΎΡΠ΅Π½ΡΠΎΠΌ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΈ ΡΠ²Π΅ΡΠ½ΡΠΌΠΈ ΠΊΠ½ΠΎΠΏΠΊΠ°ΠΌΠΈ.
|
|
21
|
+
- ΠΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΡΠΎΠ²ΠΏΠ°Π΄Π°Π΅Ρ Ρ Web, Π² ΡΠΎΠΌ ΡΠΈΡΠ»Π΅ ΡΡΠ°Π·Ρ ΠΏΠΎΡΠ»Π΅ ΡΠΆΠ°ΡΠΈΡ, ΠΈ ΠΎΠ±Π½ΠΎΠ²Π»ΡΠ΅ΡΡΡ ΠΏΡΠΈ ΠΊΠ°ΠΆΠ΄ΠΎΠΌ ΠΎΡΠΊΡΡΡΠΈΠΈ `/start` ΠΈΠ»ΠΈ `/menu`.
|
|
22
|
+
- ΠΡΡΡΡΠ΅ ΡΠ΅ΡΡΠΈΠΈ ΡΠΊΡΡΡΡ ΠΈ ΠΏΠ΅ΡΠ΅ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡΡΡΡ: ΠΏΠΎΠ²ΡΠΎΡΠ½ΠΎΠ΅ Π½Π°ΠΆΠ°ΡΠΈΠ΅ Β«ΠΠΎΠ²Π°Ρ ΡΠ΅ΡΡΠΈΡΒ» Π½Π΅ ΠΏΠ»ΠΎΠ΄ΠΈΡ Π΄ΡΠ±Π»ΠΈ, ΡΠ΅ΠΊΡΡΠ°Ρ ΠΏΠΎΠΌΠ΅ΡΠ΅Π½Π° `β
`.
|
|
20
23
|
- ΠΠ²ΡΠΊ on/off Π΄Π»Ρ ΡΠ°ΡΠ°, ΡΠΆΠ°ΡΠΈΠ΅ ΠΈΡΡΠΎΡΠΈΠΈ ΡΠ΅ΡΠ΅Π· `/compact`, ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Ρ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠ΅ΠΌ.
|
|
21
24
|
- ΠΠ΄ΠΌΠΈΠ½-ΡΠΊΡΠ°Π½ Ρ Π»ΠΎΠ³Π°ΠΌΠΈ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΎΠΌ ΠΈ ΡΠ΄Π°Π»ΡΠ½Π½ΡΠΌ ΠΏΠ΅ΡΠ΅Π·Π°ΠΏΡΡΠΊΠΎΠΌ Harness.
|
|
22
|
-
- Π ΡΡΡΠΊΠΈΠΉ ΠΈΠ»ΠΈ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ ΠΏΠΎ ΡΠ·ΡΠΊΡ Telegram (`ru*` β ΡΡΡΡΠΊΠΈΠΉ,
|
|
25
|
+
- Π ΡΡΡΠΊΠΈΠΉ ΠΈΠ»ΠΈ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ ΠΏΠΎ ΡΠ·ΡΠΊΡ Telegram (`ru*` β ΡΡΡΡΠΊΠΈΠΉ, Π»ΡΠ±ΠΎΠΉ Π΄ΡΡΠ³ΠΎΠΉ β Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ). ΠΠ΅Π½Ρ, ΠΊΠ½ΠΎΠΏΠΊΠΈ, progress, Π²ΠΎΠΏΡΠΎΡΡ, ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΈ ΠΎΠΏΠΈΡΠ°Π½ΠΈΡ ΠΊΠΎΠΌΠ°Π½Π΄ ΡΠ»Π΅Π΄ΡΡΡ ΡΡΠΎΠΌΡ ΠΏΡΠ°Π²ΠΈΠ»Ρ; ΡΡΡΠ°Π½ΠΈΡΠ° Π½Π°ΡΡΡΠΎΠ΅ΠΊ Π² Web β ΡΠ·ΡΠΊΡ Web-ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°.
|
|
26
|
+
|
|
27
|
+
## Π‘ΠΊΡΠΈΠ½ΡΠΎΡΡ
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
ΠΠ»Π°Π²Π½ΠΎΠ΅ ΠΌΠ΅Π½Ρ Π½Π° ΡΡΡΡΠΊΠΎΠΌ: Π±Π°Π»Π°Π½Ρ, Π°ΠΊΡΠΈΠ²Π½ΠΎΠ΅ ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎ ΠΈ ΡΠ΅ΡΡΠΈΡ, ΠΏΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΈ ΠΊΠ½ΠΎΠΏΠΊΠΈ Π΄Π΅ΠΉΡΡΠ²ΠΈΠΉ.
|
|
32
|
+
|
|
33
|
+
## Π§ΡΠΎ Π½ΠΎΠ²ΠΎΠ³ΠΎ
|
|
34
|
+
|
|
35
|
+
- **0.2.7 β ΡΠ²Π΅ΠΆΠΈΠΉ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡ ΠΈ ΡΠΏΠΎΠΊΠΎΠΉΠ½ΠΎΠ΅ ΡΠΆΠ°ΡΠΈΠ΅.** ΠΠ΅Π½Ρ ΡΠΈΡΠ°Π΅Ρ projection view (`projectedTokens`), ΠΏΠΎΡΡΠΎΠΌΡ ΠΏΡΠΎΡΠ΅Π½Ρ Π²Π΅ΡΠ½ΡΠΉ ΡΡΠ°Π·Ρ ΠΏΠΎΡΠ»Π΅ ΡΠΆΠ°ΡΠΈΡ ΠΈ ΠΏΡΠΈ ΠΊΠ°ΠΆΠ΄ΠΎΠΌ `/start`; Π½Π°ΠΆΠ°ΡΠΈΠ΅ **Β«Π‘ΠΆΠ°ΡΡΒ»** Π·Π°ΠΌΠ΅Π½ΡΠ΅Ρ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠ΅ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ΠΌ Β«ΠΠΆΠΈΠ΄Π°ΠΉΡΠ΅Β» ΠΈ ΡΠ±ΠΈΡΠ°Π΅Ρ ΠΊΠ½ΠΎΠΏΠΊΠΈ.
|
|
36
|
+
- **0.2.6 β ΠΌΠ°ΡΡΡΡΡΠΈΠ·Π°ΡΠΈΡ.** ΠΠΎΠΏΡΠΎΡΡ ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΏΡΠΈΠ½Π°Π΄Π»Π΅ΠΆΠ°Ρ ΡΠ΅ΡΡΠΈΠΈ, ΠΊΠΎΡΠΎΡΠ°Ρ ΡΠ΅ΠΉΡΠ°Ρ ΠΎΡΠΊΡΡΡΠ° Π² Telegram. ΠΡΡΠ°Π»ΡΠ½ΡΠ΅ ΡΠ΅ΡΡΠΈΠΈ ΠΎΡΡΠ°ΡΡΡΡ Π² Web, Π° ΡΠ΅ΡΠ΅Π· 15 ΡΠ΅ΠΊΡΠ½Π΄ Π±ΠΎΡ ΠΏΡΠΈΡΡΠ»Π°Π΅Ρ ΡΠ΅ΠΊΡΡ Ρ Π½Π°Π·Π²Π°Π½ΠΈΠ΅ΠΌ ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²Π° ΠΈ ΡΠ΅ΡΡΠΈΠΈ.
|
|
37
|
+
- **0.2.5 β ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡ ΠΈ ΡΠ΅ΡΡΠΈΠΈ.** ΠΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΡΠΎΠ²ΠΏΠ°Π΄Π°Π΅Ρ Ρ Web ΠΏΠΎΡΠ»Π΅ ΡΠΆΠ°ΡΠΈΡ (`projectedTokens`), ΠΏΡΡΡΡΠ΅ ΡΠ΅ΡΠ½ΠΎΠ²ΠΈΠΊΠΈ ΡΠ΅ΡΡΠΈΠΉ ΡΠΊΡΡΡΡ ΠΈ ΠΏΠ΅ΡΠ΅ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡΡΡΡ, ΡΠ΅ΠΊΡΡΠ°Ρ ΠΏΠΎΠΌΠ΅ΡΠ΅Π½Π° `β
`.
|
|
38
|
+
- **Π―Π·ΡΠΊΠΈ.** ΠΠ΅ΡΡ Π±ΠΎΡ ΡΠ»Π΅Π΄ΡΠ΅Ρ ΡΠ·ΡΠΊΡ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ° Telegram: `ru*` β ΡΡΡΡΠΊΠΈΠΉ, Π»ΡΠ±ΠΎΠΉ Π΄ΡΡΠ³ΠΎΠΉ β Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ. ΠΠΎΠΊΠ°Π»Ρ ΠΏΡΠΈΠ²ΡΠ·ΠΊΠΈ ΠΎΠ±Π½ΠΎΠ²Π»ΡΠ΅ΡΡΡ Π½Π° ΠΊΠ°ΠΆΠ΄ΠΎΠΌ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΈ, ΠΏΠΎΡΡΠΎΠΌΡ ΡΠΌΠ΅Π½Π° ΡΠ·ΡΠΊΠ° ΡΡΠ°Π·Ρ ΠΏΡΠΈΠΌΠ΅Π½ΡΠ΅ΡΡΡ ΠΊ progress, ΠΎΡΠ²Π΅ΡΠ°ΠΌ, Π²ΠΎΠΏΡΠΎΡΠ°ΠΌ ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡΠΌ.
|
|
23
39
|
|
|
24
40
|
## Π’ΡΠ΅Π±ΠΎΠ²Π°Π½ΠΈΡ
|
|
25
41
|
|
|
@@ -29,6 +45,13 @@ Telegram-ΠΌΠΎΡΡ Π΄Π»Ρ **DeepSeek Harness**. ΠΠ»Π°Π³ΠΈΠ½ ΡΡΡΠ°Π½Π°Π²Π»ΠΈΠ²
|
|
|
29
45
|
- Π§ΠΈΡΠ»ΠΎΠ²ΠΎΠΉ Telegram ID, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ ΠΈΠ· [@userinfobot](https://t.me/userinfobot).
|
|
30
46
|
- ΠΠ°ΠΏΡΡΠ΅Π½Π½ΡΠΉ Host. ΠΠ΄ΠΈΠ½ ΡΠΎΠΊΠ΅Π½ ΠΌΠΎΠΆΠ΅Ρ ΠΎΠΏΡΠ°ΡΠΈΠ²Π°ΡΡ ΡΠΎΠ»ΡΠΊΠΎ ΠΎΠ΄ΠΈΠ½ Host-ΠΏΡΠΎΡΠ΅ΡΡ (ΠΈΠ½Π°ΡΠ΅ Telegram Π²Π΅ΡΠ½ΡΡ `409 Conflict`).
|
|
31
47
|
|
|
48
|
+
## Π‘ΡΠ΅ΠΊ
|
|
49
|
+
|
|
50
|
+
- DeepSeek Harness, ΠΏΡΠΎΡΠΈΠ»Ρ `web`, ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π²Π½Π΅ΡΠ½ΠΈΠΌ Cordis-Π±Π°Π½Π΄Π»ΠΎΠΌ (`cordis.patch.yml`).
|
|
51
|
+
- TypeScript, Node.js `>= 24.9`, grammY Π΄Π»Ρ long polling.
|
|
52
|
+
- React-ΡΡΡΠ°Π½ΠΈΡΠ° Π½Π°ΡΡΡΠΎΠ΅ΠΊ ΡΠ΅ΡΠ΅Π· client slots DSH.
|
|
53
|
+
- ΠΠ΅Π· runtime-ΠΈΠΌΠΏΠΎΡΡΠΎΠ² `@deepseek-ai/dsh-*`: ΡΠ΅ΡΠ²ΠΈΡΡ Host ΠΎΠΏΠΈΡΠ°Π½Ρ Π»ΠΎΠΊΠ°Π»ΡΠ½ΡΠΌΠΈ ΡΠΈΠΏΠ°ΠΌΠΈ.
|
|
54
|
+
|
|
32
55
|
## Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ°
|
|
33
56
|
|
|
34
57
|
ΠΠ°ΠΊΠ΅Ρ ΠΎΠΏΡΠ±Π»ΠΈΠΊΠΎΠ²Π°Π½ Π² npm ΠΊΠ°ΠΊ **`@shliamb/dsh-telegram-bot`**. ΠΠΎΡΠΎΡΠΊΠΎΠ΅ ΠΈΠΌΡ `dsh-telegram-bot` ΡΠΆΠ΅ Π·Π°Π½ΡΡΠΎ Π΄ΡΡΠ³ΠΈΠΌ ΠΏΡΠΎΠ΅ΠΊΡΠΎΠΌ, ΠΏΠΎΡΡΠΎΠΌΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠΉΡΠ΅ ΠΈΠΌΡ ΡΠΎ scope.
|
|
@@ -59,13 +82,13 @@ pnpm dsh web
|
|
|
59
82
|
Π ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΈ ΡΠ°ΠΊΠΆΠ΅ Π»Π΅ΠΆΠΈΡ Π³ΠΎΡΠΎΠ²ΡΠΉ ΠΊ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ΅ Π°ΡΡ
ΠΈΠ²:
|
|
60
83
|
|
|
61
84
|
```text
|
|
62
|
-
dist/shliamb-dsh-telegram-bot-0.2.
|
|
85
|
+
dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
63
86
|
```
|
|
64
87
|
|
|
65
88
|
ΠΡΠ»ΠΈ ΠΊΠΎΠΌΠ°Π½Π΄Π° `dsh` Π΄ΠΎΡΡΡΠΏΠ½Π° Π² `PATH`, Π²ΡΠΏΠΎΠ»Π½ΠΈΡΠ΅ ΠΈΠ· ΠΊΠΎΡΠ½Ρ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΡ:
|
|
66
89
|
|
|
67
90
|
```bash
|
|
68
|
-
dsh plugin --profile web add ./dist/shliamb-dsh-telegram-bot-0.2.
|
|
91
|
+
dsh plugin --profile web add ./dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
69
92
|
dsh web
|
|
70
93
|
```
|
|
71
94
|
|
|
@@ -73,7 +96,7 @@ dsh web
|
|
|
73
96
|
|
|
74
97
|
```bash
|
|
75
98
|
cd /path/to/deepseek-harness
|
|
76
|
-
pnpm dsh plugin --profile web add /path/to/HarnessBot/dist/shliamb-dsh-telegram-bot-0.2.
|
|
99
|
+
pnpm dsh plugin --profile web add /path/to/HarnessBot/dist/shliamb-dsh-telegram-bot-0.2.7.tgz
|
|
77
100
|
pnpm dsh web
|
|
78
101
|
```
|
|
79
102
|
|
|
@@ -160,7 +183,7 @@ ID Π°Π΄ΠΌΠΈΠ½Π° Ρ
ΡΠ°Π½ΠΈΡΡΡ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ ΠΏΠ»Π°Π³ΠΈΠ½Π°. ΠΡΠ»ΠΈ `all
|
|
|
160
183
|
|
|
161
184
|
### ΠΠΎΠΌΠ°Π½Π΄Ρ
|
|
162
185
|
|
|
163
|
-
Π ΠΌΠ΅Π½Ρ ΠΊΠΎΠΌΠ°Π½Π΄ Telegram Π²ΠΈΠ΄Π½Π° ΡΠΎΠ»ΡΠΊΠΎ `/start`.
|
|
186
|
+
Π ΠΌΠ΅Π½Ρ ΠΊΠΎΠΌΠ°Π½Π΄ Telegram Π²ΠΈΠ΄Π½Π° ΡΠΎΠ»ΡΠΊΠΎ `/start`. `/admin` Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡΠ΅Π»ΡΠ½ΠΎ Π΄ΠΎΡΡΡΠΏΠ΅Π½ ΡΠΎΠ»ΡΠΊΠΎ Π² ΡΠ°ΡΠ΅ Π°Π΄ΠΌΠΈΠ½Π°; ΠΎΡΡΠ°Π»ΡΠ½ΡΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ ΡΠΊΡΡΡΡ, Π½ΠΎ ΡΠ°Π±ΠΎΡΠ°ΡΡ ΠΏΡΠΈ Π²Π²ΠΎΠ΄Π΅ Π²ΡΡΡΠ½ΡΡ.
|
|
164
187
|
|
|
165
188
|
| ΠΠΎΠΌΠ°Π½Π΄Π° | ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ |
|
|
166
189
|
| --- | --- |
|
|
@@ -174,6 +197,10 @@ ID Π°Π΄ΠΌΠΈΠ½Π° Ρ
ΡΠ°Π½ΠΈΡΡΡ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ ΠΏΠ»Π°Π³ΠΈΠ½Π°. ΠΡΠ»ΠΈ `all
|
|
|
174
197
|
|
|
175
198
|
Π€ΠΈΠ½Π°Π»ΡΠ½ΡΠ΅ ΠΎΡΠ²Π΅ΡΡ ΠΏΡΠΈΡ
ΠΎΠ΄ΡΡ ΠΎΡΠ΄Π΅Π»ΡΠ½ΡΠΌΠΈ rich-ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡΠΌΠΈ. ΠΠ»ΠΈΠ½Π½ΡΠΉ ΡΠ΅ΠΊΡΡ Π΄Π΅Π»ΠΈΡΡΡ Π½Π° ΡΠ°ΡΡΠΈ ΠΏΠΎ Π»ΠΈΠΌΠΈΡΡ Telegram. ΠΡΠ»ΠΈ rich-ΡΠΎΡΠΌΠ°ΡΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π½Π΅ ΡΠ΄Π°Π»ΠΎΡΡ, ΠΏΠ»Π°Π³ΠΈΠ½ ΠΏΠΎΠ²ΡΠΎΡΡΠ΅Ρ ΠΏΠΎΠΏΡΡΠΊΡ Ρ rich HTML, Π·Π°ΡΠ΅ΠΌ Ρ ΠΎΠ±ΡΡΠ½ΡΠΌ ΡΠ΅ΠΊΡΡΠΎΠΌ, ΠΏΠΎΡΡΠΎΠΌΡ ΠΎΡΠ²Π΅Ρ Π½Π΅ ΡΠ΅ΡΡΠ΅ΡΡΡ.
|
|
176
199
|
|
|
200
|
+
### Π―Π·ΡΠΊΠΈ
|
|
201
|
+
|
|
202
|
+
ΠΠΎΡ ΡΠ»Π΅Π΄ΡΠ΅Ρ ΡΠ·ΡΠΊΡ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ° Telegram: ΠΊΠΎΠ΄ `ru*` Π²ΠΊΠ»ΡΡΠ°Π΅Ρ ΡΡΡΡΠΊΠΈΠΉ, Π»ΡΠ±ΠΎΠΉ Π΄ΡΡΠ³ΠΎΠΉ β Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ. ΠΠΎΠΊΠ°Π»Ρ ΠΏΡΠΈΠ²ΡΠ·ΠΊΠΈ ΠΎΠ±Π½ΠΎΠ²Π»ΡΠ΅ΡΡΡ Π½Π° ΠΊΠ°ΠΆΠ΄ΠΎΠΌ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΈ, ΠΏΠΎΡΡΠΎΠΌΡ progress, ΡΠΈΠ½Π°Π»ΡΠ½ΡΠ΅ ΠΎΡΠ²Π΅ΡΡ, Π²ΠΎΠΏΡΠΎΡΡ ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΡΡΠ°Π·Ρ ΠΏΠ΅ΡΠ΅ΠΊΠ»ΡΡΠ°ΡΡΡΡ ΠΏΠΎΡΠ»Π΅ ΡΠΌΠ΅Π½Ρ ΡΠ·ΡΠΊΠ° Π² Telegram. ΠΠΏΠΈΡΠ°Π½ΠΈΡ ΠΊΠΎΠΌΠ°Π½Π΄ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΡΡ ΡΠΎ ΠΆΠ΅ ΠΏΡΠ°Π²ΠΈΠ»ΠΎ. Π‘ΡΡΠ°Π½ΠΈΡΠ° Π½Π°ΡΡΡΠΎΠ΅ΠΊ Π² Web ΡΠ»Π΅Π΄ΡΠ΅Ρ ΡΠ·ΡΠΊΡ Web-ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°. Π’Π΅ΠΊΡΡ, ΠΊΠΎΡΠΎΡΡΠΉ ΠΏΠΈΡΠ΅Ρ Π°Π³Π΅Π½Ρ, ΠΎΡΡΠ°ΡΡΡΡ Π½Π° ΡΠ·ΡΠΊΠ΅ Π°Π³Π΅Π½ΡΠ°.
|
|
203
|
+
|
|
177
204
|
### ΠΡΠΎΡΡΡΠ°Π½ΡΡΠ²Π° ΠΈ ΡΠ΅ΡΡΠΈΠΈ
|
|
178
205
|
|
|
179
206
|
ΠΠΎΡΠ»Π΅ Π²ΡΠ±ΠΎΡΠ° ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²Π°:
|
|
@@ -202,7 +229,7 @@ ID Π°Π΄ΠΌΠΈΠ½Π° Ρ
ΡΠ°Π½ΠΈΡΡΡ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ ΠΏΠ»Π°Π³ΠΈΠ½Π°. ΠΡΠ»ΠΈ `all
|
|
|
202
229
|
|
|
203
230
|
### ΠΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΈ Π²ΠΎΠΏΡΠΎΡΡ
|
|
204
231
|
|
|
205
|
-
ΠΠΎΠ³Π΄Π° Π°Π³Π΅Π½Ρ ΠΏΡΠΎΡΠΈΡ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠ΄ΠΈΡΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½Ρ, Π±ΠΎΡ ΠΏΡΠΈΡΡΠ»Π°Π΅Ρ inline-ΠΊΠ½ΠΎΠΏΠΊΠΈ **Β«Π Π°Π·ΡΠ΅ΡΠΈΡΡΒ»** / **Β«ΠΠ°ΠΏΡΠ΅ΡΠΈΡΡΒ»**. ΠΠΎΠ³Π΄Π° Π°Π³Π΅Π½Ρ Π·Π°Π΄Π°ΡΡ Π²ΠΎΠΏΡΠΎΡ Ρ Π³ΠΎΡΠΎΠ²ΡΠΌΠΈ Π²Π°ΡΠΈΠ°Π½ΡΠ°ΠΌΠΈ, ΠΎΡΠ²Π΅ΡΡ ΡΠΎΠΆΠ΅ ΠΏΡΠΈΡ
ΠΎΠ΄ΡΡ ΠΊΠ½ΠΎΠΏΠΊΠ°ΠΌΠΈ.
|
|
232
|
+
ΠΠΎΠ³Π΄Π° Π°Π³Π΅Π½Ρ ΠΏΡΠΎΡΠΈΡ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠ΄ΠΈΡΡ ΠΈΠ½ΡΡΡΡΠΌΠ΅Π½Ρ, Π±ΠΎΡ ΠΏΡΠΈΡΡΠ»Π°Π΅Ρ inline-ΠΊΠ½ΠΎΠΏΠΊΠΈ **Β«Π Π°Π·ΡΠ΅ΡΠΈΡΡΒ»** / **Β«ΠΠ°ΠΏΡΠ΅ΡΠΈΡΡΒ»**. ΠΠΎΠ³Π΄Π° Π°Π³Π΅Π½Ρ Π·Π°Π΄Π°ΡΡ Π²ΠΎΠΏΡΠΎΡ Ρ Π³ΠΎΡΠΎΠ²ΡΠΌΠΈ Π²Π°ΡΠΈΠ°Π½ΡΠ°ΠΌΠΈ, ΠΎΡΠ²Π΅ΡΡ ΡΠΎΠΆΠ΅ ΠΏΡΠΈΡ
ΠΎΠ΄ΡΡ ΠΊΠ½ΠΎΠΏΠΊΠ°ΠΌΠΈ. Π Telegram ΠΊΠ°ΡΡΠΎΡΠΊΠ° Π·Π°ΠΊΡΡΠ²Π°Π΅ΡΡΡ ΡΠ΅ΡΠ΅Π· 10 ΠΌΠΈΠ½ΡΡ; Π²ΠΎΠΏΡΠΎΡ Π±Π΅Π· ΠΎΡΠ²Π΅ΡΠ° Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅ΡΡΡ ΠΊΠ°ΠΊ ΠΏΡΠΎΠΏΡΡΠ΅Π½Π½ΡΠΉ.
|
|
206
233
|
|
|
207
234
|
ΠΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ ΠΈ Π²ΠΎΠΏΡΠΎΡΡ ΠΎΡΠ²Π΅ΡΠ°ΡΡΡΡ Π΄Π»Ρ ΠΏΡΠΈΠ²ΡΠ·Π°Π½Π½ΠΎΠΉ ΡΠ΅ΡΡΠΈΠΈ. ΠΠΎΡ Π·Π°Π΄Π°ΡΡ Π²ΠΎΠΏΡΠΎΡΡ ΠΏΠΎ ΠΎΠ΄Π½ΠΎΠΌΡ. Π single-select Π½Π°ΠΆΠ°ΡΠΈΠ΅ Π²Π°ΡΠΈΠ°Π½ΡΠ° ΡΡΠ°Π·Ρ ΠΎΡΠΏΡΠ°Π²Π»ΡΠ΅Ρ ΠΎΡΠ²Π΅Ρ; Π² multi-select ΠΎΡΠΌΠ΅ΡΡ Π²Π°ΡΠΈΠ°Π½ΡΡ ΠΈ Π½Π°ΠΆΠΌΠΈ **Β«ΠΠΎΡΠΎΠ²ΠΎΒ»**. Π’Π΅ΠΊΡΡ, ΠΎΡΠΏΡΠ°Π²Π»Π΅Π½Π½ΡΠΉ ΠΏΡΠΈ ΠΎΡΠΊΡΡΡΠΎΠΌ Π²ΠΎΠΏΡΠΎΡΠ΅, ΡΡ
ΠΎΠ΄ΠΈΡ ΠΊΠ°ΠΊ Β«ΡΠ²ΠΎΠΉ ΠΎΡΠ²Π΅ΡΒ» (Π² multi-select Π΄ΠΎΠΏΠΎΠ»Π½ΡΠ΅Ρ Π²ΡΠ±ΡΠ°Π½Π½ΡΠ΅ Π²Π°ΡΠΈΠ°Π½ΡΡ), Π° **Β«ΠΡΠΎΠΏΡΡΡΠΈΡΡΒ»** ΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ Π²ΠΎΠΏΡΠΎΡ Π±Π΅Π· ΠΎΡΠ²Π΅ΡΠ°. ΠΠΎΠΊΠ° Π²ΠΎΠΏΡΠΎΡ ΠΈΠ»ΠΈ approval ΠΎΡΠΊΡΡΡ, ΠΎΠ±ΡΡΠ½ΡΠΉ ΡΠ΅ΠΊΡΡ Π½Π΅ ΡΡΠ°Π²ΠΈΡΡΡ Π² ΠΎΡΠ΅ΡΠ΅Π΄Ρ ΠΊΠ°ΠΊ Π½ΠΎΠ²Π°Ρ Π·Π°Π΄Π°ΡΠ°.
|
|
208
235
|
|
|
@@ -210,7 +237,7 @@ ID Π°Π΄ΠΌΠΈΠ½Π° Ρ
ΡΠ°Π½ΠΈΡΡΡ Π² ΠΊΠΎΠ½ΡΠΈΠ³Π΅ ΠΏΠ»Π°Π³ΠΈΠ½Π°. ΠΡΠ»ΠΈ `all
|
|
|
210
237
|
|
|
211
238
|
### Π‘ΠΆΠ°ΡΠΈΠ΅, Π·Π²ΡΠΊ ΠΈ ΠΎΡΡΠ°Π½ΠΎΠ²ΠΊΠ°
|
|
212
239
|
|
|
213
|
-
- **Β«Π‘ΠΆΠ°ΡΡΒ»** ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°Π΅Ρ ΡΠ΅ΠΊΡΡΠΈΠΉ ΠΏΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΈ ΠΏΡΠΎΡΠΈΡ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠ΅. ΠΠ»Π°Π³ΠΈΠ½ Π²ΡΠ·ΡΠ²Π°Π΅Ρ preset-ΠΊΠΎΠΌΠ°Π½Π΄Ρ `/compact` ΡΠ΅ΡΠ΅Π· ΡΠ΅ΡΠ²ΠΈΡ `commands`, Π·Π°ΡΠ΅ΠΌ ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°Π΅Ρ Π»ΠΎΠΊΠ°Π»ΠΈΠ·ΠΎΠ²Π°Π½Π½ΡΠΉ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΠΈ Π½ΠΎΠ²ΡΠΉ ΠΏΡΠΎΡΠ΅Π½Ρ. ΠΡΠ»ΠΈ Π°Π³Π΅Π½Ρ Π·Π°Π½ΡΡ, ΡΠΆΠ°ΡΠΈΠ΅ ΠΎΡΠΊΠ»ΠΎΠ½ΡΠ΅ΡΡΡ.
|
|
240
|
+
- **Β«Π‘ΠΆΠ°ΡΡΒ»** ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°Π΅Ρ ΡΠ΅ΠΊΡΡΠΈΠΉ ΠΏΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΈ ΠΏΡΠΎΡΠΈΡ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠ΅. ΠΠΎΡΠ»Π΅ Π½Π°ΠΆΠ°ΡΠΈΡ **Β«Π‘ΠΆΠ°ΡΡΒ»** ΠΊΠ°ΡΡΠΎΡΠΊΠ° Π·Π°ΠΌΠ΅Π½ΡΠ΅ΡΡΡ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ΠΌ Β«ΠΠΆΠΈΠ΄Π°ΠΉΡΠ΅Β», Π° ΠΊΠ½ΠΎΠΏΠΊΠΈ ΠΈΡΡΠ΅Π·Π°ΡΡ, ΠΏΠΎΡΡΠΎΠΌΡ ΠΏΠΎΠ²ΡΠΎΡΠ½ΡΠ΅ Π½Π°ΠΆΠ°ΡΠΈΡ Π½ΠΈΡΠ΅Π³ΠΎ Π½Π΅ Π΄Π΅Π»Π°ΡΡ. ΠΠ»Π°Π³ΠΈΠ½ Π²ΡΠ·ΡΠ²Π°Π΅Ρ preset-ΠΊΠΎΠΌΠ°Π½Π΄Ρ `/compact` ΡΠ΅ΡΠ΅Π· ΡΠ΅ΡΠ²ΠΈΡ `commands`, Π·Π°ΡΠ΅ΠΌ ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°Π΅Ρ Π»ΠΎΠΊΠ°Π»ΠΈΠ·ΠΎΠ²Π°Π½Π½ΡΠΉ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΠΈ Π½ΠΎΠ²ΡΠΉ ΠΏΡΠΎΡΠ΅Π½Ρ. ΠΡΠ»ΠΈ Π°Π³Π΅Π½Ρ Π·Π°Π½ΡΡ, ΡΠΆΠ°ΡΠΈΠ΅ ΠΎΡΠΊΠ»ΠΎΠ½ΡΠ΅ΡΡΡ.
|
|
214
241
|
- **Β«ΠΠ²ΡΠΊΒ»** Ρ
ΡΠ°Π½ΠΈΡΡΡ Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΡΠ°ΡΠ°. ΠΠΎΠ³Π΄Π° ΠΎΠ½ Π²ΡΠΊΠ»ΡΡΠ΅Π½, ΠΎΡΠ²Π΅ΡΡ, ΠΏΡΠ°Π²ΠΊΠΈ progress ΠΈ ΠΏΡΠΈΠ²Π΅ΡΡΡΠ²ΠΈΠ΅ ΠΏΡΠΈ ΡΡΠ°ΡΡΠ΅ ΠΈΠ΄ΡΡ Ρ `disable_notification`.
|
|
215
242
|
- **Β«Π‘ΡΠΎΠΏΒ»** ΠΏΡΠΎΡΠΈΡ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠ΅, Π·Π°ΡΠ΅ΠΌ ΠΎΡΠΌΠ΅Π½ΡΠ΅Ρ ΡΠ΅ΠΊΡΡΠΈΠΉ Ρ
ΠΎΠ΄ ΡΠ΅ΡΠ΅Π· `agent.cancel({ kind: 'user' })`.
|
|
216
243
|
|
|
@@ -285,6 +312,7 @@ pnpm pack --pack-destination dist
|
|
|
285
312
|
src/index.ts Host-ΠΏΠ»Π°Π³ΠΈΠ½: ΠΊΠΎΠ½ΡΠΈΠ³, runtime Π±ΠΎΡΠ°, ΠΌΠ΅Π½Ρ, ΠΊΠΎΠΌΠ°Π½Π΄Ρ
|
|
286
313
|
src/client/index.tsx Web-ΡΡΡΠ°Π½ΠΈΡΠ° Π½Π°ΡΡΡΠΎΠ΅ΠΊ (ΡΠΎΠΊΠ΅Π½ + ID Π°Π΄ΠΌΠΈΠ½Π°)
|
|
287
314
|
src/client/locales.ts Π ΡΡΡΠΊΠΈΠ΅ ΠΈ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠ΅ ΡΡΡΠΎΠΊΠΈ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°
|
|
315
|
+
images/ Π‘ΠΊΡΠΈΠ½ΡΠΎΡΡ Π΄Π»Ρ README
|
|
288
316
|
src/state/index.ts ΠΡΠΈΠ²ΡΠ·ΠΊΠΈ ΡΠ°ΡΠΎΠ² Π² storageDomain
|
|
289
317
|
src/logging/index.ts JSONL-Π»ΠΎΠ³ Ρ ΡΠΎΡΠ°ΡΠΈΠ΅ΠΉ
|
|
290
318
|
src/*/SPEC.md ΠΠΎΠ½ΡΡΠ°ΠΊΡΡ ΠΌΠΎΠ΄ΡΠ»Π΅ΠΉ ΠΈ ΡΠΎΡΠΌΠ°ΡΡ Π΄Π°Π½Π½ΡΡ
|
|
@@ -301,13 +329,14 @@ dist/ ΠΠΎΡΠΎΠ²ΡΠΉ ΡΡΡΠ°Π½ΠΎΠ²ΠΎΡΠ½ΡΠΉ Π°ΡΡ
ΠΈΠ²
|
|
|
301
329
|
- Π Web-Π½Π°ΡΡΡΠΎΠΉΠΊΠ°Ρ
ΡΠΎΠ»ΡΠΊΠΎ ΡΠΎΠΊΠ΅Π½ ΠΈ ID Π°Π΄ΠΌΠΈΠ½Π°; `lowBalanceUsd`, `rich` ΠΈ `apiRoot` Π·Π°Π΄Π°ΡΡΡΡ ΡΠ΅ΡΠ΅Π· `cordis.patch.yml`.
|
|
302
330
|
- ΠΠ΅Ρ Π³ΠΎΠ»ΠΎΡΠΎΠ²ΡΡ
ΠΈ ΡΠ°ΠΉΠ»ΠΎΠ²: Telegram ΡΠ°ΠΌ ΡΡΠ°Π½ΡΠΊΡΠΈΠ±ΠΈΡΡΠ΅Ρ Π³ΠΎΠ»ΠΎΡ.
|
|
303
331
|
- ΠΠ΅Ρ Π½Π°ΡΡΡΠΎΠΉΠΊΠΈ ΠΏΡΠΎΠΊΡΠΈ.
|
|
304
|
-
-
|
|
332
|
+
- ΠΠΎΠΏΡΠΎΡΡ ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΡ Π°ΠΊΡΠΈΠ²Π½ΠΎΠΉ Telegram-ΡΠ΅ΡΡΠΈΠΈ ΠΏΠΎΠΊΠ°Π·ΡΠ²Π°ΡΡΡΡ ΡΠΎΠ»ΡΠΊΠΎ Π² Telegram; ΠΎΡΡΠ°Π»ΡΠ½ΡΠ΅ ΡΠ΅ΡΡΠΈΠΈ ΠΎΡΡΠ°ΡΡΡΡ Π² Web Ρ ΠΎΡΠ»ΠΎΠΆΠ΅Π½Π½ΡΠΌ ΡΠ΅ΠΊΡΡΠΎΠ²ΡΠΌ ΡΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΠ΅ΠΌ. Telegram ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ single-select, multi-select, ΡΠ²ΠΎΠΉ ΡΠ΅ΠΊΡΡ ΠΈ ΠΏΡΠΎΠΏΡΡΠΊ.
|
|
305
333
|
- ΠΡΡΠ»Π΅ΠΆΠΈΠ²Π°Π½ΠΈΠ΅ progress ΠΆΠΈΠ²ΡΡ Π² ΠΏΠ°ΠΌΡΡΠΈ, ΠΏΠΎΡΡΠΎΠΌΡ ΠΏΠ΅ΡΠ΅Π·Π°ΠΏΡΡΠΊ Host ΠΏΠΎΡΡΠ΅Π΄ΠΈ Ρ
ΠΎΠ΄Π° ΠΌΠΎΠΆΠ΅Ρ ΠΎΡΡΠ°Π²ΠΈΡΡ ΡΡΡΠ°ΡΠ΅Π²ΡΠ΅Π΅ progress-ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅.
|
|
306
334
|
|
|
307
335
|
## Roadmap
|
|
308
336
|
|
|
309
|
-
-
|
|
310
|
-
-
|
|
337
|
+
- ΠΠΎΡΠΎΠ²ΠΎ Π² 0.2.5: ΠΏΡΠΎΡΠ΅Π½Ρ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΏΠΎ `projectedTokens`, ΠΏΠ΅ΡΠ΅ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ ΠΏΡΡΡΡΡ
ΡΠ΅ΡΡΠΈΠΉ, `β
` ΡΠ΅ΠΊΡΡΠ΅ΠΉ ΡΠ΅ΡΡΠΈΠΈ, Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΈΠΉ fallback ΠΊΠΎΠΌΠ°Π½Π΄, ΡΠΈΠ½Ρ
ΡΠΎΠ½ΠΈΠ·Π°ΡΠΈΡ Π»ΠΎΠΊΠ°Π»ΠΈ.
|
|
338
|
+
- ΠΠΎΡΠΎΠ²ΠΎ Π² 0.2.6: ΠΌΠ°ΡΡΡΡΡΠΈΠ·Π°ΡΠΈΡ Π²ΠΎΠΏΡΠΎΡΠΎΠ² ΠΈ ΠΏΠΎΠ΄ΡΠ²Π΅ΡΠΆΠ΄Π΅Π½ΠΈΠΉ ΠΏΠΎ Π°ΠΊΡΠΈΠ²Π½ΠΎΠΉ ΡΠ΅ΡΡΠΈΠΈ, ΡΠ΅ΠΊΡΡΠΎΠ²ΠΎΠ΅ ΡΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΠ΅ Web ΡΠ΅ΡΠ΅Π· 15 ΡΠ΅ΠΊΡΠ½Π΄, Π΄ΠΈΠ°Π³Π½ΠΎΡΡΠΈΠΊΠ°.
|
|
339
|
+
- ΠΠ°Π»ΡΡΠ΅: ΡΠ±ΡΠ°ΡΡ Π»ΠΈΡΠ½ΡΡ ΠΎΡΠΈΡΡΠΊΡ ΠΊΠ»Π°Π²ΠΈΠ°ΡΡΡΡ Π²ΠΎΠΏΡΠΎΡΠ°; `/history`; ΠΌΠ°ΡΡΡΡΡΠΈΠ·Π°ΡΠΈΡ ΠΎΡΠ²Π΅ΡΠΎΠ²; ΡΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΡ ΠΎ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΠΈ Π² Π΄ΡΡΠ³ΠΈΡ
ΡΠ΅ΡΡΠΈΡΡ
; ΠΊΠ°ΡΠ°Π»ΠΎΠ³ ΠΏΠ»Π°Π³ΠΈΠ½ΠΎΠ².
|
|
311
340
|
|
|
312
341
|
## ΠΠΈΡΠ΅Π½Π·ΠΈΡ
|
|
313
342
|
|
package/lib/index.js
CHANGED
|
@@ -84,6 +84,8 @@ const STRINGS = {
|
|
|
84
84
|
compactNoHistory: 'ΠΠ΅ΡΠ΅Π³ΠΎ ΡΠΆΠΈΠΌΠ°ΡΡ.',
|
|
85
85
|
compactConfirm: 'Π‘ΡΠ°ΡΠ°Ρ ΠΈΡΡΠΎΡΠΈΡ Π±ΡΠ΄Π΅Ρ Π·Π°ΠΌΠ΅Π½Π΅Π½Π° ΠΊΡΠ°ΡΠΊΠΈΠΌ ΡΠ΅Π·ΡΠΌΠ΅.',
|
|
86
86
|
compactDone: 'ΠΡΡΠΎΡΠΈΡ ΡΠΆΠ°ΡΠ°.',
|
|
87
|
+
compactWorking: 'β³ Π‘ΠΆΠΈΠΌΠ°Ρ ΠΈΡΡΠΎΡΠΈΡβ¦\nΠΠΎΠ΄ΠΎΠΆΠ΄ΠΈΡΠ΅, ΠΏΠΎΠΆΠ°Π»ΡΠΉΡΡΠ°.',
|
|
88
|
+
compactResultTitle: 'Π‘ΠΆΠ°ΡΠΈΠ΅ ΠΈΡΡΠΎΡΠΈΠΈ',
|
|
87
89
|
stop: 'βΉ Π‘ΡΠΎΠΏ',
|
|
88
90
|
stopDone: 'ΠΡΡΠ°Π½ΠΎΠ²Π»Π΅Π½ΠΎ.',
|
|
89
91
|
stopIdle: 'ΠΠ΅ΡΠ΅Π³ΠΎ ΠΎΡΡΠ°Π½Π°Π²Π»ΠΈΠ²Π°ΡΡ.',
|
|
@@ -201,6 +203,8 @@ const STRINGS = {
|
|
|
201
203
|
compactNoHistory: 'No compactable history.',
|
|
202
204
|
compactConfirm: 'Older history will be replaced by a short summary.',
|
|
203
205
|
compactDone: 'History compacted.',
|
|
206
|
+
compactWorking: 'β³ Compacting historyβ¦\nPlease wait.',
|
|
207
|
+
compactResultTitle: 'History compaction',
|
|
204
208
|
stop: 'βΉ Stop',
|
|
205
209
|
stopDone: 'Stopped.',
|
|
206
210
|
stopIdle: 'Nothing to stop.',
|
|
@@ -499,7 +503,7 @@ async function getBalance(runtime, locale, force = false) {
|
|
|
499
503
|
}
|
|
500
504
|
try {
|
|
501
505
|
const result = await runtime.account.getBalance({
|
|
502
|
-
version: '@shliamb/dsh-telegram-bot/0.2.
|
|
506
|
+
version: '@shliamb/dsh-telegram-bot/0.2.7',
|
|
503
507
|
locale,
|
|
504
508
|
timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60,
|
|
505
509
|
});
|
|
@@ -531,28 +535,45 @@ async function getBalance(runtime, locale, force = false) {
|
|
|
531
535
|
return cache.value === undefined ? {} : { display: cache.value, amount: cache.amount, currency: cache.currency };
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
/**
|
|
539
|
+
* Read the client-facing context pressure. The projection view is the only
|
|
540
|
+
* place that carries `projectedTokens`, which already accounts for compaction;
|
|
541
|
+
* the token-meter facade returns the provider sample alone and therefore
|
|
542
|
+
* looks stale until the next request.
|
|
543
|
+
*/
|
|
544
|
+
function readContextPressure(runtime, session) {
|
|
545
|
+
try {
|
|
546
|
+
const snapshot = runtime.sessionProjections?.snapshot(session, ['contextPressure']);
|
|
547
|
+
const value = asRecord(snapshot?.values['contextPressure']);
|
|
548
|
+
if (value !== undefined) {
|
|
549
|
+
return {
|
|
550
|
+
...(typeof value['pressureTokens'] === 'number' ? { pressureTokens: value['pressureTokens'] } : {}),
|
|
551
|
+
...(typeof value['projectedTokens'] === 'number' ? { projectedTokens: value['projectedTokens'] } : {}),
|
|
552
|
+
...(typeof value['contextWindow'] === 'number' ? { contextWindow: value['contextWindow'] } : {}),
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
catch (error) {
|
|
557
|
+
runtime.logger.warn('context-projection-failed', messageOf(error));
|
|
540
558
|
}
|
|
559
|
+
return runtime.tokenMeter?.contextPressure(session);
|
|
560
|
+
}
|
|
561
|
+
async function getSessionContextLabel(runtime, sessionId) {
|
|
541
562
|
try {
|
|
542
563
|
const result = await runtime.sessions.resolveAgent(sessionId);
|
|
543
564
|
if (result.agent === undefined)
|
|
544
565
|
return undefined;
|
|
545
|
-
const pressure = runtime
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
//
|
|
566
|
+
const pressure = readContextPressure(runtime, result.agent.session);
|
|
567
|
+
if (pressure === undefined)
|
|
568
|
+
return undefined;
|
|
569
|
+
// Match the Web meter: `projectedTokens` is what the next request would
|
|
570
|
+
// carry, so compaction is visible immediately.
|
|
549
571
|
const used = pressure.projectedTokens ?? pressure.pressureTokens;
|
|
550
572
|
const percent = used !== undefined
|
|
551
573
|
&& pressure.contextWindow !== undefined
|
|
552
574
|
&& pressure.contextWindow > 0
|
|
553
|
-
? Math.round(100 * used / pressure.contextWindow)
|
|
575
|
+
? Math.min(100, Math.round(100 * used / pressure.contextWindow))
|
|
554
576
|
: undefined;
|
|
555
|
-
runtime.contextCache.set(sessionId, { percent, at: Date.now() });
|
|
556
577
|
return percent === undefined ? undefined : `${percent}%`;
|
|
557
578
|
}
|
|
558
579
|
catch (error) {
|
|
@@ -565,10 +586,10 @@ async function getContextLabel(runtime, binding) {
|
|
|
565
586
|
return undefined;
|
|
566
587
|
return getSessionContextLabel(runtime, binding.activeSessionId);
|
|
567
588
|
}
|
|
568
|
-
async function getMenuState(runtime, chatId, locale) {
|
|
589
|
+
async function getMenuState(runtime, chatId, locale, forceBalance = false) {
|
|
569
590
|
const binding = runtime.store.get(chatId);
|
|
570
591
|
const [balance, context] = await Promise.all([
|
|
571
|
-
getBalance(runtime, locale),
|
|
592
|
+
getBalance(runtime, locale, forceBalance),
|
|
572
593
|
getContextLabel(runtime, binding),
|
|
573
594
|
]);
|
|
574
595
|
return {
|
|
@@ -655,7 +676,6 @@ async function runCompact(runtime, chatId, locale, sessionId) {
|
|
|
655
676
|
// The preset that owns the session registers /compact together with its
|
|
656
677
|
// isolated compaction backend; calling the command uses the same path as Web.
|
|
657
678
|
const execution = await commands.execute(result.agent, '/compact', [], AbortSignal.timeout(300_000));
|
|
658
|
-
runtime.contextCache.delete(sessionId);
|
|
659
679
|
if (execution === undefined)
|
|
660
680
|
return t(locale, 'compactUnavailable');
|
|
661
681
|
runtime.logger.info('compact-result', 'manual compaction finished', {
|
|
@@ -679,7 +699,7 @@ async function runCompact(runtime, chatId, locale, sessionId) {
|
|
|
679
699
|
async function statusText(runtime, chatId, locale) {
|
|
680
700
|
const binding = runtime.store.get(chatId);
|
|
681
701
|
const workspace = binding?.activeWorkspaceId === undefined ? undefined : runtime.workspaces.get(binding.activeWorkspaceId);
|
|
682
|
-
const balance = await getBalance(runtime, locale);
|
|
702
|
+
const balance = await getBalance(runtime, locale, true);
|
|
683
703
|
const context = await getContextLabel(runtime, binding);
|
|
684
704
|
let agentStatus = 'β';
|
|
685
705
|
if (binding?.activeSessionId !== undefined) {
|
|
@@ -872,14 +892,6 @@ function buildQuestionResultView(question, answer, outcome, locale) {
|
|
|
872
892
|
}
|
|
873
893
|
return { html: html.join('\n'), text: text.join('\n'), keyboard: new InlineKeyboard() };
|
|
874
894
|
}
|
|
875
|
-
async function clearQuestionKeyboard(runtime, chatId, messageId) {
|
|
876
|
-
try {
|
|
877
|
-
await runtime.bot.api.editMessageReplyMarkup(chatId, messageId, { reply_markup: new InlineKeyboard() });
|
|
878
|
-
}
|
|
879
|
-
catch (error) {
|
|
880
|
-
runtime.logger.warn('question-keyboard-clear-failed', messageOf(error), { chatId });
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
895
|
async function handleApproval(runtime, request, next) {
|
|
884
896
|
if (request.signal?.aborted === true)
|
|
885
897
|
return 'cancelled';
|
|
@@ -1019,7 +1031,6 @@ async function askQuestion(runtime, chatId, sessionId, locale, question, questio
|
|
|
1019
1031
|
const result = buildQuestionResultView(question, answer, outcome, locale);
|
|
1020
1032
|
void (async () => {
|
|
1021
1033
|
await editRich(runtime, chatId, messageId, result);
|
|
1022
|
-
await clearQuestionKeyboard(runtime, chatId, messageId);
|
|
1023
1034
|
})();
|
|
1024
1035
|
runtime.logger.info('question-closed', 'agent question closed', {
|
|
1025
1036
|
chatId,
|
|
@@ -1284,8 +1295,8 @@ async function sendPlain(runtime, chatId, text, silent = false) {
|
|
|
1284
1295
|
runtime.logger.error('send-failed', messageOf(error), { chatId });
|
|
1285
1296
|
}
|
|
1286
1297
|
}
|
|
1287
|
-
async function sendMainMenu(runtime, chatId, locale, editMessageId) {
|
|
1288
|
-
const state = await getMenuState(runtime, chatId, locale);
|
|
1298
|
+
async function sendMainMenu(runtime, chatId, locale, editMessageId, forceBalance = false) {
|
|
1299
|
+
const state = await getMenuState(runtime, chatId, locale, forceBalance);
|
|
1289
1300
|
const view = buildMainMenu(runtime.workspaces.list(), state, locale);
|
|
1290
1301
|
if (editMessageId !== undefined)
|
|
1291
1302
|
await editRich(runtime, chatId, editMessageId, view);
|
|
@@ -1340,6 +1351,25 @@ function buildCompactView(state, locale) {
|
|
|
1340
1351
|
const keyboard = new InlineKeyboard().text(t(locale, 'compact'), 'compact:yes').text(t(locale, 'back'), 'menu:home');
|
|
1341
1352
|
return { html, text, keyboard };
|
|
1342
1353
|
}
|
|
1354
|
+
function buildCompactWaitingView(locale) {
|
|
1355
|
+
const text = t(locale, 'compactWorking');
|
|
1356
|
+
return {
|
|
1357
|
+
html: `<p>${escapeHtml(text).replaceAll('\n', '<br>')}</p>`,
|
|
1358
|
+
text,
|
|
1359
|
+
keyboard: new InlineKeyboard(),
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
function buildCompactResultView(text, locale) {
|
|
1363
|
+
return {
|
|
1364
|
+
html: [
|
|
1365
|
+
`<h2>${escapeHtml(t(locale, 'compactResultTitle'))}</h2>`,
|
|
1366
|
+
`<p>${escapeHtml(text).replaceAll('\n', '<br>')}</p>`,
|
|
1367
|
+
`<tg-button-row align="left"><tg-button type="callback_data" style="primary" data="menu:home">${escapeHtml(t(locale, 'home'))}</tg-button></tg-button-row>`,
|
|
1368
|
+
].join('\n'),
|
|
1369
|
+
text,
|
|
1370
|
+
keyboard: new InlineKeyboard().text(t(locale, 'home'), 'menu:home'),
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1343
1373
|
function sessionTitle(session, locale) {
|
|
1344
1374
|
if (session.blank)
|
|
1345
1375
|
return t(locale, 'newSessionTitle');
|
|
@@ -1704,11 +1734,6 @@ async function handleSessionEvent(runtime, session, event) {
|
|
|
1704
1734
|
void maybeWarnLowBalance(runtime, chatId, locale, silent);
|
|
1705
1735
|
break;
|
|
1706
1736
|
}
|
|
1707
|
-
case 'compaction/end':
|
|
1708
|
-
// Compaction can also be started from Web; drop the cached percentage
|
|
1709
|
-
// so the next menu reads the updated projection immediately.
|
|
1710
|
-
runtime.contextCache.delete(session.id);
|
|
1711
|
-
break;
|
|
1712
1737
|
default:
|
|
1713
1738
|
break;
|
|
1714
1739
|
}
|
|
@@ -1775,6 +1800,7 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
1775
1800
|
}
|
|
1776
1801
|
const account = ctx.get('accountController');
|
|
1777
1802
|
const tokenMeter = ctx.get('tokenMeter');
|
|
1803
|
+
const sessionProjections = ctx.get('sessionProjections');
|
|
1778
1804
|
const commands = ctx.get('commands');
|
|
1779
1805
|
const runtime = {
|
|
1780
1806
|
bot,
|
|
@@ -1783,6 +1809,7 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
1783
1809
|
sessions,
|
|
1784
1810
|
account,
|
|
1785
1811
|
tokenMeter,
|
|
1812
|
+
sessionProjections,
|
|
1786
1813
|
commands,
|
|
1787
1814
|
adminUserId,
|
|
1788
1815
|
allowedUserIds: [...allowedUserIds],
|
|
@@ -1797,7 +1824,6 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
1797
1824
|
pendingQuestionChats: new Map(),
|
|
1798
1825
|
questionQueues: new Map(),
|
|
1799
1826
|
balanceCache: { at: 0 },
|
|
1800
|
-
contextCache: new Map(),
|
|
1801
1827
|
lowBalanceWarnedAt: new Map(),
|
|
1802
1828
|
rich: config.rich !== false,
|
|
1803
1829
|
lowBalanceUsd: config.lowBalanceUsd ?? 1,
|
|
@@ -1873,14 +1899,14 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
1873
1899
|
if (binding !== undefined) {
|
|
1874
1900
|
await store.set({ ...binding, locale, updatedAt: Date.now() });
|
|
1875
1901
|
}
|
|
1876
|
-
await sendMainMenu(runtime, chatId, locale);
|
|
1902
|
+
await sendMainMenu(runtime, chatId, locale, undefined, true);
|
|
1877
1903
|
});
|
|
1878
1904
|
bot.command('menu', async (grammyCtx) => {
|
|
1879
1905
|
const chatId = grammyCtx.chat?.id;
|
|
1880
1906
|
if (chatId === undefined)
|
|
1881
1907
|
return;
|
|
1882
1908
|
const locale = localeOf(grammyCtx.from?.language_code);
|
|
1883
|
-
await sendMainMenu(runtime, chatId, locale);
|
|
1909
|
+
await sendMainMenu(runtime, chatId, locale, undefined, true);
|
|
1884
1910
|
});
|
|
1885
1911
|
bot.command('new', async (grammyCtx) => {
|
|
1886
1912
|
const chatId = grammyCtx.chat?.id;
|
|
@@ -1932,8 +1958,13 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
1932
1958
|
await grammyCtx.reply(t(locale, 'noActiveSession'));
|
|
1933
1959
|
return;
|
|
1934
1960
|
}
|
|
1935
|
-
|
|
1936
|
-
await
|
|
1961
|
+
const waitingId = await sendRich(runtime, chatId, buildCompactWaitingView(locale), binding.sound === false);
|
|
1962
|
+
const text = await runCompact(runtime, chatId, locale, binding.activeSessionId);
|
|
1963
|
+
if (waitingId === undefined)
|
|
1964
|
+
await grammyCtx.reply(text);
|
|
1965
|
+
else
|
|
1966
|
+
await editRich(runtime, chatId, waitingId, buildCompactResultView(text, locale));
|
|
1967
|
+
await sendMainMenu(runtime, chatId, locale, undefined, true);
|
|
1937
1968
|
});
|
|
1938
1969
|
bot.callbackQuery(/^ws:(.+)$/, async (grammyCtx) => {
|
|
1939
1970
|
const workspaceId = grammyCtx.match[1];
|
|
@@ -2052,7 +2083,7 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
2052
2083
|
return;
|
|
2053
2084
|
const locale = localeOf(grammyCtx.from?.language_code);
|
|
2054
2085
|
await grammyCtx.answerCallbackQuery().catch(() => undefined);
|
|
2055
|
-
await sendMainMenu(runtime, chatId, locale, grammyCtx.callbackQuery?.message?.message_id);
|
|
2086
|
+
await sendMainMenu(runtime, chatId, locale, grammyCtx.callbackQuery?.message?.message_id, true);
|
|
2056
2087
|
});
|
|
2057
2088
|
bot.callbackQuery('menu:sound', async (grammyCtx) => {
|
|
2058
2089
|
const chatId = grammyCtx.chat?.id;
|
|
@@ -2120,14 +2151,12 @@ async function runBot(ctx, config, workspaces, sessions, credentials, logger, si
|
|
|
2120
2151
|
await grammyCtx.answerCallbackQuery({ text: t(locale, 'noActiveSession') }).catch(() => undefined);
|
|
2121
2152
|
return;
|
|
2122
2153
|
}
|
|
2123
|
-
await grammyCtx.answerCallbackQuery(
|
|
2124
|
-
const text = await runCompact(runtime, chatId, locale, binding.activeSessionId);
|
|
2125
|
-
const view = {
|
|
2126
|
-
html: `<h2>${escapeHtml(t(locale, 'compactHistory'))}</h2><p>${escapeHtml(text)}</p><tg-button-row align="left"><tg-button type="callback_data" style="primary" data="menu:home">${escapeHtml(t(locale, 'home'))}</tg-button></tg-button-row>`,
|
|
2127
|
-
text,
|
|
2128
|
-
keyboard: new InlineKeyboard().text(t(locale, 'home'), 'menu:home'),
|
|
2129
|
-
};
|
|
2154
|
+
await grammyCtx.answerCallbackQuery().catch(() => undefined);
|
|
2130
2155
|
const messageId = grammyCtx.callbackQuery?.message?.message_id;
|
|
2156
|
+
if (messageId !== undefined)
|
|
2157
|
+
await editRich(runtime, chatId, messageId, buildCompactWaitingView(locale));
|
|
2158
|
+
const text = await runCompact(runtime, chatId, locale, binding.activeSessionId);
|
|
2159
|
+
const view = buildCompactResultView(text, locale);
|
|
2131
2160
|
if (messageId !== undefined)
|
|
2132
2161
|
await editRich(runtime, chatId, messageId, view);
|
|
2133
2162
|
else
|