SPB Git

spb/zyquo-agent Public MIT

The autonomous agent that actually operates your Mac — plans, runs real commands, verifies its own work.

Swift 94.7% Shell 4.1% Python 0.7% Makefile 0.5%
1.8 KB · 52 lines swift
Raw Blame History
1//2//  Main.swift3//  Zyquo Agent4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  Entry point. `--run "<task>"` executes a headless agent task (Phase 3 CLI9//  POC), `--run-mock` drives the same engine with a scripted provider (CI10//  smoke test), `--verify` runs the provider tool-calling harness (Phase 7),11//  `--verify-policy` runs the PolicyEngine safety self-check (Phase 3.C),12//  `--load-vault` seeds the encrypted vault from environment keys; otherwise13//  the SwiftUI app launches.14//15//  Deliberately a synchronous main: launching NSApplicationMain from an async16//  main() corrupts Swift concurrency's executor setup (background tasks stop17//  being scheduled), so the CLI modes drive their async work explicitly.18//1920import Foundation2122@main23enum Main {24    static func main() {25        let arguments = CommandLine.arguments26        if arguments.contains("--run") || arguments.contains("--run-mock")27            || arguments.contains("--verify") || arguments.contains("--verify-policy") {28            Task.detached {29                let status = await AgentCLI.run(arguments: arguments)30                exit(status)31            }32            // Park the main thread servicing the main queue so MainActor work33            // can run (a blocking semaphore here deadlocks the harness).34            dispatchMain()35        }36        if arguments.contains("--run-ui-smoke") {37            // Hidden CI check: drives the UI's RunController with the mock38            // provider and asserts the published state transitions.39            Task { @MainActor in40                let status = await UISmoke.run()41                exit(status)42            }43            dispatchMain()44        }45        if arguments.contains("--load-vault") {46            AgentCLI.loadVault()47            exit(0)48        }49        ZyquoAgentApp.main()50    }51}52