stratagate-dsh 0.2.60 → 0.2.63

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.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/repair-profile.ts
4
+ import { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
+ import { randomUUID } from "node:crypto";
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ var PROFILE_PACKAGES = [
9
+ "@deepseek-ai/cordis",
10
+ "@deepseek-ai/cosmokit",
11
+ "@deepseek-ai/dsh-agent",
12
+ "@deepseek-ai/dsh-agent-default-model",
13
+ "@deepseek-ai/dsh-brand",
14
+ "@deepseek-ai/dsh-client-ui-conversation",
15
+ "@deepseek-ai/dsh-code-runtime",
16
+ "@deepseek-ai/dsh-invariants",
17
+ "@deepseek-ai/dsh-llm",
18
+ "@deepseek-ai/dsh-scope",
19
+ "@deepseek-ai/dsh-session",
20
+ "@deepseek-ai/dsh-session-format",
21
+ "@deepseek-ai/dsh-session-format-catalog",
22
+ "@deepseek-ai/dsh-session-format-v0-to-v1",
23
+ "@deepseek-ai/dsh-session-projection",
24
+ "@deepseek-ai/dsh-settings",
25
+ "@deepseek-ai/dsh-system-prompt",
26
+ "@deepseek-ai/dsh-timeout",
27
+ "@deepseek-ai/dsh-tools",
28
+ "@deepseek-ai/dsh-typert-protocol",
29
+ "@deepseek-ai/dsh-user-approval",
30
+ "@deepseek-ai/dsh-util-crypto",
31
+ "@deepseek-ai/dsh-util-values",
32
+ "@deepseek-ai/schemastery"
33
+ ];
34
+ function profileDirectory(start) {
35
+ let directory = start;
36
+ for (; ; ) {
37
+ const manifestPath = join(directory, "package.json");
38
+ if (existsSync(manifestPath)) {
39
+ try {
40
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
41
+ if (manifest.dsh?.profile && typeof manifest.dsh.profile === "object") return directory;
42
+ } catch {
43
+ }
44
+ }
45
+ const parent = dirname(directory);
46
+ if (parent === directory) {
47
+ throw new Error("stratagate-dsh-repair must run inside an installed DSH profile");
48
+ }
49
+ directory = parent;
50
+ }
51
+ }
52
+ function main() {
53
+ const profile = profileDirectory(dirname(fileURLToPath(import.meta.url)));
54
+ const modules = join(profile, "node_modules");
55
+ const candidates = PROFILE_PACKAGES.map((name) => ({ name, source: join(modules, ...name.split("/")) })).filter(({ source }) => {
56
+ try {
57
+ lstatSync(source);
58
+ return true;
59
+ } catch (error) {
60
+ if (error.code === "ENOENT") return false;
61
+ throw error;
62
+ }
63
+ });
64
+ if (candidates.length === 0) {
65
+ process.stdout.write("StrataGate profile runtime is already isolated; no DSH peer residue found.\n");
66
+ return;
67
+ }
68
+ const backup = join(profile, ".stratagate-runtime-backups", `${Date.now()}-${process.pid}-${randomUUID()}`);
69
+ const moved = [];
70
+ try {
71
+ for (const candidate of candidates) {
72
+ const target = join(backup, "node_modules", ...candidate.name.split("/"));
73
+ mkdirSync(dirname(target), { recursive: true });
74
+ renameSync(candidate.source, target);
75
+ moved.push({ ...candidate, target });
76
+ }
77
+ const receipt = {
78
+ schema: "stratagate-dsh-profile-runtime-repair/v1",
79
+ profile,
80
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
81
+ packages: moved.map(({ name, source, target }) => ({ name, source, target })),
82
+ recovery: `While DSH is stopped, move the listed targets back to their source paths if this repair must be reversed.`
83
+ };
84
+ writeFileSync(join(backup, "receipt.json"), `${JSON.stringify(receipt, null, 2)}
85
+ `, { flag: "wx", mode: 384 });
86
+ } catch (error) {
87
+ for (const item of moved.reverse()) {
88
+ if (existsSync(item.target) && !existsSync(item.source)) renameSync(item.target, item.source);
89
+ }
90
+ throw error;
91
+ }
92
+ process.stdout.write(`Quarantined ${moved.length} stale DSH profile package(s) to ${backup}
93
+ `);
94
+ }
95
+ try {
96
+ main();
97
+ } catch (error) {
98
+ process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}
99
+ `);
100
+ process.exitCode = 1;
101
+ }
102
+ //# sourceMappingURL=repair-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/repair-profile.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { randomUUID } from 'node:crypto'\nimport { basename, dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst PROFILE_PACKAGES = [\n '@deepseek-ai/cordis',\n '@deepseek-ai/cosmokit',\n '@deepseek-ai/dsh-agent',\n '@deepseek-ai/dsh-agent-default-model',\n '@deepseek-ai/dsh-brand',\n '@deepseek-ai/dsh-client-ui-conversation',\n '@deepseek-ai/dsh-code-runtime',\n '@deepseek-ai/dsh-invariants',\n '@deepseek-ai/dsh-llm',\n '@deepseek-ai/dsh-scope',\n '@deepseek-ai/dsh-session',\n '@deepseek-ai/dsh-session-format',\n '@deepseek-ai/dsh-session-format-catalog',\n '@deepseek-ai/dsh-session-format-v0-to-v1',\n '@deepseek-ai/dsh-session-projection',\n '@deepseek-ai/dsh-settings',\n '@deepseek-ai/dsh-system-prompt',\n '@deepseek-ai/dsh-timeout',\n '@deepseek-ai/dsh-tools',\n '@deepseek-ai/dsh-typert-protocol',\n '@deepseek-ai/dsh-user-approval',\n '@deepseek-ai/dsh-util-crypto',\n '@deepseek-ai/dsh-util-values',\n '@deepseek-ai/schemastery',\n] as const\n\nfunction profileDirectory(start: string): string {\n let directory = start\n for (;;) {\n const manifestPath = join(directory, 'package.json')\n if (existsSync(manifestPath)) {\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { dsh?: { profile?: unknown } }\n if (manifest.dsh?.profile && typeof manifest.dsh.profile === 'object') return directory\n } catch {}\n }\n const parent = dirname(directory)\n if (parent === directory) {\n throw new Error('stratagate-dsh-repair must run inside an installed DSH profile')\n }\n directory = parent\n }\n}\n\nfunction main(): void {\n const profile = profileDirectory(dirname(fileURLToPath(import.meta.url)))\n const modules = join(profile, 'node_modules')\n const candidates = PROFILE_PACKAGES\n .map((name) => ({ name, source: join(modules, ...name.split('/')) }))\n .filter(({ source }) => {\n try {\n lstatSync(source)\n return true\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw error\n }\n })\n if (candidates.length === 0) {\n process.stdout.write('StrataGate profile runtime is already isolated; no DSH peer residue found.\\n')\n return\n }\n\n const backup = join(profile, '.stratagate-runtime-backups', `${Date.now()}-${process.pid}-${randomUUID()}`)\n const moved: Array<{ name: string; source: string; target: string }> = []\n try {\n for (const candidate of candidates) {\n const target = join(backup, 'node_modules', ...candidate.name.split('/'))\n mkdirSync(dirname(target), { recursive: true })\n renameSync(candidate.source, target)\n moved.push({ ...candidate, target })\n }\n const receipt = {\n schema: 'stratagate-dsh-profile-runtime-repair/v1',\n profile,\n createdAt: new Date().toISOString(),\n packages: moved.map(({ name, source, target }) => ({ name, source, target })),\n recovery: `While DSH is stopped, move the listed targets back to their source paths if this repair must be reversed.`,\n }\n writeFileSync(join(backup, 'receipt.json'), `${JSON.stringify(receipt, null, 2)}\\n`, { flag: 'wx', mode: 0o600 })\n } catch (error) {\n for (const item of moved.reverse()) {\n if (existsSync(item.target) && !existsSync(item.source)) renameSync(item.target, item.source)\n }\n throw error\n }\n process.stdout.write(`Quarantined ${moved.length} stale DSH profile package(s) to ${backup}\\n`)\n}\n\ntry {\n main()\n} catch (error) {\n process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\\n`)\n process.exitCode = 1\n}\n"],"mappings":"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","names":[]}
package/docs/DSH.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # StrataGate for DeepSeek Harness
2
2
 
3
- [English](../README.md) · [简体中文](DSH.zh-CN.md)
3
+ [English](../README.md) · [简体中文](DSH.zh-CN.md)
4
4
 
5
5
  Automatic, local-first cross-session memory for DeepSeek Harness. StrataGate remembers user preferences, project decisions, completed conversations, and tool results, then checks recalled evidence and can expand it back to the original messages before the agent answers. No separate memory server is required.
6
6
 
@@ -10,11 +10,11 @@ The plugin adapts DSH session events to the existing StrataGate memory engine; i
10
10
 
11
11
  ### Knowledge graph and event timeline
12
12
 
13
- ![StrataGate knowledge graph and event timeline view](assets/stratagate-knowledge-graph.png)
13
+ ![StrataGate knowledge graph and event timeline view](assets/stratagate-knowledge-graph.png)
14
14
 
15
15
  ### Layered short-term memory
16
16
 
17
- ![StrataGate layered short-term memory view](assets/stratagate-short-term-memory.png)
17
+ ![StrataGate layered short-term memory view](assets/stratagate-short-term-memory.png)
18
18
 
19
19
  ## How it is designed
20
20
 
@@ -80,7 +80,7 @@ Removing the plugin does not delete that database.
80
80
  - Subagent turns are not ingested by default; subagents in the same project can still read project memory.
81
81
  - Each DSH turn has a durable ingestion receipt, so replay or retry cannot store it twice.
82
82
  - StrataGate performs Block summarization, Event extraction, versioned Knowledge Graph projection, search, Evidence Gate, and use-only reinforcement.
83
- - When a Block reaches its boundary, StrataGate first seals durable L3-L5 without touching the DSH surface. Only after validated L0-L2 and Event processing make the Block ready does the plugin use native surface `replace`; pending or failed Blocks keep their original conversation messages. Later decay, manual lift, or λ changes update only ready checkpoints. Unsealed open-tail messages and complete tool-call/result chains remain native DSH messages.
83
+ - When a Block reaches its boundary, StrataGate first seals durable L3-L5 without touching the DSH surface. Only after validated L0-L2 and Event processing make the Block ready does the plugin use native surface `replace`; pending or failed Blocks keep their original conversation messages. Later decay, manual lift, or λ changes update only ready checkpoints. Unsealed open-tail messages and complete tool-call/result chains remain native DSH messages.
84
84
  - Before every main-model call, dynamic system context injects only up to four project-scoped activated Events and four active Graph nodes. It never serializes the current conversation, open tail, sealed Blocks, or tool calls into that prompt.
85
85
 
86
86
  Activated memory uses the current human message plus the latest two open-tail turns from the current session as its query. Existing BM25 search remains the lexical relevance gate; pinned and safety memory are the only exceptions. Existing memory weights provide a second ranking, and RRF fuses the relevance and weight rankings. The activated section has a fixed budget of about 900 tokens, so it does not grow with the database.
@@ -131,9 +131,9 @@ Open DSH Settings and select **StrataGate-AgentMemory**. The page provides:
131
131
  - manual Block expansion and a two-step external-memory import flow;
132
132
  - a Usage Audit chain from a recorded answer turn, through the Evidence Gate verdict and selected memories, back to source messages.
133
133
 
134
- Events, graph facts, and source messages cannot be edited, deleted, or approved in the UI. The UI can still change memory state in three explicit ways: manually expand a Block, import memory exported by another AI, and use Advanced Settings to change the completed turns per Block or the global Block decay coefficient λ. When the Block size changes, the UI explains their relationship and suggests a λ that preserves the decay rate per conversation turn; the user decides whether to adopt it. Saved settings immediately apply to every existing workspace, become the defaults for future workspaces, and survive restarts. Existing sealed Blocks are never repartitioned.
135
-
136
- The UI validates and previews pasted `stratagate.external-memory.v2` JSON before writing. Malformed input uses a model-backed recovery fallback whose candidates always require review. Exact duplicates are ignored deterministically; the configured model adjudicates other candidates against Top-K local Events as add, merge, supersede, conflict, or ignore. Analysis jobs persist per-candidate progress in SQLite, resume after the import page is reopened, and let users choose the action for low-confidence decisions. High-confidence decisions remain automatic, and a committed import can be undone as one batch. Common token and credential patterns are redacted in message content and structured tool traces before they leave the local server. The SQLite database remains the source of truth.
134
+ Events, graph facts, and source messages cannot be edited, deleted, or approved in the UI. The UI can still change memory state in three explicit ways: manually expand a Block, import memory exported by another AI, and use Advanced Settings to change the completed turns per Block or the global Block decay coefficient λ. When the Block size changes, the UI explains their relationship and suggests a λ that preserves the decay rate per conversation turn; the user decides whether to adopt it. Saved settings immediately apply to every existing workspace, become the defaults for future workspaces, and survive restarts. Existing sealed Blocks are never repartitioned.
135
+
136
+ The UI validates and previews pasted `stratagate.external-memory.v2` JSON before writing. Malformed input uses a model-backed recovery fallback whose candidates always require review. Exact duplicates are ignored deterministically; the configured model adjudicates other candidates against Top-K local Events as add, merge, supersede, conflict, or ignore. Analysis jobs persist per-candidate progress in SQLite, resume after the import page is reopened, and let users choose the action for low-confidence decisions. High-confidence decisions remain automatic, and a committed import can be undone as one batch. Common token and credential patterns are redacted in message content and structured tool traces before they leave the local server. The SQLite database remains the source of truth.
137
137
 
138
138
  ## Configuration
139
139
 
@@ -145,13 +145,13 @@ config:
145
145
  globalNamespace: global
146
146
  blockTurnSize: 6
147
147
  blockDecayLambda: 0.3
148
- ingestSubagents: false
149
- maxOutputTokens: 10000
150
- structuredTaskTimeoutMs: 120000
151
- structuredReasoningEffort: auto # auto | force-off
152
- # Optional: use a dedicated model for memory processing.
148
+ ingestSubagents: false
149
+ maxOutputTokens: 10000
150
+ structuredTaskTimeoutMs: 120000
151
+ structuredReasoningEffort: auto # auto | force-off
152
+ # Optional: use a dedicated model for memory processing.
153
153
  # provider: deepseek
154
- # model: deepseek-chat
154
+ # model: deepseek-chat
155
155
  ```
156
156
 
157
157
  `blockTurnSize` and `blockDecayLambda` are initial fallbacks. Once changed in **Advanced Settings**, persisted UI values take precedence. λ defaults to `0.3`; smaller values forget more slowly and consume more tokens, and values above `0.4` are not recommended.
@@ -172,7 +172,9 @@ For diagnostics, the five most recent successful memory-model responses are reta
172
172
 
173
173
  ## Compatibility and permissions
174
174
 
175
- Release gates exercise DSH `0.1.2-rc.1` on Node `24`, plus the core package on Node `22.19` and `24`. The published peer range accepts compatible DSH releases from `0.1.2-rc.1` up to, but not including, `0.2.0`.
175
+ Release gates exercise the complete DSH `0.1.2-rc.1` family and `@deepseek-ai/dsh@0.1.5-rc.1` on Node `24`, on both Linux and Windows. The latter's real dependency tree resolves its internal DSH packages to `0.1.5-rc.2`; that is intentional. The plugin declares these DSH packages as optional, exact-version peers so the host supplies one coherent runtime instead of npm installing a second copy. Other `0.1.x` versions are not implicitly supported.
176
+
177
+ DSH core packages are host-provided optional peers. After upgrading a profile that once installed those peers locally, run `dsh plugin --profile <name> exec stratagate-dsh-repair` before starting it. The command moves only the known DSH runtime packages into `.stratagate-runtime-backups` inside that profile and writes a recovery receipt; it does not delete them or touch session data. At startup, a bootstrap resolver also forces StrataGate's own imports through the installation-owned module fallback, then verifies the resolved DSH core family and stops with an actionable error for an unknown host family. On DSH `0.1.5`, v0 sessions containing the retired `stratagate/memory-citations` event are copied to a validated v1 generation before the host migrates them to v3. The original v0 log is never modified; a `stratagate-legacy-citations-v1.json` receipt records source/target hashes and recovery instructions.
176
178
 
177
179
  The package declares local filesystem read/write and Harness tool registration. It does not request direct network, subprocess, shell, Python, or credential access. Model calls still flow through DSH's existing LLM service.
178
180
 
package/docs/DSH.zh-CN.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # StrataGate for DeepSeek Harness
2
2
 
3
- [English](DSH.md) · [简体中文](../README.zh-CN.md)
3
+ [English](DSH.md) · [简体中文](../README.zh-CN.md)
4
4
 
5
5
  面向 DeepSeek Harness 的自动、本地优先跨会话记忆。StrataGate 能够记住用户偏好、项目决策、已完成的对话和工具结果;Agent 回答前会检查找回的证据,并可将其展开追溯到原始消息。无需单独部署记忆服务器。
6
6
 
@@ -80,7 +80,7 @@ DSH_HOME/stratagate/memory.db
80
80
  - 默认不保存子 Agent 的对话轮次;同一项目中的子 Agent 仍然可以读取项目记忆。
81
81
  - 每个 DSH 对话轮次都有持久化的写入回执,因此重放或重试不会导致重复保存。
82
82
  - StrataGate 会执行 Block 摘要、Event 提取、版本化 Knowledge Graph 投影、搜索、Evidence Gate(证据门控)以及仅在使用后触发的强化。
83
- - Block 到达边界时,StrataGate 先持久化真实的 L3–L5,不修改 DSH surface。只有 L0–L2 校验通过且 Event 处理完成、Block 进入可衰减状态后,插件才使用原生 surface `replace`;待处理或失败的 Block 始终保留原始会话消息。后续衰减、手动提升或 λ 调整也只更新已就绪 checkpoint。尚未封存的 open tail 与完整工具调用/结果链继续作为 DSH 原生消息保留。
83
+ - Block 到达边界时,StrataGate 先持久化真实的 L3–L5,不修改 DSH surface。只有 L0–L2 校验通过且 Event 处理完成、Block 进入可衰减状态后,插件才使用原生 surface `replace`;待处理或失败的 Block 始终保留原始会话消息。后续衰减、手动提升或 λ 调整也只更新已就绪 checkpoint。尚未封存的 open tail 与完整工具调用/结果链继续作为 DSH 原生消息保留。
84
84
  - 每次主模型调用前,动态系统上下文只注入最多 4 条项目级激活 Event 和 4 个 active Graph Node,不再序列化 Current conversation、open tail、已封 Block 或 tool calls。
85
85
 
86
86
  激活查询由当前人类消息和当前会话 open tail 的最近两个 turn 组成。现有 BM25 搜索继续作为词面相关性门槛,只有 pinned 和 safety 记忆可以例外进入候选;现有记忆权重提供第二路排序,再由 RRF 融合相关性与权重排序。激活区固定使用约 900 tokens 的预算,不会随数据库增大而增长。
@@ -128,9 +128,9 @@ ID、`blockId`、角色、轮次和有界摘录。`narrative`、`quotes`、来
128
128
  - 手动展开 Block,以及分两步导入其他 AI 的记忆;
129
129
  - Usage Audit(使用审计)链路:从已记录的回答轮次出发,经由 Evidence Gate 的判断与选中的记忆,追溯到来源消息。
130
130
 
131
- 界面不允许直接编辑、删除或批准 Event、图谱事实和来源消息,但可以通过三种明确操作改变记忆状态:手动展开 Block、导入其他 AI 的记忆,以及在“高级设置”中修改每个 Block 包含的完整对话轮数或全局 Block 衰减系数 λ。修改轮数时,界面会解释两者关系并给出保持单位对话衰减速度的建议 λ,是否采用由用户决定。保存后设置立即应用到所有已有工作区,同时成为新工作区默认值,并在重启后保持;已封存 Block 不会重新切分。
132
-
133
- 当前界面会在写入前校验并预览粘贴的 `stratagate.external-memory.v2` JSON:不合格内容会进入模型兜底恢复,恢复候选全部需要人工确认。完全重复项会被确定性忽略,其余候选由当前模型结合 Top-K 本地 Event 判断新增、合并、取代、冲突或忽略。分析任务和逐条进度持久化到 SQLite,关闭并重新打开页面后会恢复进度;高置信度判断自动采用,低置信度项可由用户选择具体动作;提交后可按批次撤销。消息内容和结构化工具轨迹中的常见令牌及凭证格式,会在离开本地服务器前被脱敏。SQLite 数据库始终是唯一可信数据源。
131
+ 界面不允许直接编辑、删除或批准 Event、图谱事实和来源消息,但可以通过三种明确操作改变记忆状态:手动展开 Block、导入其他 AI 的记忆,以及在“高级设置”中修改每个 Block 包含的完整对话轮数或全局 Block 衰减系数 λ。修改轮数时,界面会解释两者关系并给出保持单位对话衰减速度的建议 λ,是否采用由用户决定。保存后设置立即应用到所有已有工作区,同时成为新工作区默认值,并在重启后保持;已封存 Block 不会重新切分。
132
+
133
+ 当前界面会在写入前校验并预览粘贴的 `stratagate.external-memory.v2` JSON:不合格内容会进入模型兜底恢复,恢复候选全部需要人工确认。完全重复项会被确定性忽略,其余候选由当前模型结合 Top-K 本地 Event 判断新增、合并、取代、冲突或忽略。分析任务和逐条进度持久化到 SQLite,关闭并重新打开页面后会恢复进度;高置信度判断自动采用,低置信度项可由用户选择具体动作;提交后可按批次撤销。消息内容和结构化工具轨迹中的常见令牌及凭证格式,会在离开本地服务器前被脱敏。SQLite 数据库始终是唯一可信数据源。
134
134
 
135
135
  ## 配置
136
136
 
@@ -142,13 +142,13 @@ config:
142
142
  globalNamespace: global
143
143
  blockTurnSize: 6
144
144
  blockDecayLambda: 0.3
145
- ingestSubagents: false
146
- maxOutputTokens: 10000
147
- structuredTaskTimeoutMs: 120000
148
- structuredReasoningEffort: auto # auto | force-off
149
- # 可选:为记忆处理指定专用模型。
145
+ ingestSubagents: false
146
+ maxOutputTokens: 10000
147
+ structuredTaskTimeoutMs: 120000
148
+ structuredReasoningEffort: auto # auto | force-off
149
+ # 可选:为记忆处理指定专用模型。
150
150
  # provider: deepseek
151
- # model: deepseek-chat
151
+ # model: deepseek-chat
152
152
  ```
153
153
 
154
154
  配置文件中的 `blockTurnSize` 和 `blockDecayLambda` 是初始后备值;一旦在“高级设置”中修改,持久化的界面值优先生效。λ 默认值为 `0.3`;数字越小,记忆遗忘越慢、消耗 token 越多,不建议大于 `0.4`。
@@ -169,7 +169,9 @@ config:
169
169
 
170
170
  ## 兼容性与权限
171
171
 
172
- 发布门禁会在 Node `24` 上测试 DSH `0.1.2-rc.1`,并在 Node `22.19` 和 `24` 上测试核心包。发布包声明的 peer 版本范围接受从 `0.1.2-rc.1` 开始、低于 `0.2.0` 的兼容 DSH 版本。
172
+ 发布门禁会在 Node `24`、Linux 和 Windows 上测试完整的 DSH `0.1.2-rc.1` 依赖族,以及 `@deepseek-ai/dsh@0.1.5-rc.1`。后者的真实依赖树会把内部 DSH 包解析为 `0.1.5-rc.2`,这是预期行为。插件将这些 DSH 包声明为可选且精确版本的 peer,由宿主提供一套一致的运行时,避免 npm 在插件目录再安装第二套核心包;不会笼统承诺其他 `0.1.x` 版本。
173
+
174
+ DSH 核心包现在都是由宿主提供的可选 peer。若某个 profile 曾在本地安装这些 peer,升级后、启动前运行 `dsh plugin --profile <名称> exec stratagate-dsh-repair`。该命令只会把已知 DSH 运行时包移动到 profile 内的 `.stratagate-runtime-backups` 并写入恢复收据,不会删除包或触碰会话数据。启动时 bootstrap 还会把 StrataGate 自身的 DSH 导入定向到宿主维护的共享模块回退目录,再检查实际解析出的 DSH 核心族;未知宿主会立即给出明确错误并停止,而不是让正文区域空白。对于 DSH `0.1.5`,含已废弃 `stratagate/memory-citations` 事件的 v0 会话会先复制成经过校验的 v1 代际,再交给宿主迁移到 v3;原始 v0 日志不会被修改,并写入 `stratagate-legacy-citations-v1.json` 记录源/目标哈希和恢复说明。
173
175
 
174
176
  该包申请本地文件系统读写权限和 Harness 工具注册权限,不申请直接网络访问、子进程、Shell、Python 或凭证访问权限。模型调用仍通过 DSH 现有的 LLM 服务进行。
175
177
 
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "stratagate-dsh",
3
- "version": "0.2.60",
3
+ "version": "0.2.63",
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",
7
- "types": "./dist/index.d.ts",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "stratagate-dsh-repair": "./dist/repair-profile.js"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "types": "./dist/index.d.ts",
@@ -36,8 +39,8 @@
36
39
  "patch": "./cordis.patch.yml"
37
40
  },
38
41
  "client": {
39
- "inject": [
40
- "@deepseek-ai/dsh-client-ui-conversation"
42
+ "inject": [
43
+ "@deepseek-ai/dsh-client-ui-conversation"
41
44
  ],
42
45
  "platform": "web"
43
46
  }
@@ -55,7 +58,7 @@
55
58
  "test:dsh": "vitest run --config vitest.config.ts",
56
59
  "test:core": "npm run test --workspace @diqier/stratagate",
57
60
  "test:workbuddy": "npm run test --workspace stratagate-workbuddy",
58
- "verify:dsh": "npm run build:dsh && node scripts/verify-package.mjs",
61
+ "verify:dsh": "npm run build:dsh && node scripts/verify-package.mjs && npm pack --ignore-scripts --pack-destination . && node scripts/verify-dsh-install.mjs stratagate-dsh-0.2.63.tgz",
59
62
  "verify:workbuddy": "npm run verify:package --workspace stratagate-workbuddy",
60
63
  "test:watch": "vitest --config vitest.config.ts",
61
64
  "prepare": "npm run build:dsh"
@@ -110,8 +113,9 @@
110
113
  "dispose": "supported"
111
114
  },
112
115
  "compatibility": {
113
- "dshVersions": [
114
- "0.1.2-rc.1"
116
+ "dshVersions": [
117
+ "0.1.2-rc.1",
118
+ "0.1.5-rc.1"
115
119
  ]
116
120
  },
117
121
  "permissions": [
@@ -143,27 +147,72 @@
143
147
  "engines": {
144
148
  "node": "^22.19.0 || >=24.0.0"
145
149
  },
146
- "peerDependencies": {
147
- "@deepseek-ai/cordis": "^4.0.1",
148
- "@deepseek-ai/dsh-agent-default-model": ">=0.1.2-rc.1 <0.2.0",
149
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.2-rc.1 <0.2.0",
150
- "@deepseek-ai/dsh-llm": ">=0.1.2-rc.1 <0.2.0",
151
- "@deepseek-ai/dsh-session": ">=0.1.2-rc.1 <0.2.0",
152
- "@deepseek-ai/dsh-settings": ">=0.1.2-rc.1 <0.2.0",
153
- "@deepseek-ai/dsh-system-prompt": ">=0.1.2-rc.1 <0.2.0",
154
- "@deepseek-ai/dsh-tools": ">=0.1.2-rc.1 <0.2.0",
155
- "@deepseek-ai/schemastery": "^3.18.1"
150
+ "peerDependencies": {
151
+ "@deepseek-ai/cordis": "4.0.2",
152
+ "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || 0.1.5-rc.2",
153
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1 || 0.1.5-rc.2",
154
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1 || 0.1.5-rc.2",
155
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1 || 0.1.5-rc.2",
156
+ "@deepseek-ai/dsh-session-format": "0.1.5-rc.2",
157
+ "@deepseek-ai/dsh-session-format-catalog": "0.1.5-rc.2",
158
+ "@deepseek-ai/dsh-session-format-v0-to-v1": "0.1.5-rc.2",
159
+ "@deepseek-ai/dsh-settings": "0.1.2-rc.1 || 0.1.5-rc.2",
160
+ "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || 0.1.5-rc.2",
161
+ "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || 0.1.5-rc.2",
162
+ "@deepseek-ai/schemastery": "3.18.2"
156
163
  },
157
- "devDependencies": {
158
- "@deepseek-ai/cordis": "^4.0.1",
159
- "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1",
160
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1",
161
- "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
162
- "@deepseek-ai/dsh-session": "0.1.2-rc.1",
163
- "@deepseek-ai/dsh-settings": "0.1.2-rc.1",
164
- "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1",
165
- "@deepseek-ai/dsh-tools": "0.1.2-rc.1",
166
- "@deepseek-ai/schemastery": "^3.18.1",
164
+ "peerDependenciesMeta": {
165
+ "@deepseek-ai/cordis": {
166
+ "optional": true
167
+ },
168
+ "@deepseek-ai/dsh-agent-default-model": {
169
+ "optional": true
170
+ },
171
+ "@deepseek-ai/dsh-client-ui-conversation": {
172
+ "optional": true
173
+ },
174
+ "@deepseek-ai/dsh-llm": {
175
+ "optional": true
176
+ },
177
+ "@deepseek-ai/dsh-session": {
178
+ "optional": true
179
+ },
180
+ "@deepseek-ai/dsh-session-format": {
181
+ "optional": true
182
+ },
183
+ "@deepseek-ai/dsh-session-format-catalog": {
184
+ "optional": true
185
+ },
186
+ "@deepseek-ai/dsh-session-format-v0-to-v1": {
187
+ "optional": true
188
+ },
189
+ "@deepseek-ai/dsh-settings": {
190
+ "optional": true
191
+ },
192
+ "@deepseek-ai/dsh-system-prompt": {
193
+ "optional": true
194
+ },
195
+ "@deepseek-ai/dsh-tools": {
196
+ "optional": true
197
+ },
198
+ "@deepseek-ai/schemastery": {
199
+ "optional": true
200
+ }
201
+ },
202
+ "devDependencies": {
203
+ "@deepseek-ai/cordis": "4.0.2",
204
+ "@deepseek-ai/dsh": "0.1.5-rc.1",
205
+ "@deepseek-ai/dsh-agent-default-model": "0.1.5-rc.2",
206
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.2",
207
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.2",
208
+ "@deepseek-ai/dsh-session": "0.1.5-rc.2",
209
+ "@deepseek-ai/dsh-session-format": "0.1.5-rc.2",
210
+ "@deepseek-ai/dsh-session-format-catalog": "0.1.5-rc.2",
211
+ "@deepseek-ai/dsh-session-format-v0-to-v1": "0.1.5-rc.2",
212
+ "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
213
+ "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
214
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
215
+ "@deepseek-ai/schemastery": "3.18.2",
167
216
  "@types/node": "^22.0.0",
168
217
  "cytoscape": "^3.34.1",
169
218
  "cytoscape-fcose": "^2.2.0",
@@ -172,10 +221,10 @@
172
221
  "typescript": "^5.7.0",
173
222
  "vitest": "^3.0.0"
174
223
  },
175
- "dependencies": {
176
- "ngraph.graph": "^20.1.2",
177
- "ngraph.leiden": "^0.3.0"
178
- },
224
+ "dependencies": {
225
+ "ngraph.graph": "^20.1.2",
226
+ "ngraph.leiden": "^0.3.0"
227
+ },
179
228
  "directories": {
180
229
  "doc": "docs",
181
230
  "test": "tests"