@soffits/dsh-telegram-bot 0.0.0-stage → 0.4.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/CREDITS.md +24 -0
- package/LICENSE +22 -0
- package/MAINTAINING.md +39 -0
- package/README.md +293 -2
- package/bin/dsh-telegram-send.js +110 -0
- package/client.js +809 -0
- package/cordis.patch.yml +8 -0
- package/docs/bot-setting.gif +0 -0
- package/icon.svg +12 -0
- package/index.js +2 -0
- package/locale/en.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +72 -4
- package/src/admission.js +21 -0
- package/src/app.js +6286 -0
- package/src/client.js +809 -0
- package/src/config.js +73 -0
- package/src/constants.js +80 -0
- package/src/errors.js +16 -0
- package/src/final-text.js +45 -0
- package/src/formatting.js +390 -0
- package/src/index.js +24 -0
- package/src/message-context.js +339 -0
- package/src/models.js +257 -0
- package/src/outbox.js +160 -0
- package/src/sent-log.js +112 -0
- package/src/state.js +49 -0
- package/src/status.js +43 -0
- package/src/steer.js +104 -0
- package/src/stickers.js +185 -0
- package/src/topics.js +211 -0
- package/src/update-ledger.js +58 -0
- package/src/utils.js +139 -0
- package/src/voice.js +151 -0
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Bundle layer for @soffits/dsh-telegram-bot.
|
|
2
|
+
#
|
|
3
|
+
# The row id doubles as the settings namespace the Web page edits. Every
|
|
4
|
+
# editable field is declared `.volatile()` in index.js so the Host can persist
|
|
5
|
+
# it through the profile patch without restarting the plugin.
|
|
6
|
+
- insert:
|
|
7
|
+
- id: telegram-bot
|
|
8
|
+
name: '@soffits/dsh-telegram-bot'
|
|
Binary file
|
package/icon.svg
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Telegram bot">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="dtb-bg" x1="0" y1="0" x2="64" y2="64" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#37AEE2"/>
|
|
5
|
+
<stop offset="1" stop-color="#1E88C7"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="64" height="64" rx="15" fill="url(#dtb-bg)"/>
|
|
9
|
+
<path d="M13.5 31.9 49.8 17.2c1.7-.7 3.3.4 2.7 3.1L46 48.1c-.5 2.2-1.8 2.7-3.6 1.7l-9.9-7.3-4.8 4.6c-.5.5-1 .9-1.9.9l.7-9.9 18.1-16.4c.8-.7-.2-1.1-1.2-.4L21.2 35.9l-9.6-3c-2.1-.7-2.1-2.1 1.9-1z" fill="#fff"/>
|
|
10
|
+
<circle cx="48" cy="48" r="10" fill="#fff"/>
|
|
11
|
+
<path d="M48 41.5c-3.6 0-6.5 2.9-6.5 6.5S44.4 54.5 48 54.5s6.5-2.9 6.5-6.5-2.9-6.5-6.5-6.5zm0 2.2c.8 0 1.4.6 1.4 1.4s-.6 1.4-1.4 1.4-1.4-.6-1.4-1.4.6-1.4 1.4-1.4zm0 7.2c-1.4 0-2.5-.9-2.5-2h5c0 1.1-1.1 2-2.5 2z" fill="#1E88C7"/>
|
|
12
|
+
</svg>
|
package/index.js
ADDED
package/locale/en.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soffits/dsh-telegram-bot",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Telegram sessions, topics, model controls and approvals for DeepSeek Harness.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"dsh-telegram-send": "./bin/dsh-telegram-send.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./index.js",
|
|
12
|
+
"./client": "./client.js",
|
|
13
|
+
"./locale/*.json": "./locale/*.json",
|
|
14
|
+
"./icon": "./icon.svg",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"client.js",
|
|
20
|
+
"index.js",
|
|
21
|
+
"cordis.patch.yml",
|
|
22
|
+
"locale/*.json",
|
|
23
|
+
"icon.svg",
|
|
24
|
+
"README.md",
|
|
25
|
+
"CREDITS.md",
|
|
26
|
+
"docs",
|
|
27
|
+
"src",
|
|
28
|
+
"MAINTAINING.md"
|
|
29
|
+
],
|
|
30
|
+
"dsh": {
|
|
31
|
+
"bundle": {
|
|
32
|
+
"patch": "./cordis.patch.yml"
|
|
33
|
+
},
|
|
34
|
+
"client": {
|
|
35
|
+
"platform": "web",
|
|
36
|
+
"immediately": true,
|
|
37
|
+
"inject": [
|
|
38
|
+
"@deepseek-ai/dsh-client-locale",
|
|
39
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
40
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22",
|
|
46
|
+
"dsh": ">=0.2.1-rc.2 <0.3.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@deepseek-ai/schemastery": "3.18.5",
|
|
50
|
+
"telegramify-markdown": "^1.3.3"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"dsh-plugin",
|
|
54
|
+
"deepseek-harness",
|
|
55
|
+
"dsh",
|
|
56
|
+
"telegram",
|
|
57
|
+
"bot"
|
|
58
|
+
],
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/soffits/dsh-telegram-bot.git"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/soffits/dsh-telegram-bot#readme",
|
|
65
|
+
"bugs": {
|
|
66
|
+
"url": "https://github.com/soffits/dsh-telegram-bot/issues"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"test": "NODE_ENV=test node --test --test-concurrency=1"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/admission.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Native DSH prompt admission helpers. */
|
|
2
|
+
export function promptRequestId(chatId, messageId) {
|
|
3
|
+
if (!Number.isSafeInteger(chatId)) throw new Error('Telegram chat id is required')
|
|
4
|
+
if (!Number.isSafeInteger(messageId)) throw new Error('Telegram message id is required')
|
|
5
|
+
return `telegram:${chatId}:${messageId}`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Admit text into the native session queue. Returns false when the mounted
|
|
10
|
+
* controller has no prompt method so the caller can use its legacy path.
|
|
11
|
+
*/
|
|
12
|
+
export function admitText(ctx, { sessionId, chatId, messageId, text }, signal) {
|
|
13
|
+
const controller = ctx.get('sessionController')
|
|
14
|
+
if (typeof controller?.prompt !== 'function') return false
|
|
15
|
+
return controller.prompt({
|
|
16
|
+
sessionId,
|
|
17
|
+
requestId: promptRequestId(chatId, messageId),
|
|
18
|
+
mode: 'queue',
|
|
19
|
+
content: text.trim().length > 0 ? [{ type: 'text', text }] : [],
|
|
20
|
+
}, signal)
|
|
21
|
+
}
|