@dsh-plus/web-search-services 0.1.12 → 0.1.14

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
@@ -7,6 +7,54 @@ window.__ModuleLoader__.load({
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let react = require("react");
9
9
  require("@deepseek-ai/dsh-client-ui-primitives");
10
+ //#region ../shared/src/client/fields.tsx
11
+ /** 卡片按钮(与 CardChrome 页脚同一套类名与视觉)。 */
12
+ function Button(props) {
13
+ const p = props.prefix ?? "dshp";
14
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
15
+ type: "button",
16
+ className: `${p}-btn ${props.variant === "primary" ? `${p}-btnPrimary` : `${p}-btnGhost`}`,
17
+ disabled: props.disabled === true,
18
+ onClick: props.onClick,
19
+ children: props.label
20
+ });
21
+ }
22
+ function TextField(props) {
23
+ const p = props.prefix ?? "dshp";
24
+ const invalid = props.invalid === true;
25
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
26
+ className: `${p}-field`,
27
+ children: [
28
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
29
+ className: `${p}-head`,
30
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
31
+ className: `${p}-label`,
32
+ htmlFor: props.id,
33
+ children: props.label
34
+ }), props.badge !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
35
+ className: `${p}-badge ${props.badge.set ? `${p}-badgeSet` : `${p}-badgeUnset`}`,
36
+ children: props.badge.text
37
+ }) : null]
38
+ }),
39
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
40
+ id: props.id,
41
+ className: `${p}-input${invalid ? ` ${p}-inputInvalid` : ""}`,
42
+ type: props.password === true ? "password" : "text",
43
+ inputMode: props.numeric === true ? "numeric" : void 0,
44
+ autoComplete: props.password === true ? "off" : void 0,
45
+ "aria-invalid": invalid || void 0,
46
+ value: props.value,
47
+ disabled: props.disabled === true,
48
+ onChange: (event) => props.onEdit(event.target.value)
49
+ }),
50
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
51
+ className: invalid ? `${p}-invalid` : `${p}-hint`,
52
+ children: invalid ? props.invalidLabel ?? "" : props.hint ?? ""
53
+ })
54
+ ]
55
+ });
56
+ }
57
+ //#endregion
10
58
  //#region ../shared/src/client/card.tsx
11
59
  const IDLE_STATUS = {
12
60
  kind: "idle",
@@ -55,12 +103,12 @@ window.__ModuleLoader__.load({
55
103
  className: `${p}-status${props.status.kind === "error" ? ` ${p}-statusError` : ""}`,
56
104
  role: "status",
57
105
  children: props.status.text
58
- }) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
59
- type: "button",
60
- className: `${p}-btn ${action.variant === "primary" ? `${p}-btnPrimary` : `${p}-btnGhost`}`,
61
- disabled: action.disabled === true,
62
- onClick: action.onClick,
63
- children: action.label
106
+ }) : null, props.actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
107
+ prefix: p,
108
+ label: action.label,
109
+ variant: action.variant,
110
+ disabled: action.disabled,
111
+ onClick: action.onClick
64
112
  }, action.key))]
65
113
  })
66
114
  ]
@@ -181,43 +229,6 @@ window.__ModuleLoader__.load({
181
229
  };
182
230
  }
183
231
  //#endregion
184
- //#region ../shared/src/client/fields.tsx
185
- function TextField(props) {
186
- const p = props.prefix ?? "dshp";
187
- const invalid = props.invalid === true;
188
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
189
- className: `${p}-field`,
190
- children: [
191
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
192
- className: `${p}-head`,
193
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
194
- className: `${p}-label`,
195
- htmlFor: props.id,
196
- children: props.label
197
- }), props.badge !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
198
- className: `${p}-badge ${props.badge.set ? `${p}-badgeSet` : `${p}-badgeUnset`}`,
199
- children: props.badge.text
200
- }) : null]
201
- }),
202
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
203
- id: props.id,
204
- className: `${p}-input${invalid ? ` ${p}-inputInvalid` : ""}`,
205
- type: props.password === true ? "password" : "text",
206
- inputMode: props.numeric === true ? "numeric" : void 0,
207
- autoComplete: props.password === true ? "off" : void 0,
208
- "aria-invalid": invalid || void 0,
209
- value: props.value,
210
- disabled: props.disabled === true,
211
- onChange: (event) => props.onEdit(event.target.value)
212
- }),
213
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
214
- className: invalid ? `${p}-invalid` : `${p}-hint`,
215
- children: invalid ? props.invalidLabel ?? "" : props.hint ?? ""
216
- })
217
- ]
218
- });
219
- }
220
- //#endregion
221
232
  //#region ../shared/src/client/i18n.ts
222
233
  /** 卡片通用文案(save/discard/unsaved/loading 等四插件共有键)。 */
223
234
  const commonZh = {
@@ -227,7 +238,7 @@ window.__ModuleLoader__.load({
227
238
  unsaved: "未保存",
228
239
  loading: "加载中…",
229
240
  unavailable: "配置服务不可用。",
230
- readOnly: "当前部署无 settings provider,配置为只读;请编辑 settings.yaml。",
241
+ readOnly: "当前部署无 settings provider,配置为只读;请在 profile 的 cordis.patch.yml 行级配置。",
231
242
  invalidNumber: "请输入正整数。",
232
243
  collapse: "收起",
233
244
  expand: "展开",
@@ -244,7 +255,7 @@ window.__ModuleLoader__.load({
244
255
  unsaved: "Unsaved",
245
256
  loading: "Loading…",
246
257
  unavailable: "Settings service unavailable.",
247
- readOnly: "No settings provider in this deployment; config is read-only. Edit settings.yaml.",
258
+ readOnly: "No settings provider in this deployment; config is read-only. Configure it at the profile row in cordis.patch.yml.",
248
259
  invalidNumber: "Enter a positive integer.",
249
260
  collapse: "Collapse",
250
261
  expand: "Expand",
@@ -451,8 +462,8 @@ ${extra}
451
462
  //#region src/ns.ts
452
463
  /**
453
464
  * settings 命名空间字面量(纯常量,零依赖)。
454
- * 服务端以字面量注册 settings section(用户层配置落 $DSH_HOME/settings.yaml,
455
- * 热生效);与行级 cordis Config 共用同一份 schemastery schema(config.ts)。
465
+ * 服务端以字面量注册 settings section(用户层配置落 profile 行级覆盖层
466
+ * cordis.patch.yml,热生效);与行级 cordis Config 共用同一份 schema。
456
467
  * @module web-search-services/ns
457
468
  */
458
469
  const SETTINGS_NS = "dsh-plus-web-search-services";
@@ -683,7 +694,7 @@ ${extra}
683
694
  invalidTimeout: "请输入不小于 1000 的整数",
684
695
  keysGroup: "密钥与覆盖项(本卡片不编辑)",
685
696
  keysHint: "密钥主来源是上面的 env 文件,保持 skill 单事实源:TAVILY_API_KEY、EXA_API_KEY、SEARCH_OPENAI_API_KEY,以及可选的 SEARCH_OPENAI_BASE_URL、SEARCH_OPENAI_MODEL。",
686
- keysUserLayerHint: "schema 里的 keys 段是行级覆盖逃生舱(role(secret) 字段只允许 profile 行级注入);写入 settings.yaml 用户层会被脱敏遮蔽,因此配置卡片不提供编辑。需要覆盖时请改 env 文件,或在 profile 的 cordis.patch.yml 行级注入。",
697
+ keysUserLayerHint: "schema 里的 keys 段是行级覆盖逃生舱(role(secret) 字段只允许 profile 行级注入);写入 settings 用户层会被脱敏遮蔽,因此配置卡片不提供编辑。需要覆盖时请改 env 文件,或在 profile 的 cordis.patch.yml 行级注入。",
687
698
  reloadHint: "改动热生效(下一次 web_search 调用即用新配置);scriptPath / python 变化无需重启。"
688
699
  };
689
700
  const ownEn = {
@@ -704,7 +715,7 @@ ${extra}
704
715
  invalidTimeout: "Enter an integer of at least 1000",
705
716
  keysGroup: "Credentials and overrides (not edited here)",
706
717
  keysHint: "Credentials come from the env file above, keeping the skill as the single source: TAVILY_API_KEY, EXA_API_KEY, SEARCH_OPENAI_API_KEY, plus optional SEARCH_OPENAI_BASE_URL and SEARCH_OPENAI_MODEL.",
707
- keysUserLayerHint: "The keys section in the schema is a line-level escape hatch (role(secret) fields accept profile-line injection only); values written to the settings.yaml user layer are masked, so this card offers no editor. To override, edit the env file or inject at the profile row in cordis.patch.yml.",
718
+ keysUserLayerHint: "The keys section in the schema is a line-level escape hatch (role(secret) fields accept profile-line injection only); values written to the settings user layer are masked, so this card offers no editor. To override, edit the env file or inject at the profile row in cordis.patch.yml.",
708
719
  reloadHint: "Changes apply hot (the next web_search call uses them); scriptPath / python need no restart."
709
720
  };
710
721
  const zh = mergeDict(commonZh, ownZh);
package/lib/index.d.ts CHANGED
@@ -44,7 +44,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
44
44
  openaiModel: z<string, string, "defined">;
45
45
  }>>>, "volatile-defined">;
46
46
  }>>, "plain">;
47
- /** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
47
+ /** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
48
48
  type WebSearchServicesConfigFields = Schemastery.TypeT<typeof Config>;
49
49
  /** 平面配置形态(消费面的读取形态,由活动引用解包得到)。 */
50
50
  type WebSearchServicesConfig = UnwrapVolatile<WebSearchServicesConfigFields>;
package/lib/index.js CHANGED
@@ -614,7 +614,7 @@ var SearchServicesProvider = class {
614
614
  //#region src/config.ts
615
615
  /**
616
616
  * 配置单一事实源:cordis 行级 Config(组合默认值,patch 层可覆盖)与 settings
617
- * namespace(用户层 $DSH_HOME/settings.yaml,热生效)共用同一 schemastery schema。
617
+ * namespace(用户层=profile 行级覆盖层 cordis.patch.yml,热生效)共用同一 schemastery schema。
618
618
  *
619
619
  * 密钥主来源是 search-services skill 的 env 文件(envFile,默认
620
620
  * ~/.config/search-services/env),保持 skill 单事实源、零搬迁。行级 keys 仅为
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/web-search-services",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "dsh-plus service plugin: web_search 免费后端聚合——经官方 ctx.web provider 扩展点桥接 search-services skill(Tavily/Exa/OpenAI Chat 免费额度,优先级+自动回退+key 配置),官方 web_search 工具与输出格式零修改",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@dsh-plus/shared": "0.1.34"
35
+ "@dsh-plus/shared": "0.1.36"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/cordis": "^4.0.5-alpha.1",
@@ -30,7 +30,7 @@ const ownZh = {
30
30
  keysHint:
31
31
  '密钥主来源是上面的 env 文件,保持 skill 单事实源:TAVILY_API_KEY、EXA_API_KEY、SEARCH_OPENAI_API_KEY,以及可选的 SEARCH_OPENAI_BASE_URL、SEARCH_OPENAI_MODEL。',
32
32
  keysUserLayerHint:
33
- 'schema 里的 keys 段是行级覆盖逃生舱(role(secret) 字段只允许 profile 行级注入);写入 settings.yaml 用户层会被脱敏遮蔽,因此配置卡片不提供编辑。需要覆盖时请改 env 文件,或在 profile 的 cordis.patch.yml 行级注入。',
33
+ 'schema 里的 keys 段是行级覆盖逃生舱(role(secret) 字段只允许 profile 行级注入);写入 settings 用户层会被脱敏遮蔽,因此配置卡片不提供编辑。需要覆盖时请改 env 文件,或在 profile 的 cordis.patch.yml 行级注入。',
34
34
  reloadHint: '改动热生效(下一次 web_search 调用即用新配置);scriptPath / python 变化无需重启。',
35
35
  } as const
36
36
 
@@ -59,7 +59,7 @@ const ownEn = {
59
59
  keysHint:
60
60
  'Credentials come from the env file above, keeping the skill as the single source: TAVILY_API_KEY, EXA_API_KEY, SEARCH_OPENAI_API_KEY, plus optional SEARCH_OPENAI_BASE_URL and SEARCH_OPENAI_MODEL.',
61
61
  keysUserLayerHint:
62
- 'The keys section in the schema is a line-level escape hatch (role(secret) fields accept profile-line injection only); values written to the settings.yaml user layer are masked, so this card offers no editor. To override, edit the env file or inject at the profile row in cordis.patch.yml.',
62
+ 'The keys section in the schema is a line-level escape hatch (role(secret) fields accept profile-line injection only); values written to the settings user layer are masked, so this card offers no editor. To override, edit the env file or inject at the profile row in cordis.patch.yml.',
63
63
  reloadHint:
64
64
  'Changes apply hot (the next web_search call uses them); scriptPath / python need no restart.',
65
65
  } as const
package/src/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 配置单一事实源:cordis 行级 Config(组合默认值,patch 层可覆盖)与 settings
3
- * namespace(用户层 $DSH_HOME/settings.yaml,热生效)共用同一 schemastery schema。
3
+ * namespace(用户层=profile 行级覆盖层 cordis.patch.yml,热生效)共用同一 schemastery schema。
4
4
  *
5
5
  * 密钥主来源是 search-services skill 的 env 文件(envFile,默认
6
6
  * ~/.config/search-services/env),保持 skill 单事实源、零搬迁。行级 keys 仅为
@@ -50,7 +50,7 @@ const KeysSchema = z.object({
50
50
  .default(''),
51
51
  })
52
52
 
53
- // 0.1.7:全字段 `.volatile()`——条目进入 settings describe 视图(卡片可读写;
53
+ // 全字段 `.volatile()`——条目进入 settings describe 视图(卡片可读写;
54
54
  // keys 内 role('secret') 字段由 describe/write 层做密文遮蔽,用户层勿填),
55
55
  // loader 原位提交活动引用,current() 现取即热。
56
56
  export const Config = z.object({
@@ -91,7 +91,7 @@ export const Config = z.object({
91
91
  }).volatile(),
92
92
  })
93
93
 
94
- /** 活动字段形态(0.1.7 loader 解析产物:volatile 字段为活动引用)。 */
94
+ /** 活动字段形态(loader 解析产物:volatile 字段为活动引用)。 */
95
95
  export type WebSearchServicesConfigFields = Schemastery.TypeT<typeof Config>
96
96
  /** 平面配置形态(消费面的读取形态,由活动引用解包得到)。 */
97
97
  export type WebSearchServicesConfig = UnwrapVolatile<WebSearchServicesConfigFields>
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ export { Config, SETTINGS_NS } from './config.ts'
24
24
  export { PROVIDER_ID, SearchServicesProvider } from './provider.ts'
25
25
 
26
26
  // config 运行期为 loader 解析的 volatile 活动字段(用户层 override 并入行级
27
- // config,写入原位提交)——每次读现取平面快照,替代 0.1.6 installSection/setSource。
27
+ // config,写入原位提交)——每次读现取平面快照,替代已删除的 installSection/setSource。
28
28
  export function apply(
29
29
  ctx: Context,
30
30
  config: WebSearchServicesConfig | WebSearchServicesConfigFields,
package/src/ns.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * settings 命名空间字面量(纯常量,零依赖)。
3
- * 服务端以字面量注册 settings section(用户层配置落 $DSH_HOME/settings.yaml,
4
- * 热生效);与行级 cordis Config 共用同一份 schemastery schema(config.ts)。
3
+ * 服务端以字面量注册 settings section(用户层配置落 profile 行级覆盖层
4
+ * cordis.patch.yml,热生效);与行级 cordis Config 共用同一份 schema。
5
5
  * @module web-search-services/ns
6
6
  */
7
7
  export const SETTINGS_NS = 'dsh-plus-web-search-services'