feat: /status 通用状态显示 + /compact 手动压缩;HTML 兼容渲染默认化
- /status:绑定会话/会话 ID/工作区/当前模型/思考强度/上下文长度/ 首 token 平均/输出速率/输入输出 tokens —— 与 Web 底部统计条同源 同算法(sessionProjections: sessionStats/tokenUsage/contextPressure), 投影插件缺失时逐组优雅降级;冷会话不强制 resume - /compact:复用 ctx.compaction.compactNow 手动压缩绑定会话历史, 异步执行不阻塞轮询,完成/失败均中文通知,同会话去重, 桥停止/热重载自动中止进行中的压缩 - 全部用户可见文案不使用 emoji - rendering 默认改 html(兼容优先)+ userQuestions/approval 双通道等 既有修改一并合入(此前已上线确认) - tests:+6 覆盖 /status 全字段与 /compact 各分支(51 全绿)
This commit is contained in:
Vendored
+25
-3
@@ -18,7 +18,12 @@ export declare class TelegramBridge {
|
||||
private readonly client;
|
||||
private readonly sleep;
|
||||
private readonly maxMessageLength;
|
||||
/** Global rendering mode: follows config; flipped to 'html' permanently when the
|
||||
* Rich Message API itself is unavailable (a server-wide fact, not per-chat). */
|
||||
private renderingMode;
|
||||
/** Per-chat rendering override (persisted): rich messages need a recent Telegram
|
||||
* client — old ones (e.g. 10.x) cannot render them and show “unsupported”. */
|
||||
private readonly renderPrefs;
|
||||
private readonly bindings;
|
||||
private readonly pickers;
|
||||
/** chatId → model awaiting reasoning-effort pick (kept outside picker so list refreshes won't drop it). */
|
||||
@@ -44,7 +49,13 @@ export declare class TelegramBridge {
|
||||
private readonly callNames;
|
||||
/** sessionId → latest todo snapshot (/mission) */
|
||||
private readonly lastTodos;
|
||||
/** sessionId → in-flight manual compaction (dedup /compact) */
|
||||
private readonly compacting;
|
||||
/** sessionId → compaction abort controller (cancelled on bridge stop) */
|
||||
private readonly compactAborts;
|
||||
constructor(ctx: Context, options: TelegramBridgeOptions);
|
||||
/** Effective rendering mode for a chat: per-chat override, else the global mode. */
|
||||
private modeFor;
|
||||
start(): void;
|
||||
stop(): Promise<void>;
|
||||
processUpdate(update: TelegramUpdate): Promise<void>;
|
||||
@@ -62,19 +73,30 @@ export declare class TelegramBridge {
|
||||
/** Resume cold sessions when needed; never dispose the returned handle. */
|
||||
private ensureLiveAgent;
|
||||
private sendStatus;
|
||||
/** 按 sessionId 解析工作区:apiProxy 目录优先,冷/热会话均可用;退化为 agent cwd。 */
|
||||
private workspaceOf;
|
||||
/** 从 sessionProjections 快照读 Web 底部同款统计(sessionStats/tokenUsage/contextPressure)。 */
|
||||
private readRuntimeValues;
|
||||
/** 按名称解析宿主服务(Cordis 需 ctx.get;mock/plain ctx 走自有属性兜底)。 */
|
||||
private serviceOf;
|
||||
private requestCompact;
|
||||
/** 等待压缩落定并汇报结果(不阻塞轮询循环)。 */
|
||||
private runCompaction;
|
||||
private followupBound;
|
||||
private pollLoop;
|
||||
private interruptibleDelay;
|
||||
private interruptibleSleep;
|
||||
private onSessionEvent;
|
||||
private handleRichCommand;
|
||||
private deliver;
|
||||
private deliverHtml;
|
||||
/** Retry an outbound call with capped linear backoff (500ms, 1s, 2s… max 4s). */
|
||||
private withRetry;
|
||||
private escHtml;
|
||||
/**
|
||||
* Send a notice; a leading `> ` renders as a Telegram blockquote (HTML).
|
||||
* Falls back to plain text when the HTML send fails — a notice is never lost.
|
||||
* Send a notice; a leading `> ` keeps the quote look via a plain-text `> `
|
||||
* prefix. NB: NOT `<blockquote>` HTML — older Telegram clients cannot render
|
||||
* the blockquote entity at all and show the whole message as “not supported”.
|
||||
* Falls back to plain text when the send fails — a notice is never lost.
|
||||
*/
|
||||
private deliverNotice;
|
||||
/** Serialized per-chat notice chain — bursts can't race into Telegram 429s. */
|
||||
|
||||
Reference in New Issue
Block a user