@240xu/dsh-websearch 2.13.5 → 2.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/client.js +32 -9
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -40,6 +40,10 @@ window.__ModuleLoader__.load({
|
|
|
40
40
|
};
|
|
41
41
|
/** Boolean settings staged as "true"/"false" strings by the selects. */
|
|
42
42
|
const BOOLEAN_FIELDS = ["rerank", "safeSearch", "resultTelemetry", "resultHeader", "cacheEnabled"];
|
|
43
|
+
// resolveOptions forces these under official; a draft left behind would
|
|
44
|
+
// be saved while having no runtime effect, and could block Save with an
|
|
45
|
+
// invalid value the disabled control cannot correct.
|
|
46
|
+
const OFFICIAL_IGNORED_FIELDS = ["numResults", "rerank", "resultTelemetry", "resultHeader"];
|
|
43
47
|
// split metered, opt-in backends out of the
|
|
44
48
|
// "keyless / ready to use" group. They work without a key but are rate
|
|
45
49
|
// limited and default OFF, so a separate section with an explicit hint
|
|
@@ -143,6 +147,7 @@ window.__ModuleLoader__.load({
|
|
|
143
147
|
interventionBalanced: "平衡(确定性去噪 + 去重/遥测,默认)",
|
|
144
148
|
interventionThorough: "彻底(相关性重排 + 深度覆盖)",
|
|
145
149
|
interventionHint: "official 把查询与结果呈现完全交给官方工具;balanced 只剥明确的口语前缀;thorough 会重排并扩大后端请求,延迟与额度消耗更高。内部多查询仍是独立开关。",
|
|
150
|
+
officialHint: "官方档会覆盖:结果条数、相关性重排、结果健康遥测、引用提示头——这四项在你离开 official 前不生效。",
|
|
146
151
|
unavailable: "设置暂不可用:宿主没有返回配置快照(服务未就绪或路由未挂载)。",
|
|
147
152
|
retry: "重试",
|
|
148
153
|
loading: "载入中…",
|
|
@@ -235,6 +240,7 @@ window.__ModuleLoader__.load({
|
|
|
235
240
|
interventionBalanced: "Balanced (deterministic cleanup + dedupe/telemetry, default)",
|
|
236
241
|
interventionThorough: "Thorough (relevance rerank + deep coverage)",
|
|
237
242
|
interventionHint: "official leaves query construction and presentation to the host tool; balanced strips only explicit conversational prefixes; thorough reranks and widens backend requests, costing more latency and quota. Internal multi-query stays a separate opt-in.",
|
|
243
|
+
officialHint: "Official also overrides Results, Relevance rerank, Result health telemetry and Citation header; those controls have no effect until you leave official.",
|
|
238
244
|
unavailable: "Settings are unavailable: the host returned no configuration snapshot (service not ready or route not mounted).",
|
|
239
245
|
retry: "Retry",
|
|
240
246
|
loading: "Loading…",
|
|
@@ -501,6 +507,9 @@ window.__ModuleLoader__.load({
|
|
|
501
507
|
}
|
|
502
508
|
this.savedAt = 0;
|
|
503
509
|
this.staged.set(field, { text });
|
|
510
|
+
if (field === "intervention" && String(text) === "official") {
|
|
511
|
+
for (const ignored of OFFICIAL_IGNORED_FIELDS) this.staged.delete(ignored);
|
|
512
|
+
}
|
|
504
513
|
this.republish();
|
|
505
514
|
}
|
|
506
515
|
/** Drop a staged field edit; the stored value is untouched. */
|
|
@@ -861,6 +870,8 @@ window.__ModuleLoader__.load({
|
|
|
861
870
|
react_jsx_runtime.jsx("select", {
|
|
862
871
|
className: "wsc-input",
|
|
863
872
|
"aria-label": props.label,
|
|
873
|
+
"aria-describedby": props.describedBy,
|
|
874
|
+
disabled: props.disabled === true,
|
|
864
875
|
value: props.value,
|
|
865
876
|
onChange: (e) => props.onChange(e.target.value),
|
|
866
877
|
children: props.options.map((o) =>
|
|
@@ -950,6 +961,12 @@ window.__ModuleLoader__.load({
|
|
|
950
961
|
const { state, card, t } = props;
|
|
951
962
|
const selVal = (f, dflt) => state.stagedText(f) ?? String(state.value[f] ?? dflt);
|
|
952
963
|
const cacheOn = selVal("cacheEnabled", "true") !== "false";
|
|
964
|
+
const official = selVal("intervention", "balanced") === "official";
|
|
965
|
+
const hasDraft = (f) => state.stagedText(f) !== undefined;
|
|
966
|
+
// A gate only locks untouched fields; a field with a pending edit
|
|
967
|
+
// stays editable so the user can correct or discard it.
|
|
968
|
+
const officialLocked = (f) => official && !hasDraft(f); // drafts are dropped on switching to official
|
|
969
|
+
const ttlLocked = !cacheOn && !hasDraft("cacheTtl");
|
|
953
970
|
const recencyOptions = [
|
|
954
971
|
{ value: "any", label: t("recencyAny") },
|
|
955
972
|
{ value: "day", label: t("recencyDay") },
|
|
@@ -978,24 +995,25 @@ window.__ModuleLoader__.load({
|
|
|
978
995
|
options: interventionOptions,
|
|
979
996
|
onChange: (v) => card.edit("intervention", v),
|
|
980
997
|
}) }),
|
|
981
|
-
react_jsx_runtime.jsx("p", { className: "wsc-hint", children: t("interventionHint") }),
|
|
998
|
+
react_jsx_runtime.jsx("p", { className: "wsc-hint", id: "wsc-intervention-hint", children: t("interventionHint") + (official ? " " + t("officialHint") : "") }),
|
|
982
999
|
react_jsx_runtime.jsx("h4", { className: "wsc-sectionTitle", children: t("globalsTitle") }),
|
|
983
1000
|
react_jsx_runtime.jsxs("div", { className: "wsc-grid", children: [
|
|
984
1001
|
react_jsx_runtime.jsxs("div", { children: [
|
|
985
1002
|
react_jsx_runtime.jsx("div", { className: "wsc-fieldHead", children: react_jsx_runtime.jsx("span", { className: "wsc-label", children: t("numResultsLabel") }) }),
|
|
986
|
-
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("numResultsLabel"), value: state.stagedText("numResults") ?? String(state.value.numResults ?? ""), onChange: (e) => card.edit("numResults", e.target.value), inputMode: "numeric" }),
|
|
1003
|
+
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("numResultsLabel"), "aria-describedby": official ? "wsc-intervention-hint" : undefined, "aria-invalid": state.failedFields.includes("numResults") || undefined, disabled: officialLocked("numResults"), value: state.stagedText("numResults") ?? String(state.value.numResults ?? ""), onChange: (e) => card.edit("numResults", e.target.value), inputMode: "numeric" }),
|
|
987
1004
|
] }),
|
|
988
1005
|
react_jsx_runtime.jsxs("div", { children: [
|
|
989
1006
|
react_jsx_runtime.jsx("div", { className: "wsc-fieldHead", children: react_jsx_runtime.jsx("span", { className: "wsc-label", children: t("concurrencyLabel") }) }),
|
|
990
|
-
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("concurrencyLabel"), value: state.stagedText("concurrency") ?? String(state.value.concurrency ?? ""), onChange: (e) => card.edit("concurrency", e.target.value), inputMode: "numeric" }),
|
|
1007
|
+
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("concurrencyLabel"), "aria-invalid": state.failedFields.includes("concurrency") || undefined, value: state.stagedText("concurrency") ?? String(state.value.concurrency ?? ""), onChange: (e) => card.edit("concurrency", e.target.value), inputMode: "numeric" }),
|
|
991
1008
|
] }),
|
|
992
1009
|
react_jsx_runtime.jsxs("div", { children: [
|
|
993
1010
|
react_jsx_runtime.jsx("div", { className: "wsc-fieldHead", children: react_jsx_runtime.jsx("span", { className: "wsc-label", children: t("timeoutLabel") }) }),
|
|
994
|
-
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("timeoutLabel"), value: state.stagedText("backendTimeoutMs") ?? String(state.value.backendTimeoutMs ?? ""), onChange: (e) => card.edit("backendTimeoutMs", e.target.value), inputMode: "numeric" }),
|
|
1011
|
+
react_jsx_runtime.jsx("input", { className: "wsc-input", "aria-label": t("timeoutLabel"), "aria-invalid": state.failedFields.includes("backendTimeoutMs") || undefined, value: state.stagedText("backendTimeoutMs") ?? String(state.value.backendTimeoutMs ?? ""), onChange: (e) => card.edit("backendTimeoutMs", e.target.value), inputMode: "numeric" }),
|
|
995
1012
|
] }),
|
|
1013
|
+
react_jsx_runtime.jsx(SelectField, { label: t("cacheLabel"), value: selVal("cacheEnabled", "true"), options: boolOptions, onChange: (v) => card.edit("cacheEnabled", v) }),
|
|
996
1014
|
react_jsx_runtime.jsxs("div", { children: [
|
|
997
1015
|
react_jsx_runtime.jsx("div", { className: "wsc-fieldHead", children: react_jsx_runtime.jsx("span", { className: "wsc-label", children: t("cacheTtlLabel") }) }),
|
|
998
|
-
react_jsx_runtime.jsx("input", { className: "wsc-input", id: "wsc-cacheTtl", "aria-label": t("cacheTtlLabel"), "aria-describedby": "wsc-cacheTtl-hint", "aria-invalid": state.failedFields.includes("cacheTtl") || undefined, disabled:
|
|
1016
|
+
react_jsx_runtime.jsx("input", { className: "wsc-input", id: "wsc-cacheTtl", "aria-label": t("cacheTtlLabel"), "aria-describedby": "wsc-cacheTtl-hint", "aria-invalid": state.failedFields.includes("cacheTtl") || undefined, disabled: ttlLocked, value: state.stagedText("cacheTtl") ?? String(state.value.cacheTtl ?? ""), onChange: (e) => card.edit("cacheTtl", e.target.value), inputMode: "numeric" }),
|
|
999
1017
|
react_jsx_runtime.jsx("p", { className: "wsc-hint", id: "wsc-cacheTtl-hint", children: cacheOn ? t("cacheTtlHint") : t("cacheTtlHint") + " " + t("cacheOffHint") }),
|
|
1000
1018
|
] }),
|
|
1001
1019
|
] }),
|
|
@@ -1015,11 +1033,10 @@ window.__ModuleLoader__.load({
|
|
|
1015
1033
|
] }),
|
|
1016
1034
|
react_jsx_runtime.jsx(SelectField, { label: t("recencyLabel"), value: selVal("recency", "any"), options: recencyOptions, onChange: (v) => card.edit("recency", v) }),
|
|
1017
1035
|
react_jsx_runtime.jsx(SelectField, { label: t("dedupLabel"), value: selVal("dedupStrategy", "url"), options: dedupOptions, onChange: (v) => card.edit("dedupStrategy", v) }),
|
|
1018
|
-
react_jsx_runtime.jsx(SelectField, { label: t("rerankLabel"), value: selVal("rerank", "false"), options: boolOptions, onChange: (v) => card.edit("rerank", v) }),
|
|
1036
|
+
react_jsx_runtime.jsx(SelectField, { label: t("rerankLabel"), value: selVal("rerank", "false"), options: boolOptions, disabled: officialLocked("rerank"), describedBy: official ? "wsc-intervention-hint" : undefined, onChange: (v) => card.edit("rerank", v) }),
|
|
1019
1037
|
react_jsx_runtime.jsx(SelectField, { label: t("safeSearchLabel"), value: selVal("safeSearch", "true"), options: boolOptions, onChange: (v) => card.edit("safeSearch", v) }),
|
|
1020
|
-
react_jsx_runtime.jsx(SelectField, { label: t("telemetryLabel"), value: selVal("resultTelemetry", "true"), options: boolOptions, onChange: (v) => card.edit("resultTelemetry", v) }),
|
|
1021
|
-
react_jsx_runtime.jsx(SelectField, { label: t("resultHeaderLabel"), value: selVal("resultHeader", "true"), options: boolOptions, onChange: (v) => card.edit("resultHeader", v) }),
|
|
1022
|
-
react_jsx_runtime.jsx(SelectField, { label: t("cacheLabel"), value: selVal("cacheEnabled", "true"), options: boolOptions, onChange: (v) => card.edit("cacheEnabled", v) }),
|
|
1038
|
+
react_jsx_runtime.jsx(SelectField, { label: t("telemetryLabel"), value: selVal("resultTelemetry", "true"), options: boolOptions, disabled: officialLocked("resultTelemetry"), describedBy: official ? "wsc-intervention-hint" : undefined, onChange: (v) => card.edit("resultTelemetry", v) }),
|
|
1039
|
+
react_jsx_runtime.jsx(SelectField, { label: t("resultHeaderLabel"), value: selVal("resultHeader", "true"), options: boolOptions, disabled: officialLocked("resultHeader"), describedBy: official ? "wsc-intervention-hint" : undefined, onChange: (v) => card.edit("resultHeader", v) }),
|
|
1023
1040
|
] }),
|
|
1024
1041
|
] });
|
|
1025
1042
|
}
|
|
@@ -1123,6 +1140,12 @@ window.__ModuleLoader__.load({
|
|
|
1123
1140
|
];
|
|
1124
1141
|
const selVal = (f, dflt) => state.stagedText(f) ?? String(state.value[f] ?? dflt);
|
|
1125
1142
|
const cacheOn = selVal("cacheEnabled", "true") !== "false";
|
|
1143
|
+
const official = selVal("intervention", "balanced") === "official";
|
|
1144
|
+
const hasDraft = (f) => state.stagedText(f) !== undefined;
|
|
1145
|
+
// A gate only locks untouched fields; a field with a pending edit
|
|
1146
|
+
// stays editable so the user can correct or discard it.
|
|
1147
|
+
const officialLocked = (f) => official && !hasDraft(f); // drafts are dropped on switching to official
|
|
1148
|
+
const ttlLocked = !cacheOn && !hasDraft("cacheTtl");
|
|
1126
1149
|
|
|
1127
1150
|
return react_jsx_runtime.jsxs("div", { className: "wsc-card", children: [
|
|
1128
1151
|
react_jsx_runtime.jsx(StatusSummary, { state, enabledCount, hasOverride: override.length > 0, keysReady, t: props.t }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@240xu/dsh-websearch",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.7",
|
|
4
4
|
"description": "Unified web search provider for DeepSeek Harness (ctx.web): 13 backends — Exa + Parallel + DDG + SearXNG (keyless), DeepSeek + Anthropic + OpenAI + Brave + Tavily + Serper + Mojeek (key-gated via Settings credentials), Firecrawl + TinyFish (metered keyless, opt-in). Registers provider id \"unified\" for zero-config web_search. 统一网页搜索聚合:13 后端并发扇出、去重合并。See CHANGELOG.md for version history.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|