dsh-gallery 0.13.7 → 0.14.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 +64 -0
- package/README.md +120 -96
- package/client.js +4017 -3070
- package/host/feedback-text.js +18 -5
- package/host/protocol.js +57 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +86 -81
package/host/feedback-text.js
CHANGED
|
@@ -28,7 +28,7 @@ export const ACTIONS = [
|
|
|
28
28
|
export const ACTION_LABELS_ZH = {
|
|
29
29
|
approve: '通过',
|
|
30
30
|
reject: '不要这张',
|
|
31
|
-
finalize: '
|
|
31
|
+
finalize: '已定稿',
|
|
32
32
|
'redo-one-dim': '单维重做',
|
|
33
33
|
'regenerate-selected': '选择性重生成',
|
|
34
34
|
'set-reference': '设为参照',
|
|
@@ -38,7 +38,7 @@ export const ACTION_LABELS_ZH = {
|
|
|
38
38
|
export const ACTION_LABELS_EN = {
|
|
39
39
|
approve: 'approve',
|
|
40
40
|
reject: 'reject',
|
|
41
|
-
finalize: '
|
|
41
|
+
finalize: 'deliver',
|
|
42
42
|
'redo-one-dim': 'redo one dimension',
|
|
43
43
|
'regenerate-selected': 'regenerate',
|
|
44
44
|
'set-reference': 'set as reference',
|
|
@@ -145,7 +145,12 @@ export function renderFeedbackText(feedback, options) {
|
|
|
145
145
|
items.forEach((item, idx) => {
|
|
146
146
|
const n = idx + 1
|
|
147
147
|
const name = baseName(item.relPath)
|
|
148
|
-
const
|
|
148
|
+
const hasRegion = item.region !== undefined && item.region !== null
|
|
149
|
+
// 带框选区域的条目来自「框选批注」:动词写清楚是「只改这个框里的东西」,
|
|
150
|
+
// 比抽象动作名(单维重做)更贴近用户真正想说的话。
|
|
151
|
+
const verb = hasRegion
|
|
152
|
+
? (locale === 'en' ? 'Change the boxed area only' : '按框选区域修改')
|
|
153
|
+
: (labels[item.action] ?? item.action)
|
|
149
154
|
lines.push(`Annotation ${n}:${verb} —— ${name}`)
|
|
150
155
|
lines.push(`${locale === 'en' ? 'Path' : '路径'}:${item.relPath}`)
|
|
151
156
|
if (item.reason !== undefined) {
|
|
@@ -166,8 +171,16 @@ export function renderFeedbackText(feedback, options) {
|
|
|
166
171
|
? `preserve: ${item.preserve.join(' / ')}`
|
|
167
172
|
: `保留:${item.preserve.join(' / ')}`)
|
|
168
173
|
}
|
|
169
|
-
if (
|
|
170
|
-
|
|
174
|
+
if (hasRegion) {
|
|
175
|
+
// 人话百分比,别丢 JSON 给模型看:左上角 + 宽高,相对整张图
|
|
176
|
+
const pct = (v) => {
|
|
177
|
+
const num = Number(v)
|
|
178
|
+
return Number.isFinite(num) ? Math.round(Math.max(0, Math.min(1, num)) * 100) : 0
|
|
179
|
+
}
|
|
180
|
+
const r = item.region
|
|
181
|
+
lines.push(locale === 'en'
|
|
182
|
+
? `Region: left ${pct(r.x)}%, top ${pct(r.y)}%, width ${pct(r.w)}%, height ${pct(r.h)}% (relative to the whole image)`
|
|
183
|
+
: `区域:左 ${pct(r.x)}%、上 ${pct(r.y)}%,宽 ${pct(r.w)}%、高 ${pct(r.h)}%(相对整张图)`)
|
|
171
184
|
}
|
|
172
185
|
if (item.params !== undefined && item.params !== null) {
|
|
173
186
|
lines.push(`${locale === 'en' ? 'Params' : '参数'}:${JSON.stringify(item.params)}`)
|
package/host/protocol.js
CHANGED
|
@@ -23,3 +23,60 @@ export const VIDEO_EXTS = ['.mp4', '.webm', '.mov', '.m4v', '.mkv', '.avi', '.og
|
|
|
23
23
|
|
|
24
24
|
/** 音频扩展名。 */
|
|
25
25
|
export const AUDIO_EXTS = ['.mp3', '.wav', '.m4a', '.aac', '.flac', '.ogg', '.oga', '.opus', '.wma']
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 框选批注的坐标契约(v0.14.0)—— Host 与 Client 的唯一真源。
|
|
29
|
+
*
|
|
30
|
+
* 为什么用归一化坐标:批注要落在「图片的某个位置」上,而不是「屏幕上某个像素」。
|
|
31
|
+
* 写像素值的话,换个窗口尺寸 / 换个缩放比例就全错了。
|
|
32
|
+
* 用相对宽高的 0–1 比例,无论怎么缩放都能还原到同一块区域。
|
|
33
|
+
*
|
|
34
|
+
* 形状类型:
|
|
35
|
+
* rect —— 矩形框(最主要,圈出「这块不对」)
|
|
36
|
+
* arrow —— 箭头(指向具体某点)
|
|
37
|
+
* text —— 纯文字标注(钉在某位置,不带框)
|
|
38
|
+
*/
|
|
39
|
+
export const ANNOTATION_SHAPES = ["rect", "arrow", "text"]
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 一条批注的数据形态:
|
|
43
|
+
* {
|
|
44
|
+
* id: string, // 稳定 id(同一次会话内唯一)
|
|
45
|
+
* shape: "rect|arrow|text",
|
|
46
|
+
* x: number, y: number, // 起点,归一化 0–1
|
|
47
|
+
* w: number, h: number, // 宽高,归一化 0–1(text/arrow 可只用 x,y)
|
|
48
|
+
* note: string, // 人写的说明(可为空)
|
|
49
|
+
* frameMs: number|null, // 视频帧时间(图片为 null)
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* 约束:x/y/w/h 必须落在 [0,1];越界由写入端 clamp。
|
|
53
|
+
*/
|
|
54
|
+
export const ANNOTATION_LIMITS = { min: 0, max: 1, maxNoteLength: 500, maxPerAsset: 50 }
|
|
55
|
+
|
|
56
|
+
/** 把任意数值 clamp 到 [0,1](批注坐标写入前必须过一遍)。 */
|
|
57
|
+
export function clamp01(v) {
|
|
58
|
+
const n = Number(v)
|
|
59
|
+
if (!Number.isFinite(n)) return 0
|
|
60
|
+
if (n < 0) return 0
|
|
61
|
+
if (n > 1) return 1
|
|
62
|
+
return n
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** 校验并规整一条批注;不合法返回 null。 */
|
|
66
|
+
export function normalizeAnnotation(a) {
|
|
67
|
+
if (a === null || typeof a !== "object") return null
|
|
68
|
+
const shape = ANNOTATION_SHAPES.includes(a.shape) ? a.shape : "rect"
|
|
69
|
+
const note = typeof a.note === "string" ? a.note.slice(0, ANNOTATION_LIMITS.maxNoteLength) : ""
|
|
70
|
+
const x = clamp01(a.x)
|
|
71
|
+
const y = clamp01(a.y)
|
|
72
|
+
let w = clamp01(a.w)
|
|
73
|
+
let h = clamp01(a.h)
|
|
74
|
+
// 宽高至少留一点,且不越过右/下边界
|
|
75
|
+
if (w > 0 && x + w > 1) w = 1 - x
|
|
76
|
+
if (h > 0 && y + h > 1) h = 1 - y
|
|
77
|
+
const frameMs = Number.isFinite(a.frameMs) ? Math.max(0, Math.floor(a.frameMs)) : null
|
|
78
|
+
return {
|
|
79
|
+
id: typeof a.id === "string" && a.id !== "" ? a.id : ("a" + Math.random().toString(36).slice(2, 10)),
|
|
80
|
+
shape, x, y, w, h, note, frameMs,
|
|
81
|
+
}
|
|
82
|
+
}
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Output Gallery",
|
|
4
|
-
"description": "Fixes DSH reporting produced files only after a task ends: watches your output folders live with auto-refreshing
|
|
4
|
+
"description": "Fixes DSH reporting produced files only after a task ends: watches your output folders live with auto-refreshing thumbnails, native file preview, and in-panel media playback over HTTP Range, so you can verify and intervene mid-task. Above the automatic asset tags (final / intermediate / input) sits a human verdict layer (finalized / redo / archive) that persists, filters and applies in batches, overriding the machine guess; region annotations merge into a feedback basket and become a decision draft you approve before sending."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "产出画廊",
|
|
4
|
-
"description": "解决 DSH 只在任务结尾才列出产出、过程不可见的问题:实时监控产出目录,图片自动刷新、文件原生预览、音视频面板内直接播放(支持 HTTP Range
|
|
4
|
+
"description": "解决 DSH 只在任务结尾才列出产出、过程不可见的问题:实时监控产出目录,图片自动刷新、文件原生预览、音视频面板内直接播放(支持 HTTP Range,任意大小都能拖进度条),任务进行中就能校验纠正。自动标签(成稿/过程稿/素材)之上还有一层人的表态(已定稿/要重做/留档),结论落盘、可筛可批量,且优先于机器预判;图上圈选批注并入反馈篮,攒成决策草稿由人确认后送回对话。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,81 +1,86 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-gallery",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "产出画廊:图片 / 文件 /
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Hope2023Dcr/dsh-gallery.git"
|
|
9
|
-
},
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/Hope2023Dcr/dsh-gallery/issues"
|
|
12
|
-
},
|
|
13
|
-
"homepage": "https://github.com/Hope2023Dcr/dsh-gallery#readme",
|
|
14
|
-
"exports": {
|
|
15
|
-
".": "./index.js",
|
|
16
|
-
"./client": "./client.js",
|
|
17
|
-
"./locale/*.json": "./locale/*.json",
|
|
18
|
-
"./icon": "./icon.svg"
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"index.js",
|
|
22
|
-
"client.js",
|
|
23
|
-
"session-index.js",
|
|
24
|
-
"host/*.js",
|
|
25
|
-
"cordis.patch.yml",
|
|
26
|
-
"locale/*.json",
|
|
27
|
-
"icon.svg",
|
|
28
|
-
"README.md",
|
|
29
|
-
"LICENSE",
|
|
30
|
-
"CHANGELOG.md"
|
|
31
|
-
],
|
|
32
|
-
"dsh": {
|
|
33
|
-
"bundle": {
|
|
34
|
-
"patch": "./cordis.patch.yml"
|
|
35
|
-
},
|
|
36
|
-
"client": {
|
|
37
|
-
"platform": "web",
|
|
38
|
-
"immediately": true,
|
|
39
|
-
"inject": [
|
|
40
|
-
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
|
41
|
-
"@deepseek-ai/dsh-client-locale"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"author": {
|
|
46
|
-
"name": "Hope2023Dcr"
|
|
47
|
-
},
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"keywords": [
|
|
50
|
-
"dsh-plugin",
|
|
51
|
-
"deepseek-harness",
|
|
52
|
-
"dsh",
|
|
53
|
-
"output-gallery",
|
|
54
|
-
"image-gallery",
|
|
55
|
-
"file-preview",
|
|
56
|
-
"sidebar-plugin",
|
|
57
|
-
"agent-tools",
|
|
58
|
-
"media-gallery",
|
|
59
|
-
"video-preview",
|
|
60
|
-
"audio-preview",
|
|
61
|
-
"range-seek",
|
|
62
|
-
"filter",
|
|
63
|
-
"deliverable",
|
|
64
|
-
"confirm",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
}
|
|
81
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-gallery",
|
|
3
|
+
"version": "0.14.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "产出画廊:图片 / 文件 / 音视频实时可见与当场校验;机器标签(成稿/过程稿/素材)之上有一层人的表态定性(已定稿 / 要重做 / 留档),结论落盘、可筛、可批量,且优先于机器预判;图上圈选批注并入反馈篮,攒成决策草稿,由人确认后送回对话。Output gallery for DeepSeek Harness: live media gallery with a human verdict layer (final / redo / archive) above automatic asset tags, batch actions, and region annotations merged into human-approved decision drafts.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Hope2023Dcr/dsh-gallery.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/Hope2023Dcr/dsh-gallery/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/Hope2023Dcr/dsh-gallery#readme",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./index.js",
|
|
16
|
+
"./client": "./client.js",
|
|
17
|
+
"./locale/*.json": "./locale/*.json",
|
|
18
|
+
"./icon": "./icon.svg"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"client.js",
|
|
23
|
+
"session-index.js",
|
|
24
|
+
"host/*.js",
|
|
25
|
+
"cordis.patch.yml",
|
|
26
|
+
"locale/*.json",
|
|
27
|
+
"icon.svg",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"CHANGELOG.md"
|
|
31
|
+
],
|
|
32
|
+
"dsh": {
|
|
33
|
+
"bundle": {
|
|
34
|
+
"patch": "./cordis.patch.yml"
|
|
35
|
+
},
|
|
36
|
+
"client": {
|
|
37
|
+
"platform": "web",
|
|
38
|
+
"immediately": true,
|
|
39
|
+
"inject": [
|
|
40
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
|
41
|
+
"@deepseek-ai/dsh-client-locale"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"author": {
|
|
46
|
+
"name": "Hope2023Dcr"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"dsh-plugin",
|
|
51
|
+
"deepseek-harness",
|
|
52
|
+
"dsh",
|
|
53
|
+
"output-gallery",
|
|
54
|
+
"image-gallery",
|
|
55
|
+
"file-preview",
|
|
56
|
+
"sidebar-plugin",
|
|
57
|
+
"agent-tools",
|
|
58
|
+
"media-gallery",
|
|
59
|
+
"video-preview",
|
|
60
|
+
"audio-preview",
|
|
61
|
+
"range-seek",
|
|
62
|
+
"filter",
|
|
63
|
+
"deliverable",
|
|
64
|
+
"confirm",
|
|
65
|
+
"verdict",
|
|
66
|
+
"conclusion",
|
|
67
|
+
"decision",
|
|
68
|
+
"human-in-the-loop",
|
|
69
|
+
"asset-tags",
|
|
70
|
+
"batch",
|
|
71
|
+
"region-selection",
|
|
72
|
+
"annotation"
|
|
73
|
+
],
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public",
|
|
76
|
+
"registry": "https://registry.npmjs.org/"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=20"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"build": "node scripts/build.mjs",
|
|
83
|
+
"check": "node scripts/check.mjs",
|
|
84
|
+
"test": "node --test tests/contract/install-whitelist.test.mjs"
|
|
85
|
+
}
|
|
86
|
+
}
|