@lmzhen/dsh-evolution-core 0.3.83 → 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/README.md +20 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,30 @@
|
|
|
1
1
|
# @lmzhen/dsh-evolution-core
|
|
2
2
|
|
|
3
|
-
Shared pure library for the
|
|
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
|
|
6
|
+
section, and importing the package root is its only entry.
|
|
4
7
|
|
|
5
|
-
## Model
|
|
8
|
+
## Model surface
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
- **Model-visible:** nothing of its own: the guidance text and memory snapshot it renders are injected by the rows that consume it (`tool-memory`, `tool-skill-manage`).
|
|
11
|
+
- **Prompt prefix / KV cache:** unchanged by this package: family-level rules single-sourced in `packages/README.md` §"Model-visible prompt prefix and the KV cache".
|
|
12
|
+
- **Mount it?** no: a library, not a row; consumed by the family's rows (e.g. `evolution-threat`, `evolution-policy`, `memory-files`, `skill-usage`, `evolution-state-json`).
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`@lmzhen/dsh-evolution-core` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
|
|
12
|
-
|
|
13
|
-
#### Token effect
|
|
14
|
-
|
|
15
|
-
Zero direct token effect from this package; consumers add any model-visible tokens.
|
|
16
|
-
|
|
17
|
-
#### KV Cache effect
|
|
18
|
-
|
|
19
|
-
Independent of request-prefix construction. This package does not alter the assembled prompt or tool list.
|
|
20
|
-
|
|
21
|
-
## SkillLibrary concurrency model
|
|
22
|
-
|
|
23
|
-
Skill-library mutations are read-modify-write on one file, so `SkillLibrary`
|
|
24
|
-
serializes them in-process with a `makeSerialQueue` chain: `update`, `patch`,
|
|
25
|
-
`restructure`, `writeSupportFile` and — since 0.3.46 — `consolidate`'s target
|
|
26
|
-
read→merge→commit run their whole read→validate→write under one serial task,
|
|
27
|
-
so two concurrent mutators on one skill never interleave in this process.
|
|
28
|
-
Single-file writes (`update`, `patch`, `writeSupportFile`)
|
|
29
|
-
additionally run the read and the write inside `transactIo` when a caller
|
|
30
|
-
injects a `transact` into the constructor — that is the cross-process lock, so
|
|
31
|
-
two processes sharing `DSH_HOME` cannot interleave their RMW on one file.
|
|
32
|
-
`create` is INSIDE the serial chain and, when a transact backend is bound, its
|
|
33
|
-
exists check runs inside the same per-file transact (v18); `archive`/`consolidate`
|
|
34
|
-
are rename-based two-phase paths and stay outside the single-file serial chain.
|
|
35
|
-
|
|
36
|
-
**v18 residual (updated):** `create`, `removeSupportFile` and `setPinned` now
|
|
37
|
-
run on the serial chain (`removeSupportFile`'s delete also goes through the
|
|
38
|
-
per-file transact), so the remaining single-file residual is the protection
|
|
39
|
-
TOCTOU (a marker check outside the transact) and the multi-file two-phase
|
|
40
|
-
paths `archive`/`consolidate`/`restructure`. The race needs a concurrent
|
|
41
|
-
mutator on the SAME skill file/package; the exposure is acknowledged and the
|
|
42
|
-
protection check is the next candidate (see the v18 optimization plan, E-5).
|
|
43
|
-
|
|
44
|
-
When the backend provides `transact` (nodeEvolutionIo and the io adapter do),
|
|
45
|
-
the constructor binds it BY DEFAULT since 0.3.27 — the single-file entry points
|
|
46
|
-
(`update`, `patch`, `writeSupportFile`, and each per-file piece of
|
|
47
|
-
`restructure`) run their read→write inside the cross-process lock for every
|
|
48
|
-
instantiation, so same-file concurrent writes from different processes no
|
|
49
|
-
longer resolve to last-writer-wins there. An explicit `transact` argument
|
|
50
|
-
overrides the default binding. The two-phase paths deliberately stay outside
|
|
51
|
-
that lock: `create`'s exists probe runs inside the transact when a transact
|
|
52
|
-
backend is bound (v18), so only a transact-less custom backend can still
|
|
53
|
-
double-pass the probe across processes; `archive`/`consolidate` are rename-based with best-effort
|
|
54
|
-
rollback (an archive loser's rollback surfaces the raw failure when the source
|
|
55
|
-
vanished), and `restructure`'s multi-file swap can expose an interleaved tree
|
|
56
|
-
to a concurrent reader. These residual windows are documented rather than
|
|
57
|
-
locked — cross-process writers to the SAME skill file should serialize through
|
|
58
|
-
the single-file paths above.
|
|
59
|
-
|
|
60
|
-
## Known Limitations and Deferred Work
|
|
14
|
+
## Known limitations
|
|
61
15
|
|
|
62
16
|
- This package is a library, not a Cordis row; do not mount it as a plugin.
|
|
63
17
|
- 数值配置已在消费方 Config 面钳制(`min 1`/各字段域);`MemoryStore` 内部对 `limit <= 0` 仍按 unbounded 防御处理——那是库内部防御,不构成"0 = 禁用"的配置语义。
|
|
18
|
+
- 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.
|
|
64
19
|
|
|
65
20
|
**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
|
+
|
|
22
|
+
## Notes and history
|
|
23
|
+
|
|
24
|
+
- 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
|
+
- `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
|
+
- **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`.
|
|
27
|
+
- The race needs a concurrent mutator on the SAME skill file/package; the exposure is acknowledged and the protection check is the next candidate (see the v18 optimization plan, E-5).
|
|
28
|
+
- When the backend provides `transact` (nodeEvolutionIo and the io adapter do), the constructor binds it BY DEFAULT since 0.3.27: the single-file entry points (`update`, `patch`, `writeSupportFile`, and each per-file piece of `restructure`) run their read→write inside the cross-process lock for every instantiation, so same-file concurrent writes from different processes no longer resolve to last-writer-wins there.
|
|
29
|
+
- The two-phase paths deliberately stay outside that lock: `create`'s exists probe runs inside the transact when a transact backend is bound (v18), so only a transact-less custom backend can still double-pass the probe across processes; `archive`/`consolidate` are rename-based with best-effort rollback (an archive loser's rollback surfaces the raw failure when the source vanished), and `restructure`'s multi-file swap can expose an interleaved tree to a concurrent reader.
|
|
30
|
+
- These residual windows are documented rather than locked: cross-process writers to the SAME skill file should serialize through the single-file paths above.
|
package/package.json
CHANGED