@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.
@@ -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
@@ -0,0 +1,2 @@
1
+ /** Host entry point; implementation lives in src/. */
2
+ export * from './src/index.js'
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Telegram Bot",
4
+ "description": "Chat with deepseek on Telegram"
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Telegram-бот",
4
+ "description": "Сессии, топики, управление моделью и approvals для этого профиля Harness."
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,74 @@
1
1
  {
2
2
  "name": "@soffits/dsh-telegram-bot",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
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
+ }
@@ -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
+ }