style: resolve swift lint warnings
This commit is contained in:
@@ -86,9 +86,9 @@ enum ExecApprovalDecision: String, Codable, Sendable {
|
||||
|
||||
struct ExecAllowlistEntry: Codable, Hashable {
|
||||
var pattern: String
|
||||
var lastUsedAt: Double? = nil
|
||||
var lastUsedCommand: String? = nil
|
||||
var lastResolvedPath: String? = nil
|
||||
var lastUsedAt: Double?
|
||||
var lastUsedCommand: String?
|
||||
var lastResolvedPath: String?
|
||||
}
|
||||
|
||||
struct ExecApprovalsDefaults: Codable {
|
||||
|
||||
@@ -87,16 +87,19 @@ enum ExecApprovalsSocketClient {
|
||||
let trimmedToken = token.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmedPath.isEmpty, !trimmedToken.isEmpty else { return nil }
|
||||
do {
|
||||
return try await AsyncTimeout.withTimeoutMs(timeoutMs: timeoutMs, onTimeout: {
|
||||
TimeoutError(message: "exec approvals socket timeout")
|
||||
}, operation: {
|
||||
try await Task.detached {
|
||||
try self.requestDecisionSync(
|
||||
socketPath: trimmedPath,
|
||||
token: trimmedToken,
|
||||
request: request)
|
||||
}.value
|
||||
})
|
||||
return try await AsyncTimeout.withTimeoutMs(
|
||||
timeoutMs: timeoutMs,
|
||||
onTimeout: {
|
||||
TimeoutError(message: "exec approvals socket timeout")
|
||||
},
|
||||
operation: {
|
||||
try await Task.detached {
|
||||
try self.requestDecisionSync(
|
||||
socketPath: trimmedPath,
|
||||
token: trimmedToken,
|
||||
request: request)
|
||||
}.value
|
||||
})
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -733,7 +733,9 @@ actor MacNodeRuntime {
|
||||
return BridgeInvokeResponse(id: req.id, ok: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MacNodeRuntime {
|
||||
private static func decodeParams<T: Decodable>(_ type: T.Type, from json: String?) throws -> T {
|
||||
guard let json, let data = json.data(using: .utf8) else {
|
||||
throw NSError(domain: "Gateway", code: 20, userInfo: [
|
||||
|
||||
@@ -80,10 +80,7 @@ struct SystemRunSettingsView: View {
|
||||
.labelsHidden()
|
||||
.pickerStyle(.menu)
|
||||
|
||||
Text(self.model.isDefaultsScope
|
||||
? "Defaults apply when an agent has no overrides. Ask controls prompt behavior; fallback is used when no companion UI is reachable."
|
||||
:
|
||||
"Security controls whether system.run can execute on this Mac when paired as a node. Ask controls prompt behavior; fallback is used when no companion UI is reachable.")
|
||||
Text(self.scopeMessage)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.tertiary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
@@ -138,6 +135,15 @@ struct SystemRunSettingsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var scopeMessage: String {
|
||||
if self.model.isDefaultsScope {
|
||||
return "Defaults apply when an agent has no overrides. " +
|
||||
"Ask controls prompt behavior; fallback is used when no companion UI is reachable."
|
||||
}
|
||||
return "Security controls whether system.run can execute on this Mac when paired as a node. " +
|
||||
"Ask controls prompt behavior; fallback is used when no companion UI is reachable."
|
||||
}
|
||||
}
|
||||
|
||||
private enum ExecApprovalsSettingsTab: String, CaseIterable, Identifiable {
|
||||
|
||||
Reference in New Issue
Block a user