// // Main.swift // Zyquo Agent // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // // Entry point. `--run ""` executes a headless agent task (Phase 3 CLI // POC), `--run-mock` drives the same engine with a scripted provider (CI // smoke test), `--verify` runs the provider tool-calling harness (Phase 7), // `--verify-policy` runs the PolicyEngine safety self-check (Phase 3.C), // `--load-vault` seeds the encrypted vault from environment keys; otherwise // the SwiftUI app launches. // // Deliberately a synchronous main: launching NSApplicationMain from an async // main() corrupts Swift concurrency's executor setup (background tasks stop // being scheduled), so the CLI modes drive their async work explicitly. // import Foundation @main enum Main { static func main() { let arguments = CommandLine.arguments if arguments.contains("--run") || arguments.contains("--run-mock") || arguments.contains("--verify") || arguments.contains("--verify-policy") { Task.detached { let status = await AgentCLI.run(arguments: arguments) exit(status) } // Park the main thread servicing the main queue so MainActor work // can run (a blocking semaphore here deadlocks the harness). dispatchMain() } if arguments.contains("--run-ui-smoke") { // Hidden CI check: drives the UI's RunController with the mock // provider and asserts the published state transitions. Task { @MainActor in let status = await UISmoke.run() exit(status) } dispatchMain() } if arguments.contains("--load-vault") { AgentCLI.loadVault() exit(0) } ZyquoAgentApp.main() } }