diarium 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/bin/diarium.mjs +9 -1
- package/package.json +1 -1
package/bin/diarium.mjs
CHANGED
|
@@ -271,8 +271,16 @@ if (cmd === 'write') {
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
if (cmd === 'read') {
|
|
274
|
-
const
|
|
274
|
+
const rawDepth = flag('depth', '3');
|
|
275
275
|
const { ordered, problems } = chain();
|
|
276
|
+
const depth = rawDepth === 'all' ? ordered.length : Number(rawDepth);
|
|
277
|
+
// --json emits the ordered DOCUMENTS so a caller can render its own view without re-deriving the chain. Without it,
|
|
278
|
+
// anyone wanting a different presentation writes a second chain walk, which is the duplication this tool exists to avoid.
|
|
279
|
+
if (args.includes('--json')) {
|
|
280
|
+
if (problems.length) { console.error('✗ refusing to emit an order derived from a broken store:'); for (const p of problems) console.error(' • ' + p); process.exit(1); }
|
|
281
|
+
console.log(JSON.stringify(ordered.slice(-depth).map((x) => x.d)));
|
|
282
|
+
process.exit(0);
|
|
283
|
+
}
|
|
276
284
|
if (!ordered.length) { console.log(' (no entries yet)'); process.exit(0); }
|
|
277
285
|
if (problems.length) console.log(` ! ${problems.length} structural problem(s) — run: diarium verify\n`);
|
|
278
286
|
console.log(` walking back ${depth} hop(s) from the head of ${ordered.length} entries\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diarium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Agent memory as a verifiable UST stream — a task closes, the agent writes what it learned, the entry is sealed and prev-chained. Tamper-evident, offline-verifiable, no server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|