@nemesis-oss/ollama-sdk 1.23.0 → 1.24.0

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,6 +1,41 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## [1.24.0] — vision resolution trust boundaries; release-pipeline and CI hardening
4
+
5
+ ### Fixed — release workflow security
6
+
7
+ - **`publish.yml` no longer interpolates the `tag` workflow input into the shell command.** The dist-tag now reaches the publish step as an environment variable (`NPM_DIST_TAG`) and is validated against `^[a-zA-Z0-9][a-zA-Z0-9._-]*$` before `npm publish` runs; the manual-dispatch input is additionally restricted to the supported set (`latest`, `next`, `beta`). The previous form — `--tag ${{ inputs.tag || 'latest' }}` — was a command-injection pattern: shell metacharacters supplied in the input would execute as part of a step that holds `NODE_AUTH_TOKEN`. An env-var assignment is inert data, never shell source.
8
+
9
+ ### Added — vision resolution trust boundaries and resource limits ([ADR 0041](./docs/adr/0041-vision-resolution-trust-boundaries.md))
10
+
11
+ - **`OllamaClientConfig.imageResolution` (`ImageResolutionPolicy`, newly exported)** governs every resolution path for polymorphic `images` entries — `http(s)` URL fetches, data URIs, and local file paths. `resolveImageInput`/`resolveImages` accept it as an optional third argument (backward-compatible).
12
+ - **Remote image fetches now use the client's configured `fetch`** (or an explicit `imageResolution.fetchImpl`), so proxies, agents, and mocks installed via `config.fetch` apply to image resolution too.
13
+ - **Resource limits:** `maxImageBytes` (default 50 MiB) is enforced *while streaming* remote bodies — the download is cancelled at the cap, not buffered first — and via `stat` for local file reads; `fetchTimeoutMs` (default 30 s) covers the whole fetch; `maxRedirects` (default 5). Direct `Uint8Array`/`Buffer` inputs are deliberately not capped (the caller already holds the bytes).
14
+ - **SSRF guard on by default** (`image_private_address_blocked`): loopback/private/CGNAT/link-local/metadata/TEST-NET/multicast IPv4 and IPv6 ranges, `localhost`/`.local`/`.internal` hostnames, and hostnames that *resolve* to a private address (via `node:dns`, injectable through `addressLookup`) are refused — **including every redirect hop** (followed manually on Node so each `Location` target is re-validated: protocol, host allowlist, private-address guard). `allowedImageHosts` (exact / `*.wildcard` / `'*'`) adds an explicit allowlist; `allowPrivateNetworkAccess: true` is the documented opt-out for genuinely internal image hosts.
15
+ - **Local reads are an explicit capability:** `allowLocalFileReads` (default `true`, the historical behavior) can disable filesystem reads entirely for untrusted input.
16
+ - New error codes: `image_too_large`, `image_fetch_timeout`, `image_redirect_limit`, `image_host_not_allowed`, `image_private_address_blocked`, `image_unsupported_protocol`, `vision_local_reads_disabled`, `vision_path_read_failed`, `image_fetch_unavailable`; caller-signal aborts surface as `OllamaAbortError`. 58 hermetic tests cover every code and address class.
17
+
18
+ ### Changed — vision resolution behavior (security defaults)
19
+
20
+ - **Failed local file reads throw `vision_path_read_failed`** with the underlying `cause`, instead of silently passing the raw path string through to the server (which could only reject it as invalid base64 — an extension-matched string can never *be* valid base64, the alphabet has no `.`).
21
+ - Data-URI payloads over `maxImageBytes` throw `image_too_large`.
22
+ - Remote fetches of non-literal hostnames perform one DNS lookup on Node before connecting (negligible next to the fetch itself; injectable when it matters).
23
+
24
+ ### Added — CI quality and security scanning (2026-10-27 audit, P2)
25
+
26
+ - **The CI test matrix is Node 22 + 24** (maintenance LTS + active LTS). Node 20 reached end-of-life on 2026-04-30; `engines` keeps `>=20` for consumers, but nothing below 22 is CI-verified anymore.
27
+ - **Coverage thresholds are enforced** — a dedicated CI job runs `npm run test:coverage` on Node 22 and fails below statements 85 / branches 75 / functions 85 / lines 87 (measured baseline: 87.7 / 78.6 / 87.1 / 89.2). Coverage regressions now fail CI instead of drifting silently.
28
+ - **Dependabot** watches npm dependencies (root and docs-site) and GitHub Actions versions weekly. Its PRs title themselves `chore(deps...)`, so they pass the Conventional-Commit title check and never cut releases (ADR 0040).
29
+ - **CodeQL** static analysis on pushes to main, PRs, and weekly — complementing the behavior (unit/contract/conformance) and secret (GitGuardian) gates with vulnerability classes only static analysis sees.
30
+
31
+ ### Fixed — dependency security
32
+
33
+ - **zod development dependency bumped to `^4.6.6`** (lockfile was at 4.4.3): HIGH severity [GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5) — "Zod can exhaust memory while validating oversized constrained collections", fixed in 4.6.6. The peer range stays `^3.22.0 || ^4.0.0` (ADR 0003 dual-support contract); consumers providing their own zod should also move to a patched version. `npm audit fix` additionally cleared the transitive `source-map-js` and `vite` advisories (dev tooling) — 9 findings → 6 moderate, 0 high.
34
+
35
+ ### Docs — API entry-point guarantees
36
+
37
+ - `docs-site/api/native-api.md` now states explicitly what a standalone `HttpClient` + `OllamaRuntime` construction does **not** acquire (failover, shared retry/backoff/timeout, middleware, telemetry, endpoint credentials, `images` resolution) and when to prefer `client.native` / `client.runtime`.
38
+
4
39
 
5
40
  ## [1.23.0] — weekly upstream drift watch; automated versioning with release-please
6
41
 
@@ -1,4 +1,4 @@
1
- import { O as OllamaRuntime, H as HttpClient, A as AbortableAsyncIterable, ai as SseEvent, z as OllamaClientError } from './runtime-DPSrPwAa.js';
1
+ import { O as OllamaRuntime, H as HttpClient, A as AbortableAsyncIterable, ai as SseEvent, z as OllamaClientError } from './runtime-D_rMXIVT.js';
2
2
 
3
3
  /**
4
4
  * AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.
@@ -1,4 +1,4 @@
1
- import { O as OllamaRuntime, H as HttpClient, A as AbortableAsyncIterable, ai as SseEvent, z as OllamaClientError } from './runtime-CpO3H6yy.cjs';
1
+ import { O as OllamaRuntime, H as HttpClient, A as AbortableAsyncIterable, ai as SseEvent, z as OllamaClientError } from './runtime-CUzw4GAE.cjs';
2
2
 
3
3
  /**
4
4
  * AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.
@@ -1,4 +1,4 @@
1
- import { l as ToolDefinition, i as ToolCall, n as Message } from './types-CnsZ24tm.cjs';
1
+ import { l as ToolDefinition, i as ToolCall, n as Message } from './types-CH3pdrak.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { l as ToolDefinition, i as ToolCall, n as Message } from './types-CnsZ24tm.js';
1
+ import { l as ToolDefinition, i as ToolCall, n as Message } from './types-CH3pdrak.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -1,8 +1,8 @@
1
- import { O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, b as OpenAIChatCompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, e as OpenAICompletionChunk, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, h as OpenAIListModelsResponse, i as OpenAIModelItem, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, l as OpenAIResponsesStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, n as AnthropicMessageStreamEvent } from './anthropic-D8qPCPIr.cjs';
2
- export { N as NativeApi } from './anthropic-D8qPCPIr.cjs';
3
- import { O as OllamaRuntime } from './runtime-CpO3H6yy.cjs';
4
- export { a as OperationDefinition } from './runtime-CpO3H6yy.cjs';
5
- import './types-CnsZ24tm.cjs';
1
+ import { O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, b as OpenAIChatCompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, e as OpenAICompletionChunk, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, h as OpenAIListModelsResponse, i as OpenAIModelItem, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, l as OpenAIResponsesStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, n as AnthropicMessageStreamEvent } from './anthropic-Dfa6TV9C.cjs';
2
+ export { N as NativeApi } from './anthropic-Dfa6TV9C.cjs';
3
+ import { O as OllamaRuntime } from './runtime-CUzw4GAE.cjs';
4
+ export { a as OperationDefinition } from './runtime-CUzw4GAE.cjs';
5
+ import './types-CH3pdrak.cjs';
6
6
  import 'zod';
7
7
 
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, b as OpenAIChatCompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, e as OpenAICompletionChunk, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, h as OpenAIListModelsResponse, i as OpenAIModelItem, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, l as OpenAIResponsesStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, n as AnthropicMessageStreamEvent } from './anthropic-DjdkzlIn.js';
2
- export { N as NativeApi } from './anthropic-DjdkzlIn.js';
3
- import { O as OllamaRuntime } from './runtime-DPSrPwAa.js';
4
- export { a as OperationDefinition } from './runtime-DPSrPwAa.js';
5
- import './types-CnsZ24tm.js';
1
+ import { O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, b as OpenAIChatCompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, e as OpenAICompletionChunk, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, h as OpenAIListModelsResponse, i as OpenAIModelItem, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, l as OpenAIResponsesStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, n as AnthropicMessageStreamEvent } from './anthropic-Czz0OKH-.js';
2
+ export { N as NativeApi } from './anthropic-Czz0OKH-.js';
3
+ import { O as OllamaRuntime } from './runtime-D_rMXIVT.js';
4
+ export { a as OperationDefinition } from './runtime-D_rMXIVT.js';
5
+ import './types-CH3pdrak.js';
6
6
  import 'zod';
7
7
 
8
8
  /**