@elvisw/dsh-magic-context 0.0.0-stage → 0.14.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.
Files changed (66) hide show
  1. package/LICENSE +23 -0
  2. package/NOTICE +93 -0
  3. package/README.md +501 -2
  4. package/README.zh-CN.md +398 -0
  5. package/cordis.patch.yml +20 -0
  6. package/lib/client.js +2753 -0
  7. package/lib/core/compartments.js +424 -0
  8. package/lib/core/corpus-store.js +176 -0
  9. package/lib/core/directive-detect.js +147 -0
  10. package/lib/core/domain-reconcile.js +394 -0
  11. package/lib/core/domains.js +127 -0
  12. package/lib/core/embedding-local.js +247 -0
  13. package/lib/core/global-autostage.js +223 -0
  14. package/lib/core/global-domains.js +302 -0
  15. package/lib/core/journal.js +248 -0
  16. package/lib/core/llm-deadline.js +53 -0
  17. package/lib/core/machine-domain.js +106 -0
  18. package/lib/core/maintenance.js +380 -0
  19. package/lib/core/memory-bridge.js +818 -0
  20. package/lib/core/memory-categories.js +84 -0
  21. package/lib/core/memory-scoring.js +65 -0
  22. package/lib/core/memory-search.js +414 -0
  23. package/lib/core/memory-write.js +1176 -0
  24. package/lib/core/policy.js +111 -0
  25. package/lib/core/profile-confirmation.js +55 -0
  26. package/lib/core/profile-review.js +375 -0
  27. package/lib/core/profile-write.js +283 -0
  28. package/lib/core/reference-seeds.js +63 -0
  29. package/lib/core/route-health.js +106 -0
  30. package/lib/core/stores.js +1021 -0
  31. package/lib/core/tagger.js +7 -0
  32. package/lib/core/types.js +15 -0
  33. package/lib/core/vector-backfill.js +140 -0
  34. package/lib/core/vector-lane.js +184 -0
  35. package/lib/dsh/command-surface.js +376 -0
  36. package/lib/dsh/compaction-engine.js +231 -0
  37. package/lib/dsh/config-switches.js +56 -0
  38. package/lib/dsh/config.js +13 -0
  39. package/lib/dsh/context-pressure.js +36 -0
  40. package/lib/dsh/drop-landing.js +42 -0
  41. package/lib/dsh/emergency.js +89 -0
  42. package/lib/dsh/flush-command.js +148 -0
  43. package/lib/dsh/global-review.js +412 -0
  44. package/lib/dsh/historian.js +907 -0
  45. package/lib/dsh/live-journal.js +81 -0
  46. package/lib/dsh/maintenance-wiring.js +229 -0
  47. package/lib/dsh/management-pass.js +564 -0
  48. package/lib/dsh/memory-lane.js +535 -0
  49. package/lib/dsh/pre-step.js +675 -0
  50. package/lib/dsh/project-drift.js +116 -0
  51. package/lib/dsh/recomp.js +192 -0
  52. package/lib/dsh/reduce-guidance.js +188 -0
  53. package/lib/dsh/seams.js +588 -0
  54. package/lib/dsh/search-hint.js +186 -0
  55. package/lib/dsh/session-notice.js +100 -0
  56. package/lib/dsh/status-command.js +75 -0
  57. package/lib/dsh/telemetry.js +349 -0
  58. package/lib/dsh/tool-bridge.js +1009 -0
  59. package/lib/dsh/volatile.js +89 -0
  60. package/lib/index.js +931 -0
  61. package/package.json +108 -4
  62. package/tools/migrate-profile-package-name.mjs +317 -0
  63. package/vendor/onnx/LICENSE +27 -0
  64. package/vendor/onnx/ort-wasm-simd-threaded.mjs +59 -0
  65. package/vendor/onnx/ort-wasm-simd-threaded.wasm +0 -0
  66. package/vendor/onnx/ort.node.min.mjs +8 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ufuk Altinok — magic-context (https://github.com/cortexkit/magic-context)
4
+ Copyright (c) 2026 wukai — the DeepSeek Harness adapter in this repository
5
+ Copyright (c) 2026 elvisw — fork modifications in this repository
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,93 @@
1
+ # Notices
2
+
3
+ This repository is the DeepSeek Harness adapter extracted from **magic-context**.
4
+ It carries work from more than one project, under more than one copyright, and
5
+ MIT requires the notices to travel with it. This file records where each part
6
+ came from and the exact revisions it was taken at.
7
+
8
+ ## This fork
9
+
10
+ The npm package `@elvisw/dsh-magic-context` is maintained by **elvisw**
11
+ (https://github.com/elvisw). It is a fork of the DSH adapter previously
12
+ published as `dsh-plugin-magic-context` by wukai; the fork used
13
+ `@elvisw/dsh-plugin-magic-context` for `0.12.x` and renamed to
14
+ `@elvisw/dsh-magic-context` in `0.13.0`. The upstream package and repository
15
+ are not modified by this fork; upstream credit and the notices below remain in
16
+ force. The loader row id (`magic-context-dsh`), settings namespace, and plugin
17
+ data directory are intentionally unchanged.
18
+
19
+ Upstream DSH adapter: `wk544863858/dsh-plugin-magic-context`, npm
20
+ `dsh-plugin-magic-context@0.11.2` (last public release, 2026-11-11), MIT,
21
+ Copyright (c) 2026 wukai — the DeepSeek Harness adapter in this repository.
22
+ Fork modifications are Copyright (c) 2026 elvisw, also under MIT.
23
+
24
+ Starting with 0.12.0 this fork differs from upstream 0.11.2 in its recovery
25
+ semantics (`ctx_expand` returns a new result and leaves the old placeholder and
26
+ tag dropped), the `message` locator for raw results shadowed by a Historian
27
+ compartment, manual `/ctx-flush`, durable drop-state decisions, and the removal
28
+ of the 30-day tag prune / `tags.retentionDays` / `pruneTags`. The plugin schema
29
+ moves to v11 (`pending_drops.flush_requested`). `0.13.0` renames the npm package
30
+ to `@elvisw/dsh-magic-context` and adds a one-time profile patch name migration;
31
+ the row id, settings namespace, data directory, schema and stored format stay
32
+ the same. Co-installing the upstream package, the 0.12.x fork package, or this
33
+ package is unsupported: the loader keeps one duplicate row id, so remove the old
34
+ package before installing this one.
35
+
36
+ ## magic-context — https://github.com/cortexkit/magic-context
37
+
38
+ MIT License, Copyright (c) 2025 Ufuk Altinok.
39
+
40
+ The adapter is derived from this project: it shares its memory contracts, its
41
+ on-disk formats, and its design language. Extracted from upstream tag
42
+ **v0.46.0** (commit `651c105a9`). The adapter's own commits were replayed out of
43
+ the `dsh` branch of a local magic-context checkout at `e34eda955`
44
+ (2026-10-08) — 60 commits, authors and dates preserved.
45
+
46
+ The adapter's own database lives under the upstream project's directory
47
+ (`~/.local/share/cortexkit/magic-context-dsh-poc`) and reads the shared memory
48
+ bank at (`~/.local/share/cortexkit/magic-context/context.db`) on purpose: that
49
+ is the interoperability path with magic-context, so the namespace stays.
50
+
51
+ ## DeepSeek Harness (DSH) — https://github.com/deepseek-ai/deepseek-harness
52
+
53
+ MIT License.
54
+
55
+ DSH is a separate project and is **not** included here; its packages are
56
+ consumed as dependencies. The adapter implements the DSH plugin seams
57
+ (`@deepseek-ai/cordis`, `@deepseek-ai/dsh-agent`, `-compaction`, `-llm`,
58
+ `-session`, `-tools`, and the client/session services). It is written against
59
+ DSH **0.2.1-rc.1** — checkout `1600d8a1e`, published on npm under the
60
+ coordinated dist-tag `next`.
61
+
62
+ Note that npm's `latest` tag on those packages is an *older* release line
63
+ (`0.0.1-rc.x` / `0.1.0-rc.6`); the pinned `devDependencies` are what the suite
64
+ is tested against. Individual `@deepseek-ai` packages are BSD-3-Clause rather
65
+ than MIT where their own metadata says so; that is their licence, not this
66
+ repository's.
67
+
68
+ ## Vendored file: `tests/helpers/mock-adapter.ts`
69
+
70
+ MIT License, Copyright (c) 2026 DeepSeek.
71
+
72
+ Taken verbatim from DSH (`packages/core/agent-loop/tests/mock-adapter.ts`,
73
+ MIT) so that this repository's suite runs without a DSH checkout. The body is
74
+ byte-identical to upstream; only a provenance header was added.
75
+
76
+ ## Vendored files: `vendor/onnx/` — onnxruntime-web (WASM backend subset)
77
+
78
+ MIT License, Copyright (c) Microsoft Corporation.
79
+
80
+ Three files taken verbatim from `onnxruntime-web`
81
+ **1.31.0-dev.20260914-8d85527a0** (`dist/ort.node.min.mjs`,
82
+ `dist/ort-wasm-simd-threaded.mjs`, `dist/ort-wasm-simd-threaded.wasm`)
83
+ so the local embedding lane runs on WebAssembly without the ~287 MB native
84
+ `onnxruntime-node` package. Verified against the native fp32 pipeline at
85
+ cosine 1.0000000 (2026-10-09). The upstream MIT license text travels with them
86
+ at `vendor/onnx/LICENSE`. The tokenizers binding (`@huggingface/tokenizers`,
87
+ Apache-2.0) is consumed as a normal npm dependency, not vendored.
88
+
89
+ ## Everything else
90
+
91
+ No other third-party code is bundled. The build output (`lib/`) is compiled
92
+ from this repository's own `src/`, and the browser half is hand-written here;
93
+ `scripts/copy-client.mjs` copies it verbatim.
package/README.md CHANGED
@@ -1,3 +1,502 @@
1
- # Temporary Holding Version
1
+ # Magic Context for DeepSeek Harness — elvisw fork
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/elvisw/dsh-plugin-magic-context/actions/workflows/ci.yml/badge.svg)](https://github.com/elvisw/dsh-plugin-magic-context/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@elvisw/dsh-magic-context)](https://www.npmjs.com/package/@elvisw/dsh-magic-context)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+ [![Node](https://img.shields.io/badge/node-%3E%3D22.19-brightgreen.svg)](package.json)
7
+ [![DeepSeek Harness](https://img.shields.io/badge/DSH-0.2.x-blue.svg)](package.json)
8
+
9
+ > **English** | [简体中文](README.zh-CN.md)
10
+
11
+ > Anyone who has run long sessions knows the symptoms: the project details you worked out
12
+ > yesterday are gone today, so the same pit gets re-dug; tool outputs bloat the context
13
+ > window; and every compaction busts the cache prefix, so the expensive part re-runs.
14
+ >
15
+ > [Magic Context](https://github.com/cortexkit/magic-context)'s answer: **knowledge should
16
+ > persist, context should be managed.** This plugin gives **DeepSeek Harness (DSH)**
17
+ > sessions a **persistent, project-aware memory** — knowledge distilled from your sessions
18
+ > survives restarts, is searchable with hybrid full-text + local vector search, and is
19
+ > re-injected right where the model reads it — while the context window itself is run as
20
+ > an asset: tool results become tagged, reclaimable history, digests come back as
21
+ > four-level summaries, and none of it ever breaks the live KV-cache prefix.
22
+
23
+ - **Memory that outlives the session** — a project corpus in the plugin's own SQLite store;
24
+ historian facts auto-promote into it, `ctx_memory` reads/writes/maintains it, and project
25
+ identity is auto-derived (git root or directory).
26
+ - **Local-first retrieval** — MiniLM embeddings via WebAssembly (no native build, no API
27
+ keys), hybrid full-text 0.7 / vector 0.3 ranking, fail-open to full-text on any failure.
28
+ - **Sharing with a human gate** — machine/org global domains: staging can be automated,
29
+ publishing is always yours (approval cards, `/ctx-global approve`); a user-profile layer
30
+ rides on top with read / collect / review as separate switches.
31
+ - **Reversible reclaim, cache-aware compaction** — `ctx_reduce` only queues; drops land as
32
+ `[dropped §N§]` placeholders and `ctx_expand` returns the original as a new result; history digests into
33
+ p1–p4 summaries published as range replacements — never a spontaneous prefix bust.
34
+ - **Conservative by default** — the host `compaction-basic` engine stays in place unless
35
+ you explicitly opt in.
36
+
37
+ Requires **Node ≥ 22.19** and a **DSH 0.2.x host with the Web client** (the desktop app or
38
+ a `web` profile). The package ships compiled — install straight from the npm registry:
39
+
40
+ ```bash
41
+ dsh plugin --profile web add @elvisw/dsh-magic-context
42
+ ```
43
+
44
+ > Package identity: the unscoped `dsh-magic-context` on npm is an unrelated
45
+ > implementation by another maintainer, not this fork or its upstream. This fork
46
+ > is published only as `@elvisw/dsh-magic-context`; keep the `@elvisw/` scope in
47
+ > every install command.
48
+
49
+ `0.13.0` introduced this package name; the current release is `0.14.0`, which adds the
50
+ top-level Settings page. If you installed
51
+ `@elvisw/dsh-plugin-magic-context` (0.12.x) or the upstream
52
+ `dsh-plugin-magic-context`, remove it first: all three use the same loader row id
53
+ (`magic-context-dsh`), so co-install is unsupported: the loader keeps one row and
54
+ settings may disappear. Upgrading from 0.12.x also
55
+ needs the one-time profile patch migration described in
56
+ [docs/independent-package-release.md](docs/independent-package-release.md); the helper is
57
+ shipped in the npm tarball and the hand-out bundle.
58
+
59
+ New to the plugin? A five-minute tour follows in [Quick start](#quick-start);
60
+ configuration, tools and architecture are covered in full below. A complete Chinese
61
+ translation is at [README.zh-CN.md](README.zh-CN.md). Contributions are welcome — see
62
+ [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
63
+
64
+ ## Quick start
65
+
66
+ After installing, restart the profile unless it has HMR enabled; with HMR the new
67
+ version hot-loads. In your next session:
68
+
69
+ - Tool results carry `§N§` tags; a **telemetry badge** appears in the overlay showing live
70
+ context occupancy, with a panel of live metrics and an operation record behind it.
71
+ - A **Settings → Magic Context** page edits the options the card exposes; the same card is still
72
+ available on the GUI Plugins page as the legacy location/fallback.
73
+ - The `ctx_reduce` / `ctx_expand` / `ctx_memory` tools are registered for the agent;
74
+ project memory is **on by default** — facts distilled by the historian persist across
75
+ sessions and surface where the model reads them.
76
+
77
+ Context reclaim, in one exchange (real parameter names):
78
+
79
+ ```text
80
+ you: ctx_reduce {"drop": "4-7"} # four tool outputs are no longer worth the tokens
81
+ agent: queued 4 item(s) — the drops land as placeholders in the next reclaim band
82
+ …later in the transcript…
83
+ [dropped §4§] [dropped §5§] [dropped §6§] [dropped §7§]
84
+ you: ctx_expand {"tag": "5"} # wait — what was in §5 again?
85
+ tool: the original text of §5, as a new result — the §5 placeholder stays dropped
86
+ ```
87
+
88
+ The only opt-in surface is the compaction takeover (`registerCompactionEngine`, off by
89
+ default — see [Configuration](#configuration)).
90
+
91
+ ## What it does
92
+
93
+ Memory first, context management second — the first five rows are the memory system, the
94
+ last five manage the context window (full design in [Architecture](#architecture) and
95
+ [PARITY.md](PARITY.md)):
96
+
97
+ | Capability | Mechanism |
98
+ |---|---|
99
+ | **Project memory (own corpus)** | Plugin's own SQLite store (`memories.db`), hard-split from upstream — no shared storage, no compatibility duty. Project identity auto-derived (`git:<root-sha>` / `dir:<hash>`); injected into the m[0] baseline and served to `ctx_memory` for read/write; historian facts auto-promote; FTS 0.7 / vector 0.3 hybrid retrieval |
100
+ | **Local vector lane** | MiniLM embeddings run locally via the bundled onnxruntime-web WASM backend — no native build, no API keys; the model download is pinned by revision + sha256 (mirror fallback), cached in the plugin data dir; retrieval candidates get inline + maintenance-tick backfill; any failure fails open to full-text search |
101
+ | **m[0]/m[1] memory baseline** | A synthetic notice node carries the frozen baseline plus incremental lanes (`<new-memories>` / `<memory-updates>` / `<user-profile>`); each lane keeps its own watermark, so new memory never rebuilds the cached prefix — unchanged content produces zero diff |
102
+ | **Global domains + user profile** | machine/org domains: **staging can be automated** (maintenance tick, LLM classification), **publishing is always human** (approval cards, `/ctx-global approve`); the user profile's render / collect / review are separate switches |
103
+ | **Maintenance tick (MC dreamer slice)** | Every 30 min: TTL archiving → batched LLM verify (keep / update / archive) → vector backfill → global-domain candidate staging |
104
+ | **Reversible context reclaim** | Tool results get `§N§` tags; `ctx_reduce` **only queues** — drops land in the execute band as `[dropped §N§]` placeholders referencing the originals; `ctx_expand` returns the original text as a new result while the placeholder stays dropped. The cached prefix is never busted spontaneously |
105
+ | **Pressure scheduling** | Persistent usage (incl. cache reads/writes) → pressure score → execute/defer decisions (65% threshold, 5 min cache TTL, 85% force band); `CONTEXT_WINDOW_EXCEEDED` triggers emergency reclaim + retry; tiered reduce-guidance nudges |
106
+ | **Historian (out-of-band digest)** | One LLM call replays the real prefix (KV cache preserved) → four-tier p1–p4 summary + facts/events, **writes the store only, never touches the wire**; published in the execute band as a `[compacted §C<n>§]` range replacement; `/ctx-recomp` redoes compacted history in place |
107
+ | **Compaction seam** | `registerCompactionEngine` can take over `ctx.compaction` (real `compaction/start\|summary\|replace\|end` protocol); **off by default** — the host compaction-basic stays in place |
108
+ | **UI integration** | Top-level **Settings → Magic Context** page plus the legacy Plugins-page card (volatile fields, save = live); catalog-backed Historian reasoning-effort picker; `shell.overlay` telemetry badge + capsule panel (live metrics + operation record); `session-notice` rows in the session stream; Chinese/English instant switching for every card-owned string |
109
+
110
+ ## Installation
111
+
112
+ From the npm registry — recommended; the package ships compiled `lib/` and `vendor/`, no
113
+ local build needed:
114
+
115
+ ```bash
116
+ dsh plugin --profile web add @elvisw/dsh-magic-context
117
+ ```
118
+
119
+ Registry versions are published automatically by tag pushes (with npm provenance
120
+ signatures); see the "Releasing" section of [CONTRIBUTING](CONTRIBUTING.md).
121
+
122
+ ### From source (development)
123
+
124
+ ```bash
125
+ git clone https://github.com/elvisw/dsh-plugin-magic-context
126
+ cd dsh-plugin-magic-context
127
+ npm install
128
+ npm run build # tsc → lib/ (multi-file ESM) + browser half copied to lib/client.js
129
+ dsh plugin --profile web add <path to this repo> # the CLI ships with the app; the spec can be a Git URL, a local path, or a registry version
130
+ ```
131
+
132
+ Installing does three things: `pnpm add` into the profile (`link:` for local paths),
133
+ appends the package name to `dsh.profile.bundles`, and the loader composes it. When the
134
+ profile has HMR enabled, changes take effect immediately (no restart; running sessions
135
+ start tagging right away); otherwise reload the page or restart the profile.
136
+
137
+ - All `@deepseek-ai/*` in `peerDependencies` are declared `"*"` — the compatibility
138
+ precheck passes on any DSH 0.2.x; the host packages actually imported at runtime are
139
+ also listed as **exact-version dependencies** (resolved with the package; `link:` dev
140
+ installs are served by this repo's own node_modules).
141
+ - **Node ≥ 22.19** required: the stores build on the built-in `node:sqlite`, no native
142
+ modules. A CLI/`web` profile runs on Node; the desktop app supplies an Electron
143
+ RunAsNode runtime; both need the `node:sqlite` version that Node 22.19 provides.
144
+ - **Tool-constructor resolution**: `config.defineTool` (host-injected, used by in-tree
145
+ glue) first, then dynamic `import('@deepseek-ai/dsh-tools')` (a hard dependency,
146
+ physically resolvable in every install shape). If both are unavailable the mount **fails
147
+ loudly** — the ctx_* tools are the only entry point for reclaim tags; no silent
148
+ half-boot.
149
+ - Two loading modes: **patch-overlay / file URL** (development: overlay yml +
150
+ `config.defineTool` injection) and **profile install** (production: package-name line +
151
+ link dependency). The production path is the `dsh plugin add` above.
152
+
153
+ Uninstall / disable: disable the bundle on the GUI Plugins page (writes `disabled` into
154
+ the profile patch), or `dsh plugin --profile web remove @elvisw/dsh-magic-context`.
155
+
156
+ ## Configuration
157
+
158
+ Two ways to change configuration, with different semantics (see the
159
+ [Settings UI contract](docs/dsh-plugin-settings-ui-contract.md)):
160
+
161
+ - **GUI settings page (Settings → Magic Context)**: exposes `policy.*` (incl. historian
162
+ generation cap / ceiling / timeout), `historianEnabled`, `registerCompactionEngine`,
163
+ `journal.*`, `maintenance.*`, `historian.*` and other volatile fields. The two
164
+ provider/model **route pins** (maintenance verify, historian generation) prefer a
165
+ dropdown fed by the **host's configured model catalog** (client
166
+ `remote.session.modelCatalog()`), with "Auto = follow the session route" and clearing;
167
+ shells without that RPC fall back to plain text (values remain hand-editable). The
168
+ Historian reasoning-effort field is the same catalog-backed picker: `Default`, the
169
+ routed model's advertised ids, and `Custom` for legacy/unknown values; an Auto route
170
+ keeps the text input. Writes go through the settings chain: non-volatile keys are
171
+ preserved untouched, untouched fields never materialize into override rows — **saving
172
+ takes effect immediately** (the host side always reads through
173
+ `liveNumber/liveBoolean/liveString/liveRoute` at the decision point).
174
+ - **Hand-written profile override rows**: `config` **replaces** the package patch's config
175
+ wholesale — it is **not** a deep merge. Writing only `memory:` erases
176
+ `registerCompactionEngine: false`. When hand-writing overrides you must spell out every
177
+ key you want to keep.
178
+
179
+ The bundle's built-in config is one line: `registerCompactionEngine: false` — a
180
+ conservative first install that keeps the host compaction engine in place (memory, reclaim
181
+ and historian are on by default). To take over compaction:
182
+
183
+ ```yaml
184
+ - id: magic-context-dsh
185
+ name: '@elvisw/dsh-magic-context'
186
+ config:
187
+ registerCompactionEngine: true
188
+ - id: compaction-basic
189
+ name: '@deepseek-ai/dsh-compaction-basic'
190
+ disabled: true # mutually exclusive; taking over requires disabling the host engine too
191
+ ```
192
+
193
+ Configuration reference (full types in [src/dsh/config.ts](src/dsh/config.ts); all keys
194
+ writable as profile override rows unless noted):
195
+
196
+ | Group | Keys (defaults) | Notes |
197
+ |---|---|---|
198
+ | Master switches | `enabled` (true) · `registerTools` (true) · `registerStatusCommand` (true) · `sessionNotices` (true) · `reduceGuidance` (true) · `searchHint` (true) | `enabled: false` stays loaded but fully inert; `sessionNotices` controls the management notice rows in the session stream |
199
+ | Compaction seam | `registerCompactionEngine` (code default: mount when resolvable; **ships false in the bundle**) · `compactionBase` (host-injected base class) | Taking over requires disabling compaction-basic too; pre-step `reconcileEngine` mounts/unmounts dynamically every step |
200
+ | Pressure policy | `policy.*`: `executeThreshold` (65) · `forceThreshold` (85) · `ttlMs` (5 min) · `assumedContextWindow` (256k) · `protectedToolResults` (8) · `historianTimeoutMs` (120 s) · `historianMaxTokens` (8192, raised to 8192 if set lower) · `historianMaxTokensCeiling` (32768) · `baselineTokens` (2000) · `memoryBudgetTokens` (8000) · `memoryLimit` (40) · `forceWaitReadyMs` (0) | Thresholds take effect at the next decision point (incl. `/ctx-status` and the compaction-engine paths). `compartmentGuardMode` / `compartmentEntrantTokens` (publish guards) were retired and are no longer configurable |
201
+ | historian | `historianEnabled` (true) · `historian.{provider, model}` (**pinned as a pair**; empty = follow the session's last route) · `historian.reasoningEffort` (optional, blank = model default) | Generation route for out-of-band digests and `/compact` summaries; the GUI Settings page has "Historian provider/model" dropdowns (Auto = follow session, recommended) and a catalog-backed reasoning-effort picker: `Default`, the routed model's advertised ids, and `Custom` for legacy/unknown values. The Auto route keeps a text input because the session model is unknown there; an unadvertised id is never silently remapped or clamped. A provider-level `OUTPUT_TOKEN_LIMIT` empty completion is retried with the normal cap escalation. The only LLM spend besides verify |
202
+ | Project memory | `memory.{}`: `enabled` (true, on by default since 0.9.0 — opt out with `enabled: false`) · `dbPath` · `project` (omitted = session cwd) · `domainProjects` · `shareCategories` · `autoPromote` (true) · `write` (true) | `write: false` makes `ctx_memory` read-only |
203
+ | Retrieval / vectors | `memory.embedBackfill` (true, query-side inline backfill) · `memory.vectorBackfill` (true, maintenance-tick backfill) · `memory.vectorBackfillLimit` (24 rows/tick) | Any vector-lane failure fails open to FTS |
204
+ | S(t) decay | `memory.scoring.{enabled (true), alpha (0.4), beta (0.2), archiveThreshold (2), halfLives}` | Stats are always collected; the distribution default enabled=true takes over ranking; profile-JSON only, not on the settings card |
205
+ | Global domains | `memory.global.machine.{enabled (true), excludeProjects, autoStage (true)}` · `memory.global.user.{render (true), collect (true), review (true)}` · `memory.global.review.batchLimit` (50) | Defaults all on: staging can be automated (≤3/pass, paused at ≥10 pending candidates), **publishing is always human**; LLM classification failure is fail-closed |
206
+ | User profile | `memory.global.user.{render (true), collect (false), review (false)}` | Read / collect / review are independent halves; the two halves that write to the shared store are off by default |
207
+ | Domain resolution | `memory.domains.source` (`adapter` \| `contract`) | `contract` is a fallback pole for comparison, not a supported end state |
208
+ | Maintenance | `maintenance.{enabled, intervalMs (30 min), verifyProvider, verifyModel}` | LLM verify needs an explicit route (unpinned = follow the conversation's latest route); the GUI card offers host-catalog dropdowns, Auto = unpinned (same picker for both pins) |
209
+ | Observability | `journal.{enabled (true), level (info), retentionDays (30), mirror (true)}` | level/mirror apply to the next write; a journal that was off at mount needs a restart to turn on at runtime; `retentionDays` has a `min(1)` floor against accidental pruning. §N§ tag rows have no age-based TTL; this adapter has no automatic message/session deletion path today |
210
+
211
+ ## Tools & commands
212
+
213
+ Agent tools (registered at mount; `registerTools: false` turns them off):
214
+
215
+ | Tool | What it does |
216
+ |---|---|
217
+ | `ctx_reduce` | Parses MC range syntax (`"3-5,8"`) → **queues only**; landing is a priced bust that waits for the reclaim band, never spontaneous |
218
+ | `ctx_expand` | **Returns the original text as a new result**, read from the persisted log by `tag` (single), the deprecated `tags` alias, or `message` (a DSH log event seq in the current session for an already dropped item; `[compacted §C…§]` nodes are not accepted) — the old placeholder and its spent tag stay in place. Tag is primary; message is a fallback, not a general history browser. `start`/`end` (inclusive DSH log event seq, not upstream message ordinals) read a read-only `user`/`assistant`/`tool/result` transcript without requiring a drop; `verbose` previews 200 characters per part under the shared 15k budget. `[compacted §C…§]` bookkeeping is excluded while `[dropped §N§]` stays literal when the range reads raw history; a range whose readable events are all still live returns a live-surface sentence instead of duplicating them. No recovery is promised once the raw event is gone |
219
+ | `ctx_memory` | The shared memory store's read/write port. Reads: `list` / `search` / `get`; writes: `write` / `update` / `archive` / `merge` (with MC's normalized content hashing, mutation log and authority guards in the loop throughout); `review_global` (surfaces machine/org domain candidates one by one as approval cards; publishes only on approval); `promote` (stages a single project memory instantly — a manual lane with no recurrence gate). Every action accepts `project` (absolute path or git root) to operate on another project |
220
+
221
+ Slash commands (`registerStatusCommand: false` disables this command surface):
222
+
223
+ | Command | What it does |
224
+ |---|---|
225
+ | `/ctx-status` | pressure / decisions / reclaim ledger / compartments / baseline / policy |
226
+ | `/ctx-flush` | mark this session's pending `ctx_reduce` drops for landing on the next message; reports requested/already/pending counts; when the queue is empty, reports the last landed drop count/time for this session; starts no historian, recomp, summary, or model call |
227
+ | `/ctx-recomp` `all` \| `last:<n>` \| `<startSeq>-<endSeq>` | re-runs the historian and **replaces the stored digest in place** (ranges snap to compartments, never split; identity and landed placeholders unchanged, the next pre-step rebuilds the baseline) |
228
+ | `/ctx-profile` `confirm` \| `reject` \| `retire` | confirm / reject / retire user-profile candidates; promotion into the shared profile happens at the next maintenance tick |
229
+ | `/ctx-global` `add` \| `remove` \| `status` \| `promote` \| `approve` \| `reject` | the manual lane for global-domain membership and candidate approval (same gate→publish path as the approval cards, `source_type=user`) |
230
+
231
+ ## UI & telemetry
232
+
233
+ Both UI capabilities ride the same browser half (`src/client/index.js`, copied verbatim to
234
+ `lib/client.js` at build time):
235
+
236
+ - **Settings → Magic Context** (top-level Settings page): visual editing of the volatile
237
+ config above; saving takes effect immediately (see "Configuration"). The same card stays
238
+ on the Plugins page as the legacy location and fallback for hosts without the
239
+ `settings.section` slot.
240
+
241
+ ![Magic Context settings card on the DSH Plugins page — execute/force thresholds, scheduling window, reclaim TTL, protected results, historian minimum nodes](https://raw.githubusercontent.com/elvisw/dsh-plugin-magic-context/main/docs/img/settings-card-top.jpg)
242
+
243
+ ![Lower half of the settings card — memory recall budget and limits, journal retention, historian and compaction toggles, verify/historian route selectors, journal switches](https://raw.githubusercontent.com/elvisw/dsh-plugin-magic-context/main/docs/img/settings-card-bottom.jpg)
244
+
245
+ - **`shell.overlay` telemetry badge + capsule panel**: collapsed state shows the occupancy
246
+ percentage; the panel holds two metric rows, the beat, and a **live operation record**
247
+ (up to 12 entries, adjacent identical operations folded as `×N`): 🧠 memory write ·
248
+ 🔎 memory load · 🗑️ reclaim queued · 🧭 original restored · ✂️ context compacted ·
249
+ 🗑️ context dropped · 🧭 archived-stored · 🧰 maintenance sweep · ⚠️ failure. Clicking
250
+ outside the panel/badge, Esc, or window blur closes it.
251
+
252
+ ![Telemetry capsule panel — live context pressure, occupancy metrics and a running record of recent reclaim and archive operations](https://raw.githubusercontent.com/elvisw/dsh-plugin-magic-context/main/docs/img/telemetry-panel.png)
253
+ - Data comes from the plugin's own HTTP routes (the harness's Remote event whitelist is a
254
+ compile-time constant; the supported seam for third-party bundles is
255
+ `ctx.webServer.register`):
256
+ - `GET /mc-telemetry/summary` — one-shot snapshot (adapter / project / health + recent
257
+ events)
258
+ - `GET /mc-telemetry/events` — SSE live tail
259
+ - **Security**: the routes are loopback-only with no token auth, so they **emit counts and
260
+ one-line summaries only** — no message bodies, no file paths, no credentials.
261
+ - **Languages**: browser-side `magic-context` namespace dictionaries (zh/en); every
262
+ card-owned label, hint, route placeholder, summary, form frame and picker caption follows
263
+ Settings → General instantly without a refresh. Host catalog values (provider/model/effort
264
+ names) stay as the host sends them. The `session-notice` rows written into the session
265
+ stream (model-visible) stay English constants (to avoid cached-prefix churn from
266
+ mid-session language switches). Mechanics in the
267
+ [Settings UI contract](docs/dsh-plugin-settings-ui-contract.md) and the
268
+ [historical UI telemetry host analysis](docs/dsh-plugin-ui-telemetry-contract.md).
269
+
270
+ ## Observability & operations
271
+
272
+ Desktop **does not persist `ctx.logger` output**, so the plugin writes its decisions and
273
+ outcomes into its own append-only journal:
274
+
275
+ - `~/.local/share/cortexkit/magic-context-dsh-poc/dsh-magic-context.db` → `journal` table
276
+ (structured, SQL-queryable)
277
+ - `~/.local/share/cortexkit/magic-context-dsh-poc/activity.log` → single-line text mirror
278
+ (`tail`/grep friendly, auto-rotates to `.1` past 5 MiB)
279
+
280
+ **Privacy**: message bodies are **never logged**. Only counts, tag numbers, token
281
+ estimates, reasons and durations; strings truncate at 300 chars, arrays cap at 20 items
282
+ (`redactData` as the backstop).
283
+
284
+ Journal coverage (by group): lifecycle (`boot` / `config-drift` / `session-first-seen`);
285
+ reclaim & compaction (`pass` — every execute recorded, with **tokensBefore→After
286
+ net-reclaim proof** and defer reasons, `drop-landed`, `compartment-published`/`-recomp`/
287
+ `-guard`, `force-path`, `emergency-reclaim`, `context-pressure`); historian & baseline
288
+ (`historian` — start/done/failed pairs with LLM usage, `baseline`, `session-notice`,
289
+ `wire-repair`); memory (`memory-recall` / `profile-recall` / `memory-promote` /
290
+ `memory-stats` / `vector-lane` / `search-hint` / `project-drift` / `global-review`);
291
+ maintenance (`maintenance`); tools & engine (`tool-call` / `engine` / `error` — every
292
+ exception swallowed fail-open).
293
+
294
+ ### Operations commands
295
+
296
+ ```sh
297
+ npm test # vitest run
298
+ npm run gate # full gate: typecheck + suite + build + acceptance + memory audit + records
299
+ npm run doctor # read-only health report: corpus fence / event-lane heartbeat / dangling runs / embedding lane
300
+
301
+ node scripts/mc-report.mjs --days 7 [--json] [--session <id>] # journal retrospective report
302
+ node scripts/mc-acceptance.mjs [--hours 72 --json] # corpus acceptance, exit 1 on failure
303
+ npm run phase # phase gate: run one phase's suite with verdict and blind spots
304
+ ```
305
+
306
+ The retrospective report includes: stores and status, per-kind/per-day counts, key metrics
307
+ (execute/defer ratio and reason distribution, net reclaim, historian failure rate and
308
+ duration, emergency reclaims, tool calls), recent event details and health hints ("no
309
+ execute pass in the window" / "historian never ran" / "errors present" / "latest journal
310
+ event older than 24h", …).
311
+
312
+ `scripts/` specialists: retrieval-weight A/B (`retrieval-eval`), S(t) ranking offline diff
313
+ (`score-diff`), dilution & fold dashboard (`report-dilution`), domain-hit stats
314
+ (`report-hits`), historian failure classification (`report-classify`), embedding-model
315
+ precheck (`embedder-precheck`), reference-seed rebuild (`npm run build:seeds`),
316
+ panel-category validation (`mc-records-check`), i18n check (`npm run check:i18n`).
317
+
318
+ ## Architecture
319
+
320
+ ```
321
+ src/
322
+ dsh/ # ← the ONLY directory allowed to import @deepseek-ai/* (the
323
+ # anti-corruption layer). Event names, payload shapes and the
324
+ # surface vocabulary all live here; a DSH upgrade touches this
325
+ # directory only.
326
+ core/ # Neutral logic and storage: policy/stores/journal/memory-*/domains.
327
+ # No DSH dependency.
328
+ client/ # Browser half (settings card + telemetry badge), plain JS,
329
+ # copied verbatim to lib/client.js at build time.
330
+ index.ts # Composition root: boot probe (fail-loud) → seam listeners →
331
+ # neutral stores.
332
+ ```
333
+
334
+ Isolation discipline (DSH is in developer preview; breaking changes are expected — this
335
+ package's structural answer):
336
+
337
+ - **Fail-loud capability probing**: `probeDshSeams` validates seam availability at boot and
338
+ throws when absent — never silently pretends to manage context;
339
+ - **Version fences**: the adapter DB schema chain is at **v11** (forward migrations; a
340
+ newer DB refuses to open); the **own corpus** `memories.db` inherits the **v95** starting
341
+ point (switched 2026-10-13, numbering owned by this plugin; `MEMORY_SCHEMA_MAX_VERSION`
342
+ guards the migration line) — beyond it, reads refuse and writes degrade to read-only
343
+ with a loud warning;
344
+ - **Tests as probes**: the integration tests double as seam-contract tests — rerun after a
345
+ DSH upgrade and breakage localizes to `src/dsh/`;
346
+ - **Two-database layout**:
347
+ - **Adapter DB** `~/.local/share/cortexkit/magic-context-dsh-poc/dsh-magic-context.db`
348
+ (tags / usage / pending_drops / compartments / baseline / domains / queues / journal…,
349
+ schema v11);
350
+ - **Own corpus** `~/.local/share/cortexkit/magic-context-dsh-poc/memories.db` (project
351
+ memories + global-domain rows + profile + vectors; the legacy `context.db` is sealed
352
+ and unread — the 2026-10-13 hard split; the upstream relationship is feature-following
353
+ only, no storage-compat duty);
354
+ - **Upstream parity ledger**: effective-behavior alignment and deliberate differences
355
+ against the OpenCode / Pi adapters are tracked in [PARITY.md](PARITY.md) (aligned /
356
+ host-imposed / intentional verdicts, each citing host files).
357
+
358
+ ## Documentation index
359
+
360
+ The linked documents are maintained in this repository; most are written in
361
+ Chinese and a few are English.
362
+
363
+ ### Current documentation maintained by this fork
364
+
365
+ - [Magic Context Settings UI contract](docs/dsh-plugin-settings-ui-contract.md) (English) — the
366
+ current top-level Settings page, Plugins fallback, zh/en copy, and catalog-backed effort picker.
367
+ - [Operations runbook](docs/dsh-plugin-operations-runbook-2026-10-10.md) — daily/weekly checks,
368
+ thresholds, recovery, and backup commands.
369
+ - [Upgrade follow-up](docs/dsh-plugin-upgrade-followup.md) — the current re-alignment procedure.
370
+ Its §1 baseline is v0.49.30 and is **not** a v0.49.55 parity claim.
371
+ - [Independent package release](docs/independent-package-release.md) — package identity, migration,
372
+ and release procedure for `@elvisw/dsh-magic-context`.
373
+
374
+ ### Historical research and upstream snapshots
375
+
376
+ These are preserved for provenance. They are **not current guarantees**; each file has its own
377
+ `> Status:` header with the evidence baseline.
378
+
379
+ **Historical contracts**
380
+
381
+ - [Memory write contract](docs/dsh-plugin-memory-write-contract.md) — mixed 2026-10 storage snapshot;
382
+ the current corpus is `memories.db`, and §8 authority is historical.
383
+ - [Memory promotion contract](docs/dsh-plugin-memory-promotion-contract.md) — upstream promotion research.
384
+ - [Memory acceptance](docs/dsh-plugin-memory-acceptance.md) — 2026-10 evidence (v6/v94 era).
385
+ - [Config UI contract](docs/dsh-plugin-config-ui-contract.md) — historical; its plugin-specific
386
+ conclusions are superseded by the current Settings UI contract.
387
+ - [UI telemetry contract](docs/dsh-plugin-ui-telemetry-contract.md) — historical host-seam analysis.
388
+ - [Hooks coverage (2026-10-08)](docs/dsh-plugin-hooks-coverage-2026-10-08.md) — historical coverage audit.
389
+
390
+ **Design decisions**
391
+
392
+ - [Port feasibility (seam map)](docs/dsh-port-feasibility-2026-10-06.md)
393
+ - [Platform takeover & global domains](docs/dsh-plugin-platform-takeover-and-global-domains-2026-10-09.md)
394
+ - [Dreamer vector decision](docs/dsh-plugin-dreamer-vector-decision-2026-10-08.md)
395
+ - [Memory mechanisms inventory](docs/memory-mechanisms-inventory-2026-10-09.md)
396
+ - [Upstream source analysis](docs/upstream-source-analysis-2026-10-09.md)
397
+ - [Global-domain source finding](docs/global-domain-source-finding-2026-10-10.md)
398
+ - [Memory architecture challenge](docs/memory-architecture-challenge-2026-10-10.md)
399
+ - [Domain naming decision (2026-10-25)](docs/domain-naming-work-global-2026-10-25.md)
400
+
401
+ **Audits & retrospectives**
402
+
403
+ - [Test design audit](docs/dsh-plugin-test-design-audit-2026-10-07.md)
404
+ - [Surface write audit](docs/dsh-surface-write-audit-2026-10-09.md)
405
+ - [Local embedding runtime audit](docs/local-embedding-runtime-audit-2026-10-15.md)
406
+
407
+ **Reports**
408
+
409
+ - [Dreamer token usage](docs/reports/dreamer-token-usage.md)
410
+ - [Memory solutions comparison](docs/reports/memory-solutions-comparison.md)
411
+
412
+ **Upstream handoffs**
413
+
414
+ - [Upstream follow-up v0.46.0 → v0.49.30](docs/upstream-followup-2026-10-30.md)
415
+ - [/ctx-flush research handoff (0.11.1)](docs/research-handoff-ctx-flush-2026-11-11.md)
416
+
417
+ ## Known limits
418
+
419
+ - Historian triggering and budgeting use **chars/4 estimates**, not a real tokenizer
420
+ (retrieval vectorization does use a real one); the four-tier digest is produced in **one
421
+ call** (MC accumulates across calls);
422
+ - `review_global` approval cards must be raised inside an agent turn; headless without a
423
+ responder it refuses explicitly with zero state change;
424
+ - A journal that was off at mount needs a restart to turn on at runtime (all other
425
+ journal / threshold changes apply immediately);
426
+ - Desktop does not persist the harness logger — observability rests entirely on the
427
+ self-kept journal.
428
+
429
+ ## Contributing
430
+
431
+ - Contributing guide: [CONTRIBUTING.md](CONTRIBUTING.md) (environment, code conventions,
432
+ PR flow)
433
+ - Security reports go through the private channel: [SECURITY.md](SECURITY.md)
434
+ - Code of conduct: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
435
+ - Changelog: [CHANGELOG.md](CHANGELOG.md)
436
+
437
+ This repo uses npm as its only package manager (`package-lock.json` is the truth); CI runs
438
+ typecheck → test → build → check:i18n on Node 22.x / 24.x.
439
+
440
+ ## Provenance & license
441
+
442
+ ### Difference from the upstream DSH adapter
443
+
444
+ This repository is a fork of [`wk544863858/dsh-plugin-magic-context`](https://github.com/wk544863858/dsh-plugin-magic-context)
445
+ (npm `dsh-plugin-magic-context`). The upstream's last public release is `dsh-plugin-magic-context@0.11.2`
446
+ (2026-11-11); this fork published as `@elvisw/dsh-plugin-magic-context` from `0.12.0` through `0.12.3`,
447
+ and publishes as **`@elvisw/dsh-magic-context`** from `0.13.0`. Its versions and tags belong to the
448
+ fork. The upstream repository and npm package remain under their original maintainer; this fork does
449
+ not modify them.
450
+
451
+ Differences from upstream `0.11.2`, accumulated through `0.14.0`:
452
+
453
+ - **Recovery semantics**: `ctx_expand` no longer rewrites placeholders in place. It reads the persisted
454
+ original `tool/result`, returns it as a new tool result, and assigns a new tag. The old placeholder is
455
+ unchanged, the old tag stays dropped, and reducing it again is a no-op (`already dropped`). This is a
456
+ breaking change.
457
+ - **Raw reads after Historian**: `ctx_expand` accepts a `message` locator (the current session's DSH log
458
+ event seq, including an original `tool/result` shadowed by a Historian compartment). It does not rerun
459
+ the original tool and does not rewrite summaries or compartments.
460
+ - **Manual flush**: `/ctx-flush` marks the current session's pending drops for the next pre-step to land;
461
+ it does not start Historian, recomp, summarization, or a model call.
462
+ - **Durable drop state**: `ctx_reduce`/`ctx_expand` decide from the `pending_drops` `none`/`pending`/
463
+ `landed` state instead of whether a placeholder is still on the current surface; a restored old tag no
464
+ longer produces a fake “Queued” receipt.
465
+ - **Tag retention**: the mount-time 30-day tag prune, the `tags.retentionDays` config, and
466
+ `AdapterStores.pruneTags` are removed. An old profile's key is kept but ignored, with at most one warning
467
+ per process.
468
+ - **Settings UI**: the plugin registers a top-level `settings.section` (Magic Context) with
469
+ zh/en copy and a catalog-backed Historian reasoning-effort picker; the card on the GUI Plugins
470
+ page remains as the legacy location/fallback.
471
+ - **Schema and package name**: the plugin DB moves to v11 (`pending_drops.flush_requested`, automatic v10
472
+ migration). The npm package was `@elvisw/dsh-plugin-magic-context` in `0.12.x`; `0.13.0` renames it to
473
+ `@elvisw/dsh-magic-context` without changing the loader row id `magic-context-dsh`, the settings
474
+ namespace, the plugin data directory `magic-context-dsh-poc`, the schema, or the stored format.
475
+ - **Upgrade migration**: a `0.12.x` profile patch row still says the old package name; the DSH loader
476
+ matches by both `id` and `name` and skips a mismatched row, so run
477
+ `tools/migrate-profile-package-name.mjs --patch <cordis.patch.yml>` once before opening Settings.
478
+ Plugin memories, journal, schema and a custom `dataDir` stay at the same paths; the rename performs no
479
+ data migration. The `0.13.0` host gate is config-effective only and did not open the old database.
480
+
481
+ Because the row id is shared, co-installing upstream `dsh-plugin-magic-context`, the `0.12.x` fork
482
+ package, and this package is **unsupported**; remove the old package before installing the new one. The
483
+ gate observed only that a config dump accepts both rows and keeps both names. The loader keeping one
484
+ duplicate-id row and the settings editor hiding duplicate ids are source-level inferences, not
485
+ gate observations. This fork guarantees its own plugin behavior and data migration, not long-term
486
+ UX/API compatibility with upstream 0.11.x; compatibility semantics target the original
487
+ `cortexkit/magic-context`, with DSH as the host.
488
+
489
+ ### Copyright and third parties
490
+
491
+ - **Upstream DSH adapter** (`wk544863858/dsh-plugin-magic-context`, npm `dsh-plugin-magic-context@0.11.2`,
492
+ MIT, Copyright (c) 2026 wukai — the DeepSeek Harness adapter in this repository): the direct upstream of
493
+ this fork. Fork modifications are Copyright (c) 2026 elvisw, also under MIT.
494
+ - **magic-context** (MIT, Copyright (c) 2025 Ufuk Altinok — magic-context): the derivative origin of this
495
+ repo. Extracted from upstream tag v0.46.0 (`651c105a9`); the adapter's own commits were replayed verbatim
496
+ from `e34eda955` (2026-10-08) on the local `dsh` branch.
497
+ - **DeepSeek Harness** (MIT): consumed as a dependency, not vendored. Code written against 0.2.1-rc.1
498
+ (checkout `1600d8a1e`, npm dist-tag `next`; note their `latest` tag trails a release line — exact pins are
499
+ the devDependencies).
500
+ - Vendored third-party: `vendor/onnx/` (onnxruntime-web WASM subset, MIT © Microsoft),
501
+ `tests/helpers/mock-adapter.ts` (DSH test tree, verbatim). Details in [NOTICE](NOTICE);
502
+ license in [LICENSE](LICENSE).