dsh-gateway-provider 1.0.8 → 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/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.8",
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",
@@ -66,12 +66,11 @@
66
66
  "@earendil-works/pi-ai": "0.84.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "@deepseek-ai/cordis": "^4.0.1",
70
- "@deepseek-ai/dsh-credentials": "^0.1.0-rc.7",
71
- "@deepseek-ai/dsh-launch-environment": "^0.1.0-rc.7",
72
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
73
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.7",
74
- "@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",
75
74
  "@deepseek-ai/schemastery": "^3.18.1"
76
75
  }
77
76
  }