stratagate-dsh 0.3.29 → 0.3.31
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 +7 -0
- package/LICENSE +21 -21
- package/README.md +9 -22
- package/README.zh-CN.md +9 -22
- package/dist/client.d.ts +1 -1
- package/dist/client.js +12 -12
- package/dist/index.d.ts +3 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +581 -254
- package/dist/plugin.js.map +1 -1
- package/dist/repair-profile.js.map +1 -1
- package/docs/ARCHITECTURE.md +7 -5
- package/docs/DSH.md +9 -8
- package/docs/DSH.zh-CN.md +7 -7
- package/docs/surface-maintenance.md +34 -0
- package/docs/validation/issue119.md +41 -41
- package/package.json +1 -1
- package/docs/validation/frontend-feedback-20261021/background-refresh-failed.png +0 -0
- package/docs/validation/frontend-feedback-20261021/browser-results.json +0 -334
- package/docs/validation/frontend-feedback-20261021/first-read-graph.png +0 -0
- package/docs/validation/frontend-feedback-20261021/first-read-profile.png +0 -0
- package/docs/validation/frontend-feedback-20261021/first-read-short.png +0 -0
- package/docs/validation/frontend-feedback-20261021/profile-conflict.png +0 -0
- package/docs/validation/frontend-feedback-20261021/profile-save-regression.json +0 -466
- package/docs/validation/frontend-feedback-20261021/report.json +0 -99
- package/docs/validation/frontend-feedback-20261021/settings-saved-read-failed.png +0 -0
- package/docs/validation/frontend-feedback-20261021/settings-unknown.png +0 -0
- package/docs/validation/frontend-feedback-20261021/unit-results.json +0 -1
|
@@ -1 +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-native-command',\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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/repair-profile.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\r\nimport { randomUUID } from 'node:crypto'\r\nimport { basename, dirname, join } from 'node:path'\r\nimport { fileURLToPath } from 'node:url'\r\n\r\nconst PROFILE_PACKAGES = [\r\n '@deepseek-ai/cordis',\r\n '@deepseek-ai/cosmokit',\r\n '@deepseek-ai/dsh-agent',\r\n '@deepseek-ai/dsh-agent-default-model',\r\n '@deepseek-ai/dsh-brand',\r\n '@deepseek-ai/dsh-client-ui-conversation',\r\n '@deepseek-ai/dsh-code-runtime',\r\n '@deepseek-ai/dsh-invariants',\r\n '@deepseek-ai/dsh-llm',\r\n '@deepseek-ai/dsh-native-command',\r\n '@deepseek-ai/dsh-scope',\r\n '@deepseek-ai/dsh-session',\r\n '@deepseek-ai/dsh-session-format',\r\n '@deepseek-ai/dsh-session-format-catalog',\r\n '@deepseek-ai/dsh-session-format-v0-to-v1',\r\n '@deepseek-ai/dsh-session-projection',\r\n '@deepseek-ai/dsh-settings',\r\n '@deepseek-ai/dsh-system-prompt',\r\n '@deepseek-ai/dsh-timeout',\r\n '@deepseek-ai/dsh-tools',\r\n '@deepseek-ai/dsh-typert-protocol',\r\n '@deepseek-ai/dsh-user-approval',\r\n '@deepseek-ai/dsh-util-crypto',\r\n '@deepseek-ai/dsh-util-values',\r\n '@deepseek-ai/schemastery',\r\n] as const\r\n\r\nfunction profileDirectory(start: string): string {\r\n let directory = start\r\n for (;;) {\r\n const manifestPath = join(directory, 'package.json')\r\n if (existsSync(manifestPath)) {\r\n try {\r\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { dsh?: { profile?: unknown } }\r\n if (manifest.dsh?.profile && typeof manifest.dsh.profile === 'object') return directory\r\n } catch {}\r\n }\r\n const parent = dirname(directory)\r\n if (parent === directory) {\r\n throw new Error('stratagate-dsh-repair must run inside an installed DSH profile')\r\n }\r\n directory = parent\r\n }\r\n}\r\n\r\nfunction main(): void {\r\n const profile = profileDirectory(dirname(fileURLToPath(import.meta.url)))\r\n const modules = join(profile, 'node_modules')\r\n const candidates = PROFILE_PACKAGES\r\n .map((name) => ({ name, source: join(modules, ...name.split('/')) }))\r\n .filter(({ source }) => {\r\n try {\r\n lstatSync(source)\r\n return true\r\n } catch (error) {\r\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false\r\n throw error\r\n }\r\n })\r\n if (candidates.length === 0) {\r\n process.stdout.write('StrataGate profile runtime is already isolated; no DSH peer residue found.\\n')\r\n return\r\n }\r\n\r\n const backup = join(profile, '.stratagate-runtime-backups', `${Date.now()}-${process.pid}-${randomUUID()}`)\r\n const moved: Array<{ name: string; source: string; target: string }> = []\r\n try {\r\n for (const candidate of candidates) {\r\n const target = join(backup, 'node_modules', ...candidate.name.split('/'))\r\n mkdirSync(dirname(target), { recursive: true })\r\n renameSync(candidate.source, target)\r\n moved.push({ ...candidate, target })\r\n }\r\n const receipt = {\r\n schema: 'stratagate-dsh-profile-runtime-repair/v1',\r\n profile,\r\n createdAt: new Date().toISOString(),\r\n packages: moved.map(({ name, source, target }) => ({ name, source, target })),\r\n recovery: `While DSH is stopped, move the listed targets back to their source paths if this repair must be reversed.`,\r\n }\r\n writeFileSync(join(backup, 'receipt.json'), `${JSON.stringify(receipt, null, 2)}\\n`, { flag: 'wx', mode: 0o600 })\r\n } catch (error) {\r\n for (const item of moved.reverse()) {\r\n if (existsSync(item.target) && !existsSync(item.source)) renameSync(item.target, item.source)\r\n }\r\n throw error\r\n }\r\n process.stdout.write(`Quarantined ${moved.length} stale DSH profile package(s) to ${backup}\\n`)\r\n}\r\n\r\ntry {\r\n main()\r\n} catch (error) {\r\n process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\\n`)\r\n process.exitCode = 1\r\n}\r\n"],"mappings":"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","names":[]}
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -6,7 +6,7 @@ StrataGate separates source preservation, derived memory, retrieval control, and
|
|
|
6
6
|
|
|
7
7
|
Knowledge Graph processing is optional and defaults off for new and upgraded databases. DSH persists the installation policy in its existing settings table; Core persists namespace defaults using additive columns without deleting graph data. A durable epoch fences claims, provider retries, lease renewals and late commits. Event ingestion can still commit when Graph is disabled during extraction, but cannot enqueue new Graph work. Ordinary retrieval, topics, Profile and Dreaming remain independent.
|
|
8
8
|
|
|
9
|
-
Historical Graph processing requires a preview and explicit confirmation of a finite Event ID list. Existing bounded batches, leases and retry budgets remain in effect; pause/resume does not reset spent attempts. Read-only admin browsing does not migrate the database.
|
|
9
|
+
Historical Graph processing requires a preview and explicit confirmation of a finite Event ID list. Existing bounded batches, leases and retry budgets remain in effect; pause/resume does not reset spent attempts. Read-only admin browsing does not migrate the database. The additive Graph policy alone does not protect against older binaries ignoring the switch; the schema-14 Block coordinate upgrade additionally prevents pre-14 binaries from opening an upgraded database. See [Graph policy details](knowledge-graph.md).
|
|
10
10
|
|
|
11
11
|
```mermaid
|
|
12
12
|
flowchart TB
|
|
@@ -55,22 +55,24 @@ Hosts may attach a `threadId` to each turn. Open tails, Block boundaries, neighb
|
|
|
55
55
|
When the boundary is reached:
|
|
56
56
|
|
|
57
57
|
1. One atomic sealing transaction moves the source messages into permanent L5 and writes deterministic L4 and L3.
|
|
58
|
-
2. The sealed Block is marked model-pending. It
|
|
58
|
+
2. The sealed Block is marked model-pending. It reserves its position in the per-thread sealed timeline, but cannot be injected or replace native conversation history until ready.
|
|
59
59
|
3. A background summarizer produces and validates L0-L2 plus a conservative `shouldExtract` decision.
|
|
60
60
|
4. Event extraction completes with either validated Events or an explicit valid empty result.
|
|
61
|
-
5. Only then is the Block marked ready
|
|
61
|
+
5. Only then is the Block marked ready and may replace native history. Its L5 anchor remains at its original sealed position, so its target layer already reflects any newer sealed Blocks. Completing derivation never advances the timeline or resets an anchor.
|
|
62
62
|
|
|
63
63
|
The block weight is:
|
|
64
64
|
|
|
65
65
|
```text
|
|
66
66
|
w(age) = exp(-lambda_block * age)
|
|
67
67
|
|
|
68
|
-
age = latest
|
|
68
|
+
age = max(0, latest sealed Block position - pointer anchor Block position)
|
|
69
69
|
lambda_block = 0.30 by default
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Open-tail turns do not change Block age. The weight selects how many levels to drop from the pointer anchor. Expanding a block to L3 anchors the pointer at L3 and at the latest sealed Block position; it does not silently jump to L5. Hosts may configure `lambda_block`; smaller values decay more slowly, and values above `0.4` are not recommended.
|
|
73
73
|
|
|
74
|
+
Schema 14 unifies the core and panel on this sealed timeline, including pending Blocks. At upgrade, legacy ready anchors are shifted by the thread's current pending count. This preserves their pre-upgrade elapsed decay exactly; historical pending membership cannot be reconstructed from the old numeric anchors. Pending anchors already use sealed positions and stay unchanged. Snapshot and SQLite migrations apply the same conversion once; no summaries, raw messages, explicit lift metadata, or injected surface levels are regenerated or reset.
|
|
75
|
+
|
|
74
76
|
## Deterministic L3 policy
|
|
75
77
|
|
|
76
78
|
L3 may remove only:
|
|
@@ -268,7 +270,7 @@ External model calls are never made inside a database transaction:
|
|
|
268
270
|
The adapter preserves these invariants:
|
|
269
271
|
|
|
270
272
|
- blocks and L5 messages are append-only, including when every derived task fails;
|
|
271
|
-
- model-pending Blocks are excluded from
|
|
273
|
+
- model-pending Blocks reserve sealed positions but are excluded from context injection and native-history replacement;
|
|
272
274
|
- card provenance references an existing source block and message set;
|
|
273
275
|
- search hits do not increment adoption state;
|
|
274
276
|
- supersession retains the old event;
|
package/docs/DSH.md
CHANGED
|
@@ -18,6 +18,10 @@ The plugin adapts DSH session events to the existing StrataGate memory engine; i
|
|
|
18
18
|
|
|
19
19
|
## How it is designed
|
|
20
20
|
|
|
21
|
+
### Sidebar entry
|
|
22
|
+
|
|
23
|
+
Use **Settings → StrataGate → More → Interface & display → Show StrataGate in the sidebar** to show or hide the entry. New installations hide the entry by default and offer to add it from settings. Previously saved on/off choices are preserved across upgrades and restarts. Hiding it leaves memory, retrieval and background processing running; settings remain accessible. When the entry is hidden, a reminder appears below the settings header. Dismissing it with “×” suppresses it in that browser until browser data is cleared. No reminder appears while the entry is enabled.
|
|
24
|
+
|
|
21
25
|
### Optional Knowledge Graph, off by default
|
|
22
26
|
|
|
23
27
|
New installations hide the Graph page until enabled in **More → Advanced settings → Memory configuration**. Existing installations upgrade with Graph processing off, retained data and a disabled Graph view; a one-time settings notice explains the additional model and token cost. Enabling or resuming previews pending work and requires confirmation for a finite historical list, processed in batches with pause/resume and existing retry limits. Events, directory, ordinary retrieval, Profile and Dreaming continue independently. Older versions do not recognize this switch and may restart Graph processing after a downgrade. See [policy and compatibility details](knowledge-graph.md).
|
|
@@ -96,7 +100,8 @@ Removing the plugin does not delete that database.
|
|
|
96
100
|
- Subagent turns are not ingested by default; subagents in the same project can still read project memory.
|
|
97
101
|
- Each DSH turn has a durable ingestion receipt, so replay or retry cannot store it twice.
|
|
98
102
|
- StrataGate performs Block summarization, Event extraction, versioned Knowledge Graph projection, search, Evidence Gate, and use-only reinforcement.
|
|
99
|
-
- 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.
|
|
103
|
+
- 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. Automatic decay or λ changes update ready checkpoints only when the new layer is no larger; an explicit user request from the panel replaces the current checkpoint with the requested layer, subject to the context capacity limit. The decay target and the layer actually present in the native checkpoint are tracked separately, so a failed L4 check leaves L5 injected and a later valid L2 check can jump directly from L5 to L2. The Block API's `currentLevel` reports the injected layer and `targetLevel` reports the pending decay target. Unsealed open-tail messages and complete tool-call/result chains remain native DSH messages.
|
|
104
|
+
- User expansion and sealing retries have distinct synchronization requests: an existing lower-layer checkpoint does not block expansion, and expansion does not require a smaller replacement. Requests remain pending while the target session is unloaded, compacting, capacity-limited, or unable to save. An expansion request is removed only after its target surface is applied and the session is saved; background sealing cannot overwrite it.
|
|
100
105
|
- Before every main-model call, a separate Persistent Profile context injects its nonempty global fields without retrieval. The dynamic memory context injects 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.
|
|
101
106
|
|
|
102
107
|
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.
|
|
@@ -152,8 +157,9 @@ memory_record_use memory_remember
|
|
|
152
157
|
memory_profile_update
|
|
153
158
|
```
|
|
154
159
|
|
|
155
|
-
`memory_get_blocks` returns a paginated directory: each row contains
|
|
156
|
-
`title`, `turnRange`,
|
|
160
|
+
`memory_get_blocks` returns a paginated directory: each row contains `id`,
|
|
161
|
+
`title`, `turnRange`, the injected `level`, and `targetLevel` when the decay target differs.
|
|
162
|
+
Read source content with `memory_expand_block`.
|
|
157
163
|
It accepts `offset` and `limit` (default 12, bounded to 1–20), and returns `total`,
|
|
158
164
|
`offset`, `limit`, and `nextOffset` (`null` at the end). `blockCount` counts all matching
|
|
159
165
|
ready blocks before pagination. An offset past the end returns an empty page without
|
|
@@ -323,8 +329,3 @@ npm run verify:dsh
|
|
|
323
329
|
```
|
|
324
330
|
|
|
325
331
|
`verify:dsh` inspects the tarball allowlist, rejects leaked source/runtime/secret files, installs the exact tarball in a clean temporary project, and imports the installed plugin.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
### Block checkpoint layer tracking
|
|
329
|
-
|
|
330
|
-
`pointerCurrentLevel` is the decay target; `surfaceCurrentLevel` is the actual native-history layer, or null until verified from the session. The UI uses the actual layer and shows 待核对 for an unknown or host-compacted surface. Only the scheduled target is considered: a complete checkpoint (including its recovery hint) replaces the current surface when its estimated size is <=100% of that surface and within the host checkpoint budget. Rejected targets keep the current content; they never trigger a scan of lower layers. A later target can therefore replace L5 directly with L2. Original L5 evidence remains available through `memory_expand_block`. Repeated synchronization recognizes both released header formats and does not ratchet the layer downward.
|
package/docs/DSH.zh-CN.md
CHANGED
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
## 它是怎么设计的
|
|
20
20
|
|
|
21
|
+
### 侧栏入口
|
|
22
|
+
|
|
23
|
+
在 **设置 → StrataGate → 更多 → 界面与显示** 中,用“在左侧栏显示 StrataGate”开关显示或隐藏侧栏入口。新安装默认隐藏,在设置页提示添加;已有用户保存的开启或关闭选择会保留,重启后仍生效。隐藏入口不影响记忆、检索和后台处理,仍可从设置打开。入口隐藏时,设置页标题下会显示添加提醒;点击“×”后,当前浏览器不再提醒(清除浏览器数据后会重置)。入口已开启时不显示提醒。
|
|
24
|
+
|
|
21
25
|
### 知识图谱可选,默认关闭
|
|
22
26
|
|
|
23
27
|
新用户默认隐藏图谱页;存量用户升级后关闭处理、保留全部数据和灰色入口,首次进入记忆设置显示一次说明。在 **更多 → 高级设置 → 记忆配置** 开启时先统计待处理数量,确认后按有限清单分批恢复,可暂停和继续。事件卡、目录、普通检索、Profile 和 Dreaming 独立工作。旧版本不认识此开关,降级运行可能重新启用图谱处理。详见 [开关、迁移和兼容边界](knowledge-graph.md)。
|
|
@@ -96,7 +100,8 @@ DSH_HOME/stratagate/memory.db
|
|
|
96
100
|
- 默认不保存子 Agent 的对话轮次;同一项目中的子 Agent 仍然可以读取项目记忆。
|
|
97
101
|
- 每个 DSH 对话轮次都有持久化的写入回执,因此重放或重试不会导致重复保存。
|
|
98
102
|
- StrataGate 会执行 Block 摘要、Event 提取、版本化 Knowledge Graph 投影、搜索、Evidence Gate(证据门控)以及仅在使用后触发的强化。
|
|
99
|
-
- Block 到达边界时,StrataGate 先持久化真实的 L3–L5,不修改 DSH surface。只有 L0–L2 校验通过且 Event 处理完成、Block 进入可衰减状态后,插件才使用原生 surface `replace`;待处理或失败的 Block
|
|
103
|
+
- Block 到达边界时,StrataGate 先持久化真实的 L3–L5,不修改 DSH surface。只有 L0–L2 校验通过且 Event 处理完成、Block 进入可衰减状态后,插件才使用原生 surface `replace`;待处理或失败的 Block 始终保留原始会话消息。自动衰减或 λ 调整只在新层级不扩大的情况下更新已就绪 checkpoint;用户在面板明确要求展开时,会直接把当前会话里的 checkpoint 替换为所选层级(受上下文容量限制)。衰减目标层与原生 checkpoint 实际注入层分开记录:因此 L4 检查失败时仍注入 L5,之后 L2 检查通过时可以直接从 L5 跳到 L2。Block API 的 `currentLevel` 表示实际注入层,`targetLevel` 表示待处理的衰减目标。尚未封存的 open tail 与完整工具调用/结果链继续作为 DSH 原生消息保留。
|
|
104
|
+
- 手动展开与压缩补建使用不同的同步待办:已有低层 checkpoint 不会阻止展开,展开也不要求新内容更小。目标会话未加载、会话整理中、容量不足或会话保存失败时,不会静默撤销待办;只有目标会话完成替换并保存后才移除展开待办。后台补建不会覆盖待处理的展开请求。
|
|
100
105
|
- 每次主模型调用前,独立的常驻画像上下文无需检索就注入非空的全局字段。动态记忆上下文另注入最多 4 条项目级激活 Event 和 4 个 active Graph Node,不会把当前对话、open tail、已封 Block 或工具调用序列化进该上下文。
|
|
101
106
|
|
|
102
107
|
激活查询由当前人类消息和当前会话 open tail 的最近两个 turn 组成。现有 BM25 搜索继续作为词面相关性门槛,只有 pinned 和 safety 记忆可以例外进入候选;现有记忆权重提供第二路排序,再由 RRF 融合相关性与权重排序。激活区固定使用约 900 tokens 的预算,不会随数据库增大而增长。
|
|
@@ -132,7 +137,7 @@ memory_record_use memory_remember
|
|
|
132
137
|
memory_profile_update
|
|
133
138
|
```
|
|
134
139
|
|
|
135
|
-
`memory_get_blocks`
|
|
140
|
+
`memory_get_blocks` 返回分页目录,每项含 `id`、`title`、`turnRange`、实际注入的 `level`,以及目标层不同时的 `targetLevel`;
|
|
136
141
|
正文通过 `memory_expand_block` 获取。支持 `offset/limit`,默认每页 12 项,限制在 1–20 项,
|
|
137
142
|
返回 `total/offset/limit/nextOffset`,末页的 `nextOffset` 为 `null`。
|
|
138
143
|
`blockCount` 表示分页前匹配的就绪块总数;offset 超出末页时返回空页,不误报范围内没有块。
|
|
@@ -284,8 +289,3 @@ npm run verify:dsh
|
|
|
284
289
|
```
|
|
285
290
|
|
|
286
291
|
`verify:dsh` 会检查 tarball 文件白名单,拒绝包含泄漏的源码、运行时文件或敏感文件;随后在全新的临时项目中安装该精确 tarball,并导入已安装的插件。
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
### Block 实际注入层
|
|
290
|
-
|
|
291
|
-
`pointerCurrentLevel` 表示衰减目标,`surfaceCurrentLevel` 表示已核实的实际层级;未核实或内容已由宿主压缩接管时为 null,前端显示“待核对”。已加载会话以实时 surface 为准,只读查询不改写衰减或强化状态。每次只检查当前目标层:完整 checkpoint(包括恢复工具提示)估算体积不大于当前内容,且未超宿主容量上限时才替换。检查失败保留当前内容,不扫描更低层;目标后来到达 L2 时,可以直接从 L5 替换为 L2。旧版两种 checkpoint 头部都能识别,重复同步不会继续下移。原始 L5 证据始终可以通过 `memory_expand_block` 按需读取。
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 长会话表面对账
|
|
2
|
+
|
|
3
|
+
记忆组装默认读取现有 checkpoint。自动衰减对账改在回合结束后做;用户明确提层和当前请求需要的容量修复仍及时执行。
|
|
4
|
+
|
|
5
|
+
## 写入规则
|
|
6
|
+
|
|
7
|
+
- 一轮对账收集每个 Block 的最终层级,再调用一次 `setBlockSurfaceLevels()`。
|
|
8
|
+
- 相同层级不写库,不生成快照,也不更新 revision。检查在写队列内完成,避免并发的相同请求重复提交。
|
|
9
|
+
- 单条 `setBlockSurfaceLevel()` 保留,内部使用批量接口。
|
|
10
|
+
- 数据库层级更新具有事务性。原生会话日志与记忆库分别保存;中途失败时,按实际 checkpoint 重算和重试,不能视作跨库事务。
|
|
11
|
+
|
|
12
|
+
## 后台什么时候跑
|
|
13
|
+
|
|
14
|
+
封块、派生完成、衰减设置变化、宿主压缩或容量变化后,给会话标记待处理。同一会话的任务会合并。
|
|
15
|
+
|
|
16
|
+
新回合开始时暂停未执行的维护。组装正在等待检索时也不启动维护。任务等相关入库完成后,基于最新状态计算并连续应用 checkpoint,再统一记账。计算和应用之间没有异步等待,避免旧文本在后来的用户提层之后生效。
|
|
17
|
+
|
|
18
|
+
`flush()` 只等待入库,不等待自动表面维护。失败后保留待处理状态并退避重试;关闭时取消定时器,等待已开始的任务结束。重启后会检查现有 checkpoint,也会尝试补回保存 Block 后丢失的封块请求;宿主已压缩掉的原始范围不会被重新插入。
|
|
19
|
+
|
|
20
|
+
自动恢复只处理原片段仍在当前上下文中的 Block。宿主压缩后失效的自动任务会移出队列,后续对账不再为这些历史 Block 渲染内容;每轮共用一次来源筛查。用户明确选择仍保留同步失败原因,保存失败且来源仍在的任务继续重试。
|
|
21
|
+
|
|
22
|
+
## 怎么验证
|
|
23
|
+
|
|
24
|
+
相关测试:`packages/core/tests/surface-levels.test.ts`、`tests/surface-maintenance.test.ts`、`tests/issue81-surface.test.ts`。
|
|
25
|
+
|
|
26
|
+
用符合项目要求的 Node 版本执行:
|
|
27
|
+
|
|
28
|
+
```powershell
|
|
29
|
+
node scripts/benchmark-surface-assembly.mjs --base=<修复前的提交> --rounds=12
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
脚本只使用临时目录里的构造数据和 SQLite,不打开用户数据库。基线 runtime/store 从指定 Git 提交读取,其余依赖共用当前版本。结果、逐轮样本、源码哈希及两个版本的构建文件保存在 `.benchmarks/surface-*/`。
|
|
33
|
+
|
|
34
|
+
测试区分首次需要衰减的组装、维护后的稳定组装、后台对账,以及重复调用同值 setter。没有接入真实向量服务,因此耗时不能代替真实长会话的端到端测量。事件循环延迟使用 1ms 分辨率的 `monitorEventLoopDelay`,包括调度延迟。
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
# Issue #119 修复与验证
|
|
2
|
-
|
|
3
|
-
基线:`e954eaf2f2cbbef4bb6226a2ebb35191424868c2`(main,stratagate-dsh 0.3.6)。
|
|
4
|
-
|
|
5
|
-
## 根因与修改
|
|
6
|
-
|
|
7
|
-
- 日志中的 656、778 字符概要均正常结束于 `tool-calls`,被 600 字符业务上限拒绝,不能归因于 token 截断。现在使用 `TOPIC_OVERVIEW_MAX_CHARACTERS = 1000`,按 Unicode code point 计数,保留原文,不截断。
|
|
8
|
-
- DSH `StringValueSchemaSpec` 只支持类型、枚举、常量和注解,不支持 `maxLength`。工具字段说明与提示词引用同一常量,解析器和存储提交门调用同一校验函数。
|
|
9
|
-
- 旧 `TopicOverviewRepairGuard` 把未保存的违规草稿计数和来源持久化成补写义务,还从历史字段错误推导“至少一段”的要求。删除这套草稿守卫、错误携带和跨批分配逻辑,保留语义去重。旧 `overviewRepairRequirements` 字段仅供快照兼容与识别恢复对象,不发送给模型、不约束提交,重排、失败或成功时清理。
|
|
10
|
-
- 有效旧概要仍由原有存储逻辑继承;章节成员与小节归属、来源权限、批次覆盖、源版本、租约、陈旧响应和原子提交检查继续生效。原有合法重分类、来源失效和遗忘语义不变,旧小节消失时仍按现有规则移除孤立概要。
|
|
11
|
-
- 提示词先要求完整事件归类;新增概要通常 0~2 段,无必要时允许空数组,建议 300~600 字符,不为凑长度省略事实,不复述已有内容。
|
|
12
|
-
- 沿用 `recoveryVersion`,升级为 2。仅恢复仍有效、有未完成工作且命中概要字段、旧草稿要求、Provider 失败或原始 `invalid-output` 签名的终态任务。无关内容校验、超时和 worker 失败不获得新周期。已完成来源、失效来源、已有排队工作、重启和并发写入沿用原有排除与持久化机制;单周期仍最多三次任务尝试,没有新增恢复状态机。
|
|
13
|
-
|
|
14
|
-
## Provider 预算与剩余证据
|
|
15
|
-
|
|
16
|
-
DSH `LlmResolvedModelInfo` 公开 `context.contextWindow` 和 `defaultMaxTokens`;后者仅是未显式指定输出预算时使用的普通默认值,不证明模型能力,也不限制 Topic 的独立请求。Topic 保留 32,768 上限,仅按实际 provider/model 路由已知的上下文剩余空间收缩。当前元数据没有可用的已验证模型输出硬上限,不据默认值猜测 Provider 限制。提示中的预算与每次实际请求保持一致,包括内容重试和 reasoning-off 回退。审查后的实现删除了普通默认值限流和对应缓存。
|
|
17
|
-
|
|
18
|
-
无法容纳输入的模型配置报告 `provider-failed`,不归类成内容校验错误。输出实际截断继续用 `max-tokens` 和现有有界拆批;Provider 异常继续走现有任务退避,无新增专属补丁或重试次数。普通默认值为 512、1024 的路由测试使用 12 张 Event 和两段 1000 字符概要,完整响应的估算 token 超过这些默认值,断言实际请求仍使用独立预算并只调用一次;这是模拟流的请求策略验证,不是低实际预算下的真实生成能力测试。人工重试路径同时保留携带敏感响应的普通 `worker-failed` 脱敏测试。
|
|
19
|
-
|
|
20
|
-
Issue 中那次 `finishReason=error` 的根因尚未确认。32,768 可能超过部分模型的输出能力,但也可能是限流、路由或其他请求错误。确认仍需要实际 Provider/model 标识、路由配置的 defaultMaxTokens 与 contextWindow、Provider 错误码/HTTP 状态/请求编号,以及 token usage(含 reasoning)和对应失败请求日志。不得凭当前安全摘要断言是哪一项。
|
|
21
|
-
|
|
22
|
-
## 固定模拟响应对比
|
|
23
|
-
|
|
24
|
-
在固定 main 与首轮修复提交 `6edcb34445e58e9df1ede0189e118672f90fcb42` 上运行同一临时重放测试,使用 `tests/llm.test.ts` 的 `modelBridge`、`context`、`proposal` 辅助函数;只把新概要 text 替换成 `𠮷.repeat(length)`。第一次与第二次流均正常结束于 `tool-calls`;656、778、1000 的第二次响应重复原响应;1001 的第二次响应返回空概要且保留全部章节/小节归类。其余输入与输出一致。保留这次原始测量;审查修复不改变这些未配置路由默认值的概要校验场景,新的定向测试继续覆盖其行为。
|
|
25
|
-
|
|
26
|
-
| 首次字符数 | 修复前结果 / 调用数 | 修复后结果 / 调用数 |
|
|
27
|
-
| --- | --- | --- |
|
|
28
|
-
| 656 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
29
|
-
| 778 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
30
|
-
| 1000 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
31
|
-
| 1001 → 空概要 | 草稿守卫拒绝 / 2 | 合法重试通过 / 2 |
|
|
32
|
-
|
|
33
|
-
这组样例首次通过率 0/4 → 3/4,总调用数 8 → 5,最终完成 0/4 → 4/4。1001 字符始终拒绝,成功来自第二次合法结果。原始输出保存在 [修复前](issue119-before.json) 与 [修复后](issue119-after.json)。这是模拟流经过真实实现的测量,不是线上成功率、真实模型遵从度或提示词效果的测量;未调用真实 Provider,未读取用户数据库。
|
|
34
|
-
|
|
35
|
-
## 回归范围
|
|
36
|
-
|
|
37
|
-
定向测试覆盖 656、778、1000 / 1001 与补充平面 Unicode 字符,字段级诊断、Schema 与提示词、草稿舍弃、完整 Event 分类、旧概要和来源继承、伪造来源和遗漏 Event 拒绝、SQLite 重启、旧恢复要求、部分完成与重叠任务、重复提交、并发初始化、失败后有界拆批,以及 Provider 预算配置与分类。
|
|
38
|
-
|
|
39
|
-
首轮修复提交在 Node 24.19.0 下:`npm run check` 全部通过;`npm test` 的 core 286、DSH 580、WorkBuddy 10 项通过,共 876 项通过、1 项既有跳过;`npm run build` 的 core、DSH 和 WorkBuddy 全部通过。隔离安装最初跳过安装脚本,导致旧数据库迁移测试缺少 better-sqlite3 绑定;用相同 Node 24 执行 `npm rebuild better-sqlite3` 后,完整测试通过。未修改依赖或锁文件。
|
|
40
|
-
|
|
41
|
-
审查修复后的本地验证:`tests/llm.test.ts` 与 `tests/memory-topics.test.ts` 共 194 项通过,`packages/core/tests/topic-recovery.test.ts` 25 项通过,共 219 项定向测试通过;`npm run check` 和 `npm run build` 全部通过。已自查实际预算反馈、内容重试与 reasoning-off 回退、上下文预检分类、持久化来源/归属/旧概要保护和有界恢复路径。新提交仍需独立复审及其对应的 CI 结果;未执行用户真实 Windows + DSH 数据库的升级验收。
|
|
1
|
+
# Issue #119 修复与验证
|
|
2
|
+
|
|
3
|
+
基线:`e954eaf2f2cbbef4bb6226a2ebb35191424868c2`(main,stratagate-dsh 0.3.6)。
|
|
4
|
+
|
|
5
|
+
## 根因与修改
|
|
6
|
+
|
|
7
|
+
- 日志中的 656、778 字符概要均正常结束于 `tool-calls`,被 600 字符业务上限拒绝,不能归因于 token 截断。现在使用 `TOPIC_OVERVIEW_MAX_CHARACTERS = 1000`,按 Unicode code point 计数,保留原文,不截断。
|
|
8
|
+
- DSH `StringValueSchemaSpec` 只支持类型、枚举、常量和注解,不支持 `maxLength`。工具字段说明与提示词引用同一常量,解析器和存储提交门调用同一校验函数。
|
|
9
|
+
- 旧 `TopicOverviewRepairGuard` 把未保存的违规草稿计数和来源持久化成补写义务,还从历史字段错误推导“至少一段”的要求。删除这套草稿守卫、错误携带和跨批分配逻辑,保留语义去重。旧 `overviewRepairRequirements` 字段仅供快照兼容与识别恢复对象,不发送给模型、不约束提交,重排、失败或成功时清理。
|
|
10
|
+
- 有效旧概要仍由原有存储逻辑继承;章节成员与小节归属、来源权限、批次覆盖、源版本、租约、陈旧响应和原子提交检查继续生效。原有合法重分类、来源失效和遗忘语义不变,旧小节消失时仍按现有规则移除孤立概要。
|
|
11
|
+
- 提示词先要求完整事件归类;新增概要通常 0~2 段,无必要时允许空数组,建议 300~600 字符,不为凑长度省略事实,不复述已有内容。
|
|
12
|
+
- 沿用 `recoveryVersion`,升级为 2。仅恢复仍有效、有未完成工作且命中概要字段、旧草稿要求、Provider 失败或原始 `invalid-output` 签名的终态任务。无关内容校验、超时和 worker 失败不获得新周期。已完成来源、失效来源、已有排队工作、重启和并发写入沿用原有排除与持久化机制;单周期仍最多三次任务尝试,没有新增恢复状态机。
|
|
13
|
+
|
|
14
|
+
## Provider 预算与剩余证据
|
|
15
|
+
|
|
16
|
+
DSH `LlmResolvedModelInfo` 公开 `context.contextWindow` 和 `defaultMaxTokens`;后者仅是未显式指定输出预算时使用的普通默认值,不证明模型能力,也不限制 Topic 的独立请求。Topic 保留 32,768 上限,仅按实际 provider/model 路由已知的上下文剩余空间收缩。当前元数据没有可用的已验证模型输出硬上限,不据默认值猜测 Provider 限制。提示中的预算与每次实际请求保持一致,包括内容重试和 reasoning-off 回退。审查后的实现删除了普通默认值限流和对应缓存。
|
|
17
|
+
|
|
18
|
+
无法容纳输入的模型配置报告 `provider-failed`,不归类成内容校验错误。输出实际截断继续用 `max-tokens` 和现有有界拆批;Provider 异常继续走现有任务退避,无新增专属补丁或重试次数。普通默认值为 512、1024 的路由测试使用 12 张 Event 和两段 1000 字符概要,完整响应的估算 token 超过这些默认值,断言实际请求仍使用独立预算并只调用一次;这是模拟流的请求策略验证,不是低实际预算下的真实生成能力测试。人工重试路径同时保留携带敏感响应的普通 `worker-failed` 脱敏测试。
|
|
19
|
+
|
|
20
|
+
Issue 中那次 `finishReason=error` 的根因尚未确认。32,768 可能超过部分模型的输出能力,但也可能是限流、路由或其他请求错误。确认仍需要实际 Provider/model 标识、路由配置的 defaultMaxTokens 与 contextWindow、Provider 错误码/HTTP 状态/请求编号,以及 token usage(含 reasoning)和对应失败请求日志。不得凭当前安全摘要断言是哪一项。
|
|
21
|
+
|
|
22
|
+
## 固定模拟响应对比
|
|
23
|
+
|
|
24
|
+
在固定 main 与首轮修复提交 `6edcb34445e58e9df1ede0189e118672f90fcb42` 上运行同一临时重放测试,使用 `tests/llm.test.ts` 的 `modelBridge`、`context`、`proposal` 辅助函数;只把新概要 text 替换成 `𠮷.repeat(length)`。第一次与第二次流均正常结束于 `tool-calls`;656、778、1000 的第二次响应重复原响应;1001 的第二次响应返回空概要且保留全部章节/小节归类。其余输入与输出一致。保留这次原始测量;审查修复不改变这些未配置路由默认值的概要校验场景,新的定向测试继续覆盖其行为。
|
|
25
|
+
|
|
26
|
+
| 首次字符数 | 修复前结果 / 调用数 | 修复后结果 / 调用数 |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| 656 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
29
|
+
| 778 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
30
|
+
| 1000 | 长度校验失败 / 2 | 首次通过 / 1 |
|
|
31
|
+
| 1001 → 空概要 | 草稿守卫拒绝 / 2 | 合法重试通过 / 2 |
|
|
32
|
+
|
|
33
|
+
这组样例首次通过率 0/4 → 3/4,总调用数 8 → 5,最终完成 0/4 → 4/4。1001 字符始终拒绝,成功来自第二次合法结果。原始输出保存在 [修复前](issue119-before.json) 与 [修复后](issue119-after.json)。这是模拟流经过真实实现的测量,不是线上成功率、真实模型遵从度或提示词效果的测量;未调用真实 Provider,未读取用户数据库。
|
|
34
|
+
|
|
35
|
+
## 回归范围
|
|
36
|
+
|
|
37
|
+
定向测试覆盖 656、778、1000 / 1001 与补充平面 Unicode 字符,字段级诊断、Schema 与提示词、草稿舍弃、完整 Event 分类、旧概要和来源继承、伪造来源和遗漏 Event 拒绝、SQLite 重启、旧恢复要求、部分完成与重叠任务、重复提交、并发初始化、失败后有界拆批,以及 Provider 预算配置与分类。
|
|
38
|
+
|
|
39
|
+
首轮修复提交在 Node 24.19.0 下:`npm run check` 全部通过;`npm test` 的 core 286、DSH 580、WorkBuddy 10 项通过,共 876 项通过、1 项既有跳过;`npm run build` 的 core、DSH 和 WorkBuddy 全部通过。隔离安装最初跳过安装脚本,导致旧数据库迁移测试缺少 better-sqlite3 绑定;用相同 Node 24 执行 `npm rebuild better-sqlite3` 后,完整测试通过。未修改依赖或锁文件。
|
|
40
|
+
|
|
41
|
+
审查修复后的本地验证:`tests/llm.test.ts` 与 `tests/memory-topics.test.ts` 共 194 项通过,`packages/core/tests/topic-recovery.test.ts` 25 项通过,共 219 项定向测试通过;`npm run check` 和 `npm run build` 全部通过。已自查实际预算反馈、内容重试与 reasoning-off 回退、上下文预检分类、持久化来源/归属/旧概要保护和有界恢复路径。新提交仍需独立复审及其对应的 CI 结果;未执行用户真实 Windows + DSH 数据库的升级验收。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stratagate-dsh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
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",
|
|
Binary file
|