Neues Swift-Package mit lokalen LLM-Backends für alle nativen mana- e.V.-Apps. Lift der bisher Memoro-eigenen Files in `memoro-native/Sources/Core/AI/` plus zwei neue Layer: ManaSharedModels (App-Group-Container-Helper) und ManaLLM-Facade. Library-Products: - ManaLLM — Backend-Abstraktion (FoundationModels, Gemma 4 E2B/E4B, NoOp), Router mit Priority-Liste, High-Level-Facade `ManaLLM.summarize/generate/classify` mit fast/creative/deep Level. - ManaLLMShared — App-Group `group.ev.mana.models` Container, HF_HUB_CACHE-Setup, Legacy-Fallback wenn Group fehlt. Lift-Anpassungen ggü. memoro: - public-Marker auf protocol + types + actors - generischer `generate(prompt:instructions:maxTokens:)` zu LLMBackend-Protocol hinzu; `summarize` als Default-Impl auf Basis von generate - AppleFMBackend behält optimierten @Generable-Summary-Path - GemmaBackend nutzt ManaSharedModels.effectiveCacheURL() statt eigenen Application-Support-Pfad; allowsCellular kommt jetzt als Initializer-Param statt App-Settings-Lookup - LLMRouter: Memoro-spezifische User-Pref-Store-Logic durch Priority-Liste-API ersetzt - LLMLog-Subsystem `ev.mana.llm` statt App-eigenes `Log.ai` Build: `swift build` clean (76s, MLX-Toolchain-Resolution beim ersten Lauf). 4/4 Parser-Tests grün. Doku: ../mana/docs/MANA_LLM.md (Plattform-SOT), CLAUDE.md (Konventionen + Lift-Tabelle). Folge: L-4 Memoro auf ManaLLM umstellen, L-5 pageta-Pilot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
59 lines
2.2 KiB
Swift
59 lines
2.2 KiB
Swift
// swift-tools-version: 6.0
|
|
import PackageDescription
|
|
|
|
/// `mana-swift-llm` — Swift-Package mit lokalen LLM-Backends für alle
|
|
/// nativen mana-e.V.-Apps (FoundationModels + Gemma 4 via MLX).
|
|
///
|
|
/// Zwei Library-Products:
|
|
///
|
|
/// - **ManaLLM**: Backend-Abstraktion + Router. Apps importieren
|
|
/// dieses Modul für `ManaLLM.summarize(...)` oder direkte Backend-
|
|
/// Zugriffe. Bringt MLX-Swift-LM + swift-transformers als
|
|
/// Dependencies mit.
|
|
///
|
|
/// - **ManaLLMShared**: App-Group-Container-Helper für gemeinsamen
|
|
/// HuggingFace-Cache (`group.ev.mana.models`). Apps nutzen das,
|
|
/// um Modelle einmal zu laden und über alle teilnehmenden Apps
|
|
/// hinweg per mmap zu lesen. Kein MLX-Dep — schmale Tool-Lib.
|
|
///
|
|
/// SOT-Doku: `mana/docs/MANA_LLM.md`. Plattform-Kontext:
|
|
/// `mana/docs/MANA_SWIFT.md`. Bewusst eigenes Repo (nicht in
|
|
/// mana-swift-core), weil die MLX-Swift-Toolchain ~30 MB schwer ist
|
|
/// und ManaCore lean bleiben soll (Architektur-Invariante).
|
|
let package = Package(
|
|
name: "mana-swift-llm",
|
|
platforms: [
|
|
.iOS(.v18),
|
|
.macOS(.v15),
|
|
],
|
|
products: [
|
|
.library(name: "ManaLLM", targets: ["ManaLLM"]),
|
|
.library(name: "ManaLLMShared", targets: ["ManaLLMShared"]),
|
|
],
|
|
dependencies: [
|
|
.package(url: "https://github.com/ml-explore/mlx-swift-lm", branch: "main"),
|
|
.package(url: "https://github.com/huggingface/swift-huggingface", from: "0.9.0"),
|
|
.package(url: "https://github.com/huggingface/swift-transformers", from: "1.3.0"),
|
|
],
|
|
targets: [
|
|
.target(
|
|
name: "ManaLLM",
|
|
dependencies: [
|
|
"ManaLLMShared",
|
|
.product(name: "MLXLLM", package: "mlx-swift-lm"),
|
|
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
|
|
.product(name: "MLXHuggingFace", package: "mlx-swift-lm"),
|
|
.product(name: "HuggingFace", package: "swift-huggingface"),
|
|
.product(name: "Tokenizers", package: "swift-transformers"),
|
|
]
|
|
),
|
|
.target(
|
|
name: "ManaLLMShared",
|
|
dependencies: []
|
|
),
|
|
.testTarget(
|
|
name: "ManaLLMTests",
|
|
dependencies: ["ManaLLM"]
|
|
),
|
|
]
|
|
)
|