dsh-gateway-provider 1.0.7 → 1.0.9

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
@@ -131,11 +131,10 @@ the bridge is lifted from the official `dsh-llm-pi-ai` adapter.
131
131
  ```sh
132
132
  git clone https://github.com/Luck9Star/dsh-gateway-provider
133
133
  cd dsh-gateway-provider
134
- pnpm install # installs the plugin-pinned pi-ai copy (direct dependency)
135
- pnpm run link # symlink @deepseek-ai/* into your dsh profile (single instanceof safety)
136
- npm run test:client # settings-UI render, both locales
137
- npm run test:urls # URL/derivation units
138
- npm run smoke # live gateway round-trip (needs a real key)
134
+ pnpm install # pi-ai (pinned) + @deepseek-ai/* profile symlinks, via the prepare hook
135
+ pnpm run test:client # settings-UI render, both locales
136
+ pnpm run test:urls # URL/derivation units
137
+ pnpm run smoke # live gateway round-trip (needs a real key)
139
138
  ```
140
139
 
141
140
  ### Why the plugin pins its own pi-ai
package/docs/README.zh.md CHANGED
@@ -91,11 +91,10 @@ dsh --profile web
91
91
  ```sh
92
92
  git clone https://github.com/Luck9Star/dsh-gateway-provider
93
93
  cd dsh-gateway-provider
94
- pnpm install # 安装插件自带的 pi-ai 固定副本(直接依赖)
95
- pnpm run link # @deepseek-ai/* 软链进 dsh profile(保证单实例)
96
- npm run test:client # 设置页渲染测试,双语言
97
- npm run test:urls # URL 派生单元测试
98
- npm run smoke # 真实网关往返(需要真 key)
94
+ pnpm install # 一条命令搞定:pi-ai 固定副本 + @deepseek-ai/* 软链(prepare 钩子自动执行)
95
+ pnpm run test:client # 设置页渲染测试,双语言
96
+ pnpm run test:urls # URL 派生单元测试
97
+ pnpm run smoke # 真实网关往返(需要真 key)
99
98
  ```
100
99
 
101
100
  ### 为什么插件自带 pi-ai
package/index.js CHANGED
@@ -31,7 +31,6 @@ import z from "@deepseek-ai/schemastery";
31
31
  import { LlmError, RetryPolicySchema, assertUsableApiKey, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
32
32
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
33
33
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
34
- import { deepEqualJson, installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
35
34
  import { MAX_TIMER_DELAY_MS } from "@deepseek-ai/dsh-timeout";
36
35
  import { NewapiAdapter } from "./lib/adapter.js";
37
36
  import { DEFAULT_EXCLUDE_PATTERNS, DEFAULT_MAX_TOKENS, DEFAULT_CONTEXT_WINDOW } from "./lib/catalog.js";
@@ -41,7 +40,7 @@ export const name = "llm-newapi";
41
40
  export const inject = ["llm"];
42
41
 
43
42
  /** User-settings namespace whose section overrides this entry. */
44
- const NS = settingsNamespace("llm-newapi");
43
+ const NS = "llm-newapi";
45
44
  /** The legacy single provider route (kept for backwards compatibility). */
46
45
  export const PROVIDER = "newapi";
47
46
  /** Prefix for additional gateway routes. */
@@ -373,7 +372,7 @@ export function apply(ctx, config) {
373
372
  // Include the per-protocol bases: URL-addressed (custom) gateways may
374
373
  // share an empty plain baseURL, and URL-only edits must re-register.
375
374
  const facts = gateways.map((g) => `${g.provider}:${g.connection.baseURL}:${g.label}:${g.connection.apiBases ? JSON.stringify(g.connection.apiBases) : ""}`);
376
- if (deepEqualJson(facts, directoryFacts)) return;
375
+ if (directoryFacts !== undefined && JSON.stringify(facts) === JSON.stringify(directoryFacts)) return;
377
376
  const entries = gateways.map((g, i) => ({
378
377
  provider: g.provider,
379
378
  displayName: g.label,
@@ -413,10 +412,12 @@ export function apply(ctx, config) {
413
412
  }
414
413
  });
415
414
 
416
- installSettingsSection(ctx, NS, Config, config, {
417
- setSource: (source) => {
418
- current = source;
419
- },
420
- onChange: ensureRegistration,
415
+ ctx.inject(["settings"], (settingsCtx) => {
416
+ settingsCtx.settings.installSection(ctx, NS, Config, config, {
417
+ setSource: (source) => {
418
+ current = source;
419
+ },
420
+ onChange: ensureRegistration,
421
+ });
421
422
  });
422
423
  }
package/lib/pi-bridge.js CHANGED
@@ -17,10 +17,10 @@
17
17
 
18
18
  import {
19
19
  CONTEXT_WINDOW_EXCEEDED_CODE,
20
- CallId,
21
20
  EMPTY_RESPONSE_CODE,
22
21
  LlmError,
23
22
  QUOTA_EXCEEDED_CODE,
23
+ ToolCallId,
24
24
  attributionHeaders,
25
25
  contentHasImage,
26
26
  isContextWindowExceededError,
@@ -275,7 +275,7 @@ function textOnlyContext(options) {
275
275
  }
276
276
  if (message.role === "assistant") {
277
277
  const assistant = toPiAssistant(message);
278
- for (const block of assistant.content) if (block.type === "toolCall") toolNames.set(CallId(block.id), block.name);
278
+ for (const block of assistant.content) if (block.type === "toolCall") toolNames.set(ToolCallId(block.id), block.name);
279
279
  messages.push(assistant);
280
280
  continue;
281
281
  }
@@ -306,7 +306,7 @@ async function toPiContextWithImages(options, attachments) {
306
306
  }
307
307
  if (message.role === "assistant") {
308
308
  const assistant = toPiAssistant(message);
309
- for (const block of assistant.content) if (block.type === "toolCall") toolNames.set(CallId(block.id), block.name);
309
+ for (const block of assistant.content) if (block.type === "toolCall") toolNames.set(ToolCallId(block.id), block.name);
310
310
  messages.push(assistant);
311
311
  continue;
312
312
  }
@@ -455,7 +455,7 @@ export async function* toStreamChunks(events, contextWindow) {
455
455
  yield {
456
456
  type: "tool-call-delta",
457
457
  index: event.contentIndex,
458
- id: CallId(known?.id ?? ""),
458
+ id: ToolCallId(known?.id ?? ""),
459
459
  ...known?.name !== void 0 && known.name.length > 0 ? { name: known.name } : {},
460
460
  argumentsDelta: event.delta,
461
461
  };
@@ -467,7 +467,7 @@ export async function* toStreamChunks(events, contextWindow) {
467
467
  index: event.contentIndex,
468
468
  block: {
469
469
  type: "tool-call",
470
- id: CallId(event.toolCall.id),
470
+ id: ToolCallId(event.toolCall.id),
471
471
  name: event.toolCall.name,
472
472
  arguments: JSON.stringify(event.toolCall.arguments),
473
473
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gateway-provider",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Generic LLM gateway model provider plugin for DeepSeek Harness: mounts newapi / LiteLLM / Higress / any OpenAI-compatible gateway as provider routes, auto-discovers the model list, enriches every model with models.dev parameters, and dispatches each model over its native wire protocol (OpenAI / Anthropic / Gemini) via the pi-ai SDK",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,6 +24,7 @@
24
24
  "docs"
25
25
  ],
26
26
  "scripts": {
27
+ "prepare": "bash scripts/link.sh",
27
28
  "link": "bash scripts/link.sh",
28
29
  "smoke": "node test/smoke.mjs",
29
30
  "test:session": "node test/session-affinity.mjs",
@@ -65,12 +66,11 @@
65
66
  "@earendil-works/pi-ai": "0.84.4"
66
67
  },
67
68
  "peerDependencies": {
68
- "@deepseek-ai/cordis": "^4.0.1",
69
- "@deepseek-ai/dsh-credentials": "^0.1.0-rc.7",
70
- "@deepseek-ai/dsh-launch-environment": "^0.1.0-rc.7",
71
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
72
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.7",
73
- "@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
69
+ "@deepseek-ai/cordis": "^4.0.2",
70
+ "@deepseek-ai/dsh-credentials": "^0.1.2-rc.1",
71
+ "@deepseek-ai/dsh-launch-environment": "^0.1.2-rc.1",
72
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
73
+ "@deepseek-ai/dsh-timeout": "^0.1.2-rc.1",
74
74
  "@deepseek-ai/schemastery": "^3.18.1"
75
75
  }
76
76
  }