dsh-trivium 0.5.1 → 0.6.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/README.md +9 -2
- package/README.zh-CN.md +9 -2
- package/package.json +7 -1
- package/scripts/check-integrity.mjs +60 -0
- package/scripts/clear-expired-until.mjs +120 -0
package/README.md
CHANGED
|
@@ -279,6 +279,8 @@ Off by default. After you turn **Chips (memory whitelist)** on in Settings, the
|
|
|
279
279
|
|
|
280
280
|
## Changelog
|
|
281
281
|
|
|
282
|
+
**0.6.0** — Maintenance release. The read-only revision checker and the stale-deadline cleaner now ship with the package as `dsh-trivium-check` and `dsh-trivium-clear-until` (dry run by default; `--apply` clears only deadlines also present in the body, `--all` clears every stale one). The checker previously existed only in the Git checkout even though the 0.5.1 notes told users to run it. This release also pins two verifications: turn identity comes from the host's own user-message id (checked in a real session log), and a genuine second-window attempt with a stale ETag returns 409 and succeeds after refresh. No defaults or data formats changed.
|
|
283
|
+
|
|
282
284
|
**0.5.1** — Correctness release for 0.5.0. A user turn is now booked by the text actually rendered, so three long chips can no longer ship 3 × ~217 tokens against one 300 allowance; commit is idempotent and an explicit zero budget stays zero. Version resolution returns the current node's own body, type, deadline and state instead of only its id, so a query matching a superseded decision no longer shows the old instruction under the new id. Imports plan URI identity and validate the whole resulting graph before one native transaction: two versions are never merged by similar text, no `supersedes` self-loop is written, and a failed transaction leaves no node, body or edge behind. When a delivered fact changes, the session that saw it gets a short correction notice (never the old body), scoped per workspace and consumed only after delivery. Kernel: `triviumdb@0.9.0-beta.3` (pinned prerelease). Windows are supported from 900 px upward; at 390 px the host's 188 px settings sidebar leaves ~154 px for the panel, which is not readable (it does not scroll horizontally). Upgrade note: `until` values written by 0.4.21 from prose dates are not rewritten automatically — clear them with **Show expired decisions** or `ctx_remember` with `until: ""`.
|
|
283
285
|
|
|
284
286
|
**0.5.0** — Memory you can audit. Chips and recall now share **one** 300-token allowance per user turn instead of clipping to 300 each, the same node can no longer appear twice, and a tool loop no longer re-injects inside one turn. The delivery ledger is keyed by host message ids, so a failed send is retried and compaction rebuilds, while a fork inherits neither the ledger nor the pins. `ctx_find` is capped at ~1200 estimated tokens with whole-record truncation, and `ctx_read` projects a field allowlist so new metadata cannot grow its output.
|
|
@@ -351,6 +353,11 @@ The peer ranges now explicitly admit the supported DSH `0.1.5`, `0.2.0`, and `0.
|
|
|
351
353
|
| Check for updates fails | That request only hits the npm registry for the latest version. Memory is unaffected; try again later. |
|
|
352
354
|
| Old conversations will not open after rc.8 | That is DSH’s own session-store format change, not a broken `.tdb`. Graph memory still works via `ctx_find`; leftover boxes on unmatched old sessions are plot residue. |
|
|
353
355
|
|
|
356
|
+
**Maintenance commands** (shipped with the package since 0.6.0):
|
|
357
|
+
|
|
358
|
+
- `npx dsh-trivium-check <workspace>` — opens the graph **read-only** and reports `supersedes` self loops, cycles, forks, duplicate URIs, dangling endpoints and unresolvable chains. Exit code 0 clean, 2 issues, 1 cannot open.
|
|
359
|
+
- `npx dsh-trivium-clear-until <workspace>` — dry run: lists stale decisions that still carry a deadline. `--apply` clears only deadlines whose text also appears in the body (the shape 0.4.21 produced from prose dates); `--apply --all` clears every stale deadline, including explicit ones. Close the host first — the kernel is single-writer.
|
|
360
|
+
|
|
354
361
|
Local source checkout: `npm install`, then `node scripts/link-dsh.mjs`, then restart `dsh web`. `triviumdb` is a native module; if it will not install, check Node against `package.json` `engines` (`^22.19.0 || >=24`).
|
|
355
362
|
|
|
356
363
|
---
|
|
@@ -358,8 +365,8 @@ Local source checkout: `npm install`, then `node scripts/link-dsh.mjs`, then res
|
|
|
358
365
|
## Release info
|
|
359
366
|
|
|
360
367
|
- GitHub: https://github.com/QWQcool/dsh-trivium
|
|
361
|
-
- Package version: `0.
|
|
362
|
-
- Tested host: `@deepseek-ai/dsh@0.1
|
|
368
|
+
- Package version: `0.6.0` · [npm](https://www.npmjs.com/package/dsh-trivium)
|
|
369
|
+
- Tested host: `@deepseek-ai/dsh@0.2.1-rc.4` (the peer range also admits the 0.1.x lines)
|
|
363
370
|
- License: MIT (depends on [TriviumDB](https://github.com/YoKONCy/TriviumDB), Apache-2.0)
|
|
364
371
|
|
|
365
372
|
---
|
package/README.zh-CN.md
CHANGED
|
@@ -275,6 +275,8 @@ Trivium 是记忆内核,不是日记、日历或聊天伴侣。它按**节点
|
|
|
275
275
|
|
|
276
276
|
## 更新说明
|
|
277
277
|
|
|
278
|
+
**0.6.0** — 维护版本。只读版本链体检与过期期限清理现在随包分发:`dsh-trivium-check`、`dsh-trivium-clear-until`(默认只列不改;`--apply` 只清「期限同时出现在正文里」的那些,`--all` 清所有过期期限)。此前 0.5.1 的说明让用户运行 `scripts/check-integrity.mjs`,但该脚本并不在 npm 包里。本版同时固化两项验收:轮标识取自宿主自己的用户消息 id(已在真实会话日志中确认),以及真实第二窗口带过期 ETag 会得到 409、刷新后成功。默认值与数据格式均未变。
|
|
279
|
+
|
|
278
280
|
**0.5.1** — 0.5.0 的正确性修复版。一轮的预算改为按**实际渲染出的文本**记账,三条长芯片不可能再在同一轮送出 3 × 约 217 token;`commit` 幂等,显式 0 预算保持为 0。版本解析返回当前节点自己的正文、类型、期限与状态,而不是只换 id——查询命中被替代的决策时,不会再把旧指令挂在新 id 下。导入先按 URI 规划身份、校验映射后的完整图,再用一次原生事务提交:两个版本不会因正文相近被合并,不会写出 `supersedes` 自环,事务失败也不留下节点、正文或边。已投递的事实被修改后,看过它的会话会收到一条短更正(不重发旧正文),按工作区隔离,且只有真正送达才消费。内核升到 `triviumdb@0.9.0-beta.3`(精确锁定预发布版)。界面支持宽度为 **≥900px**;390px 时宿主固定 188px 侧栏只给面板留下约 154px,不可读(但不会横向滚动)。升级说明:0.4.21 从正文日期误写的 `until` 不会自动清除,请在「显示过期决策」里清空,或用 `ctx_remember` 传 `until: ""`。
|
|
279
281
|
|
|
280
282
|
**0.5.0** — 记忆可审计。芯片与召回改为**共用**每轮 300 估算 token(原先各 300),同一节点不会出现两次,一轮内的工具循环也不再重复注入。投递账本按宿主消息 id 记账:失败可重试、压缩后可重建,fork 既不继承账本也不继承 pins。`ctx_find` 默认上限约 1200 估算 token,超预算丢弃整条记录;`ctx_read` 改为字段白名单,新元数据不会撑大默认输出。
|
|
@@ -347,6 +349,11 @@ peer 范围显式接受已支持的 DSH `0.1.5`、`0.2.0`、`0.2.1` RC 版本线
|
|
|
347
349
|
| 检查更新失败 | 只请求 npm registry 拿最新版本号,不影响记忆;过一会儿再点即可。 |
|
|
348
350
|
| rc.8 之后旧对话打不开 | 那是 DSH 自己的会话库格式变了,不是 `.tdb` 坏了。图记忆仍可 `ctx_find`;对不上号的旧方框可当情节残留。 |
|
|
349
351
|
|
|
352
|
+
**维护命令**(0.6.0 起随包分发):
|
|
353
|
+
|
|
354
|
+
- `npx dsh-trivium-check <工作区>` —— 以**只读**方式打开图,报告 `supersedes` 自环、循环、分叉、重复 URI、悬空端点与无法解析的链。退出码:0 干净,2 有问题,1 打不开。
|
|
355
|
+
- `npx dsh-trivium-clear-until <工作区>` —— 默认只列出仍带期限的过期决策;`--apply` 只清「期限文本同时出现在正文里」的那些(0.4.21 从正文抓日期的形态);`--apply --all` 清掉所有过期期限,包括用户显式填的。先关宿主,内核是单写者。
|
|
356
|
+
|
|
350
357
|
本地联调:仓库里 `npm install` 后 `node scripts/link-dsh.mjs`,再重启 `dsh web`。`triviumdb` 是原生模块,装不上时先看 Node 是否满足 `package.json` 的 `engines`(`^22.19.0 || >=24`)。
|
|
351
358
|
|
|
352
359
|
---
|
|
@@ -354,8 +361,8 @@ peer 范围显式接受已支持的 DSH `0.1.5`、`0.2.0`、`0.2.1` RC 版本线
|
|
|
354
361
|
## 发布信息
|
|
355
362
|
|
|
356
363
|
- GitHub: https://github.com/QWQcool/dsh-trivium
|
|
357
|
-
- 包版本:`0.
|
|
358
|
-
- 测试宿主:`@deepseek-ai/dsh@0.
|
|
364
|
+
- 包版本:`0.6.0` · [npm](https://www.npmjs.com/package/dsh-trivium)
|
|
365
|
+
- 测试宿主:`@deepseek-ai/dsh@0.2.1-rc.4`(peer 范围同时接受 0.1.x 各线)
|
|
359
366
|
- License: MIT(依赖 [TriviumDB](https://github.com/YoKONCy/TriviumDB) 为 Apache-2.0)
|
|
360
367
|
|
|
361
368
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-trivium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "In-process graph memory for DeepSeek Harness, backed by TriviumDB.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -12,11 +12,17 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"lib",
|
|
15
|
+
"scripts/check-integrity.mjs",
|
|
16
|
+
"scripts/clear-expired-until.mjs",
|
|
15
17
|
"cordis.patch.yml",
|
|
16
18
|
"README.md",
|
|
17
19
|
"README.zh-CN.md",
|
|
18
20
|
"LICENSE"
|
|
19
21
|
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"dsh-trivium-check": "scripts/check-integrity.mjs",
|
|
24
|
+
"dsh-trivium-clear-until": "scripts/clear-expired-until.mjs"
|
|
25
|
+
},
|
|
20
26
|
"dsh": {
|
|
21
27
|
"bundle": {
|
|
22
28
|
"patch": "./cordis.patch.yml"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Read-only check for decision revision integrity.
|
|
4
|
+
*
|
|
5
|
+
* node scripts/check-integrity.mjs <workspace> [--json]
|
|
6
|
+
*
|
|
7
|
+
* Exit codes: 0 clean, 2 issues found, 1 cannot open.
|
|
8
|
+
*
|
|
9
|
+
* The database is opened with accessMode "readOnly": no WAL, no text index
|
|
10
|
+
* rebuild, no workspace registration. If a host is holding the file, the open
|
|
11
|
+
* is refused — close the host or run this on a copy, never let a checker modify
|
|
12
|
+
* the file it is judging.
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
15
|
+
import { resolve } from "node:path";
|
|
16
|
+
|
|
17
|
+
import { checkRevisionIntegrity } from "../lib/integrity.js";
|
|
18
|
+
import { dbPathFor, openWorkspaceDbReadOnly } from "../lib/store.js";
|
|
19
|
+
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
const asJson = args.includes("--json");
|
|
22
|
+
const cwd = resolve(args.find((arg) => !arg.startsWith("--")) || process.cwd());
|
|
23
|
+
const file = dbPathFor(cwd);
|
|
24
|
+
|
|
25
|
+
if (!existsSync(file)) {
|
|
26
|
+
console.error(`no memory database at ${file}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let db;
|
|
31
|
+
try {
|
|
32
|
+
db = openWorkspaceDbReadOnly(cwd);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error(`cannot open read-only (is another host using it?): ${err.message}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const report = checkRevisionIntegrity(db);
|
|
40
|
+
if (asJson) {
|
|
41
|
+
console.log(JSON.stringify({ cwd, file, ...report }, null, 2));
|
|
42
|
+
} else {
|
|
43
|
+
console.log(`workspace: ${cwd}`);
|
|
44
|
+
console.log(`database: ${file}`);
|
|
45
|
+
console.log(`nodes: ${report.nodes} revision edges: ${report.edges}`);
|
|
46
|
+
if (report.ok) {
|
|
47
|
+
console.log("integrity: ok");
|
|
48
|
+
} else {
|
|
49
|
+
console.log(`integrity: ${report.issues.length} issue(s)`);
|
|
50
|
+
for (const issue of report.issues) console.log(`- ${issue.code}: ${JSON.stringify(issue)}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
process.exitCode = report.ok ? 0 : 2;
|
|
54
|
+
} finally {
|
|
55
|
+
try {
|
|
56
|
+
db.close?.();
|
|
57
|
+
} catch {
|
|
58
|
+
// closing a read-only handle is best effort
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* List or clear stale decision deadlines.
|
|
4
|
+
*
|
|
5
|
+
* node scripts/clear-expired-until.mjs <workspace> [--json]
|
|
6
|
+
* node scripts/clear-expired-until.mjs <workspace> --apply [--all]
|
|
7
|
+
*
|
|
8
|
+
* Default is a read-only listing. `--apply` clears deadlines only on decisions
|
|
9
|
+
* that are already stale, and by default only when the deadline text is also
|
|
10
|
+
* present in the body — that is the shape 0.4.21 produced when it parsed dates
|
|
11
|
+
* out of prose. Pass `--all` to clear every stale decision deadline, including
|
|
12
|
+
* ones the user typed explicitly; that is a deliberate, destructive choice.
|
|
13
|
+
*
|
|
14
|
+
* The workspace must not be open in another process (the kernel is single
|
|
15
|
+
* writer). Back up `.dsh/trivium.tdb` if you are not sure.
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync } from "node:fs";
|
|
18
|
+
import { resolve } from "node:path";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
closeAll,
|
|
22
|
+
dbPathFor,
|
|
23
|
+
describeDbFailure,
|
|
24
|
+
openWorkspaceDb,
|
|
25
|
+
updateNode,
|
|
26
|
+
} from "../lib/store.js";
|
|
27
|
+
import { isStalePayload } from "../lib/until.js";
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
const asJson = args.includes("--json");
|
|
31
|
+
const apply = args.includes("--apply");
|
|
32
|
+
const all = args.includes("--all");
|
|
33
|
+
const cwd = resolve(args.find((arg) => !arg.startsWith("--")) || process.cwd());
|
|
34
|
+
const file = dbPathFor(cwd);
|
|
35
|
+
|
|
36
|
+
function compact(value) {
|
|
37
|
+
return String(value ?? "").replace(/\s+/g, "");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 0.4.21 turned a date in the prose into `until`; that date is still in the body. */
|
|
41
|
+
function textMentionsUntil(text, until) {
|
|
42
|
+
const raw = String(until || "").trim();
|
|
43
|
+
if (!raw) return false;
|
|
44
|
+
const hay = compact(text);
|
|
45
|
+
const variants = [raw, raw.replace(/-/g, "."), raw.replace(/-/g, "/")];
|
|
46
|
+
return variants.some((value) => hay.includes(compact(value)));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function fail(message, code = 1) {
|
|
50
|
+
if (asJson) console.log(JSON.stringify({ ok: false, message }, null, 2));
|
|
51
|
+
else console.error(message);
|
|
52
|
+
process.exit(code);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!existsSync(file)) {
|
|
56
|
+
fail(`No database at ${file}. Pass the workspace directory that contains .dsh/trivium.tdb.`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let db;
|
|
60
|
+
try {
|
|
61
|
+
db = await openWorkspaceDb(cwd);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
const lock = describeDbFailure(err);
|
|
64
|
+
fail(lock ? lock.message : `Cannot open ${file}: ${err.message || err}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const rows = [];
|
|
68
|
+
for (const id of db.allNodeIds?.() || []) {
|
|
69
|
+
const payload = db.get(id)?.payload || {};
|
|
70
|
+
if (payload.type !== "decision") continue;
|
|
71
|
+
if (!String(payload.until || "").trim()) continue;
|
|
72
|
+
if (!isStalePayload(payload)) continue;
|
|
73
|
+
rows.push({
|
|
74
|
+
id: Number(id),
|
|
75
|
+
name: String(payload.name || ""),
|
|
76
|
+
until: String(payload.until || ""),
|
|
77
|
+
untilAt: String(payload.untilAt || ""),
|
|
78
|
+
textMentionsUntil: textMentionsUntil(payload.text, payload.until),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const selected = apply ? (all ? rows : rows.filter((row) => row.textMentionsUntil)) : [];
|
|
83
|
+
const cleared = [];
|
|
84
|
+
for (const row of selected) {
|
|
85
|
+
try {
|
|
86
|
+
updateNode(db, row.id, { until: "" });
|
|
87
|
+
cleared.push(row.id);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
fail(`#${row.id} could not be cleared: ${err.message || err}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (cleared.length) db.flush();
|
|
93
|
+
|
|
94
|
+
const report = {
|
|
95
|
+
ok: true,
|
|
96
|
+
cwd,
|
|
97
|
+
file,
|
|
98
|
+
applied: apply,
|
|
99
|
+
all,
|
|
100
|
+
staleDecisions: rows.length,
|
|
101
|
+
textMentionsUntil: rows.filter((row) => row.textMentionsUntil).length,
|
|
102
|
+
cleared,
|
|
103
|
+
rows,
|
|
104
|
+
};
|
|
105
|
+
closeAll();
|
|
106
|
+
|
|
107
|
+
if (asJson) {
|
|
108
|
+
console.log(JSON.stringify(report, null, 2));
|
|
109
|
+
} else {
|
|
110
|
+
console.log(`${rows.length} stale decision(s) with a deadline in ${file}`);
|
|
111
|
+
for (const row of rows) {
|
|
112
|
+
const mark = row.textMentionsUntil ? "date in body" : "explicit deadline";
|
|
113
|
+
console.log(` #${row.id} ${row.name || "(no name)"} until=${row.until} (${mark})`);
|
|
114
|
+
}
|
|
115
|
+
if (!apply) {
|
|
116
|
+
console.log("\nDry run. Re-run with --apply to clear dates that also appear in the body, or --apply --all for every stale deadline.");
|
|
117
|
+
} else {
|
|
118
|
+
console.log(`\nCleared ${cleared.length} deadline(s).`);
|
|
119
|
+
}
|
|
120
|
+
}
|