@mupt-ai/dari-gateway 1.0.301 → 1.0.302

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.
@@ -197,7 +197,7 @@ export function buildModel(pi, modelId, pricing, config) {
197
197
  throw new HttpError(502, `No base URL is configured for provider ${provider}.`, "provider_configuration_error");
198
198
  }
199
199
  const contextWindow = contextWindowForModel(modelId, registered, config) ?? 128000;
200
- const compat = responsesToolContract(api, runtimeCompat(provider, registered, modelId));
200
+ const compat = gatewayRuntimeCompat(api, runtimeCompat(provider, registered, modelId));
201
201
  return {
202
202
  ...(registered ?? {}),
203
203
  ...(compat !== undefined ? { compat } : {}),
@@ -273,7 +273,13 @@ function contextWindowForModel(modelId, registered, config) {
273
273
  // `tools` field, when a model supports mid-conversation system messages. The gateway
274
274
  // keeps tools at the request level until that native tool-change path is validated.
275
275
  const RESPONSES_APIS = new Set(["openai-responses", "azure-openai-responses", "openai-codex-responses"]);
276
- function responsesToolContract(api, compat) {
276
+ function gatewayRuntimeCompat(api, compat) {
277
+ // Pi 1.5 enables server-side message threads whenever sessionId is set.
278
+ // Gateway sessions serve affinity, not permission to retain a conversation
279
+ // remotely; keep full-history requests, including on ZDR routes.
280
+ if (api === "anthropic-messages") {
281
+ return { ...(isRecord(compat) ? compat : {}), supportsMessageThreads: false };
282
+ }
277
283
  if (typeof api !== "string" || !RESPONSES_APIS.has(api))
278
284
  return compat;
279
285
  if (!isRecord(compat) || compat.supportsMidConvoSystemMessages !== true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mupt-ai/dari-gateway",
3
- "version": "1.0.301",
3
+ "version": "1.0.302",
4
4
  "description": "Self-hostable LLM gateway for coding agents and APIs: one endpoint for Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses, with subscription pooling, failover, and prompt-cache-aware routing.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@aws-sdk/client-sts": "3.1063.0",
54
- "@mupt-ai/dari-router": "1.0.301",
55
- "@mupt-ai/pi-ai": "1.4.0-mupt.3"
54
+ "@mupt-ai/dari-router": "1.0.302",
55
+ "@mupt-ai/pi-ai": "1.5.2-mupt.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/bun": "^1.3.4",
@@ -364,7 +364,7 @@ export function buildModel(
364
364
  throw new HttpError(502, `No base URL is configured for provider ${provider}.`, "provider_configuration_error");
365
365
  }
366
366
  const contextWindow = contextWindowForModel(modelId, registered, config) ?? 128000;
367
- const compat = responsesToolContract(api, runtimeCompat(provider, registered, modelId));
367
+ const compat = gatewayRuntimeCompat(api, runtimeCompat(provider, registered, modelId));
368
368
  return {
369
369
  ...(registered ?? {}),
370
370
  ...(compat !== undefined ? { compat } : {}),
@@ -460,7 +460,13 @@ function contextWindowForModel(
460
460
  // keeps tools at the request level until that native tool-change path is validated.
461
461
  const RESPONSES_APIS: ReadonlySet<string> = new Set(["openai-responses", "azure-openai-responses", "openai-codex-responses"]);
462
462
 
463
- function responsesToolContract(api: unknown, compat: unknown): unknown {
463
+ function gatewayRuntimeCompat(api: unknown, compat: unknown): unknown {
464
+ // Pi 1.5 enables server-side message threads whenever sessionId is set.
465
+ // Gateway sessions serve affinity, not permission to retain a conversation
466
+ // remotely; keep full-history requests, including on ZDR routes.
467
+ if (api === "anthropic-messages") {
468
+ return { ...(isRecord(compat) ? compat : {}), supportsMessageThreads: false };
469
+ }
464
470
  if (typeof api !== "string" || !RESPONSES_APIS.has(api)) return compat;
465
471
  if (!isRecord(compat) || compat.supportsMidConvoSystemMessages !== true) return compat;
466
472
  return { ...compat, supportsMidConvoSystemMessages: false };