feat: remote-control live DSH Web sessions from Telegram
Attach via /sessions picker instead of creating parallel agents; mirror the same session trajectory to phone and Web (Codex-style remote). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+37
-11
@@ -1,15 +1,30 @@
|
||||
export const MSG = {
|
||||
DENIED: '无权限。',
|
||||
WELCOME:
|
||||
'你好,我是 DeepSeek Harness 渠道机器人。直接发消息开始对话,或发送 /help 查看命令。',
|
||||
WELCOME: [
|
||||
'你好,这是 DeepSeek Harness 的手机遥控器。',
|
||||
'本机会话是真相源:请先在 Web 打开对话,再用 /sessions 选择并附着。',
|
||||
'发送 /help 查看命令。',
|
||||
].join('\n'),
|
||||
HELP: [
|
||||
'/start — 开始 / 欢迎',
|
||||
'/new 或 /clear — 新开会话',
|
||||
'/sessions — 列出本机正在运行的会话并选择附着',
|
||||
'/status — 查看当前绑定',
|
||||
'/unbind — 断开绑定(不关闭本机会话)',
|
||||
'/help — 显示帮助',
|
||||
'',
|
||||
'仅白名单用户可对话;会话在内存中,重启 Harness 后需重新发消息建立。',
|
||||
'绑定后直接发文字,消息会进入该本机会话;Web 与手机看到同一条轨迹。',
|
||||
'仅白名单用户可用。无 live 会话时请先在 dsh web 开对话。',
|
||||
].join('\n'),
|
||||
NEW_SESSION: '已开启新会话。',
|
||||
NEED_BIND: '尚未绑定本机会话。请先发送 /sessions 选择一个。',
|
||||
NO_LIVE: '当前没有正在运行的本机会话。请先在 Web(dsh web)打开或继续一个对话,再发 /sessions。',
|
||||
BOUND(label: string): string {
|
||||
return `已附着本机会话:${label}\n此后消息将进入该会话(与 Web 同轨迹)。`
|
||||
},
|
||||
UNBOUND: '已断开绑定。本机会话仍在运行。',
|
||||
STATUS_NONE: '当前未绑定任何本机会话。发送 /sessions 选择。',
|
||||
STATUS_BOUND(label: string): string {
|
||||
return `当前绑定:${label}`
|
||||
},
|
||||
GONE: '绑定的会话已不在本机运行(可能已在 Web 关闭)。请重新 /sessions。',
|
||||
unknown(command: string): string {
|
||||
return `未知命令 ${command}。发送 /help 查看可用命令。`
|
||||
},
|
||||
@@ -18,22 +33,33 @@ export const MSG = {
|
||||
export type ParsedCommand =
|
||||
| { type: 'start'; text: string }
|
||||
| { type: 'help'; text: string }
|
||||
| { type: 'new'; text: string }
|
||||
| { type: 'sessions'; text: string }
|
||||
| { type: 'status'; text: string }
|
||||
| { type: 'unbind'; text: string }
|
||||
| { type: 'unknown'; command: string; text: string }
|
||||
| { type: 'plain'; text: string }
|
||||
|
||||
export function parseCommand(text: string): ParsedCommand {
|
||||
if (!text.startsWith('/')) return { type: 'plain', text }
|
||||
const command = text.split(/\s+/)[0] ?? text
|
||||
const raw = text.split(/\s+/)[0] ?? text
|
||||
const command = raw.includes('@') ? raw.slice(0, raw.indexOf('@')) : raw
|
||||
switch (command) {
|
||||
case '/start':
|
||||
return { type: 'start', text }
|
||||
case '/help':
|
||||
return { type: 'help', text }
|
||||
case '/new':
|
||||
case '/clear':
|
||||
return { type: 'new', text }
|
||||
case '/sessions':
|
||||
case '/list':
|
||||
return { type: 'sessions', text }
|
||||
case '/status':
|
||||
return { type: 'status', text }
|
||||
case '/unbind':
|
||||
case '/disconnect':
|
||||
return { type: 'unbind', text }
|
||||
default:
|
||||
return { type: 'unknown', command, text }
|
||||
}
|
||||
}
|
||||
|
||||
/** Callback data prefix for session bind buttons. */
|
||||
export const BIND_CB_PREFIX = 'bind:'
|
||||
|
||||
Reference in New Issue
Block a user