@clawos-dev/clawd 0.2.372 → 0.2.374
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/dist/persona-defaults/persona-clawd-butler/.claude/skills/clawd-session-import/SKILL.md
CHANGED
|
@@ -49,6 +49,10 @@ node .claude/skills/clawd-session-import/scripts/link-sessions.mjs --undo
|
|
|
49
49
|
node .claude/skills/clawd-session-import/scripts/link-sessions.mjs --undo --apply # 真删
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
台账里 session 已被手动删除的条目,`--undo` 只清账、不再调删除接口 —— 清掉后该会话
|
|
53
|
+
才能重新出现在「关联外部 session」的候选里(扫盘去重会读这本台账,见
|
|
54
|
+
`superpowers/specs/2026-08-19-external-scan-entrypoint-design.md` §4)。
|
|
55
|
+
|
|
52
56
|
## 原理
|
|
53
57
|
|
|
54
58
|
一条 clawd 会话的元数据里有 `cwd` + `toolSessionId` 两个字段,指向底层工具那条真实
|
|
@@ -485,9 +485,15 @@ async function doUndo(applyIt) {
|
|
|
485
485
|
const res = await rpc('session:list', { limit: 100000 })
|
|
486
486
|
const alive = new Set((res.sessions || []).map((s) => s.sessionId))
|
|
487
487
|
const todo = entries.filter((e) => alive.has(e.sessionId))
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
// 台账里 session 已经不在了(多半是用户直接在 clawd UI 里删的):没什么可删,只需
|
|
489
|
+
// 把账清掉。扫盘去重会读这本台账(spec 2026-08-19 §4),条目留着就等于该会话永久
|
|
490
|
+
// 无法重新导入,而 undo 的语义本就是「撤销我的导入记录」。
|
|
491
|
+
const stale = entries.filter((e) => !alive.has(e.sessionId))
|
|
492
|
+
console.log(`台账 ${entries.length} 条,其中 ${todo.length} 条还在` +
|
|
493
|
+
(stale.length ? `,${stale.length} 条已不存在(只清账)` : '') + '。' +
|
|
494
|
+
(applyIt ? '正在处理……' : '(预演;加 --apply 才真删)'))
|
|
495
|
+
for (const e of todo) console.log(` 删 ${e.sessionId} ${e.label || ''}`)
|
|
496
|
+
for (const e of stale) console.log(` 清账 ${e.sessionId} ${e.label || ''}`)
|
|
491
497
|
if (!applyIt) return
|
|
492
498
|
let removed = 0
|
|
493
499
|
const failed = new Set()
|
|
@@ -500,9 +506,13 @@ async function doUndo(applyIt) {
|
|
|
500
506
|
console.error(` 删 ${e.sessionId} 失败:${err.message}`)
|
|
501
507
|
}
|
|
502
508
|
}
|
|
503
|
-
|
|
509
|
+
// 清账范围 = 删成功的 + 本就不存在的;删失败的留在账上,下次 undo 还能重试
|
|
510
|
+
const doneIds = new Set([
|
|
511
|
+
...todo.map((t) => t.sessionId).filter((id) => !failed.has(id)),
|
|
512
|
+
...stale.map((s) => s.sessionId),
|
|
513
|
+
])
|
|
504
514
|
ledgerWrite(entries.filter((e) => !doneIds.has(e.sessionId)))
|
|
505
|
-
console.log(`已删除 ${removed} 条。原 Claude Code / Codex 的会话文件没有任何改动。`)
|
|
515
|
+
console.log(`已删除 ${removed} 条,清账 ${doneIds.size} 条。原 Claude Code / Codex 的会话文件没有任何改动。`)
|
|
506
516
|
}
|
|
507
517
|
|
|
508
518
|
// ---------------------------------------------------------------- 参数
|