@nemesis-oss/ollama-sdk 1.22.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 +68 -0
- package/dist/{anthropic-DjdkzlIn.d.ts → anthropic-Czz0OKH-.d.ts} +1 -1
- package/dist/{anthropic-D8qPCPIr.d.cts → anthropic-Dfa6TV9C.d.cts} +1 -1
- package/dist/{compose-BXXgHmrS.d.cts → compose-Bjpsu3Y1.d.cts} +1 -1
- package/dist/{compose-DaG83yId.d.ts → compose-DxAQ2z26.d.ts} +1 -1
- package/dist/generated-api.d.cts +5 -5
- package/dist/generated-api.d.ts +5 -5
- package/dist/generated-runtime.cjs.map +1 -1
- package/dist/generated-runtime.d.cts +2 -2
- package/dist/generated-runtime.d.ts +2 -2
- package/dist/generated-runtime.js.map +1 -1
- package/dist/index.cjs +456 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -9
- package/dist/index.d.ts +25 -9
- package/dist/index.js +456 -104
- package/dist/index.js.map +1 -1
- package/dist/mcp-generated.d.cts +2 -2
- package/dist/mcp-generated.d.ts +2 -2
- package/dist/mcp-http.cjs.map +1 -1
- package/dist/mcp-http.js.map +1 -1
- package/dist/{runtime-CpO3H6yy.d.cts → runtime-CUzw4GAE.d.cts} +1 -1
- package/dist/{runtime-DPSrPwAa.d.ts → runtime-D_rMXIVT.d.ts} +1 -1
- package/dist/skills.d.cts +3 -3
- package/dist/skills.d.ts +3 -3
- package/dist/{types-CnsZ24tm.d.cts → types-CH3pdrak.d.cts} +124 -18
- package/dist/{types-CnsZ24tm.d.ts → types-CH3pdrak.d.ts} +124 -18
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
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
|
+
|
|
39
|
+
|
|
40
|
+
## [1.23.0] — weekly upstream drift watch; automated versioning with release-please
|
|
41
|
+
|
|
42
|
+
### Added: automated versioning with release-please ([ADR 0040](./docs/adr/0040-release-please-versioning.md))
|
|
43
|
+
|
|
44
|
+
- `.github/workflows/release-please.yml` keeps one release PR open with the next version, computed from Conventional Commit PR titles: `fix:` → patch, `feat:` → minor, `feat!:` → major. Merging that PR tags the version, creates the GitHub release, and calls `publish.yml`, which now accepts `workflow_call`.
|
|
45
|
+
- This changelog stays hand-written. Before merging a release PR, rename `## [Unreleased]` to the new version on its branch.
|
|
46
|
+
- `.github/workflows/pr-title.yml` rejects PR titles that aren't Conventional Commits.
|
|
47
|
+
- Upstream-watch PRs title themselves `feat(contract):` when `src/generated` changed and `chore(contract):` for a pin-only refresh.
|
|
48
|
+
|
|
49
|
+
### Added — weekly upstream drift watch (ADR 0039)
|
|
50
|
+
|
|
51
|
+
- **`npm run contract:upstream-drift` (`scripts/upstream-drift.ts`).** Compares each pinned docs source against the latest `ollama/ollama` commit touching its new `docs-index.json` `upstreamPath`, by commit ancestry through the GitHub compare API. Exits 1 on drift.
|
|
52
|
+
- The report also lists bridge-code commits under upstream `openai/` and `anthropic/` and the latest Ollama release. Both are informational.
|
|
53
|
+
- Its first live run found `675150d` ("voice: add voice catalog for Phonon"), an OpenAI-compatibility docs edit after the 1.22.0 pin.
|
|
54
|
+
- **`.github/workflows/upstream-watch.yml`** runs Mondays at 09:00 IST and on demand. On drift it:
|
|
55
|
+
- re-pins the drifted sources;
|
|
56
|
+
- regenerates and runs the contract gates;
|
|
57
|
+
- opens or updates the candidate PR on `upstream-sync/auto` and the single `upstream-drift` issue.
|
|
58
|
+
|
|
59
|
+
The PR is never auto-merged; a red gate in it means implementation work is due.
|
|
60
|
+
- **Re-pins keep the curated parts.**
|
|
61
|
+
- `contract:fetch` takes `--ref <sha>` and now writes the verbatim spec to `docs/upstream/ollama-openapi.yaml`.
|
|
62
|
+
- The contract source keeps its curated header (pin anchor rewritten, refresh note appended), and the body gets `CURATED_DEVIATIONS` (the `families: [array, null]` deviation) re-applied. A deviation that can neither be applied nor found adopted upstream throws.
|
|
63
|
+
- `refresh-mdx-pins.ts` reads its pins from `docs-index.json`, resolves each SHA from upstream, and takes `--only <ids>`.
|
|
64
|
+
- Both scripts update `pinnedSha`/`pinnedAt` in `docs-index.json`.
|
|
65
|
+
- 9 new tests in `test/contract/upstream-drift.test.ts`.
|
|
66
|
+
|
|
67
|
+
### Fixed — structural guard against rebase artifacts
|
|
68
|
+
|
|
69
|
+
- **New `test/repo-hygiene.test.ts` fails the suite on any unresolved conflict marker in any tracked file.** The v1.22.0 PR head had shipped a green eight-check CI run carrying a stray rebase marker at `CHANGELOG.md:23` — caught only by pre-tag manual review and dropped in the `ac9a385` amendment. The changelog was (and is) neither linted nor imported by tests, so no existing gate could see it; this test scans every file `git ls-files` reports for the four conflict-marker line shapes (`<<<<<<<`, `=======` as a whole line, `|||||||`, `>>>>>>>`) and runs everywhere `npm test` runs — PR CI, the publish workflow's pre-publish suite, and local development. It is the structural fix for the artifact-class lessons of ADR 0036 (display artifacts) and ADR 0038 (piped exit codes): the class can no longer reach `main` behind a passing build.
|
|
70
|
+
|
|
3
71
|
## [1.22.0] — `/v1/audio/speech` recorded as a generation-excluded contract operation; MDX pin provenance for every docs source
|
|
4
72
|
|
|
5
73
|
The second daily audit claimed "zero upstream drift since d9b8601" while verifying the v1.20.0 release that had absorbed exactly the two commits landing after that (retired) pin — and missed real in-window documentation drift besides: upstream `6ef847b8` ("mlxrunner: add Phonon text-to-speech support", 2026-10-22 18:36 UTC) added a `### /v1/audio/speech` section to the OpenAI-compatibility page inside the audit's own 24-hour window. The endpoint is documented (Ollama v0.40.8+; `model`/`input` ≤ 4,096 chars/`voice`/`response_format` `wav`+`pcm`/`speed` `1`/`stream_format` `audio` supported; `instructions` and the `mp3`/`opus`/`aac`/`flac` formats unsupported; 16-bit mono 24 kHz; unsupported values rejected with `400`) but absent from upstream's own `openapi.yaml` — docs ahead of spec, so no openapi re-pin. The live openapi content itself is byte-identical to the `36a6e99` pin (raw sha256 `e94c8f02…`), confirming zero *spec* drift; the audit's error was the anchor and the unchecked MDX surfaces. This release closes the documentation-alignment gap (see [ADR 0038](./docs/adr/0038-audio-speech-contract-mdx-pin-provenance.md)). 1125 pre-existing tests stay green (including the 1.21.0 cancellation-signal suite), 8 net-new tests added.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OllamaRuntime, H as HttpClient, A as AbortableAsyncIterable, ai as SseEvent, z as OllamaClientError } from './runtime-
|
|
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-
|
|
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.
|
package/dist/generated-api.d.cts
CHANGED
|
@@ -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-
|
|
2
|
-
export { N as NativeApi } from './anthropic-
|
|
3
|
-
import { O as OllamaRuntime } from './runtime-
|
|
4
|
-
export { a as OperationDefinition } from './runtime-
|
|
5
|
-
import './types-
|
|
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
|
/**
|
package/dist/generated-api.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { N as NativeApi } from './anthropic-
|
|
3
|
-
import { O as OllamaRuntime } from './runtime-
|
|
4
|
-
export { a as OperationDefinition } from './runtime-
|
|
5
|
-
import './types-
|
|
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
|
/**
|