fix(macos): restore control + webchat build
parent
e2a93e17f9
commit
39c232548c
|
|
@ -10,7 +10,9 @@ enum ControlRequestHandler {
|
|||
{
|
||||
// Keep `status` responsive even if the main actor is busy.
|
||||
let paused = UserDefaults.standard.bool(forKey: pauseDefaultsKey)
|
||||
if paused, request != .status {
|
||||
if paused, case .status = request {
|
||||
// allow status through
|
||||
} else if paused {
|
||||
return Response(ok: false, message: "clawdis paused")
|
||||
}
|
||||
|
||||
|
|
@ -21,8 +23,7 @@ enum ControlRequestHandler {
|
|||
body: body,
|
||||
sound: sound,
|
||||
priority: priority,
|
||||
delivery: delivery
|
||||
)
|
||||
delivery: delivery)
|
||||
return await self.handleNotify(notify, notifier: notifier)
|
||||
|
||||
case let .ensurePermissions(caps, interactive):
|
||||
|
|
@ -42,8 +43,7 @@ enum ControlRequestHandler {
|
|||
cwd: cwd,
|
||||
env: env,
|
||||
timeoutSec: timeoutSec,
|
||||
needsSR: needsSR
|
||||
)
|
||||
needsSR: needsSR)
|
||||
|
||||
case let .agent(message, thinking, session, deliver, to):
|
||||
return await self.handleAgent(
|
||||
|
|
@ -51,8 +51,7 @@ enum ControlRequestHandler {
|
|||
thinking: thinking,
|
||||
session: session,
|
||||
deliver: deliver,
|
||||
to: to
|
||||
)
|
||||
to: to)
|
||||
|
||||
case let .canvasShow(session, path, placement):
|
||||
return await self.handleCanvasShow(session: session, path: path, placement: placement)
|
||||
|
|
@ -77,8 +76,7 @@ enum ControlRequestHandler {
|
|||
nodeId: nodeId,
|
||||
command: command,
|
||||
paramsJSON: paramsJSON,
|
||||
logger: logger
|
||||
)
|
||||
logger: logger)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,8 +98,7 @@ enum ControlRequestHandler {
|
|||
title: request.title,
|
||||
body: request.body,
|
||||
sound: chosenSound,
|
||||
priority: request.priority
|
||||
)
|
||||
priority: request.priority)
|
||||
return ok ? Response(ok: true) : Response(ok: false, message: "notification not authorized")
|
||||
case .overlay:
|
||||
await MainActor.run {
|
||||
|
|
@ -113,8 +110,7 @@ enum ControlRequestHandler {
|
|||
title: request.title,
|
||||
body: request.body,
|
||||
sound: chosenSound,
|
||||
priority: request.priority
|
||||
)
|
||||
priority: request.priority)
|
||||
if ok { return Response(ok: true) }
|
||||
await MainActor.run {
|
||||
NotifyOverlayController.shared.present(title: request.title, body: request.body)
|
||||
|
|
@ -141,8 +137,8 @@ enum ControlRequestHandler {
|
|||
cwd: String?,
|
||||
env: [String: String]?,
|
||||
timeoutSec: Double?,
|
||||
needsSR: Bool
|
||||
) async -> Response {
|
||||
needsSR: Bool) async -> Response
|
||||
{
|
||||
if needsSR {
|
||||
let authorized = await PermissionManager
|
||||
.ensure([.screenRecording], interactive: false)[.screenRecording] ?? false
|
||||
|
|
@ -156,8 +152,8 @@ enum ControlRequestHandler {
|
|||
thinking: String?,
|
||||
session: String?,
|
||||
deliver: Bool,
|
||||
to: String?
|
||||
) async -> Response {
|
||||
to: String?) async -> Response
|
||||
{
|
||||
let trimmed = message.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmed.isEmpty else { return Response(ok: false, message: "message empty") }
|
||||
let sessionKey = session ?? "main"
|
||||
|
|
@ -167,8 +163,7 @@ enum ControlRequestHandler {
|
|||
sessionKey: sessionKey,
|
||||
deliver: deliver,
|
||||
to: to,
|
||||
channel: nil
|
||||
)
|
||||
channel: nil)
|
||||
return rpcResult.ok
|
||||
? Response(ok: true, message: rpcResult.text ?? "sent")
|
||||
: Response(ok: false, message: rpcResult.error ?? "failed to send")
|
||||
|
|
@ -181,8 +176,8 @@ enum ControlRequestHandler {
|
|||
private static func handleCanvasShow(
|
||||
session: String,
|
||||
path: String?,
|
||||
placement: CanvasPlacement?
|
||||
) async -> Response {
|
||||
placement: CanvasPlacement?) async -> Response
|
||||
{
|
||||
guard self.canvasEnabled() else { return Response(ok: false, message: "Canvas disabled by user") }
|
||||
do {
|
||||
let dir = try await MainActor.run {
|
||||
|
|
@ -235,8 +230,7 @@ enum ControlRequestHandler {
|
|||
let ids = await BridgeServer.shared.connectedNodeIds()
|
||||
let payload = (try? JSONSerialization.data(
|
||||
withJSONObject: ["connectedNodeIds": ids],
|
||||
options: [.prettyPrinted]
|
||||
))
|
||||
options: [.prettyPrinted]))
|
||||
.flatMap { String(data: $0, encoding: .utf8) } ?? "{}"
|
||||
return Response(ok: true, payload: Data(payload.utf8))
|
||||
}
|
||||
|
|
@ -245,8 +239,8 @@ enum ControlRequestHandler {
|
|||
nodeId: String,
|
||||
command: String,
|
||||
paramsJSON: String?,
|
||||
logger: Logger
|
||||
) async -> Response {
|
||||
logger: Logger) async -> Response
|
||||
{
|
||||
do {
|
||||
let res = try await BridgeServer.shared.invoke(nodeId: nodeId, command: command, paramsJSON: paramsJSON)
|
||||
if res.ok {
|
||||
|
|
|
|||
|
|
@ -181,7 +181,6 @@ final class WebChatServer: @unchecked Sendable {
|
|||
status: 403,
|
||||
mime: "text/plain",
|
||||
body: forbidden,
|
||||
contentLength: forbidden.count,
|
||||
includeBody: includeBody,
|
||||
over: connection)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue