stratagate-dsh 0.3.41 → 0.3.43
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 +188 -145
- package/README.zh-CN.md +185 -144
- package/dist/client.js +1 -1
- package/dist/plugin.js +194 -58
- package/dist/plugin.js.map +1 -1
- package/docs/DSH.md +2 -2
- package/docs/DSH.zh-CN.md +2 -2
- package/docs/assets/stratagate-conversation-memory-en.png +0 -0
- package/docs/assets/stratagate-conversation-memory-zh.png +0 -0
- package/docs/assets/stratagate-long-term-memory-views-en-v2.png +0 -0
- package/docs/assets/stratagate-long-term-memory-views-zh-v2.png +0 -0
- package/docs/assets/stratagate-memory-workflow-en-v2.png +0 -0
- package/docs/assets/stratagate-memory-workflow-zh-v2.png +0 -0
- package/docs/development-validation.md +52 -0
- package/package.json +4 -4
- package/packages/core/src/blocks.ts +24 -0
package/docs/DSH.md
CHANGED
|
@@ -306,9 +306,9 @@ DSH `0.2.1-rc.1` reads the unified host declaration `engines.dsh: "0.1.2-rc.1 ||
|
|
|
306
306
|
|
|
307
307
|
Installation peers use continuous compatibility ranges: `0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0` for general DSH interfaces and `>=0.1.5-rc.2 <0.3.0-0` for Session Format interfaces. Existing legacy adapters remain available. Hosts such as `0.2.1-rc.1` and later `0.2.x` updates need no individual whitelist entries or patch-version upper bounds. DSH `0.3.0`, including every prerelease, remains outside the support boundary until its key interfaces are verified. DSH checks these ranges with `includePrerelease`, accepting alpha, beta, RC, and stable versions within the boundary; ordinary npm range matching does not guarantee acceptance of later prereleases.
|
|
308
308
|
|
|
309
|
-
Startup still requires one coherent internal DSH version. From the `0.2.0` prereleases onward, Session Format packages must also match the core version.
|
|
309
|
+
Startup still requires one coherent internal DSH version. From the `0.2.0` prereleases onward, Session Format packages must also match the core version. DSH `0.2.2` and later hosts use Cordis `4.1.x` from `4.1.0` and Schemastery `3.19.x` from `3.19.0`; earlier modern hosts use Cordis `4.0.x` from `4.0.4` and Schemastery `3.18.x` from `3.18.4`; older hosts retain their original dependency families. Before migration or database access, startup checks tool registration, system prompt, model streaming, and default model selection interfaces. The migration loader also validates codec, migration-stage, and restoration entry points before proceeding. Missing interfaces stop the operation with a specific diagnostic. Method presence alone does not prove behavioral compatibility: strict artifact validation, immutable source generations, and recovery receipts remain in place. A continuous range does not mean every version within it has been tested.
|
|
310
310
|
|
|
311
|
-
Development dependencies remain pinned to DSH `0.2.0-rc.2` for reproducible core checks. The current-host smoke target is recorded as `dshWorkshop.compatibility.currentVersion` (`0.2.
|
|
311
|
+
Development dependencies remain pinned to DSH `0.2.0-rc.2` for reproducible core checks. The current-host smoke target is recorded as `dshWorkshop.compatibility.currentVersion` (`0.2.2-rc.1`). `dshWorkshop.compatibility.dshVersions` records historical regression hosts rather than an installation whitelist. Pull requests check the oldest boundary, the last 0.1 host and the current host; the 0.2 migration boundary remains in the historical matrix because its Windows tests are timing/lock sensitive. Ordinary releases smoke-test the current host, while the full historical matrix runs nightly and can be selected for high-risk release verification. Use `DSH_VERSION=<version> node scripts/run-dsh-compatibility.mjs` to check a new host within the peer ranges. GitHub CI and Roadmap synchronization are active again after the account recovery.
|
|
312
312
|
|
|
313
313
|
On DSH `0.2.0`, the host-owned `dsh-session-format`, `dsh-session-format-catalog`, and `dsh-session-format-v0-to-v1` packages must also match the core DSH version. Mixed or missing Session Format packages stop startup before legacy migration; earlier hosts retain their existing compatibility rules.
|
|
314
314
|
|
package/docs/DSH.zh-CN.md
CHANGED
|
@@ -296,9 +296,9 @@ Topic Projection 优先将全部本批 Event 完整分配到章节和小节。
|
|
|
296
296
|
|
|
297
297
|
安装声明使用连续兼容范围:普通 DSH 接口为 `0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0`,Session Format 接口为 `>=0.1.5-rc.2 <0.3.0-0`。保留已有旧版适配,取消每次宿主升级都追加白名单和设置补丁版本上限的做法;`0.2.1-rc.1` 及后续 `0.2.x` 更新无需逐版追加。`0.3.0` 及其全部预发布版暂不接纳,待关键接口验证后再调整边界。DSH 的兼容检查启用了 `includePrerelease`,范围内的 Alpha、Beta、RC 和正式版均可匹配;普通 npm 的默认范围匹配不保证接纳后续预发布版。
|
|
298
298
|
|
|
299
|
-
运行时仍要求核心 DSH 包来自同一个版本;从 `0.2.0` 预发布版起,也要求 Session Format
|
|
299
|
+
运行时仍要求核心 DSH 包来自同一个版本;从 `0.2.0` 预发布版起,也要求 Session Format 包与核心版本一致。DSH `0.2.2` 及后续 `0.2.x` 宿主使用 Cordis `4.1.x`(从 `4.1.0` 起)和 Schemastery `3.19.x`(从 `3.19.0` 起);更早的现代宿主使用 Cordis `4.0.x`(从 `4.0.4` 起)和 Schemastery `3.18.x`(从 `3.18.4` 起),早期宿主保留其原有依赖族。启动时先检查工具注册、系统提示词、模型调用和默认模型选择接口,再迁移会话或打开数据库;迁移模块加载后,先验证编解码器、迁移阶段和恢复校验入口。接口缺失时给出具体名称并停止操作。方法存在不保证行为完全兼容,迁移仍保留严格内容校验、原始代际不变与恢复收据;连续版本范围也不代表已实测其中每个版本。
|
|
300
300
|
|
|
301
|
-
开发依赖固定为 DSH `0.2.0-rc.2`,保证核心检查可复现;当前宿主 smoke 版本记录在 `dshWorkshop.compatibility.currentVersion
|
|
301
|
+
开发依赖固定为 DSH `0.2.0-rc.2`,保证核心检查可复现;当前宿主 smoke 版本记录在 `dshWorkshop.compatibility.currentVersion`(当前为 `0.2.2-rc.1`)。`dshWorkshop.compatibility.dshVersions` 记录历史回归宿主,不是安装白名单;安装兼容性由 peer 版本范围声明。Pull Request 检查最老边界、最后一个 0.1 宿主和当前宿主;0.2 迁移边界因 Windows 测试对时序和文件锁敏感,保留在历史矩阵中。普通发布只 smoke 当前宿主,完整历史矩阵每天运行,高风险发布可手动选择。可通过 `DSH_VERSION=目标版本 node scripts/run-dsh-compatibility.mjs` 验证范围内的新宿主。账号恢复后 GitHub CI 与 Roadmap 同步已恢复。
|
|
302
302
|
|
|
303
303
|
DSH 核心包现在都是由宿主提供的可选 peer。若某个 profile 曾在本地安装这些 peer,升级后、启动前运行 `dsh plugin --profile <名称> exec stratagate-dsh-repair`。该命令只会把已知 DSH 运行时包移动到 profile 内的 `.stratagate-runtime-backups` 并写入恢复收据,不会删除包或触碰会话数据。启动时 bootstrap 还会把 StrataGate 自身的 DSH 导入定向到宿主维护的共享模块回退目录,再检查实际解析出的 DSH 核心族;未知宿主会立即给出明确错误并停止,而不是让正文区域空白。对于受支持的 DSH `0.1.5`、`0.1.6`、`0.1.7` 和 `0.2.0`,含已废弃 `stratagate/memory-citations` 事件的 v0 会话会先复制成经过校验的 v1 代际,再由宿主继续其迁移链;原始 v0 日志不会被修改,并写入 `stratagate-legacy-citations-v1.json` 记录源/目标哈希和恢复说明。
|
|
304
304
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# 开发和发布时如何避免重复检查
|
|
2
|
+
|
|
3
|
+
目标是在代码稳定后运行一次与风险相称的完整 CI,后续步骤复用可信结果;候选包和正式包各自只补做针对实际包的检查。
|
|
4
|
+
|
|
5
|
+
1. 修复过程中先运行受影响的测试。合并同一轮反馈后再推送,避免每处小修改都启动完整 CI。新的 PR 提交会取消同一 PR 尚未完成的旧 CI;不同 PR 和 main 的运行互不影响。
|
|
6
|
+
2. 准备发布的功能 PR 直接把目标正式版本号写入 `package.json` 和 `package-lock.json`,并用这个文件树跑最终 PR CI。合并后 main CI 复用同一文件树的证据,发布工作流直接从合并提交生成正式包,不再创建单独的改版本号 PR。普通修复如果不发布,不需要提前改版本。
|
|
7
|
+
3. 记录已通过 CI 的提交、文件树和检查范围。同一文件树且检查范围满足要求时,审查后直接复用,不再人为触发空提交或重复完整 CI。文件、依赖、构建配置或测试范围变化时,重新执行受影响的检查;不能把不同版本的包当作相同文件。
|
|
8
|
+
4. 候选包用于人工验收,不上传 npm。候选版本只在提交源码的暂存副本中改成 `T-candidate.N`,使用 `node scripts/stage-candidate.mjs --version T-candidate.N --output <暂存目录>` 生成;正式源码和 lockfile 始终保留 `T`。候选只检查包内容、安装和启动,不重复源码测试;历史宿主全矩阵按风险或定期执行。
|
|
9
|
+
5. 正式发布从进入 main 的源码经 GitHub Actions trusted publishing 生成,核对实际正式包、安装、来源和公开结果。发布 workflow 核实同树的 PR 完整 CI,或同一 main 提交的完整 CI;找不到、仍在运行、任务缺失或查询失败时停止发布。正式包只打一次,内容检查和安装验证使用同一个文件。
|
|
10
|
+
|
|
11
|
+
PR CI 明确测试 PR 头提交。合并到 main 后,仅当已合并的同仓库 PR 头提交与 main 的完整文件树一致,且指定工作流的全部必需任务均已成功时,main 才跳过重复测试;其他情况自动运行完整 CI。发布时重新核验这些证据。候选和正式包版本不同,必须检查实际发布的包。
|
|
12
|
+
|
|
13
|
+
## 下一步的优先顺序
|
|
14
|
+
|
|
15
|
+
1. 对照 Windows 三个代表任务的总时长,确认复用隔离 CLI 之后比 [run 42344461565](https://github.com/diqierjia/StrataGate-AgentMemory/actions/runs/42344461565) 的大约 15 / 23 / 36 分钟更短。第一次运行要安装并写入缓存;同一缓存键的下一次运行才是命中。不要为了缩短时间删掉代表版本或 Windows。
|
|
16
|
+
2. 将发布所需版本尽量包含在最终功能 PR,并在定稿后跑最终 CI;修复迭代用相关测试和审查,避免为每次评审都等完整矩阵。合并产生的文件树如与已测树不同,补测合并结果。
|
|
17
|
+
3. 对候选包复用同一源码的 CI:候选版本号在独立暂存目录设置,记录被测源码提交与版本元数据差异;打包后对该文件执行 `node scripts/verify-package.mjs <候选包路径>` 和针对当前宿主的 `node scripts/verify-dsh-install.mjs <候选包路径>`,不重复运行源码测试。两条命令应在候选源码的构建环境运行,并设置 `DSH_VERSION` 为当前宿主版本。
|
|
18
|
+
4. 对正式发布、直接推送和合并结果变化,使用工作流中的证据核验;不得仅按提交消息或文件名判断已通过。
|
|
19
|
+
|
|
20
|
+
候选暂存脚本只读取指定提交并在临时副本中改写版本,源码工作树不会被候选后缀污染。发布工作流会拒绝候选版本源码,确保正式包只能从正式版本文件树生成。
|
|
21
|
+
|
|
22
|
+
## Windows 兼容验证按风险分层
|
|
23
|
+
|
|
24
|
+
PR CI 先看这次改了哪些文件,再决定要不要跑 Windows。依据是这些文件会不会进入 DSH 兼容套件(`check:dsh`、`test:dsh`、`build:dsh`、`verify:dsh`),不看提交说明。
|
|
25
|
+
|
|
26
|
+
需要 Windows:
|
|
27
|
+
|
|
28
|
+
- `src/` 下的插件源码,以及 `packages/core/src/`、核心包的 `package.json` 和 tsconfig
|
|
29
|
+
- 根目录 `tests/**/*.ts` 和 `tests/fixtures/`
|
|
30
|
+
- 套件直接调用的脚本:`run-dsh-compatibility.mjs`、`dsh-cli-isolate.mjs`、`build-client.mjs`、`check-feedback-policy.mjs`、`verify-package.mjs`、`verify-dsh-install.mjs`
|
|
31
|
+
- `tsconfig.json`、`tsconfig.base.json`、`vitest.config.ts`、`tsup.config.ts`、`cordis.patch.yml`
|
|
32
|
+
- `package.json` 或 `package-lock.json` 里除版本号以外的改动;看不出差异内容时按高风险处理
|
|
33
|
+
- `.github/workflows/` 下的工作流
|
|
34
|
+
|
|
35
|
+
可以只跑 Ubuntu:
|
|
36
|
+
|
|
37
|
+
- 文档、WorkBuddy、核心包自己的单元测试
|
|
38
|
+
- 不参与兼容套件的脚本,例如候选暂存和发布证据查询
|
|
39
|
+
- `tests/**/*.mjs`
|
|
40
|
+
- 只改 `package.json` 和 `package-lock.json` 的版本号
|
|
41
|
+
|
|
42
|
+
分类失败,或这次是直接推到 `main`:跑 Windows。合并后的 main 如果已经有同一文件树的 PR 证据,并且证据覆盖了上面要求的系统,就复用,不再重跑。
|
|
43
|
+
|
|
44
|
+
正式发布用同一套规则。高风险提交的证据必须包含 Windows。只改版本号或文档时,可以复用只有 Ubuntu 的同树证据。手动发布不查 PR 接口,直接看该提交在 main 上的 CI:要么包含 Windows 的矩阵任务都成功,要么 `reuse-pr-ci` 已经成功。后者表示 main 当时已经按上面的规则接受了 PR 证据,0.3.42 的正式发布就是靠这条记录通过的。
|
|
45
|
+
|
|
46
|
+
历史宿主全矩阵仍由定时或手动工作流运行,不进每个 PR。时间仍是每天 02:30(Asia/Shanghai)。代表宿主任务的上限是 90 分钟。已经成功过的 Windows 任务大约 47 分钟,上限留在这之上;仓库 `npm ci` 另有 20 分钟上限。一个任务失败或超时不会取消其他系统上的任务。
|
|
47
|
+
|
|
48
|
+
同一次任务里,选定的宿主 CLI 只安装一次,并使用和真实宿主冒烟相同的版本钉扎。包校验把这棵树复制到单独目录,把已经装好的精确版本同时写进 dependencies 和对应 override,再安装待测 tarball。两处字符串保持一致,npm 才不会因说明不一致拒绝安装,也不会把宿主包当成多余依赖删掉。真实宿主冒烟也复制这棵树,然后继续做 plugin 安装、修复、Web 启动、会话页和迁移。复制出来的符号链接如果指向树的外面,就丢掉这次复制并重新安装。
|
|
49
|
+
|
|
50
|
+
Actions 缓存按操作系统、DSH 版本、Node 版本和 `scripts/dsh-cli-isolate.mjs` 的内容保存这棵树。还原之后核对 CLI 版本、`lib/bin.js`、已装包指纹,以及钉扎的依赖名和版本字符串是否仍与当前仓库一致。键顺序不同不算变化;版本字符串变了就删除整目录并重新安装,不在半截目录上继续。已经写入的坏缓存不能原键覆盖;下次还会被拒绝并重装,直到隔离脚本变化。日志里的 `[dsh-isolate]`、`[verify-package]`、`[verify-dsh-install]` 会写明复用还是重装。
|
|
51
|
+
|
|
52
|
+
比较 Windows 耗时时,看 `dsh-compatibility (windows-latest, 0.1.2-rc.1)`、`0.1.7-rc.2` 和 `0.2.2-rc.1` 的总时长。改动前的 [run 42344461565](https://github.com/diqierjia/StrataGate-AgentMemory/actions/runs/42344461565) 大约是 15、23、36 分钟;其中当前宿主的套件步骤里,隔离安装约 9 分钟(652 个包),包校验约 11.5 分钟,安装冒烟约 8.5 分钟。仓库 `npm ci` 当时已经命中缓存。第一次运行含安装和缓存上传,之后的同键运行才是命中。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stratagate-dsh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.43",
|
|
4
4
|
"description": "Recent conversations stay vivid. Older ones fade into summaries, not oblivion. StrataGate gives DeepSeek Harness six-layer, time-decaying memory, while lasting events and relationships settle into a knowledge graph. Bring your memories from other AIs with you—no need to start over.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"dispose": "supported"
|
|
121
121
|
},
|
|
122
122
|
"compatibility": {
|
|
123
|
-
"currentVersion": "0.2.
|
|
123
|
+
"currentVersion": "0.2.2-rc.1",
|
|
124
124
|
"dshVersions": [
|
|
125
125
|
"0.1.2-rc.1",
|
|
126
126
|
"0.1.5-rc.1",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"node": "^22.19.0 || >=24.0.0"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
|
-
"@deepseek-ai/cordis": "4.0.2 || ~4.0.4",
|
|
165
|
+
"@deepseek-ai/cordis": "4.0.2 || ~4.0.4 || ~4.1.0",
|
|
166
166
|
"@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
167
167
|
"@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
168
168
|
"@deepseek-ai/dsh-llm": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"@deepseek-ai/dsh-settings": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
175
175
|
"@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
176
176
|
"@deepseek-ai/dsh-tools": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
177
|
-
"@deepseek-ai/schemastery": "3.18.2 || ~3.18.4"
|
|
177
|
+
"@deepseek-ai/schemastery": "3.18.2 || ~3.18.4 || ~3.19.0"
|
|
178
178
|
},
|
|
179
179
|
"peerDependenciesMeta": {
|
|
180
180
|
"@deepseek-ai/cordis": {
|
|
@@ -369,6 +369,30 @@ export function formatRawTranscript(messages: readonly RawMessage[]): string {
|
|
|
369
369
|
.join('\n\n');
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
const ATTACHMENT_REFERENCE_PREFIX = '[StrataGate attachment] ';
|
|
373
|
+
|
|
374
|
+
function attachmentReferenceLines(value: string): string[] {
|
|
375
|
+
return value.split(/\r?\n/u).filter((line) => line.startsWith(ATTACHMENT_REFERENCE_PREFIX));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function attachmentReferences(messages: readonly RawMessage[]): string[] {
|
|
379
|
+
const lines: string[] = [];
|
|
380
|
+
for (const message of messages) {
|
|
381
|
+
lines.push(...attachmentReferenceLines(message.content));
|
|
382
|
+
for (const trace of message.toolCalls ?? []) {
|
|
383
|
+
if (typeof trace.result === 'string') lines.push(...attachmentReferenceLines(trace.result));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return [...new Set(lines)];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** Keep durable attachment identity visible in every rendered layer. */
|
|
390
|
+
export function preserveAttachmentReferences(content: string, messages: readonly RawMessage[]): string {
|
|
391
|
+
const missing = attachmentReferences(messages).filter((reference) => !content.includes(reference));
|
|
392
|
+
if (missing.length === 0) return content;
|
|
393
|
+
return `${content}\n\nAttachments retained in source:\n${missing.join('\n')}`;
|
|
394
|
+
}
|
|
395
|
+
|
|
372
396
|
export function estimateTokens(value: string): number {
|
|
373
397
|
let tokens = 0;
|
|
374
398
|
let asciiRun = 0;
|