chore: initial commit of Vorleser kit

This commit is contained in:
schihei committed 2026-11-01 15:38:29 +01:00
commit cf3f2678e1
62 files changed
+2350

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
// swift-tools-version: 6.0
// VorleserKit — all testable logic for Vorleser. The macOS app target (App/) is generated by XcodeGen
// from project.yml and links the library products below. See docs/ARCHITECTURE.md §3.
import PackageDescription
let strictSettings: [SwiftSetting] = [
.enableUpcomingFeature("ExistentialAny"),
]
let package = Package(
name: "VorleserKit",
platforms: [.macOS(.v14)],
products: [
.library(name: "VorleserCore", targets: ["VorleserCore"]),
.library(name: "VorleserCapture", targets: ["VorleserCapture"]),
.executable(name: "vorleser-cli", targets: ["vorleser-cli"]),
],
dependencies: [
// CLI harness only (ADR-006). The app target must not depend on it.
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
],
targets: [
// Leaf modules — must not depend on each other.
.target(name: "VorleserText", swiftSettings: strictSettings),
.target(name: "VorleserOllama", swiftSettings: strictSettings),
.target(name: "VorleserAudio", swiftSettings: strictSettings),
// Composition of leaf modules via protocols.
.target(
name: "VorleserCore",
dependencies: ["VorleserText", "VorleserOllama", "VorleserAudio"],
swiftSettings: strictSettings
),
// Only module allowed to use Accessibility / ApplicationServices.
.target(name: "VorleserCapture", dependencies: ["VorleserCore"], swiftSettings: strictSettings),
// Fakes shared by tests (FakeSynthesizer, FakeAudioPlayer, FakeCatalog, FakePasteboard, FakeAXClient).
.target(
name: "VorleserTestSupport",
dependencies: ["VorleserCore", "VorleserCapture"],
swiftSettings: strictSettings
),
.executableTarget(
name: "vorleser-cli",
dependencies: [
"VorleserCore",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
swiftSettings: strictSettings
),
.testTarget(name: "VorleserTextTests", dependencies: ["VorleserText"],
resources: [.copy("Fixtures")]),
.testTarget(name: "VorleserOllamaTests", dependencies: ["VorleserOllama"],
resources: [.copy("Fixtures")]),
.testTarget(name: "VorleserAudioTests", dependencies: ["VorleserAudio"]),
.testTarget(name: "VorleserCoreTests", dependencies: ["VorleserCore", "VorleserTestSupport"]),
.testTarget(name: "VorleserCaptureTests", dependencies: ["VorleserCapture", "VorleserTestSupport"]),
// Opt-in tests against a real local Ollama: VORLESER_LIVE=1 swift test --filter VorleserLiveTests
.testTarget(name: "VorleserLiveTests", dependencies: ["VorleserCore"]),
]
)
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserAudio module.
public enum VorleserAudioModule {
public static let moduleName = "VorleserAudio"
}
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserCapture module.
public enum VorleserCaptureModule {
public static let moduleName = "VorleserCapture"
}
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserCore module.
public enum VorleserCoreModule {
public static let moduleName = "VorleserCore"
}
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserOllama module.
public enum VorleserOllamaModule {
public static let moduleName = "VorleserOllama"
}
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserTestSupport module.
public enum VorleserTestSupportModule {
public static let moduleName = "VorleserTestSupport"
}
@@ -0,0 +1,6 @@
// Placeholder so the target compiles. Replace during T0.1+ (see docs/IMPLEMENTATION_PLAN.md).
/// Namespace for the VorleserText module.
public enum VorleserTextModule {
public static let moduleName = "VorleserText"
}
@@ -0,0 +1,17 @@
import ArgumentParser
import VorleserCore
/// Headless harness for Vorleser. Subcommands are added in T1.5 (models, voices, speak),
/// T2.4 (segment) and T4.5 (read). See docs/IMPLEMENTATION_PLAN.md.
@main
struct VorleserCLI: ParsableCommand {
static let configuration = CommandConfiguration(
commandName: "vorleser-cli",
abstract: "Headless test harness for Vorleser.",
subcommands: []
)
func run() throws {
print("vorleser-cli: no subcommands implemented yet (\(VorleserCoreModule.moduleName))")
}
}
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserAudio
@Test func moduleLinks() {
#expect(VorleserAudioModule.moduleName == "VorleserAudio")
}
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserCapture
@Test func moduleLinks() {
#expect(VorleserCaptureModule.moduleName == "VorleserCapture")
}
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserCore
@Test func moduleLinks() {
#expect(VorleserCoreModule.moduleName == "VorleserCore")
}
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserCore
@Test func moduleLinks() {
#expect(VorleserCoreModule.moduleName == "VorleserCore")
}
@@ -0,0 +1 @@
Recorded by scripts/capture-fixtures.sh (T1.1). Do not edit by hand. Keep each file < 200 KB.
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserOllama
@Test func moduleLinks() {
#expect(VorleserOllamaModule.moduleName == "VorleserOllama")
}
@@ -0,0 +1,8 @@
Sample inputs for normaliser/segmenter tests (T2.1–T2.4).
- en-article.txt: abbreviations (e.g., Fig. 3), decimals (3.5 TB/s), a page-number paragraph ("12"), em dash.
- de-pdf-copy.txt: PDF line wraps, lowercase hyphenation joins ("Infra-\nstruktur" → "Infrastruktur",
"Unter-\nschiede" → "Unterschiede"), uppercase continuation that must stay hyphenated ("Nord-\nSüd"),
German abbreviations ("z. B.", "d. h."), decimal comma, page-number paragraph ("– 14 –").
Expected outputs belong in the tests themselves, not in these files.
@@ -0,0 +1,11 @@
Die europäische KI-Infra-
struktur tritt in eine neue Phase ein. Die neuen Systeme kombinieren z. B. Beschleuniger
mit Hochbandbreitenspeicher, d. h. die Speicherbandbreite steigt auf 3,5 TB/s.
Der Nord-
Süd-Vergleich zeigt jedoch deutliche Unter-
schiede bei der Energieversorgung.
– 14 –
Ob damit die Lücke zu den USA und China geschlossen wird, bleibt offen.
@@ -0,0 +1,7 @@
Europe's AI infrastructure is entering a new phase. The EuroHPC Joint Undertaking has selected new AI factories, e.g. in Germany and Finland, with a combined budget of more than 2.1 billion euros.
The systems combine accelerators with high-bandwidth memory. Fig. 3 shows the topology. Each node delivers 3.5 TB/s of memory bandwidth; the interconnect, however, remains the limiting factor for large-scale training — especially for mixture-of-experts models with frequent all-to-all communication.
12
Whether this closes the gap to the United States and China is an open question.
@@ -0,0 +1,6 @@
import Testing
@testable import VorleserText
@Test func moduleLinks() {
#expect(VorleserTextModule.moduleName == "VorleserText")
}