dsh-memento 0.3.0 → 0.3.1
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/ARCHITECTURE.md +1 -0
- package/CHANGELOG.md +8 -0
- package/README.es.md +2 -2
- package/README.hi.md +2 -2
- package/README.md +2 -2
- package/README.pt.md +2 -2
- package/README.zh.md +2 -2
- package/lib/constants.mjs +0 -1
- package/lib/store.mjs +9 -11
- package/package.json +1 -1
package/ARCHITECTURE.md
CHANGED
|
@@ -138,3 +138,4 @@ memory 工具(add)
|
|
|
138
138
|
## 配置面(无硬编码 tunable)
|
|
139
139
|
|
|
140
140
|
全部字段可 cordis.yml 覆盖,schema 见 `index.mjs` 的 `Config`;完整字段表(`enabled` / `dbPath` / `budgets` / `writePolicy` / `writePolicies` / `language` / `snapshotOrder` / `maxEntriesPerQuery` / `commandListLimit` / `commandAuditLimit` / `recall.*` / `panelEntriesLimit` / `panelAuditLimit` / `auditRetentionDays` / `proposals.*`)以 README 配置表为准,本文件不再逐项复制以免漂移。非法值加载期响亮失败。
|
|
141
|
+
- **harness 主目录回退(0.3.1)**:`dbPath` 为空或相对路径时,基准目录取 `$DSH_HOME`;`dsh web` 启动不会把官方 `resolveDshHome()` 解析出的主目录写回 `process.env.DSH_HOME`,因此未导出时回退 `~/.dsh`(与官方回退同语义)——否则默认 Windows 配置会在真实 boot 时整体崩溃(issue #1)。`lib/` 零 DSH 依赖的红线不允许 import `@deepseek-ai/dsh-home-paths`,用 `os.homedir()` 复刻同一回退。
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be 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.3.1] - 2026-08-15
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Boot crash on default Windows setups (reported in [issue #1](https://github.com/PerryLink/dsh-memento/issues/1)): `dsh web` does not write the harness's resolved home back to `process.env.DSH_HOME`, so `resolveDbPath` threw `MISSING_DSH_HOME` and failed the whole profile load. It now falls back to `~/.dsh` — the same documented fallback as the official harness (`resolveDshHome()`), replicated with `os.homedir()` to keep `lib/` zero-DSH-dependency. Relative `dbPath` values resolve against the same fallback home.
|
|
13
|
+
- Removed the now-unreachable `MISSING_DSH_HOME` error code.
|
|
14
|
+
|
|
8
15
|
## [0.3.0] - 2026-08-15
|
|
9
16
|
|
|
10
17
|
### Added
|
|
@@ -20,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
20
27
|
- `proposalDecide` now resolves and updates inside one transaction: concurrent approve/dismiss races settle first-writer-wins instead of double-deciding.
|
|
21
28
|
- `/memory proposals approve` no longer masks a successful write when the proposal was concurrently decided elsewhere.
|
|
22
29
|
- Release workflow is now idempotent: it skips `npm publish` when the tag's version is already on npm, so re-pushing an old tag cannot fail a run.
|
|
30
|
+
- Cross-platform test fix: the `resolveDbPath` absolute-path sample now matches the platform's `path.isAbsolute` semantics (a Windows drive path is relative on POSIX) — CI is green on all three platforms instead of red on Linux/macOS.
|
|
23
31
|
|
|
24
32
|
### Changed
|
|
25
33
|
|
package/README.es.md
CHANGED
|
@@ -81,7 +81,7 @@ Cada campo es un `Config` de Schemastery validado; los valores inválidos fallan
|
|
|
81
81
|
| Campo | Valor por defecto | Significado |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `enabled` | `true` | `false` elimina por completo el servicio, las herramientas, la instantánea, el comando, el panel y el contestador (sin estados a medias) |
|
|
84
|
-
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absoluto, o relativo a `$DSH_HOME` |
|
|
84
|
+
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absoluto, o relativo a `$DSH_HOME`; si `$DSH_HOME` no está exportado (el valor por defecto en Windows — `dsh web` no devuelve el home resuelto al entorno), ambos caen a `~/.dsh` |
|
|
85
85
|
| `budgets.user.userGlobal` / `budgets.user.workspace` | `2000` / `2000` | presupuesto estricto de caracteres por capa de la pista de usuario |
|
|
86
86
|
| `budgets.agent.userGlobal` / `budgets.agent.workspace` | `4000` / `4000` | presupuesto estricto de caracteres por capa de la pista de agente |
|
|
87
87
|
| `writePolicy` | `'ask'` | `'ask'` = aprobación del usuario; `'auto'` = dejar pasar (se registra el origen de la aprobación); `'off'` = rechazar. Invisible para el modelo |
|
|
@@ -150,7 +150,7 @@ El nombre es **`dsh-memento`** (publicado en npm y GitHub). No `dsh-recall` (con
|
|
|
150
150
|
|
|
151
151
|
```sh
|
|
152
152
|
npm install
|
|
153
|
-
npm test # node --test:
|
|
153
|
+
npm test # node --test: 115 tests — budget, unique-substring, gate policy, store, snapshot, mock-ctx integration (S2/S3 invariants), V2 command/recall/panel/import
|
|
154
154
|
npm run typecheck # puerta tsc --checkJs sobre index.mjs / lib / scripts
|
|
155
155
|
npm run check:coverage # puerta de cobertura de líneas: lib ≥90 %, index.mjs ≥85 %, todos ≥90 %
|
|
156
156
|
npm run check:readmes # puerta de coherencia de los cinco README
|
package/README.hi.md
CHANGED
|
@@ -81,7 +81,7 @@ dsh plugin --profile <name> remove dsh-memento # uninstall: DB + session l
|
|
|
81
81
|
| फ़ील्ड | डिफ़ॉल्ट | अर्थ |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `enabled` | `true` | `false` सेवा, टूल, स्नैपशॉट, कमांड, पैनल और उत्तरदाता को पूरी तरह हटा देता है (कोई अधूरी स्थिति नहीं) |
|
|
84
|
-
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | निरपेक्ष, या `$DSH_HOME` के
|
|
84
|
+
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | निरपेक्ष, या `$DSH_HOME` के सापेक्ष; जब `$DSH_HOME` निर्यातित नहीं है (Windows डिफ़ॉल्ट — `dsh web` resolved home को env में वापस नहीं लिखता), दोनों `~/.dsh` पर गिरते हैं |
|
|
85
85
|
| `budgets.user.userGlobal` / `budgets.user.workspace` | `2000` / `2000` | user ट्रैक की हर लेयर का कठोर वर्ण बजट |
|
|
86
86
|
| `budgets.agent.userGlobal` / `budgets.agent.workspace` | `4000` / `4000` | agent ट्रैक की हर लेयर का कठोर वर्ण बजट |
|
|
87
87
|
| `writePolicy` | `'ask'` | `'ask'` = उपयोगकर्ता अनुमोदन; `'auto'` = अनुमति दें (अनुमोदन स्रोत रिकॉर्ड किया गया); `'off'` = अस्वीकार करें। मॉडल-अदृश्य |
|
|
@@ -150,7 +150,7 @@ dsh-memento Claude Code, Codex या Hermes का पोर्ट नहीं
|
|
|
150
150
|
|
|
151
151
|
```sh
|
|
152
152
|
npm install
|
|
153
|
-
npm test # node --test:
|
|
153
|
+
npm test # node --test: 115 tests — budget, unique-substring, gate policy, store, snapshot, mock-ctx integration (S2/S3 invariants), V2 command/recall/panel/import
|
|
154
154
|
npm run typecheck # index.mjs / lib / scripts पर tsc --checkJs द्वार
|
|
155
155
|
npm run check:coverage # लाइन-कवरेज द्वार: lib ≥90%, index.mjs ≥85%, सभी ≥90%
|
|
156
156
|
npm run check:readmes # पाँच-भाषा README संगति द्वार
|
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ Every field is a validated Schemastery `Config`; invalid values fail loudly at l
|
|
|
81
81
|
| Field | Default | Meaning |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `enabled` | `true` | `false` removes the service, tools, snapshot, command, panel, and answerer entirely (no half-state) |
|
|
84
|
-
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absolute, or relative to `$DSH_HOME` |
|
|
84
|
+
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absolute, or relative to `$DSH_HOME`; when `$DSH_HOME` is not exported (the Windows default — `dsh web` does not write the resolved home back to the env), both fall back to `~/.dsh` |
|
|
85
85
|
| `budgets.user.userGlobal` / `budgets.user.workspace` | `2000` / `2000` | hard char budget per layer of the user track |
|
|
86
86
|
| `budgets.agent.userGlobal` / `budgets.agent.workspace` | `4000` / `4000` | hard char budget per layer of the agent track |
|
|
87
87
|
| `writePolicy` | `'ask'` | `'ask'` = user approval; `'auto'` = allow through (approval source recorded); `'off'` = reject. Model-invisible |
|
|
@@ -150,7 +150,7 @@ The name is **`dsh-memento`** (published on npm and GitHub). Not `dsh-recall` (c
|
|
|
150
150
|
|
|
151
151
|
```sh
|
|
152
152
|
npm install
|
|
153
|
-
npm test # node --test:
|
|
153
|
+
npm test # node --test: 115 tests — budget, unique-substring, gate policy, store, snapshot, mock-ctx integration (S2/S3 invariants), V2 command/recall/panel/import
|
|
154
154
|
npm run typecheck # tsc --checkJs gate over index.mjs / lib / scripts
|
|
155
155
|
npm run check:coverage # line-coverage gate: lib ≥90%, index.mjs ≥85%, all files ≥90%
|
|
156
156
|
npm run check:readmes # five-language README consistency gate
|
package/README.pt.md
CHANGED
|
@@ -81,7 +81,7 @@ Todo campo é um `Config` Schemastery validado; valores inválidos falham ruidos
|
|
|
81
81
|
| Campo | Padrão | Significado |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `enabled` | `true` | `false` remove o serviço, as ferramentas, o snapshot, o comando, o painel e o answerer por completo (sem estado parcial) |
|
|
84
|
-
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absoluto, ou relativo a `$DSH_HOME` |
|
|
84
|
+
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | absoluto, ou relativo a `$DSH_HOME`; quando `$DSH_HOME` não é exportado (o padrão no Windows — `dsh web` não devolve o home resolvido ao ambiente), ambos caem para `~/.dsh` |
|
|
85
85
|
| `budgets.user.userGlobal` / `budgets.user.workspace` | `2000` / `2000` | orçamento rígido de caracteres por camada da trilha user |
|
|
86
86
|
| `budgets.agent.userGlobal` / `budgets.agent.workspace` | `4000` / `4000` | orçamento rígido de caracteres por camada da trilha agent |
|
|
87
87
|
| `writePolicy` | `'ask'` | `'ask'` = aprovação do usuário; `'auto'` = permite passar (fonte da aprovação registrada); `'off'` = rejeita. Invisível ao modelo |
|
|
@@ -150,7 +150,7 @@ O nome é **`dsh-memento`** (publicado no npm e no GitHub). Não `dsh-recall` (c
|
|
|
150
150
|
|
|
151
151
|
```sh
|
|
152
152
|
npm install
|
|
153
|
-
npm test # node --test:
|
|
153
|
+
npm test # node --test: 115 testes — orçamento, substring única, política do portão, armazenamento, snapshot, integração com mock-ctx (invariantes S2/S3), comando/recuperação/painel/importação V2
|
|
154
154
|
npm run typecheck # portão tsc --checkJs sobre index.mjs / lib / scripts
|
|
155
155
|
npm run check:coverage # portão de cobertura de linhas: lib ≥90%, index.mjs ≥85%, todos ≥90%
|
|
156
156
|
npm run check:readmes # portão de coerência dos cinco README
|
package/README.zh.md
CHANGED
|
@@ -81,7 +81,7 @@ dsh plugin --profile <name> remove dsh-memento # 卸载:库与会话日
|
|
|
81
81
|
| 字段 | 默认 | 含义 |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `enabled` | `true` | `false` 时服务/工具/快照/命令/面板/answerer 整体消失(不留半残状态) |
|
|
84
|
-
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | 绝对路径,或相对 `$DSH_HOME` |
|
|
84
|
+
| `dbPath` | `''` → `$DSH_HOME/dsh-memento/memory.db` | 绝对路径,或相对 `$DSH_HOME`;`$DSH_HOME` 未导出时(Windows 默认——`dsh web` 不会把解析出的主目录写回环境变量)两者都回退 `~/.dsh` |
|
|
85
85
|
| `budgets.user.userGlobal` / `budgets.user.workspace` | `2000` / `2000` | user 轨每层硬字符预算 |
|
|
86
86
|
| `budgets.agent.userGlobal` / `budgets.agent.workspace` | `4000` / `4000` | agent 轨每层硬字符预算 |
|
|
87
87
|
| `writePolicy` | `'ask'` | `'ask'`=用户审批;`'auto'`=放行但记录审批来源;`'off'`=拒绝。模型不可见 |
|
|
@@ -150,7 +150,7 @@ dsh-memento 不是 Claude Code、Codex 或 Hermes 的移植版——但它的设
|
|
|
150
150
|
|
|
151
151
|
```sh
|
|
152
152
|
npm install
|
|
153
|
-
npm test # node --test:
|
|
153
|
+
npm test # node --test:115 个测试——预算、唯一子串、审批策略、store、快照、mock ctx 集成(S2/S3 不变量)、V2 命令/召回/面板/导入
|
|
154
154
|
npm run typecheck # tsc --checkJs 类型检查门(index.mjs / lib / scripts)
|
|
155
155
|
npm run check:coverage # 行覆盖率门:lib ≥90%、index.mjs ≥85%、全部 ≥90%
|
|
156
156
|
npm run check:readmes # 五语 README 一致性门
|
package/lib/constants.mjs
CHANGED
|
@@ -51,7 +51,6 @@ export const ERROR_CODES = {
|
|
|
51
51
|
PROPOSAL_NOT_FOUND: 'PROPOSAL_NOT_FOUND',
|
|
52
52
|
STORE_CORRUPT: 'STORE_CORRUPT',
|
|
53
53
|
STORE_UNSUPPORTED_VERSION: 'STORE_UNSUPPORTED_VERSION',
|
|
54
|
-
MISSING_DSH_HOME: 'MISSING_DSH_HOME',
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/** 会话事件名(SessionEventMap 声明合并的词汇表;运行时按已知类型自适应派发)。 */
|
package/lib/store.mjs
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { DatabaseSync } from 'node:sqlite'
|
|
12
12
|
import { mkdirSync, chmodSync, existsSync } from 'node:fs'
|
|
13
|
+
import { homedir } from 'node:os'
|
|
13
14
|
import path from 'node:path'
|
|
14
15
|
import { randomUUID } from 'node:crypto'
|
|
15
16
|
import { SCHEMA_VERSION, DEFAULT_DB_NAME, TRACKS, SCOPES, ERROR_CODES, MAX_QUERY_LIMIT } from './constants.mjs'
|
|
@@ -135,24 +136,21 @@ export function chmodOwned(dbPath, io = {}) {
|
|
|
135
136
|
/**
|
|
136
137
|
* 解析记忆库绝对路径。
|
|
137
138
|
* - 显式绝对路径:原样规范化。
|
|
138
|
-
* - 显式相对路径:相对
|
|
139
|
-
* -
|
|
139
|
+
* - 显式相对路径:相对 harness 主目录($DSH_HOME;未导出时回退 ~/.dsh)。
|
|
140
|
+
* - 空值:<harness 主目录>/dsh-memento/memory.db。
|
|
141
|
+
* $DSH_HOME 未导出时回退 ~/.dsh——与官方 harness 的 resolveDshHome() 文档化回退
|
|
142
|
+
* 同语义。dsh 启动不会把解析出的主目录写回 process.env.DSH_HOME,插件自己兜底
|
|
143
|
+
* 才能避免默认 Windows 配置在真实 boot 时整体崩溃(issue #1)。
|
|
140
144
|
* @param {string} [dbPath] - Config.dbPath。
|
|
141
145
|
* @param {string|undefined} [dshHome] - 环境 $DSH_HOME(测试注入)。
|
|
142
146
|
* @returns {string} 绝对路径。
|
|
143
147
|
*/
|
|
144
148
|
export function resolveDbPath(dbPath, dshHome = process.env.DSH_HOME) {
|
|
149
|
+
const home = typeof dshHome === 'string' && dshHome.length > 0 ? dshHome : path.join(homedir(), '.dsh')
|
|
145
150
|
if (dbPath) {
|
|
146
|
-
|
|
147
|
-
return path.isAbsolute(dbPath) ? path.normalize(dbPath) : path.resolve(base, dbPath)
|
|
151
|
+
return path.isAbsolute(dbPath) ? path.normalize(dbPath) : path.resolve(home, dbPath)
|
|
148
152
|
}
|
|
149
|
-
|
|
150
|
-
throw new StoreError(
|
|
151
|
-
ERROR_CODES.MISSING_DSH_HOME,
|
|
152
|
-
'dbPath is not configured and $DSH_HOME is not set; run under dsh or set dbPath explicitly',
|
|
153
|
-
)
|
|
154
|
-
}
|
|
155
|
-
return path.join(dshHome, 'dsh-memento', DEFAULT_DB_NAME)
|
|
153
|
+
return path.join(home, 'dsh-memento', DEFAULT_DB_NAME)
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-memento",
|
|
3
3
|
"description": "Bounded, layered, approval-gated, auditable cross-session memory for DeepSeek Harness — a capability seam (ctx.memory service + local SQLite provider + memory tool + frozen snapshot injection), not another memory warehouse",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
7
7
|
"types": "./types.d.ts",
|