dsh-manage-session 0.5.4 → 0.5.7

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
@@ -1,10 +1,10 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
- //#region node_modules/cosmokit/lib/index.d.ts
2
+ //#region node_modules/.pnpm/cosmokit@1.8.1/node_modules/cosmokit/lib/index.d.ts
3
3
  type Dict<T = any, K extends string | symbol = string> = { [key in K]: T; };
4
4
  type Promisify<T> = Promise<T extends Promise<infer S> ? S : T>;
5
5
  type Awaitable<T> = [T] extends [Promise<unknown>] ? T : T | Promise<T>;
6
6
  //#endregion
7
- //#region node_modules/@standard-schema/spec/dist/index.d.ts
7
+ //#region node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
8
8
  /** The Standard Typed interface. This is a base type extended by other specs. */
9
9
  interface StandardTypedV1<Input = unknown, Output = Input> {
10
10
  /** The Standard properties. */
@@ -81,7 +81,7 @@ declare namespace StandardSchemaV1 {
81
81
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
82
82
  }
83
83
  //#endregion
84
- //#region node_modules/cordis/lib/utils.d.ts
84
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/utils.d.ts
85
85
  declare class DisposableList<T extends WeakKey> {
86
86
  private sn;
87
87
  private map;
@@ -113,7 +113,7 @@ declare const symbols: {
113
113
  resolveConfig: typeof Service.resolveConfig;
114
114
  };
115
115
  //#endregion
116
- //#region node_modules/cordis/lib/registry.d.ts
116
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/registry.d.ts
117
117
  type Inject<M = Dict> = (keyof M)[] | { [K in keyof M]?: M[K]; };
118
118
  type InjectKey = keyof { [K in keyof Context & string as Context[K] extends {
119
119
  [symbols.config]: any;
@@ -183,7 +183,7 @@ declare class RegistryService {
183
183
  plugin(plugin: Plugin, config?: any, getOuterStack?: () => string[]): Fiber & PromiseLike<Fiber>;
184
184
  }
185
185
  //#endregion
186
- //#region node_modules/cordis/lib/reflect.d.ts
186
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/reflect.d.ts
187
187
  declare module './context' {
188
188
  interface Context {
189
189
  get<K extends string & keyof this>(name: K, strict?: boolean): undefined | this[K];
@@ -231,7 +231,7 @@ declare class ReflectService {
231
231
  bind<T extends Function>(callback: T): T;
232
232
  }
233
233
  //#endregion
234
- //#region node_modules/cordis/lib/fiber.d.ts
234
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/fiber.d.ts
235
235
  declare module './context' {
236
236
  interface Context extends Pick<Fiber, 'effect'> {
237
237
  fiber: Fiber;
@@ -292,7 +292,7 @@ declare class Fiber {
292
292
  update(config: any, noSave?: boolean): Awaitable<void>;
293
293
  }
294
294
  //#endregion
295
- //#region node_modules/cordis/lib/events.d.ts
295
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/events.d.ts
296
296
  type Parameters<F> = F extends ((...args: infer P) => any) ? P : never;
297
297
  type ReturnType$1<F> = F extends ((...args: any) => infer R) ? R : never;
298
298
  type ThisType<F> = F extends ((this: infer T, ...args: any) => any) ? T : never;
@@ -350,7 +350,7 @@ interface Events {
350
350
  'internal/dispatch'(mode: DispatchMode, name: string | symbol, args: any[], thisArg: any): void;
351
351
  }
352
352
  //#endregion
353
- //#region node_modules/cordis/lib/logger.d.ts
353
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/logger.d.ts
354
354
  declare module './context' {
355
355
  interface Intercept {
356
356
  logger: LoggerService.Intercept;
@@ -412,7 +412,7 @@ declare class LoggerService {
412
412
  [symbols.invoke](name?: string): Logger;
413
413
  }
414
414
  //#endregion
415
- //#region node_modules/cordis/lib/context.d.ts
415
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/context.d.ts
416
416
  interface Context {
417
417
  [symbols.isolate]: Dict<symbol>;
418
418
  [symbols.intercept]: Dict;
@@ -439,7 +439,7 @@ declare class Context {
439
439
  intercept(name: string, config: any): this;
440
440
  }
441
441
  //#endregion
442
- //#region node_modules/cordis/lib/service.d.ts
442
+ //#region node_modules/.pnpm/cordis@4.0.0-rc.10/node_modules/cordis/lib/service.d.ts
443
443
  declare abstract class Service<out T = never> {
444
444
  protected ctx: Context;
445
445
  static readonly init: unique symbol;
@@ -481,6 +481,12 @@ interface StewardConfig {
481
481
  healthCheck?: boolean;
482
482
  /** 搜索索引子域(`index-*` 路由与侧栏搜索入口)。关闭后索引子域整体停摆。 */
483
483
  search?: boolean;
484
+ /**
485
+ * 直接删除入口(2026-10-20 用户定标):开启后搜索面板结果行出现行内
486
+ * 「删除」按钮(两步确认,走管理端同款 session-history-purge 链路)。
487
+ * **缺省关**——破坏性入口不默认铺开;管理端批量删除不受本开关限制。
488
+ */
489
+ directDelete?: boolean;
484
490
  }
485
491
  /** 缺省值。 */
486
492
  declare const DEFAULT_CONFIG: Required<StewardConfig>;
@@ -510,6 +516,14 @@ interface SwitchSearchConfig {
510
516
  archiveKeep?: number;
511
517
  /** 独立索引文件的可选绝对目录。 */
512
518
  indexDir?: string;
519
+ /**
520
+ * 语料源(T7.1):`'native'`=sessionQuery 服务 + 转录文件兜底(缺省);
521
+ * `'drs'`=dsh-reference-session-collector 投影库(docs 直插;DRS 不可达时整轮
522
+ * 回退 native 链路,水位语义切换的首轮会全量重灌一次)。
523
+ */
524
+ corpusSource?: 'native' | 'drs';
525
+ /** DRS 投影库 API 基址;空=自动(首个 trustedHosts 条目,再退 http://127.0.0.1:8080)。 */
526
+ drsBaseUrl?: string;
513
527
  }
514
528
  /** 搜索子域缺省值。 */
515
529
  declare const SWITCH_DEFAULT_CONFIG: Required<SwitchSearchConfig>;
@@ -1052,7 +1066,21 @@ declare class SwitchIndexEngine {
1052
1066
  * 全量重灌不改变归档状态);显式传入时以传入值为准(重建/导入路径)。
1053
1067
  */
1054
1068
  archived?: boolean;
1055
- }): void;
1069
+ }): number;
1070
+ /**
1071
+ * 该会话是否已有正文(issue #1:hollow 行判据)。
1072
+ * LIMIT 1 探测命中 docs_session 索引,每轮 poll 对每个未变更会话的开销可忽略。
1073
+ */
1074
+ hasSessionDocs(sessionId: string): boolean;
1075
+ /**
1076
+ * 「有表头无正文」的会话 id(升序)—— hollow 体检面。补录后仍 hollow 的行
1077
+ * 包含无可索引文本的真空会话(合法终态,见 sync 的 confirmedEmpty 缓存)。
1078
+ */
1079
+ listHollowSessions(): string[];
1080
+ /**
1081
+ * `PRAGMA integrity_check` 首行:'ok' 或损坏报告串。swap 后完整性闸门用。
1082
+ */
1083
+ integrityCheck(): string;
1056
1084
  /**
1057
1085
  * Write an archived session's header row without any document content.
1058
1086
  *
@@ -1106,6 +1134,44 @@ declare class SwitchIndexEngine {
1106
1134
  text: string;
1107
1135
  }[];
1108
1136
  }): void;
1137
+ /**
1138
+ * Insert or replace one session from corpus-source documents (T7.1 DRS
1139
+ * 语料源):docs 已由语料源抽好(surface 字符串),切分仍由本引擎重算。
1140
+ * 与 importSessionDocs 的三点差异,均为检索排序/水印所需:cwd 与
1141
+ * updated_at 直写(日期过滤/时间排序键);标题空串保留旧行(upsertSession
1142
+ * 同款 CASE——DRS 对老会话可能给不出标题,不能抹掉既有精修);归档旗标
1143
+ * 冲突时不动(翻转仍归 setArchived)。
1144
+ * @returns 落库 docs 数(0 = 该会话无可索引文本,合法终态)。
1145
+ */
1146
+ upsertSessionDocs(input: {
1147
+ sessionId: string;
1148
+ version: number;
1149
+ title?: string;
1150
+ cwd?: string;
1151
+ updatedAt?: number;
1152
+ archived?: boolean;
1153
+ docs: readonly {
1154
+ seq: number;
1155
+ type: string;
1156
+ surface: string;
1157
+ time: number;
1158
+ text: string;
1159
+ }[];
1160
+ }): number;
1161
+ /**
1162
+ * 会话头直写(DRS 直连时代的同步轮专用,T7.3):只维护 sessions 元数据
1163
+ * (水位/标题/目录/末时间/归档),**不碰 docs/docs_fts**——内容检索
1164
+ * 已直连 dsh-reference-session-collector(op=search&group=session),本地正文索引
1165
+ * 退役,存量 docs 行自然老化不再新增。空标题保留旧行(同 upsertSessionDocs)。
1166
+ */
1167
+ upsertSessionHead(input: {
1168
+ sessionId: string;
1169
+ version: number;
1170
+ title?: string;
1171
+ cwd?: string;
1172
+ updatedAt?: number;
1173
+ archived?: boolean;
1174
+ }): void;
1109
1175
  /** Remove one session and its documents entirely. */
1110
1176
  removeSession(sessionId: string): void;
1111
1177
  /** Update only a session's header row (title backfill), keeping documents. */
@@ -1203,6 +1269,8 @@ interface SwitchSyncState {
1203
1269
  sessionId: string;
1204
1270
  error: string;
1205
1271
  }[];
1272
+ /** 补录后仍「有表头无正文」的行数(hollow 体检面,含合法真空会话)。 */
1273
+ hollow: number;
1206
1274
  /** Last pass error (whole-pass abort), if any. */
1207
1275
  error?: string;
1208
1276
  }
@@ -1213,6 +1281,36 @@ interface SwitchSyncState {
1213
1281
  interface SwitchArchiveSource {
1214
1282
  readonly archivedSessionIds: readonly string[];
1215
1283
  }
1284
+ /** DRS 语料头(依赖倒置端口;真身 = drs-source.ts 的 DrsCorpusSource)。 */
1285
+ interface SwitchDrsCorpusHead {
1286
+ sessionId: string;
1287
+ /** 水位代理 = DRS sessions.artifact_mtime_ms(日志重写必 bump)。 */
1288
+ version: number;
1289
+ title: string;
1290
+ cwd: string;
1291
+ updatedAt: number;
1292
+ archived: boolean;
1293
+ }
1294
+ /** DRS 检索臂文档(surface 已折算引擎字符串域;切分由引擎重算)。 */
1295
+ interface SwitchDrsCorpusDoc {
1296
+ seq: number;
1297
+ type: string;
1298
+ surface: string;
1299
+ time: number;
1300
+ text: string;
1301
+ }
1302
+ /**
1303
+ * DRS 语料源端口(T7.1):corpusSource='drs' 时语料改从
1304
+ * dsh-reference-session-collector 投影库取,docs 直插引擎;不可达时整轮回退原生
1305
+ * sessionQuery + 文件兜底链路。单测注入普通对象。
1306
+ */
1307
+ interface SwitchDrsCorpusSource {
1308
+ listSessions(): Promise<readonly SwitchDrsCorpusHead[]>;
1309
+ readSession(sessionId: string): Promise<{
1310
+ head: SwitchDrsCorpusHead;
1311
+ docs: readonly SwitchDrsCorpusDoc[];
1312
+ } | undefined>;
1313
+ }
1216
1314
  /**
1217
1315
  * One watermark syncer bound to one open engine. `poll()` is re-entrant-safe:
1218
1316
  * overlapping calls collapse into the running pass.
@@ -1228,7 +1326,19 @@ declare class SwitchWatermarkSync {
1228
1326
  * 的老会话,快照服务又整片不可用时,这是最后兜底。
1229
1327
  */
1230
1328
  private readonly readProjectionTitle?;
1329
+ /**
1330
+ * DRS 语料源(可选,T7.1):提供时每轮先走 DRS 轮(docs 直插);DRS 整轮
1331
+ * 失败(网络/路由/包络)自动回退原生 sessionQuery + 文件兜底。
1332
+ */
1333
+ private readonly drsSource?;
1231
1334
  private running;
1335
+ /**
1336
+ * 本进程已确认「重读过且产出仍为 0 docs」的会话(键 id@version)。
1337
+ * 无可索引文本是合法终态——没有这份缓存,hollow 补录判据会把真空会话
1338
+ * 每轮完整重读一次(热循环)。宿主重启后缓存归零,最多各重读一次。
1339
+ */
1340
+ private readonly confirmedEmpty;
1341
+ private static emptyKey;
1232
1342
  private readonly state;
1233
1343
  /**
1234
1344
  * @param readSessionFromFile - 可选的**文件级兜底读取器**(管家 health 侧的
@@ -1248,7 +1358,12 @@ declare class SwitchWatermarkSync {
1248
1358
  * 第三标题源(可选):官方投影缓存里的 title 行。事件流没有 session/title
1249
1359
  * 的老会话,快照服务又整片不可用时,这是最后兜底。
1250
1360
  */
1251
- readProjectionTitle?: ((sessionId: string) => string) | undefined);
1361
+ readProjectionTitle?: ((sessionId: string) => string) | undefined,
1362
+ /**
1363
+ * DRS 语料源(可选,T7.1):提供时每轮先走 DRS 轮(docs 直插);DRS 整轮
1364
+ * 失败(网络/路由/包络)自动回退原生 sessionQuery + 文件兜底。
1365
+ */
1366
+ drsSource?: SwitchDrsCorpusSource | undefined);
1252
1367
  /**
1253
1368
  * 读取一个会话的日志:服务面优先,失败落文件兜底。两条路都失败时抛最后
1254
1369
  * 一个错误,由调用方按会话隔离记失败。
@@ -1273,6 +1388,15 @@ declare class SwitchWatermarkSync {
1273
1388
  */
1274
1389
  poll(): Promise<SwitchSyncState>;
1275
1390
  private runPass;
1391
+ /**
1392
+ * DRS 语料轮(T7.1):语料头从 DRS `op=sessions` 分页拉取,水位
1393
+ * diff(version=artifact_mtime_ms)后按会话 `op=session&fields=search`
1394
+ * 取检索臂 docs 直插引擎(upsertSessionDocs)。归档集合改用 DRS 行的
1395
+ * archived 旗标(DRS sync 本就只读跟随 workspace.json,同源);标题直接
1396
+ * 采 DRS 行(投影侧同一 extractTitleFromEvents 视界),不再走快照精修。
1397
+ * 每会话失败隔离语义与原生轮一致;无可索引文本仍进 confirmedEmpty 缓存。
1398
+ */
1399
+ private runDrsPass;
1276
1400
  /**
1277
1401
  * Fold latest titles for changed sessions into the index header rows.
1278
1402
  *
@@ -1306,6 +1430,81 @@ declare function createArchiveSource(getRegistry: () => SwitchRegistryFace | und
1306
1430
  diagnostics: () => SwitchArchiveDiagnostics;
1307
1431
  };
1308
1432
  //#endregion
1433
+ //#region src/host/index/drs-source.d.ts
1434
+ /** 一个 DRS 会话头(watermark 代理 + 检索排序字段)。 */
1435
+ interface DrsCorpusHead {
1436
+ sessionId: string;
1437
+ version: number;
1438
+ title: string;
1439
+ cwd: string;
1440
+ updatedAt: number;
1441
+ archived: boolean;
1442
+ }
1443
+ /** 一个 DRS 检索臂文档(surface 已折算成引擎列的字符串域)。 */
1444
+ interface DrsCorpusDoc {
1445
+ seq: number;
1446
+ type: string;
1447
+ surface: 'current' | 'shadowed';
1448
+ time: number;
1449
+ text: string;
1450
+ }
1451
+ /** 一个 DRS 会话的完整语料(头 + docs)。 */
1452
+ interface DrsCorpusSession {
1453
+ head: DrsCorpusHead;
1454
+ docs: DrsCorpusDoc[];
1455
+ }
1456
+ interface DrsCorpusSourceOptions {
1457
+ /** DRS API 基址(http://host[:port];解析序见 resolveDrsBaseUrl)。 */
1458
+ baseUrl: string;
1459
+ /** 注入面(单测);缺省全局 fetch。 */
1460
+ fetchImpl?: typeof fetch;
1461
+ /** 显式 Host 头(trustedHosts 首条回显;缺省不覆盖)。 */
1462
+ hostHeader?: string;
1463
+ log?: (message: string) => void;
1464
+ }
1465
+ declare class DrsCorpusSource {
1466
+ private readonly options;
1467
+ private readonly fetchImpl;
1468
+ constructor(options: DrsCorpusSourceOptions);
1469
+ /** 一个 GET 的 JSON 包络(ok!==true 或非 2xx 一律抛,由调用方回退 native)。 */
1470
+ private getJson;
1471
+ private static headOf;
1472
+ /** 全量语料头(内部翻页;rows 空或凑满 total 即止)。 */
1473
+ listSessions(): Promise<DrsCorpusHead[]>;
1474
+ /** 一个会话的检索臂 docs;DRS 无此会话(session:null)返回 undefined。 */
1475
+ readSession(sessionId: string): Promise<DrsCorpusSession | undefined>;
1476
+ /**
1477
+ * 分组内容搜索直连臂(op=search&group=session,DRS surface.searchGrouped 同构):
1478
+ * 会话分组/加权/过滤/锚定节选全部在 DRS 侧完成,本方法只搬 wire →
1479
+ * 引擎命中形状(SwitchSearchHit 字段同名)。失败(网络/非 2xx/包络)直抛,
1480
+ * 调用侧按硬依赖语义显式报错——**不回退本地索引**。
1481
+ */
1482
+ searchGrouped(request: {
1483
+ query: string;
1484
+ /** 原事件 type 列表(调用方展开粗类);空=DRS 缺省 user+assistant。 */
1485
+ kinds?: readonly string[];
1486
+ archived?: 'active' | 'archived' | 'all';
1487
+ from?: number;
1488
+ to?: number;
1489
+ sortBy?: 'relevance' | 'time';
1490
+ limit?: number;
1491
+ /** 命中展开(wire `expand=1`):同会话多命中各自成行;缺省聚合。 */
1492
+ expand?: boolean;
1493
+ /** 同源 Host 覆盖(转发调用方请求头;优先于装配 baseUrl)。 */
1494
+ atHost?: string;
1495
+ }): Promise<{
1496
+ sessionId: string;
1497
+ title: string;
1498
+ seq: number;
1499
+ type: string;
1500
+ time: number;
1501
+ updatedAt: number;
1502
+ snippet: string;
1503
+ }[]>;
1504
+ /** 可性探针(op=status):硬依赖预检/降级提示用;失败返回 false。 */
1505
+ probe(atHost?: string): Promise<boolean>;
1506
+ }
1507
+ //#endregion
1309
1508
  //#region src/host/index/rebuild.d.ts
1310
1509
  /** The corpus reader a rebuild needs (same faces as the syncer). */
1311
1510
  interface SwitchRebuildSessionQuery {
@@ -1402,6 +1601,18 @@ interface SwitchRebuildHooks {
1402
1601
  events: readonly SwitchRawEvent[];
1403
1602
  } | undefined>;
1404
1603
  }
1604
+ /**
1605
+ * The swap window: synchronous renames only; queries fail only inside it.
1606
+ *
1607
+ * issue #1 评论的损坏根因:只搬主文件时,旧库残留的 -wal/-shm 会被同名顶替
1608
+ * 的新库当自己的 WAL 重放,页号错配 → malformed。因此 sidecar 必须随主文件
1609
+ * 一并迁 archive(干净 close 本会 checkpoint 自删,这里是异常关闭的兜底)。
1610
+ * swap 后跑 integrity_check:非 ok 则把损坏库改名 .corrupt、从刚落的 archive
1611
+ * 回滚重开,并抛错让调用方置 error(把「索引损坏」降级为「回到上次快照」)。
1612
+ * 导出供测试直接驱动 swap 窗口(多连接场景在 Windows 上 rename 必 EBUSY,
1613
+ * 无法经 rebuildIndex 全链路确定性复现)。
1614
+ */
1615
+ declare function swapShadowIntoActive(activeEngine: SwitchIndexEngine, layout: SwitchIndexLayout, log?: (msg: string) => void): Promise<void>;
1405
1616
  declare function rebuildIndex(activeEngine: SwitchIndexEngine, layout: SwitchIndexLayout, sessionQuery: SwitchRebuildSessionQuery, keepArchives: number, onProgress?: (done: number, total: number) => void, archiveSource?: () => SwitchArchiveSource | undefined, hooks?: SwitchRebuildHooks): Promise<SwitchRebuildState>;
1406
1617
  /** One doc-level record the snapshot importer feeds in. */
1407
1618
  interface SwitchImportRecord {
@@ -1418,8 +1629,9 @@ interface SwitchImportRecord {
1418
1629
  text: string;
1419
1630
  }[];
1420
1631
  }
1421
- /** Import doc-level records into the shadow file and swap it in (same swap path). */
1422
- declare function importIntoIndex(activeEngine: SwitchIndexEngine, layout: SwitchIndexLayout, records: readonly SwitchImportRecord[], keepArchives: number): Promise<SwitchRebuildState>;
1632
+ /** Import doc-level records into the shadow file and swap it in (same swap path).
1633
+ * @param log - 可选日志汇(空 docs 记录告警,issue #1 写入侧可观测)。 */
1634
+ declare function importIntoIndex(activeEngine: SwitchIndexEngine, layout: SwitchIndexLayout, records: readonly SwitchImportRecord[], keepArchives: number, log?: (msg: string) => void): Promise<SwitchRebuildState>;
1423
1635
  //#endregion
1424
1636
  //#region src/host/history/archive.d.ts
1425
1637
  /** 一行历史文件条目(尽力而为的元数据 + 磁盘占用)。 */
@@ -1954,21 +2166,27 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
1954
2166
  historyFiles: z<boolean, boolean, "defined">;
1955
2167
  healthCheck: z<boolean, boolean, "defined">;
1956
2168
  search: z<boolean, boolean, "defined">;
2169
+ directDelete: z<boolean, boolean, "defined">;
1957
2170
  defaultMode: z<"title" | "content", "title" | "content", "defined">;
1958
2171
  autoSync: z<boolean, boolean, "defined">;
1959
2172
  syncIntervalMs: z<number, number, "defined">;
1960
2173
  archiveKeep: z<number, number, "defined">;
1961
2174
  indexDir: z<string, string, "defined">;
2175
+ corpusSource: z<"native" | "drs", "native" | "drs", "defined">;
2176
+ drsBaseUrl: z<string, string, "defined">;
1962
2177
  }>>, Schemastery.ObjectT<NoInfer<{
1963
2178
  enabled: z<boolean, boolean, "defined">;
1964
2179
  historyFiles: z<boolean, boolean, "defined">;
1965
2180
  healthCheck: z<boolean, boolean, "defined">;
1966
2181
  search: z<boolean, boolean, "defined">;
2182
+ directDelete: z<boolean, boolean, "defined">;
1967
2183
  defaultMode: z<"title" | "content", "title" | "content", "defined">;
1968
2184
  autoSync: z<boolean, boolean, "defined">;
1969
2185
  syncIntervalMs: z<number, number, "defined">;
1970
2186
  archiveKeep: z<number, number, "defined">;
1971
2187
  indexDir: z<string, string, "defined">;
2188
+ corpusSource: z<"native" | "drs", "native" | "drs", "defined">;
2189
+ drsBaseUrl: z<string, string, "defined">;
1972
2190
  }>>, "plain">;
1973
2191
  /** 运行时依赖。 */
1974
2192
  interface StewardRuntime {
@@ -2006,6 +2224,11 @@ interface StewardRuntime {
2006
2224
  /** 清理成功(物理删除)→ 索引行整个移除。 */
2007
2225
  onPurged: (sessionIds: readonly string[]) => void;
2008
2226
  };
2227
+ /**
2228
+ * 退场墓碑台账目录(可选):purge 成功后追加 retired-tombstones.jsonl。
2229
+ * 缺省 = ~/.dsh-switch-search(单测注入临时目录隔离真实家目录)。
2230
+ */
2231
+ tombstoneDir?: () => string;
2009
2232
  }
2010
2233
  /**
2011
2234
  * 支持的路由方法(按子域分组;用于对外声明与测试断言)。
@@ -2088,6 +2311,8 @@ interface SwitchIndexServiceState {
2088
2311
  interface SearchRuntime {
2089
2312
  sessionQuery: SwitchSessionQuery | undefined;
2090
2313
  index: SwitchIndexServiceState;
2314
+ /** DRS 直连客户端(T7.3 硬依赖:内容分组检索臂唯一来源 + 可性探针)。 */
2315
+ drsSource: DrsCorpusSource;
2091
2316
  config: () => Required<StewardConfig> & SwitchSearchConfig;
2092
2317
  /** Lazy official archive-set source (registry first, file fallback). */
2093
2318
  registry: () => {
@@ -2107,7 +2332,7 @@ interface SearchRuntime {
2107
2332
  } | undefined>;
2108
2333
  }
2109
2334
  /** JSON 面的搜索子域方法分发(index-export/import 走原始体,在路由层特判)。 */
2110
- declare function handleIndexMethod(method: string, payload: unknown, srt: SearchRuntime): Promise<unknown>;
2335
+ declare function handleIndexMethod(method: string, payload: unknown, srt: SearchRuntime, requestHost?: string): Promise<unknown>;
2111
2336
  declare function handleMethod(method: string, payload: unknown, runtime: StewardRuntime): Promise<unknown>;
2112
2337
  /**
2113
2338
  * 插件主体:装配运行时、挂载两条 fenced 路由与索引生命周期。
@@ -2116,4 +2341,4 @@ declare function handleMethod(method: string, payload: unknown, runtime: Steward
2116
2341
  */
2117
2342
  declare function apply(ctx: Context, config?: Partial<StewardConfig & SwitchSearchConfig>): void;
2118
2343
  //#endregion
2119
- export { Config, DEFAULT_CONFIG, DEFAULT_INDEX_LAYOUT, type DiscoveredSession, type GenerationArtifact, HEALTH_METHODS, HISTORY_METHODS, HealthCache, type HealthCacheEntry, INDEX_METHODS, type LogArtifact, type LogCompression, type RepairAssessment, type RepairVerdict, SOURCE_MIGRATE_BACKUP_SUFFIX, STEWARD_API_PREFIX, STEWARD_SETTINGS_NAMESPACE, SWITCH_API_PREFIX, SWITCH_DEFAULT_CONFIG, SearchRuntime, type SessionGenerations, type SessionPriority, type StewardConfig, StewardRuntime, type SwitchArchiveDiagnostics, SwitchIndexEngine, SwitchIndexServiceState, type SwitchSearchConfig, SwitchWatermarkSync, V4_HOST_MIN, apply, archiveArchiveFile, archiveHistory, assessRepair, backupFilesIn, buildProjectionOwnerIndex, buildSessionReport, classifyGenerationFilename, countCorpus, createArchiveSource, createAttributor, decodeSessionLogBytes, decodeSessionLogFile, detectSteward, dirSize, discoverSessions, editWorkspaceDocument, exportSnapshot, extractTitleFromEvents, findSession, findSessionLog, firstLosslessViolation, gateColdRead, gateGeneration, gateLogIntegrity, gateLosslessJson, gateProjectionCache, gateSourceKind, generationLogFilename, handleIndexMethod, handleMethod, importIntoIndex, indexSessionDirs, inject, isLossless, isMigrationStagingFilename, isSafeChild, isSourceMigrateBackupName, latestArtifactMtime, listHistory, locateSessionUsage, methodEnabled, migrateLegacySource, migrateSessionSourceKind, parseGenerationLogFilename, parseSnapshot, prescribe, probePeer, projCacheRootFor, pruneArchiveFile, pruneHistory, purgeHistory, quarantineProjectionCache, readArchiveSet, readProjectionCache, readSessionGenerations, readSourceKindFacts, readTailFacts, rebuildIndex, recoverIndex, scanSessions, scanZstdFrames, sessionPriority, sessionsRootFor };
2344
+ export { Config, DEFAULT_CONFIG, DEFAULT_INDEX_LAYOUT, type DiscoveredSession, type GenerationArtifact, HEALTH_METHODS, HISTORY_METHODS, HealthCache, type HealthCacheEntry, INDEX_METHODS, type LogArtifact, type LogCompression, type RepairAssessment, type RepairVerdict, SOURCE_MIGRATE_BACKUP_SUFFIX, STEWARD_API_PREFIX, STEWARD_SETTINGS_NAMESPACE, SWITCH_API_PREFIX, SWITCH_DEFAULT_CONFIG, SearchRuntime, type SessionGenerations, type SessionPriority, type StewardConfig, StewardRuntime, type SwitchArchiveDiagnostics, SwitchIndexEngine, SwitchIndexServiceState, type SwitchSearchConfig, SwitchWatermarkSync, V4_HOST_MIN, apply, archiveArchiveFile, archiveHistory, assessRepair, backupFilesIn, buildProjectionOwnerIndex, buildSessionReport, classifyGenerationFilename, countCorpus, createArchiveSource, createAttributor, decodeSessionLogBytes, decodeSessionLogFile, detectSteward, dirSize, discoverSessions, editWorkspaceDocument, exportSnapshot, extractTitleFromEvents, findSession, findSessionLog, firstLosslessViolation, gateColdRead, gateGeneration, gateLogIntegrity, gateLosslessJson, gateProjectionCache, gateSourceKind, generationLogFilename, handleIndexMethod, handleMethod, importIntoIndex, indexSessionDirs, inject, isLossless, isMigrationStagingFilename, isSafeChild, isSourceMigrateBackupName, latestArtifactMtime, listHistory, locateSessionUsage, methodEnabled, migrateLegacySource, migrateSessionSourceKind, parseGenerationLogFilename, parseSnapshot, prescribe, probePeer, projCacheRootFor, pruneArchiveFile, pruneHistory, purgeHistory, quarantineProjectionCache, readArchiveSet, readProjectionCache, readSessionGenerations, readSourceKindFacts, readTailFacts, rebuildIndex, recoverIndex, scanSessions, scanZstdFrames, sessionPriority, sessionsRootFor, swapShadowIntoActive };