52aa99ec8e
- Resolve Package.swift add/add: one manifest, single AIFabric target (Sources/AI compiled once; no duplicate-symbol risk) + DSKit/AppFeature/DSApp + AITests + DSKitTests, AIFabric library product kept. - import AI -> import AIFabric across AppFeature + RouterFallbackTests (S2 renamed module). - AppModel.askMeta qualified DSKit.AskResponse (AIFabric also defines an AskResponse for RemoteDS). swift build + swift test green (71 tests: S2 AITests + S3 DSKitTests). Frozen AIProvider interface intact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
948 B
Swift
27 lines
948 B
Swift
import Foundation
|
|
import AIFabric
|
|
|
|
/// The ONE composition touch-point that names MockAIProvider. When S2 ships real providers,
|
|
/// only this file changes (mockProviders -> realProviders) — AIService, views, and intents stay put.
|
|
public enum AppAIComposition {
|
|
public static func mockProviders(unavailable: Set<AIProviderID> = []) -> [AIProviderID: any AIProvider] {
|
|
var providers: [AIProviderID: any AIProvider] = [:]
|
|
for id in AIProviderID.allCases {
|
|
providers[id] = MockAIProvider(id: id, available: !unavailable.contains(id))
|
|
}
|
|
return providers
|
|
}
|
|
|
|
public static func mockRouter(unavailable: Set<AIProviderID> = []) -> AIRouter {
|
|
AIRouter(
|
|
providers: mockProviders(unavailable: unavailable),
|
|
policy: .default,
|
|
log: { msg in
|
|
#if DEBUG
|
|
print("[route]", msg)
|
|
#endif
|
|
}
|
|
)
|
|
}
|
|
}
|