dsh-pf-stream 0.1.0 → 0.1.3
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.en.md +110 -0
- package/README.md +26 -17
- package/cordis.patch.yml +4 -2
- package/package.json +16 -10
- package/NOTICE +0 -13
package/README.en.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# dsh-pf-stream
|
|
2
|
+
|
|
3
|
+
[中文](README.md) | **English**
|
|
4
|
+
|
|
5
|
+
Video perception plugin for DeepSeek Harness (DSH). One tool lets the model "see" local video files:
|
|
6
|
+
|
|
7
|
+
- **Continuous events** → adaptive streaming sampling. During motion, the sampler emits low-token process units by displacement integration. On settle or sharpness peaks, it freezes a high-resolution focus unit.
|
|
8
|
+
- **Suspicious time points** → deterministic inspection: metadata probe, frame extraction at given timestamps, uniform slicing, and local RoI zoom-in.
|
|
9
|
+
|
|
10
|
+
Every canvas aligns with the DeepSeek-V4.1-Flash vision pipeline: 42-px superpixel grid, billing `r×(c+1)+2`. All four forms bill ≤530 tokens, within the 1024-token per-image limit. The server encodes each canvas at its original resolution.
|
|
11
|
+
|
|
12
|
+
## Capability routing
|
|
13
|
+
|
|
14
|
+
One tool, `dsh-pf-stream`, routes through `intent.action`:
|
|
15
|
+
|
|
16
|
+
| action | engine | use |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `pf_stream` (default) | adaptive streaming | 336² process units (P) during motion; 672² focus units (F) on settle/peak. Schmitt four-state machine + two-layer adaptation (intent baseline + content feedback R1-R4) |
|
|
19
|
+
| `timestamps` | deterministic inspection | high-resolution frames at given timestamps; `roi_hint` zoom-in |
|
|
20
|
+
| `uniform` | deterministic inspection | uniform slicing by step or target frame count |
|
|
21
|
+
| `probe` | deterministic inspection | metadata only (display size, rotation, last-frame PTS, stream summary); zero vision tokens |
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Requirements:
|
|
26
|
+
|
|
27
|
+
- DSH host (Node ≥ 20).
|
|
28
|
+
- `ffmpeg` and `ffprobe` executables. Search order: plugin config path → `DSH_FFMPEG_PATH` / `FFMPEG_PATH` → `DSH_FFMPEG_DIR` → `~/.dsh/tools/ffmpeg/bin` → `~/.dsh/bin` → `PATH`.
|
|
29
|
+
|
|
30
|
+
Install the package `dsh-pf-stream` in the DSH plugin manager. The host mounts the plugin through `dsh.bundle.patch` (`cordis.patch.yml`). Peer dependencies `@deepseek-ai/cordis` and `@deepseek-ai/schemastery` resolve in the host runtime. The only runtime dependency is `pngjs`; canvas PNG encoding uses fixed parameters, so output bytes are deterministic.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Streaming perception ("what text is on screen"):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"video_path": "D:/videos/demo.mp4",
|
|
39
|
+
"intent": { "action": "pf_stream", "focus": "detail", "mode": "dense" }
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Point inspection (text found at 12.9 s in a streaming result):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"video_path": "D:/videos/demo.mp4",
|
|
48
|
+
"intent": {
|
|
49
|
+
"action": "timestamps",
|
|
50
|
+
"timestamps_ms": [12900],
|
|
51
|
+
"roi_hint": { "x": 0.2, "y": 0.3, "w": 0.4, "h": 0.4 }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The top level also accepts common convenience fields from the video-inspection domain: `start_time`, `end_time`, `timestamps`, `fps`, `interval`, `num_frames`, `crop`, `probe_only`. The entry adapter normalizes them into the standard `intent` structure.
|
|
57
|
+
|
|
58
|
+
## Returned content
|
|
59
|
+
|
|
60
|
+
Each call returns one or more canvas packets:
|
|
61
|
+
|
|
62
|
+
- **PNG canvas**: one of four forms (table below). Two-tone separator lines block edge-feature crosstalk between units; an optional superpixel badge renders unit IDs.
|
|
63
|
+
- **Structured metadata**: `packet_id`, per-unit PTS, token-grid bbox, source-sampling bbox, dual-carrier SHA-256.
|
|
64
|
+
- **Timeline hint line**: a model-readable P/F timeline, for example `[Packet #42 | Anchor: #105 | #101(P, 12.1s, Left-Top) → …]`.
|
|
65
|
+
|
|
66
|
+
Session capabilities:
|
|
67
|
+
|
|
68
|
+
- Intent persists across calls.
|
|
69
|
+
- Streaming cursor resume: the next call on the same video continues from the last position.
|
|
70
|
+
- Two-tier history reference: the hot tier reuses the latest 2 full strips; the cold tier reuses up to 4 independent F-anchor carriers.
|
|
71
|
+
- Epoch compaction: hot-to-cold conversion in batches of 6 packets, keeping the multi-turn Prefix KV-Cache prefix stable.
|
|
72
|
+
|
|
73
|
+
## Canvas and billing
|
|
74
|
+
|
|
75
|
+
| form | layout | tokens |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `FORM_1_STANDARD_STRIP` | 4P + 1F, 1344×672 | 530 |
|
|
78
|
+
| `FORM_2_COMPACT_4P` | 4P, 672×672 | 274 |
|
|
79
|
+
| `FORM_3_COMPACT_1F` | 1F, 672×672 | 274 |
|
|
80
|
+
| `FORM_4_PARTIAL_STRIP` | 1-3P + 1F, 1344×672 | 530 |
|
|
81
|
+
|
|
82
|
+
## Configuration
|
|
83
|
+
|
|
84
|
+
| option | default | description |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| `renderVisualId` | `true` | superpixel inverse badge at each unit corner |
|
|
87
|
+
| `maxPacketsPerCall` | `64` | packet count limit per call |
|
|
88
|
+
| `maxTokensBudgetPerCall` | `65536` | vision-token budget per call |
|
|
89
|
+
| `maxRequestBytes` | `56 MiB` | request byte watermark, Base64-inclusive |
|
|
90
|
+
| `maxColdRefs` | `4` | cold-tier reference limit |
|
|
91
|
+
| `defaultStreamWindowMs` | `10000` | window length in ms when `pts_window` is absent |
|
|
92
|
+
| `streamWorkMaxEdge` | `2048` | working-resolution long edge for streaming decode; deterministic inspection always uses full resolution |
|
|
93
|
+
| `epochCompactionWindow` | `6` | hot-to-cold batch window, in packets |
|
|
94
|
+
| `meteringProfile.imageCountTiersEnabled` | `false` | gate for the ≥15-image 4096-px rule |
|
|
95
|
+
|
|
96
|
+
## Testing
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pnpm test # boundary (pure logic) + e2e (fixture-driven), 20 boundary cases
|
|
100
|
+
pnpm run build # TypeScript compile
|
|
101
|
+
pnpm verify:host # host-contract self-check (schema shape, keyword subset, dependency boundary)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Release
|
|
105
|
+
|
|
106
|
+
npm releases run automatically through GitHub Actions. Process and version policy: [docs/发布规范.md](docs/发布规范.md) (Chinese).
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
Apache-2.0.
|
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# dsh-pf-stream
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**中文** | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **可疑时间点** → 确定性检视:元数据探测、指定时间戳抽帧、均匀切片、局部 RoI 放大复核。
|
|
5
|
+
DeepSeek Harness(DSH)视频感知插件。模型用一个工具即可「看」本地视频:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- **连续事件** → 自适应流式采样。运动时按位移积分抽低 token 过程单元;停稳与顿挫波峰时定格高清焦点单元。
|
|
8
|
+
- **可疑时间点** → 确定性检视。能力:元数据探测、指定时间戳抽帧、均匀切片、局部 RoI 放大复核。
|
|
9
|
+
|
|
10
|
+
全部画布对齐 DeepSeek-V4.1-Flash 视觉编码管线:42px 超像素网格,计费 `r×(c+1)+2`。四种形态计费均 ≤530 token,满足单图 1024 token 上限。服务端按画布原始分辨率计量。
|
|
9
11
|
|
|
10
12
|
## 能力路由
|
|
11
13
|
|
|
@@ -13,7 +15,7 @@ DeepSeek Harness(DSH)视频感知插件。模型通过一个工具即可"看
|
|
|
13
15
|
|
|
14
16
|
| action | 引擎 | 用途 |
|
|
15
17
|
| --- | --- | --- |
|
|
16
|
-
| `pf_stream`(默认) | 动态流式采样 | 运动中抽 336² 过程单元(P
|
|
18
|
+
| `pf_stream`(默认) | 动态流式采样 | 运动中抽 336² 过程单元(P);停稳/波峰定格 672² 焦点单元(F)。施密特四状态机 + 双层自适应调节(意图基准 + 内容自闭环 R1-R4) |
|
|
17
19
|
| `timestamps` | 确定性检视 | 指定时间戳单帧/组合高清检视,支持 `roi_hint` 局部放大 |
|
|
18
20
|
| `uniform` | 确定性检视 | 固定步长或目标帧数均匀切片 |
|
|
19
21
|
| `probe` | 确定性检视 | 仅元数据(显示宽高/旋转/末帧 PTS/流摘要),零视觉 token |
|
|
@@ -22,14 +24,14 @@ DeepSeek Harness(DSH)视频感知插件。模型通过一个工具即可"看
|
|
|
22
24
|
|
|
23
25
|
前置条件:
|
|
24
26
|
|
|
25
|
-
- DSH 宿主(Node ≥ 20
|
|
26
|
-
- `ffmpeg` 与 `ffprobe`
|
|
27
|
+
- DSH 宿主(Node ≥ 20)。
|
|
28
|
+
- `ffmpeg` 与 `ffprobe` 可执行文件。定位顺序:插件配置路径 → `DSH_FFMPEG_PATH` / `FFMPEG_PATH` → `DSH_FFMPEG_DIR` → `~/.dsh/tools/ffmpeg/bin` → `~/.dsh/bin` → `PATH`。
|
|
27
29
|
|
|
28
|
-
在 DSH 插件管理器中安装包 `dsh-pf-stream`。宿主经 `dsh.bundle.patch`(`cordis.patch.yml
|
|
30
|
+
在 DSH 插件管理器中安装包 `dsh-pf-stream`。宿主经 `dsh.bundle.patch`(`cordis.patch.yml`)挂载插件。peer 依赖 `@deepseek-ai/cordis` 与 `@deepseek-ai/schemastery` 由宿主运行时解析。运行时直接依赖仅 `pngjs`;画布 PNG 编码参数固定,输出字节幂等。
|
|
29
31
|
|
|
30
32
|
## 使用
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
流式感知(问「画面里写了什么」):
|
|
33
35
|
|
|
34
36
|
```json
|
|
35
37
|
{
|
|
@@ -38,7 +40,7 @@ DeepSeek Harness(DSH)视频感知插件。模型通过一个工具即可"看
|
|
|
38
40
|
}
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
定点复核(流式结果中 12.9s 处发现文字):
|
|
42
44
|
|
|
43
45
|
```json
|
|
44
46
|
{
|
|
@@ -51,17 +53,22 @@ DeepSeek Harness(DSH)视频感知插件。模型通过一个工具即可"看
|
|
|
51
53
|
}
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
顶层同时接受视频检视领域常见便捷字段:`start_time` / `end_time` / `timestamps` / `fps` / `interval` / `num_frames` / `crop` / `probe_only`。入口适配器将其归一化为标准 `intent` 结构。
|
|
55
57
|
|
|
56
58
|
## 返回内容
|
|
57
59
|
|
|
58
60
|
每次调用返回一个或多个画布包:
|
|
59
61
|
|
|
60
|
-
- **PNG
|
|
61
|
-
- **结构化元数据**:`packet_id`、每单元 PTS、token 网格 bbox、源采样 bbox、双载体 SHA-256
|
|
62
|
+
- **PNG 画布**:四形态之一(见下表)。单元间双色隔离线阻断相邻边缘特征串扰;可选超像素角标渲染单元编号。
|
|
63
|
+
- **结构化元数据**:`packet_id`、每单元 PTS、token 网格 bbox、源采样 bbox、双载体 SHA-256。
|
|
62
64
|
- **时序提示行**:模型可读的 P/F 单元时间轴(如 `[Packet #42 | Anchor: #105 | #101(P, 12.1s, Left-Top) → …]`)。
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
会话级能力:
|
|
67
|
+
|
|
68
|
+
- 意图跨调用持久化。
|
|
69
|
+
- 流式游标续窗:同视频下次调用从上次位置继续。
|
|
70
|
+
- 两级历史引用:热区最近 2 包整条带复用;冷区至多 4 个 F 锚点独立载体复用。
|
|
71
|
+
- Epoch Compaction:默认 6 包窗口批量热转冷,保持多轮对话 Prefix KV-Cache 前缀稳定。
|
|
65
72
|
|
|
66
73
|
## 画布与计费
|
|
67
74
|
|
|
@@ -86,8 +93,6 @@ DeepSeek Harness(DSH)视频感知插件。模型通过一个工具即可"看
|
|
|
86
93
|
| `epochCompactionWindow` | `6` | 热转冷批量收敛窗口(包数) |
|
|
87
94
|
| `meteringProfile.imageCountTiersEnabled` | `false` | ≥15 图单边 4096px 规则门控 |
|
|
88
95
|
|
|
89
|
-
完整配置、设计依据与 20 项工程边界验证方案见 `docs/dsh-pf-stream 技术设计方案.md`。
|
|
90
|
-
|
|
91
96
|
## 测试
|
|
92
97
|
|
|
93
98
|
```bash
|
|
@@ -96,6 +101,10 @@ pnpm run build # TypeScript 编译
|
|
|
96
101
|
pnpm verify:host # 宿主契约自检(Schema 形状/关键字子集/依赖边界)
|
|
97
102
|
```
|
|
98
103
|
|
|
104
|
+
## 发布
|
|
105
|
+
|
|
106
|
+
npm 发布由 GitHub Actions 自动执行。流程与版本策略见 [docs/发布规范.md](docs/发布规范.md)。
|
|
107
|
+
|
|
99
108
|
## 许可证
|
|
100
109
|
|
|
101
|
-
Apache-2.0
|
|
110
|
+
Apache-2.0。
|
package/cordis.patch.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-pf-stream",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "DeepSeek Harness video perception plugin: adaptive dual-scale streaming sampling plus deterministic inspection, aligned to the DeepSeek-V4.1-Flash vision pipeline (42px superpixel grid, <=1024 tokens per image).",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Weilv-D/dsh-pf-stream"
|
|
9
|
+
},
|
|
6
10
|
"main": "lib/index.js",
|
|
7
11
|
"types": "lib/index.d.ts",
|
|
8
12
|
"files": [
|
|
9
13
|
"lib",
|
|
10
14
|
"cordis.patch.yml",
|
|
11
15
|
"LICENSE",
|
|
12
|
-
"
|
|
16
|
+
"README.md",
|
|
17
|
+
"README.en.md"
|
|
13
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
|
+
"verify:host": "node scripts/verify-host-contract.mjs",
|
|
23
|
+
"check:package": "node scripts/check-package.mjs",
|
|
24
|
+
"test": "vitest run --passWithNoTests"
|
|
25
|
+
},
|
|
14
26
|
"peerDependencies": {
|
|
15
27
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
16
28
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
@@ -41,11 +53,5 @@
|
|
|
41
53
|
"vision",
|
|
42
54
|
"ffmpeg"
|
|
43
55
|
],
|
|
44
|
-
"license": "Apache-2.0"
|
|
45
|
-
|
|
46
|
-
"build": "tsc -p tsconfig.json",
|
|
47
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
48
|
-
"verify:host": "node scripts/verify-host-contract.mjs",
|
|
49
|
-
"test": "vitest run --passWithNoTests"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
56
|
+
"license": "Apache-2.0"
|
|
57
|
+
}
|
package/NOTICE
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
dsh-pf-stream
|
|
2
|
-
Copyright 2026 Weilv-D
|
|
3
|
-
|
|
4
|
-
This product is licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this product except in compliance with the License.
|
|
6
|
-
|
|
7
|
-
This product includes design references to the following open-source projects
|
|
8
|
-
(no source code is verbatim copied; refer to docs/dsh-pf-stream 技术设计方案.md
|
|
9
|
-
section 2.5 for the reference-reuse inventory):
|
|
10
|
-
|
|
11
|
-
- dsh-video-see (MIT) — probing, rotation parsing, frame-size planning patterns
|
|
12
|
-
- dsh-video-lens (MIT) — bounded-concurrency frame extraction patterns
|
|
13
|
-
- dsh-see-now (Apache-2.0) — rawvideo streaming pipeline and tool contract patterns
|