chore(agent): drop cli fallback, rpc only for sends
This commit is contained in:
@@ -72,23 +72,13 @@ final class ClawdisXPCService: NSObject, ClawdisXPCProtocol {
|
||||
let trimmed = message.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmed.isEmpty else { return Response(ok: false, message: "message empty") }
|
||||
let sessionKey = session ?? "main"
|
||||
|
||||
// Try RPC first for lower latency; fall back to one-shot CLI.
|
||||
let rpcResult = await AgentRPC.shared.send(
|
||||
text: trimmed,
|
||||
thinking: thinking,
|
||||
session: sessionKey)
|
||||
if rpcResult.ok {
|
||||
return Response(ok: true, message: rpcResult.text ?? "sent")
|
||||
}
|
||||
|
||||
let result = await self.runAgentCLI(
|
||||
message: trimmed,
|
||||
thinking: thinking,
|
||||
session: sessionKey)
|
||||
return result.ok
|
||||
? Response(ok: true, message: result.text ?? "sent")
|
||||
: Response(ok: false, message: result.error ?? rpcResult.error ?? "failed to send")
|
||||
return rpcResult.ok
|
||||
? Response(ok: true, message: rpcResult.text ?? "sent")
|
||||
: Response(ok: false, message: rpcResult.error ?? "failed to send")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user