feat(keyboard): unify assistant voice and AI workflows

Merge dictation and AI controls into one assistant surface, preserve safe insertion and clipboard actions, and align settings and tests with the new flow.
This commit is contained in:
Rocky
2026-08-16 12:07:06 +08:00
parent 46f6d818b8
commit fb97ec2937
45 changed files with 1969 additions and 2143 deletions
@@ -60,6 +60,22 @@ public struct EditableInputReference: Codable, Equatable, Sendable {
now >= expiresAt
}
/// Same-process verification uses the exact insertion kept in memory.
/// This path intentionally does not depend on the field fingerprint,
/// because UITextDocumentProxy may publish that context one callback after
/// the insertion while the in-memory record is already authoritative.
public func matchesLiveInsertion(
extensionInstanceID currentInstanceID: UUID,
lastInsertedText: String?,
contextBeforeInput: String?
) -> Bool {
!isExpired()
&& isWithinLengthBudget
&& extensionInstanceID == currentInstanceID
&& lastInsertedText == insertedText
&& contextBeforeInput?.hasSuffix(insertedText) == true
}
/// Rebuilt extensions must match the complete inserted string at the caret
/// and, when captured, the same field fingerprint; a suffix sample is insufficient.
public func isFullyVerified(