feat(m1): Ollama client, catalog, streaming chat and CLI (T1.1-T1.6)

Add endpoint policy and redirect-safe ephemeral HTTP client, error mapping, catalog cache and version checks, streaming chat with phase timeouts/cancellation, provisional Hy-MT3 prompt/language/request factory, warm-up policy, and sprachmittler-cli models/show/translate. Recapture the 7B fixtures; defer the 1.8B VERIFY items; document ADR-016. Also fix the signature checker's pipefail SIGPIPE issue.
This commit is contained in:
schihei committed 2026-11-26 13:04:22 +01:00
1 parent 7ca5c710ec
commit 26b493e7e5
93 files changed
+3732 -218

No files matched your search

+7 -1
View File
@@ -126,6 +126,8 @@ flowchart TD
App --> Capture
CLI[sprachmittler-cli] --> Core
CLI --> Eval
CLI --> Ollama
CLI --> Engines
Eval --> Core
Core --> Text
Core --> Ollama
@@ -142,6 +144,8 @@ flowchart TD
- `SprachmittlerCore` composes everything through **protocols** so each part can be faked in tests. It contains no model-specific branches and no AppKit.
- `SprachmittlerCapture` is the only module that imports `ApplicationServices`/`Accessibility` and touches `NSPasteboard`. It depends on `SprachmittlerCore` for domain types and protocols.
- `SprachmittlerEval` is linked into the CLI only, never into the app.
- `sprachmittler-cli` links `SprachmittlerOllama` and `SprachmittlerEngines` directly for the M1 commands; it is never linked into the app.
- `SprachmittlerTestSupport` is test-only and depends on `SprachmittlerCore` and `SprachmittlerOllama`; it is never linked into the app.
- The `App` target holds no business logic. Anything with a branch worth testing belongs in a package module.
### Third-party dependencies
@@ -398,6 +402,8 @@ public protocol OllamaCatalog: Sendable {
func installedModels() async throws -> [InstalledModel]
func show(model: String) async throws -> ModelDetails
func loadedModels() async throws -> [LoadedModel]
func refresh() async
func checkMinimumVersion() async throws
}
public protocol OllamaChatting: Sendable {
@@ -415,7 +421,7 @@ Implementation rules:
- `URLSession` with an **ephemeral** configuration, no cookies, no URL cache, no credential storage, and a delegate that **refuses redirects**.
- `URLSession.bytes(for:)` and line-by-line NDJSON decoding; carry partial lines across chunks.
- Cancellation: cancelling the consuming task cancels the URL task (`onTermination` → `task.cancel()`).
- Timeouts per phase, injectable: connect 3 s; first token 120 s (includes cold model load); idle 20 s; total per chunk 180 s.
- Timeouts per phase, injectable: connect and first token 120 s (includes cold model load; `URLSession` has no separate connect hook); idle 20 s; total per chunk 180 s.
- No `system` message, no `images`, no `think` (the model reports only `completion`). Send exactly one user message with the prompt.
- `keep_alive` comes from settings (`30m` default; `0` unloads after the request).
- `/api/show` results are cached per model digest for the app lifetime and invalidated on "Refresh models".