feat(m4-m6): session, panel, Replace, settings and onboarding
M4: TranslationSession actor with epochs/one-in-flight streaming, PanelViewModel, non-activating NSPanel, streaming panel UI, searchable/recent target languages, warnings/errors and Copy/Retry/Replace actions. M5: InsertionCoordinator with target capture, AX direct replacement, secure-field/own-PID refusal, frontmost and selected-text verification, snapshot/⌘V/restore fallback, cancellation-safe restore and blocking-warning gate. M6: versioned AppSettings/SettingsStore, onboarding for Ollama/model/target/Accessibility, General/Model/Translation/Privacy/Diagnostics settings, launch-at-login via SMAppService, status menu (target, copy/replace last, setup, diagnostics, about), text-free diagnostics and first-run setup. Docs: PROGRESS M4–M6, ARCHITECTURE §10–§12, ADR-019/020, SELECTION_AND_CLIPBOARD and TESTING. Manual 10-app matrices, real AX/paste delivery, VoiceOver and focus checks remain open. Verified: make verify green (format, strict lint, scripts, privacy, Debug+Release signatures, 217 package tests); app launches and a two-copy clipboard smoke test opens the panel.
This commit is contained in:
1 parent
64078e2f04
commit
a78572adc3
47 files changed
+4963
-79
No files matched your search
@@ -50,6 +50,48 @@ struct TranslationPipelineTests {
|
||||
#expect(chat.recorded[1].messages.first?.content.contains("Second paragraph.") == true)
|
||||
}
|
||||
|
||||
@Test func streamedTextIncludesChunkSeparators() async throws {
|
||||
let chat = SequencedChat(responses: [
|
||||
[.delta("Erster Absatz."), .done(reason: "stop", metrics: .empty)],
|
||||
[.delta("Zweiter Absatz."), .done(reason: "stop", metrics: .empty)],
|
||||
])
|
||||
let collector = DeltaCollector()
|
||||
let pipeline = makePipeline(
|
||||
chat: chat,
|
||||
chunker: Chunker(latinLimit: 20, denseLimit: 20),
|
||||
detector: FixedDetector(code: "en", confidence: 0.9)
|
||||
)
|
||||
let result = try await pipeline.translate(
|
||||
text: "First paragraph.\n\nSecond paragraph.",
|
||||
target: german,
|
||||
model: model,
|
||||
keepAlive: "30m",
|
||||
onDelta: { await collector.append($0) }
|
||||
)
|
||||
|
||||
#expect(await collector.text == result.translation)
|
||||
#expect(await collector.text == "Erster Absatz.\n\nZweiter Absatz.")
|
||||
}
|
||||
|
||||
@Test func retryDoesNotStreamBothAttempts() async throws {
|
||||
let chat = SequencedChat(responses: [
|
||||
[.delta("Öffne jetzt."), .done(reason: "stop", metrics: .empty)],
|
||||
[.delta("Öffne https://example.com jetzt."), .done(reason: "stop", metrics: .empty)],
|
||||
])
|
||||
let collector = DeltaCollector()
|
||||
let pipeline = makePipeline(chat: chat, detector: FixedDetector(code: "en", confidence: 0.9))
|
||||
let result = try await pipeline.translate(
|
||||
text: "Open https://example.com now.",
|
||||
target: german,
|
||||
model: model,
|
||||
keepAlive: "30m",
|
||||
onDelta: { await collector.append($0) }
|
||||
)
|
||||
|
||||
#expect(await collector.text == "Öffne jetzt.")
|
||||
#expect(result.translation == "Öffne https://example.com jetzt.")
|
||||
}
|
||||
|
||||
@Test func retriesOnceWithTheDocumentedDelimitersPrompt() async throws {
|
||||
let chat = SequencedChat(responses: [
|
||||
[.delta("Öffne jetzt."), .done(reason: "stop", metrics: .empty)],
|
||||
@@ -182,6 +224,14 @@ private struct FixedDetector: LanguageDetecting {
|
||||
}
|
||||
}
|
||||
|
||||
private actor DeltaCollector {
|
||||
private(set) var text = ""
|
||||
|
||||
func append(_ delta: String) {
|
||||
text += delta
|
||||
}
|
||||
}
|
||||
|
||||
private struct FailingChat: OllamaChatting {
|
||||
let error: OllamaError
|
||||
|
||||
|
||||
Reference in new issue
Block a user