@anionex/dsh-vision-toolkit 0.1.5
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 +383 -0
- package/README.zh.md +383 -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/hero.png +0 -0
- package/assets/social-preview.png +0 -0
- package/assets/upstream/README.md +16 -0
- package/assets/upstream/image-qa.webp +0 -0
- package/assets/upstream/infographic-reference.webp +0 -0
- package/assets/upstream/infographic-result.webp +0 -0
- package/assets/upstream/screenshot-debugging.webp +0 -0
- package/assets/upstream/ui-result.webp +0 -0
- package/assets/upstream/ui-sketch.webp +0 -0
- package/assets/vision-settings.png +0 -0
- package/cordis.patch.yml +6 -0
- package/docs/assets/vision-settings.png +0 -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 +952 -0
- package/lib/client.js.map +1 -0
- package/lib/config.js +117 -0
- package/lib/config.js.map +1 -0
- package/lib/errors.js +56 -0
- package/lib/errors.js.map +1 -0
- package/lib/exposure.js +213 -0
- package/lib/exposure.js.map +1 -0
- package/lib/index.js +97 -0
- package/lib/index.js.map +1 -0
- package/lib/paste-images.js +199 -0
- package/lib/paste-images.js.map +1 -0
- package/lib/paths.js +325 -0
- package/lib/paths.js.map +1 -0
- package/lib/runtime-install.js +601 -0
- package/lib/runtime-install.js.map +1 -0
- package/lib/runtime-manager.js +126 -0
- package/lib/runtime-manager.js.map +1 -0
- package/lib/runtime.js +1344 -0
- package/lib/runtime.js.map +1 -0
- package/lib/skill.js +139 -0
- package/lib/skill.js.map +1 -0
- package/lib/tools.js +528 -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/index.d.ts +179 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/paste-images.d.ts +57 -0
- package/lib/types/client/paste-images.d.ts.map +1 -0
- package/lib/types/config.d.ts +73 -0
- package/lib/types/config.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/exposure.d.ts +40 -0
- package/lib/types/exposure.d.ts.map +1 -0
- package/lib/types/index.d.ts +18 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/paste-images.d.ts +21 -0
- package/lib/types/paste-images.d.ts.map +1 -0
- package/lib/types/paths.d.ts +107 -0
- package/lib/types/paths.d.ts.map +1 -0
- package/lib/types/runtime-install.d.ts +49 -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 +389 -0
- package/lib/types/runtime.d.ts.map +1 -0
- package/lib/types/skill.d.ts +15 -0
- package/lib/types/skill.d.ts.map +1 -0
- package/lib/types/tools.d.ts +22 -0
- package/lib/types/tools.d.ts.map +1 -0
- package/lib/types/upstream.d.ts +207 -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 +4 -0
- package/lib/types/web-request.d.ts.map +1 -0
- package/lib/types/web.d.ts +74 -0
- package/lib/types/web.d.ts.map +1 -0
- package/lib/upstream.js +675 -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 +20 -0
- package/lib/web-request.js.map +1 -0
- package/lib/web.js +244 -0
- package/lib/web.js.map +1 -0
- package/package.json +139 -0
- package/runtime/requirements.lock +3 -0
- package/src/artifact-access.ts +386 -0
- package/src/artifacts.ts +85 -0
- package/src/client/index.tsx +866 -0
- package/src/client/paste-images.tsx +426 -0
- package/src/config.ts +177 -0
- package/src/errors.ts +62 -0
- package/src/exposure.ts +227 -0
- package/src/index.ts +122 -0
- package/src/paste-images.ts +234 -0
- package/src/paths.ts +348 -0
- package/src/runtime-install.ts +723 -0
- package/src/runtime-manager.ts +166 -0
- package/src/runtime.ts +1783 -0
- package/src/skill.ts +143 -0
- package/src/tools.ts +668 -0
- package/src/upstream.ts +861 -0
- package/src/version.ts +37 -0
- package/src/web-request.ts +17 -0
- package/src/web.ts +329 -0
- package/vendor/agent-vision-toolkit/CHANGELOG.md +16 -0
- package/vendor/agent-vision-toolkit/LICENSE +21 -0
- package/vendor/agent-vision-toolkit/README.md +399 -0
- package/vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json +89 -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 +56 -0
- package/vendor/agent-vision-toolkit/ground.py +216 -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 +108 -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/vision_client.py +156 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/skill.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,iBAAiB,CAAA;AAErD,mFAAmF;AACnF,eAAO,MAAM,0BAA0B,++KAuHtC,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,EAAE,iBAMhC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing native tools. Every definition projects one structured runtime
|
|
3
|
+
* operation, declares replay-safe file locations, and preserves canonical
|
|
4
|
+
* result metadata for the optional Web client without changing Headless or
|
|
5
|
+
* model-visible semantics.
|
|
6
|
+
* @module dsh-vision-toolkit/tools
|
|
7
|
+
*/
|
|
8
|
+
import { defineTool, type JsonValue } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
import { VisionToolkitRuntime } from './runtime.ts';
|
|
10
|
+
/** Runtime lookup accepted by tools so Settings can atomically swap generations. */
|
|
11
|
+
export type VisionToolkitRuntimeSource = VisionToolkitRuntime | (() => VisionToolkitRuntime);
|
|
12
|
+
/** Browser-only metadata projector; the model-visible value remains unchanged. */
|
|
13
|
+
export type VisionToolkitPresentationProjector = (value: JsonValue) => JsonValue;
|
|
14
|
+
/**
|
|
15
|
+
* Build the complete P0/P1 tool set from one live runtime source.
|
|
16
|
+
* @param source - Current runtime or atomic runtime lookup.
|
|
17
|
+
* @param projectPresentation - Browser-only projection for Artifact capabilities.
|
|
18
|
+
* @param lifecycleSignal - Plugin lifetime; aborting it cancels every active tool call.
|
|
19
|
+
* @returns Native tool definitions registered as one lifecycle generation.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createVisionTools(source: VisionToolkitRuntimeSource, projectPresentation?: VisionToolkitPresentationProjector, lifecycleSignal?: AbortSignal): ReturnType<typeof defineTool>[];
|
|
22
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAA6C,MAAM,wBAAwB,CAAA;AAC9G,OAAO,EACL,oBAAoB,EAWrB,MAAM,cAAc,CAAA;AA+HrB,oFAAoF;AACpF,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,GAAG,CAAC,MAAM,oBAAoB,CAAC,CAAA;AAE5F,kFAAkF;AAClF,MAAM,MAAM,kCAAkC,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,CAAA;AAMhF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,0BAA0B,EAClC,mBAAmB,GAAE,kCAAyD,EAC9E,eAAe,CAAC,EAAE,WAAW,GAC5B,UAAU,CAAC,OAAO,UAAU,CAAC,EAAE,CA8YjC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
+
LANG: 'zh' | 'en';
|
|
21
|
+
}
|
|
22
|
+
/** Pinned upstream identity plus prepared runtime facts. */
|
|
23
|
+
export interface UpstreamVersionInfo {
|
|
24
|
+
repository: string;
|
|
25
|
+
version: string;
|
|
26
|
+
commit: string;
|
|
27
|
+
path: string;
|
|
28
|
+
source: 'managed' | 'external';
|
|
29
|
+
python: string;
|
|
30
|
+
pythonVersion: string;
|
|
31
|
+
dependencies: Record<string, string>;
|
|
32
|
+
runtimeHome: string;
|
|
33
|
+
}
|
|
34
|
+
/** Settled upstream process facts plus bounded output. */
|
|
35
|
+
export interface UpstreamRunResult {
|
|
36
|
+
stdout: string;
|
|
37
|
+
stderr: string;
|
|
38
|
+
stdoutTruncated: boolean;
|
|
39
|
+
stderrTruncated: boolean;
|
|
40
|
+
outcome: SubprocessOutcome;
|
|
41
|
+
}
|
|
42
|
+
/** Pixel box in original-image coordinates. */
|
|
43
|
+
export interface PixelBox {
|
|
44
|
+
x1: number;
|
|
45
|
+
y1: number;
|
|
46
|
+
x2: number;
|
|
47
|
+
y2: number;
|
|
48
|
+
}
|
|
49
|
+
/** One ground/detect match line converted to structure. */
|
|
50
|
+
export interface LocatedElement {
|
|
51
|
+
label?: string;
|
|
52
|
+
box: PixelBox;
|
|
53
|
+
}
|
|
54
|
+
/** Parsed crop CLI result. */
|
|
55
|
+
export interface CropOutput {
|
|
56
|
+
outputPath: string;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
clamped: boolean;
|
|
60
|
+
note?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Parsed trace CLI result from the pinned vtracer implementation. */
|
|
63
|
+
export interface TraceOutput {
|
|
64
|
+
outputPath: string;
|
|
65
|
+
bytes: number;
|
|
66
|
+
pathCount: number;
|
|
67
|
+
tracedScale: number;
|
|
68
|
+
}
|
|
69
|
+
/** Parsed local pixel-diff report. */
|
|
70
|
+
export interface PixelDiffOutput {
|
|
71
|
+
scaled: boolean;
|
|
72
|
+
rebuiltOriginalSize?: {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
};
|
|
76
|
+
scaledToSize?: {
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
};
|
|
80
|
+
overallDifferencePct: number;
|
|
81
|
+
heatmapPath: string;
|
|
82
|
+
worstRegions: Array<{
|
|
83
|
+
index: number;
|
|
84
|
+
differencePct: number;
|
|
85
|
+
box: PixelBox;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
/** Parsed transparent foreground extraction report. */
|
|
89
|
+
export interface ExtractForegroundOutput {
|
|
90
|
+
box: PixelBox;
|
|
91
|
+
foregroundPixels: number;
|
|
92
|
+
keptComponents: number;
|
|
93
|
+
totalComponents: number;
|
|
94
|
+
largestComponentPct: number;
|
|
95
|
+
outputPath: string;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
autoSummary?: string;
|
|
99
|
+
}
|
|
100
|
+
/** One significant palette cluster from `dominant_colors.py`. */
|
|
101
|
+
export interface DominantColorCluster {
|
|
102
|
+
color: string;
|
|
103
|
+
sharePct: number;
|
|
104
|
+
}
|
|
105
|
+
/** One candidate-scoring row from `dominant_colors.py`. */
|
|
106
|
+
export interface DominantColorCandidate {
|
|
107
|
+
color: string;
|
|
108
|
+
sharePct: number;
|
|
109
|
+
meanDistance: number;
|
|
110
|
+
weightedScorePct: number;
|
|
111
|
+
winner: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Structured dominant-colour result in palette or candidate mode. */
|
|
114
|
+
export type DominantColorsOutput = {
|
|
115
|
+
mode: 'palette';
|
|
116
|
+
region: PixelBox;
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
requestedTop: number;
|
|
120
|
+
clusterCount: number;
|
|
121
|
+
mergeTolerance: number;
|
|
122
|
+
colors: DominantColorCluster[];
|
|
123
|
+
} | {
|
|
124
|
+
mode: 'candidates';
|
|
125
|
+
region: PixelBox;
|
|
126
|
+
width: number;
|
|
127
|
+
height: number;
|
|
128
|
+
sampledPixels: number;
|
|
129
|
+
candidates: DominantColorCandidate[];
|
|
130
|
+
winner: string;
|
|
131
|
+
matchedWithinTolerance: boolean;
|
|
132
|
+
closestCandidate?: string;
|
|
133
|
+
note?: string;
|
|
134
|
+
};
|
|
135
|
+
/** Parsed local HTML screenshot result. */
|
|
136
|
+
export interface HtmlScreenshotOutput {
|
|
137
|
+
outputPath: string;
|
|
138
|
+
width: number;
|
|
139
|
+
height: number;
|
|
140
|
+
}
|
|
141
|
+
/** Parse one numbered upstream location line (`N. position label x1: ..., ...`). */
|
|
142
|
+
export declare function parseLocationLine(line: string): LocatedElement | undefined;
|
|
143
|
+
/** Parse ground/detect stdout; non-empty unknown lines are an output contract failure. */
|
|
144
|
+
export declare function parseLocationOutput(stdout: string): LocatedElement[];
|
|
145
|
+
/** Parse the crop CLI's `wrote <path> (WxH)` line and clamp note. */
|
|
146
|
+
export declare function parseCropOutput(stdout: string, stderr: string): CropOutput;
|
|
147
|
+
/** Parse the pinned trace CLI's written-file summary. */
|
|
148
|
+
export declare function parseTraceOutput(stdout: string): TraceOutput;
|
|
149
|
+
/** Parse the complete `pixel_diff.py` stdout contract. */
|
|
150
|
+
export declare function parsePixelDiffOutput(stdout: string): PixelDiffOutput;
|
|
151
|
+
/** Parse the complete `extract_fg.py` stdout contract. */
|
|
152
|
+
export declare function parseExtractForegroundOutput(stdout: string): ExtractForegroundOutput;
|
|
153
|
+
/** Parse palette and candidate modes from `dominant_colors.py`. */
|
|
154
|
+
export declare function parseDominantColorsOutput(stdout: string): DominantColorsOutput;
|
|
155
|
+
/** Parse the local Chrome screenshot summary. */
|
|
156
|
+
export declare function parseHtmlScreenshotOutput(stdout: string): HtmlScreenshotOutput;
|
|
157
|
+
/** Find the first candidate with the five pinned core CLI entrypoints. */
|
|
158
|
+
export declare function findCheckout(candidates: readonly string[]): Promise<string>;
|
|
159
|
+
/** Adapter over one prepared pinned upstream runtime. */
|
|
160
|
+
export declare class UpstreamAdapter {
|
|
161
|
+
private readonly ctx;
|
|
162
|
+
private readonly config;
|
|
163
|
+
private prepared;
|
|
164
|
+
constructor(ctx: Context, config: ResolvedVisionToolkitConfig, prepared?: PreparedUpstreamRuntime);
|
|
165
|
+
/** Upstream identity reported to tools and logs. */
|
|
166
|
+
get versionInfo(): UpstreamVersionInfo;
|
|
167
|
+
private requirePrepared;
|
|
168
|
+
/** Verify and prepare the configured source plus Python dependencies. */
|
|
169
|
+
prepare(): Promise<void>;
|
|
170
|
+
/** Run one upstream CLI without a shell. */
|
|
171
|
+
run(tool: UpstreamTool, args: readonly string[], options: {
|
|
172
|
+
signal: AbortSignal;
|
|
173
|
+
env?: UpstreamEnvironment;
|
|
174
|
+
}): Promise<UpstreamRunResult>;
|
|
175
|
+
/** Read image dimensions through the prepared Pillow dependency. */
|
|
176
|
+
probeImageSize(imagePath: string, options: {
|
|
177
|
+
signal: AbortSignal;
|
|
178
|
+
}): Promise<{
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
format: string;
|
|
182
|
+
mode: string;
|
|
183
|
+
}>;
|
|
184
|
+
private runPythonCode;
|
|
185
|
+
/** Draw validated pixel boxes and labels into a PNG preview with Pillow. */
|
|
186
|
+
renderAnnotatedPreview(imagePath: string, outputPath: string, elements: readonly LocatedElement[], options: {
|
|
187
|
+
signal: AbortSignal;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
/** Locate the same optional Chrome-family browser the pinned HTML script uses. */
|
|
190
|
+
findChrome(options: {
|
|
191
|
+
signal: AbortSignal;
|
|
192
|
+
}): Promise<string | undefined>;
|
|
193
|
+
private collect;
|
|
194
|
+
/** Report the pinned snapshot identity. */
|
|
195
|
+
readCheckoutVersion(): Promise<string>;
|
|
196
|
+
/** Whether the prepared snapshot carries one optional script path. */
|
|
197
|
+
hasScript(name: string): Promise<boolean>;
|
|
198
|
+
/** Read one prepared upstream text file for diagnostics or compatibility tests. */
|
|
199
|
+
readText(relativePath: readonly string[]): Promise<string>;
|
|
200
|
+
/** Turn a failed run into a model-safe classified error. */
|
|
201
|
+
classifyFailure(tool: UpstreamTool, result: UpstreamRunResult, options: {
|
|
202
|
+
timedOut: boolean;
|
|
203
|
+
cancelled: boolean;
|
|
204
|
+
secrets?: readonly string[];
|
|
205
|
+
}): VisionToolkitError;
|
|
206
|
+
}
|
|
207
|
+
//# 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,KAA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+
* 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 @@
|
|
|
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,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAa5D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 } from './paste-images.ts';
|
|
11
|
+
import { type VisionToolkitConfig } from './config.ts';
|
|
12
|
+
import { VisionToolkitRuntimeManager, type PreparedRuntimeGeneration, type RuntimeManagerStatus } from './runtime-manager.ts';
|
|
13
|
+
/** Exact route used by the browser Settings page. */
|
|
14
|
+
export declare const SETTINGS_ROUTE = "/_dsh/vision-toolkit/settings";
|
|
15
|
+
/** Public Settings snapshot; credential values are deliberately impossible here. */
|
|
16
|
+
export interface VisionToolkitSettingsSnapshot {
|
|
17
|
+
schemaVersion: 1;
|
|
18
|
+
writable: boolean;
|
|
19
|
+
settings: {
|
|
20
|
+
value: VisionToolkitConfig;
|
|
21
|
+
user?: unknown;
|
|
22
|
+
base?: unknown;
|
|
23
|
+
revision: number;
|
|
24
|
+
applies: 'live';
|
|
25
|
+
};
|
|
26
|
+
credential: {
|
|
27
|
+
ref: string;
|
|
28
|
+
configured: boolean;
|
|
29
|
+
source?: string;
|
|
30
|
+
writable: boolean;
|
|
31
|
+
};
|
|
32
|
+
runtime: RuntimeManagerStatus;
|
|
33
|
+
release: {
|
|
34
|
+
pluginVersion: string;
|
|
35
|
+
upstreamRepository: string;
|
|
36
|
+
upstreamVersion: string;
|
|
37
|
+
upstreamCommit: string;
|
|
38
|
+
};
|
|
39
|
+
artifactRouteAvailable: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Minimal runtime-manager face used by the Web route and its tests. */
|
|
42
|
+
export interface WebRuntimeManager {
|
|
43
|
+
readonly ready: boolean;
|
|
44
|
+
current(): ReturnType<VisionToolkitRuntimeManager['current']>;
|
|
45
|
+
prepareCandidate(raw: VisionToolkitConfig): Promise<PreparedRuntimeGeneration>;
|
|
46
|
+
activateCandidate(candidate: PreparedRuntimeGeneration): void;
|
|
47
|
+
recordFailure(error: unknown): void;
|
|
48
|
+
status(): RuntimeManagerStatus;
|
|
49
|
+
}
|
|
50
|
+
/** Callback invoked when a Settings save makes the first runtime available. */
|
|
51
|
+
export type RuntimeActivated = () => void;
|
|
52
|
+
/** Same-origin Settings and health handler. */
|
|
53
|
+
export declare class VisionToolkitWebBackend {
|
|
54
|
+
private readonly ctx;
|
|
55
|
+
private readonly manager;
|
|
56
|
+
private readonly artifacts;
|
|
57
|
+
private readonly onRuntimeActivated;
|
|
58
|
+
constructor(ctx: Context, manager: WebRuntimeManager, artifacts: ArtifactAccessController, onRuntimeActivated: RuntimeActivated);
|
|
59
|
+
private credential;
|
|
60
|
+
/** Build the current settings/runtime/credential snapshot without secrets. */
|
|
61
|
+
snapshot(): Promise<VisionToolkitSettingsSnapshot>;
|
|
62
|
+
private save;
|
|
63
|
+
private health;
|
|
64
|
+
/** Handle the exact Settings route. */
|
|
65
|
+
handle(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Attach optional Web routes whenever an webServer service is present.
|
|
69
|
+
* @param ctx - plugin context owning route effects.
|
|
70
|
+
* @param backend - Settings handler.
|
|
71
|
+
* @param artifacts - signed Artifact handler.
|
|
72
|
+
*/
|
|
73
|
+
export declare function installVisionToolkitWeb(ctx: Context, backend: VisionToolkitWebBackend, artifacts: ArtifactAccessController, pastedImages: PastedImageBackend): void;
|
|
74
|
+
//# 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,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,OAAO,EAAE,wBAAwB,EAAyB,MAAM,sBAAsB,CAA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