dsh-macro-memory 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +506 -2
- package/cordis.patch.yml +6 -0
- package/lib/client.js +3623 -0
- package/lib/index.js +502 -0
- package/lib/macro/brand.js +82 -0
- package/lib/macro/bridge.js +158 -0
- package/lib/macro/chain.js +206 -0
- package/lib/macro/contract.js +471 -0
- package/lib/macro/cost.js +164 -0
- package/lib/macro/defs/admin.js +442 -0
- package/lib/macro/defs/dream.js +24 -0
- package/lib/macro/defs/link.js +257 -0
- package/lib/macro/defs/project.js +25 -0
- package/lib/macro/defs/read.js +160 -0
- package/lib/macro/defs/remember.js +411 -0
- package/lib/macro/defs/search.js +871 -0
- package/lib/macro/defs/update.js +161 -0
- package/lib/macro/dreamledger.js +1398 -0
- package/lib/macro/facade.js +135 -0
- package/lib/macro/fusion.js +182 -0
- package/lib/macro/linkflow.js +391 -0
- package/lib/macro/links.js +448 -0
- package/lib/macro/neighbor.js +209 -0
- package/lib/macro/panel.js +96 -0
- package/lib/macro/prompt.js +139 -0
- package/lib/macro/provenance.js +148 -0
- package/lib/macro/render.js +35 -0
- package/lib/macro/revisions.js +253 -0
- package/lib/macro/shared.js +113 -0
- package/lib/macro/store.js +103 -0
- package/lib/macro/supersede.js +197 -0
- package/lib/macro/tokencost.js +90 -0
- package/lib/macro/tools.js +67 -0
- package/package.json +54 -4
- package/vendor/VENDOR.json +23 -0
- package/vendor/dsh-memory-nebula/CONTRIBUTING.md +48 -0
- package/vendor/dsh-memory-nebula/LICENSE +21 -0
- package/vendor/dsh-memory-nebula/README.en.md +203 -0
- package/vendor/dsh-memory-nebula/README.md +253 -0
- package/vendor/dsh-memory-nebula/SECURITY.md +43 -0
- package/vendor/dsh-memory-nebula/SUPPORT.md +33 -0
- package/vendor/dsh-memory-nebula/cordis.patch.yml +4 -0
- package/vendor/dsh-memory-nebula/lib/client.js +105 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/index.js +279 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/ingest.js +230 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/meow.js +320 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/notes.js +305 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/sqlite.js +287 -0
- package/vendor/dsh-memory-nebula/lib/host/adapters/util.js +231 -0
- package/vendor/dsh-memory-nebula/lib/host/bridge.js +351 -0
- package/vendor/dsh-memory-nebula/lib/host/compress.js +97 -0
- package/vendor/dsh-memory-nebula/lib/host/demo.js +357 -0
- package/vendor/dsh-memory-nebula/lib/host/diagnostics.js +125 -0
- package/vendor/dsh-memory-nebula/lib/host/doctor.js +270 -0
- package/vendor/dsh-memory-nebula/lib/host/entities.js +230 -0
- package/vendor/dsh-memory-nebula/lib/host/graph.js +1762 -0
- package/vendor/dsh-memory-nebula/lib/host/graphcache.js +290 -0
- package/vendor/dsh-memory-nebula/lib/host/http.js +993 -0
- package/vendor/dsh-memory-nebula/lib/host/injectcfg.js +95 -0
- package/vendor/dsh-memory-nebula/lib/host/ledger.js +175 -0
- package/vendor/dsh-memory-nebula/lib/host/live.js +204 -0
- package/vendor/dsh-memory-nebula/lib/host/nebula.js +2105 -0
- package/vendor/dsh-memory-nebula/lib/host/page.js +75 -0
- package/vendor/dsh-memory-nebula/lib/host/path.js +83 -0
- package/vendor/dsh-memory-nebula/lib/host/recall.js +524 -0
- package/vendor/dsh-memory-nebula/lib/host/share.js +633 -0
- package/vendor/dsh-memory-nebula/lib/host/sources.js +266 -0
- package/vendor/dsh-memory-nebula/lib/host/store.js +333 -0
- package/vendor/dsh-memory-nebula/lib/host/text.js +410 -0
- package/vendor/dsh-memory-nebula/lib/host/transcripts.js +396 -0
- package/vendor/dsh-memory-nebula/lib/index.js +782 -0
- package/vendor/dsh-memory-nebula/lib/standalone.mjs +315 -0
- package/vendor/dsh-memory-nebula/lib/web/api.js +426 -0
- package/vendor/dsh-memory-nebula/lib/web/app.js +4172 -0
- package/vendor/dsh-memory-nebula/lib/web/i18n.js +580 -0
- package/vendor/dsh-memory-nebula/lib/web/index.html +174 -0
- package/vendor/dsh-memory-nebula/lib/web/nav.js +132 -0
- package/vendor/dsh-memory-nebula/lib/web/render.js +1890 -0
- package/vendor/dsh-memory-nebula/lib/web/space3d.js +1883 -0
- package/vendor/dsh-memory-nebula/lib/web/style.css +1402 -0
- package/vendor/dsh-memory-nebula/locale/en.json +7 -0
- package/vendor/dsh-memory-nebula/locale/zh.json +7 -0
- package/vendor/dsh-memory-nebula/market/assets/icon-180.png +0 -0
- package/vendor/dsh-memory-nebula/market/assets/icon.svg +40 -0
- package/vendor/dsh-memory-nebula/market/index.json +101 -0
- package/vendor/dsh-memory-nebula/package.json +87 -0
- package/vendor/dsh-memory-nebula/sidecar.ps1 +119 -0
- package/vendor/meow-memory/LICENSE +21 -0
- package/vendor/meow-memory/README.en.md +192 -0
- package/vendor/meow-memory/README.md +174 -0
- package/vendor/meow-memory/README.pt-br.md +180 -0
- package/vendor/meow-memory/cordis.patch.yml +7 -0
- package/vendor/meow-memory/lib/client.js +3344 -0
- package/vendor/meow-memory/lib/client.js.map +7 -0
- package/vendor/meow-memory/lib/index.js +9802 -0
- package/vendor/meow-memory/lib/index.js.map +7 -0
- package/vendor/meow-memory/lib/prompts/README.md +65 -0
- package/vendor/meow-memory/lib/prompts/en/dream-atomic.md +36 -0
- package/vendor/meow-memory/lib/prompts/en/dream-header.md +9 -0
- package/vendor/meow-memory/lib/prompts/en/dream-project-summary.md +12 -0
- package/vendor/meow-memory/lib/prompts/en/dream-topic.md +27 -0
- package/vendor/meow-memory/lib/prompts/en/external-memory-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/en/first-create-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/en/labels.md +98 -0
- package/vendor/meow-memory/lib/prompts/en/reflect.md +31 -0
- package/vendor/meow-memory/lib/prompts/en/system-guide.md +121 -0
- package/vendor/meow-memory/lib/prompts/en/tools.md +83 -0
- package/vendor/meow-memory/lib/prompts/en/welcome-guide.md +12 -0
- package/vendor/meow-memory/lib/prompts/pt-br/dream-atomic.md +36 -0
- package/vendor/meow-memory/lib/prompts/pt-br/dream-header.md +9 -0
- package/vendor/meow-memory/lib/prompts/pt-br/dream-project-summary.md +12 -0
- package/vendor/meow-memory/lib/prompts/pt-br/dream-topic.md +27 -0
- package/vendor/meow-memory/lib/prompts/pt-br/external-memory-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/pt-br/first-create-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/pt-br/labels.md +98 -0
- package/vendor/meow-memory/lib/prompts/pt-br/reflect.md +31 -0
- package/vendor/meow-memory/lib/prompts/pt-br/system-guide.md +121 -0
- package/vendor/meow-memory/lib/prompts/pt-br/tools.md +83 -0
- package/vendor/meow-memory/lib/prompts/pt-br/welcome-guide.md +12 -0
- package/vendor/meow-memory/lib/prompts/zh/dream-atomic.md +36 -0
- package/vendor/meow-memory/lib/prompts/zh/dream-header.md +9 -0
- package/vendor/meow-memory/lib/prompts/zh/dream-project-summary.md +19 -0
- package/vendor/meow-memory/lib/prompts/zh/dream-topic.md +27 -0
- package/vendor/meow-memory/lib/prompts/zh/external-memory-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/zh/first-create-notice.md +8 -0
- package/vendor/meow-memory/lib/prompts/zh/labels.md +98 -0
- package/vendor/meow-memory/lib/prompts/zh/reflect.md +30 -0
- package/vendor/meow-memory/lib/prompts/zh/system-guide.md +119 -0
- package/vendor/meow-memory/lib/prompts/zh/tools.md +83 -0
- package/vendor/meow-memory/lib/prompts/zh/welcome-guide.md +12 -0
- package/vendor/meow-memory/package.json +64 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for looking. This is a small, dependency-free plugin, and the fastest
|
|
4
|
+
way to keep it healthy is to run the same checks CI runs.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
- Node.js 24 or newer (CI runs 24 on both Linux and Windows; 22 is not supported).
|
|
9
|
+
- No install step: the package has no runtime or dev dependencies.
|
|
10
|
+
- The repo is the plugin source. To try it inside DSH, point a profile at this
|
|
11
|
+
directory or install the packed tarball; see `docs/distribution.md`.
|
|
12
|
+
|
|
13
|
+
## Before opening a pull request
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm test # node --test "test/*.test.mjs"
|
|
17
|
+
npm run check # static release checks (version, UTF-8, links, assets)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For HTTP or UI changes, also start the standalone engine and run the smoke
|
|
21
|
+
tests:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
node lib/standalone.mjs --port 7891 --root <a-memory-root>
|
|
25
|
+
node scripts/smoke.mjs http://127.0.0.1:7891/api/memory-nebula
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you change the market index or locale files, keep the package version and
|
|
29
|
+
`market/index.json` version in sync; `test/market.test.mjs` enforces it.
|
|
30
|
+
|
|
31
|
+
## Rules of the house
|
|
32
|
+
|
|
33
|
+
- Read-only toward memory stores. Never write into `~/.dsh-meow`, OpenViking
|
|
34
|
+
directories, or user notes.
|
|
35
|
+
- No new runtime dependencies without a strong reason; the single-file
|
|
36
|
+
snapshot and offline story depend on shipping everything ourselves.
|
|
37
|
+
- Keep UI strings in `lib/web/i18n.js`; Chinese is the source text. If you add
|
|
38
|
+
a visible string, add the English entry and run `dev/check-i18n.mjs`.
|
|
39
|
+
- Add a test for behavior changes. A bug fix without a regression test will
|
|
40
|
+
usually be asked for one.
|
|
41
|
+
- Keep commits focused. Update `CHANGELOG.md` for user-visible changes and bump
|
|
42
|
+
the version only when preparing a release.
|
|
43
|
+
|
|
44
|
+
## Reporting bugs
|
|
45
|
+
|
|
46
|
+
Open an issue with the version, platform, and the diagnostics report from
|
|
47
|
+
`?` → “复制诊断” (it contains no memory text or local paths). For security
|
|
48
|
+
issues use `SECURITY.md`, not a public issue.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 主人 & 小代码酱
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Memory Nebula · memory-nebula
|
|
2
|
+
|
|
3
|
+
[](https://github.com/hanhan9999999999999999999/dsh-memory-nebula/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-memory-nebula)
|
|
5
|
+
[](https://github.com/hanhan9999999999999999999/dsh-memory-nebula/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
[Website](https://hanhan9999999999999999999.github.io/dsh-memory-nebula/) · [Live demo](https://hanhan9999999999999999999.github.io/dsh-memory-nebula/demo.html?lang=en) · A DSH plugin that pulls memories out of every workspace **and every memory plugin**, turns them into a **nebula of evidence-backed connections**, and lets both you and the AI follow those connections the way neurons do.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
No memories yet? The empty state offers three ways in, plus a built-in demo galaxy:
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
Export the whole graph (text included) as one self-contained HTML for offline reading:
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
- One icon in the sidebar opens the whole nebula (deep-space style: zoom, filter, search).
|
|
24
|
+
- Every other memory database is opened **read-only**. The plugin only writes under `$DSH_HOME/memory-nebula/`.
|
|
25
|
+
- It is not just a picture: the host registers **9 tools** plus a per-turn prompt, so the AI can walk a connection into another project and read the other half of a memory.
|
|
26
|
+
- Sources are **pluggable**: meow-memory SQLite, any notes directory, any SQLite table, or JSONL pushed by a remote service — all behind one adapter contract.
|
|
27
|
+
|
|
28
|
+
## What it does
|
|
29
|
+
|
|
30
|
+
| Capability | Where |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| Nebula / galaxy / time-spiral views | sidebar icon; `1` `2` `3` |
|
|
33
|
+
| Spreading-activation recall across workspaces | `nebula_recall`, search box `/` |
|
|
34
|
+
| Full text, origin, same-session neighbours, who mentioned it | click any node |
|
|
35
|
+
| Evidence chain: how two memories are actually connected | select one, `Shift`-click another |
|
|
36
|
+
| **Cross-plugin bridge**: what another plugin just injected → the neighbours it did not | `nebula_bridge`, per-turn injection |
|
|
37
|
+
| **Attach a new memory store**: SQLite / notes dir / JSONL | `nebula_sources`, `sources.json` |
|
|
38
|
+
| **Name an unreadable store**: no more silent "0 memories" | red row in Sources, one toast at startup, `sourceErrors` in `--diagnose` |
|
|
39
|
+
| **Snapshot checksum**: single-file snapshots carry a sha256, so an edited or truncated file says so on open | "checksum ok" toast, or a red banner with expected vs actual digest; unparsable data reports itself instead of a half-drawn page |
|
|
40
|
+
| **Push from a remote memory service** | `nebula_ingest`, `POST /ingest` |
|
|
41
|
+
| Export the whole graph (MD report / JSON) | `GET /export?format=md\|json` |
|
|
42
|
+
| Corrections: mute a wrong edge | `×` next to a neighbour, or `nebula_link(action="mute")` |
|
|
43
|
+
| Memory hygiene (six failure modes) | left panel, board `B`, `nebula_hygiene` |
|
|
44
|
+
| Export visible PNG / subgraph JSON | top bar |
|
|
45
|
+
| First open: three ways in, or a built-in demo galaxy | empty-state card, `?demo=1` |
|
|
46
|
+
| Single-file snapshot: the whole graph (with text) as one offline HTML | Export → “whole graph · single HTML”, `GET /share` |
|
|
47
|
+
| Scoped share: one workspace, one project, or a node’s 2-hop neighbourhood | Export menu, `GET /share?scope=ws:<workspace>` |
|
|
48
|
+
| CLI snapshot: write the HTML from CI or a cron job without starting a server | `node lib/standalone.mjs --share <file> [--scope …]` |
|
|
49
|
+
| CLI report: write the same scoped graph as md/json for automation | `node lib/standalone.mjs --export <file> [--format md\|json]` |
|
|
50
|
+
| Privacy filter: drop the diary workspace, a level, a project or a status before export | Export menu, `GET /share?hide=ws:diary` |
|
|
51
|
+
| **Bilingual UI**: interface and offline snapshots in English, untranslated strings fall back to Chinese | top-bar language button, `?lang=en` |
|
|
52
|
+
| **One-click diagnostics**: version, environment, graph size and last error, with no memory text or paths | `?` → “Copy diagnostics”, `GET /diagnostics`, `--diagnose` |
|
|
53
|
+
| First-visit guide: search → open one memory → trace one chain, skippable | appears once, replay from `?` |
|
|
54
|
+
| Time replay (everything up to a day) | timeline in the time view |
|
|
55
|
+
| **Fifty thousand, paged**: first screen is 10,000 memories in 4.26MB (whole graph 22.3MB); "load more" follows the importance ranking | 50k measured at 197,569 edges / 0 orphans; `GET /graph?limit=&offset=` |
|
|
56
|
+
| **Viewport culling**: only edges inside the view are drawn; zoomed out, edges become cluster-to-cluster bundles; 11.5ms per frame at 50k nodes | automatic; `pick()` walks a spatial grid |
|
|
57
|
+
| **Snapshot sharding**: single-file snapshots cap at 20,000 memories and say "trimmed" on the page | `GET /share?limit=` (max 50,000), `--share` |
|
|
58
|
+
| **3D with a draw budget**: above 18,000 memories the galaxy draws the most important ones and says so, instead of turning big libraries away; ~47–51ms per frame at 50k under software rendering | automatic in the galaxy view; `docs/troubleshooting.md` §5 |
|
|
59
|
+
| **Compressed large responses**: `/graph`, snapshots and the front end negotiate br / gzip; refreshes revalidate with 304 | browsers negotiate automatically; `HEAD` gives length, see `docs/http-api.md` |
|
|
60
|
+
| **Keyboard and screen reader**: arrow keys walk between stars by direction, `[` `]` follow links, `+` `-` zoom, `Home` jumps to the hub | click the map (or Tab in), then use the keys; `?` lists them |
|
|
61
|
+
| Keyboard map | `?` |
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
Listed in the curated directory (recommended): [awesome-dsh-plugin](https://awesome-dsh-plugin.com/p/hanhan9999999999999999999/dsh-memory-nebula/).
|
|
66
|
+
|
|
67
|
+
```powershell
|
|
68
|
+
dsh plugin --profile web add dsh-memory-nebula
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
You can also add the index
|
|
72
|
+
`https://unpkg.com/dsh-memory-nebula@1.11.74/market/index.json` under
|
|
73
|
+
Plugins → Discover, search for “Memory Nebula”, and install. Run the doctor in step 2.5 afterwards.
|
|
74
|
+
|
|
75
|
+
Want a look first, without installing into DSH?
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
npx -y -p dsh-memory-nebula memory-nebula --demo
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Open the `http://127.0.0.1:7891/api/memory-nebula/?demo=1` URL it prints. It uses the built-in demo store and never reads or writes your real memories.
|
|
82
|
+
|
|
83
|
+
Or install from this checkout:
|
|
84
|
+
|
|
85
|
+
```powershell
|
|
86
|
+
# 1) link the plugin (either way)
|
|
87
|
+
New-Item -ItemType Junction -Path "<profile>\node_modules\dsh-memory-nebula" -Target "<plugin>"
|
|
88
|
+
npm install <path>\dsh-memory-nebula-1.11.14.tgz --prefix <profile>
|
|
89
|
+
|
|
90
|
+
# 2) profile package.json: add the dependency AND the bundle
|
|
91
|
+
# dependencies: "dsh-memory-nebula": "file:../../plugins/dsh-memory-nebula"
|
|
92
|
+
# dsh.profile.bundles: "dsh-memory-nebula"
|
|
93
|
+
|
|
94
|
+
# 2.5) read-only preflight: Node, dependency, bundles and files; exits 1 only on fail
|
|
95
|
+
node "<profile>\node_modules\dsh-memory-nebula\scripts\doctor.mjs" --profile "<profile>"
|
|
96
|
+
|
|
97
|
+
# 3) restart DSH, open the "Memory Nebula" sidebar panel
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
No restart, or the host still runs old modules:
|
|
101
|
+
|
|
102
|
+
```powershell
|
|
103
|
+
powershell -ExecutionPolicy Bypass -File sidecar.ps1 start # Windows, port 7890, finds node itself
|
|
104
|
+
node lib/standalone.mjs --port 7890 # other systems, scans the current directory
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`sidecar.ps1` also takes `-Port`, `-Root <extra scan dir>` and `-Node <node.exe>`; `status` / `stop` only touch that port.
|
|
108
|
+
|
|
109
|
+
Write a snapshot from the command line without starting a server:
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
node lib/standalone.mjs --demo --share .\snapshot.html
|
|
113
|
+
node lib/standalone.mjs --share .\work.html --scope ws:xingang --hide level:lesson
|
|
114
|
+
node lib/standalone.mjs --export ./nebula.json --scope project:memory-nebula
|
|
115
|
+
node lib/standalone.mjs --export ./nebula.md --format md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`--share` / `--export` build once and exit; `--scope` accepts `all`, `ws:<workspace>`, `project:<project>` or
|
|
119
|
+
`focus:<node id>`; `--hops` sets the focus radius (1–5, default 2); `--hide` takes comma-separated rules.
|
|
120
|
+
|
|
121
|
+
The page probes `/ping` on both legs and picks the newer `build`; a banner explains when the host lacks endpoints.
|
|
122
|
+
|
|
123
|
+
Self-checks:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm test # unit suite (it prints its own count)
|
|
127
|
+
npm run check # static release check
|
|
128
|
+
node scripts/smoke.mjs # contract assertions against a live instance (count printed at the end)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Attaching a new memory store (three steps)
|
|
132
|
+
|
|
133
|
+
1. Ask the AI: *"run `nebula_sources`, then attach `<where your memories live>`."*
|
|
134
|
+
2. The AI reads [docs/integration-guide.md](docs/integration-guide.md) and picks a path:
|
|
135
|
+
- **on disk (SQLite / notes)** → add a source to `sources.json`; hot-reloaded.
|
|
136
|
+
- **API only** → have that plugin `POST /api/memory-nebula/ingest`, or call `nebula_ingest`.
|
|
137
|
+
- **just need context once** → call `nebula_bridge(memory_ids=[…])`, no source needed.
|
|
138
|
+
3. Confirm with `GET /sources`: the new store must report "N nodes, 0 read errors".
|
|
139
|
+
|
|
140
|
+
Adapter contract and every `sources.json` field: [docs/adapters.md](docs/adapters.md).
|
|
141
|
+
|
|
142
|
+
## Docs
|
|
143
|
+
|
|
144
|
+
| File | Contents |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| [docs/integration-guide.md](docs/integration-guide.md) | **Integration manual for another AI**: three paths, decision tree, verification |
|
|
147
|
+
| [docs/adapters.md](docs/adapters.md) | Adapter contract, four built-in adapters, `sources.json`, safety boundary |
|
|
148
|
+
| [docs/recall-and-tools.md](docs/recall-and-tools.md) | Spreading activation, the nine tools, bridge budget, per-turn injection |
|
|
149
|
+
| [docs/architecture.md](docs/architecture.md) | Module map, request path, invariants |
|
|
150
|
+
| [docs/interface.md](docs/interface.md) | Views, interaction, detail panel, LOD, board / command palette, export |
|
|
151
|
+
| [docs/accessibility.md](docs/accessibility.md) | Keyboard walking, screen-reader announcements and index, structure, known limits, manual checklist |
|
|
152
|
+
| [docs/http-api.md](docs/http-api.md) | HTTP routes, `/ping` fields, ETag/304, error codes, body limits |
|
|
153
|
+
| [docs/security.md](docs/security.md) | Local-only boundary, CORS/CSRF, CSP, read-only guarantee, threat model |
|
|
154
|
+
| [docs/operations.md](docs/operations.md) | Read-only boundary, install, hot reload, known limits |
|
|
155
|
+
| [docs/release.md](docs/release.md) | Release checklist, versioning, packaging, rollback |
|
|
156
|
+
| [docs/compatibility.md](docs/compatibility.md) | Verified OS/Node/browser matrix, explicit non-support |
|
|
157
|
+
| [docs/distribution.md](docs/distribution.md) | Install/upgrade/rollback/uninstall, support flow, marketplace copy |
|
|
158
|
+
| [docs/troubleshooting.md](docs/troubleshooting.md) | Start here when something breaks: doctor, version drift, empty graph, 3D/snapshot limits, privacy, ticket material |
|
|
159
|
+
| [SECURITY.md](SECURITY.md) | Read-only boundary, HTTP protections and vulnerability reporting |
|
|
160
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | Local development, test commands and contribution rules |
|
|
161
|
+
| [SUPPORT.md](SUPPORT.md) | what to run first, what to include, and what never to paste |
|
|
162
|
+
| [docs/testing.md](docs/testing.md) | unit suite, smoke, security probes, browser probes and manual sign-off (counts are printed by the scripts) |
|
|
163
|
+
| [docs/roadmap.md](docs/roadmap.md) | From 0.5 to 1.2: scoped sharing, first-run guidance, 10k-node performance, i18n and release support |
|
|
164
|
+
| [CHANGELOG.md](CHANGELOG.md) | Version history |
|
|
165
|
+
|
|
166
|
+
## Layout
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
lib/
|
|
170
|
+
index.js entry: 9 tools, prompt injection, /api/memory-nebula
|
|
171
|
+
host/
|
|
172
|
+
nebula.js facade: index / cache / refresh / detail / bridge
|
|
173
|
+
graph.js build, score, prune, auditHygiene
|
|
174
|
+
recall.js seeds + spreading activation
|
|
175
|
+
bridge.js complementary bundle: ids → spread → drop seen → fit budget
|
|
176
|
+
ledger.js injection ledger shared across plugins
|
|
177
|
+
adapters/ meow / notes / sqlite / ingest + discovery and config
|
|
178
|
+
live.js hot reload (recursive over lib/host, copy by mtime)
|
|
179
|
+
http.js routes (statically loaded)
|
|
180
|
+
web/ front end (served from disk; refresh to apply)
|
|
181
|
+
scripts/smoke.mjs read-only contract checks
|
|
182
|
+
scripts/release-check.mjs static release check
|
|
183
|
+
scripts/bench.mjs 10k benchmark (build / recall / hygiene / snapshot / memory)
|
|
184
|
+
test/ node:test unit suite
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Privacy and security
|
|
188
|
+
|
|
189
|
+
- Read-only: every memory database is opened with `readOnly`; writes stay under `$DSH_HOME/memory-nebula/`.
|
|
190
|
+
- Local-only: the standalone engine binds `127.0.0.1`; cross-site reads get no CORS, cross-site writes get 403; the page ships a CSP.
|
|
191
|
+
- The standalone engine accepts an optional `--token <at least 12 chars>`; without it the local open-and-read model is unchanged, and the host path uses DSH's Host/auth fence. With a token, a browser opening the page gets a small unlock form; a wrong password never lets it through.
|
|
192
|
+
- Full model and verification: [docs/security.md](docs/security.md).
|
|
193
|
+
- Performance budget and 10k measurements: [docs/benchmarks.md](docs/benchmarks.md).
|
|
194
|
+
|
|
195
|
+
## Support
|
|
196
|
+
|
|
197
|
+
- Run `node scripts/doctor.mjs`, then check [docs/troubleshooting.md](docs/troubleshooting.md) — blank pages, empty graphs and 3D guards are covered there.
|
|
198
|
+
- Use the issue forms and include `doctor` output, DSH/Node/OS versions, and reproduction steps. **Never paste memory text, tokens, `.npmrc`, or private paths.**
|
|
199
|
+
- Report vulnerabilities through the private advisory in [SECURITY.md](SECURITY.md). Full policy: [SUPPORT.md](SUPPORT.md).
|
|
200
|
+
|
|
201
|
+
## Version
|
|
202
|
+
|
|
203
|
+
`1.8.0`, MIT. Front-end changes apply on refresh; everything under `lib/host/` is hot-reloaded, while `http.js` / `index.js` / `live.js` need a DSH restart (or the standalone engine).
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# 记忆星图 · memory-nebula
|
|
2
|
+
|
|
3
|
+
[](https://github.com/hanhan9999999999999999999/dsh-memory-nebula/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/dsh-memory-nebula)
|
|
5
|
+
[](https://github.com/hanhan9999999999999999999/dsh-memory-nebula/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
[English](https://github.com/hanhan9999999999999999999/dsh-memory-nebula/blob/main/README.en.md) · [在线示例](https://hanhan9999999999999999999.github.io/dsh-memory-nebula/demo.html?lang=en) · [官网](https://hanhan9999999999999999999.github.io/dsh-memory-nebula/) · 在 DSH 里把散落在各个工作区、各个记忆插件里的记忆抽出来,算成一张**带证据的关联星云**,再从这张图上做「神经元式」的连带检索——以及,让别的插件注入了什么,星图就顺着连接补上它没注的那一半。
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
第一次打开、库里还没有记忆时,页面不会留一块空白——它给三条接入路径,也可以先进示例星系看看:
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
看完之后,可以把整张星图(含正文)导出成一个自包含 HTML,双击离线打开,搜索和证据链都还能用:
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
- 左侧栏一个图标 → 打开就是整片星云(Deep Space 风格,可缩放、可筛选、可搜索)。
|
|
26
|
+
- 不改任何别的插件的记忆库:所有记忆库都以 `readOnly` 打开,只写自己的目录 `$DSH_HOME/memory-nebula/`。
|
|
27
|
+
- 星图不只是一张画:宿主侧注册了 **9 个工具** + 一段每轮注入的提示,让会话里的 AI 在检索记忆时能**顺着连接把别的项目里的那一半一起读出来**。
|
|
28
|
+
- 记忆从哪来是**可插拔**的:meow-memory 的 SQLite、任意笔记目录、任意 SQLite 表、远端服务推来的 JSONL,都走同一套适配器契约。
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
┌─────────────── 记忆来源(全部只读)───────────────┐
|
|
32
|
+
│ meow-memory <ws>/.dsh-meow/memory.db + sessions/ │
|
|
33
|
+
│ notes 任意 .md/.jsonl/.txt 目录(frontmatter)│
|
|
34
|
+
│ sqlite 任意库,列名自动猜,写操作直接拒 │
|
|
35
|
+
│ ingest $DSH_HOME/memory-nebula/ingest/*.jsonl│
|
|
36
|
+
└───────────────────────┬───────────────────────────┘
|
|
37
|
+
│ adapters/index.js 发现 + 扫描
|
|
38
|
+
▼
|
|
39
|
+
text.js 分词/实体 ──▶ graph.js 建图(6 类边 + 打分 + 剪枝)
|
|
40
|
+
│
|
|
41
|
+
nebula.js 门面(索引 / 缓存 / 巡检)
|
|
42
|
+
│
|
|
43
|
+
┌──────────────────┼────────────────────┬──────────────┐
|
|
44
|
+
▼ ▼ ▼ ▼
|
|
45
|
+
http.js 页面 index.js 9 个工具 systemPrompt bridge.js 补充包
|
|
46
|
+
(iframe) nebula_* 每轮邻域注入 ledger.js 注入账本
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 能做什么
|
|
50
|
+
|
|
51
|
+
| 能力 | 入口 |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| 看整片星云 / 星系 / 时间螺旋 | 左侧栏图标;`1` `2` `3` 切换三档 |
|
|
54
|
+
| 顺着连接检索(跨工作区) | `nebula_recall`、搜索框 `/` |
|
|
55
|
+
| 查一条记忆的全文、出处、同会话邻居、谁提到过它 | 点任意节点 |
|
|
56
|
+
| 证据链:两条记忆到底怎么连上的 | 选中后 `Shift` 点另一条 |
|
|
57
|
+
| **跨插件补充包**:别的插件注入了什么,就补它强相关却没读的邻居 | `nebula_bridge`、每轮注入(可配预算) |
|
|
58
|
+
| **接入新的记忆库**:SQLite / 笔记目录 / JSONL 推送 | `nebula_sources`、`sources.json` |
|
|
59
|
+
| **坏库点名**:某个库读不动时不再安静显示 0 条 | 来源面板红色行、启动时一次 toast、`--diagnose` 的 `sourceErrors` |
|
|
60
|
+
| **快照校验和**:单文件快照带 sha256,改过/截断过都会当场报出来 | 打开时 toast「校验通过」或顶部红横幅给出期望/实际摘要;解析失败直接说「读不出来」而不是白屏 |
|
|
61
|
+
| **远端记忆服务推进来**(hindsight / openviking 之类) | `nebula_ingest`、`POST /ingest` |
|
|
62
|
+
| 导出整张图:给人看的 MD 报告 / 给 AI 看的 JSON | `GET /export?format=md\|json`、顶栏「导出」 |
|
|
63
|
+
| 纠错:把算错的关联按掉 | 详情里邻居右侧 `×`,或 `nebula_link(action="mute")` |
|
|
64
|
+
| 记忆体检(六类失效模式) | 左侧「记忆体检」、看板 `B`、`nebula_hygiene` |
|
|
65
|
+
| 导出当前视图 PNG / 可见子图 JSON | 顶栏「导出」 |
|
|
66
|
+
| **第一次打开**:空库给三条接入路径,或直接进示例星系 | 空态卡片「看示例」、`?demo=1` |
|
|
67
|
+
| **单文件快照**:整张星图(含正文)打包成一个 HTML,离线可看 | 顶栏「导出 → 整张星图 · 单文件 HTML」、`GET /share` |
|
|
68
|
+
| **范围分享**:只导出一个工作区 / 一个项目 / 选中节点 2 跳 | 导出菜单另两项、`GET /share?scope=ws:<工作区>` |
|
|
69
|
+
| **命令行快照**:CI / 定时归档不启端口,直接写 HTML | `node lib/standalone.mjs --share <file> [--scope …]` |
|
|
70
|
+
| **隐私过滤**:导出前整区隐去日记 / 按层级 / 项目 / 状态排除 | 导出菜单「隐去日记」、`GET /share?hide=ws:日记` |
|
|
71
|
+
| **中英双语**:界面与离线快照都可切英文,未翻译处回退中文 | 顶栏语言按钮、`?lang=en` |
|
|
72
|
+
| **一键诊断**:复制版本/环境/图规模/最近错误,不含正文与路径 | `?` →「复制诊断」、`GET /diagnostics`、`--diagnose` |
|
|
73
|
+
| **首访引导**:搜一个词 → 看一条证据 → 走一条链,三步可跳过 | 首次打开自动出现,`?` 里可重看 |
|
|
74
|
+
| **两万条级打开**:20,000 条 / 156,993 条连接,建图 2.53s、快照首屏 762ms | 无需切换;大图自动跳过生长动画,基准见 `docs/benchmarks.md` |
|
|
75
|
+
| **五万条分页**:首屏 10,000 条 4.26MB(整图 22.3MB),底部「继续加载」按重要度取下一页 | 五万条实测 197,569 边 / 0 孤岛;`GET /graph?limit=&offset=` |
|
|
76
|
+
| **视口裁剪**:只画视口内的边,缩小时边变簇间聚合线;5 万节点一帧 11.5ms | 自动,无需开关;`pick()` 走空间网格 |
|
|
77
|
+
| **快照分片**:单文件快照默认最多 20,000 条,超出在页面上写明「已裁剪」 | `GET /share?limit=`(上限 50,000)、`--share` |
|
|
78
|
+
| **三维大库取样**:超过 18,000 条按重要度取样绘制并明示,不再把大库挡在门外;5 万条软件渲染一帧约 47–51ms | 切「星系」视图自动生效;`docs/troubleshooting.md` 第 5 节 |
|
|
79
|
+
| **大响应压缩**:`/graph`、快照与前端按 `Accept-Encoding` 走 br / gzip,刷新走 304 不再重下 | 浏览器自动协商;`HEAD` 可取长度,见 `docs/http-api.md` |
|
|
80
|
+
| 时间回放(只看某天及之前) | 时间视图底部时间轴 |
|
|
81
|
+
| **纯键盘 / 读屏**:方向键在星星之间按方向走、`[` `]` 沿连接走、`+` `-` 缩放、`Home` 跳枢纽 | 点一下画面(或 Tab 进星图)就能用;`?` 看全表 |
|
|
82
|
+
| 快捷键一览 | `?` 或顶栏「?」 |
|
|
83
|
+
|
|
84
|
+
## 快速开始
|
|
85
|
+
|
|
86
|
+
已经装好的机器上(`profiles/desktop`),只要打开「记忆星图」页面就有一张图;页面每 12 秒比一次 `sig`,别的会话写了新记忆会自动长出新星点。库里还没有记忆时,页面会给三条接入路径,也可以先点「看示例」;`…/memory-nebula/?demo=1` 可直达示例星系,逛完退出不会动真实库。
|
|
87
|
+
|
|
88
|
+
精选目录已收录(推荐):[awesome-dsh-plugin 目录页](https://awesome-dsh-plugin.com/p/hanhan9999999999999999999/dsh-memory-nebula/)。
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
dsh plugin --profile web add dsh-memory-nebula
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
也可以在 DSH 的「插件 → 发现」里添加索引
|
|
95
|
+
`https://unpkg.com/dsh-memory-nebula@1.11.74/market/index.json`,搜索「记忆星图」安装。
|
|
96
|
+
装完按下面的 2.5 跑一次 doctor。
|
|
97
|
+
|
|
98
|
+
想先看看,不装进 DSH:
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
npx -y -p dsh-memory-nebula memory-nebula --demo
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
打开它打印的 `http://127.0.0.1:7891/api/memory-nebula/?demo=1`,看到的是内置示例库,不读也不写你的真实记忆。
|
|
105
|
+
|
|
106
|
+
也可以从仓库装到 DSH:
|
|
107
|
+
|
|
108
|
+
```powershell
|
|
109
|
+
# 1) 装进 profile(二选一)
|
|
110
|
+
New-Item -ItemType Junction -Path "<profile>\node_modules\dsh-memory-nebula" -Target "<plugin>"
|
|
111
|
+
npm install <path>\dsh-memory-nebula-1.11.14.tgz --prefix <profile>
|
|
112
|
+
|
|
113
|
+
# 2) profile 的 package.json 里加依赖与 bundles(只加 dependencies 不会重组)
|
|
114
|
+
# dependencies: "dsh-memory-nebula": "file:../../plugins/dsh-memory-nebula"
|
|
115
|
+
# dsh.profile.bundles: "dsh-memory-nebula"
|
|
116
|
+
|
|
117
|
+
# 2.5) 装完先体检:只读检查 Node/依赖/bundles/文件,fail 才退出 1
|
|
118
|
+
node "<profile>\node_modules\dsh-memory-nebula\scripts\doctor.mjs" --profile "<profile>"
|
|
119
|
+
|
|
120
|
+
# 3) 重启 DSH,打开侧栏「记忆星图」
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
不想重启 DSH,或宿主里跑的还是旧模块:
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
powershell -ExecutionPolicy Bypass -File sidecar.ps1 start # Windows,默认 7890,自动找 node
|
|
127
|
+
node lib/standalone.mjs --port 7890 # 其它系统,默认扫当前目录
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`sidecar.ps1` 还接受 `-Port`、`-Root <额外扫描目录>`、`-Node <node.exe>`;`status` / `stop` 只作用于指定端口。
|
|
131
|
+
|
|
132
|
+
不启动端口,直接从命令行写一份快照:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
node lib/standalone.mjs --demo --share .\snapshot.html
|
|
136
|
+
node lib/standalone.mjs --share .\work.html --scope ws:星港产品 --hide level:lesson
|
|
137
|
+
|
|
138
|
+
# 报告也能带走:md 或 json,范围语义与快照一致
|
|
139
|
+
node lib/standalone.mjs --export .
|
|
140
|
+
ebula.json --scope project:memory-nebula
|
|
141
|
+
node lib/standalone.mjs --export .
|
|
142
|
+
ebula.md --format md
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`--share` / `--export` 都只建一次图就退出:`--scope` 支持 `all` / `ws:<工作区>` /
|
|
146
|
+
`project:<项目>` / `focus:<节点 id>`,`--hops` 控制 focus 的跳数(1–5,默认 2),
|
|
147
|
+
`--hide` 可逗号分隔多条规则(仅 `--share`)。
|
|
148
|
+
|
|
149
|
+
页面会并行探宿主与独立引擎的 `/ping`,自动选 `build` 较新的那条;宿主缺接口时顶部有横幅说明。
|
|
150
|
+
|
|
151
|
+
自检三条命令:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm test # 单元测试(条数由测试框架自己打印)
|
|
155
|
+
npm run verify # 单测 + 发布静态检查(npm pack 的 prepack 会自动再跑)
|
|
156
|
+
node scripts/smoke.mjs # 接口契约(对运行中的实例,结尾打印条数)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 接入一个新的记忆库(三步)
|
|
160
|
+
|
|
161
|
+
1. 问 AI:「用 `nebula_sources` 看看现在接了哪些来源,然后把 `<你的记忆在哪>` 接进来。」
|
|
162
|
+
2. AI 会读 [docs/integration-guide.md](docs/integration-guide.md),判断属于哪种情况:
|
|
163
|
+
- **落盘的 SQLite / 笔记目录** → 往 `sources.json` 加一条 source,重启页面即可(热载)。
|
|
164
|
+
- **只有 API 的远端服务** → 让那个插件在写入后 `POST /api/memory-nebula/ingest`,或调 `nebula_ingest`。
|
|
165
|
+
- **只想临时补上下文** → 直接 `nebula_bridge(memory_ids=[…])`,不用接来源。
|
|
166
|
+
3. `GET /sources` 或 `nebula_sources(verbose=true)` 确认新来源「读到了 N 条、没有读取失败」。
|
|
167
|
+
|
|
168
|
+
适配器契约、列名猜测规则、`sources.json` 全字段见 [docs/adapters.md](docs/adapters.md)。
|
|
169
|
+
|
|
170
|
+
装卸(junction + `dsh.profile.bundles`)、热载边界、sidecar 过渡通道见 [docs/operations.md](docs/operations.md)。
|
|
171
|
+
|
|
172
|
+
## 环境变量
|
|
173
|
+
|
|
174
|
+
| 变量 | 作用 | 默认 |
|
|
175
|
+
| --- | --- | --- |
|
|
176
|
+
| `NEBULA_LARGE_LIBRARY` | 150000 | 多大的库算「该提醒你一声」(`/ping.scale`、`/overview.warnings`、来源面板那句实话) |
|
|
177
|
+
|
|
178
|
+
| `NEBULA_HYGIENE_WARM=0` | 关掉「建完图顺手把体检算好」的后台预热(词频表预热照常) | 开 |
|
|
179
|
+
| `NEBULA_CACHE=0` | 不读也不写盘上的图缓存(1.11.70 起) | 开 |
|
|
180
|
+
| `NEBULA_PREWARM_DELAY` | 建完图后隔多久预热检索缓存(毫秒,1.11.70 起) | 1200 |
|
|
181
|
+
| `NEBULA_HY_PROFILE=1` / `NEBULA_GRAPH_TIMING=1` / `NEBULA_REFRESH_PROFILE=1` / `NEBULA_SHARE_PROFILE=1` | 打分段计时到 stderr,排查慢在哪一段 | 关 |
|
|
182
|
+
|
|
183
|
+
## 文档
|
|
184
|
+
|
|
185
|
+
| 分册 | 内容 |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| [docs/integration-guide.md](docs/integration-guide.md) | **给「别人的 AI」看的接入手册**:三种接入路径、判断树、逐步验证 |
|
|
188
|
+
| [docs/adapters.md](docs/adapters.md) | 适配器契约、四种内置适配器、`sources.json` 字段、安全边界 |
|
|
189
|
+
| [docs/data-and-edges.md](docs/data-and-edges.md) | 数据从哪来;7 类边怎么算、怎么剪枝;来源节点 |
|
|
190
|
+
| [docs/recall-and-tools.md](docs/recall-and-tools.md) | 扩散激活检索;九个出口、补充包预算与每轮注入 |
|
|
191
|
+
| [docs/interface.md](docs/interface.md) | 三种视图、交互、详情面板、LOD、看板/命令面板/主线、时间回放与导出 |
|
|
192
|
+
| [docs/accessibility.md](docs/accessibility.md) | 键盘走位、读屏播报与索引、实现结构、已知限制与手工验收清单 |
|
|
193
|
+
| [docs/http-api.md](docs/http-api.md) | HTTP 路由、`/ping` 字段、ETag/304、错误码、请求体限制 |
|
|
194
|
+
| [docs/security.md](docs/security.md) | 本机服务边界、CORS/CSRF、CSP、只读保证、威胁模型与验证 |
|
|
195
|
+
| [docs/operations.md](docs/operations.md) | 只读边界、装卸、已知限制、sidecar、发布信息 |
|
|
196
|
+
| [docs/release.md](docs/release.md) | 发布前检查清单、版本策略、打包/安装/回滚 |
|
|
197
|
+
| [docs/compatibility.md](docs/compatibility.md) | 已验证的平台/Node/浏览器矩阵,以及明确不支持的组合 |
|
|
198
|
+
| [docs/distribution.md](docs/distribution.md) | 安装/升级/回滚/卸载、支持流程、市场文案与发布检查 |
|
|
199
|
+
| [docs/troubleshooting.md](docs/troubleshooting.md) | 出问题时先看这里:doctor、版本漂移、空图、3D/快照边界、隐私与工单材料 |
|
|
200
|
+
| [SECURITY.md](SECURITY.md) | 只读边界、HTTP 防护与漏洞报告 |
|
|
201
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | 本地开发、测试命令与提交约定 |
|
|
202
|
+
| [SUPPORT.md](SUPPORT.md) | 提 issue 前先做什么、要带什么、绝不能贴什么 |
|
|
203
|
+
| [docs/verified.md](docs/verified.md) | 每一条结论背后的实测证据 |
|
|
204
|
+
| [docs/architecture.md](docs/architecture.md) | 模块分工、请求路径、不能破的不变量 |
|
|
205
|
+
| [docs/testing.md](docs/testing.md) | 单测、冒烟、安全探针、浏览器探针清单与手工验收(条数由脚本自己打印) |
|
|
206
|
+
| [docs/roadmap.md](docs/roadmap.md) | 从 0.5 到 1.2:切片分享、首访引导、万条性能、国际化与发行支持 |
|
|
207
|
+
| [CHANGELOG.md](CHANGELOG.md) | 版本变更 |
|
|
208
|
+
|
|
209
|
+
## 目录结构
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
lib/
|
|
213
|
+
index.js 插件入口:注册 9 个工具、注入提示、挂 /api/memory-nebula
|
|
214
|
+
client.js 左侧栏入口
|
|
215
|
+
host/ 引擎(只读取数、建图、检索、体检、转写解析)
|
|
216
|
+
nebula.js 门面:索引 / 缓存 / 巡检 / publicGraph / detail / bridge
|
|
217
|
+
graph.js 建图、打分、剪枝、auditHygiene
|
|
218
|
+
recall.js seed + 扩散激活
|
|
219
|
+
bridge.js 补充包:ids → 扩散 → 排除已读 → 预算内挑几条
|
|
220
|
+
ledger.js 注入账本:谁什么时候注入过什么(跨插件共用)
|
|
221
|
+
adapters/ 来源适配器(meow / notes / sqlite / ingest)+ 发现与配置
|
|
222
|
+
live.js 引擎热载(递归枚举 lib/host,按 mtime 复制再 import)
|
|
223
|
+
http.js 路由(启动时静态加载)
|
|
224
|
+
web/ 前端(每次请求从磁盘读,改完刷新即生效)
|
|
225
|
+
app.js 状态、面板、筛选、命令面板、导出、时间轴
|
|
226
|
+
render.js 2D 星云:力导向 + 区块点亮 + Path2D 批处理
|
|
227
|
+
space3d.js 3D 星系 / 时间螺旋:WebGL 光点
|
|
228
|
+
scripts/smoke.mjs 只读契约自查
|
|
229
|
+
scripts/release-check.mjs 发布静态检查
|
|
230
|
+
scripts/bench.mjs 10k 性能基准(建图 / 检索 / 体检 / 快照 / 内存)
|
|
231
|
+
test/ node:test 单元测试
|
|
232
|
+
sidecar.ps1 Windows 独立引擎开关
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 隐私与安全
|
|
236
|
+
|
|
237
|
+
- 只读:所有记忆库以 `readOnly` 打开;写入只落在 `$DSH_HOME/memory-nebula/`。
|
|
238
|
+
- 只连本机:独立引擎绑定 `127.0.0.1`;跨站读拿不到 CORS、跨站写 403;页面带 CSP。
|
|
239
|
+
- 独立引擎可加 `--token <至少 12 字符>` 开本机口令;不传时保持本地即开即用,宿主内走 DSH 的 Host/认证围栏。开启后浏览器直接打开页面会看到输口令的登录页,口令错误不会放行。
|
|
240
|
+
- 全文细节与威胁模型见 [docs/security.md](docs/security.md)。
|
|
241
|
+
- 性能预算与 10k 实测见 [docs/benchmarks.md](docs/benchmarks.md)。
|
|
242
|
+
|
|
243
|
+
## 支持与反馈
|
|
244
|
+
|
|
245
|
+
- 先跑 `node scripts/doctor.mjs`,再对照 [docs/troubleshooting.md](docs/troubleshooting.md);多数空白页/空图/3D 问题能在那里解决。
|
|
246
|
+
- 提 issue 请用仓库里的模板,附 `doctor` 输出、DSH/Node/系统版本、复现步骤;**不要贴记忆正文、token、`.npmrc` 或私有路径**。
|
|
247
|
+
- 安全漏洞走私密 advisory,见 [SECURITY.md](SECURITY.md)。完整支持边界见 [SUPPORT.md](SUPPORT.md)。
|
|
248
|
+
|
|
249
|
+
## 版本与许可
|
|
250
|
+
|
|
251
|
+
- 当前版本 `1.11.74`,MIT。
|
|
252
|
+
- 打包内容:`lib/`、`scripts/`、`docs/`、`cordis.patch.yml`、`README.md` / `README.en.md`、`CHANGELOG.md`、`LICENSE`、`sidecar.ps1`(`test/` 与 `dev/` 不进包)。
|
|
253
|
+
- 前端改动刷新页面即生效;`lib/host/` 下所有引擎文件(含 `adapters/`、`bridge.js`、`ledger.js`)由 LiveEngine 热载,`http.js` / `index.js` / `live.js` 改动要重启 DSH 或走独立引擎。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## What this project touches
|
|
4
|
+
|
|
5
|
+
`dsh-memory-nebula` reads memory stores on the local machine (meow-memory,
|
|
6
|
+
OpenViking, plain notes, SQLite) and serves a read-only viewer. It never writes
|
|
7
|
+
to those stores. The only writable state is under
|
|
8
|
+
`$DSH_HOME/memory-nebula/` (mutes, manual links, caches, logs, injected-ledger
|
|
9
|
+
files).
|
|
10
|
+
|
|
11
|
+
The HTTP surface is intended for one local user:
|
|
12
|
+
|
|
13
|
+
- it binds to loopback only;
|
|
14
|
+
- write routes require a loopback `Origin` and reject cross-site requests;
|
|
15
|
+
- static pages ship a restrictive CSP and `nosniff` / `no-store`;
|
|
16
|
+
- `/share` is the one route that deliberately exports memory **content** as a
|
|
17
|
+
self-contained HTML file. Treat exported files as plaintext backups.
|
|
18
|
+
|
|
19
|
+
Do not expose the server to a public network. There is no account system, no
|
|
20
|
+
telemetry, and no upload path.
|
|
21
|
+
|
|
22
|
+
## Supported versions
|
|
23
|
+
|
|
24
|
+
Security fixes land on the latest published minor. Older minors are not
|
|
25
|
+
maintained separately.
|
|
26
|
+
|
|
27
|
+
## Reporting a vulnerability
|
|
28
|
+
|
|
29
|
+
Please use GitHub's private vulnerability reporting:
|
|
30
|
+
|
|
31
|
+
<https://github.com/hanhan9999999999999999999/dsh-memory-nebula/security/advisories/new>
|
|
32
|
+
|
|
33
|
+
Do not open a public issue for a vulnerability. Include the version, the
|
|
34
|
+
affected route or file, and a minimal reproduction when possible. Reports that
|
|
35
|
+
only need a configuration change will be answered with the setting rather than
|
|
36
|
+
a release.
|
|
37
|
+
|
|
38
|
+
## Out of scope
|
|
39
|
+
|
|
40
|
+
- running the server on a public interface;
|
|
41
|
+
- a malicious local user who can already read the memory database;
|
|
42
|
+
- exported snapshot files shared by the user;
|
|
43
|
+
- third-party memory adapters that execute their own code.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 支持 / Support
|
|
2
|
+
|
|
3
|
+
## 先自查
|
|
4
|
+
|
|
5
|
+
1. 跑 `node scripts/doctor.mjs`(装了包就用包内路径);它只读,不改 profile。
|
|
6
|
+
2. 看 [docs/troubleshooting.md](docs/troubleshooting.md) 的对应症状。
|
|
7
|
+
3. 搜一下现有 issue,避免重复。
|
|
8
|
+
|
|
9
|
+
## 提 issue 时带上
|
|
10
|
+
|
|
11
|
+
- `dsh-memory-nebula` 版本、DSH 版本、操作系统、Node 版本;
|
|
12
|
+
- 安装方式:精选目录 / tgz / 源码;
|
|
13
|
+
- `doctor` 的完整输出(它不含记忆正文和路径);
|
|
14
|
+
- 复现步骤、期望结果、实际结果;
|
|
15
|
+
- 页面问题附截图;控制台错误附原文。
|
|
16
|
+
|
|
17
|
+
**不要贴**:记忆正文、`.npmrc`、token、私有路径。需要正文才能复现时,先用示例模式
|
|
18
|
+
(`?demo=1`)或自己造一条最小假数据。
|
|
19
|
+
|
|
20
|
+
## 安全漏洞
|
|
21
|
+
|
|
22
|
+
不要开公开 issue,走 [SECURITY.md](SECURITY.md) 里的 GitHub private advisory。
|
|
23
|
+
|
|
24
|
+
## 响应
|
|
25
|
+
|
|
26
|
+
这是 MIT 开源项目,按尽力而为处理,不承诺 SLA。需要商业支持/定制适配器,请在 issue 里
|
|
27
|
+
说明场景与时间要求,再单独约定。
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
For English: run `doctor`, read `docs/troubleshooting.md`, then open an issue with version,
|
|
32
|
+
OS/Node, install method, full `doctor` output, steps and expected/actual. Never paste memory
|
|
33
|
+
text, tokens, `.npmrc`, or private paths. Security reports go through `SECURITY.md`.
|