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//2// AgentEvent.swift3// Zyquo Agent4//5// Author: Simon-Pierre Boucher6// Mail: contact@spboucher.ai7//8// The engine→UI event stream. AgentLoop emits these while a run executes;9// the CLI renderer (Phase 3) and the full UI (Phase 6) render EXCLUSIVELY10// from this stream plus the persisted Transcript — nothing about a run is11// observable any other way.12//1314import Foundation1516/// Coarse run state, for status pills and the sidebar activity indicator.17enum AgentRunStatus: Sendable, Equatable {18 /// Workspace/memory/system prompt being prepared.19 case preparing20 /// A model turn is streaming.21 case running22 /// Tool calls from the current turn are executing.23 case executingTools24 /// Context compaction in progress.25 case compacting26 /// A LoopGuard trip paused the run; waiting for resume/stop.27 case awaitingUser28 /// The run ended (see the accompanying `runFinished` outcome).29 case finished30}3132/// How a run ended. Persisted in the Transcript.33enum AgentRunOutcome: Codable, Sendable {34 /// The model produced a final answer (its user-facing result summary).35 case completed(finalAnswer: String)36 /// The run failed with a human-readable reason (provider error, refusal,37 /// repeated truncation, model without tool support…).38 case failed(reason: String)39 /// The surrounding task was cancelled (user pressed Stop / ⌘.).40 case cancelled41 /// A LoopGuard trip was answered with "stop".42 case stoppedByUser(reason: String)43}4445/// One event in the live run stream.46enum AgentEvent: Sendable {47 case statusChanged(AgentRunStatus)4849 /// A new loop iteration began (step has its index + id; content follows).50 case stepStarted(AgentStep)51 /// Reasoning-model thinking text for the step, as it streams.52 case thinkingDelta(stepID: UUID, String)53 /// Assistant-visible text for the step, as it streams.54 case textDelta(stepID: UUID, String)5556 /// The model opened a tool-call block — show the live chip immediately,57 /// before the arguments finish streaming.58 case toolCallStreaming(stepID: UUID, index: Int, id: String, name: String)59 /// Raw tool-call argument JSON fragments for the call at `index`60 /// (concatenate to render the command as it streams; may be partial JSON).61 case toolCallArgumentsDelta(stepID: UUID, index: Int, delta: String)6263 /// A finalized tool call is about to execute (arguments complete,64 /// heading into the policy gate).65 case toolCallStarted(stepID: UUID, AgentToolInvocation)66 /// Live stdout/stderr/note chunks from the executing tool.67 case toolOutput(stepID: UUID, callID: String, ToolOutputChunk)68 /// The tool call finished; the invocation carries its ToolResult.69 case toolCallFinished(stepID: UUID, AgentToolInvocation)7071 /// The step is complete (final AgentStep snapshot, with invocations).72 case stepCompleted(AgentStep)7374 /// The plan/todo list changed (created or updated via `update_plan`).75 case planUpdated(TaskPlan)76 /// A LoopGuard limit tripped; the run is pausing (answer with77 /// `AgentLoop.resume(raisingBudget:)` or `AgentLoop.stop()`).78 case guardTripped(LoopGuardTrip)79 /// The MemoryManager compacted older history.80 case compactionPerformed(CompactionRecord)8182 /// Terminal event — always the last one emitted.83 case runFinished(AgentRunOutcome)84}85