@maricgeer/dsh-websearch 0.1.2 → 0.2.0

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/lib/client.js CHANGED
@@ -35,7 +35,6 @@ window.__ModuleLoader__.load({
35
35
  keySelRoundRobin: "Round-robin",
36
36
  keySelRandom: "Random",
37
37
  keySelectionHint: "Keys default to \"{policy}\" selection; on failure the tool retries across its own keys first — up to 3 attempts including the first — before degrading to the next tool.",
38
- sharedWithModels: "Shared with Models",
39
38
  toolTitle: "Web search",
40
39
  fetchTitle: "Web fetch",
41
40
  servedBy: "Served by",
@@ -52,7 +51,6 @@ window.__ModuleLoader__.load({
52
51
  chainNoUsableWarning: "No usable search tool and no working fallback — the next web_search will fail. Enable or configure a tool member, or select the DeepSeek paid fallback (needs the Models-page key, offered with fewer than two ready tools).",
53
52
  maxUsesLabel: "Max searches per request",
54
53
  maxUsesHint: "One request may search at most {N} times before it must answer.",
55
- chainTailHint: "The designated fallback tool is pinned at the chain tail and not orderable; Auto = the last tool in the order.",
56
54
  configure: "Configure",
57
55
  fallbackAutoOption: "Auto (chain-order last)",
58
56
  fallbackDeepseekOption: "DeepSeek paid",
@@ -72,7 +70,6 @@ window.__ModuleLoader__.load({
72
70
  searchLanguageNote: "One ISO language code (e.g. zh) for the members with a search-level language parameter — Tavily, and AnySearch (mapped to BCP-47, e.g. zh -> zh-CN). Applies to the next search; leave empty to send none.",
73
71
  optDefault: "Default",
74
72
  optOff: "No limit",
75
- recencyHour: "Past hour",
76
73
  recencyDay: "Past day",
77
74
  recencyWeek: "Past week",
78
75
  recencyMonth: "Past month",
@@ -114,9 +111,6 @@ window.__ModuleLoader__.load({
114
111
  fcTbsNote: "Time filter, comma-combinable: qdr:h/d/w/m/y presets, sbd:1 (date sort), cdr:1,cd_min:MM/DD/YYYY,cd_max:MM/DD/YYYY (custom range). Invalid expressions are rejected on save.",
115
112
  fcSafeLabel: "SafeSearch",
116
113
  fcSafeNote: "Filter explicit content from web source results; off = not sent (no filtering).",
117
- ctxLow: "Low",
118
- ctxMedium: "Medium",
119
- ctxHigh: "High",
120
114
  fcTbsLabel: "Time filter",
121
115
  fcLocationLabel: "Location",
122
116
  fcLocationNote: "Free-text place (e.g. Beijing,China) for city-level geo-targeting; pairs best with a region code above.",
@@ -125,9 +119,8 @@ window.__ModuleLoader__.load({
125
119
  searchExcludeDomainsLabel: "Exclude domains",
126
120
  searchExcludeDomainsNote: "Comma-separated blocklist applied to Tavily/Exa/Firecrawl. Mutually exclusive with the include list — setting one clears the other.",
127
121
  domainsLabel: "Domains",
128
- domainsNote: "Two mutually exclusive lists: include = allowlist only, exclude = blocklist only. Setting one clears the other.",
129
- modeFilter: "Filter",
130
- modeBoost: "Boost (weight)",
122
+ modeRestrict: "Restrict",
123
+ modePrefer: "Prefer (weight)",
131
124
  catCompany: "Company",
132
125
  catPublication: "Publication",
133
126
  catNews: "News",
@@ -139,6 +132,7 @@ window.__ModuleLoader__.load({
139
132
  fcCatDeveloper: "Developer",
140
133
  fcCatResearch: "Research",
141
134
  fcCatPdf: "PDF",
135
+ fcCatAlexandria: "Alexandria",
142
136
  chunksPerSourceLabel: "Chunks per source",
143
137
  chunksOne: "1 (compact)",
144
138
  chunksTwo: "2",
@@ -156,7 +150,48 @@ window.__ModuleLoader__.load({
156
150
  keyCountZeroTitle: "No API keys configured",
157
151
  paramsGroupLabel: "Search parameters",
158
152
  fetchChainHint: "The web_fetch degradation order: Firecrawl → Tavily → AnySearch, each with its own multi-key retries. Independent of the search order; member toggles apply to both chains.",
159
- fetchTakeoverNoteS21: "ON: web_fetch stays visible and is served by the plugin fetch chain (Firecrawl/Tavily/AnySearch — cloud-side extraction, unaffected by local network limits). OFF: plain local HTTP fetch. Uninstalling restores the official provider."
153
+ fetchTakeoverNoteS21: "ON: web_fetch stays visible and is served by the plugin fetch chain (Firecrawl/Tavily/AnySearch — cloud-side extraction, unaffected by local network limits). OFF: plain local HTTP fetch. Uninstalling restores the official provider.",
154
+ dnsTitle: "DNS resilience",
155
+ dnsDescription: "Encrypted DoH resolution plus egress precheck for the members above — bypasses resolver blackholes and CDN-rotation timeouts on restricted networks. Auto mode enables itself only on reserved-range evidence; a clean network keeps the system resolver untouched (zero overhead).",
156
+ dnsModeLabel: "Mode",
157
+ fallbackAutoShort: "Auto",
158
+ fallbackDeepseekShort: "Paid",
159
+ dnsModeAutoShort: "Auto",
160
+ dnsModeOnShort: "On",
161
+ dnsModeAuto: "Auto (evidence-based)",
162
+ dnsModeOn: "Always on",
163
+ dnsModeOff: "Off",
164
+ dnsModeHint: "Auto checks the member hostnames once per process on first use; a reserved-range answer (e.g. 198.18.x.x) arms the layer, a clean answer uninstalls it entirely.",
165
+ dnsPresetLabel: "DoH nodes",
166
+ dnsPresetAutoShort: "Auto",
167
+ dnsPresetCnShort: "China",
168
+ dnsPresetGlobalShort: "Global",
169
+ dnsPresetAuto: "Auto (probe & rank)",
170
+ dnsPresetCn: "China (AliDNS/DNSPod)",
171
+ dnsPresetGlobal: "Global (Cloudflare/Google/Quad9)",
172
+ dnsPresetCustom: "Custom",
173
+ dnsPresetHint: "Auto probes the built-in pool and keeps the two fastest reachable nodes — the right default on both sides of the wall.",
174
+ dnsNodesLabel: "Custom nodes",
175
+ dnsNodesHint: "One node per line: host,sni,path,port — host is usually an IP literal, path defaults to /dns-query, port to 443.",
176
+ dnsProbeMethodLabel: "Probe method",
177
+ dnsProbeMethodTcp: "TCP (bare)",
178
+ dnsProbeMethodTlsHello: "TLS-Hello (SNI-aware)",
179
+ dnsProbeMethodHint: "TLS-Hello sends a real TLS ClientHello with the hostname, so (SNI,IP)-filtered networks (side-router class) produce an accurate reachability signal. TCP is lighter but blind on such networks.",
180
+ dnsStatusArmed: "DoH active",
181
+ dnsStatusIdle: "System resolver",
182
+ dnsStatusSuspended: "Suspended (proxy detected)",
183
+ dnsDecisionNone: "Not detected yet (auto arms on first member use)",
184
+ dnsDecisionPoisoned: "Reserved-range evidence — layer enabled",
185
+ dnsDecisionClean: "Network clean — layer not installed",
186
+ dnsDecisionInconclusive: "System resolution unavailable — layer enabled conservatively",
187
+ dnsDecisionEmpty: "No member hostnames in scope",
188
+ dnsHitsLabel: "Evidence",
189
+ dnsFailuresLabel: "Unresolved samples",
190
+ dnsRecheck: "Re-check",
191
+ dnsRechecking: "Checking…",
192
+ dnsTraceTitle: "Recent resolutions",
193
+ dnsTraceEmpty: "No resolutions recorded yet",
194
+ dnsTraceLatency: "{ms}ms"
160
195
  };
161
196
  /** Chinese dictionary (complete per {@link DshWsLocaleKey}; parity is typed). */
162
197
  const zh = {
@@ -183,7 +218,6 @@ window.__ModuleLoader__.load({
183
218
  keySelRoundRobin: "轮询",
184
219
  keySelRandom: "随机",
185
220
  keySelectionHint: "key 默认按「{policy}」选取;请求失败优先在本工具的多把 key 间重试——至多 3 次尝试(含首次),仍失败才降级下一个工具。",
186
- sharedWithModels: "共用模型 Key",
187
221
  toolTitle: "网页搜索",
188
222
  fetchTitle: "网页获取",
189
223
  servedBy: "服务成员",
@@ -207,7 +241,6 @@ window.__ModuleLoader__.load({
207
241
  fallbackDesignationLostNote: "指定的兜底工具未就绪(缺 key 或已停用);期间由链序末位工具承担兜底。",
208
242
  chainLockedNote: "锁定兜底",
209
243
  fetchTakeoverLabel: "接管 web_fetch(插件链)",
210
- chainTailHint: "被指定的兜底工具固定链尾、不可排序;自动 = 链序末位即兜底。",
211
244
  configure: "配置",
212
245
  keyPlaceholder: "{ref},可填多把:APIKEY1,APIKEY2,…(最多 10 把)",
213
246
  chainOrderHint: "链序即主备序:首位是主搜索工具——失败先在其多把 key 间重试(至多 3 次尝试),再按序降级;末位就绪成员即链内兜底位(或被指定的兜底工具,锁定链尾)。内置默认序:Tavily → Exa → Firecrawl → AnySearch。",
@@ -220,7 +253,6 @@ window.__ModuleLoader__.load({
220
253
  searchLanguageNote: "一个 ISO 语言码(如 zh),作用于有搜索级语言参数的工具——Tavily,以及 AnySearch(映射为 BCP-47,如 zh → zh-CN)。下一次搜索生效;留空不发送。",
221
254
  optDefault: "默认",
222
255
  optOff: "不限",
223
- recencyHour: "1 小时内",
224
256
  recencyDay: "24 小时内",
225
257
  recencyWeek: "1 周内",
226
258
  recencyMonth: "1 个月内",
@@ -230,12 +262,12 @@ window.__ModuleLoader__.load({
230
262
  topicFinance: "财经",
231
263
  tavilyTimeRangeLabel: "时间范围",
232
264
  tavilyDepthLabel: "搜索深度",
233
- depthAdvanced: "增强(2× 消耗)",
265
+ depthAdvanced: "增强",
234
266
  depthFast: "快速",
235
267
  depthUltraFast: "极速",
236
268
  tavilyAnswerLabel: "生成答案",
237
269
  answerBasic: "基础",
238
- answerAdvanced: "高级(更详细)",
270
+ answerAdvanced: "高级",
239
271
  exaTypeLabel: "搜索类型",
240
272
  typeInstant: "即时",
241
273
  typeFast: "快速",
@@ -262,9 +294,6 @@ window.__ModuleLoader__.load({
262
294
  fcTbsNote: "时间过滤,可逗号组合:qdr:h/d/w/m/y 预设、sbd:1(按日期排序)、cdr:1,cd_min:MM/DD/YYYY,cd_max:MM/DD/YYYY(自定义区间)。非法表达式保存时会被拒绝。",
263
295
  fcSafeLabel: "安全搜索",
264
296
  fcSafeNote: "过滤 web 来源结果中的显式内容;关闭 = 不发送该参数(不过滤)。",
265
- ctxLow: "低",
266
- ctxMedium: "中",
267
- ctxHigh: "高",
268
297
  fcTbsLabel: "时效过滤",
269
298
  fcLocationLabel: "位置",
270
299
  fcLocationNote: "自由文本地点(如 Beijing,China),城市级地理定向;与上方区域码搭配效果最好。",
@@ -273,20 +302,20 @@ window.__ModuleLoader__.load({
273
302
  searchExcludeDomainsLabel: "排除域名",
274
303
  searchExcludeDomainsNote: "逗号分隔黑名单,作用于 Tavily/Exa/Firecrawl。与仅含列表互斥——设置其一自动清除另一。",
275
304
  domainsLabel: "域名过滤",
276
- domainsNote: "两个互斥列表:仅含 = 白名单,排除 = 黑名单。设置其一自动清除另一。",
277
- modeFilter: "过滤",
278
- modeBoost: "加权(仍搜全网)",
305
+ modeRestrict: "严格限定",
306
+ modePrefer: "优先加权",
279
307
  catCompany: "公司",
280
308
  catPublication: "出版物",
281
309
  catNews: "新闻",
282
- catPersonalSite: "个人站点",
310
+ catPersonalSite: "个人",
283
311
  catFinancialReport: "财报",
284
312
  catPeople: "人物",
285
313
  srcNews: "仅新闻",
286
- srcWebNews: "网页 + 新闻",
314
+ srcWebNews: "双源",
287
315
  fcCatDeveloper: "开发者",
288
316
  fcCatResearch: "研究",
289
317
  fcCatPdf: "PDF",
318
+ fcCatAlexandria: "Alexandria(research 迁移后)",
290
319
  chunksPerSourceLabel: "每源内容块数",
291
320
  chunksOne: "1(紧凑)",
292
321
  chunksTwo: "2",
@@ -304,7 +333,48 @@ window.__ModuleLoader__.load({
304
333
  keyCountZeroTitle: "暂无有效 API Key",
305
334
  paramsGroupLabel: "搜索参数",
306
335
  fetchChainHint: "web_fetch 降级序:Firecrawl → Tavily → AnySearch,各含自身多 key 重试。与搜索序相互独立;成员启停对两条链同时生效。",
307
- fetchTakeoverNoteS21: "开:web_fetch 保持可见,由插件抓取链服务(Firecrawl/Tavily/AnySearch——云端提取,不受本机网络限制影响)。关:普通本机 HTTP 抓取。卸载插件后自动恢复官方。"
336
+ fetchTakeoverNoteS21: "开:web_fetch 保持可见,由插件抓取链服务(Firecrawl/Tavily/AnySearch——云端提取,不受本机网络限制影响)。关:普通本机 HTTP 抓取。卸载插件后自动恢复官方。",
337
+ dnsTitle: "DNS 韧性",
338
+ dnsDescription: "为上方成员提供加密 DoH 解析与出口预检——绕过受限网络上的解析黑洞与 CDN 轮转超时。auto 模式仅在检出保留段证据时启用;干净网络保持系统解析零改动(零开销)。",
339
+ dnsModeLabel: "模式",
340
+ fallbackAutoShort: "自动",
341
+ fallbackDeepseekShort: "付费",
342
+ dnsModeAutoShort: "自动",
343
+ dnsModeOnShort: "开启",
344
+ dnsModeAuto: "自动(按证据)",
345
+ dnsModeOn: "始终开启",
346
+ dnsModeOff: "关闭",
347
+ dnsModeHint: "自动模式在首次使用时对成员域名做一次进程级检测:应答命中保留段(如 198.18.x.x)即启用;干净应答则完全不安装拦截层。",
348
+ dnsPresetLabel: "DoH 节点",
349
+ dnsPresetAutoShort: "自动",
350
+ dnsPresetCnShort: "国内",
351
+ dnsPresetGlobalShort: "海外",
352
+ dnsPresetAuto: "自动(探测排序)",
353
+ dnsPresetCn: "国内(AliDNS/DNSPod)",
354
+ dnsPresetGlobal: "海外(Cloudflare/Google/Quad9)",
355
+ dnsPresetCustom: "自定义",
356
+ dnsPresetHint: "自动模式并行探测内置节点池,保留最快的两个可达节点——墙内外都是正确的默认值。",
357
+ dnsNodesLabel: "自定义节点",
358
+ dnsNodesHint: "每行一个节点:host,sni,path,port——host 通常写 IP 字面量,path 默认 /dns-query,端口默认 443。",
359
+ dnsProbeMethodLabel: "探测方式",
360
+ dnsProbeMethodTcp: "TCP(裸探测)",
361
+ dnsProbeMethodTlsHello: "TLS-Hello(带SNI)",
362
+ dnsProbeMethodHint: "TLS-Hello 发送带域名的真实 TLS ClientHello,(SNI,IP) 过滤网络(旁路由类)下可产生准确的可达性信号;TCP 更轻量但在此类网络上全盲。",
363
+ dnsStatusArmed: "DoH 生效中",
364
+ dnsStatusIdle: "系统解析",
365
+ dnsStatusSuspended: "已暂停(检测到代理)",
366
+ dnsDecisionNone: "尚未检测(自动模式随首次成员使用触发)",
367
+ dnsDecisionPoisoned: "检出保留段证据——已启用",
368
+ dnsDecisionClean: "网络干净——未安装拦截层",
369
+ dnsDecisionInconclusive: "系统解析不可用——保守启用",
370
+ dnsDecisionEmpty: "范围内无成员域名",
371
+ dnsHitsLabel: "证据",
372
+ dnsFailuresLabel: "未解析样本",
373
+ dnsRecheck: "立即重检",
374
+ dnsRechecking: "检测中…",
375
+ dnsTraceTitle: "最近解析",
376
+ dnsTraceEmpty: "暂无解析记录",
377
+ dnsTraceLatency: "{ms}ms"
308
378
  };
309
379
  //#endregion
310
380
  //#region src/client/controller.ts
@@ -315,6 +385,10 @@ window.__ModuleLoader__.load({
315
385
  /** Bundled member display metadata; ids, default refs, and the documented
316
386
  * default endpoints mirror the node-half provider constants (the endpoint is
317
387
  * the GUI placeholder for the「接口地址」field, S14p). */
388
+ /** Member display label by member id (the served-by badge face; three call sites shared one copy each before S37 T11). */
389
+ function memberLabelOf(memberId) {
390
+ return MEMBERS.find((member) => member.memberId === memberId)?.label ?? memberId;
391
+ }
318
392
  const MEMBERS = [
319
393
  {
320
394
  key: "tavily",
@@ -375,7 +449,7 @@ window.__ModuleLoader__.load({
375
449
  * event) funnels here so the snapshot is always derived, never patched in
376
450
  * place.
377
451
  */
378
- function deriveSnapshot(value, facts, counts, writable, revision) {
452
+ function deriveSnapshot(value, facts, counts, writable, revision, dnsStatus, dnsTrace) {
379
453
  const members = MEMBERS.map((member) => {
380
454
  const section = value[member.key];
381
455
  const refName = section?.apiKeyEnv ?? member.defaultRef;
@@ -437,6 +511,19 @@ window.__ModuleLoader__.load({
437
511
  searchLanguage: value.searchLanguage,
438
512
  searchIncludeDomains: value.searchIncludeDomains,
439
513
  searchExcludeDomains: value.searchExcludeDomains,
514
+ dns: {
515
+ mode: value.dns?.mode ?? "auto",
516
+ preset: value.dns?.preset ?? "auto",
517
+ probeMethod: value.dns?.probe?.method ?? "tcp",
518
+ nodesText: (value.dns?.nodes ?? []).map((node) => [
519
+ node.host,
520
+ node.sni,
521
+ node.path ?? "",
522
+ node.port ?? ""
523
+ ].join(",")).join("\n"),
524
+ status: dnsStatus,
525
+ trace: dnsTrace
526
+ },
440
527
  revision,
441
528
  writable
442
529
  };
@@ -448,9 +535,11 @@ window.__ModuleLoader__.load({
448
535
  #value = EMPTY_SECTION;
449
536
  #facts = EMPTY_FACTS;
450
537
  #counts = EMPTY_COUNTS;
538
+ #dnsStatus = void 0;
539
+ #dnsTrace = [];
451
540
  #writable = false;
452
541
  #revision = void 0;
453
- #snapshot = deriveSnapshot(EMPTY_SECTION, EMPTY_FACTS, EMPTY_COUNTS, false, void 0);
542
+ #snapshot = deriveSnapshot(EMPTY_SECTION, EMPTY_FACTS, EMPTY_COUNTS, false, void 0, void 0, []);
454
543
  #unsubscribe;
455
544
  constructor(ports) {
456
545
  this.#ports = ports;
@@ -462,7 +551,11 @@ window.__ModuleLoader__.load({
462
551
  this.refreshCounts();
463
552
  });
464
553
  await this.#refreshSection();
465
- await Promise.all([this.#refreshCredentials(), this.refreshCounts()]);
554
+ await Promise.all([
555
+ this.#refreshCredentials(),
556
+ this.refreshCounts(),
557
+ this.refreshDnsFace()
558
+ ]);
466
559
  }
467
560
  /**
468
561
  * Re-describe the settings document and recompute from it. S14i audit fix:
@@ -674,18 +767,94 @@ window.__ModuleLoader__.load({
674
767
  async refreshCounts() {
675
768
  const refs = MEMBERS.map((member) => this.#refNameOf(member.key));
676
769
  const described = await this.#ports.describeKeyCounts(refs);
677
- if (described.ok) {
678
- this.#counts = new Map(Object.entries(described.value));
679
- this.#recompute();
770
+ if (described.ok) this.#counts = new Map(Object.entries(described.value));
771
+ this.#recompute();
772
+ }
773
+ /**
774
+ * S35: refresh the DNS remote face (status + trace ring). Old hosts without
775
+ * the service leave both undefined — the block renders the config-only
776
+ * view. Fires on init, after every dns settings write, and from the
777
+ * re-check button.
778
+ */
779
+ async refreshDnsFace() {
780
+ const dns = this.#ports.dns;
781
+ if (dns === void 0) return;
782
+ const [status, trace] = await Promise.all([dns.describeDnsStatus(), dns.readDnsTrace()]);
783
+ this.#dnsStatus = status.ok ? status.value : void 0;
784
+ this.#dnsTrace = trace.ok ? trace.value : [];
785
+ this.#recompute();
786
+ }
787
+ /** S35: force a fresh canary pass (the re-check button) and refresh the face. */
788
+ async recheckDns() {
789
+ const dns = this.#ports.dns;
790
+ if (dns === void 0) return { ok: false };
791
+ if (!(await dns.requestDnsRecheck()).ok) return { ok: false };
792
+ await this.refreshDnsFace();
793
+ return { ok: true };
794
+ }
795
+ /** S35: set the DNS mode (auto/on/off); hot — off uninstalls the patch immediately. */
796
+ async setDnsMode(mode) {
797
+ if (!(await this.#ports.updateSettings("dsh-websearch", { dns: { mode } }, this.#revision)).ok) return { ok: false };
798
+ await this.#refreshSection();
799
+ await this.refreshDnsFace();
800
+ return { ok: true };
801
+ }
802
+ /** S35: set the hostname scope (members/all); hot on the next resolution. */
803
+ /** S39 (plan 038 T3): set the egress probe method; hot on the next resolution. */
804
+ async setDnsProbeMethod(method) {
805
+ if (!(await this.#ports.updateSettings("dsh-websearch", { dns: { probe: { method } } }, this.#revision)).ok) return { ok: false };
806
+ await this.#refreshSection();
807
+ return { ok: true };
808
+ }
809
+ /** S35: set the DoH node preset; custom requires a non-empty validated node list. */
810
+ async setDnsPreset(preset) {
811
+ if (preset === "custom" && this.#parseDnsNodes(this.#snapshot.dns.nodesText) === void 0) return { ok: false };
812
+ if (!(await this.#ports.updateSettings("dsh-websearch", { dns: { preset } }, this.#revision)).ok) return { ok: false };
813
+ await this.#refreshSection();
814
+ return { ok: true };
815
+ }
816
+ /**
817
+ * S35: save the custom node list (textarea form, one `host,sni,path,port`
818
+ * per line). Every line needs a non-blank host and sni — the same rule the
819
+ * node half's validate hook enforces before persist.
820
+ */
821
+ async setDnsNodesText(text) {
822
+ const nodes = this.#parseDnsNodes(text);
823
+ if (nodes === void 0) return { ok: false };
824
+ if (!(await this.#ports.updateSettings("dsh-websearch", { dns: { nodes } }, this.#revision)).ok) return { ok: false };
825
+ await this.#refreshSection();
826
+ return { ok: true };
827
+ }
828
+ /** Parse the textarea form; undefined when any line fails the host+sni rule. */
829
+ #parseDnsNodes(text) {
830
+ const nodes = [];
831
+ for (const rawLine of text.split("\n")) {
832
+ const line = rawLine.trim();
833
+ if (line.length === 0) continue;
834
+ const [host, sni, path, portText] = line.split(",").map((field) => field.trim());
835
+ if (host === void 0 || host.length === 0 || sni === void 0 || sni.length === 0) return void 0;
836
+ const port = portText !== void 0 && portText.length > 0 ? Number(portText) : void 0;
837
+ if (port !== void 0 && (!Number.isInteger(port) || port < 1 || port > 65535)) return void 0;
838
+ nodes.push({
839
+ host,
840
+ sni,
841
+ ...path !== void 0 && path.length > 0 ? { path } : {},
842
+ ...port !== void 0 ? { port } : {}
843
+ });
680
844
  }
845
+ return nodes;
681
846
  }
682
847
  #recompute() {
683
- this.#snapshot = deriveSnapshot(this.#value, this.#facts, this.#counts, this.#writable, this.#revision);
848
+ this.#snapshot = deriveSnapshot(this.#value, this.#facts, this.#counts, this.#writable, this.#revision, this.#dnsStatus, this.#dnsTrace);
684
849
  for (const listener of this.#listeners) listener();
685
850
  }
686
851
  };
687
852
  //#endregion
688
853
  //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
854
+ function getEnumValues(entries) {
855
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
856
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
857
+ }
689
858
  function joinValues(array, separator = "|") {
690
859
  return array.map((val) => stringifyPrimitive(val)).join(separator);
691
860
  }
@@ -693,6 +862,23 @@ window.__ModuleLoader__.load({
693
862
  if (typeof value === "bigint") return value.toString();
694
863
  return value;
695
864
  }
865
+ var Cached = class {
866
+ constructor(getter) {
867
+ this._getter = getter;
868
+ this._value = void 0;
869
+ }
870
+ get value() {
871
+ const getter = this._getter;
872
+ if (getter !== void 0) {
873
+ this._value = getter();
874
+ this._getter = void 0;
875
+ }
876
+ return this._value;
877
+ }
878
+ };
879
+ function cached(getter) {
880
+ return new Cached(getter);
881
+ }
696
882
  function nullish(input) {
697
883
  return input === null || input === void 0;
698
884
  }
@@ -725,6 +911,49 @@ window.__ModuleLoader__.load({
725
911
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
726
912
  return desc?.get ? desc.get.raw : desc?.value;
727
913
  }
914
+ function sourceShape(schema) {
915
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
916
+ }
917
+ function deferProp(target, key, getter) {
918
+ Object.defineProperty(target, key, {
919
+ get() {
920
+ const value = getter();
921
+ assignProp(this, key, value);
922
+ return value;
923
+ },
924
+ enumerable: true,
925
+ configurable: true
926
+ });
927
+ }
928
+ function putProp(target, key, value) {
929
+ if (key in target) assignProp(target, key, value);
930
+ else target[key] = value;
931
+ }
932
+ /**
933
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
934
+ *
935
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
936
+ */
937
+ function mirrorShape(target, source, keys, wrap) {
938
+ const raw = sourceShape(source);
939
+ for (const key of keys) {
940
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
941
+ if (!desc.enumerable) continue;
942
+ if (desc.get) deferProp(target, key, () => {
943
+ const value = source._zod.def.shape[key];
944
+ return wrap ? wrap(value, key) : value;
945
+ });
946
+ else putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
947
+ }
948
+ }
949
+ function mirrorProps(target, source) {
950
+ for (const key of Reflect.ownKeys(source)) {
951
+ const desc = Object.getOwnPropertyDescriptor(source, key);
952
+ if (!desc.enumerable) continue;
953
+ if (desc.get) deferProp(target, key, () => source[key]);
954
+ else putProp(target, key, desc.value);
955
+ }
956
+ }
728
957
  function mergeDefs(...defs) {
729
958
  const mergedDescriptors = {};
730
959
  for (const def of defs) {
@@ -733,6 +962,9 @@ window.__ModuleLoader__.load({
733
962
  }
734
963
  return Object.defineProperties({}, mergedDescriptors);
735
964
  }
965
+ function esc(str) {
966
+ return JSON.stringify(str);
967
+ }
736
968
  function slugify(input) {
737
969
  return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
738
970
  }
@@ -740,6 +972,16 @@ window.__ModuleLoader__.load({
740
972
  function isObject(data) {
741
973
  return typeof data === "object" && data !== null && !Array.isArray(data);
742
974
  }
975
+ const allowsEval = /* @__PURE__*/ cached(() => {
976
+ if (globalConfig.jitless) return false;
977
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
978
+ try {
979
+ new Function("");
980
+ return true;
981
+ } catch (_) {
982
+ return false;
983
+ }
984
+ });
743
985
  function isPlainObject(o) {
744
986
  if (isObject(o) === false) return false;
745
987
  const ctor = o.constructor;
@@ -757,6 +999,11 @@ window.__ModuleLoader__.load({
757
999
  if (o instanceof Set) return new Set(o);
758
1000
  return o;
759
1001
  }
1002
+ const propertyKeyTypes = /* @__PURE__*/ new Set([
1003
+ "string",
1004
+ "number",
1005
+ "symbol"
1006
+ ]);
760
1007
  function escapeRegex(str) {
761
1008
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
762
1009
  }
@@ -785,6 +1032,11 @@ window.__ModuleLoader__.load({
785
1032
  if (typeof value === "string") return `"${value}"`;
786
1033
  return `${value}`;
787
1034
  }
1035
+ function optionalKeys(shape) {
1036
+ return Object.keys(shape).filter((k) => {
1037
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
1038
+ });
1039
+ }
788
1040
  const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
789
1041
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
790
1042
  int32: [-2147483648, 2147483647],
@@ -796,6 +1048,94 @@ window.__ModuleLoader__.load({
796
1048
  int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
797
1049
  uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")]
798
1050
  };
1051
+ function pick(schema, mask) {
1052
+ const currDef = schema._zod.def;
1053
+ const checks = currDef.checks;
1054
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
1055
+ const newShape = {};
1056
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
1057
+ return clone(schema, mergeDefs(currDef, {
1058
+ shape: newShape,
1059
+ checks: []
1060
+ }));
1061
+ }
1062
+ function maskedKeys(schema, mask) {
1063
+ const raw = sourceShape(schema);
1064
+ const keys = [];
1065
+ for (const key of Reflect.ownKeys(mask)) {
1066
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) throw new Error(`Unrecognized key: "${String(key)}"`);
1067
+ if (mask[key]) keys.push(key);
1068
+ }
1069
+ return keys;
1070
+ }
1071
+ function omit(schema, mask) {
1072
+ const currDef = schema._zod.def;
1073
+ const checks = currDef.checks;
1074
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
1075
+ const omitted = new Set(maskedKeys(schema, mask));
1076
+ const newShape = {};
1077
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
1078
+ return clone(schema, mergeDefs(currDef, {
1079
+ shape: newShape,
1080
+ checks: []
1081
+ }));
1082
+ }
1083
+ function extend(schema, shape) {
1084
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
1085
+ const checks = schema._zod.def.checks;
1086
+ if (checks && checks.length > 0) {
1087
+ const existingShape = sourceShape(schema);
1088
+ for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
1089
+ }
1090
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1091
+ }
1092
+ function extended(schema, shape) {
1093
+ const newShape = {};
1094
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
1095
+ mirrorProps(newShape, shape);
1096
+ return newShape;
1097
+ }
1098
+ function safeExtend(schema, shape) {
1099
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
1100
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
1101
+ }
1102
+ function merge(a, b) {
1103
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
1104
+ if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
1105
+ const newShape = {};
1106
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
1107
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
1108
+ return clone(a, mergeDefs(a._zod.def, {
1109
+ shape: newShape,
1110
+ get catchall() {
1111
+ return b._zod.def.catchall;
1112
+ },
1113
+ checks: b._zod.def.checks ?? []
1114
+ }));
1115
+ }
1116
+ function partial(Class, schema, mask, name = "partial") {
1117
+ const checks = schema._zod.def.checks;
1118
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
1119
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1120
+ const newShape = {};
1121
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({
1122
+ type: "optional",
1123
+ innerType: value
1124
+ })));
1125
+ return clone(schema, mergeDefs(schema._zod.def, {
1126
+ shape: newShape,
1127
+ checks: []
1128
+ }));
1129
+ }
1130
+ function required(Class, schema, mask) {
1131
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
1132
+ const newShape = {};
1133
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({
1134
+ type: "nonoptional",
1135
+ innerType: value
1136
+ }));
1137
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
1138
+ }
799
1139
  function aborted(x, startIndex = 0) {
800
1140
  if (x.aborted === true) return true;
801
1141
  for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
@@ -936,6 +1276,11 @@ window.__ModuleLoader__.load({
936
1276
  }
937
1277
  });
938
1278
  }
1279
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
1280
+ function claim(inst, sentinel) {
1281
+ const proto = Object.getPrototypeOf(inst);
1282
+ return sentinel in proto ? void 0 : proto;
1283
+ }
939
1284
  let installing;
940
1285
  let broke = false;
941
1286
  const breaker = {
@@ -987,6 +1332,38 @@ window.__ModuleLoader__.load({
987
1332
  }
988
1333
  });
989
1334
  }
1335
+ /**
1336
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
1337
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
1338
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
1339
+ */
1340
+ function installLazyProp(inst, key, make, enumerable) {
1341
+ const proto = claim(inst, key);
1342
+ if (!proto) return;
1343
+ Object.defineProperty(proto, key, {
1344
+ configurable: true,
1345
+ get() {
1346
+ const desc = {
1347
+ configurable: true,
1348
+ writable: true,
1349
+ enumerable,
1350
+ value: void 0
1351
+ };
1352
+ Object.defineProperty(this, key, desc);
1353
+ desc.value = make(this);
1354
+ Object.defineProperty(this, key, desc);
1355
+ return desc.value;
1356
+ },
1357
+ set(value) {
1358
+ Object.defineProperty(this, key, {
1359
+ configurable: true,
1360
+ writable: true,
1361
+ enumerable,
1362
+ value
1363
+ });
1364
+ }
1365
+ });
1366
+ }
990
1367
  /** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
991
1368
  const CONSTANT_CATCH = "~constantCatch";
992
1369
  /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
@@ -1489,6 +1866,7 @@ window.__ModuleLoader__.load({
1489
1866
  const anyString = /^[\s\S]{0,}$/;
1490
1867
  const integer = /^-?\d+$/;
1491
1868
  const number$1 = /^-?\d+(?:\.\d+)?$/;
1869
+ const boolean$1 = /^(?:true|false)$/i;
1492
1870
  const lowercase = /^[^A-Z]*$/;
1493
1871
  const uppercase = /^[^a-z]*$/;
1494
1872
  //#endregion
@@ -1788,6 +2166,40 @@ window.__ModuleLoader__.load({
1788
2166
  };
1789
2167
  });
1790
2168
  //#endregion
2169
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
2170
+ var Doc = class {
2171
+ constructor(args = [], closed = {}) {
2172
+ this.content = [];
2173
+ this.indent = 0;
2174
+ this.args = args;
2175
+ this.closed = closed;
2176
+ }
2177
+ indented(fn) {
2178
+ this.indent += 1;
2179
+ try {
2180
+ fn(this);
2181
+ } finally {
2182
+ this.indent -= 1;
2183
+ }
2184
+ }
2185
+ write(arg) {
2186
+ if (typeof arg === "function") {
2187
+ arg(this, { execution: "sync" });
2188
+ arg(this, { execution: "async" });
2189
+ return;
2190
+ }
2191
+ const lines = arg.split("\n").filter((x) => x);
2192
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
2193
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
2194
+ for (const line of dedented) this.content.push(line);
2195
+ }
2196
+ compile() {
2197
+ const F = Function;
2198
+ const content = this?.content ?? [``];
2199
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
2200
+ }
2201
+ };
2202
+ //#endregion
1791
2203
  //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1792
2204
  const version = {
1793
2205
  major: 4,
@@ -2258,6 +2670,40 @@ window.__ModuleLoader__.load({
2258
2670
  $ZodCheckNumberFormat.init(inst, def);
2259
2671
  $ZodNumber.init(inst, def);
2260
2672
  });
2673
+ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
2674
+ $ZodType.init(inst, def);
2675
+ inst._zod.pattern = boolean$1;
2676
+ inst._zod.parse = (payload, _ctx) => {
2677
+ if (def.coerce) try {
2678
+ payload.value = Boolean(payload.value);
2679
+ } catch (_) {}
2680
+ const input = payload.value;
2681
+ if (typeof input === "boolean") return payload;
2682
+ payload.issues.push({
2683
+ expected: "boolean",
2684
+ code: "invalid_type",
2685
+ input,
2686
+ inst
2687
+ });
2688
+ return payload;
2689
+ };
2690
+ });
2691
+ const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
2692
+ $ZodType.init(inst, def);
2693
+ inst._zod.parse = (payload) => payload;
2694
+ });
2695
+ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
2696
+ $ZodType.init(inst, def);
2697
+ inst._zod.parse = (payload, _ctx) => {
2698
+ payload.issues.push({
2699
+ expected: "never",
2700
+ code: "invalid_type",
2701
+ input: payload.value,
2702
+ inst
2703
+ });
2704
+ return payload;
2705
+ };
2706
+ });
2261
2707
  function handleArrayResult(result, final, index) {
2262
2708
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
2263
2709
  final.value[index] = result.value;
@@ -2296,6 +2742,277 @@ window.__ModuleLoader__.load({
2296
2742
  return payload;
2297
2743
  };
2298
2744
  });
2745
+ function handlePropertyResult(result, final, key, input, optin, optout) {
2746
+ const isPresent = key in input;
2747
+ const isOptionalOut = optout === "optional";
2748
+ if (!isPresent && isOptionalOut && optin === "optional") return;
2749
+ if (result.issues.length) {
2750
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
2751
+ final.issues.push(...prefixIssues(key, result.issues));
2752
+ }
2753
+ if (!isPresent && optin === void 0) {
2754
+ if (!result.issues.length) final.issues.push({
2755
+ code: "invalid_type",
2756
+ expected: "nonoptional",
2757
+ input: void 0,
2758
+ path: [key]
2759
+ });
2760
+ return;
2761
+ }
2762
+ if (result.value === void 0) {
2763
+ if (isPresent || optin === "defaulted" && !isOptionalOut) final.value[key] = void 0;
2764
+ } else final.value[key] = result.value;
2765
+ }
2766
+ const NO_SYMBOL_KEYS = [];
2767
+ function normalizeDef(def) {
2768
+ const keys = Object.keys(def.shape);
2769
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
2770
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
2771
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
2772
+ for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
2773
+ const okeys = optionalKeys(def.shape);
2774
+ return {
2775
+ ...def,
2776
+ allKeys,
2777
+ symbolKeys,
2778
+ keySet: new Set(keys),
2779
+ numKeys: keys.length,
2780
+ optionalKeys: new Set(okeys)
2781
+ };
2782
+ }
2783
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
2784
+ const unrecognized = [];
2785
+ const keySet = def.keySet;
2786
+ const _catchall = def.catchall._zod;
2787
+ const t = _catchall.def.type;
2788
+ const optin = _catchall.optin;
2789
+ const optout = _catchall.optout;
2790
+ let seen = 0;
2791
+ for (const key in input) {
2792
+ if (abortEarly && payload.issues.length !== seen) {
2793
+ if (aborted(payload, seen)) break;
2794
+ seen = payload.issues.length;
2795
+ }
2796
+ if (keySet.has(key)) continue;
2797
+ if (key === "__proto__") {
2798
+ if (t === "never") unrecognized.push(key);
2799
+ continue;
2800
+ }
2801
+ if (t === "never") {
2802
+ unrecognized.push(key);
2803
+ continue;
2804
+ }
2805
+ const r = _catchall.run({
2806
+ value: input[key],
2807
+ issues: []
2808
+ }, ctx);
2809
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2810
+ else handlePropertyResult(r, payload, key, input, optin, optout);
2811
+ }
2812
+ if (unrecognized.length) payload.issues.push({
2813
+ code: "unrecognized_keys",
2814
+ keys: unrecognized,
2815
+ input,
2816
+ inst,
2817
+ continue: true
2818
+ });
2819
+ if (!proms.length) return payload;
2820
+ return Promise.all(proms).then(() => {
2821
+ return payload;
2822
+ });
2823
+ }
2824
+ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2825
+ $ZodType.init(inst, def);
2826
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2827
+ const sh = desc?.get ? desc.get.raw : def.shape ?? {};
2828
+ if (sh) {
2829
+ const get = () => {
2830
+ const newSh = { ...sh };
2831
+ Object.defineProperty(def, "shape", { value: newSh });
2832
+ get.raw = newSh;
2833
+ return newSh;
2834
+ };
2835
+ get.raw = sh;
2836
+ Object.defineProperty(def, "shape", { get });
2837
+ }
2838
+ const _normalized = cached(() => normalizeDef(def));
2839
+ defineLazyInternal(inst, "propValues", (zod) => {
2840
+ const shape = zod.def.shape;
2841
+ const propValues = {};
2842
+ for (const key in shape) {
2843
+ const field = shape[key]._zod;
2844
+ if (field.values) {
2845
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
2846
+ for (const v of field.values) propValues[key].add(v);
2847
+ if (field.optin !== void 0) propValues[key].add(void 0);
2848
+ }
2849
+ }
2850
+ return propValues;
2851
+ });
2852
+ const isObject$2 = isObject;
2853
+ const catchall = def.catchall;
2854
+ let value;
2855
+ const memo = globalConfig.memoizer;
2856
+ memo?.attach(inst);
2857
+ inst._zod.parse = (payload, ctx) => {
2858
+ value ?? (value = _normalized.value);
2859
+ const input = payload.value;
2860
+ if (!isObject$2(input)) {
2861
+ payload.issues.push({
2862
+ expected: "object",
2863
+ code: "invalid_type",
2864
+ input,
2865
+ inst
2866
+ });
2867
+ return payload;
2868
+ }
2869
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2870
+ const proms = [];
2871
+ const shape = value.shape;
2872
+ const abortEarly = ctx?.abortEarly;
2873
+ let seen = payload.issues.length;
2874
+ for (const key of value.allKeys) {
2875
+ if (abortEarly && payload.issues.length !== seen) {
2876
+ if (aborted(payload, seen)) break;
2877
+ seen = payload.issues.length;
2878
+ }
2879
+ if (key === "__proto__") continue;
2880
+ const el = shape[key];
2881
+ const optin = el._zod.optin;
2882
+ const optout = el._zod.optout;
2883
+ const r = el._zod.run({
2884
+ value: input[key],
2885
+ issues: []
2886
+ }, ctx);
2887
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2888
+ else handlePropertyResult(r, payload, key, input, optin, optout);
2889
+ }
2890
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2891
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
2892
+ };
2893
+ });
2894
+ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
2895
+ $ZodObject.init(inst, def);
2896
+ const superParse = inst._zod.parse;
2897
+ const _normalized = cached(() => normalizeDef(def));
2898
+ const memo = globalConfig.memoizer;
2899
+ const generateFastpass = (shape) => {
2900
+ const normalized = _normalized.value;
2901
+ const syms = normalized.symbolKeys;
2902
+ const doc = new Doc(["payload", "ctx"], {
2903
+ shape,
2904
+ inst,
2905
+ memo,
2906
+ syms
2907
+ });
2908
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2909
+ const prefixStr = (id, k) => `
2910
+ let ${id}_ab = false;
2911
+ for (let i = 0; i < ${id}.issues.length; i++) {
2912
+ const iss = ${id}.issues[i];
2913
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2914
+ payload.issues.push(iss);
2915
+ if (iss.continue !== true) ${id}_ab = true;
2916
+ }
2917
+ if (${id}_ab && ctx && ctx.abortEarly) {
2918
+ payload.value = newResult;
2919
+ return payload;
2920
+ }`;
2921
+ doc.write(`const input = payload.value;`);
2922
+ const ids = Object.create(null);
2923
+ let counter = 0;
2924
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
2925
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2926
+ for (const key of normalized.allKeys) {
2927
+ if (key === "__proto__") continue;
2928
+ const id = ids[key];
2929
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
2930
+ const isPresent = `${k} in input`;
2931
+ const schema = shape[key];
2932
+ const optin = schema?._zod?.optin;
2933
+ const isOptionalIn = optin !== void 0;
2934
+ const isOptionalOut = schema?._zod?.optout === "optional";
2935
+ doc.write(`const ${id} = ${parseStr(k)};`);
2936
+ if (isOptionalIn && isOptionalOut) {
2937
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2938
+ doc.write(`
2939
+ const ${id}_present = ${isPresent};
2940
+ if (!${id}.issues.length || ${id}_present) {
2941
+ if (${id}.issues.length) {${prefixStr(id, k)}
2942
+ }
2943
+
2944
+ if (${assign}) {
2945
+ newResult[${k}] = ${id}.value;
2946
+ }
2947
+ }
2948
+
2949
+ `);
2950
+ } else if (!isOptionalIn) doc.write(`
2951
+ const ${id}_present = ${isPresent};
2952
+ if (${id}.issues.length) {${prefixStr(id, k)}
2953
+ }
2954
+ if (!${id}_present && !${id}.issues.length) {
2955
+ payload.issues.push({
2956
+ code: "invalid_type",
2957
+ expected: "nonoptional",
2958
+ input: undefined,
2959
+ path: [${k}]
2960
+ });
2961
+ if (ctx && ctx.abortEarly) {
2962
+ payload.value = newResult;
2963
+ return payload;
2964
+ }
2965
+ }
2966
+
2967
+ if (${id}_present) {
2968
+ newResult[${k}] = ${id}.value;
2969
+ }
2970
+
2971
+ `);
2972
+ else {
2973
+ doc.write(`
2974
+ if (${id}.issues.length) {${prefixStr(id, k)}
2975
+ }
2976
+ `);
2977
+ if (optin === "defaulted") doc.write(`newResult[${k}] = ${id}.value;`);
2978
+ else doc.write(`
2979
+ if (${id}.value !== undefined || ${isPresent}) {
2980
+ newResult[${k}] = ${id}.value;
2981
+ }
2982
+ `);
2983
+ }
2984
+ }
2985
+ doc.write(`payload.value = newResult;`);
2986
+ doc.write(`return payload;`);
2987
+ return doc.compile();
2988
+ };
2989
+ let fastpass;
2990
+ const isObject$1 = isObject;
2991
+ const jit = !globalConfig.jitless;
2992
+ const fastEnabled = jit && allowsEval.value;
2993
+ const catchall = def.catchall;
2994
+ let value;
2995
+ inst._zod.parse = (payload, ctx) => {
2996
+ value ?? (value = _normalized.value);
2997
+ const input = payload.value;
2998
+ if (!isObject$1(input)) {
2999
+ payload.issues.push({
3000
+ expected: "object",
3001
+ code: "invalid_type",
3002
+ input,
3003
+ inst
3004
+ });
3005
+ return payload;
3006
+ }
3007
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
3008
+ if (!fastpass) fastpass = generateFastpass(def.shape);
3009
+ payload = fastpass(payload, ctx);
3010
+ if (!catchall) return payload;
3011
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
3012
+ }
3013
+ return superParse(payload, ctx);
3014
+ };
3015
+ });
2299
3016
  function handleUnionResults(results, final, inst, ctx) {
2300
3017
  for (const result of results) if (result.issues.length === 0) {
2301
3018
  final.value = result.value;
@@ -2597,6 +3314,27 @@ window.__ModuleLoader__.load({
2597
3314
  return payload;
2598
3315
  };
2599
3316
  });
3317
+ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
3318
+ $ZodType.init(inst, def);
3319
+ const values = getEnumValues(def.entries);
3320
+ const valuesSet = new Set(values);
3321
+ inst._zod.values = valuesSet;
3322
+ defineLazyInternal(inst, "pattern", (zod) => {
3323
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
3324
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
3325
+ });
3326
+ inst._zod.parse = (payload, _ctx) => {
3327
+ const input = payload.value;
3328
+ if (valuesSet.has(input)) return payload;
3329
+ payload.issues.push({
3330
+ code: "invalid_value",
3331
+ values,
3332
+ input,
3333
+ inst
3334
+ });
3335
+ return payload;
3336
+ };
3337
+ });
2600
3338
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
2601
3339
  $ZodType.init(inst, def);
2602
3340
  inst._zod.optin = "optional";
@@ -3526,6 +4264,24 @@ window.__ModuleLoader__.load({
3526
4264
  });
3527
4265
  }
3528
4266
  // @__NO_SIDE_EFFECTS__
4267
+ function _boolean(Class, params) {
4268
+ return new Class({
4269
+ type: "boolean",
4270
+ ...normalizeParams(params)
4271
+ });
4272
+ }
4273
+ // @__NO_SIDE_EFFECTS__
4274
+ function _unknown(Class) {
4275
+ return new Class({ type: "unknown" });
4276
+ }
4277
+ // @__NO_SIDE_EFFECTS__
4278
+ function _never(Class, params) {
4279
+ return new Class({
4280
+ type: "never",
4281
+ ...normalizeParams(params)
4282
+ });
4283
+ }
4284
+ // @__NO_SIDE_EFFECTS__
3529
4285
  function _lt(value, params) {
3530
4286
  return new $ZodCheckLessThan({
3531
4287
  check: "less_than",
@@ -4293,6 +5049,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4293
5049
  if (rest.length) json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
4294
5050
  }
4295
5051
  };
5052
+ const booleanProcessor = (_schema, _ctx, json, _params) => {
5053
+ json.type = "boolean";
5054
+ };
5055
+ const neverProcessor = (_schema, _ctx, json, _params) => {
5056
+ json.not = {};
5057
+ };
5058
+ const enumProcessor = (schema, _ctx, json, _params) => {
5059
+ const def = schema._zod.def;
5060
+ const values = getEnumValues(def.entries);
5061
+ if (values.length === 0) {
5062
+ json.not = {};
5063
+ return;
5064
+ }
5065
+ if (values.every((v) => typeof v === "number")) json.type = "number";
5066
+ if (values.every((v) => typeof v === "string")) json.type = "string";
5067
+ json.enum = values;
5068
+ };
4296
5069
  const customProcessor = (schema, ctx, json, params) => {
4297
5070
  handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
4298
5071
  };
@@ -4317,6 +5090,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4317
5090
  if (def.type === "catch") return inputOptin(def.innerType);
4318
5091
  return schema._zod.optin;
4319
5092
  }
5093
+ const objectProcessor = (schema, ctx, _json, params) => {
5094
+ const json = _json;
5095
+ const def = schema._zod.def;
5096
+ const shape = def.shape;
5097
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
5098
+ json.type = "object";
5099
+ json.properties = {};
5100
+ for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
5101
+ ...params,
5102
+ path: [
5103
+ ...params.path,
5104
+ "properties",
5105
+ key
5106
+ ]
5107
+ }));
5108
+ const requiredKeys = [];
5109
+ for (const key of Object.keys(shape)) {
5110
+ const field = def.shape[key];
5111
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
5112
+ }
5113
+ if (requiredKeys.length > 0) json.required = requiredKeys;
5114
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
5115
+ else if (!def.catchall) {
5116
+ if (ctx.io === "output") json.additionalProperties = false;
5117
+ } else if (def.catchall) json.additionalProperties = processSchema(def.catchall, ctx, {
5118
+ ...params,
5119
+ path: [...params.path, "additionalProperties"]
5120
+ });
5121
+ };
4320
5122
  const unionProcessor = (schema, ctx, json, params) => {
4321
5123
  const def = schema._zod.def;
4322
5124
  const isExclusive = def.inclusive === false;
@@ -5097,6 +5899,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5097
5899
  function int(params) {
5098
5900
  return /* @__PURE__ */ _int(ZodNumberFormat, params);
5099
5901
  }
5902
+ const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
5903
+ $ZodBoolean.init(inst, def);
5904
+ ZodType.init(inst, def);
5905
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
5906
+ });
5907
+ function boolean(params) {
5908
+ return /* @__PURE__ */ _boolean(ZodBoolean, params);
5909
+ }
5910
+ const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
5911
+ $ZodUnknown.init(inst, def);
5912
+ ZodType.init(inst, def);
5913
+ inst._zod.processJSONSchema = (ctx, json, params) => void 0;
5914
+ });
5915
+ function unknown() {
5916
+ return /* @__PURE__ */ _unknown(ZodUnknown);
5917
+ }
5918
+ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
5919
+ $ZodNever.init(inst, def);
5920
+ ZodType.init(inst, def);
5921
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
5922
+ });
5923
+ function never(params) {
5924
+ return /* @__PURE__ */ _never(ZodNever, params);
5925
+ }
5100
5926
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
5101
5927
  _ensureDefaultMemoizer();
5102
5928
  $ZodArray.init(inst, def);
@@ -5123,7 +5949,65 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5123
5949
  function array(element, params) {
5124
5950
  return /* @__PURE__ */ _array(ZodArray, element, params);
5125
5951
  }
5126
- const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
5952
+ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5953
+ _ensureDefaultMemoizer();
5954
+ $ZodObjectJIT.init(inst, def);
5955
+ ZodType.init(inst, def);
5956
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
5957
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
5958
+ }, {
5959
+ keyof() {
5960
+ return _enum(Object.keys(this._zod.def.shape));
5961
+ },
5962
+ catchall(catchall) {
5963
+ return this.clone(mergeDefs(this._zod.def, { catchall }));
5964
+ },
5965
+ passthrough() {
5966
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5967
+ },
5968
+ loose() {
5969
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
5970
+ },
5971
+ strict() {
5972
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
5973
+ },
5974
+ strip() {
5975
+ return this.clone(mergeDefs(this._zod.def, { catchall: void 0 }));
5976
+ },
5977
+ extend(incoming) {
5978
+ return extend(this, incoming);
5979
+ },
5980
+ safeExtend(incoming) {
5981
+ return safeExtend(this, incoming);
5982
+ },
5983
+ merge(other) {
5984
+ return merge(this, other);
5985
+ },
5986
+ pick(mask) {
5987
+ return pick(this, mask);
5988
+ },
5989
+ omit(mask) {
5990
+ return omit(this, mask);
5991
+ },
5992
+ partial(...args) {
5993
+ return partial(ZodOptional, this, args[0]);
5994
+ },
5995
+ exactPartial(...args) {
5996
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
5997
+ },
5998
+ required(...args) {
5999
+ return required(ZodNonOptional, this, args[0]);
6000
+ }
6001
+ });
6002
+ function object(shape, params) {
6003
+ const def = {
6004
+ type: "object",
6005
+ shape: shape ?? {},
6006
+ ...normalizeParams(params)
6007
+ };
6008
+ return new ZodObject(def);
6009
+ }
6010
+ const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
5127
6011
  $ZodUnion.init(inst, def);
5128
6012
  ZodType.init(inst, def);
5129
6013
  inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
@@ -5170,6 +6054,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5170
6054
  ...normalizeParams(params)
5171
6055
  });
5172
6056
  }
6057
+ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
6058
+ $ZodEnum.init(inst, def);
6059
+ ZodType.init(inst, def);
6060
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
6061
+ inst.enum = def.entries;
6062
+ inst.options = [...inst._zod.values];
6063
+ const keys = new Set(Object.keys(def.entries));
6064
+ inst.extract = (values, params) => {
6065
+ const newEntries = {};
6066
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
6067
+ else throw new Error(`Key ${value} not found in enum`);
6068
+ return new ZodEnum({
6069
+ ...def,
6070
+ checks: [],
6071
+ ...normalizeParams(params),
6072
+ entries: newEntries
6073
+ });
6074
+ };
6075
+ inst.exclude = (values, params) => {
6076
+ const newEntries = { ...def.entries };
6077
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
6078
+ else throw new Error(`Key ${value} not found in enum`);
6079
+ return new ZodEnum({
6080
+ ...def,
6081
+ checks: [],
6082
+ ...normalizeParams(params),
6083
+ entries: newEntries
6084
+ });
6085
+ };
6086
+ });
6087
+ function _enum(values, params) {
6088
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
6089
+ return new ZodEnum({
6090
+ type: "enum",
6091
+ entries,
6092
+ ...normalizeParams(params)
6093
+ });
6094
+ }
5173
6095
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
5174
6096
  _ensureDefaultMemoizer();
5175
6097
  $ZodTransform.init(inst, def);
@@ -5335,6 +6257,114 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5335
6257
  return /* @__PURE__ */ _superRefine(fn, params);
5336
6258
  }
5337
6259
  //#endregion
6260
+ //#region src/client/dns-remote.ts
6261
+ const verdictSchema = _enum([
6262
+ "poisoned",
6263
+ "clean",
6264
+ "inconclusive",
6265
+ "empty"
6266
+ ]);
6267
+ const decisionSchema = object({
6268
+ action: _enum(["enable", "skip"]),
6269
+ verdict: verdictSchema,
6270
+ hits: array(object({
6271
+ host: string(),
6272
+ addresses: array(string())
6273
+ })),
6274
+ failures: array(object({
6275
+ host: string(),
6276
+ reason: string()
6277
+ }))
6278
+ });
6279
+ const statusSchema = object({
6280
+ mode: _enum([
6281
+ "auto",
6282
+ "on",
6283
+ "off"
6284
+ ]),
6285
+ scope: _enum(["members", "all"]),
6286
+ preset: _enum([
6287
+ "auto",
6288
+ "cn",
6289
+ "global",
6290
+ "custom"
6291
+ ]),
6292
+ armed: boolean(),
6293
+ proxyActive: boolean(),
6294
+ decision: decisionSchema.nullable()
6295
+ });
6296
+ const traceSchema = array(object({
6297
+ at: number(),
6298
+ kind: _enum([
6299
+ "resolve",
6300
+ "decision",
6301
+ "fallback",
6302
+ "suspend"
6303
+ ]),
6304
+ host: string(),
6305
+ via: string().optional(),
6306
+ latencyMs: number().optional(),
6307
+ kept: number().optional(),
6308
+ dropped: number().optional(),
6309
+ code: string().optional(),
6310
+ detail: string().optional()
6311
+ }));
6312
+ /** The client contribution (exported for cross-generation shape tests). */
6313
+ const dnsContribution = {
6314
+ package: "dsh-websearch",
6315
+ descriptors: [
6316
+ {
6317
+ id: "dsh-websearch#dshws-websearch/describeDnsStatus",
6318
+ service: "dshwsDns",
6319
+ namespace: "dshws-websearch",
6320
+ method: "describeDnsStatus",
6321
+ invocation: { kind: "direct" },
6322
+ parameters: [],
6323
+ result: {
6324
+ mode: "strict",
6325
+ typeSymbol: "dsh-websearch#dshws-websearch/dns-status",
6326
+ schema: statusSchema,
6327
+ create: () => statusSchema
6328
+ }
6329
+ },
6330
+ {
6331
+ id: "dsh-websearch#dshws-websearch/readDnsTrace",
6332
+ service: "dshwsDns",
6333
+ namespace: "dshws-websearch",
6334
+ method: "readDnsTrace",
6335
+ invocation: { kind: "direct" },
6336
+ parameters: [],
6337
+ result: {
6338
+ mode: "strict",
6339
+ typeSymbol: "dsh-websearch#dshws-websearch/dns-trace",
6340
+ schema: traceSchema,
6341
+ create: () => traceSchema
6342
+ }
6343
+ },
6344
+ {
6345
+ id: "dsh-websearch#dshws-websearch/requestDnsRecheck",
6346
+ service: "dshwsDns",
6347
+ namespace: "dshws-websearch",
6348
+ method: "requestDnsRecheck",
6349
+ invocation: { kind: "direct" },
6350
+ parameters: [],
6351
+ result: {
6352
+ mode: "strict",
6353
+ typeSymbol: "dsh-websearch#dshws-websearch/dns-recheck",
6354
+ schema: statusSchema,
6355
+ create: () => statusSchema
6356
+ }
6357
+ }
6358
+ ]
6359
+ };
6360
+ /**
6361
+ * The DNS descriptors ride the SAME single mount as the key-count face
6362
+ * (key-counts-remote mounts the combined contribution): a second lazy $mount
6363
+ * of the already-mounted dshws-websearch namespace hung forever in the 3423
6364
+ * retest. mountContribution is designed for one grouped install, and the
6365
+ * plugin now performs exactly one.
6366
+ */
6367
+ //#endregion
5338
6368
  //#region src/client/key-counts-remote.ts
5339
6369
  const refsSchema = array(string());
5340
6370
  const resultSchema = record(string(), number());
@@ -5364,7 +6394,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5364
6394
  schema: resultSchema,
5365
6395
  create: () => resultSchema
5366
6396
  }
5367
- }]
6397
+ }, ...dnsContribution.descriptors]
5368
6398
  };
5369
6399
  /**
5370
6400
  * Mount the namespace in the caller's fiber and return its typed caller.
@@ -5376,6 +6406,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5376
6406
  return ctx.get("remote.dshws-websearch");
5377
6407
  }
5378
6408
  //#endregion
6409
+ //#region src/client/dns-trace-store.ts
6410
+ const listeners = /* @__PURE__ */ new Set();
6411
+ let entries = [];
6412
+ let fetcher;
6413
+ let inFlight;
6414
+ /**
6415
+ * Register the trace fetcher (the client entry; idempotent — the last
6416
+ * registration wins across HMR rebuilds).
6417
+ * @param next - pulls the sanitized ring across the mounted remote.
6418
+ */
6419
+ function registerDnsTraceFetcher(next) {
6420
+ fetcher = next;
6421
+ }
6422
+ /** The current sanitized entries, oldest first. */
6423
+ function dnsTraceEntries() {
6424
+ return entries;
6425
+ }
6426
+ /** Subscribe to entry replacements; returns the unsubscribe. */
6427
+ function subscribeDnsTrace(listener) {
6428
+ listeners.add(listener);
6429
+ return () => {
6430
+ listeners.delete(listener);
6431
+ };
6432
+ }
6433
+ /**
6434
+ * Pull a fresh ring through the registered fetcher; a no-op without one (an
6435
+ * entry that never mounted the remote) and coalesced while in flight.
6436
+ */
6437
+ function refreshDnsTrace() {
6438
+ if (fetcher === void 0) return Promise.resolve();
6439
+ inFlight ??= (async () => {
6440
+ try {
6441
+ entries = await fetcher();
6442
+ } catch {} finally {
6443
+ inFlight = void 0;
6444
+ }
6445
+ for (const listener of listeners) listener();
6446
+ })();
6447
+ return inFlight;
6448
+ }
6449
+ //#endregion
5379
6450
  //#region src/client/host-icons.tsx
5380
6451
  /** Host-provided chevron-down outline icon (any supported generation). */
5381
6452
  const ChevronDownIcon = _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular ?? _deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14;
@@ -5384,70 +6455,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5384
6455
  /** Host-provided question outline icon (any supported generation). */
5385
6456
  const QuestionIcon = _deepseek_ai_dsh_client_ui_primitives.IconQuestionOutlineRegular ?? _deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14;
5386
6457
  //#endregion
5387
- //#region src/client/section.tsx
6458
+ //#region src/client/section-styles.ts
5388
6459
  /**
5389
- * Web-search settings section (S06 skeleton): five provider cards (key write
5390
- * through credentials, configured status dot, hot enable switch) plus a
5391
- * read-only chain display. Presentational on purpose — all host access lives
5392
- * behind the action callbacks (the entry binds the controller), so jsdom tests
5393
- * drive plain props and the slot mechanism only has to supply the `t` seat.
6460
+ * Styles and state hooks shared by the web-search settings section blocks
6461
+ * (section.tsx, dns-card.tsx, member-card.tsx, chain-cards.tsx): inline-style
6462
+ * constants and functions over verified `--dsw-alias-*` tokens — text color is
6463
+ * inherited from the settings shell — plus the 1.5s auto-clear feedback hook
6464
+ * and the staged-field lifted-draft hook.
5394
6465
  *
5395
- * Styling composes ui-primitives (requested through the manifest's
5396
- * `dsh.client.external`, so their token-driven styles ship with the host) and
5397
- * a minimal inline layer over verified `--dsw-alias-*` tokens; text color is
5398
- * inherited from the settings shell. Brand labels are locale-neutral code
5399
- * constants, not dictionary keys.
5400
- *
5401
- * @module dsh-websearch/client/section
5402
- */
5403
- /**
5404
- * Bind a controller into a registrable section component: the slot mechanism
5405
- * supplies the `t` seat, the controller supplies state and actions through
5406
- * the store subscription. The factory lives next to the presentational
5407
- * component so the entry stays framework-light wiring.
5408
- */
5409
- function bindWebSearchSettingsSection(controller) {
5410
- return function BoundWebSearchSettingsSection(props) {
5411
- const snapshot = (0, react.useSyncExternalStore)((onStoreChange) => controller.subscribe(onStoreChange), () => controller.snapshot());
5412
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WebSearchSettingsSection, {
5413
- t: props.t,
5414
- snapshot,
5415
- onSaveKey: (key, value) => controller.setKey(key, value),
5416
- onClearKey: (key) => controller.clearKey(key),
5417
- onToggleEnabled: (key, enabled) => controller.setEnabled(key, enabled),
5418
- onMoveSearch: (id, delta) => controller.moveSearchChainEntry(id, delta),
5419
- onSetKeySelection: (key, selection) => controller.setKeySelection(key, selection),
5420
- onSetMaxUses: (maxUses) => controller.setDeepseekMaxUses(maxUses),
5421
- onSetFallbackMember: (member) => controller.setFallbackMember(member),
5422
- onSetFetchTakeover: (active) => controller.setFetchTakeover(active),
5423
- onSetBaseURL: (key, url) => controller.setBaseURL(key, url),
5424
- onSetMemberOption: (key, option, value) => controller.setMemberOption(key, option, value),
5425
- onSetSearchCountry: (country) => controller.setSearchCountry(country),
5426
- onSetSearchLanguage: (language) => controller.setSearchLanguage(language),
5427
- onSetSearchDomains: (kind, domains) => controller.setSearchDomains(kind, domains),
5428
- onMoveFetch: (id, delta) => controller.moveFetchChainEntry(id, delta),
5429
- onRefreshKeyCounts: () => controller.refreshCounts()
5430
- });
5431
- };
5432
- }
5433
- /**
5434
- * S23 §0.5 B1: pseudo-class rules the inline-style system cannot express,
5435
- * delivered as one injected <style> block selected by data-dshws-* attributes.
5436
- * Colors stay tokenized (--dsw-alias-*) so both themes stay correct; host
5437
- * anchors: PluginCard.module.css (.card:hover/.cardOpen/.header:focus-visible).
6466
+ * @module dsh-websearch/client/section-styles
5438
6467
  */
5439
- const SECTION_STYLE_CSS = `
5440
- [data-dshws-card] { transition: border-color .16s, background .16s; }
5441
- [data-dshws-card]:hover { border-color: var(--dsw-alias-label-dimmed); }
5442
- [data-dshws-card][data-open='true'] { background: var(--dsw-alias-bg-layer-2); border-color: var(--dsw-alias-label-dimmed); }
5443
- [data-dshws-card-body] { border-top: 1px solid var(--dsw-alias-border-l2); margin: 0 2px; padding-top: 8px; }
5444
- [data-dshws-input]:focus { border-color: var(--dsw-alias-brand-primary); outline: none; }
5445
- [data-dshws-focusable]:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
5446
- @media (prefers-reduced-motion: reduce) {
5447
- [data-dshws-card] { transition: none; }
5448
- [data-dshws-chevron] { transition: none !important; }
5449
- }
5450
- `;
5451
6468
  const cardStyle = {
5452
6469
  border: "1px solid var(--dsw-alias-border-l2)",
5453
6470
  borderRadius: 12,
@@ -5472,17 +6489,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5472
6489
  lineHeight: "18px",
5473
6490
  color: "var(--dsw-alias-label-tertiary)"
5474
6491
  };
5475
- /**
5476
- * S14m: expanded fields mirror the host Models editor verbatim
5477
- * (ModelsSection.module.css .field/.fieldLabel/.input) — a vertical stack per
5478
- * field: 12px/500 label ABOVE a full-width 32px bordered input. Same pattern
5479
- * the Models page and every host settings card uses.
5480
- */
5481
- const fieldStyle = {
5482
- display: "flex",
5483
- flexDirection: "column",
5484
- gap: 6
5485
- };
5486
6492
  /** S23a T4: one member-parameter row — label left, control right (the host
5487
6493
  * filter-row rhythm), so the expanded card reads as a compact two-column
5488
6494
  * grid instead of a tall stack of full-width blocks. */
@@ -5533,19 +6539,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5533
6539
  opacity: .6,
5534
6540
  cursor: "help"
5535
6541
  };
5536
- /** Key-selection row (S13 D2): label + three segments; the pressed segment
5537
- * carries the field visual (bg-layer-1/border-l3 — Input wrapper precedent). */
5538
- const keySelButtonStyle = (pressed, configured) => ({
5539
- fontSize: 12,
5540
- lineHeight: "18px",
5541
- padding: "2px 10px",
5542
- cursor: configured ? "pointer" : "not-allowed",
5543
- opacity: configured ? 1 : .4,
5544
- borderRadius: 6,
5545
- border: `1px solid var(--dsw-alias-border-${pressed ? "l3" : "l2"})`,
5546
- background: pressed ? "var(--dsw-alias-bg-layer-1)" : "transparent",
5547
- color: pressed ? "var(--dsw-alias-label-secondary)" : "var(--dsw-alias-label-tertiary)"
5548
- });
5549
6542
  /** S14s: feedback color follows the operation's semantics — save is a
5550
6543
  * positive confirmation (success green), clear is a retractive act (warn),
5551
6544
  * failure is an error; the old single green mislabeled both. */
@@ -5590,580 +6583,523 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5590
6583
  borderRadius: "50%",
5591
6584
  background: configured ? "var(--dsw-alias-state-success-primary)" : "var(--dsw-alias-state-warn-label)"
5592
6585
  });
5593
- /** Chain rows render the brand label; ids stay the test/action payload (D3). */
5594
- const labelOf$2 = (id) => MEMBERS.find((member) => member.memberId === id)?.label ?? id;
5595
- /** The three pool policies and their label keys, in control order (S13 D2). */
5596
- const KEY_SELECTIONS = [
5597
- {
5598
- value: "order",
5599
- labelKey: "keySelOrder"
5600
- },
5601
- {
5602
- value: "round-robin",
5603
- labelKey: "keySelRoundRobin"
5604
- },
5605
- {
5606
- value: "random",
5607
- labelKey: "keySelRandom"
5608
- }
5609
- ];
5610
- /** Locale key for one policy value (the hint interpolates the live policy name). */
5611
- const keySelectionLabelKey = (selection) => KEY_SELECTIONS.find((entry) => entry.value === selection)?.labelKey ?? "keySelOrder";
5612
- /** The section body (`t` arrives as the locale runtime's standard seat). */
5613
- function WebSearchSettingsSection(props) {
5614
- const { t, snapshot, onSaveKey, onClearKey, onToggleEnabled, onMoveSearch, onSetKeySelection, onSetMaxUses, onSetFallbackMember, onSetFetchTakeover, onSetBaseURL, onSetMemberOption, onSetSearchCountry, onSetSearchLanguage, onSetSearchDomains, onMoveFetch, onRefreshKeyCounts } = props;
5615
- const [chainFeedback, setChainFeedback] = (0, react.useState)(void 0);
5616
- const move = async (id, delta) => {
5617
- const result = await onMoveSearch(id, delta);
5618
- setChainFeedback(result.ok ? void 0 : "failed");
6586
+ /** Auto-dismiss cadence for action feedback (ms). */
6587
+ const AUTO_CLEAR_FEEDBACK_MS = 1500;
6588
+ /**
6589
+ * Auto-dismiss action feedback after 1.5s — the cadence every field with a
6590
+ * live-region note shares (S37 T11; was nine verbatim useEffect copies).
6591
+ */
6592
+ function useAutoClearFeedback() {
6593
+ const [feedback, setFeedback] = (0, react.useState)(void 0);
6594
+ (0, react.useEffect)(() => {
6595
+ if (feedback === void 0) return;
6596
+ const timer = setTimeout(() => setFeedback(void 0), AUTO_CLEAR_FEEDBACK_MS);
6597
+ return () => clearTimeout(timer);
6598
+ }, [feedback]);
6599
+ return [feedback, setFeedback];
6600
+ }
6601
+ const chainRowStyle = {
6602
+ display: "grid",
6603
+ gridTemplateColumns: "auto minmax(0, 1fr) auto auto",
6604
+ gap: 8,
6605
+ alignItems: "center",
6606
+ padding: 6,
6607
+ borderRadius: 6
6608
+ };
6609
+ const chainIndexStyle = {
6610
+ fontSize: 12,
6611
+ color: "var(--dsw-alias-label-tertiary)",
6612
+ minWidth: 14
6613
+ };
6614
+ /** Role chip for the two chain ends (S14w): a quiet bordered pill, secondary tone. */
6615
+ const roleChipStyle = {
6616
+ fontSize: 10,
6617
+ lineHeight: 1.4,
6618
+ padding: "0 6px",
6619
+ border: "1px solid var(--dsw-alias-border-l2)",
6620
+ borderRadius: 999,
6621
+ color: "var(--dsw-alias-label-secondary)",
6622
+ whiteSpace: "nowrap"
6623
+ };
6624
+ const moveButtonStyle = {
6625
+ width: 28,
6626
+ height: 28,
6627
+ lineHeight: 1,
6628
+ padding: 0,
6629
+ cursor: "pointer",
6630
+ border: "none",
6631
+ borderRadius: 6,
6632
+ background: "transparent",
6633
+ color: "var(--dsw-alias-label-secondary)"
6634
+ };
6635
+ /**
6636
+ * S23 D9 (plan §0.5 B2 path a): a staged field can run on LIFTED draft state
6637
+ * so the draft survives the card/fold unmounting around it; `lifted === undefined`
6638
+ * keeps the component self-contained (local state, previous behavior).
6639
+ */
6640
+ function useLiftedDraft(lifted) {
6641
+ const [local, setLocal] = (0, react.useState)(null);
6642
+ if (lifted === void 0) return [local, setLocal];
6643
+ return [lifted.draft, lifted.onDraftChange];
6644
+ }
6645
+ /** Native select chrome (the fallback-row precedent): inset chevron, auto width. */
6646
+ const selectStyle = {
6647
+ ...fieldInputStyle,
6648
+ width: "auto",
6649
+ minWidth: 0,
6650
+ margin: 0,
6651
+ appearance: "none",
6652
+ WebkitAppearance: "none",
6653
+ paddingRight: 24,
6654
+ backgroundImage: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2381858C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\")",
6655
+ backgroundRepeat: "no-repeat",
6656
+ backgroundPosition: "right 6px center"
6657
+ };
6658
+ //#endregion
6659
+ //#region src/client/dns-card.tsx
6660
+ /**
6661
+ * The DNS resilience card rendered at the bottom of the web-search settings
6662
+ * section (S35, ADR-0022).
6663
+ *
6664
+ * @module dsh-websearch/client/dns-card
6665
+ */
6666
+ /**
6667
+ * The DNS resilience block (S35, user ruling: bottom of the「网页搜索」
6668
+ * section): mode/scope/preset selectors, the custom-node textarea, the live
6669
+ * detection status with its evidence, the re-check button, and the recent
6670
+ * resolution trace. Old hosts (no DNS remote) render the config-only view —
6671
+ * the status copy reflects the not-yet-detected state without a verdict.
6672
+ */
6673
+ function DnsResilienceCard(props) {
6674
+ const { t, snapshot, onSetDnsMode, onSetDnsPreset, onSetDnsNodes, onRecheckDns, onRefreshDnsFace, onSetDnsProbeMethod } = props;
6675
+ const dns = snapshot.dns;
6676
+ const [open, setOpen] = (0, react.useState)(false);
6677
+ const [nodesDraft, setNodesDraft] = (0, react.useState)(null);
6678
+ const [rechecking, setRechecking] = (0, react.useState)(false);
6679
+ const [feedback, setFeedback] = useAutoClearFeedback();
6680
+ const nodesValue = nodesDraft ?? dns.nodesText;
6681
+ const decisionCopy = dns.status?.decision === void 0 || dns.status.decision === null ? "dnsDecisionNone" : dns.status.decision.verdict === "poisoned" ? "dnsDecisionPoisoned" : dns.status.decision.verdict === "inconclusive" ? "dnsDecisionInconclusive" : dns.status.decision.verdict === "empty" ? "dnsDecisionEmpty" : "dnsDecisionClean";
6682
+ const statusCopy = dns.status?.proxyActive === true ? "dnsStatusSuspended" : dns.status?.armed === true ? "dnsStatusArmed" : "dnsStatusIdle";
6683
+ const run = async (action) => {
6684
+ const result = await action();
6685
+ setFeedback(result.ok ? "saved" : "failed");
5619
6686
  };
5620
- const visibleSearch = snapshot.searchChain.filter((id) => snapshot.members.some((m) => m.memberId === id && m.configured && m.enabled));
5621
- const designatedId = snapshot.fallbackSelection !== "auto" && snapshot.fallbackSelection !== "dshws-deepseek" ? snapshot.fallbackSelection : null;
5622
- const orderableSearch = designatedId === null ? visibleSearch : visibleSearch.filter((id) => id !== designatedId);
5623
- const showLockedTail = designatedId !== null && snapshot.fallbackDesignationReady;
5624
- const showChains = snapshot.members.some((m) => m.configured);
5625
- const [advancedOpen, setAdvancedOpen] = (0, react.useState)(false);
5626
- const [advancedDrafts, setAdvancedDrafts] = (0, react.useState)({});
5627
- const setAdvancedDraft = (key, value) => {
5628
- setAdvancedDrafts((previous) => ({
5629
- ...previous,
5630
- [key]: value
5631
- }));
6687
+ const recheck = async () => {
6688
+ setRechecking(true);
6689
+ await run(onRecheckDns);
6690
+ setRechecking(false);
5632
6691
  };
5633
- const advancedDirty = Object.values(advancedDrafts).some((value) => value !== null);
5634
- const liftedOf = (key) => ({
5635
- draft: advancedDrafts[key] ?? null,
5636
- onDraftChange: (value) => setAdvancedDraft(key, value)
5637
- });
5638
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5639
- style: {
5640
- display: "flex",
5641
- flexDirection: "column",
5642
- gap: 12,
5643
- maxWidth: 720
5644
- },
6692
+ const toggle = () => {
6693
+ setOpen((value) => !value);
6694
+ if (!open) onRefreshDnsFace();
6695
+ };
6696
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
6697
+ "data-testid": "dshws-dns-card",
6698
+ style: cardStyle,
5645
6699
  children: [
5646
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
5647
- "data-dshws-styles": "",
5648
- children: SECTION_STYLE_CSS
5649
- }),
5650
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
5651
- style: {
5652
- margin: 0,
5653
- fontSize: 16,
5654
- fontWeight: 500,
5655
- display: "inline-flex",
5656
- alignItems: "center",
5657
- gap: 4
5658
- },
5659
- children: [t("title"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
5660
- label: t("description"),
5661
- side: "bottom",
5662
- delayMs: 400,
5663
- maxWidth: 360,
5664
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5665
- type: "button",
5666
- "aria-label": t("description"),
5667
- style: infoButtonStyle,
5668
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
5669
- })
6700
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6701
+ style: cardHeadStyle,
6702
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
6703
+ type: "button",
6704
+ "data-testid": "dshws-dns-toggle",
6705
+ "data-dshws-focusable": "",
6706
+ "aria-expanded": open,
6707
+ "aria-label": `${t("dnsTitle")} ${t("configure")}`,
6708
+ onClick: toggle,
6709
+ style: {
6710
+ ...cardHeadStyle,
6711
+ flex: 1,
6712
+ minWidth: 0,
6713
+ border: "none",
6714
+ background: "transparent",
6715
+ color: "inherit",
6716
+ font: "inherit",
6717
+ textAlign: "left",
6718
+ cursor: "pointer",
6719
+ padding: 0
6720
+ },
6721
+ children: [
6722
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6723
+ role: "img",
6724
+ "aria-label": t(statusCopy),
6725
+ title: t(statusCopy),
6726
+ style: statusDotStyle(dns.status?.armed === true)
6727
+ }),
6728
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
6729
+ style: nameStyle,
6730
+ children: t("dnsTitle")
6731
+ }),
6732
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
6733
+ label: t("dnsDescription"),
6734
+ side: "bottom",
6735
+ delayMs: 400,
6736
+ maxWidth: 360,
6737
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6738
+ type: "button",
6739
+ "aria-label": t("dnsDescription"),
6740
+ "data-testid": "dshws-dns-info",
6741
+ style: {
6742
+ ...infoButtonStyle,
6743
+ border: "none",
6744
+ background: "transparent"
6745
+ },
6746
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
6747
+ })
6748
+ }),
6749
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
6750
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6751
+ "aria-hidden": "true",
6752
+ "data-dshws-chevron": "",
6753
+ style: {
6754
+ display: "inline-flex",
6755
+ color: "var(--dsw-alias-label-tertiary)",
6756
+ transform: open ? "rotate(180deg)" : "none",
6757
+ transition: "transform 160ms ease"
6758
+ },
6759
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, {})
6760
+ })
6761
+ ]
6762
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6763
+ type: "button",
6764
+ role: "switch",
6765
+ "data-dshws-focusable": "",
6766
+ "aria-checked": dns.mode !== "off",
6767
+ "aria-label": `${t("dnsTitle")} ${t("enabled")}`,
6768
+ onClick: () => {
6769
+ run(() => onSetDnsMode(dns.mode === "off" ? "auto" : "off"));
6770
+ },
6771
+ style: {
6772
+ ...switchStyle(true, dns.mode !== "off"),
6773
+ cursor: "pointer"
6774
+ },
6775
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: thumbStyle(dns.mode !== "off") })
5670
6776
  })]
5671
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5672
- style: {
5673
- margin: 0,
5674
- marginTop: 4,
5675
- fontSize: 14,
5676
- lineHeight: "22px",
5677
- color: "var(--dsw-alias-label-tertiary)"
5678
- },
5679
- children: t("description")
5680
- })] }),
5681
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5682
- "data-testid": "dshws-chains",
5683
- "data-dshws-card": "",
5684
- style: {
5685
- ...cardStyle,
5686
- padding: "10px 14px",
5687
- gap: 8
5688
- },
6777
+ }),
6778
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6779
+ role: "status",
6780
+ "data-testid": "dshws-dns-decision",
6781
+ style: hintStyle,
6782
+ children: t(decisionCopy)
6783
+ }),
6784
+ dns.status?.decision?.hits.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
6785
+ "data-testid": "dshws-dns-hits",
6786
+ style: hintStyle,
5689
6787
  children: [
5690
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6788
+ t("dnsHitsLabel"),
6789
+ ": ",
6790
+ dns.status.decision.hits.map((hit) => `${hit.host}→${hit.addresses.join(",")}`).join(" ")
6791
+ ]
6792
+ }) : null,
6793
+ dns.status?.decision?.failures.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
6794
+ "data-testid": "dshws-dns-failures",
6795
+ style: hintStyle,
6796
+ children: [
6797
+ t("dnsFailuresLabel"),
6798
+ ": ",
6799
+ dns.status.decision.failures.map((failure) => `${failure.host}:${failure.reason}`).join(" ")
6800
+ ]
6801
+ }) : null,
6802
+ open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
6803
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6804
+ style: paramRowStyle,
6805
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5691
6806
  style: {
5692
- display: "flex",
5693
- alignItems: "center",
5694
- gap: 8
6807
+ ...fieldLabelStyle,
6808
+ flex: 1
5695
6809
  },
5696
- children: [
5697
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
6810
+ children: [t("dnsModeLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
6811
+ label: t("dnsModeHint"),
6812
+ side: "bottom",
6813
+ delayMs: 400,
6814
+ maxWidth: 320,
6815
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6816
+ type: "button",
6817
+ "aria-label": t("dnsModeLabel"),
5698
6818
  style: {
5699
- margin: 0,
5700
- fontSize: 12,
5701
- fontWeight: 500,
5702
- color: "var(--dsw-alias-label-secondary)"
6819
+ ...infoButtonStyle,
6820
+ padding: 0,
6821
+ border: "none",
6822
+ background: "transparent"
5703
6823
  },
5704
- children: t("searchChain")
6824
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
6825
+ })
6826
+ })]
6827
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6828
+ "data-testid": "dshws-dns-mode",
6829
+ "data-dshws-focusable": "",
6830
+ "data-dshws-input": "",
6831
+ value: dns.mode,
6832
+ onChange: (event) => {
6833
+ run(() => onSetDnsMode(event.target.value));
6834
+ },
6835
+ style: selectStyle,
6836
+ children: [
6837
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6838
+ value: "auto",
6839
+ title: t("dnsModeAuto"),
6840
+ children: t("dnsModeAutoShort")
5705
6841
  }),
5706
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
5707
- label: snapshot.searchChainPinned ? `${t("chainPinned")}: ${t("chainOrderHint")}` : t("chainOrderHint"),
5708
- side: "bottom",
5709
- delayMs: 200,
5710
- maxWidth: 360,
5711
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5712
- type: "button",
5713
- "aria-label": snapshot.searchChainPinned ? `${t("chainPinned")}: ${t("chainOrderHint")}` : t("chainOrderHint"),
5714
- "data-testid": "dshws-chain-order-info",
5715
- "data-dshws-chain-state": snapshot.searchChainPinned ? "pinned" : "default",
5716
- style: infoButtonStyle,
5717
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
5718
- })
6842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6843
+ value: "on",
6844
+ title: t("dnsModeOn"),
6845
+ children: t("dnsModeOnShort")
5719
6846
  }),
5720
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } })
6847
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6848
+ value: "off",
6849
+ children: t("dnsModeOff")
6850
+ })
5721
6851
  ]
5722
- }),
5723
- showChains ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ol", {
5724
- "data-testid": "dshws-search-chain",
6852
+ })]
6853
+ }),
6854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6855
+ style: paramRowStyle,
6856
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5725
6857
  style: {
5726
- margin: 0,
5727
- paddingLeft: 0,
5728
- listStyle: "none",
5729
- maxHeight: 280,
5730
- overflowY: "auto",
5731
- display: "flex",
5732
- flexDirection: "column",
5733
- gap: 4
6858
+ ...fieldLabelStyle,
6859
+ flex: 1
5734
6860
  },
5735
- children: [orderableSearch.map((id, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
5736
- "data-testid": `dshws-chain-item-${id}`,
5737
- style: chainRowStyle,
5738
- children: [
5739
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5740
- style: chainIndexStyle,
5741
- children: index + 1
5742
- }),
5743
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5744
- "data-dshws-chain-label": "",
5745
- style: {
5746
- display: "inline-flex",
5747
- alignItems: "center",
5748
- gap: 6,
5749
- minWidth: 0
5750
- },
5751
- children: [
5752
- labelOf$2(id),
5753
- index === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5754
- "data-testid": "dshws-chain-role-primary",
5755
- style: roleChipStyle,
5756
- children: t("chainRolePrimary")
5757
- }) : null,
5758
- !showLockedTail && orderableSearch.length > 1 && index === orderableSearch.length - 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5759
- "data-testid": "dshws-chain-role-standby",
5760
- style: roleChipStyle,
5761
- children: t("chainRoleStandby")
5762
- }) : null
5763
- ]
5764
- }),
5765
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5766
- type: "button",
5767
- "data-dshws-focusable": "",
5768
- "aria-label": `${labelOf$2(id)} ${t("moveUp")}`,
5769
- disabled: index === 0,
5770
- onClick: () => void move(id, -1),
5771
- style: moveButtonStyle,
5772
- children: "↑"
5773
- }),
5774
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5775
- type: "button",
5776
- "data-dshws-focusable": "",
5777
- "aria-label": `${labelOf$2(id)} ${t("moveDown")}`,
5778
- disabled: index === orderableSearch.length - 1 && !showLockedTail,
5779
- onClick: () => void move(id, 1),
5780
- style: moveButtonStyle,
5781
- children: "↓"
5782
- })
5783
- ]
5784
- }, id)), showLockedTail && designatedId !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
5785
- "data-testid": `dshws-chain-item-${designatedId}`,
5786
- "data-dshws-chain-locked": "",
5787
- style: chainRowStyle,
5788
- children: [
5789
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5790
- style: chainIndexStyle,
5791
- children: orderableSearch.length + 1
5792
- }),
5793
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5794
- "data-dshws-chain-label": "",
5795
- children: labelOf$2(designatedId)
5796
- }),
5797
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5798
- "data-testid": "dshws-chain-role-standby",
5799
- style: roleChipStyle,
5800
- children: t("chainRoleStandby")
5801
- }),
5802
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5803
- style: hintStyle,
5804
- children: t("chainLockedNote")
5805
- }),
5806
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } })
5807
- ]
5808
- }, designatedId) : null]
5809
- }) : null,
5810
- snapshot.members.every((m) => !(m.configured && m.enabled)) && showChains ? snapshot.fallbackSelection === "dshws-deepseek" && snapshot.fallbackDeepseekEligible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5811
- role: "status",
5812
- "data-testid": "dshws-chain-floor",
5813
- style: hintStyle,
5814
- children: t("chainFloorDeepseekNote")
5815
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5816
- role: "status",
5817
- "data-testid": "dshws-chain-no-usable",
6861
+ children: [t("dnsProbeMethodLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
6862
+ label: t("dnsProbeMethodHint"),
6863
+ side: "bottom",
6864
+ delayMs: 400,
6865
+ maxWidth: 320,
6866
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6867
+ type: "button",
6868
+ "aria-label": t("dnsProbeMethodLabel"),
6869
+ style: {
6870
+ ...infoButtonStyle,
6871
+ padding: 0,
6872
+ border: "none",
6873
+ background: "transparent"
6874
+ },
6875
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
6876
+ })
6877
+ })]
6878
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6879
+ "data-testid": "dshws-dns-probe-method",
6880
+ "data-dshws-focusable": "",
6881
+ "data-dshws-input": "",
6882
+ value: dns.probeMethod,
6883
+ onChange: (event) => {
6884
+ run(() => onSetDnsProbeMethod(event.target.value));
6885
+ },
6886
+ style: selectStyle,
6887
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6888
+ value: "tcp",
6889
+ title: t("dnsProbeMethodTcp"),
6890
+ children: "TCP"
6891
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6892
+ value: "tls-hello",
6893
+ title: t("dnsProbeMethodTlsHello"),
6894
+ children: "TLS"
6895
+ })]
6896
+ })]
6897
+ }),
6898
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6899
+ style: paramRowStyle,
6900
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
5818
6901
  style: {
5819
- ...hintStyle,
5820
- color: "var(--dsw-alias-state-error-primary)"
6902
+ ...fieldLabelStyle,
6903
+ flex: 1
5821
6904
  },
5822
- children: t("chainNoUsableWarning")
5823
- }) : null,
5824
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
5825
- type: "button",
5826
- "data-testid": "dshws-advanced-disclosure",
6905
+ children: [t("dnsPresetLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
6906
+ label: dns.preset === "custom" ? t("dnsNodesHint") : t("dnsPresetHint"),
6907
+ side: "bottom",
6908
+ delayMs: 400,
6909
+ maxWidth: 320,
6910
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6911
+ type: "button",
6912
+ "aria-label": t("dnsPresetLabel"),
6913
+ style: {
6914
+ ...infoButtonStyle,
6915
+ padding: 0,
6916
+ border: "none",
6917
+ background: "transparent"
6918
+ },
6919
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
6920
+ })
6921
+ })]
6922
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6923
+ "data-testid": "dshws-dns-preset",
5827
6924
  "data-dshws-focusable": "",
5828
- "aria-expanded": advancedOpen,
5829
- "aria-label": t("advancedConfigLabel"),
5830
- onClick: () => {
5831
- setAdvancedOpen((value) => !value);
5832
- },
5833
- style: {
5834
- display: "flex",
5835
- alignItems: "center",
5836
- gap: 6,
5837
- border: "none",
5838
- background: "transparent",
5839
- color: "var(--dsw-alias-label-secondary)",
5840
- font: "inherit",
5841
- fontSize: 12,
5842
- fontWeight: 500,
5843
- textAlign: "left",
5844
- cursor: "pointer",
5845
- padding: 0
6925
+ "data-dshws-input": "",
6926
+ value: dns.preset,
6927
+ onChange: (event) => {
6928
+ run(() => onSetDnsPreset(event.target.value));
5846
6929
  },
6930
+ style: selectStyle,
5847
6931
  children: [
5848
- t("advancedConfigLabel"),
5849
- advancedDirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnsavedPill, {
5850
- t,
5851
- testid: "dshws-unsaved-advanced"
5852
- }) : null,
5853
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
5854
- "aria-hidden": "true",
5855
- "data-dshws-chevron": "",
6932
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6933
+ value: "auto",
6934
+ title: t("dnsPresetAuto"),
6935
+ children: t("dnsPresetAutoShort")
6936
+ }),
6937
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6938
+ value: "cn",
6939
+ title: t("dnsPresetCn"),
6940
+ children: t("dnsPresetCnShort")
6941
+ }),
6942
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6943
+ value: "global",
6944
+ title: t("dnsPresetGlobal"),
6945
+ children: t("dnsPresetGlobalShort")
6946
+ }),
6947
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6948
+ value: "custom",
6949
+ children: t("dnsPresetCustom")
6950
+ })
6951
+ ]
6952
+ })]
6953
+ }),
6954
+ dns.preset === "custom" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6955
+ style: {
6956
+ display: "flex",
6957
+ flexDirection: "column",
6958
+ gap: 6
6959
+ },
6960
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
6961
+ style: fieldLabelStyle,
6962
+ children: [t("dnsNodesLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
6963
+ label: t("dnsNodesHint"),
6964
+ side: "bottom",
6965
+ delayMs: 400,
6966
+ maxWidth: 320,
6967
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6968
+ type: "button",
6969
+ "aria-label": t("dnsNodesLabel"),
5856
6970
  style: {
5857
- display: "inline-flex",
5858
- color: "var(--dsw-alias-label-tertiary)",
5859
- transform: advancedOpen ? "rotate(180deg)" : "none",
5860
- transition: "transform 160ms ease"
6971
+ ...infoButtonStyle,
6972
+ padding: 0,
6973
+ border: "none",
6974
+ background: "transparent"
5861
6975
  },
5862
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, {})
6976
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
5863
6977
  })
5864
- ]
5865
- }),
5866
- advancedOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
5867
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FallbackToolRow, {
5868
- snapshot,
5869
- t,
5870
- onChoose: onSetFallbackMember
5871
- }, "dshws-fallback-tool"),
5872
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
5873
- style: hintStyle,
5874
- children: [
5875
- t("timeout"),
5876
- ": ",
5877
- snapshot.timeoutMs,
5878
- " ms"
5879
- ]
5880
- }),
5881
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MaxUsesRow, {
5882
- t,
5883
- value: snapshot.deepseekMaxUses,
5884
- onSet: onSetMaxUses,
5885
- lifted: liftedOf("maxUses")
5886
- }),
5887
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchGeoFields, {
5888
- t,
5889
- country: snapshot.searchCountry,
5890
- language: snapshot.searchLanguage,
5891
- onSetCountry: onSetSearchCountry,
5892
- onSetLanguage: onSetSearchLanguage,
5893
- lifted: {
5894
- country: liftedOf("country"),
5895
- language: liftedOf("language")
5896
- }
5897
- }),
5898
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDomainFields, {
5899
- t,
5900
- includeDomains: snapshot.searchIncludeDomains,
5901
- excludeDomains: snapshot.searchExcludeDomains,
5902
- onSet: onSetSearchDomains,
5903
- lifted: {
5904
- include: liftedOf("domain-include"),
5905
- exclude: liftedOf("domain-exclude")
5906
- }
5907
- })
5908
- ] }) : null,
5909
- chainFeedback ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
6978
+ })]
6979
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
6980
+ "data-testid": "dshws-dns-nodes",
6981
+ "data-dshws-focusable": "",
6982
+ "data-dshws-input": "",
6983
+ rows: 3,
6984
+ spellCheck: false,
6985
+ value: nodesValue,
6986
+ placeholder: "223.5.5.5,dns.alidns.com,/resolve,443",
6987
+ onChange: (event) => {
6988
+ setNodesDraft(event.target.value);
6989
+ },
6990
+ onBlur: () => {
6991
+ if (nodesDraft !== null && nodesDraft !== dns.nodesText) run(() => onSetDnsNodes(nodesValue));
6992
+ },
6993
+ style: {
6994
+ ...fieldInputStyle,
6995
+ height: "auto",
6996
+ padding: "6px 10px",
6997
+ lineHeight: "18px",
6998
+ resize: "vertical"
6999
+ }
7000
+ })]
7001
+ }) : null,
7002
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7003
+ style: {
7004
+ display: "flex",
7005
+ gap: 8,
7006
+ alignItems: "center"
7007
+ },
7008
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
7009
+ variant: "outline",
7010
+ size: "sm",
7011
+ disabled: rechecking,
7012
+ "aria-label": t("dnsRecheck"),
7013
+ onClick: () => {
7014
+ recheck();
7015
+ },
7016
+ children: rechecking ? t("dnsRechecking") : t("dnsRecheck")
7017
+ }), feedback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7018
+ role: "status",
7019
+ "data-testid": "dshws-dns-feedback",
5910
7020
  style: {
5911
7021
  ...hintStyle,
5912
- color: "var(--dsw-alias-state-error-primary)"
7022
+ flex: void 0
5913
7023
  },
5914
- "data-testid": "dshws-chain-feedback",
5915
- children: t(chainFeedback)
5916
- }) : null
5917
- ]
5918
- }),
5919
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5920
- "data-testid": "dshws-members",
5921
- style: {
5922
- display: "flex",
5923
- flexDirection: "column",
5924
- gap: 8
5925
- },
5926
- children: [snapshot.members.filter((member) => member.key !== "deepseek").map((member) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberCard, {
5927
- member,
5928
- t,
5929
- onSaveKey,
5930
- onClearKey,
5931
- onToggleEnabled,
5932
- onSetKeySelection,
5933
- onSetBaseURL,
5934
- onSetMemberOption,
5935
- onRefreshKeyCounts
5936
- }, member.key)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchTakeoverRow, {
5937
- t,
5938
- active: snapshot.fetchTakeover,
5939
- onSet: onSetFetchTakeover,
5940
- chain: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchChainRows, {
5941
- t,
5942
- snapshot,
5943
- onMove: onMoveFetch
5944
- })
5945
- })]
5946
- })
7024
+ children: t(feedback)
7025
+ }) : null]
7026
+ }),
7027
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7028
+ style: groupHeaderStyle,
7029
+ children: t("dnsTraceTitle")
7030
+ }),
7031
+ dns.trace.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
7032
+ style: hintStyle,
7033
+ children: t("dnsTraceEmpty")
7034
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
7035
+ "data-testid": "dshws-dns-trace",
7036
+ style: {
7037
+ margin: 0,
7038
+ paddingLeft: 16,
7039
+ fontSize: 12,
7040
+ color: "var(--dsw-alias-label-secondary)"
7041
+ },
7042
+ children: dns.trace.slice(-8).reverse().map((entry, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
7043
+ "data-testid": "dshws-dns-trace-entry",
7044
+ children: [
7045
+ entry.kind,
7046
+ " ",
7047
+ entry.host,
7048
+ entry.via !== void 0 ? ` · ${entry.via}` : "",
7049
+ entry.latencyMs !== void 0 ? ` · ${t("dnsTraceLatency").replace("{ms}", String(entry.latencyMs))}` : "",
7050
+ entry.code !== void 0 ? ` · ${entry.code}` : ""
7051
+ ]
7052
+ }, `${entry.at}-${index}`))
7053
+ })
7054
+ ] }) : null
5947
7055
  ]
5948
7056
  });
5949
7057
  }
7058
+ //#endregion
7059
+ //#region src/client/chain-cards.tsx
5950
7060
  /**
5951
- * Host-parity maxUses knob (S14c): staged numeric input in the global area —
5952
- * the label and semantics match the host `web-search-deepseek` card verbatim.
7061
+ * Chain-level cards of the web-search settings section: the DeepSeek fallback
7062
+ * selector row (ADR-0014), the universal web_fetch takeover fold (S15a), and
7063
+ * the fetch degradation chain rows (S21, ADR-0019).
7064
+ *
7065
+ * @module dsh-websearch/client/chain-cards
5953
7066
  */
5954
- function MaxUsesRow(props) {
5955
- const { t, value, onSet, lifted } = props;
5956
- const [liftedDraft, setLiftedDraft] = useLiftedDraft(lifted);
5957
- const draft = liftedDraft ?? "";
5958
- const setDraft = (next) => {
5959
- setLiftedDraft(next === "" && lifted !== void 0 ? null : next);
5960
- };
5961
- const [feedback, setFeedback] = (0, react.useState)(void 0);
5962
- const current = value ?? 10;
5963
- const parsed = draft.trim() === "" ? current : Number.parseInt(draft, 10);
5964
- (0, react.useEffect)(() => {
5965
- if (feedback === void 0) return;
5966
- const timer = setTimeout(() => setFeedback(void 0), 1500);
5967
- return () => clearTimeout(timer);
5968
- }, [feedback]);
5969
- const save = async () => {
5970
- const result = await onSet(parsed);
5971
- setFeedback(result.ok ? "saved" : "failed");
5972
- if (result.ok) setDraft("");
5973
- };
5974
- const hint = t("maxUsesHint").replace("{N}", String(parsed));
5975
- const MIN_USES = 5;
5976
- const MAX_USES = 100;
5977
- const STEP_USES = 5;
5978
- const valid = Number.isInteger(parsed) && parsed >= MIN_USES && parsed <= MAX_USES;
5979
- const snap = (raw) => Math.min(MAX_USES, Math.max(MIN_USES, raw - raw % STEP_USES));
5980
- const stepUp = () => setDraft(String(snap((draft.trim() === "" ? current : parsed) + STEP_USES)));
5981
- const stepDown = () => setDraft(String(snap((draft.trim() === "" ? current : parsed) - STEP_USES)));
7067
+ /**
7068
+ * The DeepSeek fallback row (S14b D1, user ruling): DeepSeek is not a
7069
+ * symmetric config card — it shares DEEPSEEK_API_KEY with the Models page, so
7070
+ * a key input (and a comma pool on that shared ref) would poison chat auth.
7071
+ * The row carries the live readiness dot, the shared-key badge, the takeover
7072
+ * semantics behind an ⓘ tooltip, and the paid-fallback off-switch (the
7073
+ * ADR-0004 neutrality opt-out).
7074
+ */
7075
+ function FallbackToolRow(props) {
7076
+ const { snapshot, t, onChoose } = props;
7077
+ const { fallbackSelection, readyToolMembers, fallbackDeepseekEligible, fallbackDesignationReady } = snapshot;
7078
+ const readyCount = readyToolMembers.length;
7079
+ const toolOptions = readyCount >= 2 ? readyToolMembers : [];
7080
+ const offerDeepseek = readyCount <= 1;
7081
+ const deepseekKeyed = snapshot.members.some((m) => m.key === "deepseek" && m.configured);
7082
+ const effective = fallbackSelection === "dshws-deepseek" && !offerDeepseek ? "auto" : fallbackSelection;
7083
+ const [feedback, setFeedback] = useAutoClearFeedback();
7084
+ const note = fallbackSelection === "dshws-deepseek" && !offerDeepseek ? t("fallbackDeepseekStoppedNote") : fallbackSelection === "dshws-deepseek" && !deepseekKeyed ? t("fallbackDeepseekKeylessNote") : fallbackSelection !== "auto" && fallbackSelection !== "dshws-deepseek" && !fallbackDesignationReady ? t("fallbackDesignationLostNote") : void 0;
7085
+ const dotOn = effective === "dshws-deepseek" ? deepseekKeyed && fallbackDeepseekEligible : effective !== "auto" ? fallbackDesignationReady : false;
7086
+ const dotTitle = dotOn ? t("configured") : note !== void 0 ? t("notConfigured") : void 0;
5982
7087
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5983
- "data-testid": "dshws-max-uses",
7088
+ "data-testid": "dshws-fallback-tool",
7089
+ "data-dshws-card": "",
5984
7090
  style: {
7091
+ ...cardStyle,
7092
+ padding: "10px 14px",
5985
7093
  display: "flex",
5986
- alignItems: "center",
5987
- gap: 8
7094
+ flexDirection: "column",
7095
+ gap: 6
5988
7096
  },
5989
7097
  children: [
5990
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5991
- style: {
5992
- display: "inline-flex",
5993
- alignItems: "center",
5994
- gap: 4,
5995
- fontSize: 12,
5996
- color: "var(--dsw-alias-label-secondary)"
5997
- },
5998
- children: [t("maxUsesLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
5999
- label: hint,
6000
- side: "bottom",
6001
- delayMs: 400,
6002
- maxWidth: 320,
6003
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6004
- type: "button",
6005
- "aria-label": hint,
6006
- style: infoButtonStyle,
6007
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
6008
- })
6009
- })]
6010
- }),
6011
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
6012
7098
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6013
7099
  style: {
6014
7100
  display: "flex",
6015
7101
  alignItems: "center",
6016
- gap: 4
6017
- },
6018
- children: [
6019
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6020
- type: "button",
6021
- "aria-label": `${t("maxUsesLabel")} −`,
6022
- "data-testid": "dshws-max-uses-down",
6023
- onClick: stepDown,
6024
- disabled: !valid,
6025
- style: {
6026
- ...moveButtonStyle,
6027
- width: 22,
6028
- height: 22
6029
- },
6030
- children: "−"
6031
- }),
6032
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
6033
- type: "number",
6034
- min: 5,
6035
- max: 100,
6036
- step: 5,
6037
- "aria-label": t("maxUsesLabel"),
6038
- "data-testid": "dshws-max-uses-input",
6039
- "data-dshws-input": "",
6040
- style: {
6041
- width: 52,
6042
- height: 28,
6043
- padding: "0 6px",
6044
- textAlign: "center",
6045
- borderRadius: 8,
6046
- border: "1px solid var(--dsw-alias-border-l2)",
6047
- background: "var(--dsw-alias-bg-layer-2)",
6048
- color: "inherit",
6049
- font: "inherit"
6050
- },
6051
- value: draft === "" ? String(current) : draft,
6052
- onChange: (event) => {
6053
- setDraft(event.target.value);
6054
- setFeedback(void 0);
6055
- }
6056
- }),
6057
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6058
- type: "button",
6059
- "aria-label": `${t("maxUsesLabel")} +`,
6060
- "data-testid": "dshws-max-uses-up",
6061
- onClick: stepUp,
6062
- disabled: !valid,
6063
- style: {
6064
- ...moveButtonStyle,
6065
- width: 22,
6066
- height: 22
6067
- },
6068
- children: "+"
6069
- })
6070
- ]
6071
- }),
6072
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
6073
- variant: "outline",
6074
- size: "sm",
6075
- "aria-label": `${t("maxUsesLabel")} ${t("save")}`,
6076
- disabled: !valid || draft.trim() === "",
6077
- onClick: () => void save(),
6078
- children: t("save")
6079
- }),
6080
- feedback ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6081
- role: "status",
6082
- "data-testid": "dshws-max-uses-feedback",
6083
- style: {
6084
- ...feedbackStyle,
6085
- color: feedbackColor(feedback === "saved" ? "saved" : "failed")
6086
- },
6087
- children: t(feedback)
6088
- }) : null
6089
- ]
6090
- });
6091
- }
6092
- const chainRowStyle = {
6093
- display: "grid",
6094
- gridTemplateColumns: "auto minmax(0, 1fr) auto auto",
6095
- gap: 8,
6096
- alignItems: "center",
6097
- padding: 6,
6098
- borderRadius: 6
6099
- };
6100
- const chainIndexStyle = {
6101
- fontSize: 12,
6102
- color: "var(--dsw-alias-label-tertiary)",
6103
- minWidth: 14
6104
- };
6105
- /** Role chip for the two chain ends (S14w): a quiet bordered pill, secondary tone. */
6106
- const roleChipStyle = {
6107
- fontSize: 10,
6108
- lineHeight: 1.4,
6109
- padding: "0 6px",
6110
- border: "1px solid var(--dsw-alias-border-l2)",
6111
- borderRadius: 999,
6112
- color: "var(--dsw-alias-label-secondary)",
6113
- whiteSpace: "nowrap"
6114
- };
6115
- const moveButtonStyle = {
6116
- width: 28,
6117
- height: 28,
6118
- lineHeight: 1,
6119
- padding: 0,
6120
- cursor: "pointer",
6121
- border: "none",
6122
- borderRadius: 6,
6123
- background: "transparent",
6124
- color: "var(--dsw-alias-label-secondary)"
6125
- };
6126
- /**
6127
- * The DeepSeek fallback row (S14b D1, user ruling): DeepSeek is not a
6128
- * symmetric config card — it shares DEEPSEEK_API_KEY with the Models page, so
6129
- * a key input (and a comma pool on that shared ref) would poison chat auth.
6130
- * The row carries the live readiness dot, the shared-key badge, the takeover
6131
- * semantics behind an ⓘ tooltip, and the paid-fallback off-switch (the
6132
- * ADR-0004 neutrality opt-out).
6133
- */
6134
- function FallbackToolRow(props) {
6135
- const { snapshot, t, onChoose } = props;
6136
- const { fallbackSelection, readyToolMembers, fallbackDeepseekEligible, fallbackDesignationReady } = snapshot;
6137
- const readyCount = readyToolMembers.length;
6138
- const toolOptions = readyCount >= 2 ? readyToolMembers : [];
6139
- const offerDeepseek = readyCount <= 1;
6140
- const deepseekKeyed = snapshot.members.some((m) => m.key === "deepseek" && m.configured);
6141
- const effective = fallbackSelection === "dshws-deepseek" && !offerDeepseek ? "auto" : fallbackSelection;
6142
- const [feedback, setFeedback] = (0, react.useState)(void 0);
6143
- (0, react.useEffect)(() => {
6144
- if (feedback === void 0) return;
6145
- const timer = setTimeout(() => setFeedback(void 0), 1500);
6146
- return () => clearTimeout(timer);
6147
- }, [feedback]);
6148
- const note = fallbackSelection === "dshws-deepseek" && !offerDeepseek ? t("fallbackDeepseekStoppedNote") : fallbackSelection === "dshws-deepseek" && !deepseekKeyed ? t("fallbackDeepseekKeylessNote") : fallbackSelection !== "auto" && fallbackSelection !== "dshws-deepseek" && !fallbackDesignationReady ? t("fallbackDesignationLostNote") : void 0;
6149
- const dotOn = effective === "dshws-deepseek" ? deepseekKeyed && fallbackDeepseekEligible : effective !== "auto" ? fallbackDesignationReady : false;
6150
- const dotTitle = dotOn ? t("configured") : note !== void 0 ? t("notConfigured") : void 0;
6151
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6152
- "data-testid": "dshws-fallback-tool",
6153
- "data-dshws-card": "",
6154
- style: {
6155
- ...cardStyle,
6156
- padding: "10px 14px",
6157
- display: "flex",
6158
- flexDirection: "column",
6159
- gap: 6
6160
- },
6161
- children: [
6162
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6163
- style: {
6164
- display: "flex",
6165
- alignItems: "center",
6166
- gap: 8
7102
+ gap: 8
6167
7103
  },
6168
7104
  children: [
6169
7105
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -6193,35 +7129,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6193
7129
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
6194
7130
  "aria-label": t("fallbackRowLabel"),
6195
7131
  "data-testid": "dshws-fallback-select",
7132
+ "data-dshws-focusable": "",
7133
+ "data-dshws-input": "",
6196
7134
  value: effective,
6197
7135
  onChange: (event) => {
6198
7136
  const next = event.target.value;
6199
7137
  onChoose(next).then((result) => setFeedback(result.ok ? "saved" : "failed"));
6200
7138
  },
6201
7139
  style: {
6202
- ...fieldInputStyle,
6203
- width: "auto",
6204
- minWidth: 0,
6205
- margin: 0,
6206
- appearance: "none",
6207
- WebkitAppearance: "none",
6208
- paddingRight: 32,
6209
- backgroundImage: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2381858C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\")",
6210
- backgroundRepeat: "no-repeat",
6211
- backgroundPosition: "right 12px center"
7140
+ ...selectStyle,
7141
+ minWidth: 0
6212
7142
  },
6213
7143
  children: [
6214
7144
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6215
7145
  value: "auto",
6216
- children: t("fallbackAutoOption")
7146
+ title: t("fallbackAutoOption"),
7147
+ children: t("fallbackAutoShort")
6217
7148
  }),
6218
7149
  toolOptions.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6219
7150
  value: id,
6220
- children: labelOf$2(id)
7151
+ children: memberLabelOf(id)
6221
7152
  }, id)),
6222
7153
  offerDeepseek ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
6223
7154
  value: "dshws-deepseek",
6224
- children: t("fallbackDeepseekOption")
7155
+ title: t("fallbackDeepseekOption"),
7156
+ children: t("fallbackDeepseekShort")
6225
7157
  }) : null
6226
7158
  ]
6227
7159
  })
@@ -6255,13 +7187,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6255
7187
  * rows open on demand and only while the takeover is on. */
6256
7188
  function FetchTakeoverRow(props) {
6257
7189
  const { t, active, onSet, chain } = props;
6258
- const [feedback, setFeedback] = (0, react.useState)(void 0);
7190
+ const [feedback, setFeedback] = useAutoClearFeedback();
6259
7191
  const [open, setOpen] = (0, react.useState)(false);
6260
- (0, react.useEffect)(() => {
6261
- if (feedback === void 0) return;
6262
- const timer = setTimeout(() => setFeedback(void 0), 1500);
6263
- return () => clearTimeout(timer);
6264
- }, [feedback]);
6265
7192
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6266
7193
  "data-testid": "dshws-fetch-takeover",
6267
7194
  "data-dshws-card": "",
@@ -6447,7 +7374,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6447
7374
  gap: 6,
6448
7375
  minWidth: 0
6449
7376
  },
6450
- children: [labelOf$2(id), index === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7377
+ children: [memberLabelOf(id), index === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6451
7378
  "data-testid": "dshws-fetch-role-primary",
6452
7379
  style: roleChipStyle,
6453
7380
  children: t("chainRolePrimary")
@@ -6456,7 +7383,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6456
7383
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6457
7384
  type: "button",
6458
7385
  "data-dshws-focusable": "",
6459
- "aria-label": `${labelOf$2(id)} ${t("moveUp")}`,
7386
+ "aria-label": `${memberLabelOf(id)} ${t("moveUp")}`,
6460
7387
  disabled: index === 0,
6461
7388
  onClick: () => void move(id, -1),
6462
7389
  style: moveButtonStyle,
@@ -6465,7 +7392,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6465
7392
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
6466
7393
  type: "button",
6467
7394
  "data-dshws-focusable": "",
6468
- "aria-label": `${labelOf$2(id)} ${t("moveDown")}`,
7395
+ "aria-label": `${memberLabelOf(id)} ${t("moveDown")}`,
6469
7396
  disabled: index === visible.length - 1,
6470
7397
  onClick: () => void move(id, 1),
6471
7398
  style: moveButtonStyle,
@@ -6476,16 +7403,59 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6476
7403
  })]
6477
7404
  });
6478
7405
  }
7406
+ //#endregion
7407
+ //#region src/client/member-card.tsx
6479
7408
  /**
6480
- * S23 D9 (plan §0.5 B2 path a): a staged field can run on LIFTED draft state
6481
- * so the draft survives the card/fold unmounting around it; `lifted === undefined`
6482
- * keeps the component self-contained (local state, previous behavior).
7409
+ * Per-member provider cards of the web-search settings section: the key pool
7410
+ * surface with its selection chip and key-count badge, the endpoint override,
7411
+ * the S17 P1 parameter controls, and the staged-text field family
7412
+ * (StagedTextField/DomainField/GeoField) shared with the section's geo and
7413
+ * domain rows.
7414
+ *
7415
+ * @module dsh-websearch/client/member-card
6483
7416
  */
6484
- function useLiftedDraft(lifted) {
6485
- const [local, setLocal] = (0, react.useState)(null);
6486
- if (lifted === void 0) return [local, setLocal];
6487
- return [lifted.draft, lifted.onDraftChange];
6488
- }
7417
+ /**
7418
+ * S14m: expanded fields mirror the host Models editor verbatim
7419
+ * (ModelsSection.module.css .field/.fieldLabel/.input) — a vertical stack per
7420
+ * field: 12px/500 label ABOVE a full-width 32px bordered input. Same pattern
7421
+ * the Models page and every host settings card uses.
7422
+ */
7423
+ const fieldStyle = {
7424
+ display: "flex",
7425
+ flexDirection: "column",
7426
+ gap: 6
7427
+ };
7428
+ /** Key-selection row (S13 D2): label + three segments; the pressed segment
7429
+ * carries the field visual (bg-layer-1/border-l3 — Input wrapper precedent). */
7430
+ const keySelButtonStyle = (pressed, configured) => ({
7431
+ fontSize: 12,
7432
+ lineHeight: "18px",
7433
+ padding: "2px 10px",
7434
+ cursor: configured ? "pointer" : "not-allowed",
7435
+ opacity: configured ? 1 : .4,
7436
+ borderRadius: 6,
7437
+ border: `1px solid var(--dsw-alias-border-${pressed ? "l3" : "l2"})`,
7438
+ background: pressed ? "var(--dsw-alias-bg-layer-1)" : "transparent",
7439
+ color: pressed ? "var(--dsw-alias-label-secondary)" : "var(--dsw-alias-label-tertiary)"
7440
+ });
7441
+ /** Chain rows render the brand label; ids stay the test/action payload (D3). */
7442
+ /** The three pool policies and their label keys, in control order (S13 D2). */
7443
+ const KEY_SELECTIONS = [
7444
+ {
7445
+ value: "order",
7446
+ labelKey: "keySelOrder"
7447
+ },
7448
+ {
7449
+ value: "round-robin",
7450
+ labelKey: "keySelRoundRobin"
7451
+ },
7452
+ {
7453
+ value: "random",
7454
+ labelKey: "keySelRandom"
7455
+ }
7456
+ ];
7457
+ /** Locale key for one policy value (the hint interpolates the live policy name). */
7458
+ const keySelectionLabelKey = (selection) => KEY_SELECTIONS.find((entry) => entry.value === selection)?.labelKey ?? "keySelOrder";
6489
7459
  /** S23 D9: the host's header-carried pending pill (PluginCard.module.css .pending). */
6490
7460
  const unsavedPillStyle = {
6491
7461
  flex: "none",
@@ -6498,6 +7468,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6498
7468
  background: "var(--dsw-alias-bg-module-platform)",
6499
7469
  color: "var(--dsw-alias-label-secondary)"
6500
7470
  };
7471
+ /** The pending pill a header carries while a staged draft is unsaved. */
6501
7472
  function UnsavedPill(props) {
6502
7473
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6503
7474
  "data-testid": props.testid,
@@ -6578,12 +7549,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6578
7549
  function MemberEndpointField(props) {
6579
7550
  const { member, t, onSet, lifted } = props;
6580
7551
  const [draft, setDraft] = useLiftedDraft(lifted);
6581
- const [feedback, setFeedback] = (0, react.useState)(void 0);
6582
- (0, react.useEffect)(() => {
6583
- if (feedback === void 0) return;
6584
- const timer = setTimeout(() => setFeedback(void 0), 1500);
6585
- return () => clearTimeout(timer);
6586
- }, [feedback]);
7552
+ const [feedback, setFeedback] = useAutoClearFeedback();
6587
7553
  const value = draft ?? member.baseURL ?? "";
6588
7554
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6589
7555
  style: fieldStyle,
@@ -6743,12 +7709,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6743
7709
  labelKey: "optDefault"
6744
7710
  },
6745
7711
  {
6746
- value: "filter",
6747
- labelKey: "modeFilter"
7712
+ value: "restrict",
7713
+ labelKey: "modeRestrict"
6748
7714
  },
6749
7715
  {
6750
- value: "boost",
6751
- labelKey: "modeBoost"
7716
+ value: "prefer",
7717
+ labelKey: "modePrefer"
6752
7718
  }
6753
7719
  ]
6754
7720
  },
@@ -6998,38 +7964,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6998
7964
  {
6999
7965
  value: "pdf",
7000
7966
  labelKey: "fcCatPdf"
7967
+ },
7968
+ {
7969
+ value: "alexandria",
7970
+ labelKey: "fcCatAlexandria"
7001
7971
  }
7002
7972
  ]
7003
7973
  }
7004
7974
  ]
7005
7975
  };
7006
- /** Native select chrome (the fallback-row precedent): inset chevron, auto width. */
7007
- const selectStyle = {
7008
- ...fieldInputStyle,
7009
- width: "auto",
7010
- minWidth: 120,
7011
- margin: 0,
7012
- appearance: "none",
7013
- WebkitAppearance: "none",
7014
- paddingRight: 32,
7015
- backgroundImage: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2381858C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\")",
7016
- backgroundRepeat: "no-repeat",
7017
- backgroundPosition: "right 12px center"
7018
- };
7019
7976
  /** One rendered S17 member parameter: selects/toggles commit immediately; text/number stage a draft. */
7020
7977
  function MemberParamField(props) {
7021
7978
  const { member, control, t, onSet, lifted } = props;
7022
7979
  const [draft, setDraft] = useLiftedDraft(lifted);
7023
- const [feedback, setFeedback] = (0, react.useState)(void 0);
7024
- (0, react.useEffect)(() => {
7025
- if (feedback === void 0) return;
7026
- const timer = setTimeout(() => setFeedback(void 0), 1500);
7027
- return () => clearTimeout(timer);
7028
- }, [feedback]);
7980
+ const [feedback, setFeedback] = useAutoClearFeedback();
7029
7981
  const stored = member[control.option];
7030
7982
  const ariaLabel = `${member.label} ${t(control.labelKey)}`;
7031
7983
  const testid = `dshws-param-${member.key}-${control.option}`;
7032
- const commit = (value) => onSet(member.key, control.option, value).then((result) => setFeedback(result.ok ? "saved" : "failed"));
7984
+ const commit = (value) => onSet(member.key, control.option, value).then((result) => {
7985
+ setFeedback(result.ok ? "saved" : "failed");
7986
+ return result;
7987
+ });
7033
7988
  if (control.kind === "select") {
7034
7989
  const value = typeof stored === "string" && stored !== "" ? stored : control.fallback ?? "";
7035
7990
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -7061,6 +8016,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7061
8016
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
7062
8017
  "aria-label": ariaLabel,
7063
8018
  "data-testid": testid,
8019
+ "data-dshws-focusable": "",
8020
+ "data-dshws-input": "",
7064
8021
  value,
7065
8022
  onChange: (event) => {
7066
8023
  commit(event.target.value);
@@ -7068,6 +8025,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7068
8025
  style: selectStyle,
7069
8026
  children: control.options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
7070
8027
  value: option.value,
8028
+ title: t(option.labelKey),
7071
8029
  children: t(option.labelKey)
7072
8030
  }, option.value))
7073
8031
  }), feedback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -7196,7 +8154,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7196
8154
  disabled: !valid || draft === null || draft === current,
7197
8155
  "aria-label": `${ariaLabel} ${t("save")}`,
7198
8156
  onClick: () => {
7199
- commit(control.kind === "number" ? Number(value) : value).then(() => setDraft(null));
8157
+ commit(control.kind === "number" ? Number(value) : value).then((result) => {
8158
+ if (result.ok) setDraft(null);
8159
+ });
7200
8160
  },
7201
8161
  children: t("save")
7202
8162
  }),
@@ -7214,80 +8174,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7214
8174
  })]
7215
8175
  });
7216
8176
  }
7217
- /** Unified search region/language fields (S17 P1, ADR-0015) — global single write point. */
7218
- function SearchGeoFields(props) {
7219
- const { t, country, language, onSetCountry, onSetLanguage, lifted } = props;
8177
+ /**
8178
+ * One staged text field (S37 T11): label + ⓘ note + input + Save + live-region
8179
+ * feedback, with the draft lifted on request — the shape DomainField and
8180
+ * GeoField previously duplicated at ~95% identity.
8181
+ */
8182
+ function StagedTextField(props) {
8183
+ const { t, testid, labelKey, noteKey, placeholder, width, centered, value, onSet, lifted } = props;
8184
+ const [draft, setDraft] = useLiftedDraft(lifted);
8185
+ const [feedback, setFeedback] = useAutoClearFeedback();
8186
+ const current = value ?? "";
8187
+ const shown = draft ?? current;
7220
8188
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7221
- "data-testid": "dshws-search-geo",
7222
8189
  style: {
7223
8190
  display: "flex",
7224
- flexDirection: "column",
7225
- gap: 6
7226
- },
7227
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GeoField, {
7228
- t,
7229
- testid: "dshws-search-country",
7230
- labelKey: "searchCountryLabel",
7231
- noteKey: "searchCountryNote",
7232
- placeholder: "CN",
7233
- value: country,
7234
- onSet: onSetCountry,
7235
- lifted: lifted?.country
7236
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GeoField, {
7237
- t,
7238
- testid: "dshws-search-language",
7239
- labelKey: "searchLanguageLabel",
7240
- noteKey: "searchLanguageNote",
7241
- placeholder: "zh",
7242
- value: language,
7243
- onSet: onSetLanguage,
7244
- lifted: lifted?.language
7245
- })]
7246
- });
7247
- }
7248
- /** Unified domain allow/block lists (S20 P1, ADR-0018) — mutually exclusive single-line inputs. */
7249
- function SearchDomainFields(props) {
7250
- const { t, includeDomains, excludeDomains, onSet, lifted } = props;
7251
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7252
- "data-testid": "dshws-search-domains",
7253
- style: {
7254
- display: "flex",
7255
- flexDirection: "column",
7256
- gap: 6
7257
- },
7258
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DomainField, {
7259
- t,
7260
- kind: "include",
7261
- value: includeDomains,
7262
- onSet,
7263
- lifted: lifted?.include
7264
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DomainField, {
7265
- t,
7266
- kind: "exclude",
7267
- value: excludeDomains,
7268
- onSet,
7269
- lifted: lifted?.exclude
7270
- })]
7271
- });
7272
- }
7273
- function DomainField(props) {
7274
- const { t, kind, value, onSet, lifted } = props;
7275
- const [draft, setDraft] = useLiftedDraft(lifted);
7276
- const [feedback, setFeedback] = (0, react.useState)(void 0);
7277
- (0, react.useEffect)(() => {
7278
- if (feedback === void 0) return;
7279
- const timer = setTimeout(() => setFeedback(void 0), 1500);
7280
- return () => clearTimeout(timer);
7281
- }, [feedback]);
7282
- const labelKey = kind === "include" ? "searchIncludeDomainsLabel" : "searchExcludeDomainsLabel";
7283
- const noteKey = kind === "include" ? "searchIncludeDomainsNote" : "searchExcludeDomainsNote";
7284
- const current = value ?? "";
7285
- const shown = draft ?? current;
7286
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7287
- style: {
7288
- display: "flex",
7289
- alignItems: "center",
7290
- gap: 8
8191
+ alignItems: "center",
8192
+ gap: 8
7291
8193
  },
7292
8194
  children: [
7293
8195
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
@@ -7312,92 +8214,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7312
8214
  })]
7313
8215
  }),
7314
8216
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
7315
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
7316
- "aria-label": t(labelKey),
7317
- "data-testid": `dshws-search-domains-${kind}`,
7318
- "data-dshws-input": "",
7319
- placeholder: "example.com,foo.org",
7320
- value: shown,
7321
- onChange: (event) => {
7322
- setDraft(event.target.value);
7323
- setFeedback(void 0);
7324
- },
7325
- style: {
7326
- width: 200,
7327
- height: 28,
7328
- padding: "0 8px",
7329
- borderRadius: 8,
7330
- border: "1px solid var(--dsw-alias-border-l2)",
7331
- background: "var(--dsw-alias-bg-layer-2)",
7332
- color: "inherit",
7333
- font: "inherit"
7334
- }
7335
- }),
7336
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
7337
- variant: "outline",
7338
- size: "sm",
7339
- disabled: draft === null || draft === current,
7340
- "aria-label": `${t(labelKey)} ${t("save")}`,
7341
- onClick: () => {
7342
- onSet(kind, draft ?? "").then((result) => {
7343
- setFeedback(result.ok ? "saved" : "failed");
7344
- if (result.ok) setDraft(null);
7345
- });
7346
- },
7347
- children: t("save")
7348
- }),
7349
- feedback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7350
- role: "status",
7351
- "data-testid": `dshws-search-domains-${kind}-feedback`,
7352
- style: {
7353
- fontSize: 12,
7354
- color: feedbackColor(feedback === "saved" ? "saved" : "failed")
7355
- },
7356
- children: t(feedback)
7357
- }) : null
7358
- ]
7359
- });
7360
- }
7361
- function GeoField(props) {
7362
- const { t, testid, labelKey, noteKey, placeholder, value, onSet, lifted } = props;
7363
- const [draft, setDraft] = useLiftedDraft(lifted);
7364
- const [feedback, setFeedback] = (0, react.useState)(void 0);
7365
- (0, react.useEffect)(() => {
7366
- if (feedback === void 0) return;
7367
- const timer = setTimeout(() => setFeedback(void 0), 1500);
7368
- return () => clearTimeout(timer);
7369
- }, [feedback]);
7370
- const current = value ?? "";
7371
- const shown = draft ?? current;
7372
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7373
- style: {
7374
- display: "flex",
7375
- alignItems: "center",
7376
- gap: 8
7377
- },
7378
- children: [
7379
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
7380
- style: {
7381
- display: "inline-flex",
7382
- alignItems: "center",
7383
- gap: 4,
7384
- fontSize: 12,
7385
- color: "var(--dsw-alias-label-secondary)"
7386
- },
7387
- children: [t(labelKey), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
7388
- label: t(noteKey),
7389
- side: "bottom",
7390
- delayMs: 400,
7391
- maxWidth: 360,
7392
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7393
- type: "button",
7394
- "aria-label": t(noteKey),
7395
- style: infoButtonStyle,
7396
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
7397
- })
7398
- })]
7399
- }),
7400
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
7401
8217
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
7402
8218
  "aria-label": t(labelKey),
7403
8219
  "data-testid": testid,
@@ -7409,10 +8225,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7409
8225
  setFeedback(void 0);
7410
8226
  },
7411
8227
  style: {
7412
- width: 88,
8228
+ width,
7413
8229
  height: 28,
7414
8230
  padding: "0 8px",
7415
- textAlign: "center",
8231
+ ...centered === true ? { textAlign: "center" } : {},
7416
8232
  borderRadius: 8,
7417
8233
  border: "1px solid var(--dsw-alias-border-l2)",
7418
8234
  background: "var(--dsw-alias-bg-layer-2)",
@@ -7445,16 +8261,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7445
8261
  ]
7446
8262
  });
7447
8263
  }
8264
+ /** One include/exclude domain-list field (S20 P1, ADR-0018) on StagedTextField. */
8265
+ function DomainField(props) {
8266
+ const { t, kind, value, onSet, lifted } = props;
8267
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StagedTextField, {
8268
+ t,
8269
+ testid: `dshws-search-domains-${kind}`,
8270
+ labelKey: kind === "include" ? "searchIncludeDomainsLabel" : "searchExcludeDomainsLabel",
8271
+ noteKey: kind === "include" ? "searchIncludeDomainsNote" : "searchExcludeDomainsNote",
8272
+ placeholder: "example.com,foo.org",
8273
+ width: 200,
8274
+ value,
8275
+ onSet: (text) => onSet(kind, text),
8276
+ lifted
8277
+ });
8278
+ }
8279
+ /** A centered narrow staged text field (the search region/language inputs). */
8280
+ function GeoField(props) {
8281
+ const { t, testid, labelKey, noteKey, placeholder, value, onSet, lifted } = props;
8282
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StagedTextField, {
8283
+ t,
8284
+ testid,
8285
+ labelKey,
8286
+ noteKey,
8287
+ placeholder,
8288
+ width: 88,
8289
+ centered: true,
8290
+ value,
8291
+ onSet,
8292
+ lifted
8293
+ });
8294
+ }
8295
+ /** One provider card: header (status dot, name, badges, enable switch) above
8296
+ * the folded key/endpoint/parameter surface. */
7448
8297
  function MemberCard(props) {
7449
8298
  const { member, t, onSaveKey, onClearKey, onToggleEnabled, onSetKeySelection, onSetBaseURL, onSetMemberOption, onRefreshKeyCounts } = props;
7450
8299
  const [draft, setDraft] = (0, react.useState)("");
7451
8300
  const [editing, setEditing] = (0, react.useState)(false);
7452
- const [feedback, setFeedback] = (0, react.useState)(void 0);
7453
- (0, react.useEffect)(() => {
7454
- if (feedback === void 0) return;
7455
- const timer = setTimeout(() => setFeedback(void 0), 1500);
7456
- return () => clearTimeout(timer);
7457
- }, [feedback]);
8301
+ const [feedback, setFeedback] = useAutoClearFeedback();
7458
8302
  const save = async () => {
7459
8303
  if ((await onSaveKey(member.key, draft)).ok) {
7460
8304
  setDraft("");
@@ -7699,6 +8543,727 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7699
8543
  });
7700
8544
  }
7701
8545
  //#endregion
8546
+ //#region src/client/section.tsx
8547
+ /**
8548
+ * Bind a controller into a registrable section component: the slot mechanism
8549
+ * supplies the `t` seat, the controller supplies state and actions through
8550
+ * the store subscription. The factory lives next to the presentational
8551
+ * component so the entry stays framework-light wiring.
8552
+ */
8553
+ function bindWebSearchSettingsSection(controller) {
8554
+ return function BoundWebSearchSettingsSection(props) {
8555
+ const snapshot = (0, react.useSyncExternalStore)((onStoreChange) => controller.subscribe(onStoreChange), () => controller.snapshot());
8556
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WebSearchSettingsSection, {
8557
+ t: props.t,
8558
+ snapshot,
8559
+ onSaveKey: (key, value) => controller.setKey(key, value),
8560
+ onClearKey: (key) => controller.clearKey(key),
8561
+ onToggleEnabled: (key, enabled) => controller.setEnabled(key, enabled),
8562
+ onMoveSearch: (id, delta) => controller.moveSearchChainEntry(id, delta),
8563
+ onSetKeySelection: (key, selection) => controller.setKeySelection(key, selection),
8564
+ onSetMaxUses: (maxUses) => controller.setDeepseekMaxUses(maxUses),
8565
+ onSetFallbackMember: (member) => controller.setFallbackMember(member),
8566
+ onSetFetchTakeover: (active) => controller.setFetchTakeover(active),
8567
+ onSetBaseURL: (key, url) => controller.setBaseURL(key, url),
8568
+ onSetMemberOption: (key, option, value) => controller.setMemberOption(key, option, value),
8569
+ onSetSearchCountry: (country) => controller.setSearchCountry(country),
8570
+ onSetSearchLanguage: (language) => controller.setSearchLanguage(language),
8571
+ onSetSearchDomains: (kind, domains) => controller.setSearchDomains(kind, domains),
8572
+ onMoveFetch: (id, delta) => controller.moveFetchChainEntry(id, delta),
8573
+ onRefreshKeyCounts: () => controller.refreshCounts(),
8574
+ onSetDnsMode: (mode) => controller.setDnsMode(mode),
8575
+ onSetDnsProbeMethod: (method) => controller.setDnsProbeMethod(method),
8576
+ onSetDnsPreset: (preset) => controller.setDnsPreset(preset),
8577
+ onSetDnsNodes: (text) => controller.setDnsNodesText(text),
8578
+ onRecheckDns: () => controller.recheckDns(),
8579
+ onRefreshDnsFace: () => controller.refreshDnsFace()
8580
+ });
8581
+ };
8582
+ }
8583
+ /**
8584
+ * S23 §0.5 B1: pseudo-class rules the inline-style system cannot express,
8585
+ * delivered as one injected <style> block selected by data-dshws-* attributes.
8586
+ * Colors stay tokenized (--dsw-alias-*) so both themes stay correct; host
8587
+ * anchors: PluginCard.module.css (.card:hover/.cardOpen/.header:focus-visible).
8588
+ */
8589
+ const SECTION_STYLE_CSS = `
8590
+ [data-dshws-card] { transition: border-color .16s, background .16s; }
8591
+ [data-dshws-card]:hover { border-color: var(--dsw-alias-label-dimmed); }
8592
+ [data-dshws-card][data-open='true'] { background: var(--dsw-alias-bg-layer-2); border-color: var(--dsw-alias-label-dimmed); }
8593
+ [data-dshws-card-body] { border-top: 1px solid var(--dsw-alias-border-l2); margin: 0 2px; padding-top: 8px; }
8594
+ [data-dshws-input]:focus { border-color: var(--dsw-alias-brand-primary); outline: none; }
8595
+ [data-dshws-focusable]:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
8596
+ @media (prefers-reduced-motion: reduce) {
8597
+ [data-dshws-card] { transition: none; }
8598
+ [data-dshws-chevron] { transition: none !important; }
8599
+ }
8600
+ `;
8601
+ /** The section body (`t` arrives as the locale runtime's standard seat). */
8602
+ function WebSearchSettingsSection(props) {
8603
+ const { t, snapshot, onSaveKey, onClearKey, onToggleEnabled, onMoveSearch, onSetKeySelection, onSetMaxUses, onSetFallbackMember, onSetFetchTakeover, onSetBaseURL, onSetMemberOption, onSetSearchCountry, onSetSearchLanguage, onSetSearchDomains, onMoveFetch, onRefreshKeyCounts, onSetDnsMode, onSetDnsPreset, onSetDnsNodes, onRecheckDns, onRefreshDnsFace, onSetDnsProbeMethod } = props;
8604
+ const [chainFeedback, setChainFeedback] = (0, react.useState)(void 0);
8605
+ const move = async (id, delta) => {
8606
+ const result = await onMoveSearch(id, delta);
8607
+ setChainFeedback(result.ok ? void 0 : "failed");
8608
+ };
8609
+ const visibleSearch = snapshot.searchChain.filter((id) => snapshot.members.some((m) => m.memberId === id && m.configured && m.enabled));
8610
+ const designatedId = snapshot.fallbackSelection !== "auto" && snapshot.fallbackSelection !== "dshws-deepseek" ? snapshot.fallbackSelection : null;
8611
+ const orderableSearch = designatedId === null ? visibleSearch : visibleSearch.filter((id) => id !== designatedId);
8612
+ const showLockedTail = designatedId !== null && snapshot.fallbackDesignationReady;
8613
+ const showChains = snapshot.members.some((m) => m.configured);
8614
+ const [advancedOpen, setAdvancedOpen] = (0, react.useState)(false);
8615
+ const [advancedDrafts, setAdvancedDrafts] = (0, react.useState)({});
8616
+ const setAdvancedDraft = (key, value) => {
8617
+ setAdvancedDrafts((previous) => ({
8618
+ ...previous,
8619
+ [key]: value
8620
+ }));
8621
+ };
8622
+ const advancedDirty = Object.values(advancedDrafts).some((value) => value !== null);
8623
+ const liftedOf = (key) => ({
8624
+ draft: advancedDrafts[key] ?? null,
8625
+ onDraftChange: (value) => setAdvancedDraft(key, value)
8626
+ });
8627
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8628
+ style: {
8629
+ display: "flex",
8630
+ flexDirection: "column",
8631
+ gap: 12,
8632
+ maxWidth: 720
8633
+ },
8634
+ children: [
8635
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
8636
+ "data-dshws-styles": "",
8637
+ children: SECTION_STYLE_CSS
8638
+ }),
8639
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
8640
+ style: {
8641
+ margin: 0,
8642
+ fontSize: 16,
8643
+ fontWeight: 500,
8644
+ display: "inline-flex",
8645
+ alignItems: "center",
8646
+ gap: 4
8647
+ },
8648
+ children: [t("title"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
8649
+ label: t("description"),
8650
+ side: "bottom",
8651
+ delayMs: 400,
8652
+ maxWidth: 360,
8653
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8654
+ type: "button",
8655
+ "aria-label": t("description"),
8656
+ style: infoButtonStyle,
8657
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
8658
+ })
8659
+ })]
8660
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8661
+ style: {
8662
+ margin: 0,
8663
+ marginTop: 4,
8664
+ fontSize: 14,
8665
+ lineHeight: "22px",
8666
+ color: "var(--dsw-alias-label-tertiary)"
8667
+ },
8668
+ children: t("description")
8669
+ })] }),
8670
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
8671
+ "data-testid": "dshws-chains",
8672
+ "data-dshws-card": "",
8673
+ style: {
8674
+ ...cardStyle,
8675
+ padding: "10px 14px",
8676
+ gap: 8
8677
+ },
8678
+ children: [
8679
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8680
+ style: {
8681
+ display: "flex",
8682
+ alignItems: "center",
8683
+ gap: 8
8684
+ },
8685
+ children: [
8686
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
8687
+ style: {
8688
+ margin: 0,
8689
+ fontSize: 12,
8690
+ fontWeight: 500,
8691
+ color: "var(--dsw-alias-label-secondary)"
8692
+ },
8693
+ children: t("searchChain")
8694
+ }),
8695
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
8696
+ label: snapshot.searchChainPinned ? `${t("chainPinned")}: ${t("chainOrderHint")}` : t("chainOrderHint"),
8697
+ side: "bottom",
8698
+ delayMs: 200,
8699
+ maxWidth: 360,
8700
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8701
+ type: "button",
8702
+ "aria-label": snapshot.searchChainPinned ? `${t("chainPinned")}: ${t("chainOrderHint")}` : t("chainOrderHint"),
8703
+ "data-testid": "dshws-chain-order-info",
8704
+ "data-dshws-chain-state": snapshot.searchChainPinned ? "pinned" : "default",
8705
+ style: infoButtonStyle,
8706
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
8707
+ })
8708
+ }),
8709
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } })
8710
+ ]
8711
+ }),
8712
+ showChains ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ol", {
8713
+ "data-testid": "dshws-search-chain",
8714
+ style: {
8715
+ margin: 0,
8716
+ paddingLeft: 0,
8717
+ listStyle: "none",
8718
+ maxHeight: 280,
8719
+ overflowY: "auto",
8720
+ display: "flex",
8721
+ flexDirection: "column",
8722
+ gap: 4
8723
+ },
8724
+ children: [orderableSearch.map((id, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
8725
+ "data-testid": `dshws-chain-item-${id}`,
8726
+ style: chainRowStyle,
8727
+ children: [
8728
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8729
+ style: chainIndexStyle,
8730
+ children: index + 1
8731
+ }),
8732
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8733
+ "data-dshws-chain-label": "",
8734
+ style: {
8735
+ display: "inline-flex",
8736
+ alignItems: "center",
8737
+ gap: 6,
8738
+ minWidth: 0
8739
+ },
8740
+ children: [
8741
+ memberLabelOf(id),
8742
+ index === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8743
+ "data-testid": "dshws-chain-role-primary",
8744
+ style: roleChipStyle,
8745
+ children: t("chainRolePrimary")
8746
+ }) : null,
8747
+ !showLockedTail && orderableSearch.length > 1 && index === orderableSearch.length - 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8748
+ "data-testid": "dshws-chain-role-standby",
8749
+ style: roleChipStyle,
8750
+ children: t("chainRoleStandby")
8751
+ }) : null
8752
+ ]
8753
+ }),
8754
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8755
+ type: "button",
8756
+ "data-dshws-focusable": "",
8757
+ "aria-label": `${memberLabelOf(id)} ${t("moveUp")}`,
8758
+ disabled: index === 0,
8759
+ onClick: () => void move(id, -1),
8760
+ style: moveButtonStyle,
8761
+ children: "↑"
8762
+ }),
8763
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8764
+ type: "button",
8765
+ "data-dshws-focusable": "",
8766
+ "aria-label": `${memberLabelOf(id)} ${t("moveDown")}`,
8767
+ disabled: index === orderableSearch.length - 1 && !showLockedTail,
8768
+ onClick: () => void move(id, 1),
8769
+ style: moveButtonStyle,
8770
+ children: "↓"
8771
+ })
8772
+ ]
8773
+ }, id)), showLockedTail && designatedId !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
8774
+ "data-testid": `dshws-chain-item-${designatedId}`,
8775
+ "data-dshws-chain-locked": "",
8776
+ style: chainRowStyle,
8777
+ children: [
8778
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8779
+ style: chainIndexStyle,
8780
+ children: orderableSearch.length + 1
8781
+ }),
8782
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8783
+ "data-dshws-chain-label": "",
8784
+ children: memberLabelOf(designatedId)
8785
+ }),
8786
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8787
+ "data-testid": "dshws-chain-role-standby",
8788
+ style: roleChipStyle,
8789
+ children: t("chainRoleStandby")
8790
+ }),
8791
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8792
+ style: hintStyle,
8793
+ children: t("chainLockedNote")
8794
+ }),
8795
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } })
8796
+ ]
8797
+ }, designatedId) : null]
8798
+ }) : null,
8799
+ snapshot.members.every((m) => !(m.configured && m.enabled)) && showChains ? snapshot.fallbackSelection === "dshws-deepseek" && snapshot.fallbackDeepseekEligible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8800
+ role: "status",
8801
+ "data-testid": "dshws-chain-floor",
8802
+ style: hintStyle,
8803
+ children: t("chainFloorDeepseekNote")
8804
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8805
+ role: "status",
8806
+ "data-testid": "dshws-chain-no-usable",
8807
+ style: {
8808
+ ...hintStyle,
8809
+ color: "var(--dsw-alias-state-error-primary)"
8810
+ },
8811
+ children: t("chainNoUsableWarning")
8812
+ }) : null,
8813
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
8814
+ type: "button",
8815
+ "data-testid": "dshws-advanced-disclosure",
8816
+ "data-dshws-focusable": "",
8817
+ "aria-expanded": advancedOpen,
8818
+ "aria-label": t("advancedConfigLabel"),
8819
+ onClick: () => {
8820
+ setAdvancedOpen((value) => !value);
8821
+ },
8822
+ style: {
8823
+ display: "flex",
8824
+ alignItems: "center",
8825
+ gap: 6,
8826
+ border: "none",
8827
+ background: "transparent",
8828
+ color: "var(--dsw-alias-label-secondary)",
8829
+ font: "inherit",
8830
+ fontSize: 12,
8831
+ fontWeight: 500,
8832
+ textAlign: "left",
8833
+ cursor: "pointer",
8834
+ padding: 0
8835
+ },
8836
+ children: [
8837
+ t("advancedConfigLabel"),
8838
+ advancedDirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnsavedPill, {
8839
+ t,
8840
+ testid: "dshws-unsaved-advanced"
8841
+ }) : null,
8842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8843
+ "aria-hidden": "true",
8844
+ "data-dshws-chevron": "",
8845
+ style: {
8846
+ display: "inline-flex",
8847
+ color: "var(--dsw-alias-label-tertiary)",
8848
+ transform: advancedOpen ? "rotate(180deg)" : "none",
8849
+ transition: "transform 160ms ease"
8850
+ },
8851
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, {})
8852
+ })
8853
+ ]
8854
+ }),
8855
+ advancedOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8856
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FallbackToolRow, {
8857
+ snapshot,
8858
+ t,
8859
+ onChoose: onSetFallbackMember
8860
+ }, "dshws-fallback-tool"),
8861
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
8862
+ style: hintStyle,
8863
+ children: [
8864
+ t("timeout"),
8865
+ ": ",
8866
+ snapshot.timeoutMs,
8867
+ " ms"
8868
+ ]
8869
+ }),
8870
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MaxUsesRow, {
8871
+ t,
8872
+ value: snapshot.deepseekMaxUses,
8873
+ onSet: onSetMaxUses,
8874
+ lifted: liftedOf("maxUses")
8875
+ }),
8876
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchGeoFields, {
8877
+ t,
8878
+ country: snapshot.searchCountry,
8879
+ language: snapshot.searchLanguage,
8880
+ onSetCountry: onSetSearchCountry,
8881
+ onSetLanguage: onSetSearchLanguage,
8882
+ lifted: {
8883
+ country: liftedOf("country"),
8884
+ language: liftedOf("language")
8885
+ }
8886
+ }),
8887
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDomainFields, {
8888
+ t,
8889
+ includeDomains: snapshot.searchIncludeDomains,
8890
+ excludeDomains: snapshot.searchExcludeDomains,
8891
+ onSet: onSetSearchDomains,
8892
+ lifted: {
8893
+ include: liftedOf("domain-include"),
8894
+ exclude: liftedOf("domain-exclude")
8895
+ }
8896
+ })
8897
+ ] }) : null,
8898
+ chainFeedback ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
8899
+ style: {
8900
+ ...hintStyle,
8901
+ color: "var(--dsw-alias-state-error-primary)"
8902
+ },
8903
+ "data-testid": "dshws-chain-feedback",
8904
+ children: t(chainFeedback)
8905
+ }) : null
8906
+ ]
8907
+ }),
8908
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8909
+ "data-testid": "dshws-members",
8910
+ style: {
8911
+ display: "flex",
8912
+ flexDirection: "column",
8913
+ gap: 8
8914
+ },
8915
+ children: [snapshot.members.filter((member) => member.key !== "deepseek").map((member) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemberCard, {
8916
+ member,
8917
+ t,
8918
+ onSaveKey,
8919
+ onClearKey,
8920
+ onToggleEnabled,
8921
+ onSetKeySelection,
8922
+ onSetBaseURL,
8923
+ onSetMemberOption,
8924
+ onRefreshKeyCounts
8925
+ }, member.key)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchTakeoverRow, {
8926
+ t,
8927
+ active: snapshot.fetchTakeover,
8928
+ onSet: onSetFetchTakeover,
8929
+ chain: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FetchChainRows, {
8930
+ t,
8931
+ snapshot,
8932
+ onMove: onMoveFetch
8933
+ })
8934
+ })]
8935
+ }),
8936
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DnsResilienceCard, {
8937
+ t,
8938
+ snapshot,
8939
+ onSetDnsMode,
8940
+ onSetDnsProbeMethod,
8941
+ onSetDnsPreset,
8942
+ onSetDnsNodes,
8943
+ onRecheckDns,
8944
+ onRefreshDnsFace
8945
+ })
8946
+ ]
8947
+ });
8948
+ }
8949
+ /**
8950
+ * Host-parity maxUses knob (S14c): staged numeric input in the global area —
8951
+ * the label and semantics match the host `web-search-deepseek` card verbatim.
8952
+ */
8953
+ function MaxUsesRow(props) {
8954
+ const { t, value, onSet, lifted } = props;
8955
+ const [liftedDraft, setLiftedDraft] = useLiftedDraft(lifted);
8956
+ const draft = liftedDraft ?? "";
8957
+ const setDraft = (next) => {
8958
+ setLiftedDraft(next === "" && lifted !== void 0 ? null : next);
8959
+ };
8960
+ const [feedback, setFeedback] = useAutoClearFeedback();
8961
+ const current = value ?? 10;
8962
+ const parsed = draft.trim() === "" ? current : Number.parseInt(draft, 10);
8963
+ const save = async () => {
8964
+ const result = await onSet(parsed);
8965
+ setFeedback(result.ok ? "saved" : "failed");
8966
+ if (result.ok) setDraft("");
8967
+ };
8968
+ const hint = t("maxUsesHint").replace("{N}", String(parsed));
8969
+ const MIN_USES = 5;
8970
+ const MAX_USES = 100;
8971
+ const STEP_USES = 5;
8972
+ const valid = Number.isInteger(parsed) && parsed >= MIN_USES && parsed <= MAX_USES;
8973
+ const snap = (raw) => Math.min(MAX_USES, Math.max(MIN_USES, raw - raw % STEP_USES));
8974
+ const stepUp = () => setDraft(String(snap((draft.trim() === "" ? current : parsed) + STEP_USES)));
8975
+ const stepDown = () => setDraft(String(snap((draft.trim() === "" ? current : parsed) - STEP_USES)));
8976
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8977
+ "data-testid": "dshws-max-uses",
8978
+ style: {
8979
+ display: "flex",
8980
+ alignItems: "center",
8981
+ gap: 8
8982
+ },
8983
+ children: [
8984
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
8985
+ style: {
8986
+ display: "inline-flex",
8987
+ alignItems: "center",
8988
+ gap: 4,
8989
+ fontSize: 12,
8990
+ color: "var(--dsw-alias-label-secondary)"
8991
+ },
8992
+ children: [t("maxUsesLabel"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
8993
+ label: hint,
8994
+ side: "bottom",
8995
+ delayMs: 400,
8996
+ maxWidth: 320,
8997
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8998
+ type: "button",
8999
+ "aria-label": hint,
9000
+ style: infoButtonStyle,
9001
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionIcon, {})
9002
+ })
9003
+ })]
9004
+ }),
9005
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
9006
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9007
+ style: {
9008
+ display: "flex",
9009
+ alignItems: "center",
9010
+ gap: 4
9011
+ },
9012
+ children: [
9013
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9014
+ type: "button",
9015
+ "aria-label": `${t("maxUsesLabel")} −`,
9016
+ "data-testid": "dshws-max-uses-down",
9017
+ onClick: stepDown,
9018
+ disabled: !valid,
9019
+ style: {
9020
+ ...moveButtonStyle,
9021
+ width: 22,
9022
+ height: 22
9023
+ },
9024
+ children: "−"
9025
+ }),
9026
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
9027
+ type: "number",
9028
+ min: 5,
9029
+ max: 100,
9030
+ step: 5,
9031
+ "aria-label": t("maxUsesLabel"),
9032
+ "data-testid": "dshws-max-uses-input",
9033
+ "data-dshws-input": "",
9034
+ style: {
9035
+ width: 52,
9036
+ height: 28,
9037
+ padding: "0 6px",
9038
+ textAlign: "center",
9039
+ borderRadius: 8,
9040
+ border: "1px solid var(--dsw-alias-border-l2)",
9041
+ background: "var(--dsw-alias-bg-layer-2)",
9042
+ color: "inherit",
9043
+ font: "inherit"
9044
+ },
9045
+ value: draft === "" ? String(current) : draft,
9046
+ onChange: (event) => {
9047
+ setDraft(event.target.value);
9048
+ setFeedback(void 0);
9049
+ }
9050
+ }),
9051
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
9052
+ type: "button",
9053
+ "aria-label": `${t("maxUsesLabel")} +`,
9054
+ "data-testid": "dshws-max-uses-up",
9055
+ onClick: stepUp,
9056
+ disabled: !valid,
9057
+ style: {
9058
+ ...moveButtonStyle,
9059
+ width: 22,
9060
+ height: 22
9061
+ },
9062
+ children: "+"
9063
+ })
9064
+ ]
9065
+ }),
9066
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9067
+ variant: "outline",
9068
+ size: "sm",
9069
+ "aria-label": `${t("maxUsesLabel")} ${t("save")}`,
9070
+ disabled: !valid || draft.trim() === "",
9071
+ onClick: () => void save(),
9072
+ children: t("save")
9073
+ }),
9074
+ feedback ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9075
+ role: "status",
9076
+ "data-testid": "dshws-max-uses-feedback",
9077
+ style: {
9078
+ ...feedbackStyle,
9079
+ color: feedbackColor(feedback === "saved" ? "saved" : "failed")
9080
+ },
9081
+ children: t(feedback)
9082
+ }) : null
9083
+ ]
9084
+ });
9085
+ }
9086
+ /** Unified search region/language fields (S17 P1, ADR-0015) — global single write point. */
9087
+ function SearchGeoFields(props) {
9088
+ const { t, country, language, onSetCountry, onSetLanguage, lifted } = props;
9089
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9090
+ "data-testid": "dshws-search-geo",
9091
+ style: {
9092
+ display: "flex",
9093
+ flexDirection: "column",
9094
+ gap: 6
9095
+ },
9096
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(GeoField, {
9097
+ t,
9098
+ testid: "dshws-search-country",
9099
+ labelKey: "searchCountryLabel",
9100
+ noteKey: "searchCountryNote",
9101
+ placeholder: "CN",
9102
+ value: country,
9103
+ onSet: onSetCountry,
9104
+ lifted: lifted?.country
9105
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GeoField, {
9106
+ t,
9107
+ testid: "dshws-search-language",
9108
+ labelKey: "searchLanguageLabel",
9109
+ noteKey: "searchLanguageNote",
9110
+ placeholder: "zh",
9111
+ value: language,
9112
+ onSet: onSetLanguage,
9113
+ lifted: lifted?.language
9114
+ })]
9115
+ });
9116
+ }
9117
+ /** Unified domain allow/block lists (S20 P1, ADR-0018) — mutually exclusive single-line inputs. */
9118
+ function SearchDomainFields(props) {
9119
+ const { t, includeDomains, excludeDomains, onSet, lifted } = props;
9120
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9121
+ "data-testid": "dshws-search-domains",
9122
+ style: {
9123
+ display: "flex",
9124
+ flexDirection: "column",
9125
+ gap: 6
9126
+ },
9127
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DomainField, {
9128
+ t,
9129
+ kind: "include",
9130
+ value: includeDomains,
9131
+ onSet,
9132
+ lifted: lifted?.include
9133
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DomainField, {
9134
+ t,
9135
+ kind: "exclude",
9136
+ value: excludeDomains,
9137
+ onSet,
9138
+ lifted: lifted?.exclude
9139
+ })]
9140
+ });
9141
+ }
9142
+ //#endregion
9143
+ //#region src/client/dns-trace-section.tsx
9144
+ /**
9145
+ * The DNS resolution trace section for the toolview rows (S35 T9): renders
9146
+ * the sanitized ring (via the shared store) inside a `<details>` fold — the
9147
+ * process-level recent resolutions with via/latency/code, refreshed when the
9148
+ * fold opens. Attribution is the ring window, not per-call wiring: per-call
9149
+ * trace threading needs a session-event channel and stays a registered
9150
+ * follow-up (session-35 record).
9151
+ *
9152
+ * @module dsh-websearch/client/dns-trace-section
9153
+ */
9154
+ const traceLineStyle = {
9155
+ margin: 0,
9156
+ fontSize: 12,
9157
+ lineHeight: "18px",
9158
+ color: "var(--dsw-alias-label-tertiary)"
9159
+ };
9160
+ /**
9161
+ * The shared trace fold — one per toolview row, all reading the same ring.
9162
+ * @param props - the locale seat (`t`).
9163
+ */
9164
+ function DnsTraceSection(props) {
9165
+ const { t } = props;
9166
+ const entries = (0, react.useSyncExternalStore)(subscribeDnsTrace, dnsTraceEntries);
9167
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", {
9168
+ "data-testid": "dshws-tool-dns-trace",
9169
+ onToggle: (event) => {
9170
+ if (event.target.open) refreshDnsTrace();
9171
+ },
9172
+ style: {
9173
+ borderTop: "1px solid var(--dsw-alias-border-l2)",
9174
+ paddingTop: 6
9175
+ },
9176
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
9177
+ style: {
9178
+ ...traceLineStyle,
9179
+ cursor: "pointer",
9180
+ listStyle: "revert"
9181
+ },
9182
+ children: t("dnsTraceTitle")
9183
+ }), entries.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9184
+ style: traceLineStyle,
9185
+ children: t("dnsTraceEmpty")
9186
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
9187
+ style: {
9188
+ margin: 0,
9189
+ paddingLeft: 16
9190
+ },
9191
+ children: entries.slice(-8).reverse().map((entry, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
9192
+ style: traceLineStyle,
9193
+ children: [
9194
+ entry.kind,
9195
+ " ",
9196
+ entry.host,
9197
+ entry.via !== void 0 ? ` · ${entry.via}` : "",
9198
+ entry.latencyMs !== void 0 ? ` · ${t("dnsTraceLatency").replace("{ms}", String(entry.latencyMs))}` : "",
9199
+ entry.code !== void 0 ? ` · ${entry.code}` : ""
9200
+ ]
9201
+ }, `${entry.at}-${index}`))
9202
+ })]
9203
+ });
9204
+ }
9205
+ //#endregion
9206
+ //#region src/client/toolview-common.ts
9207
+ const shellStyle = {
9208
+ display: "flex",
9209
+ flexDirection: "column"
9210
+ };
9211
+ const rowStyle = {
9212
+ display: "flex",
9213
+ alignItems: "center",
9214
+ gap: 8,
9215
+ background: "none",
9216
+ border: "none",
9217
+ padding: "4px 0",
9218
+ color: "inherit",
9219
+ font: "inherit",
9220
+ cursor: "pointer",
9221
+ textAlign: "left",
9222
+ minWidth: 0
9223
+ };
9224
+ const titleStyle = {
9225
+ fontSize: 13,
9226
+ fontWeight: 500,
9227
+ flexShrink: 0
9228
+ };
9229
+ const summaryStyle = {
9230
+ fontSize: 12,
9231
+ opacity: .7,
9232
+ overflow: "hidden",
9233
+ textOverflow: "ellipsis",
9234
+ whiteSpace: "nowrap"
9235
+ };
9236
+ const badgeStyle = {
9237
+ fontSize: 11,
9238
+ flexShrink: 0,
9239
+ border: "1px solid var(--dsw-alias-border-l2)",
9240
+ borderRadius: 999,
9241
+ padding: "0 6px",
9242
+ lineHeight: "18px"
9243
+ };
9244
+ const bodyStyle = {
9245
+ display: "flex",
9246
+ flexDirection: "column",
9247
+ gap: 8,
9248
+ padding: "4px 0 8px 22px",
9249
+ fontSize: 13
9250
+ };
9251
+ const noteStyle = {
9252
+ fontSize: 12,
9253
+ opacity: .7
9254
+ };
9255
+ const errorStyle = {
9256
+ color: "var(--dsw-alias-state-error-primary)",
9257
+ fontSize: 12
9258
+ };
9259
+ const preStyle = {
9260
+ margin: 0,
9261
+ fontSize: 11,
9262
+ whiteSpace: "pre-wrap",
9263
+ wordBreak: "break-word",
9264
+ opacity: .8
9265
+ };
9266
+ //#endregion
7702
9267
  //#region src/client/fetch-row.tsx
7703
9268
  /**
7704
9269
  * web_fetch toolview takeover (S28), the fetch sibling of the web_search row
@@ -7723,9 +9288,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7723
9288
  const SERVED_BY_PATTERN$1 = /\\?\[served-by: ([^\\\]]+)\\?\]/g;
7724
9289
  const SERVED_BY_LINE_PATTERN$1 = /^\\?\[served-by: [^\\\]]+\\?\]\n?/gm;
7725
9290
  /** Badge brand for a member id: the bundled label, else the raw id (ADR-0010 Decision 4). */
7726
- function labelOf$1(memberId) {
7727
- return MEMBERS.find((member) => member.memberId === memberId)?.label ?? memberId;
7728
- }
7729
9291
  /** The first text block's text, if the settled call carries one. */
7730
9292
  function firstText$1(content) {
7731
9293
  return content.find((piece) => piece.type === "text" && typeof piece.text === "string")?.text;
@@ -7763,70 +9325,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7763
9325
  servedBy
7764
9326
  };
7765
9327
  }
7766
- const shellStyle$1 = {
7767
- display: "flex",
7768
- flexDirection: "column"
7769
- };
7770
- const rowStyle$1 = {
7771
- display: "flex",
7772
- alignItems: "center",
7773
- gap: 8,
7774
- background: "none",
7775
- border: "none",
7776
- padding: "4px 0",
7777
- color: "inherit",
7778
- font: "inherit",
7779
- cursor: "pointer",
7780
- textAlign: "left",
7781
- minWidth: 0
7782
- };
7783
- const titleStyle$1 = {
7784
- fontSize: 13,
7785
- fontWeight: 500,
7786
- flexShrink: 0
7787
- };
7788
- const summaryStyle$1 = {
7789
- fontSize: 12,
7790
- opacity: .7,
7791
- overflow: "hidden",
7792
- textOverflow: "ellipsis",
7793
- whiteSpace: "nowrap"
7794
- };
7795
- const badgeStyle$1 = {
7796
- fontSize: 11,
7797
- flexShrink: 0,
7798
- border: "1px solid var(--dsw-alias-border-l2)",
7799
- borderRadius: 999,
7800
- padding: "0 6px",
7801
- lineHeight: "18px"
7802
- };
7803
- const bodyStyle$1 = {
7804
- display: "flex",
7805
- flexDirection: "column",
7806
- gap: 8,
7807
- padding: "4px 0 8px 22px",
7808
- fontSize: 13
7809
- };
7810
9328
  const linkStyle = { fontSize: 12 };
7811
9329
  const statusStyle = {
7812
9330
  fontSize: 12,
7813
9331
  opacity: .7
7814
9332
  };
7815
- const noteStyle$1 = {
7816
- fontSize: 12,
7817
- opacity: .7
7818
- };
7819
- const errorStyle$1 = {
7820
- color: "var(--dsw-alias-state-error-primary)",
7821
- fontSize: 12
7822
- };
7823
- const preStyle$1 = {
7824
- margin: 0,
7825
- fontSize: 11,
7826
- whiteSpace: "pre-wrap",
7827
- wordBreak: "break-word",
7828
- opacity: .8
7829
- };
7830
9333
  /** The self-drawn web_fetch tool row served by the `tool.call.toolview` takeover. */
7831
9334
  function WebFetchToolviewRow(props) {
7832
9335
  const [open, setOpen] = (0, react.useState)(false);
@@ -7835,16 +9338,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7835
9338
  const running = "kind" in block ? void 0 : block;
7836
9339
  const summary = urlFromArgs(settled?.call?.argsRaw ?? running?.argsRaw ?? "");
7837
9340
  const fetch = settled !== void 0 && !settled.isError ? deriveFetchCard(settled) : null;
7838
- const badge = fetch !== null && fetch.servedBy.length > 0 ? `· ${fetch.servedBy.map(labelOf$1).join(" + ")}` : void 0;
9341
+ const badge = fetch !== null && fetch.servedBy.length > 0 ? `· ${fetch.servedBy.map(memberLabelOf).join(" + ")}` : void 0;
7839
9342
  const contentText = settled !== void 0 ? settled.content.filter((piece) => typeof piece.text === "string").map((piece) => piece.text).join("\n") : "";
7840
9343
  const displayText = fetch !== null && fetch.servedBy.length > 0 ? contentText.replace(SERVED_BY_LINE_PATTERN$1, "").trim() : contentText;
7841
9344
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7842
9345
  "data-testid": "dshws-fetch-toolview",
7843
- style: shellStyle$1,
9346
+ style: shellStyle,
7844
9347
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
7845
9348
  type: "button",
7846
9349
  "data-testid": "dshws-fetch-toolview-row",
7847
- style: rowStyle$1,
9350
+ style: rowStyle,
7848
9351
  "aria-expanded": open,
7849
9352
  onClick: () => {
7850
9353
  setOpen((value) => !value);
@@ -7852,23 +9355,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7852
9355
  children: [
7853
9356
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobeIcon, { size: 14 }),
7854
9357
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7855
- style: titleStyle$1,
9358
+ style: titleStyle,
7856
9359
  children: t("fetchTitle")
7857
9360
  }),
7858
9361
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7859
- style: summaryStyle$1,
9362
+ style: summaryStyle,
7860
9363
  children: summary
7861
9364
  }),
7862
9365
  badge !== void 0 && fetch !== null && fetch.servedBy.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7863
- "data-testid": "dshws-served-by",
7864
- style: badgeStyle$1,
7865
- "aria-label": `${t("servedBy")} ${fetch.servedBy.map(labelOf$1).join(" + ")}`,
9366
+ "data-testid": "dshws-fetch-served-by",
9367
+ style: badgeStyle,
9368
+ "aria-label": `${t("servedBy")} ${fetch.servedBy.map(memberLabelOf).join(" + ")}`,
7866
9369
  children: badge
7867
9370
  })
7868
9371
  ]
7869
9372
  }), open && (fetch !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7870
9373
  "data-testid": "dshws-fetch-toolview-body",
7871
- style: bodyStyle$1,
9374
+ style: bodyStyle,
7872
9375
  children: [
7873
9376
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
7874
9377
  href: fetch.url,
@@ -7882,12 +9385,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7882
9385
  children: `HTTP ${fetch.statusCode}`
7883
9386
  }),
7884
9387
  fetch.truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7885
- style: noteStyle$1,
9388
+ style: noteStyle,
7886
9389
  children: t("toolTruncated")
7887
9390
  }),
9391
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DnsTraceSection, { t }),
7888
9392
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("toolRaw") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
7889
9393
  "data-testid": "dshws-fetch-raw",
7890
- style: preStyle$1,
9394
+ style: preStyle,
7891
9395
  children: displayText
7892
9396
  })] }),
7893
9397
  props.inspect !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -7900,13 +9404,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7900
9404
  ]
7901
9405
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7902
9406
  "data-testid": "dshws-fetch-toolview-generic",
7903
- style: bodyStyle$1,
9407
+ style: bodyStyle,
7904
9408
  children: [settled?.isError === true && settled.error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7905
9409
  role: "status",
7906
- style: errorStyle$1,
9410
+ style: errorStyle,
7907
9411
  children: `${t("toolError")}: ${settled.error.name}${settled.error.code !== void 0 ? ` (${settled.error.code})` : ""}`
7908
9412
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
7909
- style: preStyle$1,
9413
+ style: preStyle,
7910
9414
  children: contentText
7911
9415
  })]
7912
9416
  }))]
@@ -7972,9 +9476,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7972
9476
  }
7973
9477
  }
7974
9478
  /** Badge brand for a member id: the bundled label, else the raw id (ADR-0010 Decision 4). */
7975
- function labelOf(memberId) {
7976
- return MEMBERS.find((member) => member.memberId === memberId)?.label ?? memberId;
7977
- }
7978
9479
  /** The first text block's text, if the settled call carries one. */
7979
9480
  function firstText(content) {
7980
9481
  return content.find((piece) => piece.type === "text" && typeof piece.text === "string")?.text;
@@ -8019,50 +9520,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8019
9520
  servedBy
8020
9521
  };
8021
9522
  }
8022
- const shellStyle = {
8023
- display: "flex",
8024
- flexDirection: "column"
8025
- };
8026
- const rowStyle = {
8027
- display: "flex",
8028
- alignItems: "center",
8029
- gap: 8,
8030
- background: "none",
8031
- border: "none",
8032
- padding: "4px 0",
8033
- color: "inherit",
8034
- font: "inherit",
8035
- cursor: "pointer",
8036
- textAlign: "left",
8037
- minWidth: 0
8038
- };
8039
- const titleStyle = {
8040
- fontSize: 13,
8041
- fontWeight: 500,
8042
- flexShrink: 0
8043
- };
8044
- const summaryStyle = {
8045
- fontSize: 12,
8046
- opacity: .7,
8047
- overflow: "hidden",
8048
- textOverflow: "ellipsis",
8049
- whiteSpace: "nowrap"
8050
- };
8051
- const badgeStyle = {
8052
- fontSize: 11,
8053
- flexShrink: 0,
8054
- border: "1px solid var(--dsw-alias-border-l2)",
8055
- borderRadius: 999,
8056
- padding: "0 6px",
8057
- lineHeight: "18px"
8058
- };
8059
- const bodyStyle = {
8060
- display: "flex",
8061
- flexDirection: "column",
8062
- gap: 8,
8063
- padding: "4px 0 8px 22px",
8064
- fontSize: 13
8065
- };
8066
9523
  const answerStyle = {
8067
9524
  margin: 0,
8068
9525
  whiteSpace: "pre-wrap"
@@ -8092,21 +9549,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8092
9549
  fontSize: 12,
8093
9550
  opacity: .8
8094
9551
  };
8095
- const noteStyle = {
8096
- fontSize: 12,
8097
- opacity: .7
8098
- };
8099
- const errorStyle = {
8100
- color: "var(--dsw-alias-state-error-primary)",
8101
- fontSize: 12
8102
- };
8103
- const preStyle = {
8104
- margin: 0,
8105
- fontSize: 11,
8106
- whiteSpace: "pre-wrap",
8107
- wordBreak: "break-word",
8108
- opacity: .8
8109
- };
8110
9552
  /** The self-drawn web_search tool row served by the `tool.call.toolview` takeover. */
8111
9553
  function WebSearchToolviewRow(props) {
8112
9554
  const [open, setOpen] = (0, react.useState)(false);
@@ -8116,7 +9558,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8116
9558
  const argsRaw = settled?.call?.argsRaw ?? running?.argsRaw ?? "";
8117
9559
  const summary = summarizeArgs(argsRaw);
8118
9560
  const web = settled !== void 0 && !settled.isError ? deriveWebCard(settled) : null;
8119
- const badge = web !== null && web.servedBy.length > 0 ? `· ${web.servedBy.map(labelOf).join(" + ")}` : void 0;
9561
+ const badge = web !== null && web.servedBy.length > 0 ? `· ${web.servedBy.map(memberLabelOf).join(" + ")}` : void 0;
8120
9562
  const contentText = settled !== void 0 ? settled.content.filter((piece) => typeof piece.text === "string").map((piece) => piece.text).join("\n") : "";
8121
9563
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8122
9564
  "data-testid": "dshws-toolview",
@@ -8140,9 +9582,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8140
9582
  children: summary
8141
9583
  }),
8142
9584
  badge !== void 0 && web !== null && web.servedBy.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8143
- "data-testid": "dshws-served-by",
9585
+ "data-testid": "dshws-search-served-by",
8144
9586
  style: badgeStyle,
8145
- "aria-label": `${t("servedBy")} ${web.servedBy.map(labelOf).join(" + ")}`,
9587
+ "aria-label": `${t("servedBy")} ${web.servedBy.map(memberLabelOf).join(" + ")}`,
8146
9588
  children: badge
8147
9589
  })
8148
9590
  ]
@@ -8184,6 +9626,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8184
9626
  style: noteStyle,
8185
9627
  children: t("toolTruncated")
8186
9628
  }),
9629
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DnsTraceSection, { t }),
8187
9630
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("details", { children: [
8188
9631
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", { children: t("toolRaw") }),
8189
9632
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
@@ -8245,6 +9688,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8245
9688
  zh,
8246
9689
  en
8247
9690
  }));
9691
+ registerDnsTraceFetcher(async () => {
9692
+ const trace = await (await mountKeyCountsRemote(ctx)).readDnsTrace();
9693
+ if (!trace.ok) throw new Error("dshws dns remote unavailable");
9694
+ return trace.value;
9695
+ });
8248
9696
  ctx.slots.inject("settings.section", () => {
8249
9697
  const controller = new WebSearchSettingsController(adaptRemote(ctx));
8250
9698
  controller.init();
@@ -8278,6 +9726,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8278
9726
  const remote = ctx.remote;
8279
9727
  let keyCounts;
8280
9728
  const keyCountsRemote = () => keyCounts ??= mountKeyCountsRemote(ctx);
9729
+ const dnsRemote = () => keyCountsRemote();
8281
9730
  return {
8282
9731
  describeSettings: () => remote.settings.describe(),
8283
9732
  updateSettings: (ns, patch, expectedRevision) => remote.settings.update(ns, patch, expectedRevision),
@@ -8294,7 +9743,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8294
9743
  },
8295
9744
  setCredential: (ref, value) => remote.credentials.set(ref, value),
8296
9745
  unsetCredential: (ref) => remote.credentials.unset(ref),
8297
- onReferenceUpdated: (handler) => remote.$on("credentials/reference-updated", (ref) => handler(String(ref)))
9746
+ onReferenceUpdated: (handler) => remote.$on("credentials/reference-updated", (ref) => handler(String(ref))),
9747
+ dns: {
9748
+ describeDnsStatus: async () => {
9749
+ try {
9750
+ return await (await dnsRemote()).describeDnsStatus();
9751
+ } catch (err) {
9752
+ console.error("[dshws-dns] describeDnsStatus failed:", err);
9753
+ return {
9754
+ ok: false,
9755
+ error: /* @__PURE__ */ new Error("dshws dns remote unavailable")
9756
+ };
9757
+ }
9758
+ },
9759
+ readDnsTrace: async () => {
9760
+ try {
9761
+ return await (await dnsRemote()).readDnsTrace();
9762
+ } catch {
9763
+ return {
9764
+ ok: false,
9765
+ error: /* @__PURE__ */ new Error("dshws dns remote unavailable")
9766
+ };
9767
+ }
9768
+ },
9769
+ requestDnsRecheck: async () => {
9770
+ try {
9771
+ return await (await dnsRemote()).requestDnsRecheck();
9772
+ } catch {
9773
+ return {
9774
+ ok: false,
9775
+ error: /* @__PURE__ */ new Error("dshws dns remote unavailable")
9776
+ };
9777
+ }
9778
+ }
9779
+ }
8298
9780
  };
8299
9781
  }
8300
9782
  //#endregion