dsh-model-extension 1.0.0 → 1.1.0-alpha.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # dsh-model-extension
2
2
  > 基于 deepseek-harness 的模型扩展插件
3
3
 
4
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![npm](https://img.shields.io/npm/v/dsh-model-extension.svg?label=npm&labelColor=000000&color=ff4b01)](https://www.npmjs.com/package/dsh-model-extension) [![DeepSeek Harness:0.1.2-rc.1](https://img.shields.io/badge/DeepSeek%20Harness-0.1.2--rc.1-success.svg?labelColor=4D6BFE)](https://github.com/deepseek-ai/deepseek-harness)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![npm](https://img.shields.io/npm/v/dsh-model-extension.svg?label=npm&labelColor=000000&color=ff4b01)](https://www.npmjs.com/package/dsh-model-extension) [![DeepSeek Harness:0.1.5-alpha.2](https://img.shields.io/badge/DeepSeek%20Harness-0.1.5--alpha.2-success.svg?labelColor=4D6BFE)](https://github.com/deepseek-ai/deepseek-harness)
5
5
 
6
6
  | 供应商 | 模型 |
7
7
  | --- | --- |
@@ -48,6 +48,9 @@ npm run build
48
48
 
49
49
  ## 版本历史
50
50
 
51
+ - **1.1.0**
52
+ - **1.1.0-alpha.1**
53
+ - 💪适配deepseek harness 0.1.5-alpha.2
51
54
  - **1.0.0**
52
55
  - 🔥重构[模型+]界面
53
56
  - 🔥新增models.json元数据自动预填
package/lib/client.js CHANGED
@@ -37,7 +37,8 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
37
37
  settingsNs: entry.settingsNs,
38
38
  settingsPath: [...entry.settingsPath],
39
39
  active: active.has(entry.provider),
40
- ...entry.declared === void 0 ? {} : { declared: entry.declared }
40
+ ...entry.declared === void 0 ? {} : { declared: entry.declared },
41
+ ...entry.error === void 0 ? {} : { error: entry.error }
41
42
  }));
42
43
  for (const provider of registered) {
43
44
  if (declared.has(provider.id)) continue;
@@ -577,6 +578,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
577
578
  customApi: "API protocol",
578
579
  customApiUnset: "Not selected",
579
580
  customNeedsBaseUrl: "A custom provider needs a base URL.",
581
+ customBaseUrlInvalid: "Enter a valid HTTP or HTTPS URL.",
580
582
  customNeedsModels: "A custom provider needs at least one model.",
581
583
  customBaseUrlPlaceholder: "https://gateway.example/v1",
582
584
  settingsPathUnresolvable: "unresolvable settings path",
@@ -688,6 +690,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
688
690
  customApi: "API 协议",
689
691
  customApiUnset: "未选择",
690
692
  customNeedsBaseUrl: "自定义提供方需要 API 地址。",
693
+ customBaseUrlInvalid: "请输入有效的 HTTP 或 HTTPS 地址。",
691
694
  customNeedsModels: "自定义提供方至少需要一个模型。",
692
695
  customBaseUrlPlaceholder: "https://gateway.example/v1",
693
696
  settingsPathUnresolvable: "无法解析设置路径",
@@ -2336,7 +2339,8 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
2336
2339
  };
2337
2340
  const anyUsable = state.rows.some(providerUsable);
2338
2341
  const configured = state.rows.filter((row) => row.configured);
2339
- const addable = state.rows.filter((row) => !row.configured && row.entry.settingsNs !== "");
2342
+ const configurable = state.rows.filter((row) => state.namespaces.has(row.entry.settingsNs));
2343
+ const addable = configurable.filter((row) => !row.configured);
2340
2344
  const addTarget = adding ? editing : void 0;
2341
2345
  const addNamespace = addTarget === void 0 ? void 0 : state.namespaces.get(addTarget.settingsNs);
2342
2346
  const protocols = (() => {
@@ -2398,71 +2402,80 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
2398
2402
  const target = targetOf(row);
2399
2403
  const namespace = state.namespaces.get(target.settingsNs);
2400
2404
  if (namespace === void 0) return null;
2401
- if (needsSetup(row, anyUsable) && !dismissedSetup.has(row.entry.provider)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
2405
+ const error = row.entry.error === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2406
+ role: "alert",
2407
+ className: models_plus_module_default["error"],
2408
+ children: row.entry.error
2409
+ });
2410
+ if (needsSetup(row, anyUsable) && !dismissedSetup.has(row.entry.provider)) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2402
2411
  className: models_plus_module_default["rowCard"],
2403
- children: renderEditor(target, namespace, (changed) => {
2412
+ children: [error, renderEditor(target, namespace, (changed) => {
2404
2413
  closeSetup(changed, target);
2405
- })
2414
+ })]
2406
2415
  }, row.entry.provider);
2407
2416
  const open = !adding && !declaring && editing?.provider === row.entry.provider;
2408
2417
  const credentialConfigured = row.credential?.configured === true;
2409
2418
  const credentialMissing = !credentialConfigured && row.apiKeyEnv !== void 0 && row.credential?.configured === false;
2410
2419
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2411
2420
  className: models_plus_module_default["rowCard"],
2412
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2413
- className: models_plus_module_default["rowHead"],
2414
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2415
- className: models_plus_module_default["rowIdentity"],
2416
- children: [
2417
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2418
- className: models_plus_module_default["rowName"],
2419
- children: row.entry.displayName
2420
- }),
2421
- row.entry.declared === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2422
- className: models_plus_module_default["rowTag"],
2423
- children: "自定义"
2424
- }) : null,
2425
- credentialConfigured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2426
- className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotConfigured"]}`,
2427
- role: "img",
2428
- "aria-label": "API 密钥已配置",
2429
- title: "API 密钥已配置"
2430
- }) : credentialMissing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2431
- className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotMissing"]}`,
2432
- role: "img",
2433
- "aria-label": "API 密钥缺失",
2434
- title: "API 密钥缺失"
2435
- }) : null
2436
- ]
2437
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2438
- className: models_plus_module_default["rowActions"],
2439
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2440
- type: "button",
2441
- className: models_plus_module_default["secondaryButton"],
2442
- "aria-label": providerCopy("编辑 {provider}", target),
2443
- onClick: () => {
2444
- setSavedTarget(void 0);
2445
- setDeclaring(false);
2446
- setAdding(false);
2447
- setEditing(open ? void 0 : target);
2448
- },
2449
- children: "编辑"
2450
- }), row.removable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2451
- type: "button",
2452
- className: models_plus_module_default["dangerButton"],
2453
- "aria-label": providerCopy("删除 {provider}", target),
2454
- disabled: !state.writable,
2455
- onClick: () => {
2456
- setSavedTarget(void 0);
2457
- setDeleteFailure(void 0);
2458
- setDeleteTarget(target);
2459
- },
2460
- children: "删除"
2461
- }) : null]
2462
- })]
2463
- }), open ? renderEditor(target, namespace, (changed) => {
2464
- closeEditor(changed, target);
2465
- }) : null]
2421
+ children: [
2422
+ error,
2423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2424
+ className: models_plus_module_default["rowHead"],
2425
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2426
+ className: models_plus_module_default["rowIdentity"],
2427
+ children: [
2428
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2429
+ className: models_plus_module_default["rowName"],
2430
+ children: row.entry.displayName
2431
+ }),
2432
+ row.entry.declared === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2433
+ className: models_plus_module_default["rowTag"],
2434
+ children: "自定义"
2435
+ }) : null,
2436
+ credentialConfigured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2437
+ className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotConfigured"]}`,
2438
+ role: "img",
2439
+ "aria-label": "API 密钥已配置",
2440
+ title: "API 密钥已配置"
2441
+ }) : credentialMissing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2442
+ className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotMissing"]}`,
2443
+ role: "img",
2444
+ "aria-label": "API 密钥缺失",
2445
+ title: "API 密钥缺失"
2446
+ }) : null
2447
+ ]
2448
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2449
+ className: models_plus_module_default["rowActions"],
2450
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2451
+ type: "button",
2452
+ className: models_plus_module_default["secondaryButton"],
2453
+ "aria-label": providerCopy("编辑 {provider}", target),
2454
+ onClick: () => {
2455
+ setSavedTarget(void 0);
2456
+ setDeclaring(false);
2457
+ setAdding(false);
2458
+ setEditing(open ? void 0 : target);
2459
+ },
2460
+ children: "编辑"
2461
+ }), row.removable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2462
+ type: "button",
2463
+ className: models_plus_module_default["dangerButton"],
2464
+ "aria-label": providerCopy("删除 {provider}", target),
2465
+ disabled: !state.writable,
2466
+ onClick: () => {
2467
+ setSavedTarget(void 0);
2468
+ setDeleteFailure(void 0);
2469
+ setDeleteTarget(target);
2470
+ },
2471
+ children: "删除"
2472
+ }) : null]
2473
+ })]
2474
+ }),
2475
+ open ? renderEditor(target, namespace, (changed) => {
2476
+ closeEditor(changed, target);
2477
+ }) : null
2478
+ ]
2466
2479
  }, row.entry.provider);
2467
2480
  })
2468
2481
  }),
@@ -2516,7 +2529,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
2516
2529
  })
2517
2530
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2518
2531
  className: models_plus_module_default["addActions"],
2519
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2532
+ children: [configurable.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2520
2533
  type: "button",
2521
2534
  className: models_plus_module_default["addButton"],
2522
2535
  disabled: addable.length === 0 || !state.writable,
@@ -2541,7 +2554,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
2541
2554
  strokeLinecap: "round"
2542
2555
  })
2543
2556
  }), "添加提供方"]
2544
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2557
+ }), state.namespaces.has("llm-pi-ai") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2545
2558
  type: "button",
2546
2559
  className: models_plus_module_default["addButton"],
2547
2560
  disabled: protocols.length === 0 || !state.writable,
@@ -2686,7 +2699,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
2686
2699
  //#region src/client/index-extension.ts
2687
2700
  /** Cordis service name (distinct from the npm package name). */
2688
2701
  const name = "model-extension-client";
2689
- /** Required services — mirrors the upstream Models section registration @ 0.1.2-rc.1. */
2702
+ /** Required services — mirrors the upstream Models section registration @ 0.1.5-alpha.2. */
2690
2703
  const inject = [
2691
2704
  "slots",
2692
2705
  "locale",