@lmzhen/dsh-evolution-core 0.8.0 → 0.10.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/README.md +13 -3
- package/lib/index.js +706 -93
- package/lib/types/constants.d.ts +15 -1
- package/lib/types/errors.d.ts +4 -1
- package/lib/types/events.d.ts +7 -0
- package/lib/types/evidence.d.ts +42 -0
- package/lib/types/index.d.ts +7 -2
- package/lib/types/limits.d.ts +3 -0
- package/lib/types/mutations.d.ts +5 -0
- package/lib/types/params.d.ts +21 -7
- package/lib/types/quality.d.ts +91 -0
- package/lib/types/skill-history.d.ts +189 -0
- package/lib/types/skill-reads.d.ts +47 -0
- package/lib/types/skill-store.d.ts +29 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @lmzhen/dsh-evolution-core
|
|
2
2
|
|
|
3
|
-
Shared pure library for the family: `SkillLibrary`/`MemoryStore`, the prompts and guidance text,
|
|
4
|
-
the threat/quality/drift signals and the IO primitives (`nodeEvolutionIo`, `transactIo`,
|
|
5
|
-
`evolutionIoAdapter`). It is **not a Cordis row** — it registers no service, tool or prompt
|
|
3
|
+
Shared pure library for the family: `SkillLibrary`/`MemoryStore`, the prompts and guidance text, the threat/quality/drift signals, the skill CONTENT history (`skill-history.ts`: content-addressed versions behind every write) and the frame classification the plan path reports over (`evidence.ts`), plus the IO primitives (`nodeEvolutionIo`, `transactIo`, `evolutionIoAdapter`). It is **not a Cordis row** — it registers no service, tool or prompt
|
|
6
4
|
section, and importing the package root is its only entry.
|
|
7
5
|
|
|
8
6
|
## Model surface
|
|
@@ -15,12 +13,24 @@ section, and importing the package root is its only entry.
|
|
|
15
13
|
|
|
16
14
|
- This package is a library, not a Cordis row; do not mount it as a plugin.
|
|
17
15
|
- 数值配置已在消费方 Config 面钳制(`min 1`/各字段域);`MemoryStore` 内部对 `limit <= 0` 仍按 unbounded 防御处理——那是库内部防御,不构成"0 = 禁用"的配置语义。
|
|
16
|
+
- **Content-history storage grows with the number of DISTINCT bodies a skill has ever been written
|
|
17
|
+
with, not with the retained count.** Trimming drops index entries; the blobs they point at stay on
|
|
18
|
+
disk (they are shared by content, so a reference count would have to span every skill's index, and no
|
|
19
|
+
sweeper exists yet). Measured on a 3.6 KB skill written 41 times: a 5.7 KB index over 20 entries and
|
|
20
|
+
41 blob files totalling 150 KB (41x the live body); unchanged writes add nothing. Plan disk accordingly
|
|
21
|
+
or remove `.history/blobs` entries by hand.
|
|
18
22
|
- Skill-library writes are serialized in-process; cross-process writers to the SAME skill file must go through the single-file paths (`update`, `patch`, `writeSupportFile`). The full concurrency model, its two-phase exceptions and their provenance are in Notes and history.
|
|
19
23
|
|
|
20
24
|
**Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
|
|
21
25
|
|
|
22
26
|
## Notes and history
|
|
23
27
|
|
|
28
|
+
- Similarity is TWO NAMED QUESTIONS plus a projection the caller declares (`quality.ts`): `identity(text)` ("is it the same text?", a normalized-content hash) and `affinity(a, b)` ("how much vocabulary do these two share?", Jaccard over two `vocabulary()` sets), asked over `projectionText(projection, input)` — `body` for the library-wide scan, `summary` (name + description) for the create-time hint. `computePrefixClusters` stays a name-side STRUCTURAL index, not a score. Adding a projection is one entry in that table; a caller that wants a fourth ruler should name the question it is really asking instead.
|
|
29
|
+
- A whole-body replacement that keeps less than half of the previous body appends one line to its own result
|
|
30
|
+
(`contentRetentionFeedback`, design §4 item 3): the ratio, both character counts, and the fact that the
|
|
31
|
+
replaced version is still in the history. Computed in the write funnel where both bodies are in hand, feedback
|
|
32
|
+
only — no ratio refuses a write, and the function owns no configuration.
|
|
33
|
+
- Content history is HISTORY ONLY: the skill tree is the single truth for current content, and no judgement reads the version index (design invariant I1). Recording is best-effort but happens inside the write lock, so the index never describes content that did not land; a failed record warns once per instance instead of failing the write.
|
|
24
34
|
- Skill-library mutations are read-modify-write on one file, so `SkillLibrary` serializes them in-process with a `makeSerialQueue` chain: `update`, `patch`, `restructure`, `writeSupportFile` and (since 0.3.46) `consolidate`'s target read→merge→commit run their whole read→validate→write under one serial task, so two concurrent mutators on one skill never interleave in this process.
|
|
25
35
|
- `create` is INSIDE the serial chain and, when a transact backend is bound, its exists check runs inside the same per-file transact (v18); `archive`/`consolidate` are rename-based two-phase paths and stay outside the single-file serial chain.
|
|
26
36
|
- **v18 residual (updated):** `create`, `removeSupportFile` and `setPinned` now run on the serial chain (`removeSupportFile`'s delete also goes through the per-file transact), so the remaining single-file residual is the protection TOCTOU (a marker check outside the transact) and the multi-file two-phase paths `archive`/`consolidate`/`restructure`.
|