dsh-session-matrix 0.17.2 → 0.17.4

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 CHANGED
@@ -16,8 +16,8 @@
16
16
  </p>
17
17
 
18
18
  <p align="center">
19
- 同时跑多个 Agent:四个原生会话窗格并排,一张按压缩风险着色的 Agent Graph,<br>
20
- 外加一份在上下文被压缩之前把工作交出去的协议。
19
+ 一个多 Agent 会话的<b>全景控制台</b>:四格原生会话并排,同时盯住多个会话与子代理并行跑任务,<br>
20
+ 一张神经链路图看清主 Agent 与子代理的关系,在上下文压缩、细节丢失之前把工作交出去。
21
21
  </p>
22
22
 
23
23
  <p align="center">
@@ -28,6 +28,11 @@
28
28
  <a href="#vs-context"><b>与 dsh-context</b></a>
29
29
  </p>
30
30
 
31
+ <p align="center">
32
+ <a href="https://github.com/deepseek-ai/deepseek-harness/discussions/13786"><b>官方社区介绍帖</b></a> ·
33
+ <a href="https://dev.to/wanqiu12345/running-four-ai-sessions-at-once-with-a-live-agent-graph-and-context-compaction-warnings-319"><b>英文介绍文章</b></a>
34
+ </p>
35
+
31
36
  ![左侧面板入口与智能体脉络](./docs/01-entry.png)
32
37
 
33
38
  ---
@@ -39,17 +44,19 @@
39
44
  | 位置 | 你得到什么 |
40
45
  |:--|:--|
41
46
  | **左侧面板列表** | 一行「会话矩阵工作台」,与「上下文洞察」「技能中心」同级 |
42
- | **面板顶部** | 两个标签:`工作区` · `智能体脉络` |
43
- | **面板右上角** | 一个 **通用交接提示词** 按钮。旁边的小圆点显示有几个会话进了注意区 |
47
+ | **面板顶部** | 两个标签:`工作区`(四格原生会话)· `智能体脉络`(主子 Agent 神经链路) |
48
+ | **面板右上角** | 一个 **通用交接提示词** 按钮。旁边的小圆点在会话达到「注意」或「建议交接」时点亮 |
44
49
 
45
- 它不改 DSH 任何核心代码,只使用公开的 Cordis 服务与 slot 扩展点。
50
+ 点进左侧入口,你看到的是一个全景视图:多个会话并行推进、主子 Agent 的父子关系一目了然、
51
+ 每个会话离压缩还有多远,靠节点颜色一眼看穿。它不改 DSH 任何核心代码,只使用公开的 Cordis 服务与 slot 扩展点。
46
52
 
47
53
  <a id="workspace"></a>
48
54
 
49
55
  ## 工作区:1–4 格原生会话
50
56
 
51
- 左侧是会话列表,按项目分组;子代理折叠在所属主会话下。**归档会话不显示**——和原生侧栏一致,
52
- 你在原生侧取消归档,这里下一次刷新就回来了。
57
+ 这是主战场:最多四格原生对话窗格并排,每格都能**直接打字发消息**(子代理窗格只读),
58
+ 不是一个只能看的截图墙。左侧是会话列表,按项目分组;子代理折叠在所属主会话下。
59
+ **归档会话不显示**——和原生侧栏一致,你在原生侧取消归档,这里下一次刷新就回来了。
53
60
 
54
61
  右侧窗格按格数自动排版:
55
62
 
@@ -73,16 +80,16 @@
73
80
 
74
81
  ## 智能体脉络:Agent Graph
75
82
 
76
- 一张四列有向拓扑,从左到右:
83
+ 一张神经链路图,把一个工作空间下的会话、以及每个会话派生的子代理之间的关系画出来。四列从左到右:
77
84
 
78
85
  ```
79
86
  工作台 → 项目 → 主会话 → 子代理
80
87
  ```
81
88
 
82
- - **边来自会话头的 `parentSession`**,不推断"同项目"这类弱关系。
83
- - **节点颜色 = 距离压缩点的远近**:正常 / 注意 / 临界。
84
- - **节点尺寸 = 累计用量**,谁最重一眼能看出来。
85
- - 选中任一节点,下方三个模块按该节点的子树重新计算。
89
+ - **边来自会话头真实的 `parentSession`**,不推断"同项目"这类弱关系——看到的就是实际发生的父子调度。
90
+ - **节点颜色 = 距离压缩点的远近**:正常 / 注意 / 临界;**节点尺寸 = 累计用量**,谁最重一眼能看出来。
91
+ - **点任一节点**,下方三个模块按它的子树重算:上下文构成、累计用量与预估费用、会话概览——
92
+ 不用来回切换会话,就能判断该不该继续、要不要交接。
86
93
 
87
94
  ![智能体脉络:节点颜色 = 距压缩点的远近,尺寸 = 累计用量(图中为模拟预警状态)](./docs/03-graph.png)
88
95
 
@@ -161,7 +168,7 @@ DSH 每次压缩都会在会话里留下一个检查点(`compact-checkpoint`
161
168
  | V4.1 Flash `deepseek-flash`(旧名 `deepseek-v4-flash`) | 0.02 | 1 | 4 |
162
169
  | V4 Pro `deepseek-v4-pro` | 0.15 | 4.5 | 13.5 |
163
170
 
164
- 峰时(北京时间工作日 09:00–12:00、14:00–18:00)**×2**。法定节假日暂未建模,仍按工作日峰时计——见下方 Requirements 说明。
171
+ 峰时(北京时间周一至周五 09:00–12:00、14:00–18:00)**×2**。法定节假日全天按谷时计(内置国务院 2026 年放假安排,含调休上班的周末按工作日计);2027 年安排公布后需更新内置表。
165
172
  `contextTimeline.cost` 已按峰谷分桶,直接分桶计算,不做时间推断。
166
173
  非 `deepseek` provider 回退 models.dev 美元价,按 `1 CNY = 0.15 USD` 折算。
167
174
 
@@ -256,7 +263,7 @@ connection.fetch.register({ path: '/api/session-matrix/overview', methods: ['GET
256
263
 
257
264
  - 仅 DeepSeek 模型按人民币计价;其他 provider 走 models.dev 美元价。
258
265
  - 子代理用量按会话独立统计,不并入父会话(脉络里选中主会话时,模块按子树汇总)。
259
- - 法定节假日未建模,峰谷桶由宿主提供。
266
+ - 法定节假日按 2026 年国务院安排内置(节假日全天谷时,调休上班周末计峰时)。
260
267
  - 归档集合读自 `storages/workspace.json`;DSH 若调整该表结构,需同步修改读取逻辑。
261
268
  - macOS / Linux 未在真机验证。代码里没有平台分支,但"没写 `if`"不等于"测过"。
262
269
 
@@ -290,9 +297,11 @@ npm pack --dry-run # 约 10 个文件 / 72 KB
290
297
  <details>
291
298
  <summary><b>English</b></summary>
292
299
 
293
- **A multi-agent workspace for DeepSeek Harness.** One sidebar entry, two views: up to four native
294
- conversation panes, and an Agent Graph that draws `workbench → project → session → subagent` coloured
295
- by compaction risk. A handoff protocol moves work to a fresh session before compaction drops the details.
300
+ **A panoramic console for multi-Agent sessions in DeepSeek Harness.** Watch up to four native
301
+ conversation panes at once and track several sessions and subagents running in parallel without
302
+ switching back and forth. A neural-link Agent graph draws `workbench → project → session → subagent`
303
+ from real `parentSession` data, and a handoff protocol moves work to a fresh session before compaction
304
+ drops the details.
296
305
 
297
306
  ```bash
298
307
  dsh plugin --profile web add dsh-session-matrix
@@ -31,11 +31,45 @@ const BEIJING_OFFSET_MS = 8 * 60 * 60 * 1000
31
31
  * @param epochMs - event timestamp.
32
32
  * @returns true when the request bills at the peak rate.
33
33
  */
34
+ /**
35
+ * DeepSeek's own rule (pricing page, confirmed 2026-11): peak is Mon–Fri
36
+ * 09:00–12:00 and 14:00–18:00 Beijing time **excluding Chinese public
37
+ * holidays** — holidays bill off-peak all day, and weekend days swapped to
38
+ * workdays by the same council notice bill as weekdays.
39
+ *
40
+ * Both tables come from the State Council notice for 2026 (gov.cn, 2025-11-04)
41
+ * and cover that calendar year. When the 2027 notice publishes, extend them.
42
+ */
43
+ const HOLIDAYS_2026 = new Set([
44
+ '2026-01-01', '2026-01-02', '2026-01-03',
45
+ ...range('2026-02-15', 9),
46
+ '2026-04-04', '2026-04-05', '2026-04-06',
47
+ ...range('2026-05-01', 5),
48
+ '2026-06-19', '2026-06-20', '2026-06-21',
49
+ '2026-09-25', '2026-09-26', '2026-09-27',
50
+ ...range('2026-10-01', 7),
51
+ ])
52
+ /** 周六/周日调休上班日 — these weekends bill as weekdays. */
53
+ const WORKDAY_WEEKENDS_2026 = new Set([
54
+ '2026-01-04', '2026-02-14', '2026-02-28', '2026-05-09', '2026-09-20', '2026-10-10',
55
+ ])
56
+
57
+ function range(startIso, days) {
58
+ const list = []
59
+ const t = Date.parse(startIso + 'T00:00:00Z')
60
+ for (let i = 0; i < days; i++) list.push(new Date(t + i * 86_400_000).toISOString().slice(0, 10))
61
+ return list
62
+ }
63
+
34
64
  export function isPeakTime(epochMs) {
35
65
  if (!Number.isFinite(epochMs)) return false
36
66
  const shifted = new Date(epochMs + BEIJING_OFFSET_MS)
67
+ const date = shifted.toISOString().slice(0, 10)
68
+ if (HOLIDAYS_2026.has(date)) return false // holidays bill off-peak all day
37
69
  const weekday = shifted.getUTCDay()
38
- if (weekday === 0 || weekday === 6) return false
70
+ if (weekday === 0 || weekday === 6) {
71
+ if (!WORKDAY_WEEKENDS_2026.has(date)) return false
72
+ }
39
73
  const hour = shifted.getUTCHours()
40
74
  return (hour >= 9 && hour < 12) || (hour >= 14 && hour < 18)
41
75
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-session-matrix",
3
- "version": "0.17.2",
4
- "description": "A multi-agent workspace for DeepSeek Harness: run parallel sessions, visualize agent relationships, monitor context usage, and manage task handoffs.",
3
+ "version": "0.17.4",
4
+ "description": "A panoramic console for DeepSeek Harness: run multiple native sessions and subagents in parallel, see the agent graph, get compaction warnings, and hand work off before context is lost.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "dsh",
@@ -11,13 +11,18 @@
11
11
  "session-management",
12
12
  "parallel-sessions",
13
13
  "context-monitoring",
14
+ "context-rot",
15
+ "compaction",
16
+ "compaction-count",
14
17
  "agent-graph",
15
18
  "agent-handoff",
19
+ "handoff-protocol",
16
20
  "agent-network",
17
- "多智能体工作台",
18
- "多会话管理",
19
- "会话关系图谱",
20
- "上下文监控"
21
+ "\u591a\u667a\u80fd\u4f53\u5de5\u4f5c\u53f0",
22
+ "\u591a\u4f1a\u8bdd\u7ba1\u7406",
23
+ "\u4f1a\u8bdd\u77e9\u9635",
24
+ "\u4e0a\u4e0b\u6587\u538b\u7f29\u9884\u8b66",
25
+ "\u4e0a\u4e0b\u6587\u76d1\u63a7"
21
26
  ],
22
27
  "homepage": "https://github.com/Wanqiu12345/dsh-session-matrix#readme",
23
28
  "repository": {
@@ -33,6 +33,20 @@ const assert = (cond, message) => {
33
33
  const beijing = (y, m, d, h, min = 0, sec = 0) => Date.UTC(y, m - 1, d, h - 8, min, sec)
34
34
 
35
35
  // 2026-11-16 is a Monday, 2026-11-14 a Saturday.
36
+ check('法定节假日全天按谷时(DeepSeek 官方规则,2026 国务院安排)', () => {
37
+ assert(isPeakTime(beijing(2026, 1, 1, 10)) === false, '元旦周四 10:00 应为谷时')
38
+ assert(isPeakTime(beijing(2026, 2, 18, 10)) === false, '春节周三 10:00 应为谷时')
39
+ assert(isPeakTime(beijing(2026, 10, 6, 10)) === false, '国庆周二 10:00 应为谷时')
40
+ assert(isPeakTime(beijing(2026, 9, 25, 15)) === false, '中秋周五 15:00 应为谷时')
41
+ })
42
+ check('调休上班的周末按工作日计峰时', () => {
43
+ assert(isPeakTime(beijing(2026, 2, 14, 10)) === true, '春节调休周六 10:00 应为峰时')
44
+ assert(isPeakTime(beijing(2026, 10, 10, 15)) === true, '国庆调休周六 15:00 应为峰时')
45
+ })
46
+ check('普通周末与工作日不受日历影响', () => {
47
+ assert(isPeakTime(beijing(2026, 3, 7, 10)) === false, '普通周六 10:00 谷时')
48
+ assert(isPeakTime(beijing(2026, 11, 19, 10)) === true, '普通周四 10:00 峰时')
49
+ })
36
50
  check('peak windows are 09:00–12:00 and 14:00–18:00 on weekdays', () => {
37
51
  assert(isPeakTime(beijing(2026, 11, 16, 8, 59)) === false, '08:59 should be off-peak')
38
52
  assert(isPeakTime(beijing(2026, 11, 16, 9, 0)) === true, '09:00 should be peak')