dsh-layers-hippocampus 0.0.0-stage → 1.5.7
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 +1251 -0
- package/LICENSE +21 -0
- package/README.md +395 -2
- package/assets/icon-180.png +0 -0
- package/assets/screenshot-graph.png +0 -0
- package/assets/screenshot-panel.png +0 -0
- package/assets/screenshot-settings.png +0 -0
- package/cordis.patch.yml +20 -0
- package/docs/ARCHITECTURE.zh.md +679 -0
- package/docs/PUBLISHING.md +82 -0
- package/icon.svg +8 -0
- package/index.js +2149 -0
- package/locale/en.json +11 -0
- package/locale/zh.json +11 -0
- package/market/SUBMISSION.md +58 -0
- package/market/data/plugins/382quaii__dsh-Layers-Hippocampus.yml +7 -0
- package/package.json +73 -4
- package/screenshots.json +5 -0
- package/src/clock.js +64 -0
- package/src/config.js +1136 -0
- package/src/context/contextEngine.js +355 -0
- package/src/cron.js +157 -0
- package/src/decay.js +57 -0
- package/src/deletePipeline.js +283 -0
- package/src/dream.js +547 -0
- package/src/dreamTimer.js +121 -0
- package/src/errors.js +164 -0
- package/src/eventLoop.js +85 -0
- package/src/graph.js +224 -0
- package/src/hostBridge.js +221 -0
- package/src/identity.js +328 -0
- package/src/index/buildIndex.js +526 -0
- package/src/index/indexManager.js +292 -0
- package/src/index/indexStore.js +182 -0
- package/src/l2Merge.js +246 -0
- package/src/log/identityLedger.js +263 -0
- package/src/log/ingest.js +107 -0
- package/src/log/logStore.js +427 -0
- package/src/log/records.js +284 -0
- package/src/maintenance.js +204 -0
- package/src/memory.js +2772 -0
- package/src/migration.js +225 -0
- package/src/migrationRunner.js +258 -0
- package/src/pendingDelete.js +98 -0
- package/src/policy.js +352 -0
- package/src/priceWindow.js +78 -0
- package/src/rawStore.js +653 -0
- package/src/retrieval.js +716 -0
- package/src/schedule.js +130 -0
- package/src/scheduler.js +121 -0
- package/src/semantic/semanticStore.js +213 -0
- package/src/semantic/tempSemantic.js +450 -0
- package/src/spaces/singleSpace.js +129 -0
- package/src/tagTreeCache.js +333 -0
- package/src/tagTreeRebuild.js +261 -0
- package/src/tagging.js +92 -0
- package/src/util.js +205 -0
- package/src/utils/RegexExtractor.js +81 -0
- package/src/utils/ToolOutputSlimmer.js +49 -0
- package/src/utils/WriteQueue.js +84 -0
- package/src/utils/memoryHints.js +75 -0
- package/src/utils/promptLayout.js +48 -0
- package/src/utils/reservedTags.js +24 -0
- package/src/webRoutes.js +645 -0
- package/ui/client.js +3897 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `dsh-layers-hippocampus` are documented here.
|
|
4
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
|
+
and the project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [1.5.7] — 2026-11-04
|
|
8
|
+
|
|
9
|
+
**Version freeze: 1.5.7 is the shipped release; no further version bumps follow.**
|
|
10
|
+
This release folds in everything added after the 1.5.6 draft — Orchestrator
|
|
11
|
+
federation/dedupe wiring, read-time merge, cross-space recall aggregation (opt-in
|
|
12
|
+
`features.crossSpaceRecall`), durable Orchestrator state, the settings-page GitHub
|
|
13
|
+
installer, the verified automatic new-conversation handoff (with configurable
|
|
14
|
+
once/interval detection), low-valley Dream Phase 2, space deletion, graph
|
|
15
|
+
interaction, and the rest of the 1.5.6 section below. Annotations of the form
|
|
16
|
+
`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).
|
|
18
|
+
|
|
19
|
+
## [1.5.6] — 2026-11-03
|
|
20
|
+
|
|
21
|
+
**`deep_raw` now scans by line cursor: a huge day shard is never loaded whole.**
|
|
22
|
+
The black box is read newest-first in fixed chunks; peak memory is one chunk plus
|
|
23
|
+
one partial line (test-locked), not the file size. `hit.line` keeps its absolute
|
|
24
|
+
1-based semantics. **399 tests green** (was 303).
|
|
25
|
+
|
|
26
|
+
### Changed — raw scan / restore (zero-dependency, O(chunk) memory)
|
|
27
|
+
|
|
28
|
+
- **`readLinesReverse(file, {chunkSize, onBuffer})`** (`src/rawStore.js`): reads a
|
|
29
|
+
file backwards in 64 KiB chunks, yielding one line at a time; the trailing
|
|
30
|
+
newline does not produce a phantom empty line. `onBuffer` reports the live
|
|
31
|
+
buffer size for tests.
|
|
32
|
+
- **`deep_raw` scan** rewrote the whole-shard `readFileSync + split` path:
|
|
33
|
+
newest-first, one `JSON.parse` per line, line bytes counted as they are read,
|
|
34
|
+
hit results collected per shard. `hit.line` is computed from the shard's line
|
|
35
|
+
count via ONE extra bounded streaming pass, paid only when that shard produced
|
|
36
|
+
a hit (so a miss costs no counting pass).
|
|
37
|
+
- **`restoreByHash`** streams forward via `readline`; **`_loadTombstones`** streams
|
|
38
|
+
synchronously with a `StringDecoder` (multi-byte boundaries preserved);
|
|
39
|
+
**`_hashesFor`** streams asynchronously (so `RawStore.capture()` is now async —
|
|
40
|
+
only internal callers exist; the public `captureRaw()` contract is unchanged).
|
|
41
|
+
- **Engine-side result ceiling**: `MAX_SCAN_RESULTS = 500` caps one scan even if an
|
|
42
|
+
embedder passes `limit: 5000`; `budget.maxHits` is reported, `truncated` is true
|
|
43
|
+
when the cap is reached.
|
|
44
|
+
- **Observability**: `scanned.peakBufferBytes` exposes the largest buffer the
|
|
45
|
+
scanner ever held (proves the memory bound).
|
|
46
|
+
|
|
47
|
+
### Added — stability hardening (same 1.5.6, no extra version bump)
|
|
48
|
+
|
|
49
|
+
- **Recall response cap**: `context.maxInjectTokens` (default 4000, 256–100 000,
|
|
50
|
+
fail-fast) bounds the JSON one recall returns. `Memory.applyPayloadBudget()`
|
|
51
|
+
keeps hits in rank order (the first is always kept), then semantic/temp summaries;
|
|
52
|
+
a cut is loud: `truncated: true`, `payload: {maxTokens, estimatedTokens, dropped}`
|
|
53
|
+
and a `payload-budget` note. Editable over HTTP and rendered in the settings page
|
|
54
|
+
with a tooltip.
|
|
55
|
+
- **`Memory.close()` releases resources**: `RawStore.close()` clears the flush timer
|
|
56
|
+
and synchronously persists queued turns before the log closes; `Memory.close()`
|
|
57
|
+
then detaches the scheduler, clears oversized-tag hints and calls
|
|
58
|
+
`IndexManager.release()` to drop the A/B views. Idempotent.
|
|
59
|
+
- **Event-loop lag monitoring**: `src/eventLoop.js` (`createLagMonitor`) wraps
|
|
60
|
+
`perf_hooks.monitorEventLoopDelay`; `maintain()` yields 50ms between phases and
|
|
61
|
+
`IndexManager.rebuild` yields between read/build/catch-up/swap once the measured
|
|
62
|
+
max delay crosses 100ms. The report carries
|
|
63
|
+
`eventLoop: {maxMs, p99Ms, meanMs, yields, thresholdMs}`. Honest boundary: a
|
|
64
|
+
synchronous builder cannot be preempted, so the granularity is phase-level and the
|
|
65
|
+
numbers expose an oversized phase.
|
|
66
|
+
|
|
67
|
+
### Added — pre-ingest tagging (same 1.5.6, no extra version bump)
|
|
68
|
+
|
|
69
|
+
- **`src/tagging.js` / `extractTags()`**: deterministic anchors derived from content
|
|
70
|
+
shape — named error types (`error:typeerror`), Node errno codes
|
|
71
|
+
(`error:econnrefused`), fenced-code language (`lang:python`), HTTP status
|
|
72
|
+
(`http:500`), file path basename (`file:index.js`) and explicit task statements
|
|
73
|
+
(`task:…`). No LLM, no dependencies, stable ordering.
|
|
74
|
+
- **Write gate** (`Memory.stage`): model-provided tags always win; only an untagged
|
|
75
|
+
write runs the heuristic. Tags are deduplicated and capped by `tagging.maxTags`
|
|
76
|
+
(1–5, default 2). Inferred anchors are recorded on `meta.auto_tagged` /
|
|
77
|
+
`meta.auto_tags` (provenance, not a silent rewrite of what the caller asserted).
|
|
78
|
+
- **raw stays pure**: the black box still receives exactly
|
|
79
|
+
`{turn_id, timestamp, role, content}` — the test locks the four-field shape.
|
|
80
|
+
- **Miss is a warning**: `MEM_E_AUTO_TAG_MISS` goes to the Host log via
|
|
81
|
+
`Memory.setWarnHook` (wired in `index.js`) and increments
|
|
82
|
+
`panel.autoTag.misses`; the write proceeds untagged.
|
|
83
|
+
- **Config**: `tagging.autoTag` (default true) and `tagging.maxTags` (1–5), both
|
|
84
|
+
fail-fast, HTTP-editable and rendered in the settings page.
|
|
85
|
+
|
|
86
|
+
### Added — pinned memory (same 1.5.6, no extra version bump)
|
|
87
|
+
|
|
88
|
+
- **`remember({ pinned: true })`**: a lesson/experience that must survive time.
|
|
89
|
+
It stores `meta.pinned = true` (provenance included in `content_hash`) and is
|
|
90
|
+
refused with **`MEM_E_PINNED_TAG_REQUIRED`** unless the caller supplies at least
|
|
91
|
+
one tag — an untriggerable lesson would be dead memory.
|
|
92
|
+
- **Never decays**: `projectEpisode` exposes `pinned`; `deriveTagTable` gives a
|
|
93
|
+
pinned event `decay = 1`, keeps its tag un-archived, and protected from the
|
|
94
|
+
`maxPostingsPerTag` drop; `deriveActiveSet` admits pinned tags regardless of
|
|
95
|
+
score or the cap.
|
|
96
|
+
- **Ranks first**: recall gives every matching pinned record `decay = 1`, exempts
|
|
97
|
+
it from `minScore`, and orders pinned hits ahead of all others
|
|
98
|
+
(`pinned-first:N` note).
|
|
99
|
+
- **Observability**: `panel.global.pinned` counts pinned records.
|
|
100
|
+
- Tool surface: `memory_remember.pinned` (boolean) is documented and passed
|
|
101
|
+
through; `bulk_ingest` items accept the same field.
|
|
102
|
+
|
|
103
|
+
### Changed — relevance-first prompt hints (same 1.5.6, no extra version bump)
|
|
104
|
+
|
|
105
|
+
- **Global "most active tags" map removed from the prompt.** `runtime.promptState()`
|
|
106
|
+
now renders only tags that lexically overlap the CURRENT user turn (max 5), via
|
|
107
|
+
`src/utils/memoryHints.js` (`selectRelevantTags` / `renderMemoryHints`).
|
|
108
|
+
Internal bookkeeping tags (`status:*`, `month:*`, `context:*`, `active_task`)
|
|
109
|
+
are never hinted; no match means the section is simply absent (no padding).
|
|
110
|
+
- **Cache-safe placement**: `[Memory Hints]` is rendered AFTER `[Memory Blocks]`,
|
|
111
|
+
so a per-turn hint never disturbs the cacheable prefix (rules only).
|
|
112
|
+
- **Input source**: prompt assembly receives no message text, so the plugin tracks
|
|
113
|
+
the last `user/message` from `session/event` (`runtime.lastUserText`); other
|
|
114
|
+
surface events never overwrite it.
|
|
115
|
+
- The legacy `renderMemoryMap` / `composePrompt({map})` API remains for callers
|
|
116
|
+
and is still unit-tested, but the plugin no longer injects the map.
|
|
117
|
+
|
|
118
|
+
### Added — capability flags & microkernel boundary (same 1.5.6, no extra version bump)
|
|
119
|
+
|
|
120
|
+
- **`features.multiSpace` (default true)** and **`features.crossSpaceTransfer`**
|
|
121
|
+
(default mirrors multiSpace). Both are fail-fast, HTTP-editable and rendered in
|
|
122
|
+
the settings page; turning multiSpace off implies crossSpaceTransfer off, and the
|
|
123
|
+
explicit contradictory combination is refused.
|
|
124
|
+
- **Strict single-space mode**: with multiSpace off, every routed read/write whose
|
|
125
|
+
`targetSpaceId` is not `default` answers **`MEM_E_FEATURE_DISABLED`** (before any
|
|
126
|
+
I/O); `createSpace` / `ensureSpace` / `warmup` refuse too, and the `/spaces` route
|
|
127
|
+
reports `['default']` with `capabilities.spaces=false` so the client hides
|
|
128
|
+
create/selector affordances instead of 404-ing.
|
|
129
|
+
- **Tools follow the flags**: `space_transfer` / `transfer_to_global` are neither
|
|
130
|
+
registered nor advertised in the prompt section when the capability is off.
|
|
131
|
+
- **`Memory.open('/abs/dir')`** is now the single-space form (the Orchestrator owns
|
|
132
|
+
the multi-space walk); the options-object form stays supported.
|
|
133
|
+
- **`Memory.warmup({targetSpaceId?, dataDir?})`**: lazy, read-only index warm-up for
|
|
134
|
+
the UI / Orchestrator — no maintenance, no writes; unknown/relative dataDir fails
|
|
135
|
+
fast.
|
|
136
|
+
|
|
137
|
+
### Added — host lifecycle: compensating Dream (same 1.5.6, no extra version bump)
|
|
138
|
+
|
|
139
|
+
- **`src/hostBridge.js`** subscribes to the Host's process-local events
|
|
140
|
+
`agent/created` and `session/created` (the "session start" signals) through a plain
|
|
141
|
+
`{on, off}` bus seam, plus `agent/disposed` for teardown.
|
|
142
|
+
- **Compensation rule**: on a session start, if no Dream ran for
|
|
143
|
+
`dream.compensateAfterHours` (default 24, 1–720, fail-fast) AND the price window
|
|
144
|
+
permits, run exactly ONE compensating Dream through the shared
|
|
145
|
+
`runtime.runMaintenance('compensate')` gate — never a second concurrent run, never
|
|
146
|
+
a queue.
|
|
147
|
+
- **Price is injected, never guessed**: `setPriceProbe(fn)` / `DSH_DREAM_PRICE=low|high`.
|
|
148
|
+
Unknown price + an LLM-backed Dream ⇒ skip (`price-unknown`); unknown + local-only
|
|
149
|
+
Dream ⇒ allowed. A known peak ⇒ skip (`peak`).
|
|
150
|
+
- **Observability**: `runtime.hostStatus()` and `/stats`'s top-level `host` report
|
|
151
|
+
`sessionStarts / compensations / skipped / lastSkipReason / dreamDue / lowValley`.
|
|
152
|
+
- `enableDream:false` disables compensation; `agent/created`/`session/created` do not
|
|
153
|
+
otherwise affect memory writes (raw capture remains on `session/event`).
|
|
154
|
+
|
|
155
|
+
### Added — Dream tunables in the settings page (same 1.5.6, no extra version bump)
|
|
156
|
+
|
|
157
|
+
- The **safe** Dream subset is now exposed to `/stats` + `/config` and rendered in
|
|
158
|
+
the settings page: `useLlm`, `minGroupSize`, `maxGroupsPerRun`, `maxSummaryChars`,
|
|
159
|
+
`maxSourceChars`, `maxEventsPerGroup`, `llmTimeoutMs`, `failureThreshold`,
|
|
160
|
+
`cooldownMinutes`, `compensateAfterHours` (all fail-fast validated).
|
|
161
|
+
- **Credentials stay private**: `dream.llm.{baseUrl,model,apiKey}` is neither exposed
|
|
162
|
+
by the routes nor editable over HTTP nor rendered in the form; it comes only from
|
|
163
|
+
the profile or `DSH_DREAM_LLM_*` env. A test asserts the key never appears in the
|
|
164
|
+
`/stats` payload.
|
|
165
|
+
|
|
166
|
+
### Added — L2 multi-merge (`merged_into`, same 1.5.6, no extra version bump)
|
|
167
|
+
|
|
168
|
+
- **`src/l2Merge.js`** condenses duplicate same-tag L2 episodes into ONE durable
|
|
169
|
+
record, offline at the end of `maintain()` (after monthly memos; a failure never
|
|
170
|
+
fails maintenance).
|
|
171
|
+
- **Pinned and ordinary groups are strictly separated** — pinned merges only with
|
|
172
|
+
pinned; ordinary only with ordinary. A pinned merge keeps `pinned: true` and
|
|
173
|
+
inherits every tag.
|
|
174
|
+
- **Text**: earliest/latest time + deduplicated core text (each source capped), the
|
|
175
|
+
whole line capped by `l2Merge.maxSummaryChars` (ASCII ellipsis so identity
|
|
176
|
+
canonicalisation cannot make it longer).
|
|
177
|
+
- **Federated metadata**: `meta.global_tags` is copied into the merged record's
|
|
178
|
+
`meta` and **never becomes a tag**, so it cannot enter the sub-space inverted index;
|
|
179
|
+
`projectEpisode` exposes it as `event.globalTags` for the merge layer only.
|
|
180
|
+
- **Append-only marking**: sources are recorded as merged in
|
|
181
|
+
`state/l2-merge.json` (`mergedSourceIds`); the log is untouched and originals stay
|
|
182
|
+
recoverable. A second pass merges nothing (idempotent) and `status().panel.l2Merge`
|
|
183
|
+
reports the bookkeeping.
|
|
184
|
+
- **Config `l2Merge`**: `enabled` (default true), `minGroupSize` (2–20, default 2),
|
|
185
|
+
`maxGroupsPerRun` (1–50, default 5), `maxSummaryChars` (100–2000, default 400);
|
|
186
|
+
fail-fast, HTTP-editable and rendered in the settings page.
|
|
187
|
+
|
|
188
|
+
### Added — L3 semantic tag invariant (same 1.5.6, no extra version bump)
|
|
189
|
+
|
|
190
|
+
- **`SemanticStore.upsert` is strict**: an L3 summary with zero usable tags is
|
|
191
|
+
refused with **`MEM_E_SEMANTIC_TAG_REQUIRED`** — such a summary could never be
|
|
192
|
+
reached by tag-driven retrieval (dead knowledge).
|
|
193
|
+
- **Offline paths degrade instead of failing**: delete-consolidation and trend
|
|
194
|
+
promotion derive tags from content heuristics (`extractTags`) and, if even that
|
|
195
|
+
yields nothing, write an explicit provenance anchor (`origin:unlabelled-episode` /
|
|
196
|
+
`origin:unlabelled-trend`). Maintenance and the two-phase delete pipeline therefore
|
|
197
|
+
never break on historical untagged events.
|
|
198
|
+
- **Historical data is read-only degraded**: summaries written before the invariant
|
|
199
|
+
remain readable and are marked `degraded: true` in `list()` /
|
|
200
|
+
`semanticSummaries()`; nothing is silently rewritten.
|
|
201
|
+
|
|
202
|
+
### Added — working mode survives a handoff (same 1.5.6, no extra version bump)
|
|
203
|
+
|
|
204
|
+
- **Handoff marker carries the Host agent preset** (the UI's “工作模式”): the marker
|
|
205
|
+
written at rollover now records `agentPreset`, fed by the live adapter through
|
|
206
|
+
`memory.setHandoffPresetProvider()`.
|
|
207
|
+
- **A new conversation restores it before its first turn**: `agent/created` is a
|
|
208
|
+
serial Host event, so the bridge awaits `agentPresets.select(agent, preset)` for
|
|
209
|
+
`source === 'startup'` from a different session. `resume`, the marker-owner session
|
|
210
|
+
and markers without a preset are never overridden.
|
|
211
|
+
- **Never breaks agent creation**: a failed `select` is reported in
|
|
212
|
+
`runtime.lastPresetInherit` and the log, then creation proceeds.
|
|
213
|
+
- **Tracking**: `agent-preset/selected` updates the mode; tool boundaries and prompt
|
|
214
|
+
assembly opportunistically read `agents.currentInitiator()` + `agentPresets
|
|
215
|
+
.composedPreset()` and **backfill an older marker** that predates this feature.
|
|
216
|
+
- **Observability**: `/stats` exposes `agentPreset` + `presetInherit`, and
|
|
217
|
+
`hostStatus().presetSelections` counts observed selections.
|
|
218
|
+
|
|
219
|
+
### Changed — physical split: multi-space engine moved out (same 1.5.6)
|
|
220
|
+
|
|
221
|
+
- **`src/spaces/spaceRouter.js` and `src/spaces/transfer.js` are GONE from this
|
|
222
|
+
package.** The full multi-space router (per-space FIFO chains, lazy child stores,
|
|
223
|
+
`MEM_E_*` validation) and the cross-space transfer engine now live in
|
|
224
|
+
`dsh-orchestrator` (`src/spaceRouter.js`, `src/transfer.js`).
|
|
225
|
+
- The core compiles only `src/spaces/singleSpace.js`: the `default` space is the
|
|
226
|
+
owner handle; every named-space operation answers **`MEM_E_FEATURE_DISABLED`** with
|
|
227
|
+
an explicit "install dsh-orchestrator" hint. No silent fallback to `default`.
|
|
228
|
+
- **Adapter injection is the wiring seam**: the Host's optional `orchestrator`
|
|
229
|
+
service supplies `createSpaceAdapter({owner, dataDir, openChild})` and `transfer`;
|
|
230
|
+
`Memory.open({spaces|spacesFactory, transfer})` accepts the same seam for embedders.
|
|
231
|
+
Without the service the plugin advertises `capabilities.spaces=false`, registers
|
|
232
|
+
only the eight single-space tools, and `/spaces` reports `default` only.
|
|
233
|
+
- A profile with `features.multiSpace:true` but no Orchestrator logs a loud warning
|
|
234
|
+
and runs the strict single-space core (visible in `/stats.capabilities`), instead
|
|
235
|
+
of pretending the capability exists.
|
|
236
|
+
|
|
237
|
+
### Added — first batch: orchestrator service + 3 experience fixes (same 1.5.6)
|
|
238
|
+
|
|
239
|
+
- **Orchestrator service registration**: `apply()` now installs a real Host service
|
|
240
|
+
(`ctx.provide('orchestrator', …)` inside `ctx.effect`, so unloading removes it).
|
|
241
|
+
It exposes `createSpaceAdapter`, `transfer`, `dirFor`, `status`, `federation`,
|
|
242
|
+
`dedupe`, `consent` and `router`. The core decides the capability through
|
|
243
|
+
`config.multiSpaceActive(config, hasOrchestrator)`.
|
|
244
|
+
- **Reserved system tags isolated from display**: `status:*`, `folded-summary` and
|
|
245
|
+
`active_task` are filtered out of the knowledge graph (`buildGraph` + defensive
|
|
246
|
+
`view`) and the L1.5 tag tree (`rebuildTree` + persisted-tree/ghost filtering).
|
|
247
|
+
The inverted index still keeps them (handoff/recall internals need them).
|
|
248
|
+
- **`[Active Task]` injection**: prompt assembly prefers the active handoff summary,
|
|
249
|
+
otherwise the newest event carrying a `task:` tag, and renders it as an
|
|
250
|
+
unconditional top block (`[Active Task]`) once per session.
|
|
251
|
+
- **Fallback hints**: `selectRelevantTags` accepts `fallbackTags`; when the current
|
|
252
|
+
input has no lexical overlap (e.g. “继续”), the previous turn's matched tags (max 2)
|
|
253
|
+
are carried into `[Memory Hints]`.
|
|
254
|
+
- **Session-scoped injection dedup**: `runtime.injection` keeps per-session `ids` and
|
|
255
|
+
`tags`; hints, `[Active Task]` and recall blocks already injected are filtered on
|
|
256
|
+
later turns. SessionStart and rollover reset the pool, so the next session receives
|
|
257
|
+
the handoff content again.
|
|
258
|
+
- **Space deletion (UI + engine)**: `SpaceRouter.deleteSpace(id, {confirm})` closes
|
|
259
|
+
the child handle, evicts its queues/caches and removes the directory (refusing
|
|
260
|
+
`default` and requiring `confirm:true`). `Memory.deleteSpace` / `runtime.deleteSpace`
|
|
261
|
+
gate the same rules (named space only; `MEM_E_FEATURE_DISABLED` in the strict
|
|
262
|
+
single-space core). The HTTP route reuses `POST /spaces` with
|
|
263
|
+
`{action:'delete', space_id, confirm:true}`; an **unknown action is a 400** and
|
|
264
|
+
never falls through to CREATE. The SpaceSelector renders `🗑 删除空间` only for a
|
|
265
|
+
named space AND only when the new **`capabilities.spacesDelete`** handshake is
|
|
266
|
+
true — an old/pre-delete host therefore hides the button instead of answering the
|
|
267
|
+
misleading “空间已存在”. When `capabilities.spaces` is false the entire space UI
|
|
268
|
+
(selector, create/delete, current-space chip) disappears silently.
|
|
269
|
+
|
|
270
|
+
### Added — local low-valley Dream scheduling (same 1.5.6)
|
|
271
|
+
|
|
272
|
+
- **No external price plugin required**: `src/priceWindow.js` computes Beijing-time
|
|
273
|
+
peak/valley locally (weekday 09–12 / 14–18 peak; lunch, nights and weekends low).
|
|
274
|
+
Chinese holidays are NOT modelled (the calendar moves yearly); `DSH_DREAM_PRICE=low|high`
|
|
275
|
+
or a Host price probe still override it.
|
|
276
|
+
- **The Host bridge gets a default probe** from `isLowValley()`, so a compensating
|
|
277
|
+
Dream skips peaks (`reason:'peak'`) and runs locally in the valley.
|
|
278
|
+
- **Idle LLM Dream defers instead of spending at peak**: `runtime.tick()` writes a
|
|
279
|
+
durable `state/dream-queue.json` (`pending, dueAt, reason:'peak-hour'`), emits
|
|
280
|
+
`dream-deferred`, and runs the queued Dream as soon as the valley opens — the queue
|
|
281
|
+
survives a restart, so a missed window is not lost.
|
|
282
|
+
- **Config `dream.onlyLowValley`** (default true; fail-fast, HTTP-editable, settings
|
|
283
|
+
toggle). A local-only Dream (no LLM) is never gated by price.
|
|
284
|
+
- `/stats` exposes `dreamWindow` (low/reason/nextLowAt), `dreamQueue` and `dreamTimer`.
|
|
285
|
+
- **Phase 2 — wake timer + sleep correction**: `src/dreamTimer.js` arms ONE wake-up
|
|
286
|
+
at the queued due time / next valley (injectable timers, `unref`ed). On fire it
|
|
287
|
+
re-reads the CLOCK and the WINDOW: a late wake after an OS sleep is reported
|
|
288
|
+
(`lateMs`, `catchUp`) and runs; a wake that lands in a peak re-arms for the next
|
|
289
|
+
valley instead of spending. Boot arms from the persisted queue, so a queue left by
|
|
290
|
+
a previous run catches up with delay 0. Disposal cancels the timer.
|
|
291
|
+
`dreamTimer` status (arms/wakes/lateWakes/reschedules/runs) is exposed on `/stats`.
|
|
292
|
+
|
|
293
|
+
### Added — Federation / cross-space dedupe wiring (same 1.5.6)
|
|
294
|
+
|
|
295
|
+
- **Federation on write**: after a successful write the engine reports the record's
|
|
296
|
+
BUSINESS tags (never `status:*` / `month:*` / `active_task`) to the Orchestrator's
|
|
297
|
+
global `FederationMap` with the space id; a tag seen in two spaces becomes ONE
|
|
298
|
+
global node listing both. A missing/broken service can never fail the write.
|
|
299
|
+
- **Dedupe on monthly memos**: `generateMonthlyMemos()` claims `sha256(content)` in
|
|
300
|
+
the Orchestrator's `ContentRegistry` as `monthly:<spaceId>`; a sibling space with
|
|
301
|
+
the identical monthly workload skips its copy and reports
|
|
302
|
+
`monthly.skipped`/`skippedEntries` (owner traceable). Same-space reruns are
|
|
303
|
+
idempotent.
|
|
304
|
+
- Services arrive through the existing `orchestrator` adapter extras; spaces carry
|
|
305
|
+
their own `spaceId` (`path.basename(childDir)`), the default space is `default`.
|
|
306
|
+
- **Read-time merge on recall**: monthly memos now persist `meta.source_event_ids`,
|
|
307
|
+
and `projectEpisode` exposes `sourceEventIds`. `Memory.mergeRecallHits()` feeds the
|
|
308
|
+
recalled hits through `ContentRegistry.mergeForRead()`: a memo wins over the events
|
|
309
|
+
it owns, duplicate `contentHash` collapses monthly-first, and the payload reports
|
|
310
|
+
`merge: {space,monthly,droppedOwnedByMonthly,droppedDuplicateContent,total}`. Only
|
|
311
|
+
when the Orchestrator dedupe service is present; the pure core payload shape is
|
|
312
|
+
unchanged.
|
|
313
|
+
- **Cross-space recall aggregation**: `Memory.recallAcrossSpaces()` queries every open
|
|
314
|
+
space under its own lock, tags each hit with `spaceId`, and folds the union through
|
|
315
|
+
the same `mergeForRead()` (raw hits are requested with `mergeRecall:false` so the
|
|
316
|
+
aggregation sees owned events before the memo hides them). It is **opt-in**:
|
|
317
|
+
`features.crossSpaceRecall` defaults to **false**, is fail-fast (true without
|
|
318
|
+
multiSpace is a contradiction), HTTP-editable and rendered in the settings page.
|
|
319
|
+
Only when `crossSpaceRecall:true` does `runtime.recall()` use this path; otherwise
|
|
320
|
+
the single-space payload is unchanged (`mode` is never `cross-space`).
|
|
321
|
+
`mode:'cross-space'`, `spaces`, `merge` and per-hit `spaceId` are reported.
|
|
322
|
+
|
|
323
|
+
### Tests
|
|
324
|
+
|
|
325
|
+
- New `test/v156.rawscan.test.js` (5 cases): newest-first + absolute line number
|
|
326
|
+
(5000-line shard), turn-budget truncation without reading the head, engine result
|
|
327
|
+
ceiling, `readLinesReverse` peak buffer ≤ chunk + one line over a 20k-line file,
|
|
328
|
+
and `restoreByHash` over the streaming path.
|
|
329
|
+
- New `test/v156.hardening.test.js` (5 cases): recall payload truncation and
|
|
330
|
+
under-budget pass-through, `maxInjectTokens` fail-fast, `close()` resource release
|
|
331
|
+
and idempotency, lag monitor yield after a 120ms block, maintenance `eventLoop`.
|
|
332
|
+
- New `test/v156.tagging.test.js` (7 cases): extraction matrix, untagged write gets
|
|
333
|
+
an anchor and becomes recallable, raw purity (four fields), manual tags win +
|
|
334
|
+
dedupe, miss warning + panel counter, `autoTag:false`, config fail-fast.
|
|
335
|
+
- New `test/v156.pinned.test.js` (3 cases): pinned without tags refused and no
|
|
336
|
+
write, one-year decay still `decay=1` + index/tag flags + pinned-first ranking,
|
|
337
|
+
pinned tag stays in the active set after a 400-day maintenance.
|
|
338
|
+
- New `test/v156.hints.test.js` (4 cases): selector matrix (match/unrelated/internal/
|
|
339
|
+
empty), hint rendering, prompt tail contains only matching tags after the block
|
|
340
|
+
marker with a stable prefix, `session/event` user turn tracking.
|
|
341
|
+
- New `test/v156.features.test.js` (5 cases): flag fail-fast + implied transfer-off,
|
|
342
|
+
strict single-space engine + capabilities/tools absent, transfer-only-off,
|
|
343
|
+
defaults unchanged, `Memory.open(string)` + lazy `warmup()`.
|
|
344
|
+
- New `test/v156.host.test.js` (6 cases): price normalisation; session start runs one
|
|
345
|
+
compensating Dream; unknown price + LLM skipped; peak skipped; not-due / disabled /
|
|
346
|
+
in-flight refused; MockHostEnvironment integration through `apply()` + `hostStatus`
|
|
347
|
+
surfaced on `/stats`; `dream.compensateAfterHours` fail-fast.
|
|
348
|
+
- New `test/v156.dreamui.test.js` (3 cases): safe Dream subset exposed / credentials
|
|
349
|
+
absent from the payload; tunables editable over HTTP while `dream.llm.*` is not;
|
|
350
|
+
settings page renders the section and offers no credential field.
|
|
351
|
+
- New `test/v156.l2merge.test.js` (4 cases): pinned/ordinary strict separation with
|
|
352
|
+
global-tag metadata preserved as meta (never a tag); a lone ordinary record is not
|
|
353
|
+
dragged into the pinned group; `maxSummaryChars` cap + `enabled:false`; config
|
|
354
|
+
fail-fast. Older fixtures disable `l2Merge` so their exact index-count assertions
|
|
355
|
+
stay deterministic.
|
|
356
|
+
- New `test/v156.l3tag.test.js` (4 cases): strict upsert refusal; delete-consolidation
|
|
357
|
+
derives `error:typeerror` / `origin:unlabelled-episode` instead of dead knowledge;
|
|
358
|
+
trend promotion derives tags before writing L3; historical untagged summaries are
|
|
359
|
+
readable but `degraded`.
|
|
360
|
+
- New `test/v156.preset.test.js` (6 cases): marker records the working mode; a new
|
|
361
|
+
conversation restores it through `agentPresets.select`; older markers are
|
|
362
|
+
backfilled from the live agent; resume / same-session / marker-without-preset never
|
|
363
|
+
override; a failed select does not fail creation; `agent-preset/selected` keeps the
|
|
364
|
+
tracked mode current.
|
|
365
|
+
- New `test/v156.singleSpace.test.js` (3 cases): the core works for `default` and
|
|
366
|
+
refuses named read/write/create/ensure/transfer; without the Orchestrator the plugin
|
|
367
|
+
advertises `spaces:false`, registers eight tools and never advertises a dead tool in
|
|
368
|
+
the prompt; injecting the adapter restores ten tools and `spaces:true`.
|
|
369
|
+
- Updated: manifest 1.5.5 → 1.5.6; settings page gains `context.maxInjectTokens`,
|
|
370
|
+
the pre-ingest tagging section, Dream tunables and the L2-merge section; editable
|
|
371
|
+
contract gains `tagging`, `features`, `dream` and `l2Merge`; panel contract gains
|
|
372
|
+
`global.pinned`, `autoTag` and `l2Merge`; `plugin.test` prompt contract now asserts
|
|
373
|
+
relevance hints instead of the removed global map.
|
|
374
|
+
- New `test/v156.firstBatch.test.js` (5 cases): reserved status tags never reach the
|
|
375
|
+
graph/tag tree; `[Active Task]` from the handoff summary and from a `task:` event;
|
|
376
|
+
fallback hints reuse the previous turn's tags; session dedup blocks the second
|
|
377
|
+
injection and resets on a new session.
|
|
378
|
+
- New `test/v156.spaceDelete.test.js` (5 cases): engine deletion with confirm/default/
|
|
379
|
+
missing rules; strict single-space refusal; **`capabilities.spacesDelete` versioned
|
|
380
|
+
handshake** (an old host hides the button, so a delete request can never be
|
|
381
|
+
misread as CREATE); `POST /spaces {action:'delete'}` removes the store and returns
|
|
382
|
+
the refreshed list; unknown actions answer 400 instead of falling through to
|
|
383
|
+
CREATE; the UI source carries the capability guard, the button, the human confirm
|
|
384
|
+
and the default-space guard.
|
|
385
|
+
- **Graph interaction layer** (`test/v156.graph.test.js`, 4 cases): Ctrl/Cmd+drag
|
|
386
|
+
pans the canvas (plain drag still moves a node), Ctrl/Cmd+wheel zooms around the
|
|
387
|
+
cursor via a non-passive native listener (plain wheel keeps page scroll),
|
|
388
|
+
double-click on blank space resets the view, and the frozen initial layout runs
|
|
389
|
+
through `separateOverlaps()` so nodes never start piled on top of each other.
|
|
390
|
+
The header/footer advertise the interaction.
|
|
391
|
+
- New `test/v156.lowValley.test.js` (4 cases): Beijing peak/valley boundaries and
|
|
392
|
+
next-low computation; `dream.onlyLowValley` fail-fast + editable; a peak-hour idle
|
|
393
|
+
Dream is deferred durably and runs at the valley; the Host bridge probe follows the
|
|
394
|
+
window while `DSH_DREAM_PRICE` remains an override.
|
|
395
|
+
- New `test/v156.federation.test.js` (2 cases): business tags federate into one
|
|
396
|
+
global node across spaces while internal tags are skipped; the first space claims a
|
|
397
|
+
cross-space monthly memo and the sibling reports `skipped` with the owner.
|
|
398
|
+
- New `test/v156.lowValley2.test.js` (4 cases): peak wake re-arms (never runs); a
|
|
399
|
+
sleep-delayed wake reports `lateMs`/`catchUp`; a past-due queue in the valley arms
|
|
400
|
+
delay 0; runtime integration: peak deferral -> timer fire -> queue cleared and
|
|
401
|
+
`dreamTimer.runs === 1`.
|
|
402
|
+
- New `test/v156.readMerge.test.js` (2 cases): a recalled monthly memo drops the
|
|
403
|
+
events it owns and reports merge stats; without the dedupe service the recall
|
|
404
|
+
payload is unchanged.
|
|
405
|
+
- New `test/v156.crossSpaceRecall.test.js` (2 cases): a recall returns hits from every
|
|
406
|
+
open space with provenance; a monthly memo hides its owned event even when recorder
|
|
407
|
+
in another space, while the other space still contributes.
|
|
408
|
+
- New `test/v156.crossSpaceRecallFlag.test.js` (3 cases): default false + fail-fast
|
|
409
|
+
(`true` without multiSpace is a contradiction, non-boolean rejected); flag true
|
|
410
|
+
aggregates open spaces; flag false keeps the single-space payload.
|
|
411
|
+
- **Settings-page GitHub installer**: new `POST /api/hippocampus/orchestrator/install`
|
|
412
|
+
(requires `{confirm:true}`) delegates to the Host's
|
|
413
|
+
`pluginManager.installBundle('git+https://github.com/382quaii/dsh-Layers-Orchestrator.git', {enabled:true})`,
|
|
414
|
+
short-circuits when the service is already present, and reports
|
|
415
|
+
`applied | restart-required | manual | failed`. The settings page ships a
|
|
416
|
+
“从 GitHub 安装 dsh-orchestrator” button (human confirm dialog) plus the repo link;
|
|
417
|
+
without `pluginManager` it shows the exact manual steps instead of failing silently.
|
|
418
|
+
- **Automatic new conversation on handoff (verified feasible)**: the Host exposes
|
|
419
|
+
`agents.create/resume` and, decisively, the CLIENT service
|
|
420
|
+
`uiWorkspace.startSession()` — the same action the “+” button uses. A client-half
|
|
421
|
+
controller polls `/stats`, and when `handoff.active && handoff.autoNewSession` it
|
|
422
|
+
calls `uiWorkspace.startSession(undefined, {agentPreset})` once per handoff marker
|
|
423
|
+
(sessionStorage guard, lifecycle-owned interval, capability-guarded no-op on old
|
|
424
|
+
hosts). New config `context.autoNewSession` (default **true**, fail-fast,
|
|
425
|
+
HTTP-editable, settings toggle), plus `context.autoNewSessionPoll`
|
|
426
|
+
(`interval` | `once`, default `interval`) and
|
|
427
|
+
`context.autoNewSessionIntervalSeconds` (5–3600, default 15): the settings page
|
|
428
|
+
now exposes a “按间隔轮询 / 只检查一次” select and an interval slider; the client
|
|
429
|
+
configures its timer from the FIRST stats response (`once` clears the recurring
|
|
430
|
+
timer). The workspace-file handoff scheme is no longer needed and stays documented
|
|
431
|
+
only as a fallback.
|
|
432
|
+
- **Durable Orchestrator state**: `<root>/state/orchestrator.json` now persists the
|
|
433
|
+
global federation map and the monthly-memo claims (atomic tmp+rename on every
|
|
434
|
+
mutation); it is loaded before the services become observable, and a corrupt file
|
|
435
|
+
is treated as empty instead of failing activation — a restart no longer forgets
|
|
436
|
+
cross-space dedupe.
|
|
437
|
+
- Full suite: **399 tests / 399 pass / 0 fail**, 64 test files. Orchestrator:
|
|
438
|
+
**31/31** (`service` + `spaces` deletion + `persistence` round-trip/corrupt state).
|
|
439
|
+
**Installed locally**: desktop profile gets a `link:` dependency + an ordered patch
|
|
440
|
+
insert BEFORE the hippocampus entries, so the service exists at activation. Two
|
|
441
|
+
Cordis constraints were fixed on the way: `apply()` must return **undefined**
|
|
442
|
+
(the return value is treated as an effect → `TypeError: Invalid effect`), and the
|
|
443
|
+
service is registered directly with `ctx.provide` (itself an effect). The market
|
|
444
|
+
catalog still does **not** list it: that needs an npm publish / catalog submission.
|
|
445
|
+
- Added `docs/RELEASE-1.5.6.md`: release notes + the exact push/tag/npm/market
|
|
446
|
+
commands that require the operator's credentials (none executed here).
|
|
447
|
+
|
|
448
|
+
## [1.5.5] — 2026-11-03
|
|
449
|
+
|
|
450
|
+
**Offline Dream distillation: an optional LLM pass that can never take Dream down.**
|
|
451
|
+
Same-tag L2 records are distilled into one durable, provenance-carrying record.
|
|
452
|
+
The LLM leg uses **Node's built-in `fetch` only** (charter v2.0 #1: still zero
|
|
453
|
+
dependencies); endpoint / model / key are injected through config or
|
|
454
|
+
`DSH_DREAM_LLM_*` env and are never hard-coded, logged, or returned by HTTP.
|
|
455
|
+
Every failure — no config, network down, timeout, non-JSON — silently degrades to
|
|
456
|
+
the deterministic local merge and records `MEM_E_DREAM_LLM_FALLBACK`. **303 tests
|
|
457
|
+
green** (was 295).
|
|
458
|
+
|
|
459
|
+
### Added — Dream LLM distillation (`src/dream.js`, `Memory.executeDream`)
|
|
460
|
+
|
|
461
|
+
- **Structured output**: the model must answer JSON `{"summary","confidence"}`;
|
|
462
|
+
`summary` is capped at `dream.maxSummaryChars` (default 200). Fenced code,
|
|
463
|
+
non-JSON, missing fields and over-long summaries are all treated as LLM failure.
|
|
464
|
+
- **Zero-dependency transport**: Node's global `fetch` against an
|
|
465
|
+
OpenAI-compatible `/chat/completions`; `Authorization: Bearer` only when a key is
|
|
466
|
+
configured. No SDK, no `node-fetch`, no new `package.json` dependency (test-locked).
|
|
467
|
+
- **Absolute timeout**: `AbortController` + `Promise.race` under
|
|
468
|
+
`dream.llmTimeoutMs` (default 15s); the timer is always cleared in `finally`.
|
|
469
|
+
- **Local fallback**: earliest/latest time + deduplicated core text, capped to
|
|
470
|
+
`maxSummaryChars`. Degradation warns `MEM_E_DREAM_LLM_FALLBACK` and is visible in
|
|
471
|
+
`status().panel.dream.lastFallback`.
|
|
472
|
+
- **Provenance**: the distilled record always carries
|
|
473
|
+
`meta.source_event_ids` (deduped, sorted) and `meta.distilled_by` (`llm|local`);
|
|
474
|
+
a re-run never merges the same source twice (`state/dream.json` bookkeeping).
|
|
475
|
+
- **Circuit breaker**: `failureThreshold` (default 3) consecutive failures open the
|
|
476
|
+
breaker for `cooldownMinutes` (default 60); afterwards a half-open state allows
|
|
477
|
+
exactly one probe — success closes it, failure re-opens. Exposed as
|
|
478
|
+
`panel.dream.circuit`.
|
|
479
|
+
- **Single-flight + serial**: a concurrent `executeDream()` is refused
|
|
480
|
+
(`dream-in-flight`); within one run groups are processed strictly serially, so a
|
|
481
|
+
slow provider can never exhaust connections or accumulate queued work.
|
|
482
|
+
- **Offline only**: `executeDream()` is called exclusively from the `dream` branch
|
|
483
|
+
of the maintenance gate, after `maintain()` converged; the online
|
|
484
|
+
`recall`/`remember` paths never touch the network.
|
|
485
|
+
|
|
486
|
+
### Config
|
|
487
|
+
|
|
488
|
+
- New `dream` group (fail-fast validated): `useLlm`, `minGroupSize` (2–50),
|
|
489
|
+
`maxGroupsPerRun` (1–50), `maxSummaryChars` (40–2000), `maxSourceChars`
|
|
490
|
+
(80–4000), `maxEventsPerGroup` (2–50), `llmTimeoutMs` (500–120000),
|
|
491
|
+
`failureThreshold` (1–20), `cooldownMinutes` (1–1440), and
|
|
492
|
+
`llm.{baseUrl,model,apiKey}`. The `llm` block is deliberately **not** part of the
|
|
493
|
+
UI/HTTP config projection, so a credential can never leak through the panel.
|
|
494
|
+
|
|
495
|
+
### Tests
|
|
496
|
+
|
|
497
|
+
- New `test/v155.dream.test.js` (8 cases): no-config local fallback with full
|
|
498
|
+
provenance; LLM success (URL/header/body/JSON parse); non-JSON degradation;
|
|
499
|
+
fetch timeout degradation; single-flight refusal; circuit open → no fetch →
|
|
500
|
+
half-open single probe → close; `dream` config fail-fast matrix; `package.json`
|
|
501
|
+
dependency red line.
|
|
502
|
+
- Updated: status-panel contract gains `dream`; manifest 1.5.4 → 1.5.5.
|
|
503
|
+
- Full suite: **303 tests / 303 pass / 0 fail**, 41 test files.
|
|
504
|
+
|
|
505
|
+
## [1.5.4] — 2026-11-02
|
|
506
|
+
|
|
507
|
+
**Hotfix: the automatic handoff state machine can no longer wedge a session, and
|
|
508
|
+
recursive handoff summaries are cut off at the source.** Incident: recursive
|
|
509
|
+
`交接摘要` generations inflated the ratio past the native window and a handoff that
|
|
510
|
+
failed could leave the machine stuck, blocking new sessions. **295 tests green**
|
|
511
|
+
(was 286).
|
|
512
|
+
|
|
513
|
+
### Fixed — state machine (no deadlock, Fail-Fast with graceful degradation)
|
|
514
|
+
|
|
515
|
+
- **`checkHandoff()` never rejects**: a distillation error, a timeout (default 5s,
|
|
516
|
+
injectable per call) or a marker-write failure degrade to a `state:"failed"`
|
|
517
|
+
marker carrying `summaryError` and return immediately. The next session starts
|
|
518
|
+
regardless.
|
|
519
|
+
- **New-session transition resets everything**: `observeSessionTokens()` always
|
|
520
|
+
establishes the new session's own baseline, consumes a marker belonging to a
|
|
521
|
+
different session, and **releases `_handoffInFlight`**, so a hung handoff guard
|
|
522
|
+
can never own the next session. A same-key restart (estimate halved after reset)
|
|
523
|
+
is treated as a new baseline too.
|
|
524
|
+
- **Stale marker consumption happens before early returns**, so a fresh session
|
|
525
|
+
cannot inherit "handoff active" forever.
|
|
526
|
+
- **Outer watchdog in `_maybeAutoHandoff()`** in addition to the inner one: even if
|
|
527
|
+
`checkHandoff` itself hangs, the in-flight flag is released in `finally`.
|
|
528
|
+
|
|
529
|
+
### Fixed — recursion
|
|
530
|
+
|
|
531
|
+
- **`_distillHandoffTail()` refuses handoff content** by tag (`status:handoff`) and
|
|
532
|
+
by the `交接摘要` text prefix, in both the live-context path and the indexed
|
|
533
|
+
fallback. Output is hard-capped at 1200 characters; the idempotency key includes
|
|
534
|
+
the timestamp so distinct epochs never collide. (No more summary-of-summary.)
|
|
535
|
+
- **`status:handoff` is internal**: 2% weight in normal recall and excluded from the
|
|
536
|
+
recent-memory list, so real facts always outrank handoff bookkeeping.
|
|
537
|
+
|
|
538
|
+
### Added — escape hatches and cleanup
|
|
539
|
+
|
|
540
|
+
- **`Memory.resetSessionState()` / `memory_admin action=reset_session` /
|
|
541
|
+
`POST /api/hippocampus/session/reset` / settings-page 「强制重置交接状态(逃生舱)」**:
|
|
542
|
+
clears the live token baseline, the in-flight guard and the active marker. It
|
|
543
|
+
rewrites only `state/`; durable memories are untouched.
|
|
544
|
+
- **`Memory.repairHandoffSummaries()` + `scripts/repair-handoff.mjs`
|
|
545
|
+
(`npm run repair-handoff`)**: finds recursive/excess handoff generations
|
|
546
|
+
(recursive = >=2 `交接摘要` markers) and parks them in the two-phase
|
|
547
|
+
`pending_delete` queue. Dry-run by default; `--reset-marker` consumes a stuck
|
|
548
|
+
marker.
|
|
549
|
+
- Panel session status now exposes `handoffState` / `handoffDegraded` /
|
|
550
|
+
`handoffErrorCode`; a degraded handoff is visible in the status bar instead of
|
|
551
|
+
silently locking.
|
|
552
|
+
- New error code **`MEM_E_HANDOFF_FAILED`**.
|
|
553
|
+
|
|
554
|
+
### Tests
|
|
555
|
+
|
|
556
|
+
- New `test/v156.handoff.test.js` (9 tests): recursion refused by tag/prefix and
|
|
557
|
+
fallback path; throwing/hanging distillation degrades without rejecting; new
|
|
558
|
+
session resets ratio and releases the stuck guard; handoff summary ranking and
|
|
559
|
+
list isolation; `resetSessionState` preserves memories; repair dry-run + pending
|
|
560
|
+
delete; admin tool + HTTP escape hatch (route table 8).
|
|
561
|
+
- Route contract 7 → 8, manifest 1.5.4.
|
|
562
|
+
- Full suite: **295 tests / 295 pass / 0 fail**, 40 test files.
|
|
563
|
+
|
|
564
|
+
## [1.5.3] — 2026-11-02
|
|
565
|
+
|
|
566
|
+
**Hotfix: space creation no longer exposes a raw `MEM_E_SPACES: HTTP 404`, and
|
|
567
|
+
invalid/conflicting space names are rejected by the ENGINE with
|
|
568
|
+
`MEM_E_SPACE_INVALID`.** Incident: a new client bundle called
|
|
569
|
+
`/api/hippocampus/spaces` against a host process that predated the route (the same
|
|
570
|
+
process also 404s `/memories`). Fixed on three layers plus a route-drift test.
|
|
571
|
+
**286 tests green** (was 270).
|
|
572
|
+
|
|
573
|
+
### Added — release hygiene
|
|
574
|
+
|
|
575
|
+
- **Benchmark Protocol v1 (`scripts/bench-protocol.mjs`, `npm run bench`)**: the only
|
|
576
|
+
sanctioned way to publish a throughput number. Each measured run gets a fresh
|
|
577
|
+
`os.tmpdir()` store, one discarded same-process warmup precedes 5 measured runs,
|
|
578
|
+
and the report carries MEDIAN + min/max/spread. It makes no speed assertions
|
|
579
|
+
(a shared/AV-scanned machine must report, not fail), so single-run noise cannot
|
|
580
|
+
become an architecture conclusion again. Replaces the deleted single-run
|
|
581
|
+
`scripts/confidence-ab.mjs`.
|
|
582
|
+
- **Multi-space fixed-overhead coverage (`test/v154.release.test.js`)**: N=10
|
|
583
|
+
physical spaces — bounded per-space boot (<500ms median), lazy root boot
|
|
584
|
+
(`spaces.open=[]`, children never eagerly opened), uniform per-space storage
|
|
585
|
+
(max/min ≤1.35), linear total bytes (≤1.3×N), per-space fixed overhead <256KB.
|
|
586
|
+
- **Dead config removal**: `context.minInjectConfidence` is gone end-to-end
|
|
587
|
+
(default/validation/projection, HTTP-editable key,
|
|
588
|
+
`applyConfidence`/`MIN_INJECT_CONFIDENCE` retrieval pass, recall
|
|
589
|
+
`confidence`/`lowConfidence` annotations and low-confidence notes, obsolete A/B
|
|
590
|
+
script). Supplying the old key fails fast with `MEM_E_CONFIG_UNKNOWN_KEY`
|
|
591
|
+
(`details.removedIn = "1.5.3"`), so a profile cannot keep believing it works.
|
|
592
|
+
- Test watchdog default 30s → 60s (the in-process suite boots real stores/spaces and
|
|
593
|
+
legitimately takes ~15–25s; the watchdog now only fires on real hangs).
|
|
594
|
+
|
|
595
|
+
### Added — tool schema pruning
|
|
596
|
+
|
|
597
|
+
- **`tools.disabled` config (default `[]`)**: every registered tool definition costs its
|
|
598
|
+
JSON schema in prompt tokens on EVERY turn (~1.1–1.2k tokens of baseline tax). A
|
|
599
|
+
closed suffix vocabulary (`remember/checkpoint/recall/capture/bulk_ingest/reinforce/forget/space_transfer/transfer_to_global/admin`)
|
|
600
|
+
lets an operator prune low-frequency tools; `remember`/`recall`/`admin` are CORE
|
|
601
|
+
and cannot be disabled. A typo/prefix/full name, a core tool, or a duplicate aborts
|
|
602
|
+
config resolution with **`MEM_E_INVALID_TOOL_NAME`** (fail-fast, never silently
|
|
603
|
+
ignored). The register wrapper skips disabled suffixes AND the `memory` prompt
|
|
604
|
+
section stops advertising them, so the schema prune cannot lie to the model.
|
|
605
|
+
Editable over HTTP (`tools.disabled`) and rendered in the settings page as a
|
|
606
|
+
checkbox catalog with core-不可关闭 / low-frequency tooltips. Takes effect on the
|
|
607
|
+
next host start/reload (tool registration happens at activation).
|
|
608
|
+
|
|
609
|
+
### Fixed
|
|
610
|
+
|
|
611
|
+
- **Route-drift lock**: a new test parses the client `API` constant table and
|
|
612
|
+
proves every path equals the backend `MEMORY_API` value verbatim, and that the
|
|
613
|
+
registered route table contains them all. Adding a route on one side without the
|
|
614
|
+
other now fails CI instead of 404-ing in production.
|
|
615
|
+
- **Capability handshake**: `/stats` (ready AND booting) and `GET /spaces` now carry
|
|
616
|
+
`capabilities: { version, spaces, memories, transferConsent, multiSpace }`.
|
|
617
|
+
The client checks `capabilities.spaces` BEFORE calling `POST /spaces`; if the
|
|
618
|
+
host is older it shows a version hint and disables the action instead of firing a
|
|
619
|
+
request that 404s. `memories` is gated the same way (old host → "当前宿主版本不
|
|
620
|
+
支持记忆列表", not `MEM_E_MEMORIES`).
|
|
621
|
+
- **Human error copy**: every space-create failure now renders a complete sentence.
|
|
622
|
+
404 / route-missing / network → `创建失败:底层引擎未响应,请检查版本或联系架构师`;
|
|
623
|
+
invalid name → `创建失败:空间名称无效——需以小写字母/数字开头,只能含 a-z 0-9 . _ -(最长 64)`;
|
|
624
|
+
duplicate → `创建失败:空间「33」已存在,请换一个名称`; reserved → `创建失败:该名称是
|
|
625
|
+
系统保留名,请换一个`. The `MEM_E_SPACES: HTTP 404` template is gone from the bundle.
|
|
626
|
+
- **`MEM_E_SPACE_INVALID` (400)**: `validateNewSpaceId` + `Memory.createSpace` reject,
|
|
627
|
+
before any directory/JSONL write: empty/whitespace, wrong charset (`Bad`, `bad id!`,
|
|
628
|
+
path separators, `..`, `.`), >64 chars, trailing dot (Windows alias), Windows
|
|
629
|
+
device names (`con`, `nul`, `com1`, …), `default` (always exists), an existing
|
|
630
|
+
space (conflict), and a non-directory path collision. Creation returns `201`,
|
|
631
|
+
conflicts/invalid ids `400 MEM_E_SPACE_INVALID`.
|
|
632
|
+
- Fresh spaces are created from `POST /spaces` with a strict non-idempotent
|
|
633
|
+
`runtime.createSpace`; the lazy `ensureSpace` used by transfer keeps its
|
|
634
|
+
idempotent semantics.
|
|
635
|
+
|
|
636
|
+
### Tests
|
|
637
|
+
|
|
638
|
+
- New `test/v153.spaces.test.js` (7 tests): client↔backend route-path equality
|
|
639
|
+
(the anti-404 lock), a real dispatch through the CLIENT path against the
|
|
640
|
+
registered host route table (handler answers 201, never a router 404),
|
|
641
|
+
invalid/reserved matrix, engine conflict-before-write, HTTP 201/400 + capability
|
|
642
|
+
handshake, human-copy mapper (no raw 404), capability gating for old hosts.
|
|
643
|
+
- Updated: `POST /spaces` assertions 200 → 201 strict creation; manifest 1.5.3.
|
|
644
|
+
- Full suite: **286 tests / 286 pass / 0 fail**, 39 test files (includes
|
|
645
|
+
`v154.release.test.js`).
|
|
646
|
+
- **Note (deployment)**: the live host process observed during the incident still
|
|
647
|
+
404s `/spaces` and `/memories` — it must be restarted/reloaded for the new routes
|
|
648
|
+
to serve; until then the new client degrades with the version hint above instead
|
|
649
|
+
of a naked 404.
|
|
650
|
+
|
|
651
|
+
## [1.5.2] — 2026-11-02
|
|
652
|
+
|
|
653
|
+
**Architecture correction: physical storage migration vs. business-data transfer
|
|
654
|
+
are now physically decoupled, and the UI has a real global SpaceSelector.** The
|
|
655
|
+
v1.5.0/v1.5.1 UI mixed two unrelated concerns and let the user type
|
|
656
|
+
`target_space_id`/`event_ids` by hand. Fixed and locked by tests. **270 tests
|
|
657
|
+
green** (was 263).
|
|
658
|
+
|
|
659
|
+
### Changed — UI (module decoupling)
|
|
660
|
+
|
|
661
|
+
- **Physical dataDir migration extracted** into `StorageMigratorUI`, a SYSTEM/DATA
|
|
662
|
+
MANAGEMENT section at the bottom of the settings page. It owns only the A/B
|
|
663
|
+
double-buffer state machine: `POST { dataDir }` → `202 state=migrating` → copy →
|
|
664
|
+
verify → swap, old directory kept as a backup. No event ids, no spaces.
|
|
665
|
+
- **Business cross-space transfer removed from the settings form**: the manual
|
|
666
|
+
`event_ids` / `target_space_id` text inputs, the copy/cut buttons and the
|
|
667
|
+
inline confirmation are gone. Business transfer now exists ONLY in the panel's
|
|
668
|
+
regulated flow (below).
|
|
669
|
+
- **Global `SpaceSelector`** in the panel header: a dropdown of the physical spaces
|
|
670
|
+
(friendly labels: 默认空间 / 工作空间 / 私人空间 / 全局空间, unknown ids verbatim)
|
|
671
|
+
with `+ 新建空间` (creates an EMPTY space — never a copy). The selection is
|
|
672
|
+
app-global (`spaceStore` + `space-changed` bus event), so the panel and the
|
|
673
|
+
settings page follow it.
|
|
674
|
+
- **Every UI read follows the selected space**: `useMemoryStats`, `useGraph` and
|
|
675
|
+
`useRecentMemories` append `?space=<id>`; the backend routes `stats`, `graph` and
|
|
676
|
+
`memories` to that physical store. Memory list, graph, L1 log/index counts, L2.5
|
|
677
|
+
quarantine, L3 semantic count, L1.5 tag tree and the session status bar are all
|
|
678
|
+
that space's only — switching spaces cannot blend views or contexts.
|
|
679
|
+
- **Regulated cross-space flow (UI_TASK_3)**: check memories in the current space →
|
|
680
|
+
`移动到…` → dialog step 1 states `即将向 [目标空间] 发起迁移请求` → step 2 is the
|
|
681
|
+
SECOND explicit consent (`二次确认 · 安全红线`, with the cut warning when 剪切) →
|
|
682
|
+
only then is `user_approved: true` sent. Target is a dropdown of known spaces,
|
|
683
|
+
never a free-text id.
|
|
684
|
+
- `h(StorageMigratorUI)` is a separate component, so the two state machines can no
|
|
685
|
+
longer share draft state or validation.
|
|
686
|
+
|
|
687
|
+
### Added — backend routing
|
|
688
|
+
|
|
689
|
+
- **`GET/POST /api/hippocampus/spaces`**: list the router's spaces / create an empty
|
|
690
|
+
one (`space_id`). The selector and `+ 新建空间` use it.
|
|
691
|
+
- **`?space=<id>` on `/api/hippocampus/stats` and `/api/hippocampus/graph`**:
|
|
692
|
+
`runtime.uiPayload(spaceId)` / `runtime.graphPayload(spaceId)` return that space's
|
|
693
|
+
panel/graph via `Memory.status({ targetSpaceId })` and
|
|
694
|
+
`Memory.graphForSpace({ targetSpaceId })`; a new space reports zeros (empty), so a
|
|
695
|
+
switched view is never a fallback to the default store.
|
|
696
|
+
- `Memory.ensureSpace()` (root router) and `runtime.spaceList()`.
|
|
697
|
+
- Panel status `panel.spaces.current` now reports the SELECTED space (was always
|
|
698
|
+
`default`), and `stats`/`graph` responses carry a top-level `spaceId`.
|
|
699
|
+
|
|
700
|
+
### Security (unchanged red line, stricter transport)
|
|
701
|
+
|
|
702
|
+
- The HTTP transfer route no longer fabricates consent: it forwards
|
|
703
|
+
`user_approved` from the request and the ENGINE gate rejects a request that lacks
|
|
704
|
+
it with `MEM_E_REQUIRE_USER_CONSENT`. The UI only sets the flag after step 2. An
|
|
705
|
+
agent tool call and a raw POST that "bypasses the UI" therefore hit the same
|
|
706
|
+
wall.
|
|
707
|
+
- `dataDir` migration Fail-Fast strengthened: `validateMigrationPaths` now also
|
|
708
|
+
rejects an existing non-empty target (`MEM_E_MIGRATION_TARGET_BUSY`) and a
|
|
709
|
+
non-directory target (`MEM_E_MIGRATION_PATH`) synchronously, before a 202/job.
|
|
710
|
+
The old store remains authoritative on any rejection.
|
|
711
|
+
|
|
712
|
+
### Tests
|
|
713
|
+
|
|
714
|
+
- New `test/v152.refactor.test.js` (7 tests): dataDir validation matrix
|
|
715
|
+
(missing/relative/same/inside/root/non-empty/non-dir) + `startMigration`
|
|
716
|
+
fail-fast with the old dir intact; space isolation for stats/graph/memories/
|
|
717
|
+
session/recall with `?space=`; `ensureSpace` empty space + spaces route;
|
|
718
|
+
unauthorized transfer blocked at engine AND HTTP, authorized passes; UI wiring
|
|
719
|
+
(SpaceSelector header mount, checkbox flow, no manual inputs, isolated
|
|
720
|
+
StorageMigratorUI).
|
|
721
|
+
- Updated contract assertions: HTTP routes 6 → 7 (spaces), transfer route requires
|
|
722
|
+
explicit `user_approved`, settings order now context → space/session → system
|
|
723
|
+
storage, cut second-confirmation now lives in the panel dialog, manifest 1.5.2.
|
|
724
|
+
- Full suite: **270 tests, 270 pass, 0 fail**.
|
|
725
|
+
|
|
726
|
+
## [1.5.1] — 2026-11-02
|
|
727
|
+
|
|
728
|
+
**Security patch: cross-space transfer now requires EXPLICIT user consent.** Moving
|
|
729
|
+
memories between spaces is a data-egress action, not a memory optimisation. Two
|
|
730
|
+
independent locks (prompt + engine), plus a human-only UI path. **263 tests green**
|
|
731
|
+
(was 254).
|
|
732
|
+
|
|
733
|
+
### Added
|
|
734
|
+
|
|
735
|
+
- **Prompt red line (`memory:policy`)**: a static `【🚨最高安全红线】` block forbids
|
|
736
|
+
the model from calling `memory_space_transfer` / `memory_transfer_to_global` on
|
|
737
|
+
its own judgement, sympathy, or "better cross-device sharing". The only allowed
|
|
738
|
+
trigger is a direct user command in the current conversation; when unsure the
|
|
739
|
+
model must ask `您需要我把这条信息同步到其他空间吗?`. It also documents the
|
|
740
|
+
`user_approved: true` retry protocol for `MEM_E_REQUIRE_USER_CONSENT` and states
|
|
741
|
+
that the intercept is never a one-off obstacle to bypass.
|
|
742
|
+
- **`memory_transfer_to_global` tool**: copy/move memories from a space into the
|
|
743
|
+
canonical `global` space, with the same privacy screen, raw_turn stripping, fresh
|
|
744
|
+
target ids and consent gate as `memory_space_transfer`. Both tool schemas expose
|
|
745
|
+
`user_approved` and their descriptions carry the security warning.
|
|
746
|
+
- **`context.requireExplicitConsentForTransfer`** (default **true**, validated
|
|
747
|
+
boolean, HTTP-editable and exposed in the settings page): the operator's master
|
|
748
|
+
switch for the engine gate. The settings toggle explains the risk.
|
|
749
|
+
- **`GET /api/hippocampus/memories`** (`limit`, `space`): bounded recent-memory
|
|
750
|
+
projection (`eventId`, `day`, `tags`, `snippet`) used by the panel's per-memory
|
|
751
|
+
detail rows. `Memory.recentMemories()` is read-only and index-snapshot based.
|
|
752
|
+
- **UI per-memory 分享/转移 button**: the panel now lists the 20 most recent
|
|
753
|
+
memories with a human-initiated transfer dialog (target space, copy/cut toggle,
|
|
754
|
+
second confirmation for cut). It calls the transfer route directly — **bypassing
|
|
755
|
+
the model entirely** — and the browser request is the consenting human.
|
|
756
|
+
|
|
757
|
+
### Fixed / Security
|
|
758
|
+
|
|
759
|
+
- `Memory.transferEvents()` now throws
|
|
760
|
+
**`MEM_E_REQUIRE_USER_CONSENT`** with the fixed message
|
|
761
|
+
`[系统拦截] 跨空间传递需要用户明确授权。请向用户确认后再试。` when
|
|
762
|
+
`context.requireExplicitConsentForTransfer` is true and the call does not carry
|
|
763
|
+
`userApproved === true`. The gate runs **before** space ids are validated, before
|
|
764
|
+
any store is opened, before content is read and before any pending-delete record
|
|
765
|
+
is written, so a refused call is provably side-effect free.
|
|
766
|
+
- `POST /api/hippocampus/transfer` is documented and implemented as the **human
|
|
767
|
+
channel**: it marks `userApproved: true` itself (same-origin authenticated
|
|
768
|
+
browser request). The agent half cannot reach HTTP routes, so a UI click needs no
|
|
769
|
+
model involvement and a model call still hits the gate.
|
|
770
|
+
- The consent gate is strict: `userApproved` must be the boolean `true`; the
|
|
771
|
+
config value must be a boolean (a string like `"yes"` fails fast).
|
|
772
|
+
|
|
773
|
+
### Tests
|
|
774
|
+
|
|
775
|
+
- New `test/v151.consent.test.js` (9 tests): default-on config + fail-fast type
|
|
776
|
+
check; engine gate fires before validation/IO (invalid target still answers
|
|
777
|
+
CONSENT, nothing parked, source untouched); agent tool blocked then succeeds only
|
|
778
|
+
with `user_approved: true`; `memory_transfer_to_global` same contract; explicit
|
|
779
|
+
config opt-out; engine-level facade contract; prompt red-line markers; HTTP route
|
|
780
|
+
marks consent; UI 分享/转移 + direct-API contract.
|
|
781
|
+
- Intentional contract growth updates: tools 9 → 10, HTTP routes 5 → 6, v150 UI
|
|
782
|
+
route/transfer assertions extended with `userApproved`, manifest 1.5.1.
|
|
783
|
+
- Full suite: **263 tests, 263 pass, 0 fail**.
|
|
784
|
+
|
|
785
|
+
## [1.5.0] — 2026-11-02
|
|
786
|
+
|
|
787
|
+
Tag-explosion defence, physical multi-space routing, session handoff and the
|
|
788
|
+
cross-space transfer API. The plugin stays deliberately permission-free: the
|
|
789
|
+
complex permission choreography belongs to the future Orchestrator plugin, while
|
|
790
|
+
this engine owns only physical memory. **253 tests green** (was 200).
|
|
791
|
+
|
|
792
|
+
### Added — module 1: tag-explosion defence (P0)
|
|
793
|
+
|
|
794
|
+
- **`index.maxPostingsPerTag` (default 500, 1–100000)**: derives the inverted index
|
|
795
|
+
with a hard physical cap per tag. When a tag exceeds it, the retained pointers are
|
|
796
|
+
chosen by `salience desc -> eventTime desc -> eventId asc` and re-sorted for
|
|
797
|
+
retrieval (`eventTime desc`, then id). `eventCount`, `mass` and `lastSeen` are
|
|
798
|
+
still aggregated over **all** events, so the counts the degradation layer reports
|
|
799
|
+
are honest; only the in-memory posting pointers are dropped (the JSONL log is
|
|
800
|
+
untouched and rebuildable). Tags expose `postingsLimit` / `postingsTruncated` /
|
|
801
|
+
`postingsDropped`; index stats expose `postingsTruncated` / `postingsDropped`.
|
|
802
|
+
- **Recall degradation for oversized tags**: an EXPLICIT query tag holding more than
|
|
803
|
+
50 memories (`TAG_OVERFLOW_THRESHOLD`) is not expanded into the candidate pool.
|
|
804
|
+
The response carries `oversizedTagHints: [{ tag, total, code:
|
|
805
|
+
'MEM_E_TAG_OVERFLOW', hint: '[系统提示] 发现关于 [tag] 的记忆共 N 条,数据量过大。
|
|
806
|
+
请提供更精确的 startTime/endTime 或使用 deep_raw 查阅。', window }]` and the
|
|
807
|
+
course-block fallback is suppressed so the flood cannot re-enter through the back
|
|
808
|
+
door. If the caller insists (a second recall on the same tag), only the **3 most
|
|
809
|
+
recent** summaries are returned (`oversizedRecent: true`,
|
|
810
|
+
`oversized-tag-recent:3`). Graph neighbours of an oversized tag are never woken.
|
|
811
|
+
- **`deep_raw` super-tag gate**: a query touching a tag with more than 500
|
|
812
|
+
associations (`SUPER_TAG_THRESHOLD`) without `start_time`/`end_time` now throws
|
|
813
|
+
**`MEM_E_TIME_RANGE_REQUIRED`** (narrow queries keep the old
|
|
814
|
+
`MEM_E_INVALID_INPUT` contract). One authority decides: the tool no longer
|
|
815
|
+
pre-validates the window.
|
|
816
|
+
|
|
817
|
+
### Added — module 2: multi-space routing & session handoff (physical layer)
|
|
818
|
+
|
|
819
|
+
- **Config** `context.autoSpaceFollow` (false), `context.autoRolloverEnabled`
|
|
820
|
+
(true), `context.autoRolloverThreshold` (0.85, 0.5–0.99),
|
|
821
|
+
`context.nativeTokenLimit` (8000, 512–1000000) — validated fail-fast, editable
|
|
822
|
+
over HTTP and in the UI.
|
|
823
|
+
- **`SpaceRouter`** (`src/spaces/spaceRouter.js`): `targetSpaceId` on
|
|
824
|
+
`remember`/`recall` routes to an isolated physical store
|
|
825
|
+
(`<dataDir>/spaces/<id>`, `default` = the existing store, so every old path is
|
|
826
|
+
byte-identical). One FIFO promise chain **per space**: same-space operations are
|
|
827
|
+
serialised, different spaces run concurrently (a single global lock would
|
|
828
|
+
reintroduce the cross-space stalls spaces exist to remove). Ids become directory
|
|
829
|
+
names, so `^[a-z0-9][a-z0-9._-]{0,63}$` is enforced and a typo fails with
|
|
830
|
+
`MEM_E_INVALID_INPUT` instead of silently writing into the default space.
|
|
831
|
+
`runMany` acquires in sorted order (no ABBA deadlock).
|
|
832
|
+
- **Qwen native fidelity**: `ContextEngine.nativeState()` reports
|
|
833
|
+
`mode: 'native' | 'layered'`; below `nativeTokenLimit` nothing is folded (folding
|
|
834
|
+
is a layered-mode operation), above it the L1.5 layered fold runs. The legacy
|
|
835
|
+
`maxTokens` paging threshold is untouched.
|
|
836
|
+
- **Automatic handoff (转生)**: when the session reaches
|
|
837
|
+
`autoRolloverThreshold x nativeTokenLimit`, the tail is distilled into ONE durable
|
|
838
|
+
L1.5 summary (`status:handoff`), `state/handoff.json` is marked active and the
|
|
839
|
+
`memory-state` prompt appends `[交接标记] … 本插件不能保证一个会话永生不死,只能
|
|
840
|
+
保证人格不死。`. A new session consumes the marker. Handoffs are idempotent (one
|
|
841
|
+
summary per handoff) and self-trigger from the `session/event` stream and from
|
|
842
|
+
tool boundaries. With `autoRolloverEnabled: false` no marker is written and
|
|
843
|
+
ContextEngine force-evicts at 95% (`reason: 'native-force'`, down to
|
|
844
|
+
`target x nativeTokenLimit`).
|
|
845
|
+
- **Panel/status**: `panel.session` (`mode`, `tokens`, `nativeTokenLimit`,
|
|
846
|
+
`threshold`, `remainingTokens`, `rolloverEnabled`, `handoffActive`, …) and
|
|
847
|
+
`panel.spaces` (`current`, `ids`, `open`) are part of the UI contract.
|
|
848
|
+
|
|
849
|
+
### Added — module 3: atomic cross-space transfer
|
|
850
|
+
|
|
851
|
+
- **`memory_space_transfer` tool** (`event_ids`, `target_space_id`,
|
|
852
|
+
`transfer_mode: 'copy' | 'move'` default copy, optional `source_space_id`) and
|
|
853
|
+
`Memory.transferEvents()`.
|
|
854
|
+
- **Safety rails enforced by the engine, not the caller**: privacy screening aborts
|
|
855
|
+
the whole batch with **`MEM_E_PRIVACY_BLOCKED`** (ID cards, CN phones, bank cards,
|
|
856
|
+
emails, credential assignments, PEM private keys; matched bytes never leave the
|
|
857
|
+
scanner) before any write; `raw_turn` / `rawTurn` / `raw_*` pointers are stripped
|
|
858
|
+
from meta at every depth; the TARGET space regenerates `event_id`s
|
|
859
|
+
(`dedupe:false`, never reuses the source identity) and tags copies
|
|
860
|
+
`transferred:from:<source>` + `transferred:to:<target>`.
|
|
861
|
+
- **State difference**: `copy` leaves the source untouched (`state: 'retained'`);
|
|
862
|
+
`move` parks the source ids in the **two-phase pending_delete queue**
|
|
863
|
+
(`state: 'pending_delete'`, `dueAt`, cancellable with `restore`) only after every
|
|
864
|
+
target write succeeded — never a direct physical delete, and a partial target
|
|
865
|
+
failure leaves the source untouched.
|
|
866
|
+
- **HTTP**: `POST /api/hippocampus/transfer` (same-origin, validated body) for the
|
|
867
|
+
UI migration button.
|
|
868
|
+
|
|
869
|
+
### Added — module 4: UI
|
|
870
|
+
|
|
871
|
+
- **Space panel**: soft-follow toggle (`context.autoSpaceFollow`), auto-rollover
|
|
872
|
+
toggle, trigger-ratio slider, native-window field, single-tag index cap control,
|
|
873
|
+
and a live status bar: `[当前: 原生模式 | 剩余 X Tokens 触发交接]` (also
|
|
874
|
+
`分层折叠` / `已交接` variants).
|
|
875
|
+
- **Migration interaction**: copy/cut (复制/剪切) toggle next to the transfer button;
|
|
876
|
+
choosing 剪切 requires a **second confirmation warning** before any request is
|
|
877
|
+
sent.
|
|
878
|
+
- **Philosophy footer** (bold, bottom of the settings page): **本插件不能保证一个
|
|
879
|
+
会话永生不死,只能保证人格不死。**
|
|
880
|
+
- **Subtraction**: the tag search box uses the host-native Enter key only — no
|
|
881
|
+
debounce, no timer, no effect. `filterGraphByQuery` is pure and testable; the
|
|
882
|
+
force layout is not re-run by filtering.
|
|
883
|
+
|
|
884
|
+
### Changed
|
|
885
|
+
|
|
886
|
+
- `uiConfig` exposes `index`; `Memory.applyLiveConfig()` projects a validated config
|
|
887
|
+
onto the facade **and every open child space**, including the context engine's
|
|
888
|
+
native/rollover overrides.
|
|
889
|
+
- `Memory` opens child spaces lazily with the same policy input; `close()` closes
|
|
890
|
+
children first; a child failure never blocks the rest.
|
|
891
|
+
- The `memory-state` prompt only gains the handoff block when a marker is active,
|
|
892
|
+
so the cache-stable prefix is unchanged in the common case.
|
|
893
|
+
|
|
894
|
+
### Tests
|
|
895
|
+
|
|
896
|
+
- New files: `v150.index.test.js` (truncation/degradation/super-tag gate),
|
|
897
|
+
`v150.space.test.js` (per-space concurrency, native boundary, forced eviction),
|
|
898
|
+
`v150.transfer.test.js` (copy/move state difference, privacy, raw_turn strip,
|
|
899
|
+
fresh ids), `v150.ui.test.js` (bundle contract, helpers, no debounce, footer,
|
|
900
|
+
transfer route), `v150.lifecycle.test.js` (Qwen mode, threshold handoff, marker
|
|
901
|
+
consumption, `targetSpaceId` isolation, ninth tool surface),
|
|
902
|
+
`v150.config.test.js` (new groups, ranges, HTTP editability).
|
|
903
|
+
- Intentional contract updates in old tests: 8 -> 9 tools, 4 -> 5 routes,
|
|
904
|
+
`panel.session`/`panel.spaces` added to the panel snapshot, manifest 1.5.0.
|
|
905
|
+
- Full suite: **253 tests, 253 pass, 0 fail** (old 200 cases included unchanged).
|
|
906
|
+
|
|
907
|
+
## [1.4.3] — 2026-11-02
|
|
908
|
+
|
|
909
|
+
Two measured blockers from the 2026-11-02 handoff, both fixed and locked by tests.
|
|
910
|
+
|
|
911
|
+
### Added
|
|
912
|
+
|
|
913
|
+
- **`raw.maxScanTurns` config (500–50000, default 5000)**: `deep_raw`'s scan budget
|
|
914
|
+
was a hidden constant and is now a validated, UI-editable knob (`raw.maxScanTurns`).
|
|
915
|
+
- **`stage()` / `commitMany()`**: remember is now a `stage -> commitMany` composition.
|
|
916
|
+
`stage()` validates and builds a record (identity + idempotency, no log/index I/O);
|
|
917
|
+
`commitMany()` performs ONE durable append, ONE ledger checkpoint and ONE index
|
|
918
|
+
delta for a whole batch. `bulkIngest` uses it, so a 50-item chunk is one write
|
|
919
|
+
instead of 50.
|
|
920
|
+
- **`memory-state` prompt is now composed** via `composePrompt`: stable rules →
|
|
921
|
+
`[Memory Map]` (active tags + counts) → `[Memory Blocks]` (the only per-turn
|
|
922
|
+
volatile tail). The old single-line `briefing()` is no longer the prompt body
|
|
923
|
+
(it changed on every write and broke the prefix cache). Full-chain tests lock the
|
|
924
|
+
prefix to be byte-identical before/after a recall injects a block.
|
|
925
|
+
- **`scripts/confidence-ab.mjs`**: local A/B benchmark for `context.minInjectConfidence`
|
|
926
|
+
(100 noise + 10/3 relevant; characters, hits, low-confidence hints, mis-degraded
|
|
927
|
+
relevant memories). Run it with `node scripts/confidence-ab.mjs`.
|
|
928
|
+
- **Crash-restart test**: kills the process inside the 200ms checkpoint window
|
|
929
|
+
(cancelled timer, no `close()`), reopens the same directory, and asserts the fresh
|
|
930
|
+
instance reports `stale` (`unflushed-bytes`), rebuilds the index and can recall the
|
|
931
|
+
unflushed tail.
|
|
932
|
+
|
|
933
|
+
### Fixed
|
|
934
|
+
|
|
935
|
+
- **`injectRecall()` crashed on any L3 semantic hit**: it used `summary.id` while
|
|
936
|
+
`rankSemantic()` returns `summaryId`, so a recall with a distilled summary and
|
|
937
|
+
`context.injectPrompt` failed with `MEM_E_IO: ContextEngine.inject requires an id`.
|
|
938
|
+
Now it uses `summaryId ?? id` and skips invalid summaries. Found by the new
|
|
939
|
+
prompt/tag-tree full-chain test.
|
|
940
|
+
- `logStore.status()` now exposes `unflushedBytes` (shard size minus manifest bytes)
|
|
941
|
+
so an unclean shutdown cannot hide the uncheckpointed tail behind equal counters.
|
|
942
|
+
|
|
943
|
+
### Changed
|
|
944
|
+
|
|
945
|
+
- **`deep_raw` scans NEWEST-FIRST** (per shard, tail to head). The old head-first
|
|
946
|
+
scan burned its whole budget on the oldest 5000 turns of a day file — in a 10k
|
|
947
|
+
shard the newest turn could never be found. A hit beyond the window now returns
|
|
948
|
+
`truncated: true` with a note instead of pretending the turn does not exist.
|
|
949
|
+
- **Buffered log append**: the hot path keeps one append handle without fsync +
|
|
950
|
+
manifest rewrite per record. A 200ms checkpoint (and `close()`, and any
|
|
951
|
+
rewrite/compaction) fsyncs and publishes the manifest; `status().unflushedBytes`
|
|
952
|
+
plus the boot check make a mid-burst crash visible as stale instead of silently
|
|
953
|
+
"up to date".
|
|
954
|
+
- **Identity ledger checkpoint is debounced** (500ms / `close()`): it is a derived
|
|
955
|
+
startup hint rebuilt from the log, so rewriting it per append was pure O(n²) cost.
|
|
956
|
+
- **Index appends are lazy**: `applyRecords` records the delta and marks the view
|
|
957
|
+
dirty; the next `snapshot()` folds it once. N writes cost one index build, and
|
|
958
|
+
read-your-writes still holds because the fold happens on the read path.
|
|
959
|
+
- **Briefing is dirty-driven**: a write marks the prompt-state line stale; the next
|
|
960
|
+
`briefing()` / panel poll rebuilds it once instead of every append.
|
|
961
|
+
|
|
962
|
+
### Measured
|
|
963
|
+
|
|
964
|
+
- Sequential `memory.remember` x1000: **119/s -> 9104/s** (8.4s -> 110ms).
|
|
965
|
+
- 10,000-line raw shard, newest query: **0 hits -> 1 hit** (`deep_raw` now starts at
|
|
966
|
+
the tail; hash restore and redaction regression-guarded).
|
|
967
|
+
- **`deep_raw` tail-scan bias documented**: beyond `raw.maxScanTurns` (default 5000)
|
|
968
|
+
per shard, only the newest N turns are covered; older history needs a larger budget
|
|
969
|
+
or time-window pagination (`end_time` moved backwards). `truncated: true` + notes
|
|
970
|
+
always say so.
|
|
971
|
+
- **Confidence A/B (measured)**: `minInjectConfidence=0.6` cuts the tool payload by
|
|
972
|
+
**49.7%** (10 relevant / 100 noise) and **75.8%** (3 relevant / 100 noise), with
|
|
973
|
+
**0 relevant hits mis-degraded**; the prompt window only shrinks when the top-8
|
|
974
|
+
contains noise (0% vs 59.7% in the two scenarios), so the honest claim is
|
|
975
|
+
"long-tail payload + anti-hallucination", not "always fewer prompt tokens".
|
|
976
|
+
- 197 tests green (was 189); after the prompt/tag-tree full-chain wiring and the
|
|
977
|
+
crash-restart test: **200**.
|
|
978
|
+
|
|
979
|
+
## [1.4.2] — 2026-11-01
|
|
980
|
+
|
|
981
|
+
### Added
|
|
982
|
+
|
|
983
|
+
- **L1.5 标签层级树**: hierarchical tags (`tech/frontend/vue3`) now have a
|
|
984
|
+
three-level lifecycle — immortal roots, leaves that die when their reference
|
|
985
|
+
count reaches zero, and mids that enter a grace window when they lose their last
|
|
986
|
+
child. A mid inside that window is a **ghost**: it can be revived by a new leaf,
|
|
987
|
+
and it is what the UI's history view shows. The tree is a **derived cache**
|
|
988
|
+
(`state/tag-tree.json`) built by `maintain()` from the converged index; the
|
|
989
|
+
previous cache is carried forward (`refCount = 0`, orphans dropped) so the
|
|
990
|
+
lifecycle is observable across maintenance runs. Deleting the file loses only
|
|
991
|
+
ghost history.
|
|
992
|
+
- **Bounded prune queue**: dead leaves are queued and consumed one
|
|
993
|
+
`tagTree.pruneBatchSize` batch per maintenance run; the remaining queue is
|
|
994
|
+
persisted in the same atomic write, so a 10k-leaf storm drains across runs
|
|
995
|
+
instead of causing a maintenance storm.
|
|
996
|
+
- **Anti-hallucination recall degradation**: a `memory_recall` hit reached only
|
|
997
|
+
through a fading mid is **removed from `hits` entirely** (body, snippet and score
|
|
998
|
+
never reach the model or the prompt window) and replaced by one metadata hint per
|
|
999
|
+
mid: path, count, remaining grace days and the exact `deep_raw` time window. A
|
|
1000
|
+
query that names a fading mid with no live episode returns a `count: 0` hint
|
|
1001
|
+
instead of silence.
|
|
1002
|
+
- **`panel.tagTree`**: node/root/mid/leaf/ghost/queue counts for the Web panel, and
|
|
1003
|
+
`GET /api/hippocampus/graph` now returns `tagTree.ghosts` in the same response as
|
|
1004
|
+
the cached graph.
|
|
1005
|
+
- **UI**: `tagTree.*` sliders with numeric boxes and hover tooltips in the settings
|
|
1006
|
+
section; ghost nodes rendered in the force graph as translucent dashed circles
|
|
1007
|
+
hanging under their parent root, with a `仅活跃 / 历史全貌` toggle that cross-fades
|
|
1008
|
+
them via CSS opacity (the force layout does not re-run when toggling).
|
|
1009
|
+
- **Config `tagTree` group** (fail-fast, editable over HTTP and in the UI):
|
|
1010
|
+
`midHalfLifeMultiplier` (1–10), `midGracePeriodDays` (7–180),
|
|
1011
|
+
`pruneBatchSize` (10–500), `leafDecayFloor` (0–1). `midHalfLifeMultiplier` is the
|
|
1012
|
+
only source of the mid half-life — no silent hard-coded lifetime.
|
|
1013
|
+
|
|
1014
|
+
### Changed
|
|
1015
|
+
|
|
1016
|
+
- `maintain()` now rebuilds/prunes/persists the tag tree after the index
|
|
1017
|
+
generation converges; a tag-tree failure is reported as `report.tagTreeError`
|
|
1018
|
+
and can never fail maintenance or block recall.
|
|
1019
|
+
- `applyConfig` now projects the validated config onto the running `Memory` facade,
|
|
1020
|
+
so live UI edits (raw limits, tagTree lifetimes, …) actually reach the running
|
|
1021
|
+
objects instead of waiting for a reload.
|
|
1022
|
+
- `pruneBatch` re-derives decay against the pass's `now` (a frozen build-time score
|
|
1023
|
+
made grace windows meaningless), rejects `O(mids × nodes)` rescans, and keeps
|
|
1024
|
+
parent child counts truthful when a mid dies.
|
|
1025
|
+
|
|
1026
|
+
## [1.4.1] — 2026-11-01
|
|
1027
|
+
|
|
1028
|
+
### Added
|
|
1029
|
+
|
|
1030
|
+
- **Prompt discipline (soft interception)**: a static `memory:policy` section tells
|
|
1031
|
+
the model to prefer `memory_recall` for history/files/system facts, and to treat
|
|
1032
|
+
a `[Slimmed]` response as an invitation to answer from the summary unless the
|
|
1033
|
+
`recovery_hash` must be dereferenced.
|
|
1034
|
+
- **Own-tool output slimming**: `memory_recall`/`memory_admin` responses over the
|
|
1035
|
+
budget (default 2000 tokens) are captured to raw first, then returned as
|
|
1036
|
+
`{slimmed, summary, topics, key_entities, recovery_hash, hint}`; the hint points
|
|
1037
|
+
at `memory_recall(mode="deep_raw", hash=…)`, which restores the exact payload.
|
|
1038
|
+
- **Retrieval confidence**: hits below `context.minInjectConfidence` (default 0.6)
|
|
1039
|
+
carry a short hint instead of their full body, plus a `low-confidence-hints:N` note.
|
|
1040
|
+
- **Write flood guard**: writes above 80% of `storageBudgetMb` throw
|
|
1041
|
+
`MEM_E_WRITE_FLOOD`; `memory.bulkIngest` chunks 50 items per await and ships as
|
|
1042
|
+
`memory_bulk_ingest`.
|
|
1043
|
+
- **raw.captureRatio** (0 | 0.5 | 1): deterministic sampling by content hash;
|
|
1044
|
+
ratio 0 disables capture and `deep_raw` returns an explicit warning.
|
|
1045
|
+
|
|
1046
|
+
### Changed
|
|
1047
|
+
|
|
1048
|
+
- `memory_recall` gains `hash` (exact raw restore) and confidence fields; deep_raw
|
|
1049
|
+
results honour the token budget before returning.
|
|
1050
|
+
- `promptLayout` composes stable rules → memory map → `[Memory Blocks]` tail.
|
|
1051
|
+
|
|
1052
|
+
## [1.4.0] — 2026-10-31
|
|
1053
|
+
|
|
1054
|
+
### Added
|
|
1055
|
+
|
|
1056
|
+
- **Raw-turn forensics (`memory_capture`, `memory_recall mode:"deep_raw"`)**: a
|
|
1057
|
+
separate day-sharded JSONL store (`raw/`) that is never indexed, never loaded at
|
|
1058
|
+
boot, and never touched by normal recall. Gated by `raw.mode` (default
|
|
1059
|
+
`salience`: high-salience, code, stack traces, tool output, or `force`), deduped
|
|
1060
|
+
by content hash, secret-redacted, and capped by `maxTurnKb` (head+tail
|
|
1061
|
+
truncation), `maxBytesPerDay`, `maxTotalMb`, and `retentionDays` (pruned by
|
|
1062
|
+
maintenance; code shards keep 90 days). `deep_raw` scans newest→oldest under a
|
|
1063
|
+
byte/turn budget and reports `truncated: true` instead of pretending it saw
|
|
1064
|
+
everything.
|
|
1065
|
+
- **Spaced repetition**: engine-owned schedule (`1,2,4,7,15,30` days) persisted in
|
|
1066
|
+
`state/reviews.json`; `maintain()` reconciles due items and `reinforce` advances
|
|
1067
|
+
the step. Exposed as `memory_admin action="reviews"`.
|
|
1068
|
+
- **Two-phase delete**: `forget` parks the event for `delete.graceHours`
|
|
1069
|
+
(default 24) in `pending_deletes`; `restore` cancels it, and `maintain()`
|
|
1070
|
+
promotes expired requests into the 4-phase pipeline. Unknown ids now fail
|
|
1071
|
+
immediately, before parking.
|
|
1072
|
+
- **UI data-dir migration**: `dataDir` is editable in the settings page. Saving it
|
|
1073
|
+
takes `.migration.lock`, returns HTTP 202 with `state=migrating`, copies with
|
|
1074
|
+
`fs.promises.cp` in the background, verifies `recordCount` on both sides, and
|
|
1075
|
+
only then switches and reloads the store. A mismatch removes the target and
|
|
1076
|
+
keeps the old store authoritative; the source is never deleted.
|
|
1077
|
+
- New config groups: `raw.*`, `delete.graceHours`, `review.enabled`,
|
|
1078
|
+
`migration.timeoutMs` (all fail-fast validators, UI tooltips included).
|
|
1079
|
+
- **Raw-turn black box (minimal schema)**: each line is exactly
|
|
1080
|
+
`{turn_id, timestamp, role, content}` — no tags, salience, decay, event ids,
|
|
1081
|
+
graph links, session ids or metadata. Addressing is by `(day file, line number)`;
|
|
1082
|
+
append-only keeps lines stable (the one lawful line-pointer exception).
|
|
1083
|
+
Writes are queued and flushed in batches (10 records / 1s), never sync.
|
|
1084
|
+
- **Read-side redaction**: the shard keeps 100% plaintext (forensic integrity);
|
|
1085
|
+
secrets are redacted when `deep_raw` returns snippets, before any text reaches a
|
|
1086
|
+
model prompt. README states local storage is plaintext.
|
|
1087
|
+
- **Tombstones**: a committed purge appends `raw_tombstone {hash, timestamp}`;
|
|
1088
|
+
scans skip tombstoned content hashes (no resurrection).
|
|
1089
|
+
- **deep_raw constraints**: `start_time` and `end_time` are mandatory (missing →
|
|
1090
|
+
`MEM_E_INVALID_INPUT`), results are capped by `raw.maxResultTokens` (default
|
|
1091
|
+
1000) and carry the truncation notice when cut.
|
|
1092
|
+
- **TTL**: maintenance deletes whole day files strictly older than
|
|
1093
|
+
`today - raw.retentionDays`; today's shard is never touched. Raw bytes are
|
|
1094
|
+
surfaced as `panel.storage.rawBytes` and counted in the dashboard ring.
|
|
1095
|
+
- **Automatic raw capture**: the plugin subscribes to `dsh-session`'s
|
|
1096
|
+
`session/event` and stores every user/assistant surface message verbatim
|
|
1097
|
+
(`raw.autoCapture: true`). The Host-injected `Current runtime context.` block is
|
|
1098
|
+
stripped out of `content` and kept (truncated) in `metadata.runtimeContext`, so
|
|
1099
|
+
`deep_raw` stays signal-clean. Tool output is opt-in (`raw.captureTools: false`),
|
|
1100
|
+
**except failed tool results** (`isError`), which are always captured as
|
|
1101
|
+
`kind: "error"`. Budgets, dedupe and retention still apply.
|
|
1102
|
+
|
|
1103
|
+
### Changed
|
|
1104
|
+
|
|
1105
|
+
- Panel adds `raw`, `reviews`, and `pendingDeletes`; the settings page renders a
|
|
1106
|
+
migration progress card while `state=migrating`.
|
|
1107
|
+
- `Memory._scheduler` cron now reads `runtime.config` per tick, so a hot config
|
|
1108
|
+
update changes the schedule without a restart.
|
|
1109
|
+
|
|
1110
|
+
## [1.3.1] — 2026-10-30
|
|
1111
|
+
|
|
1112
|
+
### Fixed
|
|
1113
|
+
|
|
1114
|
+
- **Cold-start 404 (root cause)**: `webServer` is provided by the web-app row, which
|
|
1115
|
+
activates *after* this plugin's `apply()`. The old code called
|
|
1116
|
+
`ctx.get('webServer')` once and silently skipped registration when it was
|
|
1117
|
+
absent — every cold start had no routes, while a warm reload worked. Route
|
|
1118
|
+
registration now lives in `ctx.inject(['webServer'], child => …)`, so the child
|
|
1119
|
+
fiber activates the moment the service appears and the routes are always
|
|
1120
|
+
mounted. Verified live (404 → 200) and covered by a deferred-inject test.
|
|
1121
|
+
- **Front-end death spiral**: a bodiless 404 used to be synthesized into a JSON
|
|
1122
|
+
error, which the old retry counter treated as a protocol failure and gave up
|
|
1123
|
+
after six attempts. `getJson` now keeps "no JSON" distinct, and the pure
|
|
1124
|
+
`decideRetry` policy retries bodiless 404s with exponential backoff (capped at
|
|
1125
|
+
5s) for up to 10 minutes before surfacing `MEM_E_BOOT_TIMEOUT` with a manual
|
|
1126
|
+
reconnect button.
|
|
1127
|
+
- **Diagnostics**: `apply()` prints `[Hippocampus] Route registered at <iso>
|
|
1128
|
+
(<paths>) phase=<phase>` when the routes are mounted, and
|
|
1129
|
+
`[Hippocampus] Route registration FAILED: <reason>` if the service never
|
|
1130
|
+
provides one.
|
|
1131
|
+
|
|
1132
|
+
## [1.3.0] — 2026-10-30
|
|
1133
|
+
|
|
1134
|
+
### Added
|
|
1135
|
+
|
|
1136
|
+
- **Context folding (推币机)**: blocks evicted from the context window are no longer
|
|
1137
|
+
dropped. A light rule folds the most recent batch into one `folded_summary`
|
|
1138
|
+
episode tagged `status:folded` — extracting names, task statements and core
|
|
1139
|
+
conclusions — and writes it back to the L1 log.
|
|
1140
|
+
- **Graph association (在线联想)**: when a query touches a tag, retrieval reads the
|
|
1141
|
+
cached graph and pulls that tag's three strongest neighbours into the candidate
|
|
1142
|
+
pool with an explicit `penalty: 0.5`; such hits are marked `association.via` and
|
|
1143
|
+
can never outrank a direct hit.
|
|
1144
|
+
- **Monthly memos (月记)**: `maintain()` condenses a finished natural month into one
|
|
1145
|
+
`status:monthly` episode. Memos do not decay (`decay = 1`) and are pulled in
|
|
1146
|
+
first for fuzzy historical queries ("上个月", "2023-10", "去年" …).
|
|
1147
|
+
|
|
1148
|
+
### Changed
|
|
1149
|
+
|
|
1150
|
+
- HTTP routes are now registered **before** tools, prompts and scheduling inside
|
|
1151
|
+
`apply()`, so a page that wins the boot race hits a live handler answering
|
|
1152
|
+
`state=pending` instead of a 404. The Host-side assumption is documented in the
|
|
1153
|
+
code: `apply()` awaits nothing, and route service is expected once it returns.
|
|
1154
|
+
|
|
1155
|
+
## [1.2.0] — 2026-10-30
|
|
1156
|
+
|
|
1157
|
+
### Added
|
|
1158
|
+
|
|
1159
|
+
- **`memory_checkpoint`** (`task_id`, `progress`, `updated_at`): exactly one active
|
|
1160
|
+
heavy task. A new checkpoint demotes the previous one, one not refreshed for
|
|
1161
|
+
seven days is demoted by `maintain()`, and `memory_admin action="active_task"`
|
|
1162
|
+
reads it straight from the index — the active-set cap of 200 does not apply.
|
|
1163
|
+
- **Multimodal pointers**: `memory_remember` accepts `media_url` (absolute path or
|
|
1164
|
+
http(s) URL) plus `media_type` (`image|video|document|audio`). Inline base64 in
|
|
1165
|
+
`content` is rejected with `MEM_E_INVALID_MEDIA` from 256 consecutive base64
|
|
1166
|
+
characters; 200 characters is still ordinary text.
|
|
1167
|
+
- **`decay.halfLifeDays`** (default 30, 7–365) and **`activeSet.cap`** (default 200,
|
|
1168
|
+
100–1000): both declared in `DEFAULT_CONFIG`, validated fail-fast by
|
|
1169
|
+
`resolveConfig`, projected into `policy`, and editable from the settings page.
|
|
1170
|
+
- **State handshake**: every route response now carries `state`
|
|
1171
|
+
(`pending|in_progress|ready|failed`), and the UI retries on `state` rather than
|
|
1172
|
+
on the HTTP status. A bodiless 404 during boot is treated as `pending` for a
|
|
1173
|
+
120s grace window (the routes are only mounted once the Host runs `apply()`).
|
|
1174
|
+
|
|
1175
|
+
### Changed
|
|
1176
|
+
|
|
1177
|
+
- Writes before READY are refused loudly: `POST /api/hippocampus/config` answers
|
|
1178
|
+
`409` with `MEM_E_NOT_READY` and the current state; tools already answered
|
|
1179
|
+
`MEM_E_NOT_READY`, and their error details now include `state` and `retryable`.
|
|
1180
|
+
- The settings page covers the full editable surface (18 keys), with the documented
|
|
1181
|
+
hints for `storageBudgetMb`, `context.maxTokens`, `decay.halfLifeDays` and
|
|
1182
|
+
`activeSet.cap`; saving before READY is disabled in the UI and rejected by the API.
|
|
1183
|
+
|
|
1184
|
+
## [1.1.0] — 2026-10-29
|
|
1185
|
+
|
|
1186
|
+
### Added
|
|
1187
|
+
|
|
1188
|
+
- **Graph dragging**: nodes are movable with pointer events. The dragged node is
|
|
1189
|
+
pinned for the duration, coordinates are mutated in a ref and painted straight
|
|
1190
|
+
to the DOM (no `setState` per frame), and release unpins it and runs a short
|
|
1191
|
+
alpha relaxation over its 1-hop neighbourhood. A pointer travel under 4px is
|
|
1192
|
+
still a click, so selecting a label can never move the node by accident.
|
|
1193
|
+
- **`storageBudgetMb`** (integer, default 50, range 10–1000): the storage ring's
|
|
1194
|
+
budget is now configurable instead of hard-coded, and the ring recomputes the
|
|
1195
|
+
moment the value is saved.
|
|
1196
|
+
- **Full settings UI**: every editable config key is in the settings section —
|
|
1197
|
+
switches for booleans, bounded number inputs, a select for
|
|
1198
|
+
`identity.eventTimePolicy`, and a text field for the maintenance cron. Saving
|
|
1199
|
+
posts one dotted-path patch through the same fail-fast validator as startup;
|
|
1200
|
+
a rejected value shows a red banner with the `MEM_E_CONFIG_*` code and nothing
|
|
1201
|
+
is applied. A successful save broadcasts `config-changed` so the panel
|
|
1202
|
+
refetches stats and graph immediately.
|
|
1203
|
+
|
|
1204
|
+
### Fixed
|
|
1205
|
+
|
|
1206
|
+
- Dotted config paths deeper than one level (`identity.eventTimePolicy`,
|
|
1207
|
+
`retrieval.topK`) now nest correctly instead of producing a literal key.
|
|
1208
|
+
|
|
1209
|
+
## [1.0.0] — 2026-10-29
|
|
1210
|
+
|
|
1211
|
+
First public release. The package was previously developed under the working
|
|
1212
|
+
names `@local/dsh-memory` / `Layers-Hippocampus`; the data directory is
|
|
1213
|
+
unchanged and legacy folders are migrated automatically.
|
|
1214
|
+
|
|
1215
|
+
### Added
|
|
1216
|
+
|
|
1217
|
+
- **Layers**: append-only event log, rebuildable tag index (A/B generations),
|
|
1218
|
+
day diaries, independent semantic layer, L2.5 trend quarantine with promotion
|
|
1219
|
+
and burst detection.
|
|
1220
|
+
- **Identity discipline**: canonical `content_hash`, `event_id =
|
|
1221
|
+
hash(content_hash + event_time + occurrence_index)`, separate idempotency
|
|
1222
|
+
index, tombstones that survive log compaction.
|
|
1223
|
+
- **Context paging**: token budget, eviction thresholds, cumulative saved-token
|
|
1224
|
+
accounting persisted in `state/context.json`.
|
|
1225
|
+
- **Maintenance**: one gate for cron and Dream (`runtime.runMaintenance`), no
|
|
1226
|
+
queueing and no backfill; a missed window is skipped, not replayed.
|
|
1227
|
+
- **Config fail-fast**: `enableDream`, `dreamIdleMinutes`, `enableReflection`,
|
|
1228
|
+
`graphMaxEdges` (100–2000, default 500), cron, context and temp ranges are
|
|
1229
|
+
validated by `resolveConfig`; HTTP hot updates go through the same validator.
|
|
1230
|
+
- **Async startup state machine** `pending → in_progress → ready | failed`, with
|
|
1231
|
+
`POST /api/hippocampus/retry` and a UI retry banner.
|
|
1232
|
+
- **Offline knowledge graph**: built at the end of `maintain()` from the index
|
|
1233
|
+
(log minus tombstones), per-node Top-N neighbours, global weight order, cached
|
|
1234
|
+
at `state/graph.json`, hard cap 2000 edges.
|
|
1235
|
+
- **Web UI**: sidebar icon, main panel (SVG storage ring, stats, force-directed
|
|
1236
|
+
graph with progressive reveal), and a settings section.
|
|
1237
|
+
- **HTTP API** (same-origin, behind the Host's browser auth):
|
|
1238
|
+
`GET /api/hippocampus/stats`, `GET|POST /api/hippocampus/config`,
|
|
1239
|
+
`GET /api/hippocampus/graph`, `POST /api/hippocampus/retry`.
|
|
1240
|
+
- **Tests**: 106 in-process cases (Node `node:test`) covering identity,
|
|
1241
|
+
retrieval, L2.5, maintenance, migration, routes, graph and the client bundle
|
|
1242
|
+
contract.
|
|
1243
|
+
|
|
1244
|
+
### Security
|
|
1245
|
+
|
|
1246
|
+
- The UI never receives credentials and never calls agent tools; every number is
|
|
1247
|
+
read through the Host's authenticated JSON routes.
|
|
1248
|
+
- The graph route returns at most `graphMaxEdges` edges from a cached file — no
|
|
1249
|
+
query language, no path input.
|
|
1250
|
+
|
|
1251
|
+
[1.0.0]: https://github.com/382quaii/dsh-Layers-Hippocampus/releases/tag/v1.0.0
|