feat(account): add managed credits and cloud gateway

Introduce optional Apple account-backed credits with scoped gateway access while preserving local and BYOK paths. Refresh assistant behavior, tests, privacy disclosures, docs, and the website for the 2.0 experience.
This commit is contained in:
Rocky
2026-08-20 11:43:21 +08:00
parent 0f9280bd00
commit 498f407585
301 changed files with 19221 additions and 10891 deletions
@@ -58,7 +58,7 @@ public enum AIQuestionPromptComposer {
.system(systemPrompt(
targetLocaleID: targetLocaleID,
responseLength: responseLength
)),
))
]
for turn in turns.suffix(AIQuestionLimits.retainedConversationRounds) {
messages.append(.user(turn.question))
@@ -128,8 +128,20 @@ public struct AIQuestionService: Sendable {
public static func configured(
store: any ConfigurationStore,
conversations: AIConversationStore,
taskKind: ManagedGatewayTaskKind = .aiQuestion,
thinkingEnabled: Bool = true
) throws -> AIQuestionService {
if store.credentialSource == .managed {
return AIQuestionService(
client: ManagedLLMClient(
capability: .assistant,
taskKind: taskKind,
grants: GatewayGrantCoordinator()
),
conversations: conversations,
responseLength: store.aiResponseLength
)
}
// Same provider + baseURL + model resolution as dictation polish so the
// Settings LLM card is the single source of truth for both modes.
let providerID = PolishingService.resolvedProviderId(