dsh-library 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.es.md +8 -4
- package/README.hi.md +8 -4
- package/README.md +8 -4
- package/README.pt.md +8 -4
- package/README.zh.md +8 -4
- package/lib/index.js +37 -8
- package/lib/types/quality/relevance.d.ts +3 -1
- package/lib/types/quality/relevance.d.ts.map +1 -1
- package/lib/types/text.d.ts +14 -0
- package/lib/types/text.d.ts.map +1 -1
- package/package.json +19 -18
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.4] - 2026-09-04
|
|
9
|
+
- Align devDeps pins to the published dsh 0.1.2-rc.1 line and move the compat CI probes from 0.1.1-rc.2 to 0.1.2-rc.1; no behavior change.
|
|
10
|
+
|
|
11
|
+
## [0.2.3] - 2026-09-02
|
|
12
|
+
- Align devDeps pins to the published dsh 0.1.2-alpha.5 line; no behavior change.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- The `library_search` relevance gate now filters on the hybrid score — the same value the diversity re-rank orders by — instead of re-scoring each chunk lexically, so semantic matches pass the `search.minRelevance` threshold ([#2](https://github.com/PerryLink/dsh-library/issues/2)).
|
|
17
|
+
- CJK queries now score through unigram + adjacent-bigram tokens instead of whole-run tokens, so partial Chinese phrase overlaps pass the relevance gate ([#2](https://github.com/PerryLink/dsh-library/issues/2)).
|
|
18
|
+
|
|
8
19
|
## [0.2.2] - 2026-09-01
|
|
9
20
|
|
|
10
21
|
### Changed
|
package/README.es.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
| Superficie | Estado |
|
|
27
27
|
|---|---|
|
|
28
|
-
| Harness | DeepSeek Harness `0.1.2-
|
|
28
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` (compatibilidad declarada para `0.1.2-rc.1`) |
|
|
29
29
|
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
30
30
|
| Almacenamiento | Cualquier backend de storage-domain (JSON o SQLite); el índice vive en el dominio de almacenamiento del host |
|
|
31
31
|
| Modelos | Ninguno requerido — el embedder integrado es hash determinista (cero descargas) |
|
|
@@ -120,8 +120,8 @@ Todos los ajustes son campos `Config` de Schemastery (modificables desde cordis.
|
|
|
120
120
|
|
|
121
121
|
- **Permisos**: el plugin solo lee los archivos a los que apunta `library_add` (a través del servicio de archivos del harness y su política) y escribe en su propio dominio de almacenamiento `dsh_library`. Sin peticiones de red; un embedder externo opcional se ejecuta por `ctx.subprocess` sin interpretación de shell.
|
|
122
122
|
- **Datos**: el texto de los chunks y los embeddings viven en el backend de almacenamiento del host (la misma confianza que el resto de los datos durables del despliegue); el plugin no añade cifrado. Las rutas de documentos y los embeddings nunca entran en el registro de sesión.
|
|
123
|
-
- **Registro de sesión**: `library/inject` (id, consulta, ids de chunks, tamaño de página) y `library/purge` (veredicto) son eventos de auditoría solo-registro — la página inyectada visible para el modelo es reconstruible a partir de ellos. El append está condicionado por el host: los harnesses cuyo conjunto de tipos conocidos cubre el vocabulario reciben los eventos, las builds con envoltura `ignorable` los reciben con el marcador, y las builds sin envoltura (0.1.1-rc.2, 0.1.2-
|
|
124
|
-
0.1.2-
|
|
123
|
+
- **Registro de sesión**: `library/inject` (id, consulta, ids de chunks, tamaño de página) y `library/purge` (veredicto) son eventos de auditoría solo-registro — la página inyectada visible para el modelo es reconstruible a partir de ellos. El append está condicionado por el host: los harnesses cuyo conjunto de tipos conocidos cubre el vocabulario reciben los eventos, las builds con envoltura `ignorable` los reciben con el marcador, y las builds sin envoltura (0.1.1-rc.2, 0.1.2-rc.1) omiten el append — allí los eventos registrados `tool/call` + `tool/result` siguen siendo el rastro de auditoría reconstruible.
|
|
124
|
+
0.1.2-rc.1 (adaptado el 2026-09-02): el sobre de sesión conserva su campo ignorable solo para compatibilidad de lectura de logs almacenados - Session.append aún no puede estamparlo, por lo que el comportamiento de la puerta no cambia.
|
|
125
125
|
|
|
126
126
|
## Límites de seguridad
|
|
127
127
|
|
|
@@ -142,7 +142,7 @@ Todos los ajustes son campos `Config` de Schemastery (modificables desde cordis.
|
|
|
142
142
|
```sh
|
|
143
143
|
pnpm install # node ^22.19 || >=24
|
|
144
144
|
pnpm run typecheck # tsc: src + tests contra el checkout local del harness
|
|
145
|
-
pnpm run typecheck:ci # tsc contra los tipos publicados 0.1.2-
|
|
145
|
+
pnpm run typecheck:ci # tsc contra los tipos publicados 0.1.2-rc.1 (sin paths)
|
|
146
146
|
pnpm test # vitest: puertos de calidad, vocabulario núcleo, ensamblaje con pila real
|
|
147
147
|
pnpm run build # bundle tsdown + declaraciones tsc (lib/)
|
|
148
148
|
pnpm run verify:self-contained # las especificaciones de dependencias resuelven desde el registry
|
|
@@ -200,3 +200,7 @@ Este proyecto es uno de los [33 complementos de DeepSeek Harness](https://github
|
|
|
200
200
|
## License
|
|
201
201
|
|
|
202
202
|
[Apache License 2.0](LICENSE) © 2026 dsh-library contributors
|
|
203
|
+
|
|
204
|
+
### Instalar desde el mercado de DSH Desktop
|
|
205
|
+
|
|
206
|
+
Todos los plugins de PerryLink pueden explorarse en el mercado integrado de DSH Desktop: **Market → Sources → add source → pegar** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ seleccionarlo**. La instalación sigue pasando por la verificación de identidad npm del mercado y tu confirmación.
|
package/README.hi.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
| सतह | स्थिति |
|
|
27
27
|
|---|---|
|
|
28
|
-
| Harness | DeepSeek Harness `0.1.2-
|
|
28
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` (`0.1.2-rc.1` के लिए घोषित संगतता) |
|
|
29
29
|
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
30
30
|
| भंडारण | कोई भी storage-domain बैकएंड (JSON या SQLite); सूचकांक होस्ट के भंडारण डोमेन में रहता है |
|
|
31
31
|
| मॉडल | किसी की आवश्यकता नहीं — अंतर्निहित एम्बेडर नियतात्मक हैश है (शून्य डाउनलोड) |
|
|
@@ -120,8 +120,8 @@ dsh --profile web --dump-config | grep -A2 'id: dsh-library'
|
|
|
120
120
|
|
|
121
121
|
- **अनुमतियाँ**: प्लगइन केवल वही फ़ाइलें पढ़ता है जिन्हें `library_add` इंगित करता है (harness फ़ाइल-सेवा और उसकी नीति से) और केवल अपने `dsh_library` भंडारण डोमेन में लिखता है। कोई नेटवर्क अनुरोध नहीं; वैकल्पिक बाहरी एम्बेडर `ctx.subprocess` से बिना शेल-व्याख्या चलता है।
|
|
122
122
|
- **डेटा**: चंक पाठ और एम्बेडिंग होस्ट के भंडारण बैकएंड में रहते हैं (डिप्लॉयमेंट के बाकी स्थायी डेटा जैसा ही भरोसा); प्लगइन कोई एन्क्रिप्शन नहीं जोड़ता। दस्तावेज़ पथ और एम्बेडिंग कभी सत्र लॉग में नहीं जाते।
|
|
123
|
-
- **सत्र लॉग**: `library/inject` (id, क्वेरी, चंक ids, पृष्ठ आकार) और `library/purge` (निर्णय) केवल-लॉग ऑडिट घटनाएँ हैं — मॉडल-दृश्य इंजेक्टेड पृष्ठ उनसे पुनर्निर्माण योग्य है। लिखावट होस्ट-गेटेड है: जिन हार्नेस का ज्ञात-प्रकार समूह शब्दावली को कवर करता है वे घटनाएँ पाते हैं, `ignorable`-लिफ़ाफ़े वाले बिल्ड उन्हें चिह्न के साथ पाते हैं, और लिफ़ाफ़ा-रहित बिल्ड (0.1.1-rc.2, 0.1.2-
|
|
124
|
-
0.1.2-
|
|
123
|
+
- **सत्र लॉग**: `library/inject` (id, क्वेरी, चंक ids, पृष्ठ आकार) और `library/purge` (निर्णय) केवल-लॉग ऑडिट घटनाएँ हैं — मॉडल-दृश्य इंजेक्टेड पृष्ठ उनसे पुनर्निर्माण योग्य है। लिखावट होस्ट-गेटेड है: जिन हार्नेस का ज्ञात-प्रकार समूह शब्दावली को कवर करता है वे घटनाएँ पाते हैं, `ignorable`-लिफ़ाफ़े वाले बिल्ड उन्हें चिह्न के साथ पाते हैं, और लिफ़ाफ़ा-रहित बिल्ड (0.1.1-rc.2, 0.1.2-rc.1) लिखावट छोड़ देते हैं — वहाँ लॉग किए गए `tool/call` + `tool/result` घटनाएँ पुनर्निर्माण योग्य ऑडिट-कड़ी बनी रहती हैं।
|
|
124
|
+
0.1.2-rc.1 (2026-09-02 को अनुकूलित): सत्र लिफ़ाफ़ा अपना ignorable फ़ील्ड केवल संग्रहीत-लॉग पठन संगतता के लिए रखता है - Session.append अभी भी इसे स्टैम्प नहीं कर सकता, इसलिए गेट व्यवहार अपरिवर्तित है।
|
|
125
125
|
|
|
126
126
|
## सुरक्षा सीमाएँ
|
|
127
127
|
|
|
@@ -142,7 +142,7 @@ dsh --profile web --dump-config | grep -A2 'id: dsh-library'
|
|
|
142
142
|
```sh
|
|
143
143
|
pnpm install # node ^22.19 || >=24
|
|
144
144
|
pnpm run typecheck # tsc: src + tests स्थानीय हार्नेस चेकआउट के विरुद्ध
|
|
145
|
-
pnpm run typecheck:ci # tsc प्रकाशित 0.1.2-
|
|
145
|
+
pnpm run typecheck:ci # tsc प्रकाशित 0.1.2-rc.1 प्रकारों के विरुद्ध (बिना paths)
|
|
146
146
|
pnpm test # vitest: गुणवत्ता पोर्ट, मूल शब्दावली, वास्तविक-स्टैक संयोजन
|
|
147
147
|
pnpm run build # tsdown बंडल + tsc घोषणाएँ (lib/)
|
|
148
148
|
pnpm run verify:self-contained # निर्भरता स्पेक registry से हल होती हैं
|
|
@@ -200,3 +200,7 @@ pnpm pack # प्रकाशित tarball
|
|
|
200
200
|
## License
|
|
201
201
|
|
|
202
202
|
[Apache License 2.0](LICENSE) © 2026 dsh-library contributors
|
|
203
|
+
|
|
204
|
+
### DSH Desktop मार्केट से इंस्टॉल करें
|
|
205
|
+
|
|
206
|
+
सभी PerryLink प्लगइन DSH Desktop के बिल्ट-इन मार्केट में देखे जा सकते हैं: **Market → Sources → add source → पेस्ट करें** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ चुनें**। इंस्टॉलेशन मार्केट के npm-identity सत्यापन और आपकी पुष्टि से ही होता है।
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
| Surface | Status |
|
|
28
28
|
|---|---|
|
|
29
|
-
| Harness | DeepSeek Harness `0.1.2-
|
|
29
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` (compat declared for `0.1.2-rc.1`) |
|
|
30
30
|
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
31
31
|
| Storage | Any storage-domain backend (JSON or SQLite); the index lives in the host's storage domain |
|
|
32
32
|
| Models | None required — the built-in embedder is deterministic hashing (zero downloads) |
|
|
@@ -121,8 +121,8 @@ All tunables are Schemastery `Config` fields (changeable from cordis.yml). An id
|
|
|
121
121
|
|
|
122
122
|
- **Permissions**: the plugin only reads files you point `library_add` at (through the harness filesystem service and its policy) and writes into its own `dsh_library` storage domain. No network requests; an optional external embedder runs through `ctx.subprocess` without shell interpretation.
|
|
123
123
|
- **Data**: chunk text and embeddings live in the host's storage backend (same trust as the deployment's other durable data); the plugin adds no encryption. Document paths and embeddings never enter the session log.
|
|
124
|
-
- **Session log**: `library/inject` (id, query, chunk ids, page size) and `library/purge` (verdict) are log-only audit events — the model-visible injected page is reconstructable from them. The append is host-gated: harnesses whose known-type set covers the vocabulary get the events, `ignorable`-envelope builds get them with the marker, and envelope-less builds (0.1.1-rc.2, 0.1.2-
|
|
125
|
-
0.1.2-
|
|
124
|
+
- **Session log**: `library/inject` (id, query, chunk ids, page size) and `library/purge` (verdict) are log-only audit events — the model-visible injected page is reconstructable from them. The append is host-gated: harnesses whose known-type set covers the vocabulary get the events, `ignorable`-envelope builds get them with the marker, and envelope-less builds (0.1.1-rc.2, 0.1.2-rc.1) skip the append — the logged `tool/call` + `tool/result` events remain the reconstructable audit trail there.
|
|
125
|
+
0.1.2-rc.1 (adapted 2026-09-02): the session envelope keeps its ignorable field for stored-log read compatibility only - Session.append still cannot stamp it, so audit-gate behavior is unchanged.
|
|
126
126
|
|
|
127
127
|
## Security boundaries
|
|
128
128
|
|
|
@@ -143,7 +143,7 @@ All tunables are Schemastery `Config` fields (changeable from cordis.yml). An id
|
|
|
143
143
|
```sh
|
|
144
144
|
pnpm install # node ^22.19 || >=24
|
|
145
145
|
pnpm run typecheck # tsc: src + tests against the local harness checkout
|
|
146
|
-
pnpm run typecheck:ci # tsc against the published 0.1.2-
|
|
146
|
+
pnpm run typecheck:ci # tsc against the published 0.1.2-rc.1 types (no paths)
|
|
147
147
|
pnpm test # vitest: quality ports, core vocabulary, real-stack assembly
|
|
148
148
|
pnpm run build # tsdown bundle + tsc declarations (lib/)
|
|
149
149
|
pnpm run verify:self-contained # dependency specs resolve from the registry
|
|
@@ -198,6 +198,10 @@ This project is one of the [33 DeepSeek Harness plugins](https://github.com/Perr
|
|
|
198
198
|
| **[dsh-dsh-test-drive](https://github.com/PerryLink/dsh-dsh-test-drive)** | Isolated install-and-smoke test drives for DeepSeek Harness plugins. | |
|
|
199
199
|
| **[dsh-dsh-translate](https://github.com/PerryLink/dsh-dsh-translate)** | Vendor parameter translation and deterministic JSON repair for DeepSeek Harness. | |
|
|
200
200
|
|
|
201
|
+
### Install from the DSH Desktop Market
|
|
202
|
+
|
|
203
|
+
All PerryLink plugins are browsable in the built-in DSH Desktop Market: **Market → Sources → add source → paste** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ select it**. Installation still goes through the Market's npm-identity verification and your confirmation.
|
|
204
|
+
|
|
201
205
|
## License
|
|
202
206
|
|
|
203
207
|
[Apache License 2.0](LICENSE) © 2026 dsh-library contributors
|
package/README.pt.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
| Superfície | Status |
|
|
27
27
|
|---|---|
|
|
28
|
-
| Harness | DeepSeek Harness `0.1.2-
|
|
28
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` (compatibilidade declarada para `0.1.2-rc.1`) |
|
|
29
29
|
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
30
30
|
| Armazenamento | Qualquer backend de storage-domain (JSON ou SQLite); o índice vive no domínio de armazenamento do host |
|
|
31
31
|
| Modelos | Nenhum necessário — o embedder integrado é hash determinístico (zero downloads) |
|
|
@@ -120,8 +120,8 @@ Todos os ajustes são campos `Config` do Schemastery (alteráveis pelo cordis.ym
|
|
|
120
120
|
|
|
121
121
|
- **Permissões**: o plugin só lê os arquivos apontados pelo `library_add` (pelo serviço de arquivos do harness e sua política) e escreve no seu próprio domínio de armazenamento `dsh_library`. Sem requisições de rede; um embedder externo opcional executa via `ctx.subprocess` sem interpretação de shell.
|
|
122
122
|
- **Dados**: o texto dos chunks e os embeddings vivem no backend de armazenamento do host (a mesma confiança do restante dos dados duráveis da implantação); o plugin não adiciona criptografia. Caminhos de documentos e embeddings nunca entram no registro de sessão.
|
|
123
|
-
- **Registro de sessão**: `library/inject` (id, consulta, ids de chunks, tamanho da página) e `library/purge` (veredicto) são eventos de auditoria somente-registro — a página injetada visível ao modelo é reconstruível a partir deles. O append é condicionado pelo host: harnesses cujo conjunto de tipos conhecidos cobre o vocabulário recebem os eventos, builds com envelope `ignorable` os recebem com o marcador, e builds sem envelope (0.1.1-rc.2, 0.1.2-
|
|
124
|
-
0.1.2-
|
|
123
|
+
- **Registro de sessão**: `library/inject` (id, consulta, ids de chunks, tamanho da página) e `library/purge` (veredicto) são eventos de auditoria somente-registro — a página injetada visível ao modelo é reconstruível a partir deles. O append é condicionado pelo host: harnesses cujo conjunto de tipos conhecidos cobre o vocabulário recebem os eventos, builds com envelope `ignorable` os recebem com o marcador, e builds sem envelope (0.1.1-rc.2, 0.1.2-rc.1) pulam o append — ali, os eventos registrados `tool/call` + `tool/result` continuam sendo a trilha de auditoria reconstruível.
|
|
124
|
+
0.1.2-rc.1 (adaptado em 2026-09-02): o envelope de sessão mantém seu campo ignorable apenas para compatibilidade de leitura de logs armazenados - o Session.append ainda não consegue estampá-lo, então o comportamento da porta não muda.
|
|
125
125
|
|
|
126
126
|
## Limites de segurança
|
|
127
127
|
|
|
@@ -142,7 +142,7 @@ Todos os ajustes são campos `Config` do Schemastery (alteráveis pelo cordis.ym
|
|
|
142
142
|
```sh
|
|
143
143
|
pnpm install # node ^22.19 || >=24
|
|
144
144
|
pnpm run typecheck # tsc: src + tests contra o checkout local do harness
|
|
145
|
-
pnpm run typecheck:ci # tsc contra os tipos publicados 0.1.2-
|
|
145
|
+
pnpm run typecheck:ci # tsc contra os tipos publicados 0.1.2-rc.1 (sem paths)
|
|
146
146
|
pnpm test # vitest: portas de qualidade, vocabulário núcleo, montagem com pilha real
|
|
147
147
|
pnpm run build # bundle tsdown + declarações tsc (lib/)
|
|
148
148
|
pnpm run verify:self-contained # especificações de dependências resolvem pelo registry
|
|
@@ -200,3 +200,7 @@ Este projeto é um dos [33 plugins de DeepSeek Harness](https://github.com/Perry
|
|
|
200
200
|
## License
|
|
201
201
|
|
|
202
202
|
[Apache License 2.0](LICENSE) © 2026 dsh-library contributors
|
|
203
|
+
|
|
204
|
+
### Instalar a partir do mercado do DSH Desktop
|
|
205
|
+
|
|
206
|
+
Todos os plugins PerryLink podem ser explorados no mercado integrado do DSH Desktop: **Market → Sources → add source → colar** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ selecionar**. A instalação continua passando pela verificação de identidade npm do mercado e pela sua confirmação.
|
package/README.zh.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
| 方面 | 状态 |
|
|
27
27
|
|---|---|
|
|
28
|
-
| Harness | DeepSeek Harness `0.1.2-
|
|
28
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1`(声明兼容 `0.1.2-rc.1`) |
|
|
29
29
|
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
30
30
|
| 存储 | 任意 storage-domain 后端(JSON 或 SQLite);索引存放在宿主的存储域中 |
|
|
31
31
|
| 模型 | 无需任何模型 —— 内置嵌入为确定性哈希(零下载) |
|
|
@@ -120,8 +120,8 @@ dsh --profile web --dump-config | grep -A2 'id: dsh-library'
|
|
|
120
120
|
|
|
121
121
|
- **权限**:插件只读取你让 `library_add` 指向的文件(经 harness 文件系统服务及其策略),并只写入自己的 `dsh_library` 存储域。无网络请求;可选外部嵌入命令经 `ctx.subprocess` 执行、无 shell 解释。
|
|
122
122
|
- **数据**:切片文本与嵌入存放在宿主的存储后端(与部署的其他持久数据同级信任);插件不额外加密。文档路径与嵌入向量绝不进入会话日志。
|
|
123
|
-
- **会话日志**:`library/inject`(id、查询、切片 id、页大小)与 `library/purge`(判定)是仅日志审计事件 —— 模型可见的注入页可从中重建。写入受宿主门控:已知类型集合覆盖该词汇的宿主直接写入;带 `ignorable` 信封的构建加标记写入;无信封构建(0.1.1-rc.2、0.1.2-
|
|
124
|
-
0.1.2-
|
|
123
|
+
- **会话日志**:`library/inject`(id、查询、切片 id、页大小)与 `library/purge`(判定)是仅日志审计事件 —— 模型可见的注入页可从中重建。写入受宿主门控:已知类型集合覆盖该词汇的宿主直接写入;带 `ignorable` 信封的构建加标记写入;无信封构建(0.1.1-rc.2、0.1.2-rc.1)跳过写入 —— 此时已记录的 `tool/call` + `tool/result` 事件仍是可重建的审计链。
|
|
124
|
+
0.1.2-rc.1(2026-09-02 已适配):会话信封保留 ignorable 字段但仅用于存量日志读取兼容——Session.append 仍无法盖章,门控行为不变。
|
|
125
125
|
|
|
126
126
|
## 安全边界
|
|
127
127
|
|
|
@@ -142,7 +142,7 @@ dsh --profile web --dump-config | grep -A2 'id: dsh-library'
|
|
|
142
142
|
```sh
|
|
143
143
|
pnpm install # node ^22.19 || >=24
|
|
144
144
|
pnpm run typecheck # tsc:src + tests 对照本地 harness checkout
|
|
145
|
-
pnpm run typecheck:ci # tsc:对照已发布的 0.1.2-
|
|
145
|
+
pnpm run typecheck:ci # tsc:对照已发布的 0.1.2-rc.1 类型(无 paths)
|
|
146
146
|
pnpm test # vitest:八移植回归、核心词汇、真实栈装配
|
|
147
147
|
pnpm run build # tsdown bundle + tsc 声明(lib/)
|
|
148
148
|
pnpm run verify:self-contained # 依赖声明全部来自 registry
|
|
@@ -200,3 +200,7 @@ pnpm pack # 发布用 tarball
|
|
|
200
200
|
## License
|
|
201
201
|
|
|
202
202
|
[Apache License 2.0](LICENSE) © 2026 dsh-library contributors
|
|
203
|
+
|
|
204
|
+
### 从 DSH Desktop 市场安装
|
|
205
|
+
|
|
206
|
+
所有 PerryLink 插件均可在 DSH Desktop 内置市场中浏览:**市场 → 来源 → 添加来源 → 粘贴** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ 选中**。安装仍需通过市场的 npm 身份校验与你的确认。
|
package/lib/index.js
CHANGED
|
@@ -4263,16 +4263,42 @@ function tokenize(text) {
|
|
|
4263
4263
|
return tokens;
|
|
4264
4264
|
}
|
|
4265
4265
|
/**
|
|
4266
|
-
*
|
|
4266
|
+
* CJK-aware scoring tokenization: like {@link tokenize}, but every CJK run
|
|
4267
|
+
* contributes its unigrams plus its adjacent bigrams, so a query and a
|
|
4268
|
+
* document overlap on sub-phrases instead of only on identical whole runs.
|
|
4267
4269
|
* @param text - input text.
|
|
4270
|
+
* @returns the expanded token list.
|
|
4271
|
+
*/
|
|
4272
|
+
function cjkTokenize(text) {
|
|
4273
|
+
const tokens = [];
|
|
4274
|
+
for (const match of normalize(text).matchAll(/[a-z0-9]+|[\u00c0-\uffff]+/giu)) {
|
|
4275
|
+
const run = match[0];
|
|
4276
|
+
if (/^[\u4e00-\u9fff]+$/u.test(run)) {
|
|
4277
|
+
for (const char of run) tokens.push(char);
|
|
4278
|
+
for (let index = 0; index < run.length - 1; index += 1) tokens.push(run.slice(index, index + 2));
|
|
4279
|
+
} else tokens.push(run);
|
|
4280
|
+
}
|
|
4281
|
+
return tokens;
|
|
4282
|
+
}
|
|
4283
|
+
/**
|
|
4284
|
+
* Term-frequency map of a token list: token → occurrence count.
|
|
4285
|
+
* @param tokens - the token list.
|
|
4268
4286
|
* @returns the frequency map (plain object, no prototype).
|
|
4269
4287
|
*/
|
|
4270
|
-
function
|
|
4288
|
+
function termFrequenciesOf(tokens) {
|
|
4271
4289
|
const frequencies = Object.create(null);
|
|
4272
|
-
for (const token of
|
|
4290
|
+
for (const token of tokens) frequencies[token] = (frequencies[token] ?? 0) + 1;
|
|
4273
4291
|
return frequencies;
|
|
4274
4292
|
}
|
|
4275
4293
|
/**
|
|
4294
|
+
* Term-frequency map of one text: token → occurrence count.
|
|
4295
|
+
* @param text - input text.
|
|
4296
|
+
* @returns the frequency map (plain object, no prototype).
|
|
4297
|
+
*/
|
|
4298
|
+
function termFrequencies(text) {
|
|
4299
|
+
return termFrequenciesOf(tokenize(text));
|
|
4300
|
+
}
|
|
4301
|
+
/**
|
|
4276
4302
|
* Character n-grams of a normalized text, for the built-in hash embedder.
|
|
4277
4303
|
* A space-padded form adds leading/trailing boundary markers so prefixes and
|
|
4278
4304
|
* suffixes still contribute.
|
|
@@ -5026,7 +5052,9 @@ function middlePenalty(bins) {
|
|
|
5026
5052
|
* retrieval. The upstream cross-encoder model is replaced by a local-rules
|
|
5027
5053
|
* lexical scorer (zero downloads): token overlap weighted toward rarer
|
|
5028
5054
|
* query terms, normalized to 0..1 — same `(document, score, passed)` API
|
|
5029
|
-
* shape as the upstream `score_batch`/`filter_documents`.
|
|
5055
|
+
* shape as the upstream `score_batch`/`filter_documents`. Scoring tokenizes
|
|
5056
|
+
* CJK runs into unigrams plus adjacent bigrams so partial phrase overlaps
|
|
5057
|
+
* count, instead of whole runs matching only on exact equality.
|
|
5030
5058
|
* @module dsh-library/quality/relevance
|
|
5031
5059
|
*/
|
|
5032
5060
|
/**
|
|
@@ -5040,9 +5068,10 @@ function middlePenalty(bins) {
|
|
|
5040
5068
|
* @returns relevance within 0..1 (0 for an empty query or document).
|
|
5041
5069
|
*/
|
|
5042
5070
|
function scoreRelevance(query, document) {
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
const
|
|
5071
|
+
const queryTokens = cjkTokenize(query);
|
|
5072
|
+
if (queryTokens.length === 0) return 0;
|
|
5073
|
+
const documentTerms = termFrequenciesOf(cjkTokenize(document));
|
|
5074
|
+
const queryTerms = termFrequenciesOf(queryTokens);
|
|
5046
5075
|
let covered = 0;
|
|
5047
5076
|
let total = 0;
|
|
5048
5077
|
for (const [token, count] of Object.entries(queryTerms)) {
|
|
@@ -5684,7 +5713,7 @@ var LibraryStore = class {
|
|
|
5684
5713
|
relevance: candidate.hybrid,
|
|
5685
5714
|
chunk: candidate.chunk,
|
|
5686
5715
|
similarityTo: (other) => cosine(candidate.chunk.embedding, other.chunk.embedding)
|
|
5687
|
-
})), this.config.search.diversityLambda, Math.min(candidates.length, MAX_CANDIDATE_BOUND)).filter((entry) =>
|
|
5716
|
+
})), this.config.search.diversityLambda, Math.min(candidates.length, MAX_CANDIDATE_BOUND)).filter((entry) => entry.relevance >= this.config.search.minRelevance).slice(0, 500);
|
|
5688
5717
|
const reordered = avoidLostMiddle(filtered.map((entry) => ({
|
|
5689
5718
|
id: entry.chunk.chunkId,
|
|
5690
5719
|
score: entry.relevance
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* retrieval. The upstream cross-encoder model is replaced by a local-rules
|
|
5
5
|
* lexical scorer (zero downloads): token overlap weighted toward rarer
|
|
6
6
|
* query terms, normalized to 0..1 — same `(document, score, passed)` API
|
|
7
|
-
* shape as the upstream `score_batch`/`filter_documents`.
|
|
7
|
+
* shape as the upstream `score_batch`/`filter_documents`. Scoring tokenizes
|
|
8
|
+
* CJK runs into unigrams plus adjacent bigrams so partial phrase overlaps
|
|
9
|
+
* count, instead of whole runs matching only on exact equality.
|
|
8
10
|
* @module dsh-library/quality/relevance
|
|
9
11
|
*/
|
|
10
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relevance.d.ts","sourceRoot":"","sources":["../../../src/quality/relevance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"relevance.d.ts","sourceRoot":"","sources":["../../../src/quality/relevance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAatE;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,SAAM,GAAG,cAAc,EAAE,CAKzG;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,SAAM,GAAG,MAAM,EAAE,CAItG"}
|
package/lib/types/text.d.ts
CHANGED
|
@@ -18,8 +18,22 @@ export declare function normalize(text: string): string;
|
|
|
18
18
|
* @returns the token list.
|
|
19
19
|
*/
|
|
20
20
|
export declare function tokenize(text: string): string[];
|
|
21
|
+
/**
|
|
22
|
+
* CJK-aware scoring tokenization: like {@link tokenize}, but every CJK run
|
|
23
|
+
* contributes its unigrams plus its adjacent bigrams, so a query and a
|
|
24
|
+
* document overlap on sub-phrases instead of only on identical whole runs.
|
|
25
|
+
* @param text - input text.
|
|
26
|
+
* @returns the expanded token list.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cjkTokenize(text: string): string[];
|
|
21
29
|
/** Deduplicated token set of one text. */
|
|
22
30
|
export declare function tokenSet(text: string): ReadonlySet<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Term-frequency map of a token list: token → occurrence count.
|
|
33
|
+
* @param tokens - the token list.
|
|
34
|
+
* @returns the frequency map (plain object, no prototype).
|
|
35
|
+
*/
|
|
36
|
+
export declare function termFrequenciesOf(tokens: readonly string[]): Record<string, number>;
|
|
23
37
|
/**
|
|
24
38
|
* Term-frequency map of one text: token → occurrence count.
|
|
25
39
|
* @param text - input text.
|
package/lib/types/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/text.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/C;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/text.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAalD;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAInF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ5D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ1E;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO1C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-library",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Local document knowledge base for DeepSeek Harness: library_add/remove/list, hybrid semantic+keyword library_search with diversity re-ranking, relevance filtering and lost-in-the-middle avoidance, citation-aware injection, library_cite_check and library_diagnose
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Local document knowledge base for DeepSeek Harness: library_add/remove/list, hybrid semantic+keyword library_search with diversity re-ranking, relevance filtering and lost-in-the-middle avoidance, citation-aware injection, library_cite_check and library_diagnose 閳ユ摬QLite-backed index via the storage domain, local embedding, zero model downloads",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/PerryLink/dsh-library.git"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
],
|
|
68
68
|
"compatibility": {
|
|
69
69
|
"dshVersions": [
|
|
70
|
-
"0.1.2-
|
|
70
|
+
"0.1.2-rc.1"
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"capability": {
|
|
@@ -119,22 +119,23 @@
|
|
|
119
119
|
"typescript": "^5.9.0",
|
|
120
120
|
"zod": "^4.4.3"
|
|
121
121
|
},
|
|
122
|
-
"devDependencies": {
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@deepseek-ai/dsh-attachment": "0.1.2-rc.1",
|
|
123
124
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
124
|
-
"@deepseek-ai/cordis-plugin-include": "1.0.
|
|
125
|
-
"@deepseek-ai/cordis-plugin-loader": "1.0.
|
|
126
|
-
"@deepseek-ai/dsh-agent": "0.1.2-
|
|
127
|
-
"@deepseek-ai/dsh-commands": "0.1.2-
|
|
128
|
-
"@deepseek-ai/dsh-fs": "0.1.2-
|
|
129
|
-
"@deepseek-ai/dsh-fs-local": "0.1.2-
|
|
130
|
-
"@deepseek-ai/dsh-llm": "0.1.2-
|
|
131
|
-
"@deepseek-ai/dsh-session": "0.1.2-
|
|
132
|
-
"@deepseek-ai/dsh-storage": "0.1.2-
|
|
133
|
-
"@deepseek-ai/dsh-storage-domain": "0.1.2-
|
|
134
|
-
"@deepseek-ai/dsh-storage-json": "0.1.2-
|
|
135
|
-
"@deepseek-ai/dsh-subprocess": "0.1.2-
|
|
136
|
-
"@deepseek-ai/dsh-subprocess-local": "0.1.2-
|
|
137
|
-
"@deepseek-ai/dsh-tools": "0.1.2-
|
|
125
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
126
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
127
|
+
"@deepseek-ai/dsh-agent": "0.1.2-rc.1",
|
|
128
|
+
"@deepseek-ai/dsh-commands": "0.1.2-rc.1",
|
|
129
|
+
"@deepseek-ai/dsh-fs": "0.1.2-rc.1",
|
|
130
|
+
"@deepseek-ai/dsh-fs-local": "0.1.2-rc.1",
|
|
131
|
+
"@deepseek-ai/dsh-llm": "0.1.2-rc.1",
|
|
132
|
+
"@deepseek-ai/dsh-session": "0.1.2-rc.1",
|
|
133
|
+
"@deepseek-ai/dsh-storage": "0.1.2-rc.1",
|
|
134
|
+
"@deepseek-ai/dsh-storage-domain": "0.1.2-rc.1",
|
|
135
|
+
"@deepseek-ai/dsh-storage-json": "0.1.2-rc.1",
|
|
136
|
+
"@deepseek-ai/dsh-subprocess": "0.1.2-rc.1",
|
|
137
|
+
"@deepseek-ai/dsh-subprocess-local": "0.1.2-rc.1",
|
|
138
|
+
"@deepseek-ai/dsh-tools": "0.1.2-rc.1",
|
|
138
139
|
"@deepseek-ai/schemastery": "^3.18.2",
|
|
139
140
|
"@types/node": "^22.19.0",
|
|
140
141
|
"@vitest/coverage-v8": "3.2.0",
|