dsh-agent-control-center 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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1 — 2026-11-29
4
+
5
+ Patch release: brings the published artifact in line with the repository (0.3.0
6
+ shipped before the acceptance notes, module design docs and one label polish
7
+ landed).
8
+
9
+ ### Changed
10
+
11
+ - Instruction preview labels read as `Files: {count}` / `Preview sections: {count}`
12
+ / `Sessions loaded: {count}` instead of the longer "共 … 个…" phrasing.
13
+
3
14
  ## 0.3.0 — 2026-11-29
4
15
 
5
16
  Verified against DSH `0.2.2-rc.5` on an isolated profile. This release answers the
package/README.md CHANGED
@@ -14,7 +14,9 @@ safe write path.
14
14
 
15
15
  Targets DSH `>=0.2.1-rc.1 <0.3.0`; developed and verified against **DSH 0.2.2-rc.5**.
16
16
 
17
- ![Agent Control Center overview page](docs/assets/overview.png)
17
+ ![Agent Control Center overview page](docs/assets/overview.png
18
+
19
+ Instruction preview: `docs/assets/instruction.png`.)
18
20
 
19
21
  *The Overview page on a real DSH 0.2.2-rc.5 deployment: environment, 21/21 host
20
22
  capabilities present, module states, and counts that link to their pages.
package/client.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // Generated by scripts/build-client.mjs from src/client/ — do not edit.
2
- // DSH client module: dsh-agent-control-center@0.2.0 (12 i18n fragments, 11 pages)
2
+ // DSH client module: dsh-agent-control-center@0.3.1 (12 i18n fragments, 11 pages)
3
3
  window.__ModuleLoader__.load({
4
4
  id: "dsh-agent-control-center",
5
5
  factory(require) {
6
6
  'use strict'
7
7
  const React = require('react')
8
8
  const h = React.createElement
9
- const ACC_VERSION = "0.2.0"
9
+ const ACC_VERSION = "0.3.1"
10
10
  /* ---- kernel.js ---- */
11
11
  /* ---------------------------------------------------------------------------
12
12
  * ACC kernel — shared runtime attached to every page script.
@@ -1767,7 +1767,7 @@ ACC.addI18n({
1767
1767
  'instruction.chainCwd': '工作目录',
1768
1768
  'instruction.chainProjectRoot': '项目根目录',
1769
1769
  'instruction.chainSource': '目录来源',
1770
- 'instruction.chainFilesCount': '共 {count} 个文件',
1770
+ 'instruction.chainFilesCount': '文件:{count}',
1771
1771
  'instruction.displayPath': '显示路径',
1772
1772
  'instruction.source': '来源',
1773
1773
  'instruction.flags': '标记',
@@ -1795,7 +1795,7 @@ ACC.addI18n({
1795
1795
  'instruction.copyFailed': '复制失败',
1796
1796
  'instruction.copyPreview': '复制预览文本',
1797
1797
  'instruction.previewBytes': '字节数 {bytes}',
1798
- 'instruction.previewSections': '共 {count} 个文件段',
1798
+ 'instruction.previewSections': '文件段:{count}',
1799
1799
  'instruction.previewOmitted': '预算省略了 {count} 个文件',
1800
1800
  'instruction.previewTruncated': '预算截断了 {count} 个文件',
1801
1801
  'instruction.previewResponseTruncated': '响应超过上限,预览文本已截断;完整文本请以会话精确视图为准。',
@@ -1807,7 +1807,7 @@ ACC.addI18n({
1807
1807
  'instruction.sessionPickHint': '选择一条会话后读取其持久化的指令事件;只读,不会续跑或修改会话。',
1808
1808
  'instruction.sessionPick': '选择会话',
1809
1809
  'instruction.sessionPickAria': '选择要查看指令的会话',
1810
- 'instruction.sessionListLoaded': '已加载 {count} 个会话',
1810
+ 'instruction.sessionListLoaded': '已加载会话:{count}',
1811
1811
  'instruction.sessionsFailed': '会话列表加载失败',
1812
1812
  'instruction.sessionListRefresh': '刷新会话列表',
1813
1813
  'instruction.sessionsEmpty': '宿主还没有会话',
@@ -1817,7 +1817,7 @@ ACC.addI18n({
1817
1817
  'instruction.sessionUnavailableTitle': '会话精确视图不可用',
1818
1818
  'instruction.sessionBlocksTitle': '会话中的指令块',
1819
1819
  'instruction.sessionId': '会话 ID',
1820
- 'instruction.sessionInstructionCount': '指令块 {count} 个',
1820
+ 'instruction.sessionInstructionCount': '指令块:{count}',
1821
1821
  'instruction.sessionEmpty': '该会话没有记录指令块',
1822
1822
  'instruction.sessionEmptyHint': '会话日志中没有 agent-instructions 事件;宿主只在首次注入指令时写入。',
1823
1823
  'instruction.sessionReason': '宿主说明',
@@ -1847,7 +1847,7 @@ ACC.addI18n({
1847
1847
  'instruction.differentText': '文本不一致',
1848
1848
  'instruction.exactFilesYes': '文件侧精确',
1849
1849
  'instruction.exactFilesNo': '文件侧近似',
1850
- 'instruction.sessionItemsValue': '会话侧指令块 {count} 个',
1850
+ 'instruction.sessionItemsValue': '会话侧指令块:{count}',
1851
1851
  'instruction.compareWhy': '两侧文本不同:文件侧是按预算重组的近似文本(可能省略、截断或去重),会话侧是宿主当时实际注入的精确文本;字节差异由此而来。',
1852
1852
  'instruction.compareNote': '对比说明',
1853
1853
  },
@@ -1881,7 +1881,7 @@ ACC.addI18n({
1881
1881
  'instruction.chainCwd': 'Working directory',
1882
1882
  'instruction.chainProjectRoot': 'Project root',
1883
1883
  'instruction.chainSource': 'Directory source',
1884
- 'instruction.chainFilesCount': '{count} files',
1884
+ 'instruction.chainFilesCount': 'Files: {count}',
1885
1885
  'instruction.displayPath': 'Display path',
1886
1886
  'instruction.source': 'Source',
1887
1887
  'instruction.flags': 'Flags',
@@ -1909,7 +1909,7 @@ ACC.addI18n({
1909
1909
  'instruction.copyFailed': 'Copy failed',
1910
1910
  'instruction.copyPreview': 'Copy preview text',
1911
1911
  'instruction.previewBytes': 'Size {bytes}',
1912
- 'instruction.previewSections': '{count} file sections',
1912
+ 'instruction.previewSections': 'File sections: {count}',
1913
1913
  'instruction.previewOmitted': '{count} files omitted by budget',
1914
1914
  'instruction.previewTruncated': '{count} files truncated by budget',
1915
1915
  'instruction.previewResponseTruncated': 'The response exceeded its ceiling, so the preview text was clipped; use the exact session view for the full text.',
@@ -1921,7 +1921,7 @@ ACC.addI18n({
1921
1921
  'instruction.sessionPickHint': 'Pick a session to read its durable instruction events; read-only, it never resumes or modifies a session.',
1922
1922
  'instruction.sessionPick': 'Select a session',
1923
1923
  'instruction.sessionPickAria': 'Session whose instructions to inspect',
1924
- 'instruction.sessionListLoaded': '{count} sessions loaded',
1924
+ 'instruction.sessionListLoaded': 'Sessions loaded: {count}',
1925
1925
  'instruction.sessionsFailed': 'Could not load the session list',
1926
1926
  'instruction.sessionListRefresh': 'Refresh the session list',
1927
1927
  'instruction.sessionsEmpty': 'The host has no sessions yet',
@@ -1931,7 +1931,7 @@ ACC.addI18n({
1931
1931
  'instruction.sessionUnavailableTitle': 'Exact session view unavailable',
1932
1932
  'instruction.sessionBlocksTitle': 'Instruction blocks in this session',
1933
1933
  'instruction.sessionId': 'Session ID',
1934
- 'instruction.sessionInstructionCount': '{count} instruction blocks',
1934
+ 'instruction.sessionInstructionCount': 'Instruction blocks: {count}',
1935
1935
  'instruction.sessionEmpty': 'This session recorded no instruction blocks',
1936
1936
  'instruction.sessionEmptyHint': 'The session log has no agent-instructions event; the host writes one only when it first injects instructions.',
1937
1937
  'instruction.sessionReason': 'Host explanation',
@@ -1961,7 +1961,7 @@ ACC.addI18n({
1961
1961
  'instruction.differentText': 'Different text',
1962
1962
  'instruction.exactFilesYes': 'Files side exact',
1963
1963
  'instruction.exactFilesNo': 'Files side approximate',
1964
- 'instruction.sessionItemsValue': '{count} session-side blocks',
1964
+ 'instruction.sessionItemsValue': 'Session-side blocks: {count}',
1965
1965
  'instruction.compareWhy': 'The two sides differ: the files side is a reconstruction under budget (files may be omitted, truncated, or deduplicated), while the session side is the exact text the host injected; the byte difference follows from that.',
1966
1966
  'instruction.compareNote': 'Comparison note',
1967
1967
  },
@@ -0,0 +1,41 @@
1
+ # 模块 J · 指令预览(Instruction preview)
2
+
3
+ > 只读。本模块从不写入、备份、恢复或修改任何指令文件。
4
+
5
+ ## 为什么需要它
6
+
7
+ `AGENTS.md` 页面告诉你磁盘上有什么;本页告诉你**模型实际收到了什么**。两者常常不同:预算会省略/截断文件,内容去重会只保留一份,`*.local.md` 覆盖层会追加,而会话里保存的是**写入当时的快照**——之后你改了文件,模型看到的就是旧的。
8
+
9
+ ## 三个视图
10
+
11
+ | 视图 | 数据来源 | 性质 | 何时可信 |
12
+ |---|---|---|---|
13
+ | 按文件重组(近似) | 当前 cwd 的指令链 + 宿主预算规则 | `mode:'files'` | `exact:true` 时(两条链都在预算内)与宿主注入字节一致;否则是近似 |
14
+ | 按会话精确 | 真实会话日志里 `user/message` 且 `source.kind==='agent-instructions'` 的记录 | `mode:'session'` | 始终精确——这是宿主**已经写进日志**的原文,含 `seq`/时间/`baseline` 标记 |
15
+ | 对比 | 两者 | `mode:'compare'` | 同 cwd 且两侧都未被截断时,`sameText` 才有判断意义 |
16
+
17
+ ## API
18
+
19
+ - `instruction.chain({cwd?})` → 指令链(来源 user-global / agents-home / project / project-local;每文件字节、hash、是否进入有效链、是否被去重(`dedupedBy` 指向胜出文件)、是否被预算省略/截断)+ 每条链的预算。
20
+ - `instruction.preview({cwd?})` → `{mode:'files', exact, text, bytes, budget, sections, omitted, truncated, note}`。
21
+ - `instruction.session({sessionId, includeChanges?})` → `{mode:'session', exact:true, items:[{seq, at, baseline, bytes, text, truncated}], count}`;`includeChanges:false` 只留最后一条基线。
22
+ - `instruction.compare({cwd?, sessionId})` → `{filesBytes, sessionBytes, deltaBytes, sameText, exactFiles, sessionSeq, sessionAt, explanations[]}`。
23
+ - `instruction.summary()` → 两个视图名、模块 A 是否可用、预算是否缺失。
24
+
25
+ ## 实现依据
26
+
27
+ - 宿主格式:`@deepseek-ai/dsh-agent-instructions/src/render.ts` —— `<system-reminder>` 框架、`Instructions from: <displayPath>` 段落、`Workspace instruction budget N bytes: omitted …; truncated …` 标记、预算内用完整 intro、超预算退回 compact intro。
28
+ - 注入判定:同包 `src/index.ts` —— 基线消息 `source.kind === 'agent-instructions'` 且 `source.baseline === true`;后续变更批次同 kind 但无 baseline。
29
+ - 文本组装与预算判定由模块 A 的 `agents.render` 提供,本模块不重复实现发现/去重逻辑。
30
+
31
+ ## 真机观察(accverify,2026-11-29)
32
+
33
+ - 文件侧:76,621 B,`exact:true`(用户全局 58,423 B + 项目 17,855 B,预算 65,536)。
34
+ - 会话侧:某真实会话取出 29 个指令块,首块 31,472 B 且 `baseline:true`。
35
+ - 对比:同一会话 `files 76,621 B` vs `session 57,138 B` → `deltaBytes -19,483`,`sameText:false`,解释为「基线写入后文件变大」。
36
+
37
+ ## 限制
38
+
39
+ - 只能看到**已落盘**的会话;正在运行的会话若尚未写入指令块,会话视图会给 `available:false` + 原因。
40
+ - 重组视图不复制宿主的 candidate-group 去重与截断二分搜索的全部细节,因此超预算时只能标近似;此时以会话视图为准。
41
+ - 单响应上限 2 MiB;超长指令块会按序截断并标 `truncated`。
@@ -0,0 +1,45 @@
1
+ # 模块 K · 会话导出(Session export)
2
+
3
+ > 只读。不存在删除、归档、续跑或上传路径。
4
+
5
+ ## 行为
6
+
7
+ 把**一个**会话的时间线导出成可带走的文本:
8
+
9
+ - `markdown`:标题 + 元信息(session id、cwd、创建/更新时间)+ 逐条时间线(`## User` / `## Assistant` / `### Tool call: <name>` / `> Result ...`),token 用量放在折叠块里。
10
+ - `json`:`{version:1, session:{…}, events:[…]}`,每条含 `seq/at/type/role/…`。
11
+
12
+ 字节上限:默认 **256 KiB**,硬上限 **1 MiB**(超出范围直接 `bad_request`,不静默截断)。
13
+
14
+ ## 截断语义
15
+
16
+ 事件**逐条追加**,在下一个事件会越界前停止:
17
+
18
+ - `truncated` 标明发生了截断;`omittedEvents` 是省略的事件数;
19
+ - **绝不返回半个事件**——Markdown 不会停在代码围栏中间,JSON 永远可 `parse`;
20
+ - 响应里 `bytes` 是实际输出字节,`totalBytes` 是不截断时的完整大小。
21
+
22
+ ## 安全与隐私
23
+
24
+ - 工具结果只保留 `isError` 与有界预览(默认 600 字符),不输出原始大 payload;
25
+ - 消息内容里的 ``` 会被转义,避免破坏 Markdown 结构;
26
+ - token 只输出**计数**(input/output/cache read/cache write),不输出 prompt 原文中的密钥;共享脱敏函数仍会处理 `sk-…` 一类前缀;
27
+ - 不读取、不修改宿主文件;导出在内存里完成,下载走浏览器 `Blob`。
28
+
29
+ ## API
30
+
31
+ - `export.diagnostics()` → 能力、格式、上限与 `policy`(`readOnly/writesSessionLog/deletesSessions/archivesSessions/externalNetwork`)。
32
+ - `export.sessions({limit, query})` → 可供导出的会话列表(标题、更新时间、事件数、是否归档)。
33
+ - `export.summary({id})` → 计数(events/user/assistant/toolCalls/toolResults/toolErrors/errors)与两种格式的估算字节。
34
+ - `export.session({id, format, maxBytes, includeToolResults})` → 导出正文。
35
+
36
+ ## 真机观察(accverify,2026-11-29)
37
+
38
+ - 一个 19,345 事件的会话:`export.summary` 报 443 用户消息 / 2,470 助手消息 / 2,674 工具调用 / 14 错误;估算 Markdown 3.35 MB、JSON 5.40 MB。
39
+ - 同会话按默认 256 KiB 导出:6.2 s,输出 262,069 B,`truncated:true`,省略 12,623 个事件。
40
+
41
+ ## 限制
42
+
43
+ - 会话很大时导出必然截断,且耗时随事件数增长(上例 6.2 s);没有流式或分页导出。
44
+ - 只导出本插件能读到的会话(`sessionQuery.readSession`);不可读时会 `available:false` + 原因。
45
+ - 宿主侧若有原生导出能力则本模块会标注 `source:'host'` 并复用;当前版本实测宿主未暴露可直接复用的公开导出方法,因此 `source:'plugin'`,渲染由本模块完成。
package/index.js CHANGED
@@ -15,7 +15,7 @@ import { createRegistry } from './lib/core/registry.js'
15
15
 
16
16
  export const name = 'dsh-agent-control-center'
17
17
  /** Plugin version, mirrored in package.json. */
18
- export const VERSION = '0.3.0'
18
+ export const VERSION = '0.3.1'
19
19
  /** Browser transport prefix. The client fetches it document-relative. */
20
20
  export const HTTP_PREFIX = '/__agent-control-center'
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agent-control-center",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "DSH Agent Control Center: AGENTS.md editing with backups, tool inventory, sessions, real token usage, agent metadata, diagnostics and templates in one settings page.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@ ACC.addI18n({
35
35
  'instruction.chainCwd': '工作目录',
36
36
  'instruction.chainProjectRoot': '项目根目录',
37
37
  'instruction.chainSource': '目录来源',
38
- 'instruction.chainFilesCount': '共 {count} 个文件',
38
+ 'instruction.chainFilesCount': '文件:{count}',
39
39
  'instruction.displayPath': '显示路径',
40
40
  'instruction.source': '来源',
41
41
  'instruction.flags': '标记',
@@ -63,7 +63,7 @@ ACC.addI18n({
63
63
  'instruction.copyFailed': '复制失败',
64
64
  'instruction.copyPreview': '复制预览文本',
65
65
  'instruction.previewBytes': '字节数 {bytes}',
66
- 'instruction.previewSections': '共 {count} 个文件段',
66
+ 'instruction.previewSections': '文件段:{count}',
67
67
  'instruction.previewOmitted': '预算省略了 {count} 个文件',
68
68
  'instruction.previewTruncated': '预算截断了 {count} 个文件',
69
69
  'instruction.previewResponseTruncated': '响应超过上限,预览文本已截断;完整文本请以会话精确视图为准。',
@@ -75,7 +75,7 @@ ACC.addI18n({
75
75
  'instruction.sessionPickHint': '选择一条会话后读取其持久化的指令事件;只读,不会续跑或修改会话。',
76
76
  'instruction.sessionPick': '选择会话',
77
77
  'instruction.sessionPickAria': '选择要查看指令的会话',
78
- 'instruction.sessionListLoaded': '已加载 {count} 个会话',
78
+ 'instruction.sessionListLoaded': '已加载会话:{count}',
79
79
  'instruction.sessionsFailed': '会话列表加载失败',
80
80
  'instruction.sessionListRefresh': '刷新会话列表',
81
81
  'instruction.sessionsEmpty': '宿主还没有会话',
@@ -85,7 +85,7 @@ ACC.addI18n({
85
85
  'instruction.sessionUnavailableTitle': '会话精确视图不可用',
86
86
  'instruction.sessionBlocksTitle': '会话中的指令块',
87
87
  'instruction.sessionId': '会话 ID',
88
- 'instruction.sessionInstructionCount': '指令块 {count} 个',
88
+ 'instruction.sessionInstructionCount': '指令块:{count}',
89
89
  'instruction.sessionEmpty': '该会话没有记录指令块',
90
90
  'instruction.sessionEmptyHint': '会话日志中没有 agent-instructions 事件;宿主只在首次注入指令时写入。',
91
91
  'instruction.sessionReason': '宿主说明',
@@ -115,7 +115,7 @@ ACC.addI18n({
115
115
  'instruction.differentText': '文本不一致',
116
116
  'instruction.exactFilesYes': '文件侧精确',
117
117
  'instruction.exactFilesNo': '文件侧近似',
118
- 'instruction.sessionItemsValue': '会话侧指令块 {count} 个',
118
+ 'instruction.sessionItemsValue': '会话侧指令块:{count}',
119
119
  'instruction.compareWhy': '两侧文本不同:文件侧是按预算重组的近似文本(可能省略、截断或去重),会话侧是宿主当时实际注入的精确文本;字节差异由此而来。',
120
120
  'instruction.compareNote': '对比说明',
121
121
  },
@@ -149,7 +149,7 @@ ACC.addI18n({
149
149
  'instruction.chainCwd': 'Working directory',
150
150
  'instruction.chainProjectRoot': 'Project root',
151
151
  'instruction.chainSource': 'Directory source',
152
- 'instruction.chainFilesCount': '{count} files',
152
+ 'instruction.chainFilesCount': 'Files: {count}',
153
153
  'instruction.displayPath': 'Display path',
154
154
  'instruction.source': 'Source',
155
155
  'instruction.flags': 'Flags',
@@ -177,7 +177,7 @@ ACC.addI18n({
177
177
  'instruction.copyFailed': 'Copy failed',
178
178
  'instruction.copyPreview': 'Copy preview text',
179
179
  'instruction.previewBytes': 'Size {bytes}',
180
- 'instruction.previewSections': '{count} file sections',
180
+ 'instruction.previewSections': 'File sections: {count}',
181
181
  'instruction.previewOmitted': '{count} files omitted by budget',
182
182
  'instruction.previewTruncated': '{count} files truncated by budget',
183
183
  'instruction.previewResponseTruncated': 'The response exceeded its ceiling, so the preview text was clipped; use the exact session view for the full text.',
@@ -189,7 +189,7 @@ ACC.addI18n({
189
189
  'instruction.sessionPickHint': 'Pick a session to read its durable instruction events; read-only, it never resumes or modifies a session.',
190
190
  'instruction.sessionPick': 'Select a session',
191
191
  'instruction.sessionPickAria': 'Session whose instructions to inspect',
192
- 'instruction.sessionListLoaded': '{count} sessions loaded',
192
+ 'instruction.sessionListLoaded': 'Sessions loaded: {count}',
193
193
  'instruction.sessionsFailed': 'Could not load the session list',
194
194
  'instruction.sessionListRefresh': 'Refresh the session list',
195
195
  'instruction.sessionsEmpty': 'The host has no sessions yet',
@@ -199,7 +199,7 @@ ACC.addI18n({
199
199
  'instruction.sessionUnavailableTitle': 'Exact session view unavailable',
200
200
  'instruction.sessionBlocksTitle': 'Instruction blocks in this session',
201
201
  'instruction.sessionId': 'Session ID',
202
- 'instruction.sessionInstructionCount': '{count} instruction blocks',
202
+ 'instruction.sessionInstructionCount': 'Instruction blocks: {count}',
203
203
  'instruction.sessionEmpty': 'This session recorded no instruction blocks',
204
204
  'instruction.sessionEmptyHint': 'The session log has no agent-instructions event; the host writes one only when it first injects instructions.',
205
205
  'instruction.sessionReason': 'Host explanation',
@@ -229,7 +229,7 @@ ACC.addI18n({
229
229
  'instruction.differentText': 'Different text',
230
230
  'instruction.exactFilesYes': 'Files side exact',
231
231
  'instruction.exactFilesNo': 'Files side approximate',
232
- 'instruction.sessionItemsValue': '{count} session-side blocks',
232
+ 'instruction.sessionItemsValue': 'Session-side blocks: {count}',
233
233
  'instruction.compareWhy': 'The two sides differ: the files side is a reconstruction under budget (files may be omitted, truncated, or deduplicated), while the session side is the exact text the host injected; the byte difference follows from that.',
234
234
  'instruction.compareNote': 'Comparison note',
235
235
  },