@mengruo/dsh-vision-toolkit 0.0.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +356 -0
- package/README.zh.md +354 -0
- package/assets/community-group-qr.png +0 -0
- package/assets/dsh-conversation-artifact.png +0 -0
- package/assets/dsh-conversation-image-qa-top.png +0 -0
- package/assets/dsh-conversation-image-qa.png +0 -0
- package/assets/dsh-conversation-pixel-diff.png +0 -0
- package/assets/dsh-conversation-screenshot-debugging-top.png +0 -0
- package/assets/dsh-conversation-screenshot-debugging.png +0 -0
- package/assets/dsh-conversation-tool-call.png +0 -0
- package/assets/dsh-conversation-vision-trace.png +0 -0
- package/assets/dsh-view-example.png +0 -0
- package/assets/hero-v2.png +0 -0
- package/assets/logo_aihubmix.png +0 -0
- package/assets/python-bootstrap.json +48 -0
- package/assets/skill/SKILL.md +329 -0
- package/assets/skill/UPSTREAM.json +71 -0
- package/assets/skill/references/gui.md +88 -0
- package/assets/skill/references/long-screenshot-ocr.md +77 -0
- package/assets/skill/references/restore-graphic.md +84 -0
- package/assets/skill/references/restore-structure.md +45 -0
- package/assets/skill/references/restore-ui.md +202 -0
- package/assets/social-preview.png +0 -0
- package/assets/upstream/README.md +18 -0
- package/assets/upstream/focus-hint-comparison-1.webp +0 -0
- package/assets/upstream/focus-hint-comparison-2.webp +0 -0
- package/assets/upstream/infographic-reference.webp +0 -0
- package/assets/upstream/infographic-result.webp +0 -0
- package/assets/upstream/ui-fast-restore-reference.webp +0 -0
- package/assets/upstream/ui-fast-restore-result.webp +0 -0
- package/assets/upstream/ui-result.webp +0 -0
- package/assets/upstream/ui-sketch.webp +0 -0
- package/assets/vision-model-test.png +0 -0
- package/assets/vision-settings.png +0 -0
- package/assets/wechat-reward.png +0 -0
- package/cordis.patch.yml +6 -0
- package/docs/aihubmix-gemini-vision.i18n.yaml +6 -0
- package/docs/aihubmix-gemini-vision.md +138 -0
- package/docs/aihubmix-gemini-vision.zh.md +138 -0
- package/docs/assets/aihubmix-api-keys.png +0 -0
- package/docs/assets/aihubmix-create-key.png +0 -0
- package/docs/assets/aihubmix-free-vision-model.png +0 -0
- package/docs/assets/aihubmix-home.png +0 -0
- package/docs/assets/aihubmix-sign-up.png +0 -0
- package/docs/assets/groq-console-home.png +0 -0
- package/docs/assets/groq-console-keys-login.png +0 -0
- package/docs/assets/groq-docs-quickstart.png +0 -0
- package/docs/assets/groq-docs-qwen3.6.png +0 -0
- package/docs/assets/groq-docs-vision.png +0 -0
- package/docs/assets/vision-settings.png +0 -0
- package/docs/dsh-desktop-install.md +67 -0
- package/docs/dsh-desktop-install.zh.md +67 -0
- package/docs/groq-qwen3.6-vision.i18n.yaml +6 -0
- package/docs/groq-qwen3.6-vision.md +236 -0
- package/docs/groq-qwen3.6-vision.zh.md +236 -0
- package/docs/python-runtime.i18n.yaml +6 -0
- package/docs/python-runtime.md +89 -0
- package/docs/python-runtime.zh.md +89 -0
- package/docs/requirements-traceability/README.i18n.yaml +6 -0
- package/docs/requirements-traceability/README.md +75 -0
- package/docs/requirements-traceability/README.zh.md +75 -0
- package/examples/ui-restoration/README.i18n.yaml +6 -0
- package/examples/ui-restoration/README.md +70 -0
- package/examples/ui-restoration/README.zh.md +70 -0
- package/examples/ui-restoration/assets/final-heatmap.png +0 -0
- package/examples/ui-restoration/assets/final-report.json +83 -0
- package/examples/ui-restoration/assets/implementation.png +0 -0
- package/examples/ui-restoration/assets/initial-heatmap.png +0 -0
- package/examples/ui-restoration/assets/initial-report.json +83 -0
- package/examples/ui-restoration/assets/initial.png +0 -0
- package/examples/ui-restoration/assets/metrics.json +12 -0
- package/examples/ui-restoration/assets/reference.png +0 -0
- package/examples/ui-restoration/implementation.html +94 -0
- package/examples/ui-restoration/initial.html +57 -0
- package/lib/artifact-access.js +369 -0
- package/lib/artifact-access.js.map +1 -0
- package/lib/artifacts.js +56 -0
- package/lib/artifacts.js.map +1 -0
- package/lib/client.js +2099 -0
- package/lib/client.js.map +1 -0
- package/lib/config.js +172 -0
- package/lib/config.js.map +1 -0
- package/lib/defaults.js +6 -0
- package/lib/defaults.js.map +1 -0
- package/lib/errors.js +56 -0
- package/lib/errors.js.map +1 -0
- package/lib/evidence-cache.js +350 -0
- package/lib/evidence-cache.js.map +1 -0
- package/lib/exposure.js +247 -0
- package/lib/exposure.js.map +1 -0
- package/lib/image-input-variants.js +882 -0
- package/lib/image-input-variants.js.map +1 -0
- package/lib/index.js +105 -0
- package/lib/index.js.map +1 -0
- package/lib/paste-images.js +217 -0
- package/lib/paste-images.js.map +1 -0
- package/lib/paths.js +354 -0
- package/lib/paths.js.map +1 -0
- package/lib/plugin-update.js +1003 -0
- package/lib/plugin-update.js.map +1 -0
- package/lib/runtime-install.js +964 -0
- package/lib/runtime-install.js.map +1 -0
- package/lib/runtime-manager.js +133 -0
- package/lib/runtime-manager.js.map +1 -0
- package/lib/runtime.js +1678 -0
- package/lib/runtime.js.map +1 -0
- package/lib/skill.js +25 -0
- package/lib/skill.js.map +1 -0
- package/lib/tools.js +549 -0
- package/lib/tools.js.map +1 -0
- package/lib/types/artifact-access.d.ts +61 -0
- package/lib/types/artifact-access.d.ts.map +1 -0
- package/lib/types/artifacts.d.ts +42 -0
- package/lib/types/artifacts.d.ts.map +1 -0
- package/lib/types/client/display-config.d.ts +24 -0
- package/lib/types/client/display-config.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +350 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/model-variants-hider.d.ts +40 -0
- package/lib/types/client/model-variants-hider.d.ts.map +1 -0
- package/lib/types/client/paste-images.d.ts +126 -0
- package/lib/types/client/paste-images.d.ts.map +1 -0
- package/lib/types/config.d.ts +123 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/defaults.d.ts +6 -0
- package/lib/types/defaults.d.ts.map +1 -0
- package/lib/types/errors.d.ts +35 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/evidence-cache.d.ts +91 -0
- package/lib/types/evidence-cache.d.ts.map +1 -0
- package/lib/types/exposure.d.ts +50 -0
- package/lib/types/exposure.d.ts.map +1 -0
- package/lib/types/image-input-variants.d.ts +144 -0
- package/lib/types/image-input-variants.d.ts.map +1 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/paste-images.d.ts +73 -0
- package/lib/types/paste-images.d.ts.map +1 -0
- package/lib/types/paths.d.ts +117 -0
- package/lib/types/paths.d.ts.map +1 -0
- package/lib/types/plugin-update.d.ts +119 -0
- package/lib/types/plugin-update.d.ts.map +1 -0
- package/lib/types/runtime-install.d.ts +92 -0
- package/lib/types/runtime-install.d.ts.map +1 -0
- package/lib/types/runtime-manager.d.ts +60 -0
- package/lib/types/runtime-manager.d.ts.map +1 -0
- package/lib/types/runtime.d.ts +412 -0
- package/lib/types/runtime.d.ts.map +1 -0
- package/lib/types/skill.d.ts +14 -0
- package/lib/types/skill.d.ts.map +1 -0
- package/lib/types/tools.d.ts +35 -0
- package/lib/types/tools.d.ts.map +1 -0
- package/lib/types/upstream.d.ts +233 -0
- package/lib/types/upstream.d.ts.map +1 -0
- package/lib/types/version.d.ts +15 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/web-request.d.ts +11 -0
- package/lib/types/web-request.d.ts.map +1 -0
- package/lib/types/web.d.ts +118 -0
- package/lib/types/web.d.ts.map +1 -0
- package/lib/upstream.js +860 -0
- package/lib/upstream.js.map +1 -0
- package/lib/version.js +18 -0
- package/lib/version.js.map +1 -0
- package/lib/web-request.js +29 -0
- package/lib/web-request.js.map +1 -0
- package/lib/web.js +462 -0
- package/lib/web.js.map +1 -0
- package/package.json +149 -0
- package/patches/vision-tools-dsh.patch +970 -0
- package/runtime/requirements.lock +3 -0
- package/src/artifact-access.ts +386 -0
- package/src/artifacts.ts +85 -0
- package/src/client/display-config.ts +62 -0
- package/src/client/index.tsx +1580 -0
- package/src/client/model-variants-hider.ts +159 -0
- package/src/client/paste-images.tsx +747 -0
- package/src/config.ts +290 -0
- package/src/defaults.ts +5 -0
- package/src/errors.ts +62 -0
- package/src/evidence-cache.ts +418 -0
- package/src/exposure.ts +265 -0
- package/src/image-input-variants.ts +996 -0
- package/src/index.ts +141 -0
- package/src/paste-images.ts +286 -0
- package/src/paths.ts +383 -0
- package/src/plugin-update.ts +1143 -0
- package/src/runtime-install.ts +1161 -0
- package/src/runtime-manager.ts +174 -0
- package/src/runtime.ts +2189 -0
- package/src/skill.ts +35 -0
- package/src/tools.ts +691 -0
- package/src/upstream.ts +1078 -0
- package/src/version.ts +37 -0
- package/src/web-request.ts +27 -0
- package/src/web.ts +594 -0
- package/vendor/agent-vision-toolkit/CHANGELOG.md +30 -0
- package/vendor/agent-vision-toolkit/LICENSE +21 -0
- package/vendor/agent-vision-toolkit/README.md +405 -0
- package/vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json +94 -0
- package/vendor/agent-vision-toolkit/bin/crop +90 -0
- package/vendor/agent-vision-toolkit/bin/detect +13 -0
- package/vendor/agent-vision-toolkit/bin/glance +93 -0
- package/vendor/agent-vision-toolkit/bin/ground +13 -0
- package/vendor/agent-vision-toolkit/bin/trace +129 -0
- package/vendor/agent-vision-toolkit/detect.py +60 -0
- package/vendor/agent-vision-toolkit/ground.py +267 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/dominant_colors.py +224 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/extract_fg.py +278 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/html_shot.py +420 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/long_screenshot_ocr.py +1245 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/pixel_diff.py +88 -0
- package/vendor/agent-vision-toolkit/tests/test_vision_client.py +450 -0
- package/vendor/agent-vision-toolkit/vision_client.py +310 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured adapter over the pinned agent-vision-toolkit snapshot. Every
|
|
3
|
+
* invocation is an argv vector through DSH Subprocess, runs from a clean home
|
|
4
|
+
* so upstream env files cannot override DSH configuration, and converts the
|
|
5
|
+
* pinned CLI contracts into stable data.
|
|
6
|
+
* @module dsh-vision-toolkit/upstream
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
import type { SubprocessOutcome } from '@deepseek-ai/dsh-subprocess';
|
|
10
|
+
import type { ResolvedVisionToolkitConfig } from './config.ts';
|
|
11
|
+
import { VisionToolkitError } from './errors.ts';
|
|
12
|
+
import { type PreparedUpstreamRuntime } from './runtime-install.ts';
|
|
13
|
+
/** One pinned upstream CLI/script exposed by the runtime. */
|
|
14
|
+
export type UpstreamTool = 'glance' | 'ground' | 'detect' | 'crop' | 'trace' | 'pixel_diff' | 'long_screenshot_ocr' | 'extract_foreground' | 'dominant_colors' | 'html_screenshot';
|
|
15
|
+
/** Vision configuration forwarded only to upstream commands that call the API. */
|
|
16
|
+
export interface UpstreamEnvironment {
|
|
17
|
+
VISION_API_KEY: string;
|
|
18
|
+
VISION_BASE_URL: string;
|
|
19
|
+
VISION_MODEL: string;
|
|
20
|
+
VISION_API_PROTOCOL: 'chat_completions' | 'anthropic';
|
|
21
|
+
VISION_ANTHROPIC_THINKING: 'omit' | 'disabled' | 'adaptive';
|
|
22
|
+
VISION_SSL_VERIFY?: string;
|
|
23
|
+
VISION_USER_AGENT: string;
|
|
24
|
+
LANG: 'zh' | 'en';
|
|
25
|
+
}
|
|
26
|
+
/** Pinned upstream identity plus prepared runtime facts. */
|
|
27
|
+
export interface UpstreamVersionInfo {
|
|
28
|
+
repository: string;
|
|
29
|
+
version: string;
|
|
30
|
+
commit: string;
|
|
31
|
+
path: string;
|
|
32
|
+
source: 'managed' | 'external';
|
|
33
|
+
python: string;
|
|
34
|
+
pythonVersion: string;
|
|
35
|
+
dependencies: Record<string, string>;
|
|
36
|
+
runtimeHome: string;
|
|
37
|
+
}
|
|
38
|
+
/** Settled upstream process facts plus bounded output. */
|
|
39
|
+
export interface UpstreamRunResult {
|
|
40
|
+
stdout: string;
|
|
41
|
+
stderr: string;
|
|
42
|
+
stdoutTruncated: boolean;
|
|
43
|
+
stderrTruncated: boolean;
|
|
44
|
+
outcome: SubprocessOutcome;
|
|
45
|
+
}
|
|
46
|
+
/** Pixel box in original-image coordinates. */
|
|
47
|
+
export interface PixelBox {
|
|
48
|
+
x1: number;
|
|
49
|
+
y1: number;
|
|
50
|
+
x2: number;
|
|
51
|
+
y2: number;
|
|
52
|
+
}
|
|
53
|
+
/** One ground/detect match line converted to structure. */
|
|
54
|
+
export interface LocatedElement {
|
|
55
|
+
label?: string;
|
|
56
|
+
box: PixelBox;
|
|
57
|
+
}
|
|
58
|
+
/** Parsed crop CLI result. */
|
|
59
|
+
export interface CropOutput {
|
|
60
|
+
outputPath: string;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
clamped: boolean;
|
|
64
|
+
note?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Parsed trace CLI result from the pinned vtracer implementation. */
|
|
67
|
+
export interface TraceOutput {
|
|
68
|
+
outputPath: string;
|
|
69
|
+
bytes: number;
|
|
70
|
+
pathCount: number;
|
|
71
|
+
tracedScale: number;
|
|
72
|
+
}
|
|
73
|
+
/** Parsed local pixel-diff report. */
|
|
74
|
+
export interface PixelDiffOutput {
|
|
75
|
+
scaled: boolean;
|
|
76
|
+
rebuiltOriginalSize?: {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
};
|
|
80
|
+
scaledToSize?: {
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
};
|
|
84
|
+
overallDifferencePct: number;
|
|
85
|
+
heatmapPath: string;
|
|
86
|
+
worstRegions: Array<{
|
|
87
|
+
index: number;
|
|
88
|
+
differencePct: number;
|
|
89
|
+
box: PixelBox;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
/** Parsed transparent foreground extraction report. */
|
|
93
|
+
export interface ExtractForegroundOutput {
|
|
94
|
+
box: PixelBox;
|
|
95
|
+
foregroundPixels: number;
|
|
96
|
+
keptComponents: number;
|
|
97
|
+
totalComponents: number;
|
|
98
|
+
largestComponentPct: number;
|
|
99
|
+
outputPath: string;
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
autoSummary?: string;
|
|
103
|
+
}
|
|
104
|
+
/** One significant palette cluster from `dominant_colors.py`. */
|
|
105
|
+
export interface DominantColorCluster {
|
|
106
|
+
color: string;
|
|
107
|
+
sharePct: number;
|
|
108
|
+
}
|
|
109
|
+
/** One candidate-scoring row from `dominant_colors.py`. */
|
|
110
|
+
export interface DominantColorCandidate {
|
|
111
|
+
color: string;
|
|
112
|
+
sharePct: number;
|
|
113
|
+
meanDistance: number;
|
|
114
|
+
weightedScorePct: number;
|
|
115
|
+
winner: boolean;
|
|
116
|
+
}
|
|
117
|
+
/** Structured dominant-colour result in palette or candidate mode. */
|
|
118
|
+
export type DominantColorsOutput = {
|
|
119
|
+
mode: 'palette';
|
|
120
|
+
region: PixelBox;
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
requestedTop: number;
|
|
124
|
+
clusterCount: number;
|
|
125
|
+
mergeTolerance: number;
|
|
126
|
+
colors: DominantColorCluster[];
|
|
127
|
+
} | {
|
|
128
|
+
mode: 'candidates';
|
|
129
|
+
region: PixelBox;
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
sampledPixels: number;
|
|
133
|
+
candidates: DominantColorCandidate[];
|
|
134
|
+
winner: string;
|
|
135
|
+
matchedWithinTolerance: boolean;
|
|
136
|
+
closestCandidate?: string;
|
|
137
|
+
note?: string;
|
|
138
|
+
};
|
|
139
|
+
/** Parsed local HTML screenshot result. */
|
|
140
|
+
export interface HtmlScreenshotOutput {
|
|
141
|
+
outputPath: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
pageHeight?: number;
|
|
145
|
+
}
|
|
146
|
+
/** Result of one automatic Pillow compression pass for an oversized image. */
|
|
147
|
+
export interface CompressedImageInfo {
|
|
148
|
+
bytes: number;
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
format: 'png' | 'jpeg' | 'gif' | 'webp';
|
|
152
|
+
mode: string;
|
|
153
|
+
lossy: boolean;
|
|
154
|
+
resized: boolean;
|
|
155
|
+
candidate: string;
|
|
156
|
+
/** True when the source image had multiple animation frames. */
|
|
157
|
+
sourceAnimated: boolean;
|
|
158
|
+
}
|
|
159
|
+
/** Parse one numbered upstream location line (`N. position label x1: ..., ...`). */
|
|
160
|
+
export declare function parseLocationLine(line: string): LocatedElement | undefined;
|
|
161
|
+
/** Parse ground/detect stdout; non-empty unknown lines are an output contract failure. */
|
|
162
|
+
export declare function parseLocationOutput(stdout: string): LocatedElement[];
|
|
163
|
+
/** Parse the crop CLI's `wrote <path> (WxH)` line and clamp note. */
|
|
164
|
+
export declare function parseCropOutput(stdout: string, stderr: string): CropOutput;
|
|
165
|
+
/** Parse the pinned trace CLI's written-file summary. */
|
|
166
|
+
export declare function parseTraceOutput(stdout: string): TraceOutput;
|
|
167
|
+
/** Parse the complete `pixel_diff.py` stdout contract. */
|
|
168
|
+
export declare function parsePixelDiffOutput(stdout: string): PixelDiffOutput;
|
|
169
|
+
/** Parse the complete `extract_fg.py` stdout contract. */
|
|
170
|
+
export declare function parseExtractForegroundOutput(stdout: string): ExtractForegroundOutput;
|
|
171
|
+
/** Parse palette and candidate modes from `dominant_colors.py`. */
|
|
172
|
+
export declare function parseDominantColorsOutput(stdout: string): DominantColorsOutput;
|
|
173
|
+
/** Parse the local Chrome screenshot summary. */
|
|
174
|
+
export declare function parseHtmlScreenshotOutput(stdout: string): HtmlScreenshotOutput;
|
|
175
|
+
/** Find the first candidate with the five pinned core CLI entrypoints. */
|
|
176
|
+
export declare function findCheckout(candidates: readonly string[]): Promise<string>;
|
|
177
|
+
/** Adapter over one prepared pinned upstream runtime. */
|
|
178
|
+
export declare class UpstreamAdapter {
|
|
179
|
+
private readonly ctx;
|
|
180
|
+
private readonly config;
|
|
181
|
+
private prepared;
|
|
182
|
+
constructor(ctx: Context, config: ResolvedVisionToolkitConfig, prepared?: PreparedUpstreamRuntime);
|
|
183
|
+
/** Upstream identity reported to tools and logs. */
|
|
184
|
+
get versionInfo(): UpstreamVersionInfo;
|
|
185
|
+
private requirePrepared;
|
|
186
|
+
/** Verify and prepare the configured source plus Python dependencies. */
|
|
187
|
+
prepare(): Promise<void>;
|
|
188
|
+
/** Run one upstream CLI without a shell. */
|
|
189
|
+
run(tool: UpstreamTool, args: readonly string[], options: {
|
|
190
|
+
signal: AbortSignal;
|
|
191
|
+
env?: UpstreamEnvironment;
|
|
192
|
+
}): Promise<UpstreamRunResult>;
|
|
193
|
+
/** Read image dimensions through the prepared Pillow dependency. */
|
|
194
|
+
probeImageSize(imagePath: string, options: {
|
|
195
|
+
signal: AbortSignal;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
width: number;
|
|
198
|
+
height: number;
|
|
199
|
+
format: string;
|
|
200
|
+
mode: string;
|
|
201
|
+
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Auto-compress one oversized image under the configured byte and pixel
|
|
204
|
+
* budgets. The Pillow helper prefers lossless re-encodes, then quality
|
|
205
|
+
* reduction, and only downscales when neither can reach the budget.
|
|
206
|
+
*/
|
|
207
|
+
compressImage(sourcePath: string, destPath: string, maxBytes: number, maxPixels: number, options: {
|
|
208
|
+
signal: AbortSignal;
|
|
209
|
+
}): Promise<CompressedImageInfo>;
|
|
210
|
+
private runPythonCode;
|
|
211
|
+
/** Draw validated pixel boxes and labels into a PNG preview with Pillow. */
|
|
212
|
+
renderAnnotatedPreview(imagePath: string, outputPath: string, elements: readonly LocatedElement[], options: {
|
|
213
|
+
signal: AbortSignal;
|
|
214
|
+
}): Promise<void>;
|
|
215
|
+
/** Locate the same optional Chrome-family browser the pinned HTML script uses. */
|
|
216
|
+
findChrome(options: {
|
|
217
|
+
signal: AbortSignal;
|
|
218
|
+
}): Promise<string | undefined>;
|
|
219
|
+
private collect;
|
|
220
|
+
/** Report the pinned snapshot identity. */
|
|
221
|
+
readCheckoutVersion(): Promise<string>;
|
|
222
|
+
/** Whether the prepared snapshot carries one optional script path. */
|
|
223
|
+
hasScript(name: string): Promise<boolean>;
|
|
224
|
+
/** Read one prepared upstream text file for diagnostics or compatibility tests. */
|
|
225
|
+
readText(relativePath: readonly string[]): Promise<string>;
|
|
226
|
+
/** Turn a failed run into a model-safe classified error. */
|
|
227
|
+
classifyFailure(tool: UpstreamTool, result: UpstreamRunResult, options: {
|
|
228
|
+
timedOut: boolean;
|
|
229
|
+
cancelled: boolean;
|
|
230
|
+
secrets?: readonly string[];
|
|
231
|
+
}): VisionToolkitError;
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=upstream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upstream.d.ts","sourceRoot":"","sources":["../../src/upstream.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACtF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAA;AACxE,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAA;AAG7B,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,YAAY,GACZ,qBAAqB,GACrB,oBAAoB,GACpB,iBAAiB,GACjB,iBAAiB,CAAA;AAErB,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE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Y,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKhE,4DAA4D;IAC5D,eAAe,CACb,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAC9E,kBAAkB;CA8BtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin and pinned upstream version facts. The upstream snapshot is fixed at
|
|
3
|
+
* build time and recorded in package.json's `dsh.visionToolkit` metadata so
|
|
4
|
+
* the runtime, tool results, and docs all report the same source commit.
|
|
5
|
+
* @module dsh-vision-toolkit/version
|
|
6
|
+
*/
|
|
7
|
+
/** Plugin package version. */
|
|
8
|
+
export declare const PLUGIN_VERSION: string;
|
|
9
|
+
/** Pinned upstream repository URL. */
|
|
10
|
+
export declare const UPSTREAM_REPOSITORY: string;
|
|
11
|
+
/** Pinned upstream release tag. */
|
|
12
|
+
export declare const UPSTREAM_VERSION: string;
|
|
13
|
+
/** Pinned upstream source commit. */
|
|
14
|
+
export declare const UPSTREAM_COMMIT: string;
|
|
15
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,8BAA8B;AAC9B,eAAO,MAAM,cAAc,QAAmB,CAAA;AAE9C,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,QAAyF,CAAA;AAEzH,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,QAA8D,CAAA;AAE3F,qCAAqC;AACrC,eAAO,MAAM,eAAe,QAA8E,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* Accept a request only from the DSH Web application's origin. Method-agnostic:
|
|
4
|
+
* the same fence guards state-changing POSTs and policy GETs.
|
|
5
|
+
* @param req - the incoming request whose headers carry the origin evidence.
|
|
6
|
+
* @returns whether the request may be answered.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sameOriginRequest(req: IncomingMessage): boolean;
|
|
9
|
+
/** Accept state-changing requests only from the DSH Web application's origin. */
|
|
10
|
+
export declare function sameOriginPost(req: IncomingMessage): boolean;
|
|
11
|
+
//# sourceMappingURL=web-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-request.d.ts","sourceRoot":"","sources":["../../src/web-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAa/D;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAE5D"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional Web-profile routes: signed Artifact delivery plus a same-origin
|
|
3
|
+
* Settings/health endpoint. The browser never receives credential values and
|
|
4
|
+
* connection tests run only after an explicit POST action.
|
|
5
|
+
* @module dsh-vision-toolkit/web
|
|
6
|
+
*/
|
|
7
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
import { ArtifactAccessController } from './artifact-access.ts';
|
|
10
|
+
import { PastedImageBackend, type PasteSelectionQuery, type PasteVerdict } from './paste-images.ts';
|
|
11
|
+
import { type VisionToolkitConfig } from './config.ts';
|
|
12
|
+
import { type PluginUpdateCapability, type PluginUpdateCheck, type PluginUpdateResult } from './plugin-update.ts';
|
|
13
|
+
import { VisionToolkitRuntimeManager, type PreparedRuntimeGeneration, type RuntimeManagerStatus } from './runtime-manager.ts';
|
|
14
|
+
/** Exact route used by the browser Settings page. */
|
|
15
|
+
export declare const SETTINGS_ROUTE = "/_dsh/vision-toolkit/settings";
|
|
16
|
+
/** Same-origin route used by the browser client to read display-mode flags. */
|
|
17
|
+
export declare const DISPLAY_CONFIG_ROUTE = "/_dsh/vision-toolkit/display-config";
|
|
18
|
+
/** Public Settings snapshot; credential values are deliberately impossible here. */
|
|
19
|
+
export interface VisionToolkitSettingsSnapshot {
|
|
20
|
+
schemaVersion: 1;
|
|
21
|
+
writable: boolean;
|
|
22
|
+
settings: {
|
|
23
|
+
value: VisionToolkitConfig;
|
|
24
|
+
user?: unknown;
|
|
25
|
+
base?: unknown;
|
|
26
|
+
revision: number;
|
|
27
|
+
applies: 'live';
|
|
28
|
+
};
|
|
29
|
+
credential: {
|
|
30
|
+
ref: string;
|
|
31
|
+
configured: boolean;
|
|
32
|
+
source?: string;
|
|
33
|
+
writable: boolean;
|
|
34
|
+
};
|
|
35
|
+
runtime: RuntimeManagerStatus;
|
|
36
|
+
release: {
|
|
37
|
+
pluginVersion: string;
|
|
38
|
+
upstreamRepository: string;
|
|
39
|
+
upstreamVersion: string;
|
|
40
|
+
upstreamCommit: string;
|
|
41
|
+
update: PluginUpdateCapability;
|
|
42
|
+
};
|
|
43
|
+
artifactRouteAvailable: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Minimal runtime-manager face used by the Web route and its tests. */
|
|
46
|
+
export interface WebRuntimeManager {
|
|
47
|
+
readonly ready: boolean;
|
|
48
|
+
current(): ReturnType<VisionToolkitRuntimeManager['current']>;
|
|
49
|
+
prepareCandidate(raw: VisionToolkitConfig): Promise<PreparedRuntimeGeneration>;
|
|
50
|
+
activateCandidate(candidate: PreparedRuntimeGeneration): void;
|
|
51
|
+
recordFailure(error: unknown): void;
|
|
52
|
+
status(): RuntimeManagerStatus;
|
|
53
|
+
}
|
|
54
|
+
/** Minimal self-update face used by the Web route and its tests. */
|
|
55
|
+
export interface WebPluginUpdater {
|
|
56
|
+
configureWebServer?(host: string, port: number): void;
|
|
57
|
+
capability(): Promise<PluginUpdateCapability>;
|
|
58
|
+
check(): Promise<PluginUpdateCheck>;
|
|
59
|
+
installAndRestart(expectedVersion: string): Promise<PluginUpdateResult>;
|
|
60
|
+
}
|
|
61
|
+
/** Callback invoked when a Settings save makes the first runtime available. */
|
|
62
|
+
export type RuntimeActivated = () => void;
|
|
63
|
+
/** Same-origin Settings and health handler. */
|
|
64
|
+
export declare class VisionToolkitWebBackend {
|
|
65
|
+
private readonly ctx;
|
|
66
|
+
private readonly manager;
|
|
67
|
+
private readonly artifacts;
|
|
68
|
+
private readonly onRuntimeActivated;
|
|
69
|
+
private readonly updater;
|
|
70
|
+
constructor(ctx: Context, manager: WebRuntimeManager, artifacts: ArtifactAccessController, onRuntimeActivated: RuntimeActivated, updater?: WebPluginUpdater);
|
|
71
|
+
/** Supply the active listener address before the Settings route becomes reachable. */
|
|
72
|
+
configureWebServer(host: string, port: number): void;
|
|
73
|
+
private credential;
|
|
74
|
+
/** Build the current settings/runtime/credential snapshot without secrets. */
|
|
75
|
+
snapshot(): Promise<VisionToolkitSettingsSnapshot>;
|
|
76
|
+
private save;
|
|
77
|
+
private saveCredential;
|
|
78
|
+
private health;
|
|
79
|
+
/** Handle the exact Settings route. */
|
|
80
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Same-origin policy handler for the paste route: whether the browser should
|
|
84
|
+
* take a paste over into workspace paths, or let it flow natively after an
|
|
85
|
+
* optional automatic switch to the image-input variant. The optional `model`
|
|
86
|
+
* query carries the model-selector label the client currently shows; the
|
|
87
|
+
* optional `provider`/`modelId`/`reasoningEffort` queries carry the exact
|
|
88
|
+
* route the client read from the live model catalog, which the resolver
|
|
89
|
+
* prefers (a label alone cannot pick a provider). Unresolvable routes answer
|
|
90
|
+
* native — the safe default.
|
|
91
|
+
* @param resolve - resolves one live Session's paste verdict.
|
|
92
|
+
* @returns the HTTP handler.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createPastePolicyHandler(resolve: (sessionId: string, selection?: PasteSelectionQuery, modelLabel?: string) => Promise<PasteVerdict>): (req: IncomingMessage, res: ServerResponse) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Same-origin display-config handler: exposes whether transparent routing is
|
|
97
|
+
* active. The paste integration uses it to choose its notice text; the model
|
|
98
|
+
* selector hides upstream twins synchronously from DOM display names and does
|
|
99
|
+
* not depend on this route.
|
|
100
|
+
* @param getDisplayConfig - resolves the current display-mode flags.
|
|
101
|
+
* @returns the HTTP handler.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createDisplayConfigHandler(getDisplayConfig: () => {
|
|
104
|
+
hidden: boolean;
|
|
105
|
+
}): (req: IncomingMessage, res: ServerResponse) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Attach optional Web routes whenever a webServer service is present.
|
|
108
|
+
* @param ctx - plugin context owning route effects.
|
|
109
|
+
* @param backend - Settings handler.
|
|
110
|
+
* @param artifacts - signed Artifact handler.
|
|
111
|
+
* @param pastedImages - pasted-image workspace handler.
|
|
112
|
+
* @param pastePolicy - paste-policy verdict resolver (sessionId, selection, modelLabel).
|
|
113
|
+
* @param getDisplayConfig - resolves display-mode flags for the browser client.
|
|
114
|
+
*/
|
|
115
|
+
export declare function installVisionToolkitWeb(ctx: Context, backend: VisionToolkitWebBackend, artifacts: ArtifactAccessController, pastedImages: PastedImageBackend, pastePolicy: (sessionId: string, selection?: PasteSelectionQuery, modelLabel?: string) => Promise<PasteVerdict>, getDisplayConfig: () => {
|
|
116
|
+
hidden: boolean;
|
|
117
|
+
}): void;
|
|
118
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE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