Add custom MCP profiles and reusable workspace libraries

This commit is contained in:
Mark Gregory
2026-11-16 14:50:20 +00:00
parent bc2ae8ec02
commit 32c4b9f91c
12 changed files with 1398 additions and 76 deletions
+5
View File
@@ -285,8 +285,10 @@ struct CompatibleEndpoint: InferenceProvider {
let delta: Piece?
let finish_reason: String?
}
struct Usage: Decodable { let completion_tokens: Int? }
let error: Failure?
let choices: [Choice]?
let usage: Usage?
}
func models() async throws -> [String] {
@@ -317,6 +319,9 @@ struct CompatibleEndpoint: InferenceProvider {
if payload.isEmpty { continue }
let frame = try JSONDecoder().decode(Frame.self, from: Data(payload.utf8))
if let error = frame.error { throw StudioError(error.message) }
if let tokens = frame.usage?.completion_tokens, tokens >= 0 {
continuation.yield(.metrics(ProviderMetrics(tokens: tokens, seconds: 0)))
}
guard let choice = frame.choices?.first else { continue }
if choice.finish_reason == "tool_calls" || !(choice.delta?.tool_calls ?? []).isEmpty {
continuation.yield(.committed)