native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
Swift
12345678910111213141516171819202122232425262728293031323334353637383940414243import Foundationimport Testing
@testable import Prowl
struct AgentScreenDetectionTests { @Test func unmigratedDetectorsReturnTheirExistingStateWithAStableReason() { let screen = "screen without a live rule"
for agent in DetectedAgent.allCases where agent != .codex && agent != .claude { let detection = agent.detectScreen(in: screen)
#expect(detection.state == agent.detectState(in: screen)) #expect(detection.reason == .legacyDetector) #expect(detection.reason.identifier == "legacy.detector") } }
@Test func transitionDiagnosticsIncludeTheStableReasonWithoutScreenText() { let diagnostic = AgentDetectionDiagnostic( tabId: TerminalTabID(rawValue: UUID()), childPID: nil, processGroupID: nil, job: nil, identified: nil, retainedAgent: .codex, raw: .blocked, reason: .matched(AgentScreenRuleID("codex.directoryTrust")), stabilized: .blocked )
#expect(diagnostic.summary.contains("reason=codex.directoryTrust")) #expect(!diagnostic.summary.contains("screen=")) }
@Test func reasonIdentifiersDistinguishMatchesAndFallbacks() { let ruleID = AgentScreenRuleID("codex.directoryTrust")
#expect(AgentScreenDetectionReason.matched(ruleID).identifier == "codex.directoryTrust") #expect(AgentScreenDetectionReason.noRuleMatched.identifier == "fallback.noRuleMatched") }}