Files
openclaw/apps/macos/Sources/OpenClaw/GatewayConnection+Inference.swift
Peter Steinberger 28a3540f32 feat: add native inline widget support (#109212)
* feat: add native inline widget support

* refactor: simplify plugin surface refresh

* fix: preserve plugin surface refresh API

* fix: reload widgets after WebKit termination

* fix: harden native widget refresh

* fix: bound native widget recovery

* docs: defer native widget release note

* chore: refresh native i18n inventory

* fix: harden native widget delivery

* refactor: simplify native widget API surface

* fix: serialize native widget capability refresh

* fix: harden native widget recovery

* fix: recover native widget capabilities

* style: format widget refresh role selection

* fix: correct widget refresh formatting

* fix: harden cross-platform widget recovery

* fix: bind widget trust and recovery to routes

* chore: refresh native i18n inventory

* chore: regenerate Android gateway protocol

* test: remove unused release workflow read
2026-07-16 19:24:41 -07:00

28 lines
994 B
Swift

import Foundation
import OpenClawChatUI
import OpenClawProtocol
extension GatewayConnection {
func configuredInferenceModel(
ifCurrentRoute route: Route,
timeoutMs: Double = 15000) async throws -> String?
{
let data = try await request(
OpenClawChatGatewayRequests.agentsList(timeoutMs: timeoutMs),
ifCurrentRoute: route)
guard await self.isCurrentRoute(route) else {
throw CancellationError()
}
return try Self.decodeConfiguredInferenceModel(data)
}
static func decodeConfiguredInferenceModel(_ data: Data) throws -> String? {
let result = try JSONDecoder().decode(AgentsListResult.self, from: data)
let primary = result.agents
.first(where: { $0.id == result.defaultid })?
.model?["primary"]?.value as? String
let trimmed = primary?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
return trimmed.isEmpty ? nil : trimmed
}
}