dsh-offpeak 0.0.0-stage → 3.1.7
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/LICENSE +21 -0
- package/README.en.md +116 -0
- package/README.md +116 -3
- package/assets/dsh-offpeak-hero.png +0 -0
- package/config/offpeak.json +44 -0
- package/cordis.patch.yml +9 -0
- package/dsh.plugin.json +16 -0
- package/lib/client.js +1369 -0
- package/lib/client.js.map +1 -0
- package/package.json +107 -6
- package/src/bridge.js +138 -0
- package/src/client/badge-text.ts +80 -0
- package/src/client/date-range-picker.tsx +172 -0
- package/src/client/date-range.ts +174 -0
- package/src/client/free-run-button-text.ts +178 -0
- package/src/client/free-run-button.tsx +335 -0
- package/src/client/index.ts +42 -0
- package/src/client/locales.ts +163 -0
- package/src/client/model-list.ts +116 -0
- package/src/client/model-panel.tsx +185 -0
- package/src/client/status-badge.tsx +114 -0
- package/src/client/styles.ts +166 -0
- package/src/config-file.js +441 -0
- package/src/deferrals.js +235 -0
- package/src/detect.js +34 -0
- package/src/free-run.js +368 -0
- package/src/gate.js +101 -0
- package/src/index.js +984 -0
- package/src/pause-gate.js +547 -0
- package/src/pause-store.js +102 -0
- package/src/provider-directory.js +187 -0
- package/src/provider.js +183 -0
- package/src/request-guard.js +263 -0
- package/src/retry.js +227 -0
- package/src/scheduler.js +42 -0
- package/src/settings.js +183 -0
- package/src/step-gate.js +399 -0
- package/src/store.js +77 -0
- package/src/targets.js +113 -0
- package/src/time-policy.js +587 -0
- package/src/time.js +100 -0
- package/src/tool-call-id.js +44 -0
- package/src/wiring.js +444 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-offpeak contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/dsh-offpeak-hero.png" alt="dsh-offpeak — Selective Control. Continuous Workflow." width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>English</strong> · <a href="README.md">中文</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-263146?style=flat-square"></a>
|
|
11
|
+
<img alt="dsh-plugin" src="https://img.shields.io/badge/dsh--plugin-ready-478CBF?logo=deepseek&logoColor=white">
|
|
12
|
+
<img alt="Public beta" src="https://img.shields.io/badge/status-public%20beta-7da1de?style=flat-square">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
# dsh-offpeak
|
|
16
|
+
|
|
17
|
+
A DSH (DeepSeek Harness) host plugin that keeps peak-hour usage under control: it closes the session gate before a peak-hour request goes out, holds only the requests whose **target is official or explicitly listed**, lets everything else run, and gives a single session a time-boxed "free run" exemption.
|
|
18
|
+
|
|
19
|
+
Plugin id `dsh-offpeak`, settings namespace `offpeak`, config file `config/offpeak.json`.
|
|
20
|
+
|
|
21
|
+
## What it does
|
|
22
|
+
|
|
23
|
+
| Capability | Behaviour |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Configurable peak policy | Peak windows, timezone, per-window weekdays and the weekend rule come from `config/offpeak.json` (env → `$DSH_HOME/config` → `<cwd>/config` → bundled default). A malformed file never silently disables the guard: errors are collected and reported (`configFile.errors` on `/session-guard/settings` and `/diag`), affected keys keep their defaults. |
|
|
26
|
+
| Turn / step gating | On peak entry, running sessions are paused (or gated at the next `agent/pre-step` when `stepLevelPause` is on) and released automatically off peak. Manual `/pause` is never touched by the automatic release. |
|
|
27
|
+
| Request-level guard | `agent/request` is checked on **every** request, so sessions started after peak entry — or switched to an official route mid-session — are still caught. `deferredMode: 'hold'` (default) holds the request silently; `'error'` raises a recognisable `PEAK_DEFERRED`. |
|
|
28
|
+
| Target verdict | Priority: explicit `officialProviders` list → **model name (exact match, case-insensitive)** → live `baseURL` host → catalog default endpoint → built-in id (`deepseek-official`) → unknown. A request is held only when the verdict is `official`. |
|
|
29
|
+
| Peak interception list | Tick models in the badge panel (or write `officialModelPatterns`): an entry is a **model name matched exactly**, so ticking `ocg/deepseek-flash` intercepts exactly that model, whatever route serves it — and nothing is intercepted until you tick something. The panel has a keyword filter, select-all / clear-select-all, refresh, hot reload, and a `×` undo on every intercepted entry. |
|
|
30
|
+
| Free-run | Schedule one or more absolute time windows for one session; inside them the session is exempt everywhere (peak entry, step gate, request hold). Per-segment pause/resume, merged up to 8 windows, persisted — shown at the top of the same panel as the interception list. |
|
|
31
|
+
| Badge | One clickable badge in the composer: `高峰` / `高峰 · 拦截中` / `高峰 · 畅跑中` / `谷时` / `周末`; red while blocking, green while allowing. |
|
|
32
|
+
| Retry | Optional backend retry for transient turn failures (off by default); it always yields to the gates. |
|
|
33
|
+
|
|
34
|
+
## Compatibility
|
|
35
|
+
|
|
36
|
+
| Item | Notes |
|
|
37
|
+
|---|---|
|
|
38
|
+
| DSH host versions | `package.json`'s `engines.dsh` = `>=0.1.5-rc.2 <0.1.6-0 \|\| >=0.1.7-rc.1 <0.1.8-0 \|\| >=0.2.0-rc.1 <0.2.1-0`. **Only the 0.1.7 line is actually verified** (this plugin was developed and tested there); the other two ranges follow the same interfaces but were not exercised one by one — check `dsh --profile <yours> --dump-config` composes cleanly before installing. |
|
|
39
|
+
| Settings and the write path | On the 0.1.7 line the client has **no `settingsScope`**, so the browser half injects only `slots + locale`: the settings form is auto-generated by the host from the exported `Config` schema, and the interception list is written through `POST /session-guard/rpc {action:'setModelPatterns'}`, which rewrites `config/offpeak.json` and reloads immediately. A custom settings card is rendered only when the host provides `settingsScope`. |
|
|
40
|
+
| Node | `engines.node >= 20` (the bundled `node --test` suite uses Node 22+ type-stripping imports of `.ts`). |
|
|
41
|
+
| Bootstrap deps | `@deepseek-ai/schemastery ^3.18.4` is a runtime dependency; `@deepseek-ai/cordis ^4.0.1` and the `@deepseek-ai/dsh-client-*` packages are **optional peerDependencies** (missing them is not an error). |
|
|
42
|
+
| Stable surface | The `/session-guard/*` route prefix and the in-process `sessionGuard` service port are **deliberately kept** (compatibility with existing tooling/notes): renaming the plugin does not rename them. |
|
|
43
|
+
| input-traffic | The bridge global is read from `window.__DSH_OFFPEAK_BRIDGE__` first, falling back to the historic `window.__DSH_SESSION_GUARD_BRIDGE__`; without either, the plugin ships its own fallback badge/freeze and the two do not replace each other. |
|
|
44
|
+
| Known limitations | No statutory-holiday calendar; free-run interprets wall-clock input in the configured timezone; the interception list matches **exact model names** (no keyword/regex sweeping). |
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
Pick any of the three channels: the npm package, the GitHub repository, or a local directory / the tgz attached to a Release.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# (1) npm (recommended)
|
|
52
|
+
dsh plugin --profile desktop add dsh-offpeak
|
|
53
|
+
|
|
54
|
+
# (2) GitHub (first time needs an allowBuilds entry in the profile's pnpm-workspace.yaml so the package's prepare build may run)
|
|
55
|
+
dsh plugin --profile desktop add github:lizilong1993/dsh-offpeak
|
|
56
|
+
|
|
57
|
+
# (3) local directory / Release asset (no permissions needed)
|
|
58
|
+
dsh plugin --profile desktop add ./dsh-offpeak
|
|
59
|
+
dsh plugin --profile desktop add ./dsh-offpeak-<version>.tgz
|
|
60
|
+
|
|
61
|
+
dsh --profile desktop --dump-config # verify the composed patch layers
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Building from source (for development):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/lizilong1993/dsh-offpeak.git
|
|
68
|
+
cd dsh-offpeak
|
|
69
|
+
npm install # or pnpm install
|
|
70
|
+
npm run build # rebuild lib/client.js (the browser half)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or point a profile at this checkout by hand — `~/.dsh/profiles/<profile>/package.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{ "dependencies": { "dsh-offpeak": "link:/path/to/dsh-offpeak" } }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
and add `dsh-offpeak` to that file's `dsh.profile.bundles`. Then restart DSH (host code is loaded at boot) and refresh the page.
|
|
80
|
+
|
|
81
|
+
## Configuration
|
|
82
|
+
|
|
83
|
+
`config/offpeak.json` (default layer; form values win) — keys used most:
|
|
84
|
+
|
|
85
|
+
```jsonc
|
|
86
|
+
{
|
|
87
|
+
"timezone": "Asia/Shanghai",
|
|
88
|
+
"peakPolicy": { "peakWindows": [{ "name": "morning", "start": "09:00", "end": "12:00", "days": ["mon","tue","wed","thu","fri"] }] },
|
|
89
|
+
"weekendPolicy": { "enabled": true, "days": ["sat","sun"], "mode": "offPeak" },
|
|
90
|
+
"providerGuard": true,
|
|
91
|
+
"officialProviders": [], // extra provider ids, exact match, highest priority
|
|
92
|
+
"officialModelPatterns": [], // intercepted model names (exact, case-insensitive)
|
|
93
|
+
"officialBaseURLs": ["api.deepseek.com"],
|
|
94
|
+
"deferredMode": "hold", // 'hold' | 'error'
|
|
95
|
+
"deferredResume": true,
|
|
96
|
+
"stepLevelPause": true
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`DSH_OFFPEAK_CONFIG` picks an explicit config file; the state root defaults to `.dsh/offpeak` (`DSH_OFFPEAK_STATE_DIR` overrides it).
|
|
101
|
+
|
|
102
|
+
## HTTP / service surface
|
|
103
|
+
|
|
104
|
+
`GET /session-guard/status` · `/state?session=` · `/settings` · `/provider?provider=&model=` · `/models` · `/diag` · `/events` (SSE) · `POST /session-guard/rpc` (`stopNextTurn|resume|lockQueue|unlockQueue|stepPause|stepResume|state|reloadConfig|setModelPatterns|freeRunAdd|…`), plus the in-process `sessionGuard` service port.
|
|
105
|
+
|
|
106
|
+
## Tests
|
|
107
|
+
|
|
108
|
+
`npm test` (node:test) · `npm run lint` · `npm run build`.
|
|
109
|
+
|
|
110
|
+
## Acknowledgements
|
|
111
|
+
|
|
112
|
+
- [drscrewdriver/dsh-session-guard](https://github.com/drscrewdriver/dsh-session-guard)
|
|
113
|
+
|
|
114
|
+
## Licence
|
|
115
|
+
|
|
116
|
+
MIT — see [LICENSE](./LICENSE).
|
package/README.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/dsh-offpeak-hero.png" alt="dsh-offpeak — 该停的停,该跑的跑 / Selective Control. Continuous Workflow." width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="README.en.md">English</a> · <strong>中文</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-263146?style=flat-square"></a>
|
|
11
|
+
<img alt="dsh-plugin" src="https://img.shields.io/badge/dsh--plugin-ready-478CBF?logo=deepseek&logoColor=white">
|
|
12
|
+
<img alt="Public beta" src="https://img.shields.io/badge/status-public%20beta-7da1de?style=flat-square">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
# dsh-offpeak
|
|
16
|
+
|
|
17
|
+
一个 DSH(DeepSeek Harness)宿主插件:用来自动管理高峰期的会话与请求 —— 在高峰请求真正发出**之前**拉门、只拦**目标为官方源或显式列出的模型**的请求、其余照常跑,并支持给单个会话排一段时间「畅跑」豁免。
|
|
18
|
+
|
|
19
|
+
插件 id `dsh-offpeak`,设置命名空间 `offpeak`,配置文件 `config/offpeak.json`。
|
|
20
|
+
|
|
21
|
+
## 能力一览
|
|
22
|
+
|
|
23
|
+
| 能力 | 行为 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| 可配置峰谷策略 | 峰窗口、时区、每窗口的星期与周末规则全部来自 `config/offpeak.json`(env → `$DSH_HOME/config` → `<cwd>/config` → 包内默认)。配置文件写坏**绝不静默让守卫失效**:错误被收集并暴露(`/session-guard/settings` 与 `/diag` 的 `configFile.errors`),对应键保留默认值。 |
|
|
26
|
+
| 回合 / step 门控 | 入峰时暂停 running 会话(`stepLevelPause` 开启则在下一个 `agent/pre-step` 拉门),退峰自动放行;自动放行**不碰**手动 `/pause`。 |
|
|
27
|
+
| 请求级守卫 | `agent/request` **每个请求都过**,所以入峰后才启动的会话、会话中途切到官方源的情况都能兜住。`hold`(默认)静默挂起,`error` 抛可识别的 `PEAK_DEFERRED`。 |
|
|
28
|
+
| 目标判定 | 优先级:显式 `officialProviders` → **模型名(精确匹配、大小写不敏感)** → 实时 `baseURL` → catalog 默认端点 → 内置 id(`deepseek-official`)→ unknown。只有判为官方才拦。 |
|
|
29
|
+
| 高峰拦截列表 | 在徽标面板里勾选模型(或直接写 `officialModelPatterns`):条目是**模型名精确匹配** —— 勾了 `ocg/deepseek-flash` 就只拦这一个模型,无论它跑在哪条路由上;**不勾不拦**。面板顶部有关键词过滤、全选/取消全选、刷新与热重载,每个已拦截项都带 `×` 撤销。 |
|
|
30
|
+
| 畅跑 | 给单个会话排一段或多段绝对时间窗口,窗口内该会话在**入峰、step 门、请求挂起**三处都豁免;支持逐段暂停/恢复、合并上限 8 条、持久化。面板里与拦截列表同处一个展开区(最上方)。 |
|
|
31
|
+
| 徽标 | 输入区一个可点徽标:`高峰` / `高峰 · 拦截中` / `高峰 · 畅跑中` / `谷时` / `周末`;拦截态红、放行态绿。 |
|
|
32
|
+
| 自动重试 | 可选的后端重试(默认关),且永远给门控让路。 |
|
|
33
|
+
|
|
34
|
+
## 兼容性
|
|
35
|
+
|
|
36
|
+
| 项目 | 说明 |
|
|
37
|
+
|---|---|
|
|
38
|
+
| DSH 宿主版本 | `package.json` 的 `engines.dsh` = `>=0.1.5-rc.2 <0.1.6-0 \|\| >=0.1.7-rc.1 <0.1.8-0 \|\| >=0.2.0-rc.1 <0.2.1-0`(三段)。**实际验证只在 0.1.7 线做过**(本插件的开发与实测环境);另两段按接口形态适配、尚未逐一实测 —— 装之前请先看下 `dsh --profile <你的 profile> --dump-config` 能否正常组装。 |
|
|
39
|
+
| 设置与写入口 | 0.1.7 线的客户端**没有 `settingsScope`**,所以本插件的浏览器半只注入 `slots + locale`:设置表单由宿主按导出的 `Config` schema 自动生成;拦截列表的写入口是 `POST /session-guard/rpc {action:'setModelPatterns'}`,写 `config/offpeak.json` 后立即 `reloadConfig`。宿主提供 `settingsScope` 时才渲染自定义设置卡片。 |
|
|
40
|
+
| Node | `engines.node >= 20`(仓库自带 `node --test` 测试为 Node 22+ 写法:直接 import `.ts` 类型擦除)。 |
|
|
41
|
+
| bootstrap 依赖 | `@deepseek-ai/schemastery ^3.18.4` 为运行时依赖;`@deepseek-ai/cordis ^4.0.1` 与 `@deepseek-ai/dsh-client-*` 声明为**可选 peerDependencies**(不装不报错)。 |
|
|
42
|
+
| 稳定接口(跨版本不变) | `/session-guard/*` 路由前缀与 `sessionGuard` 进程内服务端口是**保留名**(与既有工具/笔记兼容):换插件名不会改它们。 |
|
|
43
|
+
| 与 input-traffic 的关系 | 该插件的「最小桥」全局名优先读 `window.__DSH_OFFPEAK_BRIDGE__`,同时兼容它历史上写的 `window.__DSH_SESSION_GUARD_BRIDGE__`;没有它时本插件自带回退冻结/徽标,两者不互相取代。 |
|
|
44
|
+
| 已知限制 | 不识别法定节假日;畅跑按配置时区解释墙钟;高峰拦截列表是**精确模型名**匹配(不做关键字/正则的批量覆盖)。 |
|
|
45
|
+
|
|
46
|
+
## 安装
|
|
47
|
+
|
|
48
|
+
三条通道任选:npm 包 / GitHub 仓库 / 本地目录或 Release 里的 tgz。
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# ① npm(推荐)
|
|
52
|
+
dsh plugin --profile desktop add dsh-offpeak
|
|
53
|
+
|
|
54
|
+
# ② GitHub(首次需在 profile 的 pnpm-workspace.yaml 里给 allowBuilds 放行该包的 prepare 构建)
|
|
55
|
+
dsh plugin --profile desktop add github:lizilong1993/dsh-offpeak
|
|
56
|
+
|
|
57
|
+
# ③ 本地目录 / Release 资产(零权限)
|
|
58
|
+
dsh plugin --profile desktop add ./dsh-offpeak
|
|
59
|
+
dsh plugin --profile desktop add ./dsh-offpeak-<version>.tgz
|
|
60
|
+
|
|
61
|
+
dsh --profile desktop --dump-config # 验证补丁分层
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
从源码构建(开发用):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/lizilong1993/dsh-offpeak.git
|
|
68
|
+
cd dsh-offpeak
|
|
69
|
+
npm install # 或 pnpm install
|
|
70
|
+
npm run build # 重新构建 lib/client.js(浏览器半)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
也可以手工在 profile 里指向这个检出 —— `~/.dsh/profiles/<profile>/package.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{ "dependencies": { "dsh-offpeak": "link:/path/to/dsh-offpeak" } }
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
并把 `dsh-offpeak` 加进同一文件的 `dsh.profile.bundles`;然后重启 DSH(host 代码在 boot 时加载)并刷新页面。
|
|
80
|
+
|
|
81
|
+
## 配置
|
|
82
|
+
|
|
83
|
+
`config/offpeak.json`(默认层;设置表单里的值优先),常用键:
|
|
84
|
+
|
|
85
|
+
```jsonc
|
|
86
|
+
{
|
|
87
|
+
"timezone": "Asia/Shanghai",
|
|
88
|
+
"peakPolicy": { "peakWindows": [{ "name": "morning", "start": "09:00", "end": "12:00", "days": ["mon","tue","wed","thu","fri"] }] },
|
|
89
|
+
"weekendPolicy": { "enabled": true, "days": ["sat","sun"], "mode": "offPeak" },
|
|
90
|
+
"providerGuard": true,
|
|
91
|
+
"officialProviders": [], // 追加官方 provider id(精确匹配,最高优先级)
|
|
92
|
+
"officialModelPatterns": [], // 高峰拦截的模型名(精确匹配、大小写不敏感)
|
|
93
|
+
"officialBaseURLs": ["api.deepseek.com"],
|
|
94
|
+
"deferredMode": "hold", // 'hold' | 'error'
|
|
95
|
+
"deferredResume": true,
|
|
96
|
+
"stepLevelPause": true
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
可用 `DSH_OFFPEAK_CONFIG` 显式指定配置文件;状态目录默认 `.dsh/offpeak`(`DSH_OFFPEAK_STATE_DIR` 可覆盖)。
|
|
101
|
+
|
|
102
|
+
## HTTP / 服务面
|
|
103
|
+
|
|
104
|
+
`GET /session-guard/status` · `/state?session=` · `/settings` · `/provider?provider=&model=` · `/models` · `/diag` · `/events`(SSE)· `POST /session-guard/rpc`(`stopNextTurn|resume|lockQueue|unlockQueue|stepPause|stepResume|state|reloadConfig|setModelPatterns|freeRunAdd|…`),以及进程内的 `sessionGuard` 服务端口。
|
|
105
|
+
|
|
106
|
+
## 测试
|
|
107
|
+
|
|
108
|
+
`npm test`(node:test)· `npm run lint` · `npm run build`。
|
|
109
|
+
|
|
110
|
+
## 致谢
|
|
111
|
+
|
|
112
|
+
- [drscrewdriver/dsh-session-guard](https://github.com/drscrewdriver/dsh-session-guard)
|
|
113
|
+
|
|
114
|
+
## 许可
|
|
115
|
+
|
|
116
|
+
MIT —— 见 [LICENSE](./LICENSE)。
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enabled": true,
|
|
3
|
+
|
|
4
|
+
"timezone": "Asia/Shanghai",
|
|
5
|
+
|
|
6
|
+
"peakPolicy": {
|
|
7
|
+
"peakWindows": [
|
|
8
|
+
{
|
|
9
|
+
"name": "morning",
|
|
10
|
+
"start": "09:00",
|
|
11
|
+
"end": "12:00",
|
|
12
|
+
"days": [
|
|
13
|
+
"mon",
|
|
14
|
+
"tue",
|
|
15
|
+
"wed",
|
|
16
|
+
"thu",
|
|
17
|
+
"fri"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
{
|
|
22
|
+
"name": "afternoon",
|
|
23
|
+
"start": "14:00",
|
|
24
|
+
"end": "18:00",
|
|
25
|
+
"days": [
|
|
26
|
+
"mon",
|
|
27
|
+
"tue",
|
|
28
|
+
"wed",
|
|
29
|
+
"thu",
|
|
30
|
+
"fri"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"weekendPolicy": {
|
|
37
|
+
"enabled": true,
|
|
38
|
+
"days": [
|
|
39
|
+
"sat",
|
|
40
|
+
"sun"
|
|
41
|
+
],
|
|
42
|
+
"mode": "offPeak"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# dsh-offpeak bundle patch:一行装配进 profile。
|
|
2
|
+
#
|
|
3
|
+
# host 半(src/index.js)注册 sessionGuard 服务(冗余端口,供 input-traffic 适配)、
|
|
4
|
+
# 高峰自动会话门(taskControl.pause/resume,缺失时回退锁等待队列)、
|
|
5
|
+
# /session-guard/* 路由(路径保留旧名,input-traffic 依赖)与 设置→插件→offpeak 子板块。
|
|
6
|
+
# 浏览器半(经 package.json dsh.client 声明)提供高峰面板(畅跑任务 + 拦截列表)。
|
|
7
|
+
- insert:
|
|
8
|
+
- id: offpeak
|
|
9
|
+
name: dsh-offpeak
|
package/dsh.plugin.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "dsh-external/dsh-offpeak",
|
|
3
|
+
"version": "3.1.6",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"description": "可配置峰谷自动会话门:config/offpeak.json 驱动 peak 时段 + step 级门控 + 周末全天 off-peak + 单会话「畅跑」限时无视峰谷 + 波谷自动恢复 + 按模型名的高峰拦截列表。",
|
|
6
|
+
"engines": {
|
|
7
|
+
"dsh": ">=0.1.5-rc.2 <0.1.6-0 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-rc.1 <0.2.1-0"
|
|
8
|
+
},
|
|
9
|
+
"contributes": {
|
|
10
|
+
"tools": [],
|
|
11
|
+
"skills": []
|
|
12
|
+
},
|
|
13
|
+
"client": {
|
|
14
|
+
"main": "./lib/client.js"
|
|
15
|
+
}
|
|
16
|
+
}
|