dsh-session-matrix 0.17.3 → 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 +2 -2
- package/lib/usage-split.js +35 -1
- package/package.json +6 -6
- package/test/usage-split.test.mjs +14 -0
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ DSH 每次压缩都会在会话里留下一个检查点(`compact-checkpoint`
|
|
|
168
168
|
| V4.1 Flash `deepseek-flash`(旧名 `deepseek-v4-flash`) | 0.02 | 1 | 4 |
|
|
169
169
|
| V4 Pro `deepseek-v4-pro` | 0.15 | 4.5 | 13.5 |
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
峰时(北京时间周一至周五 09:00–12:00、14:00–18:00)**×2**。法定节假日全天按谷时计(内置国务院 2026 年放假安排,含调休上班的周末按工作日计);2027 年安排公布后需更新内置表。
|
|
172
172
|
`contextTimeline.cost` 已按峰谷分桶,直接分桶计算,不做时间推断。
|
|
173
173
|
非 `deepseek` provider 回退 models.dev 美元价,按 `1 CNY = 0.15 USD` 折算。
|
|
174
174
|
|
|
@@ -263,7 +263,7 @@ connection.fetch.register({ path: '/api/session-matrix/overview', methods: ['GET
|
|
|
263
263
|
|
|
264
264
|
- 仅 DeepSeek 模型按人民币计价;其他 provider 走 models.dev 美元价。
|
|
265
265
|
- 子代理用量按会话独立统计,不并入父会话(脉络里选中主会话时,模块按子树汇总)。
|
|
266
|
-
-
|
|
266
|
+
- 法定节假日按 2026 年国务院安排内置(节假日全天谷时,调休上班周末计峰时)。
|
|
267
267
|
- 归档集合读自 `storages/workspace.json`;DSH 若调整该表结构,需同步修改读取逻辑。
|
|
268
268
|
- macOS / Linux 未在真机验证。代码里没有平台分支,但"没写 `if`"不等于"测过"。
|
|
269
269
|
|
package/lib/usage-split.js
CHANGED
|
@@ -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)
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-matrix",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
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",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"agent-handoff",
|
|
19
19
|
"handoff-protocol",
|
|
20
20
|
"agent-network",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
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"
|
|
26
26
|
],
|
|
27
27
|
"homepage": "https://github.com/Wanqiu12345/dsh-session-matrix#readme",
|
|
28
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')
|