@anionex/dsh-vision-toolkit 0.1.5 → 0.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/README.i18n.yaml +3 -3
- package/README.md +26 -15
- package/README.zh.md +26 -15
- package/docs/assets/vision-settings.png +0 -0
- package/docs/requirements-traceability/README.md +1 -1
- package/docs/requirements-traceability/README.zh.md +1 -1
- package/lib/client.js +415 -84
- package/lib/client.js.map +1 -1
- package/lib/config.js +18 -1
- package/lib/config.js.map +1 -1
- package/lib/runtime.js +18 -1
- package/lib/runtime.js.map +1 -1
- package/lib/types/client/index.d.ts +84 -3
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/config.d.ts +12 -1
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/runtime.d.ts.map +1 -1
- package/lib/types/upstream.d.ts +3 -0
- package/lib/types/upstream.d.ts.map +1 -1
- package/lib/types/web.d.ts +2 -1
- package/lib/types/web.d.ts.map +1 -1
- package/lib/upstream.js +3 -0
- package/lib/upstream.js.map +1 -1
- package/lib/web.js +62 -9
- package/lib/web.js.map +1 -1
- package/package.json +4 -4
- package/src/client/index.tsx +461 -113
- package/src/config.ts +29 -2
- package/src/runtime.ts +17 -1
- package/src/upstream.ts +6 -0
- package/src/web.ts +75 -10
- package/vendor/agent-vision-toolkit/CHANGELOG.md +13 -0
- package/vendor/agent-vision-toolkit/README.md +11 -6
- package/vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json +14 -9
- package/vendor/agent-vision-toolkit/tests/test_vision_client.py +396 -0
- package/vendor/agent-vision-toolkit/vision_client.py +134 -18
package/src/client/index.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import { installPasteImages } from './paste-images.tsx'
|
|
|
24
24
|
const NS = 'vision-toolkit'
|
|
25
25
|
const SETTINGS_ROUTE = '/_dsh/vision-toolkit/settings'
|
|
26
26
|
const PRESENTATION_META_KEY = '$dshVisionToolkit'
|
|
27
|
+
const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
|
|
27
28
|
|
|
28
29
|
const en = {
|
|
29
30
|
nav: 'Vision',
|
|
@@ -31,9 +32,22 @@ const en = {
|
|
|
31
32
|
settingsIntro: 'Configure the pinned visual engineering runtime, its external vision endpoint, and local safety limits.',
|
|
32
33
|
externalNotice: 'Remote tools send the selected image bytes to the configured external vision API. Local crop, trace, pixel diff, palette, foreground extraction, and HTML rendering do not upload images.',
|
|
33
34
|
provider: 'Vision service',
|
|
35
|
+
providerHint: 'Choose the API protocol, then provide the service address, model, and API key used by online vision features.',
|
|
34
36
|
baseUrl: 'Base URL',
|
|
35
|
-
|
|
37
|
+
apiKey: 'API key',
|
|
38
|
+
apiKeyPlaceholderMissing: 'Paste the API key',
|
|
39
|
+
apiKeyPlaceholderConfigured: 'Saved; leave blank to keep it',
|
|
40
|
+
apiKeyHint: 'The key is stored in DSH Credentials and is never shown again after saving.',
|
|
41
|
+
apiKeyLocked: 'The current key comes from a read-only source and cannot be replaced here.',
|
|
42
|
+
apiKeyBlank: 'The API key cannot contain only spaces.',
|
|
43
|
+
apiKeyInvalid: 'Paste only the key, without a variable name, quotes, spaces, or line breaks.',
|
|
44
|
+
credential: 'Credential name',
|
|
45
|
+
credentialHint: 'Advanced: the API key is stored under this name. Keep VISION_API_KEY unless another plugin configuration requires a different reference.',
|
|
36
46
|
model: 'Model',
|
|
47
|
+
protocol: 'API protocol',
|
|
48
|
+
anthropicThinking: 'Anthropic thinking',
|
|
49
|
+
anthropicThinkingHint: 'omit has the broadest compatibility. Use disabled or adaptive only when the selected model documents that mode; restore omit first after HTTP 400.',
|
|
50
|
+
userAgent: 'User-Agent',
|
|
37
51
|
language: 'Output language',
|
|
38
52
|
limits: 'Limits',
|
|
39
53
|
timeout: 'Request timeout (ms)',
|
|
@@ -50,20 +64,31 @@ const en = {
|
|
|
50
64
|
saving: 'Validating runtime…',
|
|
51
65
|
reload: 'Reload',
|
|
52
66
|
saved: 'Settings validated and applied.',
|
|
53
|
-
readOnly: '
|
|
67
|
+
readOnly: 'Service settings are read-only. A writable API key can still be saved.',
|
|
54
68
|
configured: 'Configured',
|
|
55
69
|
missing: 'Missing',
|
|
56
70
|
source: 'Source',
|
|
71
|
+
sourceHint: '{source}: {value}',
|
|
72
|
+
sourceEnv: 'Environment variable',
|
|
73
|
+
sourceFile: 'Credential file',
|
|
57
74
|
health: 'Health',
|
|
58
75
|
runHealth: 'Run health check',
|
|
59
76
|
testConnection: 'Test connection',
|
|
60
77
|
testing: 'Checking…',
|
|
61
78
|
connectionHint: 'Connection testing explicitly sends the configured credential to GET /models. It uploads no image and creates no completion.',
|
|
79
|
+
saveBeforeTesting: 'Save service changes before testing the connection.',
|
|
80
|
+
advanced: 'Advanced settings',
|
|
81
|
+
advancedHint: 'Credential name, provider compatibility, output language, resource limits, runtime source, Python, and additional readable directories.',
|
|
62
82
|
pluginVersion: 'Plugin',
|
|
63
83
|
upstreamVersion: 'Upstream',
|
|
64
84
|
activeGeneration: 'Runtime generation',
|
|
85
|
+
activeGenerationValue: 'Generation {generation}',
|
|
86
|
+
pluginKind: 'DSH native plugin',
|
|
65
87
|
runtimeUnavailable: 'Runtime unavailable',
|
|
66
88
|
runtimeCandidateRejected: 'Last runtime candidate was rejected; the active generation remains available.',
|
|
89
|
+
runtimeReady: 'Ready',
|
|
90
|
+
runtimeManaged: 'Managed',
|
|
91
|
+
runtimeExternal: 'External checkout',
|
|
67
92
|
retry: 'Retry',
|
|
68
93
|
open: 'Open file',
|
|
69
94
|
download: 'Download',
|
|
@@ -83,71 +108,203 @@ const en = {
|
|
|
83
108
|
healthy: 'Healthy',
|
|
84
109
|
degraded: 'Needs attention',
|
|
85
110
|
notTested: 'Not tested',
|
|
111
|
+
groundTitle: 'Ground',
|
|
112
|
+
detectTitle: 'Detect',
|
|
113
|
+
traceTitle: 'Trace SVG',
|
|
114
|
+
pixelDiffTitle: 'Pixel Diff',
|
|
115
|
+
cropTitle: 'Crop',
|
|
116
|
+
longOcrTitle: 'Long OCR',
|
|
117
|
+
extractForegroundTitle: 'Extract Foreground',
|
|
118
|
+
htmlScreenshotTitle: 'HTML Screenshot',
|
|
119
|
+
artifactTitle: 'Vision Artifact',
|
|
120
|
+
dominantColorsTitle: 'Dominant Colors',
|
|
121
|
+
artifactGroundPreview: 'Grounding bounding-box preview',
|
|
122
|
+
artifactDetectPreview: 'Detected-element bounding-box preview',
|
|
123
|
+
artifactCrop: 'Cropped image region',
|
|
124
|
+
artifactTrace: 'Traced vector geometry',
|
|
125
|
+
artifactDiffHeatmap: 'Pixel-difference heatmap',
|
|
126
|
+
artifactDiffReport: 'Structured pixel-difference report',
|
|
127
|
+
artifactLongManifest: 'Long-screenshot split and merge manifest',
|
|
128
|
+
artifactLongTranscript: 'Merged long-screenshot OCR transcript',
|
|
129
|
+
artifactLongAudit: 'Long-screenshot OCR boundary audit',
|
|
130
|
+
artifactLongChunk: 'Long-screenshot OCR chunk {index}',
|
|
131
|
+
artifactOcrSidecar: 'OCR sidecar for chunk {index}',
|
|
132
|
+
artifactForeground: 'Extracted transparent foreground',
|
|
133
|
+
artifactHtmlScreenshot: 'Headless browser screenshot of local HTML',
|
|
134
|
+
label: 'Label',
|
|
135
|
+
paths: 'paths',
|
|
136
|
+
healthPython: 'Python',
|
|
137
|
+
healthDependencies: 'Dependencies',
|
|
138
|
+
healthChrome: 'Browser',
|
|
139
|
+
healthCredential: 'Credential',
|
|
140
|
+
healthArtifactDirectory: 'Artifact directory',
|
|
141
|
+
healthTempDirectory: 'Temporary directory',
|
|
142
|
+
healthService: 'Vision service',
|
|
143
|
+
statusOk: 'OK',
|
|
144
|
+
statusWarning: 'Warning',
|
|
145
|
+
statusError: 'Error',
|
|
146
|
+
statusNotTested: 'Not tested',
|
|
147
|
+
positiveInteger: '{field} must be a positive integer.',
|
|
148
|
+
healthPythonDetail: '{version} via {path}',
|
|
149
|
+
healthChromeMissing: 'Chrome, Chromium, or Edge was not found; HTML Screenshot is unavailable.',
|
|
150
|
+
healthChromeProbeFailed: 'Could not check whether a supported browser is available.',
|
|
151
|
+
healthCredentialMissing: 'Credential {credential} is not configured.',
|
|
152
|
+
healthCredentialReady: 'Credential {credential} is available.',
|
|
153
|
+
healthCredentialFailed: 'Could not read credential {credential}.',
|
|
154
|
+
healthDirectoryWritable: '{directory} is writable: {path}',
|
|
155
|
+
healthDirectoryNotWritable: '{directory} is not writable: {path}',
|
|
156
|
+
healthArtifactDirectoryFailed: 'Could not prepare the artifact directory.',
|
|
157
|
+
healthConnectionNotTested: 'Connection not tested. Use Test connection to query /models.',
|
|
158
|
+
healthConnectionCredentialMissing: 'Connection test skipped because the credential is unavailable.',
|
|
159
|
+
healthServiceResponded: 'Service responded at {endpoint} (HTTP {status}).',
|
|
160
|
+
healthServiceRejectedCredential: 'Service rejected the configured credential (HTTP {status}).',
|
|
161
|
+
healthServiceNoModels: 'Service is reachable but does not support GET /models (HTTP {status}).',
|
|
162
|
+
healthServiceRateLimited: 'Service is reachable, but the connection test was rate-limited (HTTP 429).',
|
|
163
|
+
healthServiceHttpFailed: 'Connection test failed with HTTP {status}.',
|
|
164
|
+
healthServiceUnreachable: 'Could not reach {endpoint}.',
|
|
86
165
|
} as const
|
|
87
166
|
|
|
88
167
|
type LocaleKey = keyof typeof en
|
|
89
168
|
|
|
90
169
|
const zh: Record<LocaleKey, string> = {
|
|
91
170
|
nav: '视觉工具',
|
|
92
|
-
settingsTitle: '
|
|
93
|
-
settingsIntro: '
|
|
94
|
-
externalNotice: '
|
|
95
|
-
provider: '
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
171
|
+
settingsTitle: '视觉工具箱',
|
|
172
|
+
settingsIntro: '在这里设置视觉模型服务、工具运行环境,以及图片和文件的本地访问范围。',
|
|
173
|
+
externalNotice: '使用图像理解、目标定位、界面检测或文字识别等在线功能时,所选图片会发送到下方配置的视觉服务。图片裁剪、轮廓描摹、像素对比、主色提取、前景提取和网页截图均在本机完成,不会上传图片。',
|
|
174
|
+
provider: '在线视觉服务',
|
|
175
|
+
providerHint: '选择接口协议后,填写在线视觉功能使用的 API 地址、模型名称和 API 密钥。',
|
|
176
|
+
baseUrl: 'API 地址',
|
|
177
|
+
apiKey: 'API 密钥',
|
|
178
|
+
apiKeyPlaceholderMissing: '粘贴 API 密钥',
|
|
179
|
+
apiKeyPlaceholderConfigured: '已保存;留空表示不修改',
|
|
180
|
+
apiKeyHint: '密钥会保存到 DSH 凭据存储,保存后不会在页面中回显。',
|
|
181
|
+
apiKeyLocked: '当前密钥来自只读配置,无法在此替换。',
|
|
182
|
+
apiKeyBlank: 'API 密钥不能只包含空格。',
|
|
183
|
+
apiKeyInvalid: '请只粘贴密钥本身,不要包含变量名、引号、空格或换行。',
|
|
184
|
+
credential: '凭据名称',
|
|
185
|
+
credentialHint: '高级用法:API 密钥会按此名称保存。除非其他插件配置要求不同名称,否则保持 VISION_API_KEY。',
|
|
186
|
+
model: '模型名称',
|
|
187
|
+
protocol: 'API 协议',
|
|
188
|
+
anthropicThinking: 'Anthropic thinking',
|
|
189
|
+
anthropicThinkingHint: 'omit 兼容性最好。仅当所选模型明确支持时使用 disabled 或 adaptive;遇到 HTTP 400 时先恢复 omit。',
|
|
190
|
+
userAgent: 'User-Agent',
|
|
191
|
+
language: '结果语言',
|
|
192
|
+
limits: '资源与并发限制',
|
|
193
|
+
timeout: '单次请求超时(毫秒)',
|
|
194
|
+
maxBytes: '单张图片大小上限(字节)',
|
|
195
|
+
maxPixels: '单张图片最大像素数',
|
|
196
|
+
concurrency: '单个会话最多并发任务数',
|
|
197
|
+
runtime: '工具运行环境',
|
|
198
|
+
runtimeMode: '环境来源',
|
|
199
|
+
toolkitPath: 'agent-vision-toolkit 目录',
|
|
200
|
+
python: 'Python 解释器(可选)',
|
|
201
|
+
allowedDirs: '允许读取的其他目录',
|
|
202
|
+
allowedDirsHint: '每行填写一个目录。当前会话的工作目录始终可以读取,无需重复填写。',
|
|
203
|
+
save: '保存设置',
|
|
204
|
+
saving: '正在检查并应用…',
|
|
113
205
|
reload: '重新加载',
|
|
114
|
-
saved: '
|
|
115
|
-
readOnly: '
|
|
116
|
-
configured: '
|
|
117
|
-
missing: '
|
|
118
|
-
source: '
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
206
|
+
saved: '设置已保存并生效。',
|
|
207
|
+
readOnly: '服务设置来自只读配置;如果 API 密钥可写,仍可在此保存密钥。',
|
|
208
|
+
configured: '已就绪',
|
|
209
|
+
missing: '未配置',
|
|
210
|
+
source: '配置来源',
|
|
211
|
+
sourceHint: '{source}:{value}',
|
|
212
|
+
sourceEnv: '环境变量',
|
|
213
|
+
sourceFile: '凭据文件',
|
|
214
|
+
health: '运行检查',
|
|
215
|
+
runHealth: '检查本地环境',
|
|
216
|
+
testConnection: '测试服务连接',
|
|
122
217
|
testing: '检查中…',
|
|
123
|
-
connectionHint: '
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
218
|
+
connectionHint: '“检查本地环境”只检查本机依赖和目录;“测试服务连接”会携带已配置的 API 密钥请求 /models,但不会上传图片或调用模型。',
|
|
219
|
+
saveBeforeTesting: '修改服务配置后,请先保存,再测试连接。',
|
|
220
|
+
advanced: '高级设置',
|
|
221
|
+
advancedHint: '凭据名称、服务兼容参数、结果语言、资源限制、运行环境来源、Python 和额外可读目录。一般无需修改。',
|
|
222
|
+
pluginVersion: '插件版本',
|
|
223
|
+
upstreamVersion: '工具包版本',
|
|
224
|
+
activeGeneration: '本次运行已应用',
|
|
225
|
+
activeGenerationValue: '{generation} 次',
|
|
226
|
+
pluginKind: 'DSH 原生插件',
|
|
227
|
+
runtimeUnavailable: '运行环境尚未就绪',
|
|
228
|
+
runtimeCandidateRejected: '新设置未能生效,仍在使用上一次可用的设置。',
|
|
229
|
+
runtimeReady: '已就绪',
|
|
230
|
+
runtimeManaged: '自动安装',
|
|
231
|
+
runtimeExternal: '本地源码',
|
|
129
232
|
retry: '重试',
|
|
130
|
-
open: '
|
|
233
|
+
open: '在工作区中打开',
|
|
131
234
|
download: '下载',
|
|
132
|
-
previewUnavailable: '
|
|
235
|
+
previewUnavailable: '此页面无法直接预览该文件,请在工作区中打开。',
|
|
133
236
|
running: '运行中…',
|
|
134
|
-
failed: '
|
|
135
|
-
matches: '
|
|
237
|
+
failed: '运行失败',
|
|
238
|
+
matches: '处匹配',
|
|
136
239
|
elements: '个元素',
|
|
137
|
-
dimensions: '
|
|
240
|
+
dimensions: '图片尺寸',
|
|
138
241
|
coordinates: '坐标',
|
|
139
|
-
artifact: '
|
|
140
|
-
artifacts: '
|
|
141
|
-
difference: '
|
|
142
|
-
worstRegions: '
|
|
143
|
-
colors: '
|
|
144
|
-
noResult: '
|
|
145
|
-
healthy: '
|
|
146
|
-
degraded: '
|
|
147
|
-
notTested: '
|
|
242
|
+
artifact: '生成文件',
|
|
243
|
+
artifacts: '个生成文件',
|
|
244
|
+
difference: '像素差异',
|
|
245
|
+
worstRegions: '差异最大的区域',
|
|
246
|
+
colors: '种颜色',
|
|
247
|
+
noResult: '未能读取结果,请查看工具的原始输出。',
|
|
248
|
+
healthy: '一切正常',
|
|
249
|
+
degraded: '有项目需要处理',
|
|
250
|
+
notTested: '尚未检查',
|
|
251
|
+
groundTitle: '目标定位',
|
|
252
|
+
detectTitle: '界面元素识别',
|
|
253
|
+
traceTitle: '描摹为 SVG',
|
|
254
|
+
pixelDiffTitle: '像素对比',
|
|
255
|
+
cropTitle: '裁剪图片',
|
|
256
|
+
longOcrTitle: '长图文字识别',
|
|
257
|
+
extractForegroundTitle: '提取前景',
|
|
258
|
+
htmlScreenshotTitle: '网页截图',
|
|
259
|
+
artifactTitle: '视觉处理结果',
|
|
260
|
+
dominantColorsTitle: '主色提取',
|
|
261
|
+
artifactGroundPreview: '目标定位框预览',
|
|
262
|
+
artifactDetectPreview: '界面元素标注预览',
|
|
263
|
+
artifactCrop: '裁剪后的图片',
|
|
264
|
+
artifactTrace: '描摹得到的矢量图',
|
|
265
|
+
artifactDiffHeatmap: '像素差异热力图',
|
|
266
|
+
artifactDiffReport: '像素差异详细报告',
|
|
267
|
+
artifactLongManifest: '长图切分与合并记录',
|
|
268
|
+
artifactLongTranscript: '长图文字识别结果',
|
|
269
|
+
artifactLongAudit: '长图分块边界检查记录',
|
|
270
|
+
artifactLongChunk: '长图文字识别分块 {index}',
|
|
271
|
+
artifactOcrSidecar: '分块 {index} 的文字识别记录',
|
|
272
|
+
artifactForeground: '提取后的透明背景前景图',
|
|
273
|
+
artifactHtmlScreenshot: '本地网页截图',
|
|
274
|
+
label: '名称',
|
|
275
|
+
paths: '条路径',
|
|
276
|
+
healthPython: 'Python',
|
|
277
|
+
healthDependencies: 'Python 依赖',
|
|
278
|
+
healthChrome: '浏览器',
|
|
279
|
+
healthCredential: 'API 密钥',
|
|
280
|
+
healthArtifactDirectory: '输出目录',
|
|
281
|
+
healthTempDirectory: '临时目录',
|
|
282
|
+
healthService: '视觉服务',
|
|
283
|
+
statusOk: '正常',
|
|
284
|
+
statusWarning: '注意',
|
|
285
|
+
statusError: '异常',
|
|
286
|
+
statusNotTested: '未检查',
|
|
287
|
+
positiveInteger: '{field}必须填写正整数。',
|
|
288
|
+
healthPythonDetail: '版本 {version};解释器:{path}',
|
|
289
|
+
healthChromeMissing: '未找到 Chrome、Chromium 或 Edge,网页截图功能暂不可用。',
|
|
290
|
+
healthChromeProbeFailed: '无法检查浏览器是否可用。',
|
|
291
|
+
healthCredentialMissing: '尚未配置凭据 {credential}。',
|
|
292
|
+
healthCredentialReady: '已找到凭据 {credential}。',
|
|
293
|
+
healthCredentialFailed: '无法读取凭据 {credential}。',
|
|
294
|
+
healthDirectoryWritable: '{directory}可写:{path}',
|
|
295
|
+
healthDirectoryNotWritable: '{directory}不可写:{path}',
|
|
296
|
+
healthArtifactDirectoryFailed: '无法准备输出目录。',
|
|
297
|
+
healthConnectionNotTested: '尚未测试服务连接。点击“测试服务连接”可请求 /models。',
|
|
298
|
+
healthConnectionCredentialMissing: 'API 密钥不可用,未执行连接测试。',
|
|
299
|
+
healthServiceResponded: '服务已响应:{endpoint}(HTTP {status})。',
|
|
300
|
+
healthServiceRejectedCredential: '服务拒绝了当前 API 密钥(HTTP {status})。',
|
|
301
|
+
healthServiceNoModels: '服务可以访问,但不支持 GET /models(HTTP {status})。',
|
|
302
|
+
healthServiceRateLimited: '服务可以访问,但本次连接测试触发了限流(HTTP 429)。',
|
|
303
|
+
healthServiceHttpFailed: '连接测试失败(HTTP {status})。',
|
|
304
|
+
healthServiceUnreachable: '无法连接到 {endpoint}。',
|
|
148
305
|
}
|
|
149
306
|
|
|
150
|
-
type Translate = (key: LocaleKey) => string
|
|
307
|
+
type Translate = (key: LocaleKey, params?: Record<string, unknown>) => string
|
|
151
308
|
|
|
152
309
|
interface ToolCallOwnerProps {
|
|
153
310
|
callId: string
|
|
@@ -202,7 +359,14 @@ interface HealthResult {
|
|
|
202
359
|
}
|
|
203
360
|
|
|
204
361
|
interface SettingsValue {
|
|
205
|
-
provider?: {
|
|
362
|
+
provider?: {
|
|
363
|
+
baseUrl?: string
|
|
364
|
+
credential?: string
|
|
365
|
+
model?: string
|
|
366
|
+
protocol?: 'openai' | 'anthropic'
|
|
367
|
+
anthropicThinking?: 'omit' | 'disabled' | 'adaptive'
|
|
368
|
+
userAgent?: string
|
|
369
|
+
}
|
|
206
370
|
language?: 'zh' | 'en'
|
|
207
371
|
timeoutMs?: number
|
|
208
372
|
maxImageBytes?: number
|
|
@@ -404,17 +568,18 @@ function ArtifactPreview({ artifact, grant, openFile, t }: {
|
|
|
404
568
|
t: Translate
|
|
405
569
|
}) {
|
|
406
570
|
const canPreview = grant !== undefined && (artifact.kind === 'image' || artifact.kind === 'svg')
|
|
571
|
+
const description = artifactDescription(artifact.description, t)
|
|
407
572
|
return (
|
|
408
573
|
<article className="dvt-artifact">
|
|
409
574
|
{canPreview
|
|
410
575
|
? artifact.kind === 'svg'
|
|
411
|
-
? <iframe className="dvt-preview dvt-svg" sandbox="" src={grant.previewUrl} title={
|
|
412
|
-
: <img className="dvt-preview" src={grant.previewUrl} alt={
|
|
576
|
+
? <iframe className="dvt-preview dvt-svg" sandbox="" src={grant.previewUrl} title={description} />
|
|
577
|
+
: <img className="dvt-preview" src={grant.previewUrl} alt={description} loading="lazy" />
|
|
413
578
|
: null}
|
|
414
579
|
<div className="dvt-artifact-meta">
|
|
415
580
|
<div>
|
|
416
581
|
<strong>{artifact.filename}</strong>
|
|
417
|
-
<span>{
|
|
582
|
+
<span>{description}</span>
|
|
418
583
|
<small>{artifact.mimeType} · {formatBytes(artifact.bytes)}</small>
|
|
419
584
|
</div>
|
|
420
585
|
<ArtifactActions artifact={artifact} grant={grant} openFile={openFile} t={t} />
|
|
@@ -424,18 +589,51 @@ function ArtifactPreview({ artifact, grant, openFile, t }: {
|
|
|
424
589
|
)
|
|
425
590
|
}
|
|
426
591
|
|
|
592
|
+
const ARTIFACT_DESCRIPTION_KEYS: Record<string, LocaleKey> = {
|
|
593
|
+
'Grounding bounding-box preview': 'artifactGroundPreview',
|
|
594
|
+
'Detected-element bounding-box preview': 'artifactDetectPreview',
|
|
595
|
+
'Cropped image region': 'artifactCrop',
|
|
596
|
+
'Traced vector geometry': 'artifactTrace',
|
|
597
|
+
'Pixel-difference heatmap': 'artifactDiffHeatmap',
|
|
598
|
+
'Structured pixel-difference report': 'artifactDiffReport',
|
|
599
|
+
'Long-screenshot split and merge manifest': 'artifactLongManifest',
|
|
600
|
+
'Merged long-screenshot OCR transcript': 'artifactLongTranscript',
|
|
601
|
+
'Long-screenshot OCR boundary audit': 'artifactLongAudit',
|
|
602
|
+
'Extracted transparent foreground': 'artifactForeground',
|
|
603
|
+
'Headless browser screenshot of local HTML': 'artifactHtmlScreenshot',
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function artifactDescription(description: string, t: Translate): string {
|
|
607
|
+
const key = ARTIFACT_DESCRIPTION_KEYS[description]
|
|
608
|
+
if (key !== undefined) {
|
|
609
|
+
const translated = t(key)
|
|
610
|
+
return translated === key ? description : translated
|
|
611
|
+
}
|
|
612
|
+
let match = /^Long-screenshot OCR chunk (\d+)$/u.exec(description)
|
|
613
|
+
if (match !== null) {
|
|
614
|
+
const translated = t('artifactLongChunk', { index: match[1] })
|
|
615
|
+
return translated === 'artifactLongChunk' ? description : translated
|
|
616
|
+
}
|
|
617
|
+
match = /^OCR sidecar for chunk (\d+)$/u.exec(description)
|
|
618
|
+
if (match !== null) {
|
|
619
|
+
const translated = t('artifactOcrSidecar', { index: match[1] })
|
|
620
|
+
return translated === 'artifactOcrSidecar' ? description : translated
|
|
621
|
+
}
|
|
622
|
+
return description
|
|
623
|
+
}
|
|
624
|
+
|
|
427
625
|
type ViewProps = ToolCallViewProps & { t?: Translate }
|
|
428
626
|
|
|
429
627
|
function GroundView({ block, openFile, t = key => en[key] }: ViewProps) {
|
|
430
628
|
const value = decodeVisionResult(block)
|
|
431
629
|
const matches = Array.isArray(value?.matches) ? value.matches.filter(isRecord) : []
|
|
432
|
-
const target = stringOf(value?.target) ?? '
|
|
630
|
+
const target = stringOf(value?.target) ?? t('groundTitle')
|
|
433
631
|
const width = numberOf(value?.imageWidth)
|
|
434
632
|
const height = numberOf(value?.imageHeight)
|
|
435
633
|
const preview = artifactFrom(value?.preview)
|
|
436
634
|
const grants = accessMap(value)
|
|
437
635
|
return (
|
|
438
|
-
<ToolShell block={block} title=
|
|
636
|
+
<ToolShell block={block} title={t('groundTitle')} summary={matches.length > 0 ? `${target} · ${matches.length} ${t('matches')}` : target} icon={<VisionIcon kind="target" />} t={t}>
|
|
439
637
|
{value === undefined ? <p className="dvt-muted">{t('noResult')}</p> : (
|
|
440
638
|
<div className="dvt-stack">
|
|
441
639
|
<div className="dvt-metrics">
|
|
@@ -460,14 +658,14 @@ function DetectView({ block, openFile, t = key => en[key] }: ViewProps) {
|
|
|
460
658
|
const preview = artifactFrom(value?.preview)
|
|
461
659
|
const grants = accessMap(value)
|
|
462
660
|
return (
|
|
463
|
-
<ToolShell block={block} title=
|
|
661
|
+
<ToolShell block={block} title={t('detectTitle')} summary={`${elements.length} ${t('elements')}`} icon={<VisionIcon kind="layers" />} t={t}>
|
|
464
662
|
{value === undefined ? <p className="dvt-muted">{t('noResult')}</p> : (
|
|
465
663
|
<div className="dvt-stack">
|
|
466
664
|
<div className="dvt-metrics">
|
|
467
665
|
<div><span>{t('dimensions')}</span><strong>{width ?? '—'} × {height ?? '—'}</strong></div>
|
|
468
666
|
<div><span>{t('elements')}</span><strong>{elements.length}</strong></div>
|
|
469
667
|
</div>
|
|
470
|
-
<div className="dvt-table-wrap"><table className="dvt-table"><thead><tr><th>#</th><th>
|
|
668
|
+
<div className="dvt-table-wrap"><table className="dvt-table"><thead><tr><th>#</th><th>{t('label')}</th><th>{t('coordinates')}</th></tr></thead><tbody>
|
|
471
669
|
{elements.map((element, index) => <tr key={index}><td>{numberOf(element.index) ?? index + 1}</td><td>{stringOf(element.label) ?? '—'}</td><td><code>{boxText(element.box)}</code></td></tr>)}
|
|
472
670
|
</tbody></table></div>
|
|
473
671
|
{preview === undefined ? null : <ArtifactPreview artifact={preview} grant={grants.get(preview.path)} openFile={openFile} t={t} />}
|
|
@@ -481,10 +679,10 @@ function TraceView({ block, openFile, t = key => en[key] }: ViewProps) {
|
|
|
481
679
|
const value = decodeVisionResult(block)
|
|
482
680
|
const artifact = artifactFrom(value?.artifact)
|
|
483
681
|
const geometry = isRecord(value?.geometry) ? value.geometry : undefined
|
|
484
|
-
const summary = geometry === undefined ? undefined : `${numberOf(geometry.pathCount) ?? 0} paths · ${formatBytes(numberOf(geometry.bytes) ?? 0)}`
|
|
682
|
+
const summary = geometry === undefined ? undefined : `${numberOf(geometry.pathCount) ?? 0} ${t('paths')} · ${formatBytes(numberOf(geometry.bytes) ?? 0)}`
|
|
485
683
|
const grants = accessMap(value)
|
|
486
684
|
return (
|
|
487
|
-
<ToolShell block={block} title=
|
|
685
|
+
<ToolShell block={block} title={t('traceTitle')} summary={summary} icon={<VisionIcon kind="shape" />} t={t}>
|
|
488
686
|
{artifact === undefined ? <p className="dvt-muted">{t('noResult')}</p> : <ArtifactPreview artifact={artifact} grant={grants.get(artifact.path)} openFile={openFile} t={t} />}
|
|
489
687
|
</ToolShell>
|
|
490
688
|
)
|
|
@@ -498,7 +696,7 @@ function PixelDiffView({ block, openFile, t = key => en[key] }: ViewProps) {
|
|
|
498
696
|
const report = artifactFrom(value?.report)
|
|
499
697
|
const grants = accessMap(value)
|
|
500
698
|
return (
|
|
501
|
-
<ToolShell block={block} title=
|
|
699
|
+
<ToolShell block={block} title={t('pixelDiffTitle')} summary={pct === undefined ? undefined : `${pct.toFixed(3)}%`} icon={<VisionIcon kind="diff" />} t={t}>
|
|
502
700
|
{value === undefined ? <p className="dvt-muted">{t('noResult')}</p> : (
|
|
503
701
|
<div className="dvt-stack">
|
|
504
702
|
<div className="dvt-diff-score"><span>{t('difference')}</span><strong>{pct?.toFixed(4) ?? '—'}%</strong><div><i style={{ width: `${Math.min(100, Math.max(0, pct ?? 0))}%` }} /></div></div>
|
|
@@ -515,11 +713,11 @@ function ArtifactView({ block, openFile, toolName, t = key => en[key] }: ViewPro
|
|
|
515
713
|
const value = decodeVisionResult(block)
|
|
516
714
|
const artifacts = collectArtifacts(value)
|
|
517
715
|
const grants = accessMap(value)
|
|
518
|
-
const title = toolName === 'vision_crop' ? '
|
|
519
|
-
: toolName === 'vision_long_screenshot_ocr' ? '
|
|
520
|
-
: toolName === 'vision_extract_foreground' ? '
|
|
521
|
-
: toolName === 'vision_html_screenshot' ? '
|
|
522
|
-
: '
|
|
716
|
+
const title = toolName === 'vision_crop' ? t('cropTitle')
|
|
717
|
+
: toolName === 'vision_long_screenshot_ocr' ? t('longOcrTitle')
|
|
718
|
+
: toolName === 'vision_extract_foreground' ? t('extractForegroundTitle')
|
|
719
|
+
: toolName === 'vision_html_screenshot' ? t('htmlScreenshotTitle')
|
|
720
|
+
: t('artifactTitle')
|
|
523
721
|
return (
|
|
524
722
|
<ToolShell block={block} title={title} summary={artifacts.length > 0 ? `${artifacts.length} ${t('artifacts')}` : undefined} icon={<VisionIcon />} t={t}>
|
|
525
723
|
{artifacts.length === 0 ? <p className="dvt-muted">{t('noResult')}</p> : <div className="dvt-stack">{artifacts.map(artifact => <ArtifactPreview key={artifact.path} artifact={artifact} grant={grants.get(artifact.path)} openFile={openFile} t={t} />)}</div>}
|
|
@@ -532,7 +730,7 @@ function PaletteView({ block, t = key => en[key] }: ViewProps) {
|
|
|
532
730
|
const analysis = isRecord(value?.analysis) ? value.analysis : undefined
|
|
533
731
|
const colors = Array.isArray(analysis?.colors) ? analysis.colors.filter(isRecord) : []
|
|
534
732
|
return (
|
|
535
|
-
<ToolShell block={block} title=
|
|
733
|
+
<ToolShell block={block} title={t('dominantColorsTitle')} summary={`${colors.length} ${t('colors')}`} icon={<VisionIcon kind="palette" />} t={t}>
|
|
536
734
|
{colors.length === 0 ? <p className="dvt-muted">{t('noResult')}</p> : <div className="dvt-palette">{colors.map((color, index) => {
|
|
537
735
|
const hex = stringOf(color.color) ?? '#000000'
|
|
538
736
|
const share = numberOf(color.sharePct)
|
|
@@ -597,17 +795,50 @@ export class VisionSettingsController {
|
|
|
597
795
|
void this.load()
|
|
598
796
|
}
|
|
599
797
|
|
|
600
|
-
async save(
|
|
798
|
+
async save(
|
|
799
|
+
value: SettingsValue,
|
|
800
|
+
expectedRevision: number,
|
|
801
|
+
credentialValue: string | undefined,
|
|
802
|
+
writeSettings: boolean,
|
|
803
|
+
): Promise<boolean> {
|
|
601
804
|
this.set({ ...this.state, action: 'save', error: undefined, message: undefined })
|
|
805
|
+
let snapshot = this.state.snapshot
|
|
602
806
|
try {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
807
|
+
if (writeSettings) {
|
|
808
|
+
snapshot = await apiRequest<SettingsSnapshot>({
|
|
809
|
+
method: 'POST',
|
|
810
|
+
headers: { 'Content-Type': 'application/json' },
|
|
811
|
+
body: JSON.stringify({ action: 'save', expectedRevision, value }),
|
|
812
|
+
})
|
|
813
|
+
}
|
|
814
|
+
if (snapshot === undefined) throw new Error('Vision Toolkit Settings are unavailable')
|
|
815
|
+
if (credentialValue !== undefined) {
|
|
816
|
+
try {
|
|
817
|
+
snapshot = await apiRequest<SettingsSnapshot>({
|
|
818
|
+
method: 'POST',
|
|
819
|
+
headers: { 'Content-Type': 'application/json' },
|
|
820
|
+
body: JSON.stringify({
|
|
821
|
+
action: 'credential',
|
|
822
|
+
expectedRevision: snapshot.settings.revision,
|
|
823
|
+
ref: snapshot.credential.ref,
|
|
824
|
+
value: credentialValue,
|
|
825
|
+
}),
|
|
826
|
+
})
|
|
827
|
+
} catch (error) {
|
|
828
|
+
this.set({
|
|
829
|
+
status: 'ready',
|
|
830
|
+
snapshot,
|
|
831
|
+
health: this.state.health,
|
|
832
|
+
error: error instanceof Error ? error.message : String(error),
|
|
833
|
+
})
|
|
834
|
+
return false
|
|
835
|
+
}
|
|
836
|
+
}
|
|
608
837
|
this.set({ status: 'ready', snapshot, health: this.state.health, message: 'saved' })
|
|
838
|
+
return true
|
|
609
839
|
} catch (error) {
|
|
610
840
|
this.set({ ...this.state, action: undefined, error: error instanceof Error ? error.message : String(error) })
|
|
841
|
+
return false
|
|
611
842
|
}
|
|
612
843
|
}
|
|
613
844
|
|
|
@@ -630,6 +861,9 @@ interface Draft {
|
|
|
630
861
|
baseUrl: string
|
|
631
862
|
credential: string
|
|
632
863
|
model: string
|
|
864
|
+
protocol: 'openai' | 'anthropic'
|
|
865
|
+
anthropicThinking: 'omit' | 'disabled' | 'adaptive'
|
|
866
|
+
userAgent: string
|
|
633
867
|
language: 'zh' | 'en'
|
|
634
868
|
timeoutMs: string
|
|
635
869
|
maxImageBytes: string
|
|
@@ -646,6 +880,9 @@ function draftOf(value: SettingsValue): Draft {
|
|
|
646
880
|
baseUrl: value.provider?.baseUrl ?? 'https://api.inferera.com/v1',
|
|
647
881
|
credential: value.provider?.credential ?? 'VISION_API_KEY',
|
|
648
882
|
model: value.provider?.model ?? 'gemini-3.6-flash',
|
|
883
|
+
protocol: value.provider?.protocol ?? 'openai',
|
|
884
|
+
anthropicThinking: value.provider?.anthropicThinking ?? 'omit',
|
|
885
|
+
userAgent: value.provider?.userAgent ?? DEFAULT_USER_AGENT,
|
|
649
886
|
language: value.language ?? 'zh',
|
|
650
887
|
timeoutMs: String(value.timeoutMs ?? 60000),
|
|
651
888
|
maxImageBytes: String(value.maxImageBytes ?? 10485760),
|
|
@@ -658,20 +895,37 @@ function draftOf(value: SettingsValue): Draft {
|
|
|
658
895
|
}
|
|
659
896
|
}
|
|
660
897
|
|
|
661
|
-
function positiveInteger(raw: string, label: string): number {
|
|
898
|
+
function positiveInteger(raw: string, label: string, t: Translate): number {
|
|
662
899
|
const value = Number(raw)
|
|
663
|
-
if (!Number.isSafeInteger(value) || value <= 0) throw new Error(
|
|
900
|
+
if (!Number.isSafeInteger(value) || value <= 0) throw new Error(t('positiveInteger', { field: label }))
|
|
664
901
|
return value
|
|
665
902
|
}
|
|
666
903
|
|
|
667
|
-
function
|
|
904
|
+
function apiKeyFailure(value: string, t: Translate): string | undefined {
|
|
905
|
+
if (value.length === 0) return undefined
|
|
906
|
+
const trimmed = value.trim()
|
|
907
|
+
if (trimmed.length === 0) return t('apiKeyBlank')
|
|
908
|
+
const quoted = trimmed.length > 1 && ['"', '\'', '`'].includes(trimmed[0] ?? '') && trimmed.endsWith(trimmed[0] ?? '')
|
|
909
|
+
const environmentLine = /^[A-Z][A-Z0-9_]*=[^=]/u.test(trimmed)
|
|
910
|
+
if (quoted || environmentLine || !/^[\x21-\x7E]+$/u.test(trimmed)) return t('apiKeyInvalid')
|
|
911
|
+
return undefined
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function valueOf(draft: Draft, t: Translate): SettingsValue {
|
|
668
915
|
return {
|
|
669
|
-
provider: {
|
|
916
|
+
provider: {
|
|
917
|
+
baseUrl: draft.baseUrl.trim(),
|
|
918
|
+
credential: draft.credential.trim(),
|
|
919
|
+
model: draft.model.trim(),
|
|
920
|
+
protocol: draft.protocol,
|
|
921
|
+
anthropicThinking: draft.anthropicThinking,
|
|
922
|
+
userAgent: draft.userAgent.trim(),
|
|
923
|
+
},
|
|
670
924
|
language: draft.language,
|
|
671
|
-
timeoutMs: positiveInteger(draft.timeoutMs, '
|
|
672
|
-
maxImageBytes: positiveInteger(draft.maxImageBytes, '
|
|
673
|
-
maxImagePixels: positiveInteger(draft.maxImagePixels, '
|
|
674
|
-
concurrency: positiveInteger(draft.concurrency, 'concurrency'),
|
|
925
|
+
timeoutMs: positiveInteger(draft.timeoutMs, t('timeout'), t),
|
|
926
|
+
maxImageBytes: positiveInteger(draft.maxImageBytes, t('maxBytes'), t),
|
|
927
|
+
maxImagePixels: positiveInteger(draft.maxImagePixels, t('maxPixels'), t),
|
|
928
|
+
concurrency: positiveInteger(draft.concurrency, t('concurrency'), t),
|
|
675
929
|
runtime: {
|
|
676
930
|
mode: draft.runtimeMode,
|
|
677
931
|
...(draft.runtimeMode === 'external' ? { agentVisionToolkitPath: draft.toolkitPath.trim() } : {}),
|
|
@@ -697,10 +951,74 @@ function SettingsSection({ controller, t }: SettingsProps) {
|
|
|
697
951
|
return <LoadedSettings controller={controller} t={t} />
|
|
698
952
|
}
|
|
699
953
|
|
|
954
|
+
const HEALTH_NAME_KEYS: Record<string, LocaleKey> = {
|
|
955
|
+
python: 'healthPython',
|
|
956
|
+
dependencies: 'healthDependencies',
|
|
957
|
+
chrome: 'healthChrome',
|
|
958
|
+
credential: 'healthCredential',
|
|
959
|
+
artifactDirectory: 'healthArtifactDirectory',
|
|
960
|
+
tempDirectory: 'healthTempDirectory',
|
|
961
|
+
service: 'healthService',
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const HEALTH_STATUS_KEYS: Record<HealthCheck['status'], LocaleKey> = {
|
|
965
|
+
ok: 'statusOk',
|
|
966
|
+
warning: 'statusWarning',
|
|
967
|
+
error: 'statusError',
|
|
968
|
+
not_tested: 'statusNotTested',
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function healthDetail(name: string, detail: string, t: Translate): string {
|
|
972
|
+
if (name === 'python') {
|
|
973
|
+
const match = /^(.+) via (.+)$/u.exec(detail)
|
|
974
|
+
if (match !== null) return t('healthPythonDetail', { version: match[1], path: match[2] })
|
|
975
|
+
}
|
|
976
|
+
if (detail === 'Chrome/Chromium/Edge was not found; vision_html_screenshot is unavailable') return t('healthChromeMissing')
|
|
977
|
+
if (detail === 'Chrome availability probe failed') return t('healthChromeProbeFailed')
|
|
978
|
+
let match = /^credential (.+) is not configured$/u.exec(detail)
|
|
979
|
+
if (match !== null) return t('healthCredentialMissing', { credential: match[1] })
|
|
980
|
+
match = /^credential (.+) is resolvable$/u.exec(detail)
|
|
981
|
+
if (match !== null) return t('healthCredentialReady', { credential: match[1] })
|
|
982
|
+
match = /^credential (.+) could not be resolved$/u.exec(detail)
|
|
983
|
+
if (match !== null) return t('healthCredentialFailed', { credential: match[1] })
|
|
984
|
+
match = /^(Artifact directory|Runtime temp directory) is writable: (.+)$/u.exec(detail)
|
|
985
|
+
if (match !== null) return t('healthDirectoryWritable', {
|
|
986
|
+
directory: match[1] === 'Artifact directory' ? t('healthArtifactDirectory') : t('healthTempDirectory'),
|
|
987
|
+
path: match[2],
|
|
988
|
+
})
|
|
989
|
+
match = /^(Artifact directory|Runtime temp directory) is not writable: (.+)$/u.exec(detail)
|
|
990
|
+
if (match !== null) return t('healthDirectoryNotWritable', {
|
|
991
|
+
directory: match[1] === 'Artifact directory' ? t('healthArtifactDirectory') : t('healthTempDirectory'),
|
|
992
|
+
path: match[2],
|
|
993
|
+
})
|
|
994
|
+
if (detail === 'Artifact directory could not be prepared') return t('healthArtifactDirectoryFailed')
|
|
995
|
+
if (detail === 'Connection was not tested; pass testConnection=true to query the configured /models endpoint') return t('healthConnectionNotTested')
|
|
996
|
+
if (detail === 'Connection test skipped because the configured credential is unavailable') return t('healthConnectionCredentialMissing')
|
|
997
|
+
match = /^Service responded at (.+) \(HTTP (\d+)\)$/u.exec(detail)
|
|
998
|
+
if (match !== null) return t('healthServiceResponded', { endpoint: match[1], status: match[2] })
|
|
999
|
+
match = /^Service rejected the configured credential \(HTTP (\d+)\)$/u.exec(detail)
|
|
1000
|
+
if (match !== null) return t('healthServiceRejectedCredential', { status: match[1] })
|
|
1001
|
+
match = /^Service is reachable but does not expose GET \/models \(HTTP (\d+)\)$/u.exec(detail)
|
|
1002
|
+
if (match !== null) return t('healthServiceNoModels', { status: match[1] })
|
|
1003
|
+
if (detail === 'Service is reachable but rate-limited the connection test (HTTP 429)') return t('healthServiceRateLimited')
|
|
1004
|
+
match = /^Service connection test failed with HTTP (\d+)$/u.exec(detail)
|
|
1005
|
+
if (match !== null) return t('healthServiceHttpFailed', { status: match[1] })
|
|
1006
|
+
match = /^Service could not be reached at (.+)$/u.exec(detail)
|
|
1007
|
+
if (match !== null) return t('healthServiceUnreachable', { endpoint: match[1] })
|
|
1008
|
+
return detail
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
function credentialSource(source: string, t: Translate): string {
|
|
1012
|
+
if (source === 'env') return t('sourceEnv')
|
|
1013
|
+
if (source === 'file') return t('sourceFile')
|
|
1014
|
+
return source
|
|
1015
|
+
}
|
|
1016
|
+
|
|
700
1017
|
function LoadedSettings({ controller, t }: SettingsInjected) {
|
|
701
1018
|
const state = useSyncExternalStore(controller.subscribe, controller.snapshot, controller.snapshot)
|
|
702
1019
|
const snapshot = state.snapshot
|
|
703
1020
|
const [draft, setDraft] = useState<Draft | undefined>(undefined)
|
|
1021
|
+
const [apiKey, setApiKey] = useState('')
|
|
704
1022
|
const [draftError, setDraftError] = useState<string | undefined>(undefined)
|
|
705
1023
|
|
|
706
1024
|
useEffect(() => { if (state.status === 'idle') void controller.load() }, [controller, state.status])
|
|
@@ -718,21 +1036,31 @@ function LoadedSettings({ controller, t }: SettingsInjected) {
|
|
|
718
1036
|
const update = <K extends keyof Draft>(key: K, value: Draft[K]): void => setDraft(current => current === undefined ? current : { ...current, [key]: value })
|
|
719
1037
|
const save = (): void => {
|
|
720
1038
|
try {
|
|
1039
|
+
const keyFailure = apiKeyFailure(apiKey, t)
|
|
1040
|
+
if (keyFailure !== undefined) {
|
|
1041
|
+
setDraftError(keyFailure)
|
|
1042
|
+
return
|
|
1043
|
+
}
|
|
1044
|
+
const credentialValue = apiKey.length === 0 ? undefined : apiKey.trim()
|
|
721
1045
|
setDraftError(undefined)
|
|
722
|
-
void controller.save(
|
|
1046
|
+
void controller.save(
|
|
1047
|
+
valueOf(draft, t),
|
|
1048
|
+
snapshot.settings.revision,
|
|
1049
|
+
credentialValue,
|
|
1050
|
+
snapshot.writable,
|
|
1051
|
+
).then(saved => { if (saved) setApiKey('') })
|
|
723
1052
|
} catch (error) {
|
|
724
1053
|
setDraftError(error instanceof Error ? error.message : String(error))
|
|
725
1054
|
}
|
|
726
1055
|
}
|
|
727
1056
|
const busy = state.action !== undefined
|
|
1057
|
+
const credentialMatchesSnapshot = draft.credential.trim() === snapshot.credential.ref
|
|
1058
|
+
const keyLocked = credentialMatchesSnapshot && !snapshot.credential.writable
|
|
1059
|
+
const canSave = snapshot.writable || (apiKey.length > 0 && !keyLocked)
|
|
728
1060
|
const runtimeErrorTitle = snapshot.runtime.ready ? t('runtimeCandidateRejected') : t('runtimeUnavailable')
|
|
729
1061
|
|
|
730
1062
|
return (
|
|
731
1063
|
<div className="dvt-settings">
|
|
732
|
-
<header className="dvt-settings-header">
|
|
733
|
-
<div><span className="dvt-kicker">DSH native plugin</span><h2>{t('settingsTitle')}</h2><p>{t('settingsIntro')}</p></div>
|
|
734
|
-
<div className="dvt-release"><span>{t('pluginVersion')} <strong>{snapshot.release.pluginVersion}</strong></span><span>{t('upstreamVersion')} <strong>{snapshot.release.upstreamVersion}</strong></span><span>{t('activeGeneration')} <strong>{snapshot.runtime.generation}</strong></span></div>
|
|
735
|
-
</header>
|
|
736
1064
|
<div className="dvt-alert notice">{t('externalNotice')}</div>
|
|
737
1065
|
{!snapshot.writable ? <div className="dvt-alert warning">{t('readOnly')}</div> : null}
|
|
738
1066
|
{draftError === undefined ? null : <div className="dvt-alert error">{draftError}</div>}
|
|
@@ -740,36 +1068,55 @@ function LoadedSettings({ controller, t }: SettingsInjected) {
|
|
|
740
1068
|
{state.message === 'saved' ? <div className="dvt-alert success">{t('saved')}</div> : null}
|
|
741
1069
|
{snapshot.runtime.lastError === undefined ? null : <div className="dvt-alert error"><strong>{runtimeErrorTitle}</strong><span>{snapshot.runtime.lastError}</span></div>}
|
|
742
1070
|
|
|
743
|
-
<section className="dvt-panel"><div className="dvt-panel-title"><h3>{t('provider')}</h3><span className={`dvt-badge ${snapshot.credential.configured ? 'ok' : 'error'}`}>{snapshot.credential.configured ? t('configured') : t('missing')}</span></div>
|
|
1071
|
+
<section className="dvt-panel dvt-essential"><div className="dvt-panel-title"><div><h3>{t('provider')}</h3><p>{t('providerHint')}</p></div><span className={`dvt-badge ${snapshot.credential.configured ? 'ok' : 'error'}`}>{snapshot.credential.configured ? t('configured') : t('missing')}</span></div>
|
|
744
1072
|
<div className="dvt-form-grid">
|
|
745
|
-
<Field label={t('
|
|
746
|
-
<Field label={t('
|
|
747
|
-
<Field label={t('
|
|
748
|
-
<Field label={t('
|
|
1073
|
+
<Field label={t('protocol')}><select disabled={!snapshot.writable || busy} value={draft.protocol} onChange={(event) => { update('protocol', event.target.value as 'openai' | 'anthropic') }}><option value="openai">OpenAI Chat Completions</option><option value="anthropic">Anthropic Messages</option></select></Field>
|
|
1074
|
+
<Field label={t('baseUrl')}><Input disabled={!snapshot.writable || busy} value={draft.baseUrl} onChange={(event) => { update('baseUrl', event.target.value) }} /></Field>
|
|
1075
|
+
<Field label={t('model')}><Input disabled={!snapshot.writable || busy} value={draft.model} onChange={(event) => { update('model', event.target.value) }} /></Field>
|
|
1076
|
+
<Field label={t('apiKey')} hint={keyLocked ? t('apiKeyLocked') : snapshot.credential.source === undefined ? t('apiKeyHint') : `${t('apiKeyHint')} ${t('sourceHint', { source: t('source'), value: credentialSource(snapshot.credential.source, t) })}`}><Input aria-label={t('apiKey')} type="password" autoComplete="new-password" disabled={busy || keyLocked} placeholder={snapshot.credential.configured ? t('apiKeyPlaceholderConfigured') : t('apiKeyPlaceholderMissing')} value={apiKey} onChange={(event) => { setApiKey(event.target.value); setDraftError(undefined) }} /></Field>
|
|
749
1077
|
</div>
|
|
750
1078
|
</section>
|
|
751
1079
|
|
|
752
|
-
<
|
|
753
|
-
<Field label={t('timeout')}><Input inputMode="numeric" value={draft.timeoutMs} onChange={(event) => { update('timeoutMs', event.target.value) }} /></Field>
|
|
754
|
-
<Field label={t('maxBytes')}><Input inputMode="numeric" value={draft.maxImageBytes} onChange={(event) => { update('maxImageBytes', event.target.value) }} /></Field>
|
|
755
|
-
<Field label={t('maxPixels')}><Input inputMode="numeric" value={draft.maxImagePixels} onChange={(event) => { update('maxImagePixels', event.target.value) }} /></Field>
|
|
756
|
-
<Field label={t('concurrency')}><Input inputMode="numeric" value={draft.concurrency} onChange={(event) => { update('concurrency', event.target.value) }} /></Field>
|
|
757
|
-
</div></section>
|
|
758
|
-
|
|
759
|
-
<section className="dvt-panel"><div className="dvt-panel-title"><h3>{t('runtime')}</h3><span className={`dvt-badge ${snapshot.runtime.ready ? 'ok' : 'error'}`}>{snapshot.runtime.ready ? snapshot.runtime.upstream?.source ?? 'ready' : t('runtimeUnavailable')}</span></div><div className="dvt-form-grid">
|
|
760
|
-
<Field label={t('runtimeMode')}><select value={draft.runtimeMode} onChange={(event) => { update('runtimeMode', event.target.value as 'managed' | 'external') }}><option value="managed">managed</option><option value="external">external</option></select></Field>
|
|
761
|
-
{draft.runtimeMode === 'external' ? <Field label={t('toolkitPath')}><Input value={draft.toolkitPath} onChange={(event) => { update('toolkitPath', event.target.value) }} /></Field> : null}
|
|
762
|
-
<Field label={t('python')}><Input placeholder="python3" value={draft.python} onChange={(event) => { update('python', event.target.value) }} /></Field>
|
|
763
|
-
<Field label={t('allowedDirs')} hint={t('allowedDirsHint')}><textarea rows={3} value={draft.allowedDirs} onChange={(event) => { update('allowedDirs', event.target.value) }} /></Field>
|
|
764
|
-
</div>
|
|
765
|
-
{snapshot.runtime.upstream === undefined ? null : <div className="dvt-runtime-facts"><code>{snapshot.runtime.upstream.path}</code><code>{snapshot.runtime.upstream.python} · {snapshot.runtime.upstream.pythonVersion}</code><code>{snapshot.runtime.upstream.runtimeHome}</code></div>}
|
|
766
|
-
</section>
|
|
767
|
-
|
|
768
|
-
<div className="dvt-save-row"><Button variant="primary" disabled={!snapshot.writable || busy} onClick={save}>{state.action === 'save' ? t('saving') : t('save')}</Button><Button variant="outline" disabled={busy} onClick={() => { void controller.load() }}>{t('reload')}</Button></div>
|
|
1080
|
+
<div className="dvt-save-row"><Button variant="primary" disabled={!canSave || busy} onClick={save}>{state.action === 'save' ? t('saving') : t('save')}</Button><Button variant="outline" disabled={busy} onClick={() => { void controller.load() }}>{t('reload')}</Button></div>
|
|
769
1081
|
|
|
770
1082
|
<section className="dvt-panel"><div className="dvt-panel-title"><div><h3>{t('health')}</h3><p>{t('connectionHint')}</p></div><div className="dvt-actions"><Button size="sm" variant="outline" disabled={busy || !snapshot.runtime.ready} onClick={() => { void controller.runHealth(false) }}>{state.action === 'health' ? t('testing') : t('runHealth')}</Button><Button size="sm" variant="primary" disabled={busy || !snapshot.runtime.ready} onClick={() => { void controller.runHealth(true) }}>{state.action === 'connection' ? t('testing') : t('testConnection')}</Button></div></div>
|
|
771
|
-
|
|
1083
|
+
<p className="dvt-muted">{t('saveBeforeTesting')}</p>
|
|
1084
|
+
{state.health === undefined ? <p className="dvt-muted">{t('notTested')}</p> : <div className="dvt-health-grid">{Object.entries(state.health.checks).map(([name, check]) => <div key={name} data-status={check.status}><span>{t(HEALTH_NAME_KEYS[name] ?? 'health')}</span><strong>{t(HEALTH_STATUS_KEYS[check.status])}</strong><p>{healthDetail(name, check.detail, t)}</p></div>)}</div>}
|
|
772
1085
|
</section>
|
|
1086
|
+
|
|
1087
|
+
<details className="dvt-advanced">
|
|
1088
|
+
<summary><span><strong>{t('advanced')}</strong><small>{t('advancedHint')}</small></span><span className="dvt-details-chevron" aria-hidden="true">⌄</span></summary>
|
|
1089
|
+
<div className="dvt-advanced-body">
|
|
1090
|
+
<section className="dvt-panel"><div className="dvt-panel-title"><h3>{t('provider')}</h3></div><div className="dvt-form-grid">
|
|
1091
|
+
<Field label={t('credential')} hint={t('credentialHint')}><Input aria-label={t('credential')} disabled={!snapshot.writable || busy} value={draft.credential} onChange={(event) => { update('credential', event.target.value) }} /></Field>
|
|
1092
|
+
{draft.protocol === 'anthropic' ? <Field label={t('anthropicThinking')} hint={t('anthropicThinkingHint')}><select aria-label={t('anthropicThinking')} value={draft.anthropicThinking} onChange={(event) => { update('anthropicThinking', event.target.value as 'omit' | 'disabled' | 'adaptive') }}><option value="omit">omit (widest compatibility)</option><option value="disabled">disabled (model support required)</option><option value="adaptive">adaptive (model support required)</option></select></Field> : null}
|
|
1093
|
+
<Field label={t('userAgent')}><Input value={draft.userAgent} onChange={(event) => { update('userAgent', event.target.value) }} /></Field>
|
|
1094
|
+
</div></section>
|
|
1095
|
+
|
|
1096
|
+
<section className="dvt-panel"><div className="dvt-panel-title"><h3>{t('limits')}</h3></div><div className="dvt-form-grid">
|
|
1097
|
+
<Field label={t('language')}><select value={draft.language} onChange={(event) => { update('language', event.target.value as 'zh' | 'en') }}><option value="zh">中文</option><option value="en">English</option></select></Field>
|
|
1098
|
+
<Field label={t('timeout')}><Input inputMode="numeric" value={draft.timeoutMs} onChange={(event) => { update('timeoutMs', event.target.value) }} /></Field>
|
|
1099
|
+
<Field label={t('maxBytes')}><Input inputMode="numeric" value={draft.maxImageBytes} onChange={(event) => { update('maxImageBytes', event.target.value) }} /></Field>
|
|
1100
|
+
<Field label={t('maxPixels')}><Input inputMode="numeric" value={draft.maxImagePixels} onChange={(event) => { update('maxImagePixels', event.target.value) }} /></Field>
|
|
1101
|
+
<Field label={t('concurrency')}><Input inputMode="numeric" value={draft.concurrency} onChange={(event) => { update('concurrency', event.target.value) }} /></Field>
|
|
1102
|
+
</div></section>
|
|
1103
|
+
|
|
1104
|
+
<section className="dvt-panel"><div className="dvt-panel-title"><h3>{t('runtime')}</h3><span className={`dvt-badge ${snapshot.runtime.ready ? 'ok' : 'error'}`}>{snapshot.runtime.ready ? snapshot.runtime.upstream?.source === 'managed' ? t('runtimeManaged') : snapshot.runtime.upstream?.source === 'external' ? t('runtimeExternal') : t('runtimeReady') : t('runtimeUnavailable')}</span></div><div className="dvt-form-grid">
|
|
1105
|
+
<Field label={t('runtimeMode')}><select value={draft.runtimeMode} onChange={(event) => { update('runtimeMode', event.target.value as 'managed' | 'external') }}><option value="managed">{t('runtimeManaged')}</option><option value="external">{t('runtimeExternal')}</option></select></Field>
|
|
1106
|
+
{draft.runtimeMode === 'external' ? <Field label={t('toolkitPath')}><Input value={draft.toolkitPath} onChange={(event) => { update('toolkitPath', event.target.value) }} /></Field> : null}
|
|
1107
|
+
<Field label={t('python')}><Input placeholder="python3" value={draft.python} onChange={(event) => { update('python', event.target.value) }} /></Field>
|
|
1108
|
+
<Field label={t('allowedDirs')} hint={t('allowedDirsHint')}><textarea rows={3} value={draft.allowedDirs} onChange={(event) => { update('allowedDirs', event.target.value) }} /></Field>
|
|
1109
|
+
</div>
|
|
1110
|
+
{snapshot.runtime.upstream === undefined ? null : <div className="dvt-runtime-facts"><code>{snapshot.runtime.upstream.path}</code><code>{snapshot.runtime.upstream.python} · {snapshot.runtime.upstream.pythonVersion}</code><code>{snapshot.runtime.upstream.runtimeHome}</code></div>}
|
|
1111
|
+
</section>
|
|
1112
|
+
|
|
1113
|
+
</div>
|
|
1114
|
+
</details>
|
|
1115
|
+
|
|
1116
|
+
<footer className="dvt-settings-footer">
|
|
1117
|
+
<div><span className="dvt-kicker">{t('pluginKind')}</span><h2>{t('settingsTitle')}</h2><p>{t('settingsIntro')}</p></div>
|
|
1118
|
+
<div className="dvt-release"><span>{t('pluginVersion')} <strong>{snapshot.release.pluginVersion}</strong></span><span>{t('upstreamVersion')} <strong>{snapshot.release.upstreamVersion}</strong></span><span>{t('activeGeneration')} <strong>{t('activeGenerationValue', { generation: snapshot.runtime.generation })}</strong></span></div>
|
|
1119
|
+
</footer>
|
|
773
1120
|
</div>
|
|
774
1121
|
)
|
|
775
1122
|
}
|
|
@@ -779,10 +1126,11 @@ const CSS = `
|
|
|
779
1126
|
.dvt-tool-head{width:100%;min-height:38px;display:flex;align-items:center;gap:7px;padding:8px 10px;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer;font:inherit}.dvt-tool-head:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.dvt-tool-icon{width:20px;height:20px;display:grid;place-items:center;border-radius:6px;color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 12%,transparent);flex:none}.dvt-tool-title{font-size:12px;font-weight:650;white-space:nowrap}.dvt-tool-sep{opacity:.35}.dvt-tool-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--dsw-alias-label-secondary)}.dvt-tool-status{margin-left:auto;font-size:11px;color:var(--dsw-alias-label-secondary);max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dvt-tool[data-state=error] .dvt-tool-status{color:var(--dsw-alias-state-error-primary)}.dvt-chevron{margin-left:auto;transition:transform .16s ease;opacity:.55}.dvt-chevron[data-open=true]{transform:rotate(180deg)}.dvt-tool-body{padding:0 10px 10px}.dvt-stack{display:grid;gap:10px}.dvt-muted{margin:0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.5}
|
|
780
1127
|
.dvt-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.dvt-metrics>div,.dvt-diff-score{padding:10px;border-radius:9px;background:var(--dsw-alias-bg-layer-2);display:grid;gap:4px}.dvt-metrics span,.dvt-diff-score span{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--dsw-alias-label-secondary)}.dvt-metrics strong,.dvt-diff-score strong{font-size:13px}.dvt-list{list-style:none;margin:0;padding:0;display:grid;gap:4px;max-height:160px;overflow:auto}.dvt-list li{display:flex;justify-content:space-between;gap:12px;padding:6px 8px;border-radius:7px;background:var(--dsw-alias-bg-layer-2);font-size:11px}.dvt-list code{color:var(--dsw-alias-state-business-primary)}.dvt-table-wrap{max-height:220px;overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:9px}.dvt-table{width:100%;border-collapse:collapse;font-size:11px}.dvt-table th,.dvt-table td{padding:7px 8px;text-align:left;border-bottom:1px solid var(--dsw-alias-border-l1)}.dvt-table th{position:sticky;top:0;background:var(--dsw-alias-bg-layer-2);font-size:10px;text-transform:uppercase;letter-spacing:.05em}.dvt-table tr:last-child td{border-bottom:0}
|
|
781
1128
|
.dvt-artifact{border:1px solid var(--dsw-alias-border-l1);border-radius:10px;overflow:hidden;background:var(--dsw-alias-bg-layer-1)}.dvt-preview{display:block;width:100%;max-height:360px;object-fit:contain;background:repeating-conic-gradient(var(--dsw-alias-bg-module-platform) 0 25%,var(--dsw-alias-bg-layer-1) 0 50%) 50%/18px 18px;border:0}.dvt-svg{height:280px}.dvt-artifact-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px}.dvt-artifact-meta>div:first-child{min-width:0;display:grid;gap:2px}.dvt-artifact-meta strong{font-size:12px;overflow:hidden;text-overflow:ellipsis}.dvt-artifact-meta span,.dvt-artifact-meta small{font-size:10px;color:var(--dsw-alias-label-secondary)}.dvt-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.dvt-download{display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground);text-decoration:none;font-size:12px;font-weight:600}.dvt-download:hover{background:var(--dsw-alias-button-primary-hover)}.dvt-download:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.dvt-artifact>.dvt-muted{padding:0 10px 10px}.dvt-diff-score>div{height:5px;border-radius:99px;background:var(--dsw-alias-border-l2);overflow:hidden}.dvt-diff-score i{display:block;height:100%;min-width:2px;background:linear-gradient(90deg,var(--dsw-alias-state-warn-primary),var(--dsw-alias-state-error-primary));border-radius:99px}.dvt-tool h4{font-size:11px;margin:0 0 6px}.dvt-palette{display:grid;grid-template-columns:repeat(auto-fit,minmax(112px,1fr));gap:7px}.dvt-palette>div{display:flex;align-items:center;gap:8px;padding:7px;border:1px solid var(--dsw-alias-border-l1);border-radius:9px}.dvt-palette i{width:28px;height:28px;border-radius:7px;box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l2)}.dvt-palette span{display:grid}.dvt-palette strong{font-size:11px}.dvt-palette small{font-size:10px;color:var(--dsw-alias-label-secondary)}
|
|
782
|
-
.dvt-settings{display:grid;gap:14px;max-width:900px;padding:8px 2px 32px;color:var(--dsw-alias-label-primary)}.dvt-settings-
|
|
1129
|
+
.dvt-settings{display:grid;gap:14px;max-width:900px;padding:8px 2px 32px;color:var(--dsw-alias-label-primary)}.dvt-settings-footer{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;padding:8px 2px}.dvt-settings-footer h2{font-size:25px;letter-spacing:-.025em;margin:3px 0 6px}.dvt-settings-footer p{max-width:620px;margin:0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.55}.dvt-kicker{font-size:10px;text-transform:uppercase;letter-spacing:.1em;color:var(--dsw-alias-state-business-primary);font-weight:700}.dvt-release{display:grid;gap:4px;min-width:170px;padding:9px 11px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);font-size:10px;color:var(--dsw-alias-label-secondary)}.dvt-release span{display:flex;justify-content:space-between;gap:12px}.dvt-release strong{color:var(--dsw-alias-label-primary)}.dvt-alert{padding:10px 12px;border-radius:10px;font-size:12px;line-height:1.5;display:grid;gap:3px}.dvt-alert.notice{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 10%,transparent);color:var(--dsw-alias-state-business-primary)}.dvt-alert.warning{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 12%,transparent);color:var(--dsw-alias-state-warn-label)}.dvt-alert.error{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}.dvt-alert.success{background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent);color:var(--dsw-alias-state-success-primary)}.dvt-panel{display:grid;gap:12px;padding:15px;border:1px solid var(--dsw-alias-border-l1);border-radius:14px;background:var(--dsw-alias-bg-layer-1);box-shadow:var(--dsw-shadow-lv1)}.dvt-panel-title{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.dvt-panel-title h3{font-size:14px;margin:0}.dvt-panel-title p{font-size:11px;line-height:1.45;color:var(--dsw-alias-label-secondary);margin:4px 0 0;max-width:620px}.dvt-badge{font-size:10px;padding:3px 7px;border-radius:999px;font-weight:650}.dvt-badge.ok{background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 12%,transparent);color:var(--dsw-alias-state-success-primary)}.dvt-badge.error{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}.dvt-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dvt-field{display:grid;gap:6px;align-content:start}.dvt-field>span{font-size:11px;font-weight:600}.dvt-field>small{font-size:10px;color:var(--dsw-alias-label-secondary);line-height:1.4}.dvt-field select,.dvt-field textarea{width:100%;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;padding:8px 10px}.dvt-field select{height:36px}.dvt-field textarea{resize:vertical;min-height:76px}.dvt-runtime-facts{display:grid;gap:4px;padding:9px 10px;border-radius:9px;background:var(--dsw-alias-bg-layer-2);overflow:auto}.dvt-runtime-facts code{font-size:10px;white-space:nowrap;color:var(--dsw-alias-label-secondary)}.dvt-save-row{display:flex;gap:8px;padding:2px 0}
|
|
1130
|
+
.dvt-settings-footer{margin-top:8px;padding:20px 2px 4px;border-top:1px solid var(--dsw-alias-border-l1);opacity:.82}.dvt-settings-footer h2{font-size:18px;letter-spacing:-.015em;margin:3px 0 5px}.dvt-settings-footer p{font-size:11px;line-height:1.5}.dvt-release{min-width:220px}.dvt-release span{white-space:nowrap}.dvt-essential{border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 30%,var(--dsw-alias-border-l1));box-shadow:var(--dsw-shadow-lv1),0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-business-primary) 5%,transparent)}.dvt-advanced{border:1px solid var(--dsw-alias-border-l1);border-radius:14px;background:var(--dsw-alias-bg-layer-1);overflow:hidden}.dvt-advanced>summary{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 15px;cursor:pointer;list-style:none}.dvt-advanced>summary::-webkit-details-marker{display:none}.dvt-advanced>summary>span:first-child{display:grid;gap:3px}.dvt-advanced>summary strong{font-size:13px}.dvt-advanced>summary small{font-size:10px;line-height:1.45;color:var(--dsw-alias-label-secondary);font-weight:400}.dvt-details-chevron{font-size:15px;opacity:.55;transition:transform .16s ease}.dvt-advanced[open] .dvt-details-chevron{transform:rotate(180deg)}.dvt-advanced-body{display:grid;gap:12px;padding:0 12px 12px}.dvt-advanced-body>.dvt-panel{box-shadow:none}
|
|
783
1131
|
.dvt-health-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px}.dvt-health-grid>div{padding:9px 10px;border-radius:9px;background:var(--dsw-alias-bg-layer-2);border-left:3px solid var(--dsw-alias-border-l4)}.dvt-health-grid>div[data-status=ok]{border-left-color:var(--dsw-alias-state-success-primary)}.dvt-health-grid>div[data-status=warning],.dvt-health-grid>div[data-status=not_tested]{border-left-color:var(--dsw-alias-state-warn-primary)}.dvt-health-grid>div[data-status=error]{border-left-color:var(--dsw-alias-state-error-primary)}.dvt-health-grid span{font-size:10px;text-transform:capitalize}.dvt-health-grid strong{float:right;font-size:9px;text-transform:uppercase;color:var(--dsw-alias-label-secondary)}.dvt-health-grid p{clear:both;margin:5px 0 0;font-size:10px;line-height:1.4;color:var(--dsw-alias-label-secondary)}.dvt-loading{padding:24px;border-radius:12px;background:var(--dsw-alias-bg-layer-2);font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
784
1132
|
.dvt-paste-dock{box-sizing:border-box;width:calc(100% - 32px);max-width:var(--dsh-composer-card-max-width,960px);margin:0 auto;display:flex;flex-wrap:wrap;gap:6px;padding:0 2px 6px}.dvt-paste-chip{max-width:100%;height:32px;box-sizing:border-box;display:flex;align-items:center;gap:7px;padding:0 6px 0 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-specific-tip);font-size:12px}.dvt-paste-chip[data-status=copying]{border-color:var(--dsw-alias-state-business-primary)}.dvt-paste-chip[data-status=error]{border-color:var(--dsw-alias-state-error-primary)}.dvt-paste-name{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dvt-paste-detail{color:var(--dsw-alias-label-caption);max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dvt-paste-chip[data-status=error] .dvt-paste-detail{color:var(--dsw-alias-state-error-primary)}.dvt-paste-chip button{width:20px;height:20px;display:grid;place-items:center;border:0;border-radius:50%;padding:0;background:transparent;color:var(--dsw-alias-label-caption);font:inherit;font-size:16px;cursor:pointer}.dvt-paste-chip button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.dvt-paste-chip button:disabled{opacity:.4;cursor:default}
|
|
785
|
-
@media(max-width:720px){.dvt-settings-
|
|
1133
|
+
@media(max-width:720px){.dvt-settings-footer{display:grid}.dvt-release{width:auto}.dvt-form-grid{grid-template-columns:1fr}.dvt-metrics{grid-template-columns:1fr}.dvt-artifact-meta{align-items:flex-start;flex-direction:column}.dvt-panel-title{flex-direction:column}}
|
|
786
1134
|
`
|
|
787
1135
|
|
|
788
1136
|
function installStyles(): () => void {
|