@cold777/dsh-takeover 0.1.0 → 0.2.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.
package/lib/index.d.ts CHANGED
@@ -76,6 +76,56 @@ interface CoverageStats {
76
76
  unmarked: number;
77
77
  [k: string]: number;
78
78
  }
79
+ /**
80
+ * 四轴 IR 立约——axis:这张卡是哪根轴的载荷。
81
+ * 'session'=会话轴(工作交接卡,六段接续工作);'memory'=记忆轴(记忆快照卡,按条目吸收);
82
+ * 'config'=环境配置轴(环境/配置交接卡,预留)。取件方据此决定消费姿态。
83
+ * 走 extras 通道持久化:core parseCard 把顶层未知键收进 extras,extras 殿后渲染回 frontmatter——
84
+ * 不认识 axis 的旧实现按未知字段原样保留,round-trip 不丢(既有版本纪律)。
85
+ */
86
+ type CardAxis = 'session' | 'memory' | 'config';
87
+ /**
88
+ * 四轴 IR 立约——payload:载荷形态。
89
+ * 'files'=原文件正文(卡里带原始文件内容,取件方原样吸收整份);
90
+ * 'distilled'=蒸馏条目(卡里带甄别过的条目,取件方按条目入库);
91
+ * 'manifest'=清单+指针(配置轴:卡里只带文件清单/哈希/类别与密文包指针,
92
+ * 不带货本体——本体在卡外按指针取,口令永不进卡)。
93
+ */
94
+ type CardPayload = 'files' | 'distilled' | 'manifest';
95
+ /**
96
+ * 寄存时刻的仓库基线:remote/head/branch 三元组。取件方据此在新机器上
97
+ * clone → checkout → apply 补丁 → 跑测试,复原寄存时的代码现场。
98
+ * 各字段如实缺省(拿不到就是 null/空串),绝不用占位值冒充。
99
+ * (type 别名而非 interface:命名别名才有隐式索引签名,过 defineTool 的 JsonValue 契约——SyncToolValue 同款)
100
+ */
101
+ type RepoBaseline = {
102
+ /** origin 远端 URL;无 origin(纯本地仓)/ 非 git 仓为 null */
103
+ remote: string | null;
104
+ /** 寄存时刻 HEAD commit;unborn 分支(无提交)/ 命令失败为 null */
105
+ head: string | null;
106
+ /** 寄存时刻分支名(复用 GitSnapshot.branch,同一次采集;非 git 仓为空串) */
107
+ branch: string;
108
+ };
109
+ /** 从卡片 extras 防御式取基线(core parseCard 把顶层未知键收进 extras;外来卡/坏数据一律 undefined) */
110
+ export declare function baselineFromExtras(extras: unknown): RepoBaseline | undefined;
111
+ /** 从卡片 extras 防御式取四轴标记(闭集外/坏数据一律 undefined——外来卡无 axis 按旧卡处理) */
112
+ export declare function axisFromExtras(extras: unknown): CardAxis | undefined;
113
+ /** 「🧭 基线恢复指引」四步(clone → checkout → apply 补丁 → 跑测试)。
114
+ * baseline 与 patch/testCommand 任一缺席都如实降级为说明行,不渲染空壳步骤。 */
115
+ export declare function renderBaselineGuidance(baseline: RepoBaseline, patchPath: string | undefined, testCommand: string | undefined): string[];
116
+ /**
117
+ * 补丁随卡信息(PushResult / 信封 extra / HandoffEnvelope.patch 三处共用)。
118
+ * patchFormat/chunks 是 0.4.x gzip/分块扩展:patchFormat='gzip' = 补丁以 gzip 压缩形态
119
+ * 随卡(.patch.gz 或分块 .patch.NNN.gz),chunks>1 = 分块数;旧消费者天然忽略,
120
+ * bytes 恒为未压缩补丁全文的字节数(压缩块字节数进取件面 patchBytes)。
121
+ */
122
+ type PatchInfo = {
123
+ bytes: number;
124
+ truncated: boolean;
125
+ sidecar: boolean;
126
+ patchFormat?: 'gzip';
127
+ chunks?: number;
128
+ };
79
129
  /** handoff_push 参数:六段文本可选,缺省段走事件流确定性兜底 */
80
130
  interface PushArgs {
81
131
  goal?: string;
@@ -104,11 +154,7 @@ type PushResult = {
104
154
  note: string;
105
155
  coverage: CoverageStats;
106
156
  /** 未提交改动补丁随卡情况;undefined = 源目录非 git 仓库 */
107
- patch?: {
108
- bytes: number;
109
- truncated: boolean;
110
- sidecar: boolean;
111
- };
157
+ patch?: PatchInfo;
112
158
  /** 本卡接替的前置卡 id(透传进信封) */
113
159
  supersedes?: string;
114
160
  /** 空壳卡(守门旁路后落盘):调用方/下游可据此提示 */
@@ -127,9 +173,12 @@ export declare function factsToSections(facts: SessionFacts, skipped: boolean, n
127
173
  * 外来段落净化(ANSI/控制字符剥离、伪标题解除形态)并限量(单段 128K 字符,
128
174
  * 标量 500)——共享收件箱的卡会被 inboxList/buildState 每次全量重读,不设上限
129
175
  * 就是把宿主内存/CPU 交给任意一次 push。
176
+ * opts.extras 是插件侧内部出卡通道(pushMemoryCard 等程序化调用方覆盖 axis/payload
177
+ * 立约缺省):不进 handoff_push 工具入参面,模型输入到不了 extras,密钥闸不旁路。
130
178
  */
131
179
  export declare function pushHandoff(session: unknown, args: PushArgs, opts?: {
132
180
  dir?: string;
181
+ extras?: Record<string, unknown>;
133
182
  }): PushResult;
134
183
  interface InboxItem {
135
184
  id: string;
@@ -154,6 +203,42 @@ type InboxListResult = {
154
203
  export declare function inboxList(opts?: {
155
204
  dir?: string;
156
205
  }): InboxListResult;
206
+ /** 卡链历史单卡上限条数(与 core ARCHIVED_KEEP=50 同量级——再早的已被滚动归档淘汰) */
207
+ export declare const HISTORY_TAIL_MAX = 50;
208
+ /** stopped 摘要截断(够辨认停点,不把卡正文搬进返回值) */
209
+ export declare const HISTORY_STOPPED_MAX = 120;
210
+ /** 卡链历史单行(type 别名:JsonValue 契约要隐式索引签名,InboxItem 同款) */
211
+ type HistoryItem = {
212
+ id: string;
213
+ title: string;
214
+ pushed_at: string;
215
+ /** 「停在哪」段摘要(截 HISTORY_STOPPED_MAX;控制字符已剥离) */
216
+ stopped: string;
217
+ /** 本卡接替的前置卡 id(extras.supersedes;旧卡/无接力缺省) */
218
+ supersedes?: string;
219
+ };
220
+ type InboxHistoryResult = {
221
+ ok: true;
222
+ action: 'history';
223
+ cards: HistoryItem[];
224
+ total: number;
225
+ project?: string;
226
+ cwd?: string;
227
+ } | {
228
+ ok: false;
229
+ error: string;
230
+ };
231
+ /**
232
+ * 卡链检索:按 project 或 cwd 查 archived/ 已归档卡(复用 core listArchivedReport,
233
+ * 坏卡照旧跳过并忽略)。时间正序(pushed_at 字典序——同机卡共享时区口径),取尾
234
+ * HISTORY_TAIL_MAX 条;两个过滤条件都给 = AND,都不给 = 全量回查。
235
+ * supersedes 取自卡面 extras(寄存时随 extras 持久化——信封取件即弃,卡面才是持久通道)。
236
+ */
237
+ export declare function inboxHistory(opts?: {
238
+ dir?: string;
239
+ project?: string;
240
+ cwd?: string;
241
+ }): InboxHistoryResult;
157
242
  type InboxLoadResult = {
158
243
  ok: true;
159
244
  action: 'load';
@@ -161,13 +246,21 @@ type InboxLoadResult = {
161
246
  text: string;
162
247
  mismatches: string[];
163
248
  unavailable?: string;
249
+ /** 卡内 extras.axis 四轴标记(防御式提取,外来旧卡缺省) */
250
+ axis?: CardAxis;
164
251
  /** 卡内 extras.coverage(防御式提取,外来卡/坏数据缺省) */
165
252
  coverage?: CoverageStats;
166
253
  /** 随卡消费的机器信封 JSON 字符数;卡无信封(旧卡/外写卡)缺省 */
167
254
  envelopeChars?: number;
168
- /** 随卡归档的未提交改动补丁路径(git apply 可复原);卡无补丁缺省 */
255
+ /** 随卡归档的未提交改动补丁路径(git apply 可复原;gzip 形态已自动解压为纯文本);卡无补丁缺省 */
169
256
  patchPath?: string;
170
257
  patchBytes?: number;
258
+ /** 补丁 gzip 压缩随卡形态(取件时已自动解压重组);旧纯文本 .patch 缺省 */
259
+ patchFormat?: 'gzip' | 'gzip-chunked';
260
+ /** gzip 块数(单块=1、分块=N) */
261
+ patchChunks?: number;
262
+ /** 补丁还原降级说明(解压失败等,压缩块已原样归档);正常还原缺省 */
263
+ patchWarn?: string;
171
264
  /** 信封提示的基线测试命令 */
172
265
  testCommand?: string;
173
266
  /** 本卡接替的前置卡 id */
@@ -177,6 +270,8 @@ type InboxLoadResult = {
177
270
  source: string;
178
271
  local: string;
179
272
  };
273
+ /** 卡内 extras.baseline 的仓库基线(防御式提取,外来卡/坏数据缺省) */
274
+ baseline?: RepoBaseline;
180
275
  /** 信封验签结论:unsigned=无签名(旧卡/外写卡),no-key=有签名但本机无对应密钥 */
181
276
  sig?: SigVerdict;
182
277
  } | {
@@ -198,6 +293,52 @@ export declare function handoffHostNotice(userQuestions: unknown, action: 'push'
198
293
  agent?: Agent;
199
294
  signal?: AbortSignal;
200
295
  }, log?: (msg: string) => void): Promise<void>;
296
+ /** 配置卡 extras.config 结构化载荷:清单 + 指针(不含任何文件内容,口令永不进卡) */
297
+ interface ConfigCardPayload {
298
+ /** 密文备份文件名(.dshenv,指针) */
299
+ backupFile: string;
300
+ /** 密文包本体字节数(指针口径) */
301
+ bytes: number;
302
+ /** 备份时刻(容器 manifest.createdAt) */
303
+ createdAt: string;
304
+ /** 源机主机名 */
305
+ host: string;
306
+ /** 凭据类文件计数(如实告知包内有几件只存在于加密包内的东西) */
307
+ secretCount: number;
308
+ /** 清单行:path/sha256/category(不含内容与口令) */
309
+ files: Array<{
310
+ path: string;
311
+ sha256: string;
312
+ category: string;
313
+ }>;
314
+ }
315
+ type ConfigCardResult = {
316
+ ok: true;
317
+ id: string;
318
+ path: string;
319
+ file: string;
320
+ bytes: number;
321
+ files: number;
322
+ note?: string;
323
+ } | {
324
+ ok: false;
325
+ error: string;
326
+ };
327
+ /**
328
+ * 配置轴出卡核心(handoff_env action=card / 换机面板共用):把最近一次备份的
329
+ * 清单(files[{path,sha256,category}] + backupFile + bytes)写成 axis='config'
330
+ * 载荷卡——writeCard + 机器信封签名全套纪律(cardSha256 进签名面,与 pushHandoff
331
+ * 同款尽力签名:密钥缺席信封照落、落盘失败不回滚卡片)。密文 blob 仍在
332
+ * env-backup/(卡只带清单+指针,随 HANDOFF_HOME 同步盘走);口令只用于读加密
333
+ * 清单,永不进卡六段与 extras。args.file 缺省取最近一次备份(listBackups 首项)。
334
+ */
335
+ export declare function pushConfigCard(args: {
336
+ file?: string;
337
+ passphrase?: string;
338
+ title?: string;
339
+ }, opts?: {
340
+ dir?: string;
341
+ }): ConfigCardResult;
201
342
  //#endregion
202
343
  //#region node_modules/.pnpm/@agent-handoff+readers@file+vendor+@agent-handoff+readers/node_modules/@agent-handoff/readers/dist/index.d.mts
203
344
  //#region src/transcript.d.ts
@@ -235,11 +376,211 @@ interface SessionRef {
235
376
  kind: 'file' | 'sqlite';
236
377
  }
237
378
  //#endregion
379
+ //#region src/providers.d.ts
380
+ declare const PROVIDERS: readonly [{
381
+ readonly name: 'claude';
382
+ readonly adapter: 'claude-code';
383
+ readonly label: 'Claude Code';
384
+ readonly outboundEligible: true;
385
+ readonly icon: {
386
+ readonly kind: 'mark';
387
+ readonly mark: {
388
+ readonly viewBox: '0 0 24 24';
389
+ readonly tile: '#D97757';
390
+ readonly paths: readonly [{
391
+ readonly d: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z";
392
+ readonly fill: '#fff';
393
+ }];
394
+ };
395
+ };
396
+ readonly resume: {
397
+ readonly id: 'resume-claude';
398
+ readonly product: 'Claude Code';
399
+ readonly description: '把一条 Claude Code 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
400
+ readonly recoveryBoundary: '读取器全量读取本地记录(含被替换/放弃分支的条目,thinking 块以 [thinking] 标记保留);不复活 CLI、不回放工具调用。';
401
+ };
402
+ }, {
403
+ readonly name: 'codex';
404
+ readonly adapter: 'codex';
405
+ readonly label: 'Codex CLI';
406
+ readonly outboundEligible: true;
407
+ readonly icon: {
408
+ readonly kind: 'mark';
409
+ readonly mark: {
410
+ readonly viewBox: '0 0 24 24';
411
+ readonly tile: '#0f0f0f';
412
+ readonly paths: readonly [{
413
+ readonly d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z";
414
+ readonly fill: '#fff';
415
+ }];
416
+ };
417
+ };
418
+ readonly resume: {
419
+ readonly id: 'resume-codex';
420
+ readonly product: 'Codex';
421
+ readonly description: '把一条 Codex 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
422
+ readonly recoveryBoundary: '读取器排除 Codex 的 system / developer / reasoning / world-state / 跨 agent 记录。';
423
+ };
424
+ }, {
425
+ readonly name: 'opencode';
426
+ readonly adapter: 'opencode';
427
+ readonly label: 'OpenCode';
428
+ readonly outboundEligible: true;
429
+ readonly icon: {
430
+ readonly kind: 'mark';
431
+ readonly mark: {
432
+ readonly viewBox: '0 0 512 512';
433
+ readonly tile: '#131010';
434
+ readonly paths: readonly [{
435
+ readonly d: 'M384 416H128V96H384V416ZM320 160H192V352H320V160Z';
436
+ readonly fill: '#fff';
437
+ }];
438
+ };
439
+ };
440
+ readonly resume: {
441
+ readonly id: 'resume-opencode';
442
+ readonly product: 'OpenCode';
443
+ readonly description: '把一条 OpenCode 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id 或标题关键词。';
444
+ readonly recoveryBoundary: '读取器只读 OpenCode 本地存储的会话记录;不复活进程、不回放存储的调用。';
445
+ };
446
+ }, {
447
+ readonly name: 'zcode';
448
+ readonly adapter: 'zcode';
449
+ readonly label: 'ZCode';
450
+ readonly outboundEligible: true;
451
+ readonly icon: {
452
+ readonly kind: 'mark';
453
+ readonly mark: {
454
+ readonly viewBox: '0 0 30 30';
455
+ readonly tile: '#2D2D2D';
456
+ readonly paths: readonly [{
457
+ readonly d: 'M15.47,7.1l-1.3,1.85c-0.2,0.29-0.54,0.47-0.9,0.47h-7.1V7.09C6.16,7.1,15.47,7.1,15.47,7.1z';
458
+ readonly fill: '#fff';
459
+ }, {
460
+ readonly d: 'M24.3 7.1L13.14 22.91L5.7 22.91L16.86 7.1Z';
461
+ readonly fill: '#fff';
462
+ }, {
463
+ readonly d: 'M14.53,22.91l1.31-1.86c0.2-0.29,0.54-0.47,0.9-0.47h7.09v2.33H14.53z';
464
+ readonly fill: '#fff';
465
+ }];
466
+ };
467
+ };
468
+ readonly resume: {
469
+ readonly id: 'resume-zcode';
470
+ readonly product: 'ZCode';
471
+ readonly description: '把一条 ZCode 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id(支持短前缀)或标题关键词。';
472
+ readonly recoveryBoundary: '读取器只读 ZCode 的 sqlite 库(readonly、随开随关,需 Node ≥22);不回放调用、不复活 CLI;压缩段只是摘要标记,仍在库里的旧行保留。';
473
+ };
474
+ }, {
475
+ readonly name: 'pi';
476
+ readonly adapter: 'pi';
477
+ readonly label: 'Pi';
478
+ readonly outboundEligible: true;
479
+ readonly icon: {
480
+ readonly kind: 'mark';
481
+ readonly mark: {
482
+ readonly viewBox: '0 0 800 800';
483
+ readonly tile: '#27272a';
484
+ readonly paths: readonly [{
485
+ readonly d: 'M165.29 165.29H517.36V400H400V282.65H165.29Z';
486
+ readonly fill: '#F09082';
487
+ }, {
488
+ readonly d: 'M165.29 282.65H282.65V400H400V517.36H282.65V634.72H165.29Z';
489
+ readonly fill: '#4D9ABF';
490
+ }, {
491
+ readonly d: 'M517.36 400H634.72V634.72H517.36Z';
492
+ readonly fill: '#F1BE58';
493
+ }];
494
+ };
495
+ };
496
+ readonly resume: {
497
+ readonly id: 'resume-pi';
498
+ readonly product: 'Pi';
499
+ readonly description: '把一条 Pi 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、JSONL 路径或标题关键词。';
500
+ readonly recoveryBoundary: '读取器只沿 Pi 当前活跃叶子读取,排除 thinking、hooks、system 消息与扩展注入的记录。';
501
+ };
502
+ }, {
503
+ readonly name: 'workbuddy';
504
+ readonly adapter: 'workbuddy';
505
+ readonly label: 'WorkBuddy';
506
+ readonly outboundEligible: true;
507
+ readonly icon: {
508
+ readonly kind: 'full';
509
+ readonly svg: "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_542_3370)\">\n<rect width=\"40\" height=\"40\" rx=\"20\" fill=\"url(#paint0_linear_542_3370)\"/>\n<g filter=\"url(#filter0_f_542_3370)\">\n<circle cx=\"31.3411\" cy=\"43.6183\" r=\"12.8704\" fill=\"#FFE355\" fill-opacity=\"0.49\" style=\"fill:#FFE355;fill:color(display-p3 1.0000 0.8891 0.3348);fill-opacity:0.49;\"/>\n</g>\n<path d=\"M28.5931 3.12762C28.9853 2.77585 29.0091 2.76226 29.2968 2.74499C29.7628 2.71096 30.1894 2.93488 30.916 3.59634C32.6132 5.13875 34.9769 8.30904 36.4462 11.0168L37.0138 12.0682L37.8156 12.4668C38.5896 12.8579 39.8593 13.6593 40.3898 14.0895C40.6297 14.2878 40.6638 14.2925 40.9133 14.1954C42.0388 13.7572 43.6506 14.3382 45.0727 15.7024C46.3529 16.9294 47.5794 19.026 48.0491 20.7757C48.1177 21.0574 48.2087 21.6628 48.2419 22.1134C48.349 23.6964 47.8414 24.9608 46.8637 25.5331C46.664 25.6484 46.6505 25.6795 46.6561 26.1774C46.7011 28.5481 46.0621 30.9144 44.7785 33.2221C43.3293 35.8133 40.7489 38.4945 37.2566 41.0199C35.3813 42.3846 30.9445 44.9701 28.9382 45.8778C24.1324 48.0414 20.2794 48.8709 16.9329 48.4609C14.9368 48.219 12.6769 47.44 11.34 46.5355C10.9885 46.2925 10.9325 46.2774 10.6637 46.3543C9.2327 46.7651 7.35867 45.9207 5.76659 44.1535C5.13165 43.4471 4.1065 41.7127 3.77404 40.7843C3.0054 38.6118 3.15852 36.6506 4.18236 35.4799C4.44671 35.1785 4.45511 35.1658 4.39735 34.6589C4.30195 33.8289 4.25837 32.6008 4.30192 31.808L4.33666 31.0674L3.22502 29.101C1.5033 26.0375 0.409325 23.4645 -0.012563 21.4992C-0.235219 20.4218 -0.221193 19.9436 0.0522186 19.5899C0.21871 19.3763 0.764928 19.1545 1.42322 19.0329C3.08041 18.742 6.69466 19.0056 10.7155 19.7155L11.1329 19.788L12.0511 18.976C13.5747 17.6264 14.587 16.8696 16.4531 15.706C18.3981 14.4891 20.5929 13.4877 23.0648 12.695L23.8577 12.4414L24.2939 11.2964C25.8547 7.17615 27.4533 4.13844 28.5931 3.12762ZM15.5182 24.243C13.7542 25.2615 12.8718 25.7706 12.2236 26.3413C9.59893 28.6526 8.61811 32.3134 9.73545 35.6274C10.0114 36.4457 10.5201 37.3283 11.5386 39.0923C12.5571 40.8564 13.0671 41.7383 13.6378 42.3864C15.9491 45.0112 19.6103 45.9929 22.9243 44.8755C23.7426 44.5995 24.6249 44.0899 26.3888 43.0714L36.5375 37.2121C38.3016 36.1936 39.184 35.6845 39.8321 35.1137C42.4568 32.8024 43.4373 29.1409 42.3198 25.8269C42.0438 25.0086 41.5342 24.1264 40.5158 22.3624C39.4973 20.5983 38.9882 19.7159 38.4175 19.0678C36.1062 16.4432 32.4454 15.4622 29.1314 16.5796C28.3131 16.8556 27.431 17.3651 25.6669 18.3836L15.5182 24.243Z\" fill=\"url(#paint1_linear_542_3370)\"/>\n<rect x=\"16.4961\" y=\"31.3344\" width=\"4.00904\" height=\"8.32646\" rx=\"2.00452\" transform=\"rotate(-30 16.4961 31.3344)\" fill=\"white\" style=\"fill:white;fill-opacity:1;\"/>\n<rect x=\"27.3125\" y=\"25.0894\" width=\"4.00904\" height=\"8.32646\" rx=\"2.00452\" transform=\"rotate(-30 27.3125 25.0894)\" fill=\"white\" style=\"fill:white;fill-opacity:1;\"/>\n</g>\n<defs>\n<filter id=\"filter0_f_542_3370\" x=\"7.47033\" y=\"19.7475\" width=\"47.742\" height=\"47.7416\" filterUnits=\"userSpaceOnUse\" color-interpolation-filters=\"sRGB\">\n<feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\"/>\n<feBlend mode=\"normal\" in=\"SourceGraphic\" in2=\"BackgroundImageFix\" result=\"shape\"/>\n<feGaussianBlur stdDeviation=\"5.50019\" result=\"effect1_foregroundBlur_542_3370\"/>\n</filter>\n<linearGradient id=\"paint0_linear_542_3370\" x1=\"20\" y1=\"0\" x2=\"20\" y2=\"40\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#0EC8A9\" style=\"stop-color:#0EC8A9;stop-color:color(display-p3 0.0565 0.7837 0.6625);stop-opacity:1;\"/>\n<stop offset=\"1\" stop-color=\"#01C886\" style=\"stop-color:#01C886;stop-color:color(display-p3 0.0021 0.7858 0.5246);stop-opacity:1;\"/>\n</linearGradient>\n<linearGradient id=\"paint1_linear_542_3370\" x1=\"14.6642\" y1=\"11.0783\" x2=\"33.3762\" y2=\"43.4885\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"white\" stop-opacity=\"0.8\" style=\"stop-color:white;stop-opacity:0.8;\"/>\n<stop offset=\"0.437689\" stop-color=\"white\" style=\"stop-color:white;stop-opacity:1;\"/>\n</linearGradient>\n<clipPath id=\"clip0_542_3370\">\n<rect width=\"40\" height=\"40\" rx=\"20\" fill=\"white\" style=\"fill:white;fill-opacity:1;\"/>\n</clipPath>\n</defs>\n</svg>";
510
+ };
511
+ readonly resume: {
512
+ readonly id: 'resume-workbuddy';
513
+ readonly product: 'WorkBuddy';
514
+ readonly description: '把一条 WorkBuddy 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
515
+ readonly recoveryBoundary: '读取器只导入受支持的 WorkBuddy transcript / 存储记录,永不回放存储的调用。';
516
+ };
517
+ }, {
518
+ readonly name: 'cursor';
519
+ readonly adapter: 'cursor';
520
+ readonly label: 'Cursor';
521
+ readonly outboundEligible: true;
522
+ readonly icon: {
523
+ readonly kind: 'mark';
524
+ readonly mark: {
525
+ readonly viewBox: '0 0 24 24';
526
+ readonly tile: '#1a1a1a';
527
+ readonly paths: readonly [{
528
+ readonly d: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23";
529
+ readonly fill: '#fff';
530
+ }];
531
+ };
532
+ };
533
+ readonly resume: {
534
+ readonly id: 'resume-cursor';
535
+ readonly product: 'Cursor';
536
+ readonly description: '把一条 Cursor 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
537
+ readonly recoveryBoundary: '读取器只导入受支持的 Cursor transcript / store 记录,永不回放存储的调用。';
538
+ };
539
+ }, {
540
+ readonly name: 'grok';
541
+ readonly adapter: 'grok';
542
+ readonly label: 'Grok CLI';
543
+ readonly outboundEligible: true;
544
+ readonly icon: {
545
+ readonly kind: 'mark';
546
+ readonly mark: {
547
+ readonly viewBox: '0 0 256 246';
548
+ readonly tile: '#111111';
549
+ readonly paths: readonly [{
550
+ readonly d: "M63.8307299,56.8426545 C91.2989169,29.362978 131.465298,21.9776085 165.542128,34.9726459 L167.855892,35.8902557 C175.501463,38.7335174 182.164746,42.7796414 187.363427,46.5414469 L158.506099,59.882758 C131.637157,48.5973415 100.857492,56.2740175 82.0711204,75.0832754 C56.6656274,100.496833 51.5320736,144.566967 81.3069473,173.04336 L-1.42108547e-14,245.764227 C4.29613789,239.840925 9.45698399,234.190695 14.7493257,228.586421 L20.5645541,222.456072 L23.1726477,219.681571 C38.703877,203.027306 51.983468,185.912092 43.6693415,162.973056 L42.9033683,160.992465 C28.3109637,125.495663 36.8086459,83.896995 63.8307299,56.8426545 Z M220.785826,35.2560304 L256,0 L245.871984,14.068605 C224.778304,43.78544 215.415895,62.4930162 224.761831,102.727911 L224.69655,102.66263 C231.927394,133.390838 224.194269,167.466048 199.225391,192.464878 C167.746834,224.002573 117.372848,231.022982 75.8893821,202.634909 L104.811992,189.227703 C131.287711,199.638122 160.254097,195.066907 181.071863,174.224565 C201.890397,153.381454 206.565294,123.024196 196.101882,97.7634735 C194.113496,92.9733751 188.149873,91.7706665 183.977257,94.8542395 L98.8698734,157.755289 L220.785826,35.1466653 L220.785826,35.2560304 Z";
551
+ readonly fill: '#fff';
552
+ }];
553
+ };
554
+ };
555
+ readonly resume: {
556
+ readonly id: 'resume-grok';
557
+ readonly product: 'Grok';
558
+ readonly description: '把一条 Grok 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、会话目录、记录路径或标题关键词。';
559
+ readonly recoveryBoundary: '读取器只用 Grok 可见的 updates.jsonl 流,永不读 chat_history.jsonl 原始模型上下文。';
560
+ };
561
+ }, {
562
+ readonly name: 'gemini';
563
+ readonly adapter: 'gemini';
564
+ readonly label: 'Gemini CLI';
565
+ readonly outboundEligible: false;
566
+ readonly icon: {
567
+ readonly kind: 'none';
568
+ };
569
+ readonly resume: {
570
+ readonly id: 'resume-gemini';
571
+ readonly product: 'Gemini CLI';
572
+ readonly description: '把一条 Gemini CLI 会话拉进当前会话,生成六段交接卡接手工作;本地记录是新旧双格式 JSONL/JSON,子代理会话单独存盘,可附会话 id(记录路径)、记录路径或标题关键词。';
573
+ readonly recoveryBoundary: '读取器只读 Gemini CLI 本地 chats/ 下的会话文件(JSONL 新格式 / 整块 JSON 旧格式,含子代理会话目录);info/error/warning CLI 提示与斜杠命令行不进对话流;只读不写、不复活 Gemini CLI 进程。';
574
+ };
575
+ }];
576
+ /** 九家 provider 名的字面量并集类型(注册表声明序) */
577
+ type ProviderName = (typeof PROVIDERS)[number]['name'];
578
+ //#endregion
238
579
  //#region src/foreign.d.ts
239
- /** 面向用户的九家提供方名 → readers 适配器名(claude 是 claude-code 的别名) */
240
- export declare const FOREIGN_PROVIDERS: readonly ['claude', 'codex', 'opencode', 'zcode', 'pi', 'workbuddy', 'cursor', 'grok', 'gemini'];
241
- type ForeignProvider = (typeof FOREIGN_PROVIDERS)[number];
242
- /** 面向用户的 provider 名 → readers 适配器名(设置卡支持矩阵同用) */
580
+ /** 面向用户的九家提供方名(providers.ts 注册表派生,顺序即注册表声明序) */
581
+ export declare const FOREIGN_PROVIDERS: readonly ForeignProvider[];
582
+ type ForeignProvider = ProviderName;
583
+ /** 面向用户的 provider 名 → readers 适配器名(注册表派生;claude 是 claude-code 的别名,设置卡支持矩阵同用) */
243
584
  export declare const PROVIDER_TO_ADAPTER: Record<ForeignProvider, string>;
244
585
  /** 引用解析结果(与 readers ResolveResult 同构,解耦后单测可手写) */
245
586
  type ForeignResolve = {
@@ -425,6 +766,165 @@ export declare function renderForeign(_args: unknown, value: unknown): Array<{
425
766
  /** 注册 foreign_session_read 工具;env.isEnabled 缺省则不闸(纯库用法) */
426
767
  export declare function registerForeignTool(ctx: Context, env?: ForeignEnv): void;
427
768
  //#endregion
769
+ //#region src/sync.d.ts
770
+ interface SyncConfig {
771
+ enabled: boolean;
772
+ /** 用户配置的 git 仓库地址(https / ssh / git@host:path / 本地路径),永不存凭据 */
773
+ remote: string;
774
+ }
775
+ /** sync.json 路径(HANDOFF_HOME 内,随同步分发——B 机启用时可直接采纳同地址) */
776
+ export declare function syncConfigPath(dir?: string): string;
777
+ /** 读同步配置:文件缺失/损坏 fail-open 回未启用(同 loadSwitches 纪律),损坏必 console.warn */
778
+ export declare function loadSyncConfig(dir?: string): SyncConfig;
779
+ /** 写同步配置:tmp + rename 原子替换(saveSwitches 同模板);写入前校验地址 */
780
+ export declare function saveSyncConfig(cfg: SyncConfig, dir?: string): void;
781
+ /**
782
+ * 仓库地址校验:拒绝 userinfo 形态(`user:pass@`)——secretscan 对 URL 内嵌凭据
783
+ * 零覆盖,插件也永不存储凭据,凭据交给系统 git credential helper / ssh agent。
784
+ * 允许:https://、ssh://、git://、file://、git@host:path(scp 形态)、本地路径。
785
+ * 返回 trim 后的地址;不合法抛中文错。
786
+ */
787
+ export declare function validateRemoteUrl(url: string): string;
788
+ /** 红折展示:userinfo 段打码(防御性——保存时已拒绝,展示仍再折一次) */
789
+ export declare function redactRemote(url: string): string;
790
+ interface SyncOutcome {
791
+ ok: boolean;
792
+ action: string;
793
+ /** 动作后状态摘要(供面板/工具直显) */
794
+ detail?: string;
795
+ ahead?: number;
796
+ behind?: number;
797
+ error?: string;
798
+ }
799
+ /** 启用同步:init/收编 + remote + 本地先提交 + 远端非空先合并再推(远端空仓直接首推) */
800
+ export declare function syncSetup(url: string, dir?: string, opts?: {
801
+ timeoutMs?: number;
802
+ }): Promise<SyncOutcome>;
803
+ /** pull:本地先提交 → fetch → 合并(冲突 abort 诚实报错) */
804
+ export declare function syncPull(dir?: string, opts?: {
805
+ timeoutMs?: number;
806
+ }): Promise<SyncOutcome>;
807
+ /** push:本地提交 + 推送 */
808
+ export declare function syncPush(dir?: string, opts?: {
809
+ timeoutMs?: number;
810
+ }): Promise<SyncOutcome>;
811
+ /** 立即同步 = pull(拿别人的)→ push(给别人的),一步到位 */
812
+ export declare function syncNow(dir?: string, opts?: {
813
+ timeoutMs?: number;
814
+ }): Promise<SyncOutcome>;
815
+ /** 同步状态(type 别名:客户端与工具面都要把它当 JSON 值传递,interface 缺隐式索引签名会挂 defineTool) */
816
+ type SyncStatus = {
817
+ enabled: true;
818
+ /** 红折后的仓库地址 */
819
+ remote: string;
820
+ /** 待推提交数(上次同步记录) */
821
+ ahead: number;
822
+ /** 待拉提交数(上次同步记录) */
823
+ behind: number;
824
+ lastSyncAt?: string;
825
+ lastError?: string;
826
+ /** 同步范围内本地未提交文件数(现算,git status,零网络) */
827
+ dirtyFiles: number;
828
+ /** home 是否已是仓库(未 init 前无从谈脏计数) */
829
+ repoReady: boolean;
830
+ };
831
+ /** 组装同步状态(buildState 调用;未启用 → undefined,客户端整个块不渲染) */
832
+ export declare function syncStatusOf(dir?: string): SyncStatus | undefined;
833
+ //#endregion
834
+ //#region src/envbackup.d.ts
835
+ /** 相对路径合法性:正斜杠、无 .. 段、非绝对、无盘符(恢复路径的穿越硬闸) */
836
+ export declare function validateRelPath(p: string): string;
837
+ interface ScopeFile {
838
+ path: string;
839
+ category: string;
840
+ secret: boolean;
841
+ bytes: number;
842
+ }
843
+ /** 收集备份清单:scope 命中且磁盘上真实存在的文件(缺失容错——没有就跳过,不算错) */
844
+ export declare function collectScopeFiles(root?: string): ScopeFile[];
845
+ export declare function envBackupDir(dir?: string): string;
846
+ /** type 别名:工具/客户端 JSON 值面需要隐式索引签名(interface 会挂 defineTool) */
847
+ type BackupRow = {
848
+ file: string;
849
+ bytes: number;
850
+ /** 文件名内嵌的时间戳(yyyyMMdd-HHMM) */
851
+ at: string;
852
+ };
853
+ /** 列备份文件(只读目录,不解密) */
854
+ export declare function listBackups(dir?: string): BackupRow[];
855
+ /** 备份清单行(容器 manifest 的对外形态;配置轴出卡 / dry diff 共用) */
856
+ type ManifestFileRow = {
857
+ path: string;
858
+ bytes: number;
859
+ sha256: string;
860
+ category: string;
861
+ };
862
+ interface BackupManifestRead {
863
+ ok: true;
864
+ /** 备份文件名(.dshenv) */
865
+ file: string;
866
+ /** 密文包本体字节数(卡上「指针」的 bytes 口径) */
867
+ bytes: number;
868
+ createdAt: string;
869
+ host: string;
870
+ secretCount: number;
871
+ secretHits: number;
872
+ /** 清单行(path/bytes/sha256/category,容器内解密所得) */
873
+ files: ManifestFileRow[];
874
+ }
875
+ /**
876
+ * 读一份备份的加密清单:口令解密容器取 manifest,**不触碰任何 blob 内容**——
877
+ * 配置轴出卡(handoff_env action=card / pushConfigCard)只把清单+指针写上卡,
878
+ * 密文 blob 原样留在 env-backup/。错口令 = GCM 认证失败诚实报错(同解包口径)。
879
+ */
880
+ export declare function readBackupManifest(file: string, passphrase: string, dir?: string): BackupManifestRead;
881
+ interface BackupResult {
882
+ ok: true;
883
+ file: string;
884
+ bytes: number;
885
+ files: number;
886
+ secretCount: number;
887
+ secretHits: number;
888
+ detail: string;
889
+ }
890
+ /** 立即备份:收集 → 加密 → 落 env-backup/ → 修剪留 3 */
891
+ export declare function createBackup(passphrase: string, dir?: string, root?: string): BackupResult;
892
+ type RestoreDiffRow = {
893
+ path: string;
894
+ action: 'create' | 'overwrite' | 'same';
895
+ category: string;
896
+ diskBytes?: number;
897
+ packBytes: number;
898
+ };
899
+ interface DryRunResult {
900
+ ok: true;
901
+ file: string;
902
+ createdAt: string;
903
+ host: string;
904
+ secretCount: number;
905
+ diff: RestoreDiffRow[];
906
+ creates: number;
907
+ overwrites: number;
908
+ same: number;
909
+ }
910
+ /** 还原预演:解密 + 与磁盘逐文件比对(三态:新建/覆盖/相同)——不写任何盘 */
911
+ export declare function dryRunRestore(file: string, passphrase: string, dir?: string, root?: string): DryRunResult;
912
+ interface ApplyResult {
913
+ ok: true;
914
+ file: string;
915
+ applied: number;
916
+ checkpointDir: string;
917
+ detail: string;
918
+ }
919
+ /** 确认还原:checkpoint 被覆盖原物 → 逐文件 tmp+rename 落盘 → 报告 */
920
+ export declare function applyRestore(file: string, passphrase: string, dir?: string, root?: string): ApplyResult;
921
+ /** 回滚:把 checkpoint 里的原物写回去 */
922
+ export declare function rollbackRestore(checkpointDir: string, dir?: string, root?: string): {
923
+ ok: true;
924
+ restored: number;
925
+ detail: string;
926
+ };
927
+ //#endregion
428
928
  //#region src/settings.d.ts
429
929
  /** 开关文件形态:只记停用名单(默认全开,未知条目载入时丢弃) */
430
930
  interface TakeoverSwitches {
@@ -507,6 +1007,13 @@ interface TakeoverState {
507
1007
  }>;
508
1008
  persistedTotal: number;
509
1009
  };
1010
+ /** 0.2.0 换机同步状态(零网络:sync.json + sync-state.json + 本地脏计数)。
1011
+ * 未启用时缺省——客户端整个换机块不渲染。 */
1012
+ syncStatus?: SyncStatus;
1013
+ /** 0.2.0 环境备份清单(env-backup/ 目录只读枚举,不解密);无备份缺省 */
1014
+ envBackup?: {
1015
+ backups: BackupRow[];
1016
+ };
510
1017
  }
511
1018
  /**
512
1019
  * 组装设置卡状态(纯函数核心,读取层与目录都可注入):
@@ -527,20 +1034,17 @@ export declare function dismissPending(id: string, dir?: string): {
527
1034
  };
528
1035
  //#endregion
529
1036
  //#region src/browser-view.d.ts
530
- /**
531
- * 外部会话浏览器的纯函数层(client 面板与服务端共享语义,零 DOM / 零 cordis 依赖):
532
- * - 会话行的即时过滤(标题 / 目录 / id 子串,大小写不敏感);
533
- * - 相对时间(行内扫读友好:刚刚 / N分钟前 / …;超 30 天回退绝对日期);
534
- * - 接管 / 寄存指令生成——/resume-* 的引用解析在首个换行前截断(skills/resume 同轮修订),
535
- * 所以寄存指令是「引用行 + 指示行」两行式:一行塞尾巴会把尾巴吞进引用导致解析失败。
536
- * 不碰会话内容本体——浏览是只读的,接管与蒸馏都在会话里由模型完成。
537
- * @module dsh-takeover/browser-view
538
- */
539
1037
  type Lang = 'zh' | 'en';
540
- /** 交接出去的接收方(any = 不指定,任何 agent 可取) */
541
- export declare const OUTBOUND_TARGETS: readonly ['any', 'claude', 'codex', 'opencode', 'zcode', 'pi', 'workbuddy', 'cursor', 'grok'];
542
- type OutboundTarget = (typeof OUTBOUND_TARGETS)[number];
543
- /** 接收方展示名(与 PROVIDER_LABEL 同风格;any 是协议词不是 provider) */
1038
+ /** 交接出去的接收方(any = 不指定,任何 agent 可取)——providers.ts 注册表派生:
1039
+ * outboundEligible 的 provider 依声明序排在 any 之后。交接目标与读取器两轴独立
1040
+ * (gemini 是读取器但不进交接目标,注册表显式声明)。 */
1041
+ export declare const OUTBOUND_TARGETS: readonly OutboundTarget[];
1042
+ /** 交接轴的 provider 名并集(类型级过滤:仅 outboundEligible=true 的字面量名) */
1043
+ type OutboundEligibleName = Extract<(typeof PROVIDERS)[number], {
1044
+ readonly outboundEligible: true;
1045
+ }>['name'];
1046
+ type OutboundTarget = 'any' | OutboundEligibleName;
1047
+ /** 接收方展示名(注册表 label 派生,与 PROVIDER_LABEL 同源;any 是协议词不是 provider) */
544
1048
  export declare const OUTBOUND_LABELS: Record<OutboundTarget, {
545
1049
  zh: string;
546
1050
  en: string;
@@ -646,7 +1150,8 @@ interface MemorySourceDef {
646
1150
  * 只列有公开文档惯例的路径;没列入的家不是不支持,是路径无公开惯例。
647
1151
  * hippo-db 特殊行:dsh-hippo(伴侣智能体长期记忆插件)的记忆库——v0.1.9 起是
648
1152
  * <数据目录>/memories/ 的 zvec 原生目录(proxima 向量索引 + rocksdb FTS),二进制
649
- * 不随卡直带,存在性照报(UI 提示装了记忆库),出卡时正文替换为 export/import 指引。 */
1153
+ * 不随卡直带,存在性照报(UI 提示装了记忆库);出卡正文走 MEMORY_STORES 通用
1154
+ * 掏取契约(条目 JSONL 在场掏条目、缺席退回指引),这里只管「探测到没有」。 */
650
1155
  export declare const MEMORY_SOURCES: readonly MemorySourceDef[];
651
1156
  /** 扫描结果行 */
652
1157
  interface MemorySourceRow {
@@ -661,6 +1166,49 @@ interface MemorySourceRow {
661
1166
  preview: string;
662
1167
  [k: string]: string | number | boolean;
663
1168
  }
1169
+ /**
1170
+ * 记忆库 store 注册表项:二进制/引擎型记忆库的通用掏取契约。
1171
+ * 这类库的本体不是可读文件(zvec 目录 / sqlite 等),扫描只能报存在性;
1172
+ * 内容能不能随卡走,取决于该库有没有「条目 JSONL」导出落在约定路径上:
1173
+ * - entriesFile 在场:实际读条目(每行 {text, tags?})进「建议加载」段(64KB 截断口径内);
1174
+ * - entriesFile 不在场:退回 guidance 指引文案(告诉双方怎么补齐 JSONL 快照)。
1175
+ * entriesFile 是 (row) => 路径 的解析函数而非静态字符串:导出约定路径往往锚在
1176
+ * 该库的数据目录上,而数据目录是动态的(env / data-dir.txt / 回退根,hippoDataDir
1177
+ * 同款三级解析)——扫描行 row.path 已带解析好的基座,从它推约定路径即可,测试注入
1178
+ * 假 row 也天然可注入(假 entriesFile 指临时文件即得两态)。
1179
+ */
1180
+ interface MemoryStoreDef {
1181
+ /** 稳定键(与 MEMORY_SOURCES 的 key 对应,fileBody 按它查表) */
1182
+ id: string;
1183
+ /** 展示名 */
1184
+ label: string;
1185
+ /** 条目 JSONL 约定路径(每行 {text, tags?});undefined = 无掏取通路,恒走指引 */
1186
+ entriesFile?: (row: MemorySourceRow) => string;
1187
+ /** 条目 JSONL 不在场时的退回指引文案(export/import 通路说明) */
1188
+ guidance: string;
1189
+ }
1190
+ /**
1191
+ * 条目 JSONL 约定:每行一个 JSON 对象 {text, tags?}——与 `hippo export -f jsonl`
1192
+ * 的行形态兼容(多余字段忽略),其他记忆库照此约定产出即可获得同款掏取通路。
1193
+ */
1194
+ interface MemoryStoreEntry {
1195
+ text: string;
1196
+ tags?: string[];
1197
+ }
1198
+ /** 记忆库 store 注册表(hippo 在册——不再是代码特例;新库 = 在这里加一项) */
1199
+ export declare const MEMORY_STORES: readonly MemoryStoreDef[];
1200
+ /** 条目 JSONL 读取结果:entries 为解析出的有效条目(坏行/缺 text 跳过) */
1201
+ interface StoreEntriesRead {
1202
+ entries: MemoryStoreEntry[];
1203
+ /** 原始文件字符数(超 FILE_BODY_MAX 时渲染侧截断并注明) */
1204
+ rawChars: number;
1205
+ }
1206
+ /**
1207
+ * 读一份条目 JSONL(纯读;64KB 截断口径由渲染侧执行,这里只解析):
1208
+ * 每行一个 JSON 对象取 text 与 tags(非字符串 tags 项丢弃),坏行/空行/缺 text 行跳过。
1209
+ * 文件不在场 / 读失败 / 零有效条目 → undefined(调用方退回指引文案)。
1210
+ */
1211
+ export declare function readStoreEntries(file: string): StoreEntriesRead | undefined;
664
1212
  /** 扫描已知记忆文件(纯读;deps.home/cwd 可注入,缺省真实 home / 无项目级) */
665
1213
  export declare function scanMemorySources(deps?: {
666
1214
  home?: string;
@@ -714,65 +1262,11 @@ interface ResumeSkillSpec {
714
1262
  /** 各家恢复边界文案(读取器排除什么、永不做什么) */
715
1263
  readonly recoveryBoundary: string;
716
1264
  }
717
- /** 九家注册规格:单一出处,content 由模板函数生成 */
718
- export declare const RESUME_SKILL_SPECS: readonly [{
719
- readonly name: 'resume-claude';
720
- readonly provider: 'claude';
721
- readonly product: 'Claude Code';
722
- readonly description: '把一条 Claude Code 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
723
- readonly recoveryBoundary: '读取器全量读取本地记录(含被替换/放弃分支的条目,thinking 块以 [thinking] 标记保留);不复活 CLI、不回放工具调用。';
724
- }, {
725
- readonly name: 'resume-codex';
726
- readonly provider: 'codex';
727
- readonly product: 'Codex';
728
- readonly description: '把一条 Codex 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
729
- readonly recoveryBoundary: '读取器排除 Codex 的 system / developer / reasoning / world-state / 跨 agent 记录。';
730
- }, {
731
- readonly name: 'resume-opencode';
732
- readonly provider: 'opencode';
733
- readonly product: 'OpenCode';
734
- readonly description: '把一条 OpenCode 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id 或标题关键词。';
735
- readonly recoveryBoundary: '读取器只读 OpenCode 本地存储的会话记录;不复活进程、不回放存储的调用。';
736
- }, {
737
- readonly name: 'resume-zcode';
738
- readonly provider: 'zcode';
739
- readonly product: 'ZCode';
740
- readonly description: '把一条 ZCode 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id(支持短前缀)或标题关键词。';
741
- readonly recoveryBoundary: '读取器只读 ZCode 的 sqlite 库(readonly、随开随关,需 Node ≥22);不回放调用、不复活 CLI;压缩段只是摘要标记,仍在库里的旧行保留。';
742
- }, {
743
- readonly name: 'resume-pi';
744
- readonly provider: 'pi';
745
- readonly product: 'Pi';
746
- readonly description: '把一条 Pi 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、JSONL 路径或标题关键词。';
747
- readonly recoveryBoundary: '读取器只沿 Pi 当前活跃叶子读取,排除 thinking、hooks、system 消息与扩展注入的记录。';
748
- }, {
749
- readonly name: 'resume-workbuddy';
750
- readonly provider: 'workbuddy';
751
- readonly product: 'WorkBuddy';
752
- readonly description: '把一条 WorkBuddy 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
753
- readonly recoveryBoundary: '读取器只导入受支持的 WorkBuddy transcript / 存储记录,永不回放存储的调用。';
754
- }, {
755
- readonly name: 'resume-cursor';
756
- readonly provider: 'cursor';
757
- readonly product: 'Cursor';
758
- readonly description: '把一条 Cursor 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、记录路径或标题关键词。';
759
- readonly recoveryBoundary: '读取器只导入受支持的 Cursor transcript / store 记录,永不回放存储的调用。';
760
- }, {
761
- readonly name: 'resume-grok';
762
- readonly provider: 'grok';
763
- readonly product: 'Grok';
764
- readonly description: '把一条 Grok 会话拉进当前会话,生成六段交接卡接手工作;可附会话 id、会话目录、记录路径或标题关键词。';
765
- readonly recoveryBoundary: '读取器只用 Grok 可见的 updates.jsonl 流,永不读 chat_history.jsonl 原始模型上下文。';
766
- }, {
767
- readonly name: 'resume-gemini';
768
- readonly provider: 'gemini';
769
- readonly product: 'Gemini CLI';
770
- readonly description: '把一条 Gemini CLI 会话拉进当前会话,生成六段交接卡接手工作;本地记录是新旧双格式 JSONL/JSON,子代理会话单独存盘,可附会话 id(记录路径)、记录路径或标题关键词。';
771
- readonly recoveryBoundary: '读取器只读 Gemini CLI 本地 chats/ 下的会话文件(JSONL 新格式 / 整块 JSON 旧格式,含子代理会话目录);info/error/warning CLI 提示与斜杠命令行不进对话流;只读不写、不复活 Gemini CLI 进程。';
772
- }];
1265
+ /** 九家注册规格:providers.ts 注册表 × 本文件模板函数生成(顺序即注册表声明序) */
1266
+ export declare const RESUME_SKILL_SPECS: readonly ResumeSkillSpec[];
773
1267
  /** 单条 skill 内容模板:九条共用一个模板函数 */
774
1268
  export declare function resumeSkillContent(spec: ResumeSkillSpec): string;
775
- /** 九条注册项(数组驱动,与 RESUME_SKILL_SPECS 一一对应) */
1269
+ /** 九条注册项(注册表驱动,与 RESUME_SKILL_SPECS 一一对应) */
776
1270
  export declare function resumeSkillRegistrations(): SkillRegistration[];
777
1271
  //#endregion
778
1272
  //#region skills/index.d.ts
@@ -784,5 +1278,5 @@ export declare const name = "dsh-takeover";
784
1278
  export declare const inject: string[];
785
1279
  export declare function apply(ctx: Context): void;
786
1280
  //#endregion
787
- export type { ForeignCandidate, ForeignEnv, ForeignListResult, ForeignListRow, ForeignPreviewResult, ForeignProvider, ForeignReadArgs, ForeignReadResult, ForeignReaders, ForeignResolve, ForeignSkeleton, ForeignSummary, ForeignTurn, InboxItem, InboxListResult, InboxLoadResult, MemoryPushArgs, MemoryPushResult, MemorySourceDef, MemorySourceRow, OutboundTarget, PendingRow, ProbeResult, ProviderRow, PushArgs, PushResult, ResumeSkillSpec, SessionControllerLike, SessionFacts, TakeoverMode, TakeoverOutcome, TakeoverState, TakeoverSwitches };
1281
+ export type { ApplyResult, BackupManifestRead, BackupResult, BackupRow, CardAxis, CardPayload, ConfigCardPayload, ConfigCardResult, DryRunResult, ForeignCandidate, ForeignEnv, ForeignListResult, ForeignListRow, ForeignPreviewResult, ForeignProvider, ForeignReadArgs, ForeignReadResult, ForeignReaders, ForeignResolve, ForeignSkeleton, ForeignSummary, ForeignTurn, HistoryItem, InboxHistoryResult, InboxItem, InboxListResult, InboxLoadResult, ManifestFileRow, MemoryPushArgs, MemoryPushResult, MemorySourceDef, MemorySourceRow, MemoryStoreDef, MemoryStoreEntry, OutboundTarget, PendingRow, ProbeResult, ProviderRow, PushArgs, PushResult, RepoBaseline, RestoreDiffRow, ResumeSkillSpec, ScopeFile, SessionControllerLike, SessionFacts, StoreEntriesRead, SyncConfig, SyncOutcome, SyncStatus, TakeoverMode, TakeoverOutcome, TakeoverState, TakeoverSwitches };
788
1282
  //# sourceMappingURL=index.d.ts.map