dsh-layers-hippocampus 1.5.7 → 1.6.1

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/CHANGELOG.md CHANGED
@@ -4,9 +4,112 @@ All notable changes to `dsh-layers-hippocampus` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
5
  and the project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [1.6.1] — 2026-11-07
8
+
9
+ **Version fully un-frozen (user directive 2026-11-07): normal semantic versioning
10
+ resumes; 1.6.1 is the current release (patch on top of 1.6.0).**
11
+
12
+ - **Archive month detail UI**: the panel's raw section now shows `indexedShards` /
13
+ `archiveCount` StatCards plus a **collapsible month table** (月份 / 引擎 / 归档大小 /
14
+ 归档时间, month-DESC, collapsed by default). `panel.raw` carries `archivedBytes`,
15
+ `totalBytes`, `engines:{gzip,zstd}`, `savedBytes`, `compressionRatio` (null when
16
+ unmeasured) and `archiveMonths[]` with `at`/`bytesBefore`/`bytesAfter`; older hosts
17
+ degrade to “—” instead of breaking the panel.
18
+ - **Segment-token audit** (`docs/AUDIT-2026-11-07-segment-token.md`): no P0
19
+ same-segment re-injection exists; the six injection surfaces are documented with
20
+ their dedup mechanisms. Its two P3 items are now IMPLEMENTED:
21
+ - **P3-1** the `[Active Task]` event id also joins the block dedup pool, so one
22
+ event can never be injected both as Active Task and as a recall block;
23
+ - **P3-2** `[Persona & Traits]` is memoized by the L3 shape (`summaryId` +
24
+ `updatedAt` + count); unchanged L3 costs one signature, not a re-render.
25
+ - **Raw cold-tier archiving (zero external deps)**: on `maintain()`, daily shards
26
+ older than `raw.archiveAfterDays` (default **7**) are merged per calendar month
27
+ into one `raw-archive-YYYY-MM.jsonl.gz` via Node's built-in `zlib`, then the
28
+ plaintext shard is removed. Archiving runs at most once per month and SKIPS any
29
+ shard that is recently read (`state/raw-access.json`), `pinned`,
30
+ `status:handoff`, or carries a hot active-set tag. `deep_raw` and hash restore
31
+ stream the archive with `createGunzip()` line-by-line (no full read), report
32
+ `archiveErrors`/`notes: archive-corrupt:<name>` for a corrupt archive, and keep
33
+ plaintext `.jsonl` reads unchanged. `raw.retentionDays` default moves **30 → 90**
34
+ and must stay strictly above `archiveAfterDays` (fail-fast otherwise).
35
+ - **`/stats` panel: archive + index visualization**: `panel.raw` now reports
36
+ `archiveCount`, `archivedBytes`, `totalBytes`, `archiveMonths`, `engines`
37
+ (`{gzip,zstd}`), `savedBytes` (sum of bytesBefore−bytesAfter), `compressionRatio`
38
+ (null when no measured archive) and `indexedShards`. Each archive records
39
+ `bytesBefore`/`bytesAfter` in `state/raw-archive.json`, so the ratio and saved
40
+ bytes are real measurements, not estimates. The panel gains two StatCards
41
+ (“raw 索引覆盖”, “raw 冷归档”) with graceful “—” for an older host, plus a
42
+ collapsible **archive month table** (月份 / 引擎 / 归档大小 / 归档时间, month-DESC,
43
+ collapsed by default); `archiveMonths` rows carry `at`/`bytesBefore`/`bytesAfter`.
44
+ 4 cases in `test/v161.stats.test.js` + 2 UI contract cases.
45
+ - **Sparse line index for raw shards** (performance audit item C): one
46
+ `<day>.jsonl.idx.json` per shard, sampled every 64 lines with
47
+ `{line, offset, timestamp}` plus `bytes/mtimeMs/lineCount/minTs/maxTs/sorted`.
48
+ `deep_raw` uses it to SKIP a shard whose time range cannot overlap the window
49
+ (without opening the file) and to reuse `lineCount` for absolute `hit.line`
50
+ numbers (no second pass). Built offline by `maintain()` (50 shards/round,
51
+ progressive), deleted with its shard by `prune()`, and silently bypassed when
52
+ missing, stale (bytes/mtime mismatch), corrupt, or non-monotonic. `stats()`
53
+ reports `indexedShards`. 6 cases in `test/v161.rawIndex.test.js`.
54
+ - **Compression-engine selection (zero install)**: `raw.compressionEngine`
55
+ (`gzip` default | `zstd`) + a settings-page engine picker with an
56
+ enable/disable button. Zstd uses Node's BUILT-IN `node:zlib` zstd — nothing is
57
+ downloaded and there is no package to uninstall; "停用" switches back to gzip.
58
+ Archives are `raw-archive-YYYY-MM.jsonl.gz` / `.jsonl.zst`, dispatch is by
59
+ extension, and a legacy gzip archive stays readable after switching to zstd.
60
+ When the runtime lacks zstd the config silently falls back to gzip and
61
+ `capabilities.compression` reports `{engine, fallback, zstd, node}` for the UI.
62
+ - **Raw retention tiers documented**: the raw layer exposes exactly three modes —
63
+ `off` (keep nothing), `salience` (default: high-value turns/code/stack/errors only),
64
+ `all` (bounded by `maxTurnKb`/`maxBytesPerDay`/`maxTotalMb`) — plus
65
+ `retentionDays` (default 90) and `pinned` never pruned. README/ARCHITECTURE now
66
+ describe these implemented tiers only.
67
+ - **Fixed — settings page rendered blank**: the compression-engine card referenced a
68
+ bare `payload` that only exists in other components' scopes; it now uses the local
69
+ `statsPayload` and the shared `Select` component (not a fake `type:'select'` on
70
+ `Field`). `test/v161.ui.test.js` pins the scope rule so the whole settings page
71
+ cannot be taken down by one card again.
72
+
73
+ - **Recall bound-based early exit** (performance audit item A): every score is
74
+ `salience × decay × tagAffinity(≤3) × lexicalBoost(≤1) × association(≤1) ×
75
+ timeBoost(≤1.3) × handoff(≤1)`, so `salience × 3.9` is a hard upper bound.
76
+ Candidates are visited salience-DESC and scoring stops as soon as that bound
77
+ cannot beat the current k-th score. `pinned` hits bypass the cut, the best-k
78
+ window keeps the bound exact (ties still visited), and the result reports
79
+ `pruned` + `notes: pruned:<n>`. Complexity unchanged in the worst case
80
+ (`O(K log K)` ordering) but the per-candidate decay/similarity work is skipped
81
+ for the long low-salience tail.
82
+ - Regression: pinned decay stays exactly 1 (bypass path), monthly memos unchanged.
83
+ - **447 tests green** (64 files).
84
+
85
+ ## [1.6.0] — 2026-11-06
86
+
87
+ > Version note: 1.6.0 was the FIRST release after the temporary 1.5.7 freeze; the
88
+ > 2026-11-07 directive removed all freeze language and resumed normal versioning.
89
+ Cold-start wake-up + user-controlled cold-start injection:
90
+
91
+ - **Anti-"customer service" wake-up** (static `memory:policy` prefix): the model is
92
+ told it has continuous long-term memory, must not open with "how may I help you",
93
+ and should recall the recent topic before replying.
94
+ - **`context.coldStartInjectSummary`** (default **true**): on the first prompt
95
+ assembly of a brand-new conversation, inject `[Cold-Start Summary]` — the handoff
96
+ summary event when present, else the top-3 L3 semantic summaries (≤800 chars).
97
+ - **`context.coldStartInjectRecentTurns`** (default **false**): inject
98
+ `[Previous Context Tail]` with the last ≤5 business episodes (200 chars each).
99
+ - **`[Cold-Start Detected: Active Space=…, Recent Topic=…]`** header when either
100
+ switch is on; the block is volatile-tail only (prompt-cache prefix untouched) and
101
+ is consumed exactly once per new conversation.
102
+ - Both switches off → no historical blocks; the static wake-up policy still ships.
103
+ - UI: two independent toggles in the settings page's session group; HTTP-editable.
104
+ - **416 tests green** (64 files).
105
+
7
106
  ## [1.5.7] — 2026-11-04
8
107
 
9
- **Version freeze: 1.5.7 is the shipped release; no further version bumps follow.**
108
+ > Historical note: 1.5.7 shipped under a temporary version freeze; the 2026-11-07
109
+ > directive removed ALL freeze language and resumed normal semantic versioning
110
+ > (current version: 1.6.1). The sentence below is the historical 1.5.7 statement.
111
+
112
+ **Version freeze (historical, superseded): 1.5.7 was the shipped release.**
10
113
  This release folds in everything added after the 1.5.6 draft — Orchestrator
11
114
  federation/dedupe wiring, read-time merge, cross-space recall aggregation (opt-in
12
115
  `features.crossSpaceRecall`), durable Orchestrator state, the settings-page GitHub
@@ -14,14 +117,14 @@ installer, the verified automatic new-conversation handoff (with configurable
14
117
  once/interval detection), low-valley Dream Phase 2, space deletion, graph
15
118
  interaction, and the rest of the 1.5.6 section below. Annotations of the form
16
119
  `v1.5.6:` below record the version in which a feature was introduced; they are
17
- history, not the current version. **399 tests green** (64 files).
120
+ history, not the current version. **411 tests green** (64 files).
18
121
 
19
122
  ## [1.5.6] — 2026-11-03
20
123
 
21
124
  **`deep_raw` now scans by line cursor: a huge day shard is never loaded whole.**
22
125
  The black box is read newest-first in fixed chunks; peak memory is one chunk plus
23
126
  one partial line (test-locked), not the file size. `hit.line` keeps its absolute
24
- 1-based semantics. **399 tests green** (was 303).
127
+ 1-based semantics. **411 tests green** (was 303).
25
128
 
26
129
  ### Changed — raw scan / restore (zero-dependency, O(chunk) memory)
27
130
 
@@ -429,12 +532,39 @@ one partial line (test-locked), not the file size. `hit.line` keeps its absolute
429
532
  configures its timer from the FIRST stats response (`once` clears the recurring
430
533
  timer). The workspace-file handoff scheme is no longer needed and stays documented
431
534
  only as a fallback.
535
+ - **Fixed — new-conversation failure `tool "subagent" is already registered`**:
536
+ handoff preset inheritance no longer calls `agentPresets.select()` when the new
537
+ session is ALREADY composed with the marker's preset. A redundant recompose
538
+ re-mounted the preset's `@deepseek-ai/dsh-tool-subagent` row and aborted session
539
+ creation; the skip is recorded as `presetInherit.reason='already-composed'` and
540
+ locked by a regression test in `test/v156.preset.test.js`.
541
+ - **Persona section + generic custom decay (v1.5.7)**:
542
+ - `[Persona & Traits]` is its own prompt section (`name:'persona'`, **order 100**),
543
+ rendering the ≤10 highest-confidence L3 semantic summaries (live store read, not
544
+ the recall cache). The memory block/policy/reflection sections keep 2450/2455/2460.
545
+ - `service.remember()` accepts **`customDecayRate`** (finite, 0 < rate ≤ 10) OR
546
+ **`customHalfLifeDays`** (integer 1–36500), never both. The value is normalised to
547
+ `meta.decay_rate`, projected as `decayRate`, and applied as
548
+ `effectiveHalfLife = policyHalfLife / decayRate` for THAT record only. No
549
+ tag-prefix logic exists anywhere in the engine — an emotion plugin decides the
550
+ semantics by passing the parameter.
551
+ - **Cross-plugin `ctx.provide('hippocampus', service)`** (user decision 2026-11-05:
552
+ in-process service only, NO HTTP write surface): `apiVersion=1`, `ready()`,
553
+ `capabilities()` (declares `l3Traits:10` plus per-method support), `remember()`
554
+ (L2-only; non-L2 layers are redirected with a warning; returns
555
+ `{status,eventId,eventTime,duplicate}`), `recall()`, `runMaintenance(source)`
556
+ (never queues: a running pass answers `MEM_E_MAINTENANCE_RUNNING`; manual passes
557
+ are rate-limited to 30 s while `cron` bypasses), `stats()/handoffView()/
558
+ promptState()` read-only snapshots and `onDispose()` hooks. The service disappears
559
+ with its plugin fiber; later calls answer `MEM_E_SERVICE_DISPOSED`. New codes
560
+ `MEM_E_MAINTENANCE_RUNNING`, `MEM_E_SERVICE_DISPOSED`, `MEM_E_FEDERATION_FAILED`
561
+ are registered append-only (8 cases in `test/v157.service.test.js`).
432
562
  - **Durable Orchestrator state**: `<root>/state/orchestrator.json` now persists the
433
563
  global federation map and the monthly-memo claims (atomic tmp+rename on every
434
564
  mutation); it is loaded before the services become observable, and a corrupt file
435
565
  is treated as empty instead of failing activation — a restart no longer forgets
436
566
  cross-space dedupe.
437
- - Full suite: **399 tests / 399 pass / 0 fail**, 64 test files. Orchestrator:
567
+ - Full suite: **411 tests / 411 pass / 0 fail**, 64 test files. Orchestrator:
438
568
  **31/31** (`service` + `spaces` deletion + `persistence` round-trip/corrupt state).
439
569
  **Installed locally**: desktop profile gets a `link:` dependency + an ordered patch
440
570
  insert BEFORE the hippocampus entries, so the service exists at activation. Two