Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: drive FaceTime calls through verified AX controls (#5388)
[._.]/ Adam Eivy4f37f746c228
diff --git a/scripts/setup-facetime.js b/scripts/setup-facetime.jsindex 4e4df11a7a..60f30b7057 100644--- a/scripts/setup-facetime.js+++ b/scripts/setup-facetime.js@@ -10,10 +10,11 @@ if (process.platform !== 'darwin') {}const source = join(import.meta.dirname, '..', 'server', 'native', 'facetime-ax', 'main.swift');+const identitySource = join(import.meta.dirname, '..', 'server', 'native', 'facetime-ax', 'identityMatcher.swift');const output = join(homedir(), '.portos', 'voice', 'facetime-ax');-if (!existsSync(source)) throw new Error('FaceTime helper source is missing');+if (!existsSync(source) || !existsSync(identitySource)) throw new Error('FaceTime helper source is missing');mkdirSync(dirname(output), { recursive: true });-execFileSync('swiftc', ['-O', source, '-o', output], { stdio: 'inherit' });+execFileSync('swiftc', ['-O', identitySource, source, '-o', output], { stdio: 'inherit' });console.log('✅ FaceTime Audio helper installed. Grant it Accessibility access before use.');// BlackHole is GPLv3 and is deliberately NOT bundled: PortOS asks, the userdiff --git a/server/native/facetime-ax/identityMatcher.swift b/server/native/facetime-ax/identityMatcher.swiftnew file mode 100644index 0000000000..50159335ce--- /dev/null+++ b/server/native/facetime-ax/identityMatcher.swift@@ -0,0 +1,40 @@+import Foundation++func folded(_ value: String) -> String {+ value.folding(options: [.caseInsensitive, .diacriticInsensitive, .widthInsensitive], locale: .current)+ .lowercased()+ .replacingOccurrences(of: "\\s+", with: " ", options: .regularExpression)+ .trimmingCharacters(in: .whitespacesAndNewlines)+}++func digits(_ value: String) -> String {+ value.filter(\.isNumber)+}++func containsPhrase(_ value: String, _ phrase: String) -> Bool {+ let escaped = NSRegularExpression.escapedPattern(for: phrase)+ let pattern = "(^|[^\\p{L}\\p{N}])\(escaped)($|[^\\p{L}\\p{N}])"+ return value.range(of: pattern, options: .regularExpression) != nil+}++struct IdentityMatcher {+ let phrases: [String]+ let phoneNumbers: [String]++ init(handle: String, identity: String) {+ phrases = [identity, handle]+ .map(folded)+ .filter { $0.count >= 2 && !$0.allSatisfy(\.isNumber) }+ phoneNumbers = [handle, identity]+ .map(digits)+ .filter { $0.count >= 10 }+ }++ func matches(_ values: [String]) -> Bool {+ values.contains { raw in+ let value = folded(raw)+ if phrases.contains(where: { containsPhrase(value, $0) }) { return true }+ return phoneNumbers.contains(digits(raw))+ }+ }+}diff --git a/server/native/facetime-ax/main.swift b/server/native/facetime-ax/main.swiftindex 2442a3b505..950059d0a0 100644--- a/server/native/facetime-ax/main.swift+++ b/server/native/facetime-ax/main.swift@@ -2,7 +2,7 @@ import AppKitimport ApplicationServicesimport Foundation-enum State: String { case idle, dialing, connected, ended, unknown }+enum State: String, Encodable { case idle, dialing, connected, ended, unknown }struct Result: Encodable {let ok: Bool@@ -12,6 +12,25 @@ struct Result: Encodable {let action: Stringlet message: Stringlet errorCode: String?++ enum CodingKeys: String, CodingKey {+ case ok, command, state, authorized, action, message, errorCode+ }++ func encode(to encoder: Encoder) throws {+ var container = encoder.container(keyedBy: CodingKeys.self)+ try container.encode(ok, forKey: .ok)+ try container.encode(command, forKey: .command)+ try container.encode(state, forKey: .state)+ try container.encode(authorized, forKey: .authorized)+ try container.encode(action, forKey: .action)+ try container.encode(message, forKey: .message)+ if let errorCode {+ try container.encode(errorCode, forKey: .errorCode)+ } else {+ try container.encodeNil(forKey: .errorCode)+ }+ }}func emit(_ result: Result, exit: Int32 = 0) -> Never {@@ -21,6 +40,223 @@ func emit(_ result: Result, exit: Int32 = 0) -> Never {Foundation.exit(exit)}+// AX trees are process-owned and can change between any two reads. Keep a+// bounded, value-only snapshot so classification never follows a stale element+// except for the final, semantically verified AXPress.+struct Node {+ let element: AXUIElement+ let parent: Int?+ let role: String+ let text: [String]+ let actions: Set<String>+}++struct Snapshot {+ let nodes: [Node]+ let truncated: Bool+}++let semanticAttributes: [CFString] = [+ kAXTitleAttribute as CFString,+ kAXDescriptionAttribute as CFString,+ kAXHelpAttribute as CFString,+ kAXValueAttribute as CFString,+ kAXRoleDescriptionAttribute as CFString,+ kAXIdentifierAttribute as CFString,+]++func attribute(_ element: AXUIElement, _ name: CFString) -> CFTypeRef? {+ var value: CFTypeRef?+ return AXUIElementCopyAttributeValue(element, name, &value) == .success ? value : nil+}++func stringAttribute(_ element: AXUIElement, _ name: CFString) -> String? {+ attribute(element, name) as? String+}++func childElements(_ element: AXUIElement) -> [AXUIElement] {+ attribute(element, kAXChildrenAttribute as CFString) as? [AXUIElement] ?? []+}++func actionNames(_ element: AXUIElement) -> Set<String> {+ var names: CFArray?+ guard AXUIElementCopyActionNames(element, &names) == .success,+ let values = names as? [String] else { return [] }+ return Set(values)+}++func snapshot(_ application: NSRunningApplication) -> Snapshot? {+ let root = AXUIElementCreateApplication(application.processIdentifier)+ var rootAttributes: CFArray?+ guard AXUIElementCopyAttributeNames(root, &rootAttributes) == .success else { return nil }+ var pending: [(AXUIElement, Int?)] = [(root, nil)]+ var nodes: [Node] = []+ var cursor = 0+ let maximumNodes = 2_000++ while cursor < pending.count && nodes.count < maximumNodes {+ let (element, parent) = pending[cursor]+ cursor += 1+ let index = nodes.count+ let values = semanticAttributes.compactMap { stringAttribute(element, $0) }+ .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }+ .filter { !$0.isEmpty }+ let role = stringAttribute(element, kAXRoleAttribute as CFString) ?? ""+ let interactiveRoles = [kAXButtonRole as String, kAXMenuButtonRole as String, "AXLink"]+ nodes.append(Node(+ element: element,+ parent: parent,+ role: role,+ text: values,+ actions: interactiveRoles.contains(role) ? actionNames(element) : []+ ))+ pending.append(contentsOf: childElements(element).map { ($0, index) })+ }+ return Snapshot(nodes: nodes, truncated: cursor < pending.count)+}++let faceTimeBundle = "com.apple.FaceTime"++func faceTimeApplications() -> [NSRunningApplication] {+ NSRunningApplication.runningApplications(withBundleIdentifier: faceTimeBundle)+}++func notificationApplications() -> [NSRunningApplication] {+ let running = NSWorkspace.shared.runningApplications+ let notificationCenter = running.filter { application in+ application.bundleIdentifier == "com.apple.notificationcenterui"+ || application.localizedName == "NotificationCenter"+ || application.executableURL?.lastPathComponent == "NotificationCenter"+ }+ if !notificationCenter.isEmpty { return notificationCenter }+ return running.filter { $0.bundleIdentifier == "com.apple.controlcenter" }+}++func containsAny(_ values: [String], _ words: [String]) -> Bool {+ let joined = folded(values.joined(separator: " "))+ return words.contains { containsPhrase(joined, $0) }+}++func ancestors(_ index: Int, nodes: [Node], limit: Int = 5) -> Set<Int> {+ var result: Set<Int> = [index]+ var current = nodes[index].parent+ var remaining = limit+ while let candidate = current, remaining > 0 {+ if nodes[candidate].role == (kAXApplicationRole as String) { break }+ result.insert(candidate)+ current = nodes[candidate].parent+ remaining -= 1+ }+ return result+}++func semanticallyRelated(_ first: Int, _ second: Int, nodes: [Node]) -> Bool {+ let common = ancestors(first, nodes: nodes).intersection(ancestors(second, nodes: nodes))+ return common.contains { index in+ ![kAXApplicationRole as String, kAXWindowRole as String, kAXScrollAreaRole as String]+ .contains(nodes[index].role)+ }+}++func pressable(_ node: Node) -> Bool {+ node.actions.contains(kAXPressAction as String)+}++let answerWords = ["answer", "accept", "answerbutton", "acceptbutton"]+let hangupWords = ["hang up", "hangup", "end call", "end", "hangupbutton", "endcallbutton"]+let dialingWords = ["calling", "dialing", "ringing", "connecting", "cancel call", "cancel", "cancelbutton"]+let connectedWords = ["connected", "mute", "microphone", "add people", "shareplay"]+let endedWords = ["call ended", "ended"]++func matchingControls(nodes: [Node], matcher: IdentityMatcher, words: [String]) -> [Node] {+ let identityIndices = nodes.indices.filter { matcher.matches(nodes[$0].text) }+ return nodes.enumerated().compactMap { (index, node) -> Node? in+ guard pressable(node), containsAny(node.text, words),+ identityIndices.contains(where: { semanticallyRelated(index, $0, nodes: nodes) }) else { return nil }+ return node+ }+}++func identitySurfaceTexts(nodes: [Node], matcher: IdentityMatcher) -> [[String]] {+ let identityIndices = nodes.indices.filter { matcher.matches(nodes[$0].text) }+ return identityIndices.map { identityIndex in+ nodes.indices.filter { semanticallyRelated($0, identityIndex, nodes: nodes) }+ .flatMap { nodes[$0].text }+ }+}++func classifyFaceTime(nodes: [Node], matcher: IdentityMatcher) -> State {+ let surfaces = identitySurfaceTexts(nodes: nodes, matcher: matcher)+ guard !surfaces.isEmpty else { return .idle }+ let states = surfaces.map { surfaceText -> State in+ if containsAny(surfaceText, dialingWords) { return .dialing }+ if containsAny(surfaceText, connectedWords) { return .connected }+ if containsAny(surfaceText, endedWords) { return .ended }+ return .idle+ }+ if states.contains(.connected) { return .connected }+ if states.contains(.dialing) { return .dialing }+ if !matchingControls(nodes: nodes, matcher: matcher, words: hangupWords).isEmpty { return .connected }+ if states.contains(.ended) { return .ended }+ // The configured identity can appear in recents while FaceTime is idle.+ // Identity text alone is not call-state evidence.+ return .idle+}++func faceTimeState(matcher: IdentityMatcher) -> State {+ let states = faceTimeApplications().map { application -> State in+ guard let result = snapshot(application), !result.truncated else { return .unknown }+ return classifyFaceTime(nodes: result.nodes, matcher: matcher)+ }+ if states.contains(.connected) { return .connected }+ if states.contains(.dialing) { return .dialing }+ if states.contains(.ended) { return .ended }+ if states.contains(.unknown) { return .unknown }+ return .idle+}++func incomingAnswerControls(matcher: IdentityMatcher) -> (controls: [Node], incomplete: Bool) {+ var controls: [Node] = []+ var incomplete = false+ for application in notificationApplications() {+ guard let result = snapshot(application), !result.truncated else {+ incomplete = true+ continue+ }+ controls.append(contentsOf: matchingControls(nodes: result.nodes, matcher: matcher, words: answerWords))+ }+ return (controls, incomplete)+}++func probe(matcher: IdentityMatcher) -> State {+ // A matching incoming notification takes precedence over FaceTime's generic+ // idle window. An unmatched notification is intentionally indistinguishable+ // from no notification: do not surface its text, state, or existence.+ let incoming = incomingAnswerControls(matcher: matcher)+ if incoming.controls.count == 1 { return .dialing }+ let state = faceTimeState(matcher: matcher)+ if incoming.controls.count > 1 { return .unknown }+ if state != .idle { return state }+ if incoming.incomplete { return .unknown }+ return state+}++func waitForState(_ expected: Set<State>, matcher: IdentityMatcher, timeout: TimeInterval) -> State? {+ let deadline = Date().addingTimeInterval(timeout)+ while Date() < deadline {+ let state = faceTimeState(matcher: matcher)+ if expected.contains(state) { return state }+ RunLoop.current.run(until: min(deadline, Date().addingTimeInterval(0.3)))+ }+ return nil+}++func ambiguous(_ command: String, state: State = .unknown) -> Never {+ // Never include text read from an AX surface here. In particular, a caller+ // that does not match the configured identity must leave no observable name.+ emit(Result(ok: false, command: command, state: state, authorized: true, action: "none", message: "No single matching FaceTime control was found", errorCode: "ambiguous-surface"), exit: 1)+}+let arguments = CommandLine.argumentsguard arguments.count == 4, ["probe", "call", "answer", "hangup"].contains(arguments[1]) else {emit(Result(ok: false, command: arguments.dropFirst().first ?? "unknown", state: .unknown, authorized: AXIsProcessTrusted(), action: "none", message: "usage: facetime-ax probe|call|answer|hangup <handle> <identity>", errorCode: "invalid-arguments"), exit: 2)@@ -29,25 +265,51 @@ guard arguments.count == 4, ["probe", "call", "answer", "hangup"].contains(argumlet command = arguments[1]let handle = arguments[2]let identity = arguments[3]-let authorized = AXIsProcessTrusted()-guard authorized else {+guard AXIsProcessTrusted() else {emit(Result(ok: false, command: command, state: .unknown, authorized: false, action: "none", message: "Accessibility permission is required", errorCode: "accessibility-denied"), exit: 1)}-// This phase deliberately fails closed. Future phases provide the verified AX-// element traversal; no coordinate click is ever acceptable here.-if command == "probe" {- emit(Result(ok: true, command: command, state: .idle, authorized: true, action: "probe", message: "Accessibility authorization granted", errorCode: nil))+let matcher = IdentityMatcher(handle: handle, identity: identity)+guard !matcher.phrases.isEmpty || !matcher.phoneNumbers.isEmpty else {+ emit(Result(ok: false, command: command, state: .unknown, authorized: true, action: "none", message: "Configured FaceTime identity is invalid", errorCode: "invalid-identity"), exit: 2)}-guard let escaped = handle.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),- let url = URL(string: "facetime-audio://\(escaped)") else {- emit(Result(ok: false, command: command, state: .unknown, authorized: true, action: "none", message: "Invalid FaceTime handle", errorCode: "invalid-handle"), exit: 2)+if command == "probe" {+ emit(Result(ok: true, command: command, state: probe(matcher: matcher), authorized: true, action: "probe", message: "FaceTime state inspected", errorCode: nil))}if command == "call" {- NSWorkspace.shared.open(url)- emit(Result(ok: false, command: command, state: .dialing, authorized: true, action: "open-url", message: "FaceTime opened; semantic AX confirmation is unavailable", errorCode: "ambiguous-surface"), exit: 1)+ guard let escaped = handle.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),+ let url = URL(string: "facetime-audio://\(escaped)"),+ NSWorkspace.shared.open(url) else {+ emit(Result(ok: false, command: command, state: .unknown, authorized: true, action: "none", message: "Invalid FaceTime handle", errorCode: "invalid-handle"), exit: 2)+ }+ guard let state = waitForState([.dialing, .connected], matcher: matcher, timeout: 5) else {+ ambiguous(command, state: .dialing)+ }+ emit(Result(ok: true, command: command, state: state, authorized: true, action: "open-url", message: "FaceTime call started", errorCode: nil))+}++if command == "answer" {+ let incoming = incomingAnswerControls(matcher: matcher)+ guard !incoming.incomplete, incoming.controls.count == 1 else {+ ambiguous(command, state: incoming.controls.isEmpty ? .idle : .dialing)+ }+ guard AXUIElementPerformAction(incoming.controls[0].element, kAXPressAction as CFString) == .success else {+ emit(Result(ok: false, command: command, state: .dialing, authorized: true, action: "none", message: "The matching answer control could not be pressed", errorCode: "action-failed"), exit: 1)+ }+ let state = waitForState([.connected], matcher: matcher, timeout: 5) ?? .connected+ emit(Result(ok: true, command: command, state: state, authorized: true, action: "press-notification-action", message: "Answered the incoming call", errorCode: nil))}-emit(Result(ok: false, command: command, state: .unknown, authorized: true, action: "none", message: "No unambiguous FaceTime surface naming \(identity) was found", errorCode: "ambiguous-surface"), exit: 1)+let applications = faceTimeApplications()+let controls = applications.flatMap { application -> [Node] in+ guard let result = snapshot(application), !result.truncated else { return [] }+ return matchingControls(nodes: result.nodes, matcher: matcher, words: hangupWords)+}+guard controls.count == 1 else { ambiguous(command, state: faceTimeState(matcher: matcher)) }+guard AXUIElementPerformAction(controls[0].element, kAXPressAction as CFString) == .success else {+ emit(Result(ok: false, command: command, state: .connected, authorized: true, action: "none", message: "The matching hang-up control could not be pressed", errorCode: "action-failed"), exit: 1)+}+let ended = waitForState([.ended, .idle], matcher: matcher, timeout: 5) ?? .ended+emit(Result(ok: true, command: command, state: ended, authorized: true, action: "press-call-action", message: "FaceTime call ended", errorCode: nil))diff --git a/server/services/voice/callSession.js b/server/services/voice/callSession.jsindex bb61183a73..1e0ac9f156 100644--- a/server/services/voice/callSession.js+++ b/server/services/voice/callSession.js@@ -382,10 +382,9 @@ export async function pollIncoming() {return { checked: false, reason: 'probe-failed' };}- // The helper reports nothing distinguishing "no call" from "a caller who is- // not the configured identity" — fail-closed at the helper boundary. Reused- // here: `authorized` on an idle-session probe means "the ringing caller- // matches the configured identity", never "no call at all".+ // The helper reports `dialing` only for a ringing notification whose caller+ // matches the configured identity. An unmatched caller is indistinguishable+ // from idle; `authorized` continues to mean the helper has AX permission.const ringing = Boolean(observed?.authorized) && observed?.state === 'dialing';if (!ringing) {incomingRingActive = false;diff --git a/server/services/voice/callSession.test.js b/server/services/voice/callSession.test.jsindex c2ee4514e0..7f72055cd8 100644--- a/server/services/voice/callSession.test.js+++ b/server/services/voice/callSession.test.js@@ -409,7 +409,7 @@ describe('FaceTime incoming-call watcher', () => {// The helper reports nothing distinguishing "no call" from "an// unauthorized caller" — fail-closed at the helper boundary. This is the// only shape an unmatched caller can produce.- probe.mockResolvedValue({ state: 'idle', authorized: false });+ probe.mockResolvedValue({ state: 'idle', authorized: true });attachHost(socket());const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {});diff --git a/server/services/voice/facetimeBridge.js b/server/services/voice/facetimeBridge.jsindex 7236dc121e..b2cf4b7789 100644--- a/server/services/voice/facetimeBridge.js+++ b/server/services/voice/facetimeBridge.js@@ -97,7 +97,11 @@ export async function checkSetup(config) {};}-const setupFailure = (report) => Object.entries(report).find(([, value]) => value.ok !== 'ok')?.[0] || null;+// Accessibility is enforced by the helper on every explicitly-triggered+// command. The status endpoint deliberately never spawns the helper, so its+// informational Accessibility row cannot be used as a command precondition.+export const blockingSetupFailure = (report) => Object.entries(report)+ .find(([key, value]) => key !== 'accessibility' && value.ok !== 'ok')?.[0] || null;async function assertAvailable(config) {if (!await isInstanceFeatureEnabled('facetime')) {@@ -113,7 +117,7 @@ export async function run(command, config) {if (!FACETIME_COMMANDS.includes(command)) throw new ServerError('Unknown FaceTime command', { status: 400, code: 'VALIDATION_ERROR' });await assertAvailable(voiceConfig);const report = await checkSetup(voiceConfig);- const missing = setupFailure(report);+ const missing = blockingSetupFailure(report);if (missing) throw new ServerError(`FaceTime setup incomplete: ${missing}`, { status: 409, code: missing });const result = await bufferedSpawn(facetimeHelperPath(), [command, voiceConfig.facetime.targetHandle, voiceConfig.facetime.targetName], { timeoutMs: FACETIME_TIMEOUT_MS });if (result.timedOut) throw new ServerError('FaceTime helper timed out', { status: 504, code: 'timeout' });diff --git a/server/services/voice/facetimeBridge.test.js b/server/services/voice/facetimeBridge.test.jsindex 9eeed0dff1..8ae30eab15 100644--- a/server/services/voice/facetimeBridge.test.js+++ b/server/services/voice/facetimeBridge.test.js@@ -1,5 +1,9 @@+import { mkdtempSync, rmSync, writeFileSync } from 'fs';+import { tmpdir } from 'os';+import { join } from 'path';+import { spawnSync } from 'child_process';import { describe, expect, it } from 'vitest';-import { CALL_AUDIO_DEVICE_RATE, FACETIME_COMMANDS, checkAudioDevice, checkSetup, facetimeControlResultSchema } from './facetimeBridge.js';+import { CALL_AUDIO_DEVICE_RATE, FACETIME_COMMANDS, blockingSetupFailure, checkAudioDevice, checkSetup, facetimeControlResultSchema } from './facetimeBridge.js';const device = (overrides = {}) => ({name: 'BlackHole 16ch',@@ -10,6 +14,45 @@ const device = (overrides = {}) => ({});describe('FaceTime Audio control protocol', () => {+ it.runIf(process.platform === 'darwin')('compiles the native helper and preserves its strict JSON boundary', () => {+ const sourceDir = join(import.meta.dirname, '..', '..', 'native', 'facetime-ax');+ const tempDir = mkdtempSync(join(process.env.PORTOS_TEST_TMPDIR || tmpdir(), 'portos-facetime-ax-'));+ const helper = join(tempDir, 'facetime-ax');+ try {+ const compiled = spawnSync('swiftc', ['-warnings-as-errors', join(sourceDir, 'identityMatcher.swift'), join(sourceDir, 'main.swift'), '-o', helper], { encoding: 'utf8' });+ expect(compiled.status, compiled.stderr).toBe(0);++ const probe = spawnSync(helper, ['probe', '+15551234567', 'Example Caller'], { encoding: 'utf8' });+ const parsed = JSON.parse(probe.stdout);+ expect(Object.hasOwn(parsed, 'errorCode')).toBe(true);+ expect(facetimeControlResultSchema.safeParse(parsed).success).toBe(true);+ } finally {+ rmSync(tempDir, { recursive: true, force: true });+ }+ });++ it.runIf(process.platform === 'darwin')('matches only the configured semantic identity', () => {+ const sourceDir = join(import.meta.dirname, '..', '..', 'native', 'facetime-ax');+ const tempDir = mkdtempSync(join(process.env.PORTOS_TEST_TMPDIR || tmpdir(), 'portos-facetime-identity-'));+ const runner = join(tempDir, 'main.swift');+ const binary = join(tempDir, 'identity-test');+ try {+ writeFileSync(runner, `import Foundation+let matcher = IdentityMatcher(handle: "+15551234567", identity: "Example Caller")+guard matcher.matches(["Incoming call from Example Caller"]) else { exit(1) }+guard matcher.matches(["Incoming call from +1 (555) 123-4567"]) else { exit(2) }+guard !matcher.matches(["Incoming call from Example Callers"]) else { exit(3) }+guard !matcher.matches(["Incoming call from +44 1555 123 4567"]) else { exit(4) }+`);+ const compiled = spawnSync('swiftc', ['-warnings-as-errors', join(sourceDir, 'identityMatcher.swift'), runner, '-o', binary], { encoding: 'utf8' });+ expect(compiled.status, compiled.stderr).toBe(0);+ const result = spawnSync(binary, [], { encoding: 'utf8' });+ expect(result.status, result.stderr).toBe(0);+ } finally {+ rmSync(tempDir, { recursive: true, force: true });+ }+ });+it('accepts only the strict helper result contract', () => {const result = facetimeControlResultSchema.safeParse({ok: true, command: 'probe', state: 'idle', authorized: true,@@ -64,6 +107,18 @@ describe('FaceTime Audio control protocol', () => {.rejects.toThrow();});+ it('leaves Accessibility enforcement to the explicitly invoked helper', () => {+ expect(blockingSetupFailure({+ helper: { ok: 'ok' },+ identity: { ok: 'ok' },+ accessibility: { ok: 'missing' },+ })).toBeNull();+ expect(blockingSetupFailure({+ helper: { ok: 'missing' },+ accessibility: { ok: 'missing' },+ })).toBe('helper');+ });+describe('answer command (phase 4 — inbound)', () => {it('is one of the commands the strict helper contract accepts', () => {expect(FACETIME_COMMANDS).toContain('answer');@@ -98,4 +153,3 @@ describe('FaceTime Audio control protocol', () => {});});});-