@goodandready/dsh-ollama-cloud-provider 0.1.36 → 0.1.37

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.37 — 2026-11-11
4
+
5
+ - Session Integrity & Tool Calls: eliminated tool-call ID collisions across multiple steps and turns by minting globally unique UUID-based identifiers (`call_${randomUUID()}`) whenever Ollama Cloud omits `id` or returns an empty string, across both native and OpenAI-compatible transports (`src/transports/tool-call-id.ts`, `native.ts`, `openai-chat.ts`). Preserves upstream `call.id` when supplied by Ollama. Prevents session log corruption (`SessionFormatError: PTC dispatch repeats subCallId`) that previously caused multi-step conversations to silently disappear on DSH startup (GitHub #2, Gitea #125).
6
+
3
7
  ## 0.1.36 — 2026-11-09
4
8
 
5
9
  - Resilience: shortened 401/403 credential rejection cooldown from 24 hours to 5 minutes, added explicit reset endpoint (`POST /dsh-ollama/cooldowns/reset`) and "Reset cooldowns" UI action in settings page, and surfaced exact remaining wait time and root cause (`INVALID_CREDENTIAL`, `QUOTA`, `RATE_LIMIT`) when all keys are cooling (#117).
package/README.md CHANGED
@@ -93,6 +93,7 @@ graph LR
93
93
 
94
94
  - **Two wire transports** chosen per model: the native Ollama API (NDJSON) and the OpenAI-compatible gateway (SSE).
95
95
  - **Text, thinking, tool calls, images, usage and finish reasons** on both transports.
96
+ - **Unique tool-call IDs** minted across steps and turns, preventing session log collisions when upstream omits an id.
96
97
  - **Live catalog** from `GET /v1/models`, enriched with capability flags from `GET /api/tags`.
97
98
  - **Accurate limits** for the dsh picker: context window, input modalities, reasoning levels and their default, tool support, and API visibility.
98
99
  - **Balance and usage** from the official `/api/balance` and `/api/usage` endpoints: included credits, purchased credits, 24-hour / 7-day / 30-day spend, and spend by model.
package/README.ru.md CHANGED
@@ -76,6 +76,7 @@ graph LR
76
76
 
77
77
  - **Два транспорта**, выбираемые индивидуально для каждой модели: нативный протокол Ollama API (NDJSON) и совместимый шлюз OpenAI (SSE).
78
78
  - **Поддержка всех режимов**: текст, reasoning/thinking, вызовы функций/инструментов, изображения (vision), подсчёт токенов и finish reasons на обоих транспортах.
79
+ - **Уникальные идентификаторы вызовов инструментов**: генерация глобально уникальных ID для каждого шага исключает коллизии в мультишаговых сессиях агентов и защищает журнал сессий DSH от повреждения.
79
80
  - **Живой каталог моделей**: автоматическое чтение `GET /v1/models`, дополненное флагами возможностей `capabilities` (`tools`, `thinking`, `vision`) из `GET /api/tags`.
80
81
  - **Точные лимиты и метаданные**: контекстное окно, входные модальности, уровни reasoning и значение по умолчанию, статус поддержки инструментов и видимость в API.
81
82
  - **Баланс и аналитика расхода**: интеграция с официальными облачными эндпоинтами `/api/balance` и `/api/usage` — включённые и купленные кредиты, расход за 24 часа / 7 дней / 30 дней, а также группировка по моделям.
package/README.zh.md CHANGED
@@ -76,6 +76,7 @@ graph LR
76
76
 
77
77
  - **两种底层传输协议**:按模型选择 Ollama 原生协议(NDJSON)或 OpenAI 兼容协议(SSE)。
78
78
  - **全要素流式交互**:文本、深度思考(thinking)、工具调用、多模态图像、Token 统计与 finish reasons。
79
+ - **全局唯一工具调用 ID**:自动生成跨步不重复的工具调用标识符,彻底防止多步对话(如 PTC 预设)因 ID 冲突导致 DSH 会话日志校验失败。
79
80
  - **实时模型目录**:自动从 `GET /v1/models` 获取模型列表,并结合 `GET /api/tags` 补全能力标记(`tools`、`thinking`、`vision`)。
80
81
  - **精准模型元数据**:上下文长度、输入模态、推理等级与默认配置、工具支持状态及 API 开放性。
81
82
  - **官方余额与用量分析**:集成官方 `/api/balance` 与 `/api/usage`,呈现可用额度、已购额度、24小时/7天/30天支出及按模型细分报表。
package/lib/index.js CHANGED
@@ -2276,6 +2276,18 @@ async function* ndjsonObjects(body, idleTimeoutMs, signal) {
2276
2276
  reader.releaseLock();
2277
2277
  }
2278
2278
  }
2279
+ // src/transports/tool-call-id.ts
2280
+ /**
2281
+ * Ensures tool-call ids are globally unique across steps and turns in a session.
2282
+ * Reusing ids breaks DSH session log validation with "PTC dispatch repeats subCallId".
2283
+ */
2284
+ function uniqueToolCallId(raw) {
2285
+ if (typeof raw === "string") {
2286
+ const trimmed = raw.trim();
2287
+ if (trimmed !== "") return ToolCallId(trimmed);
2288
+ }
2289
+ return ToolCallId(`call_${randomUUID()}`);
2290
+ }
2279
2291
  // src/transports/native.ts
2280
2292
  function count$1(value) {
2281
2293
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : void 0;
@@ -2360,7 +2372,7 @@ async function* parseNativeStream(response, idleTimeoutMs, signal) {
2360
2372
  const rawArguments = call.function?.arguments;
2361
2373
  const argumentsText = typeof rawArguments === "string" ? rawArguments : JSON.stringify(rawArguments ?? {});
2362
2374
  const index = nextIndex++;
2363
- const id = `call_${toolBlocks.length}`;
2375
+ const id = uniqueToolCallId(call.id);
2364
2376
  toolBlocks.push({
2365
2377
  index,
2366
2378
  id,
@@ -2376,7 +2388,7 @@ async function* parseNativeStream(response, idleTimeoutMs, signal) {
2376
2388
  yield {
2377
2389
  type: "tool-call-delta",
2378
2390
  index,
2379
- id: ToolCallId(id),
2391
+ id,
2380
2392
  ...name === "" ? {} : { name },
2381
2393
  argumentsDelta: argumentsText
2382
2394
  };
@@ -2582,14 +2594,14 @@ async function* parseChatStream(response, idleTimeoutMs, signal) {
2582
2594
  if (entry === void 0) {
2583
2595
  entry = {
2584
2596
  dshIndex: nextIndex++,
2585
- id: toolCall.id ?? `call_${key}`,
2597
+ id: uniqueToolCallId(toolCall.id),
2586
2598
  name: "",
2587
2599
  args: "",
2588
2600
  started: false
2589
2601
  };
2590
2602
  toolCalls.set(key, entry);
2591
2603
  }
2592
- if (toolCall.id !== void 0 && toolCall.id !== "") entry.id = toolCall.id;
2604
+ if (typeof toolCall.id === "string" && toolCall.id.trim() !== "") entry.id = ToolCallId(toolCall.id.trim());
2593
2605
  if (toolCall.function?.name !== void 0 && toolCall.function.name !== "") entry.name = toolCall.function.name;
2594
2606
  if (!entry.started) {
2595
2607
  entry.started = true;
@@ -2710,7 +2722,7 @@ async function* parseCompletion(chunk) {
2710
2722
  sawContent = true;
2711
2723
  }
2712
2724
  for (const call of message?.tool_calls ?? []) {
2713
- const id = ToolCallId(call.id ?? `call_${index}`);
2725
+ const id = uniqueToolCallId(call.id);
2714
2726
  const name = call.function?.name ?? "";
2715
2727
  const args = call.function?.arguments ?? "{}";
2716
2728
  yield {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-ollama-cloud-provider",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "build": "tsdown",
74
74
  "prepare": "tsdown 1>&2",
75
75
  "typecheck": "tsc --noEmit",
76
- "test": "node --import tsx --test --test-concurrency=1 tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx tests/host-verification.test.ts tests/ui-actions.test.tsx",
76
+ "test": "node --import tsx --test --test-concurrency=1 tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx tests/host-verification.test.ts tests/ui-actions.test.tsx tests/tool-call-id.test.ts",
77
77
  "check": "npm run typecheck && npm test && npm run build",
78
78
  "release": "npm run check && npm pack",
79
79
  "sync:models": "node scripts/sync-models.mjs"