dsh-deeppilot 0.9.14 → 0.9.16

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/lib/index.d.ts CHANGED
@@ -406,6 +406,26 @@ interface WelcomeCapabilities {
406
406
  * see binary-frame.ts). Plugin-level, independent of the host. Absent ⇒ the
407
407
  * client must keep requesting base64 text frames. */
408
408
  binaryFrames?: boolean;
409
+ /** Bridge honours `watchSessions` on c2s.auth.prove and c2s.session.watch:
410
+ * a connection that declared an interest set only receives
411
+ * s2c.session.event / s2c.session.queue (live and replayed) for sessions it
412
+ * opened or watches. Plugin-level. Absent ⇒ the client gets every
413
+ * session's events, as before. */
414
+ sessionInterest?: boolean;
415
+ /** Bridge compresses downlink frames over 8 KB as binary format 2
416
+ * (`[2][deflate-raw(envelope JSON)]`) once the client listed "deflate-raw"
417
+ * in `acceptEncoding` on c2s.auth.prove. Plugin-level. Absent ⇒ the field is
418
+ * ignored and every JSON frame stays a text frame. */
419
+ compressedFrames?: boolean;
420
+ /** Bridge answers c2s.session.open carrying `sinceSeq` with an incremental
421
+ * tail (`incremental: true`) holding only rows changed after that seq, or
422
+ * with a full tail when it cannot prove the delta complete. Plugin-level. */
423
+ incrementalTail?: boolean;
424
+ /** Bridge includes `routes` (current LAN endpoints with their certificate
425
+ * fingerprint, and the public Funnel URL) in s2c.welcome so the client can
426
+ * prefer the LAN on the same network and fall back to Funnel elsewhere.
427
+ * Plugin-level. */
428
+ routeHints?: boolean;
409
429
  }
410
430
  type SessionStatus = "running" | "idle" | "error" | "unknown";
411
431
  /**
@@ -1122,6 +1142,14 @@ interface BridgeSink {
1122
1142
  * every push/replay delivery; unknown broadcast types are denied.
1123
1143
  */
1124
1144
  canReceive(scope: DeviceScope): boolean;
1145
+ /**
1146
+ * Interest filter (capability `sessionInterest`): whether this sink wants a
1147
+ * frame it is already permitted to receive. Connections that declared an
1148
+ * interest set drop other sessions' events here. Absent ⇒ wants everything.
1149
+ * The bridge consults it when sizing a replay window; sinks apply it again
1150
+ * on every push.
1151
+ */
1152
+ accepts?(type: string, payload: unknown): boolean;
1125
1153
  }
1126
1154
  /**
1127
1155
  * Offline push fan-out (F-9 离线推送). The bridge forwards every
@@ -1140,6 +1168,42 @@ interface PushOutlet {
1140
1168
  */
1141
1169
  isAvailable(): boolean;
1142
1170
  }
1171
+ interface QuietCompletionResult {
1172
+ suppressed: boolean;
1173
+ note?: string;
1174
+ }
1175
+ interface TurnVerdict {
1176
+ /** 本轮最近一条驱动消息是计划任务投递(且其后没有用户消息)。 */
1177
+ scheduled: boolean;
1178
+ /** 本轮 `turn/start` 的轮次号;日志里读不到时为 undefined。 */
1179
+ turn?: number;
1180
+ }
1181
+ declare class QuietCompletionTracker {
1182
+ /**
1183
+ * 判定过计划任务轮次的会话。粘性集合:加入后不再移除,工具不按轮出现或消失。
1184
+ * 宿主每次工具列表变化都会往会话追加一条工具增减消息并让提示词缓存失效,
1185
+ * 按轮开关会让同一会话反复产生这类消息。
1186
+ */
1187
+ private readonly scheduleSessions;
1188
+ private readonly quiet;
1189
+ /** 启动时用宿主任务列表里的投递目标会话预热,避免重启后工具先消失再出现。 */
1190
+ seed(sessionIds: Iterable<string>): void;
1191
+ isScheduleSession(sessionId: string): boolean;
1192
+ /** 加入粘性集合;返回是否为新加入(调用方据此记一次日志)。 */
1193
+ markScheduleSession(sessionId: string): boolean;
1194
+ /** 工具执行:只在计划任务轮次内生效。 */
1195
+ requestQuiet(sessionId: string | undefined, verdict: TurnVerdict, seq: number): QuietCompletionResult;
1196
+ /**
1197
+ * 桥接层观察到 user/message:用户在请求静默之后插话(日志位置更晚)就撤销静默,
1198
+ * 本轮照常提醒。计划任务与注入上下文不影响。
1199
+ */
1200
+ noteUserMessage(sessionId: string, sourceKind: string | undefined, seq: number | undefined): void;
1201
+ /**
1202
+ * turn.end 时调用。返回 true 表示本轮完成通知应被抑制:成功结束、且本轮请求过静默。
1203
+ * 轮次号能对上时按轮次号判定;迟到的上一轮 turn.end 保留本轮的请求。
1204
+ */
1205
+ consumeTurnEnd(sessionId: string, ok: boolean, turn: number | undefined, seq: number | undefined): boolean;
1206
+ }
1143
1207
  interface PromptDocument {
1144
1208
  name: string;
1145
1209
  mediaType: string;
@@ -1183,6 +1247,13 @@ export declare class HostBridge {
1183
1247
  private readonly log?;
1184
1248
  readonly id: number;
1185
1249
  private summaries;
1250
+ /**
1251
+ * 列表推送节流(连接传输第二批 P5)。每个会话最近一次推出去的摘要指纹,
1252
+ * 用来丢掉内容完全相同的重复推送;只改了 `stats` 的变化按 SUMMARY_STATS_THROTTLE_MS
1253
+ * 合并,状态、标题、任务清单、待处理标记、活动描述的变化照旧立即推。
1254
+ */
1255
+ private readonly summaryPushed;
1256
+ private readonly summaryStatsTimers;
1186
1257
  private activeTools;
1187
1258
  private approvals;
1188
1259
  private questions;
@@ -1191,6 +1262,8 @@ export declare class HostBridge {
1191
1262
  * and restore them. Excluded from `summaries` and from the live broadcast. */
1192
1263
  private archivedSummaries;
1193
1264
  private subagentSessionIds;
1265
+ /** 计划任务按需完成通知(quiet-completion.ts):index.ts 用它注册 Agent 工具。 */
1266
+ readonly quietCompletion: QuietCompletionTracker;
1194
1267
  /**
1195
1268
  * 每个会话最近一次已知的队列(inbox 投影的折叠结果)及其指纹。来源是实时
1196
1269
  * 投影通知或打开会话时读到的基线;指纹用来丢掉内容没变的重复通知。
@@ -1269,11 +1342,24 @@ export declare class HostBridge {
1269
1342
  * reader without interactions.respond never gets the missed approval
1270
1343
  * frames back (R1/P2).
1271
1344
  */
1345
+ /**
1346
+ * 按序补发游标之后的帧。先按权限与关注集合筛出该 sink 真正会收到的帧,
1347
+ * 估算字节数超过 REPLAY_RESYNC_BYTES 时改发 `s2c.resync`:补发是同步一次性
1348
+ * 写出的,经 Funnel 时插件这侧看不到积压,大补发会把之后所有请求响应堵在
1349
+ * 链路上(实测 450 帧堵 37 秒)。重新同步让客户端只拉列表和正在看的会话。
1350
+ */
1272
1351
  resumeFrom(cursor: number, target?: BridgeSink): boolean;
1273
1352
  refreshLiveActivities(): void;
1274
1353
  private record;
1275
1354
  /** Start consuming host + mux streams. Idempotent; aborts on dispose(). */
1276
1355
  start(): void;
1356
+ /**
1357
+ * 用宿主任务列表里的投递目标会话预热计划任务会话集合,避免插件重启后工具
1358
+ * 先消失、等下一次投递再出现(每次变化都会给会话追加工具增减消息)。
1359
+ * `new` 目标没有固定会话,只能从最近一次投递回执里取。失败只记日志:集合仍会
1360
+ * 在下一次投递时补上。由 index.ts 在 schedule 服务就绪、注册工具时调用。
1361
+ */
1362
+ seedQuietCompletionSessions(): Promise<void>;
1277
1363
  dispose(): void;
1278
1364
  private runHostStream;
1279
1365
  private runMuxStream;
@@ -1300,6 +1386,8 @@ export declare class HostBridge {
1300
1386
  private applyProjection;
1301
1387
  private bumpPendingFlags;
1302
1388
  private pushSummary;
1389
+ private noteSummaryPushed;
1390
+ private forgetSummaryPush;
1303
1391
  listSessions(): SessionSummary[];
1304
1392
  /**
1305
1393
  * Archived rows from the last sessions.list, newest first. Served only on
@@ -1316,7 +1404,7 @@ export declare class HostBridge {
1316
1404
  /** Resolve only the exact invocation in this session; never guess from the latest tool. */
1317
1405
  private loadApprovalArguments;
1318
1406
  /** Tail history for an opened session; pushes s2c.session.tail to the sink. */
1319
- openSession(sink: BridgeSink, sessionId: string, tailCount: number): Promise<boolean>;
1407
+ openSession(sink: BridgeSink, sessionId: string, tailCount: number, sinceSeq?: number): Promise<boolean>;
1320
1408
  /**
1321
1409
  * Pull one session's projection baseline and fold every key
1322
1410
  * through applyProjection — unknown keys are ignored there, `null` means the