memory-eternal 0.22.0 → 0.23.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.md +28 -1
- package/README.zh-CN.md +28 -1
- package/cursor-extension/package.json +1 -1
- package/dsh-tui-plugin/dsh-plugin.json +1 -1
- package/dsh-tui-plugin/package.json +1 -1
- package/index.js +78 -0
- package/lib/api.js +156 -17
- package/lib/client.js +93 -23
- package/lib/news-digest.js +109 -0
- package/lib/news-follows.js +523 -0
- package/lib/vault.js +46 -3
- package/orca-plugin/orca-plugin.json +1 -1
- package/package.json +2 -2
- package/web/app.js +98 -28
package/lib/vault.js
CHANGED
|
@@ -420,13 +420,42 @@ function moveCardBetweenStores(db, from, to, rel, { status, deletedAt = null, qu
|
|
|
420
420
|
})
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
/**
|
|
423
|
+
/**
|
|
424
|
+
* 回收站:隔离区里 status ∈ {deleted, rejected}。
|
|
425
|
+
*
|
|
426
|
+
* issue #57:过去只查 deleted,于是「审核里点驳回」的卡永远进不了回收站 —— 用户在回收站
|
|
427
|
+
* 怎么等都等不到,只能一张张去审核队列里删。驳回与删除都是「这张卡不会被召回」,
|
|
428
|
+
* 对清理者而言该出现在同一处;两者用 status 区分,恢复语义不同(见 restoreCard)。
|
|
429
|
+
* 排序用 COALESCE:驳回卡没有 deleted_at。
|
|
430
|
+
*/
|
|
424
431
|
export async function recycleList(root) {
|
|
425
432
|
const db = getDb(root)
|
|
426
|
-
const rows = db.prepare(
|
|
433
|
+
const rows = db.prepare(
|
|
434
|
+
"SELECT * FROM quarantine WHERE status IN ('deleted', 'rejected') ORDER BY COALESCE(deleted_at, updated_at) DESC"
|
|
435
|
+
).all()
|
|
427
436
|
return rows.map(rowToCard)
|
|
428
437
|
}
|
|
429
438
|
|
|
439
|
+
/**
|
|
440
|
+
* 永久清空回收站(deleted + rejected)。
|
|
441
|
+
*
|
|
442
|
+
* issue #57 的直接诉求:「清空」要能真清空,而不是只清 30 天前的。
|
|
443
|
+
* 与 purgeExpired 分开:那个是保留期策略(自动),这个是用户显式点「清空」,
|
|
444
|
+
* 语义是"把我在回收站看到的东西全删掉"。逐个走 deleteCard(permanent) 才会
|
|
445
|
+
* 连带清掉 card_updates / feedback / 修改副本关联。
|
|
446
|
+
*/
|
|
447
|
+
export async function purgeAllRecycle(root) {
|
|
448
|
+
const db = getDb(root)
|
|
449
|
+
const rows = db.prepare("SELECT path FROM quarantine WHERE status IN ('deleted', 'rejected')").all()
|
|
450
|
+
let purged = 0
|
|
451
|
+
const failed = []
|
|
452
|
+
for (const row of rows) {
|
|
453
|
+
try { await deleteCard(root, row.path, { permanent: true }); purged++ }
|
|
454
|
+
catch (e) { failed.push(row.path) }
|
|
455
|
+
}
|
|
456
|
+
return { ok: true, purged, total: rows.length, failed }
|
|
457
|
+
}
|
|
458
|
+
|
|
430
459
|
/** 清理超过 retentionDays 天的回收卡(永久删除)。 */
|
|
431
460
|
export async function purgeExpired(root, retentionDays = 30) {
|
|
432
461
|
const db = getDb(root)
|
|
@@ -525,13 +554,27 @@ export async function deleteCard(root, rel, { permanent = false } = {}) {
|
|
|
525
554
|
return { ok: true, soft: true }
|
|
526
555
|
}
|
|
527
556
|
|
|
528
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* 恢复回收站里的卡。写审计日志。
|
|
559
|
+
*
|
|
560
|
+
* 两种来源语义不同(issue #57):
|
|
561
|
+
* - 已删除(deleted):搬回主库,status=approved —— 它本来就是"删了一下",恢复即可用。
|
|
562
|
+
* - 已驳回(rejected):**只能退回审核队列(pending)**。驳回意味着"内容不该入库",
|
|
563
|
+
* 若恢复即 approved,回收站就成了绕过审核批准一条被驳回内容的旁路。
|
|
564
|
+
* 主库物理上只存 approved(见 db.js MAIN_STATUS),所以这里原地改状态、不搬表。
|
|
565
|
+
*/
|
|
529
566
|
export async function restoreCard(root, rel) {
|
|
530
567
|
const db = getDb(root)
|
|
531
568
|
const existing = db.prepare('SELECT status FROM quarantine WHERE path = ?').get(rel)
|
|
532
569
|
if (!existing) throw new Error('卡片不在回收站/隔离区: ' + rel)
|
|
533
570
|
// 修改副本不能「恢复」成一张独立卡 —— 那会跟原卡重复。它只能被批准(覆盖原卡)或删除。
|
|
534
571
|
if (getRevision(db, rel)) throw new Error('这是知识卡的修改副本:请在审核中心「批准」以覆盖原卡,或直接删除')
|
|
572
|
+
const now = new Date().toISOString()
|
|
573
|
+
if (existing.status === 'rejected') {
|
|
574
|
+
db.prepare('UPDATE quarantine SET status = ?, deleted_at = NULL, updated_at = ? WHERE path = ?').run('pending', now, rel)
|
|
575
|
+
db.prepare('INSERT INTO audit_log (card_path, old_status, new_status, changed_by, reason) VALUES (?, ?, ?, ?, ?)').run(rel, 'rejected', 'pending', 'restore', '驳回卡退回审核队列')
|
|
576
|
+
return { ok: true, restored: true, status: 'pending' }
|
|
577
|
+
}
|
|
535
578
|
const r = moveCardBetweenStores(db, 'quarantine', 'cards', rel, { status: MAIN_STATUS, deletedAt: null })
|
|
536
579
|
db.prepare('INSERT INTO audit_log (card_path, old_status, new_status, changed_by, reason) VALUES (?, ?, ?, ?, ?)').run(rel, existing.status, MAIN_STATUS, 'restore', '回收站恢复')
|
|
537
580
|
return { ok: true, restored: true, ...r }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"id": "memory-eternal",
|
|
4
4
|
"publisher": "eternalnight996",
|
|
5
5
|
"name": "memory-eternal",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.23.0",
|
|
7
7
|
"description": "Memory Atlas for Orca: open the local memory vault, pending review and knowledge graph from a sandboxed Orca panel.",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "EternalNight996",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memory-eternal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "记忆核心(Memory Eternal):自研的 DeepSeek Harness 记忆插件,不移植任何既有记忆框架——对话结束后自动沉淀知识卡到本地 Markdown Vault(自研去重、自研 CJK 检索、可 git 管理),设置页提供图形化知识库(统计 / 搜索 / 知识图谱 + 侧边栏一键弹窗),Agent 通过 memory_recall 工具按需召回历史上下文。零人工干预。",
|
|
5
5
|
"icon": "assets/icon.png",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"release": "node scripts/release.mjs",
|
|
71
71
|
"release:dry": "node scripts/release.mjs --dry-run",
|
|
72
72
|
"panel-check": "node scripts/panel-check.mjs",
|
|
73
|
-
"test": "node build.mjs && node tests/vault.test.mjs && node tests/capture.test.mjs && node tests/capture-route.test.mjs && node tests/stall.test.mjs && node tests/vault-path.test.mjs && node tests/vault-resolve.test.mjs && node tests/minhash.test.mjs && node tests/settings-save.test.mjs && node tests/config-coverage.test.mjs && node tests/config-sync.test.mjs && node tests/config-merge.test.mjs && node tests/sse.test.mjs && node tests/api.test.mjs && node tests/import-roundtrip.test.mjs && node tests/graph-perf.test.mjs && node tests/graph-force.test.mjs && node tests/settings-compat.test.mjs && node tests/node-bin.test.mjs && node tests/watchdog-lock.test.mjs && node tests/markdown.test.mjs && node tests/feedback.test.mjs && node tests/graph-lod.test.mjs && node tests/graph-warmup.test.mjs && node tests/loading-hints.test.mjs && node tests/web-entry.test.mjs && node tests/tui-scroll.test.mjs && node tests/tui-audit-scene.test.mjs && node tests/tui-plugin-boot.test.mjs && node tests/capture-session-id.test.mjs && node tests/ssr.test.mjs && node tests/window-controls.test.mjs && node tests/web-assets.test.mjs && node tests/manifests.test.mjs && node tests/two-store.test.mjs && node tests/noise-gate.test.mjs && node tests/e2e-recall.test.mjs && node tests/issue-fixes.test.mjs && node tests/issue-fixes-2.test.mjs && node tests/issue-fixes-3.test.mjs && node tests/watchdog-orphans.test.mjs && node tests/watchdog-restart.test.mjs && node tests/readme-i18n.test.mjs && node tests/issue-fixes-4.test.mjs && node tests/host-drain.test.mjs && node tests/e2e-host-drain.mjs && node tests/issue-fixes-5.test.mjs && node tests/issue-fixes-6.test.mjs && node tests/capture-json-repair.test.mjs && node tests/csrf-origin.test.mjs && node tests/watchdog-orphan-web.test.mjs && node tests/config-validate.test.mjs && node tests/issue-fixes-8.test.mjs && node tests/issue-fixes-9.test.mjs && node tests/release-verify.test.mjs && node tests/refine.test.mjs && node tests/db-restore.test.mjs && node tests/align.test.mjs && node tests/tags-normalize.test.mjs && node tests/resident-state.test.mjs && node tests/llm-route.test.mjs && node tests/host-managed.test.mjs && node tests/replace-claim.test.mjs && node tests/version-check-self.test.mjs && node tests/setup-codex.test.mjs && node tests/listener-netstat.test.mjs && node tests/issue-46-overlay.test.mjs && node tests/graph-initial-zoom.test.mjs && node tests/card-head-actions.test.mjs && node tests/card-reader-ux.test.mjs && node tests/tag-filter.test.mjs && node tests/ui-overflow.test.mjs && node tests/version-card-state.test.mjs && node tests/llm-routes-proxy.test.mjs && node tests/model-strikes.test.mjs && node tests/support-bundle.test.mjs && node tests/health-panel.test.mjs && node tests/issue-48-timeout.test.mjs && node tests/setup-node-path.test.mjs && node tests/capture-kind.test.mjs && node tests/core-memory.test.mjs && node tests/skill-cards.test.mjs && node tests/audit-search.test.mjs && node tests/news.test.mjs && node tests/news-feed.test.mjs && node tests/ledger.test.mjs && node tests/issue-55-timezone.test.mjs"
|
|
73
|
+
"test": "node build.mjs && node tests/vault.test.mjs && node tests/capture.test.mjs && node tests/capture-route.test.mjs && node tests/stall.test.mjs && node tests/vault-path.test.mjs && node tests/vault-resolve.test.mjs && node tests/minhash.test.mjs && node tests/settings-save.test.mjs && node tests/config-coverage.test.mjs && node tests/config-sync.test.mjs && node tests/config-merge.test.mjs && node tests/sse.test.mjs && node tests/api.test.mjs && node tests/import-roundtrip.test.mjs && node tests/graph-perf.test.mjs && node tests/graph-force.test.mjs && node tests/settings-compat.test.mjs && node tests/node-bin.test.mjs && node tests/watchdog-lock.test.mjs && node tests/markdown.test.mjs && node tests/feedback.test.mjs && node tests/graph-lod.test.mjs && node tests/graph-warmup.test.mjs && node tests/loading-hints.test.mjs && node tests/web-entry.test.mjs && node tests/tui-scroll.test.mjs && node tests/tui-audit-scene.test.mjs && node tests/tui-plugin-boot.test.mjs && node tests/capture-session-id.test.mjs && node tests/ssr.test.mjs && node tests/window-controls.test.mjs && node tests/web-assets.test.mjs && node tests/manifests.test.mjs && node tests/two-store.test.mjs && node tests/noise-gate.test.mjs && node tests/e2e-recall.test.mjs && node tests/issue-fixes.test.mjs && node tests/issue-fixes-2.test.mjs && node tests/issue-fixes-3.test.mjs && node tests/watchdog-orphans.test.mjs && node tests/watchdog-restart.test.mjs && node tests/readme-i18n.test.mjs && node tests/issue-fixes-4.test.mjs && node tests/host-drain.test.mjs && node tests/e2e-host-drain.mjs && node tests/issue-fixes-5.test.mjs && node tests/issue-fixes-6.test.mjs && node tests/capture-json-repair.test.mjs && node tests/csrf-origin.test.mjs && node tests/watchdog-orphan-web.test.mjs && node tests/config-validate.test.mjs && node tests/issue-fixes-8.test.mjs && node tests/issue-fixes-9.test.mjs && node tests/release-verify.test.mjs && node tests/refine.test.mjs && node tests/db-restore.test.mjs && node tests/align.test.mjs && node tests/tags-normalize.test.mjs && node tests/resident-state.test.mjs && node tests/llm-route.test.mjs && node tests/host-managed.test.mjs && node tests/replace-claim.test.mjs && node tests/version-check-self.test.mjs && node tests/setup-codex.test.mjs && node tests/listener-netstat.test.mjs && node tests/issue-46-overlay.test.mjs && node tests/graph-initial-zoom.test.mjs && node tests/card-head-actions.test.mjs && node tests/card-reader-ux.test.mjs && node tests/tag-filter.test.mjs && node tests/ui-overflow.test.mjs && node tests/version-card-state.test.mjs && node tests/llm-routes-proxy.test.mjs && node tests/model-strikes.test.mjs && node tests/support-bundle.test.mjs && node tests/health-panel.test.mjs && node tests/issue-48-timeout.test.mjs && node tests/setup-node-path.test.mjs && node tests/capture-kind.test.mjs && node tests/core-memory.test.mjs && node tests/skill-cards.test.mjs && node tests/audit-search.test.mjs && node tests/news.test.mjs && node tests/news-feed.test.mjs && node tests/ledger.test.mjs && node tests/issue-55-timezone.test.mjs && node tests/recycle-center.test.mjs && node tests/news-follows.test.mjs && node tests/news-digest.test.mjs"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@deepseek-ai/schemastery": "^3.18.1"
|