feat(cli): add agent send command and wire through XPC

This commit is contained in:
Peter Steinberger
2025-12-07 05:00:52 +01:00
parent f1dbff1dd4
commit a489550752
3 changed files with 54 additions and 0 deletions

View File

@@ -67,6 +67,22 @@ final class ClawdisXPCService: NSObject, ClawdisXPCProtocol {
guard authorized else { return Response(ok: false, message: "screen recording permission missing") }
}
return await ShellRunner.run(command: command, cwd: cwd, env: env, timeout: timeoutSec)
case let .agent(message, thinking, session):
let trimmed = message.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty else { return Response(ok: false, message: "message empty") }
let sent = await MainActor.run {
WebChatManager.shared.sendMessage(
trimmed,
thinking: thinking ?? "default",
sessionKey: session ?? "main")
}
if sent {
return Response(ok: true, message: "sent")
}
return Response(ok: false, message: "failed to enqueue message")
}
}
}